// JavaScript Document
$(document).ready(function(){
	
	Cufon.now();
	
	$('a.blank').each(function(){
		$(this).attr({target:'_blank'});
	});
	
	
	
	
	///////////////////////////////////////////////////////////////////////////////////////////////////////
	//Function to add email to dom
	addEmailLinksToDom = function(data){
		if(typeof(data)=='object' && data.SUCCESS)
		{
			$('.siteEmail').each(function(){
				$(this).append('- <a href="mailto:' + data.SITEEMAIL + '">' + data.SITEEMAIL + '</a>');
			});
		}
	}
	//AJAX - get emails from server to append to dom
	$.ajax({
		url: "/switch.htm",
		type: "POST",
		data: ({method: 'getEmails'}),
		dataType: "json",
		async:true,
		success: function(data){ addEmailLinksToDom(data); }
	});
	///////////////////////////////////////////////////////////////////////////////////////////////////////
	
	
	
	
	///////////////////////////////////////////////////////////////////////////////////////////////////////
	//Add count down info to dom
	addCountDownSWFToDom = function(data){
		if(typeof(data)=='object' && data.SUCCESS)
		{
			$('#mod-count-down-wrapper').append(data.RETURNHTML);
		}	
	}
	//Get count down swf
	if($('#mod-count-down-wrapper').length)
	{
		$.ajax({
			url: "/switch.htm",
			type: "POST",
			data: ({method: 'getCountDownHTML'}),
			dataType: "json",
			async:true,
			success: function(data){ addCountDownSWFToDom(data); }
		});
	}
	///////////////////////////////////////////////////////////////////////////////////////////////////////
	
	
faceBoxAppendDataScreen = function(data,contentWidth){
	if($('#facebox').length)
	{
		var screenWidth = $(window).width() / 2;
		screenWidth = screenWidth - (contentWidth/2);
		$('#facebox').css({left:screenWidth});
		$('#facebox .content').css({width:contentWidth});
		$('#facebox .content').append(data);
		Cufon.replace('h2.faceBoxPopupHeader', { fontFamily: 'Swis721 BlkCn BT'});
		$('#facebox a.blank').each(function(){
			$(this).attr({target:'_blank'});
		});
		
	}
}











		
});
