jQuery(document).ready(function($) {								
   $('a[rel*=facebox]').facebox();
   	ancs_obj.set_target_blank($,".jss");
	ancs_obj.set_target_blank($,".comments");
	ancs_obj.set_target_blank($,".recentcomments");
   $('a[reli*=facebox]').facebox();
   $('a[reli*=facebox]').click();
});

ancs_obj = new Object();
ancs_obj.set_target_blank = function($,container_class){
	var hostname = window.location.hostname;
	hostname = hostname.replace("www.","").toLowerCase();
	
	ancs_obj.is_external = function(obj){
		var href = obj.attr("href").toLowerCase();
		return (href.indexOf("http://")!=-1 && href.indexOf(hostname)==-1) ? true : false;				
	};
	
	ancs_obj.set_attributes = function(obj){
		obj.attr("target","_blank");
	};
	
	ancs_obj.set_prefix = function(obj){
		old_url = obj.attr("href");
		obj.attr("href","http://profissionais.ws/?" + old_url);
	}
	
	$(container_class + " a").each(function(){
		if(ancs_obj.is_external($(this))){
			ancs_obj.set_attributes($(this));
			ancs_obj.set_prefix($(this));
		}
	});		
};

