

/*
*
*
*
*/

function changeWholesaler(wholesaler){

	if(wholesaler == '') return
	window.location	= 'index.php?url=order-form-prize-draw&wholesaler=' + wholesaler + '#form_error';
}


/*
*
* externalLinks
*
*/

function externalLinks(){
	jQuery("a[href^='http:']").not("[href*='www.excelfeedingplan.com']").attr('target','_blank');
	jQuery("a[rel='external']").attr('target','_blank');
}

/*	--------------------------------------------------------------------------  */
/*	--------------	JQUERY DOCUMENT READY RUNTIME PROCESSES  -----------------  */
/*	--------------------------------------------------------------------------  */


$(document).ready(function(){
						
	//CUFON
	Cufon.replace('#top_nav li', {hover: {color: '#bed122'}});		
	Cufon.replace('h1');				
						
	//PARSE EXTERNAL LINKS
	externalLinks();
	
	//COMPETITION FORM
	$('#wholesaler').bind('change', function(){
		
		if($(this).val() == 'NVS')
		{
			$('#hidden-1').show();
		}		
	});
	$('#CVSPractice').click(function() { $('#hidden-2').show(); });	
	
	if(LAUNCH_GAME == true)
	{
	
		$("#launch-game").fancybox({
			'width'				: 900,
			'height'			: 800,
			'padding'			: 2,
			'autoScale'			: false,
			'transitionIn'		: 'elastic',
			'transitionOut'		: 'fade',
			'type'				: 'iframe',
			'centerOnScroll'	: true,
			'titleShow'			: false,
			'hideOnOverlayClick':false,
			'hideOnContentClick':false,
			'showCloseButton':false
		}).trigger('click');
	
	}
	else
	{
		$("a.playNow").fancybox({
			'width'				: 900,
			'height'			: 800,
			'padding'			: 2,
			'autoScale'			: false,
			'transitionIn'		: 'elastic',
			'transitionOut'		: 'fade',
			'type'				: 'iframe',
			'centerOnScroll'	: true,
			'titleShow'			: false,
			'hideOnOverlayClick':false,
			'hideOnContentClick':false,
			'showCloseButton':false
		});

	}
	
	$("a.fancybox").fancybox({
		'width'				: 800,
		'height'			: '95%',
		'padding'			: 0,
		'autoScale'			: false,
		'transitionIn'		: 'elastic',
		'transitionOut'		: 'fade',
		'type'				: 'iframe',
		'centerOnScroll'	: true,
		'titleShow'			: false,
		'hideOnOverlayClick':true,
      	'hideOnContentClick':false
	});
	
	$('.starOfTheShowJumpTo').click(
		function(e){
			//e.preventDefault();
			
			$.modal.close();
		}
	);
	
	$('.starOfTheShowVotingButton').click(
		function(e){
			e.preventDefault();
			
			starVotedFor = $(this).parent().attr('rel');
			
			//$('#starVotedFor').val(starVotedFor);
			
			$.post(
				'star-of-the-show-finalists.html',
				{
					excelStarOfTheShow: 1,
					submitForm: 1,
					starVotedFor: starVotedFor
				},
				function(data){
					//alert(data);
				}
			);
			
			$('#voteConfirmModal').modal({
				maxWidth: 700,
				zIndex:1000,
				overlayClose: true,
				closeClass: 'simplemodal-close'
			});
		}
	);
	
	$('.starOfTheShowInfo').click(
		function(e){
			/*
			e.preventDefault();
			
			starVotedFor = $(this).parent().attr('rel');
			
			$('#voteInfoModal .voteInfoModalBox').hide();
			$('#voteInfoModal .voteInfoModalBox[rel='+starVotedFor+']').show();
			
			$('#voteInfoModal').modal({
				maxWidth: 750,
				overlayClose: true,
				closeClass: 'simplemodal-close'
			});
			*/
		}
	);
	
});
