// Master JavaScript Document

$(document).ready(function(){
	// Cufon.replace('h1', { fontSize: '34px' });
	// Cufon.replace('h1 span', { fontSize: '16px' });
	
	//external links
	$("a[rel=external]").attr('target', '_blank');
	
	//video
	var strFlashMessage = "<div id=\"theVideo\"><p>We could not detect an up to date version of the <a href=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\">Flash Player</a> installed on your machine, this site requires flash. You will not be able to view all of the content on this site without the flash player installed.</p></div>";
	
	
	$("#videoHolder").html(strFlashMessage);
	$("#videoHolder").hide();
	$("#video img.close").hide();
	$(".video #videoHolder").show();
	
	$("a.play").click(function() {
		$("#video").addClass("playing");
		$(this).parents().find("a.play").show();
		$(this).hide();
		$(this).parents().find("#videoHolder").show();
		$(this).parents().find("img.close").show();
		var flashvars = {
			//file: "home.flv"
		}; 
		var params = { 
			wmode: "transparent",
			allowfullscreen: true
		};
		var attributes = { 
		}; 
		swfobject.embedSWF("video.swf?" + $(this).attr("rel"), "theVideo", "550", "310", "9.0.0", "", flashvars, params, attributes);												 
		
		location.href = "#header";
		return false;	
	});
	
	$("#video img.close").click(function() {
		$("#video").removeClass('playing');
		$(this).hide();
		$(this).parent().find("#videoHolder").hide();
		$(this).parents().find("a.play").show();
		$(this).parent().find("#videoHolder").html(strFlashMessage);												 
		return false;	
	});
	
	
	
});

function fncVideoAutoClose() {
	$("#video img.close").click(); //auto close player
}
