// JavaScript Document




// --------------------------------------------------------------------------------- Setup Colorbox Lightboxes 

$(document).ready(function(){  

	$(".colorbox-promo").colorbox({
			transition:"elastic",
			initialWidth:"100%",
			initialHeight:"100%",
			opacity:1,
			speed:500,
			width:"760", 
			height:"380", 
			inline:true, 
			href:"#promo", 
			onClosed: function(){ backAddress(); }
	});


	$(".colorbox-promo-vid").colorbox({
			transition:"elastic",
			initialWidth:"100%",
			initialHeight:"100%",
			opacity:1,
			speed:500,
			width:"660", 
			height:"430", 
			inline:true, 
			href:"#promo_youtube", 
			onClosed: function(){ backAddress(); }
	});
	

	$(".colorbox-psdetails").colorbox({
			width:"700", 
			height:"540", 
			opacity:1,
			inline:true, 
			href:"#psdetails",
			onClosed: function(){ backAddress(); }
	});
	
	$(".colorbox-psrewards").colorbox({
			initialWidth:1,
			initialHeight:1,
			speed:500,
			iframe:true, 
			innerWidth:660, 
			innerHeight:480,
			opacity:1,
			onClosed: function(){ backAddress(); }
	});
	
	$(".colorbox-contactus").colorbox({
			initialWidth:1,
			initialHeight:440,
			speed:500,
			iframe:true, 
			innerWidth:660, 
			innerHeight:500,
			opacity:1,
			onClosed: function(){ backAddress(); } /*  IE back address takes you too far back with iframe for some reason */
	});
	
	$(".colorbox-sizechart").colorbox({
			initialWidth:630,
			initialHeight:1,
			speed:500,
			iframe:true, 
			innerWidth:660, 
			innerHeight:480,
			opacity:1,
			onClosed: function(){ backAddress(); }
	});
	
	$(".colorbox-styleguide").colorbox({
			initialWidth:700,
			initialHeight:1,
			speed:500,
			iframe:true, 
			innerWidth:700, 
			innerHeight:400,
			opacity:1,
			onClosed: function(){ backAddress(); }
	});

	$(".colorbox-brands").colorbox({
			iframe:true, 
			initialWidth:"1%",
			initialHeight:"1%",
			speed:500,
			opacity:1,
			innerWidth:840, 
			innerHeight:520,
			onClosed: function(){ backAddress(); } /*  IE back address takes you too far back with iframe for some reason */
	});

// --------------------------------------------------------------------------------- Setup tool tips 

	


});	
	
	
	
	
function cleanNav() {
		var oldSelected = $('.active');
		var oldItem = $('.currentitem');

		oldSelected.addClass('oldSelected');
		oldSelected.removeClass('active');
		oldItem.addClass('oldItem');
		oldItem.removeClass('currentitem');
}
function revertNav() {
		$('.oldSelected').addClass('active');
		$('.oldSelected').removeClass('oldSelected');
		$('.oldItem').addClass('currentitem');
		$('.oldItem').removeClass('oldItem');
}


function backAddress() {
	//history.back();
	if ($.address.hash != null) { $.address.title($.address.title().split(' | ')[0] + ' | ' + $.address.hash().replace('_', ' ')); }
	else { $.address.title('Peter Shearer'); }  
	}




