$(function(){
	// External Link
	var allowedDomains = [location.hostname];
	$("a[href^='http']")
	.filter(function(el){
		for(var i=0; i < allowedDomains.length; i++ )
			if ( this.href.indexOf(allowedDomains[i])>-1 ) return false;
			return true;
		})
	.bind("click", function(){ this.target='_blank'; });
	
	$("a[rel='external']").bind("click", function(){ this.target='_blank'; });


	/*Rollover*/
	$("a.pf_photo").live("click", function(){
		return false;
	});
	$("span", "a.pf_photo").live("mouseover",function(){
		$txtLoader = $(this);
		
		$wrapper   = $txtLoader.parent("a.pf_photo");
		imgHover   = $(this).parent("a").attr("href");

		if($(this).siblings(".pf_photo_h").is("img")){
			$(this).siblings(".pf_photo_h").fadeIn('fast');
		}else{
			var img = new Image();
			$(img).addClass("pf_photo_h");
			
			$(img).load(function () {
				$(this).hide();
				$wrapper.append(this);
				$(this).fadeIn('fast');
			})
			.error(function () {
				$txtLoader.text("Error");
			}).attr('src', imgHover);
		}
	}).live("mouseout",function(){
		$(this).siblings(".pf_photo_h").fadeOut();
	});
	
	
	/*List
	$("a", ".pf_list").bind("click", function(){
		objId = $(this).attr("id");
		objId = objId.replace("pf_", "");
		
		if(!$("#"+objId).is("DIV")){
			$(".pf_item:last").after('<div id="'+ objId +'"></div>');
			$("#" + objId).fadeIn("slow").load(this.href + " .pf_item");
		}
		
		location.href="#"+objId;
		return false;
	});*/
});


