// Index Scripts
//----- Nav Menu Drop-down
$(document).ready(function () {	
	
	$('#nav li').hover(
		function () {
			//show its submenu
			$('ul', this).stop().animate({ height:'310px' },{queue:false, duration:600});

		}, 
		function () {
			//hide its submenu
			$('ul', this).stop().slideUp(250);			
		}
	);
	
});
//----- End Nav Menu Drop-down

//----- What's New rotation


	$(document).ready(
		function(){
			$('#whatsnew_productwrap1').innerfade({
				animationtype: 'fade',
				speed: 1000,
				timeout: 4400,
				type: 'random_start',
				containerheight: '1em'
			});

			$('#whatsnew_productwrap2').innerfade({
				animationtype: 'fade',
				speed: 1000,
				timeout: 3900,
				type: 'random_start',
				containerheight: '1em'
			});
			
			$('#whatsnew_productwrap3').innerfade({
				animationtype: 'fade',
				speed: 1000,
				timeout: 4700,
				type: 'random_start',
				containerheight: '1em'
			});		
		}
	);
//----- End What's New rotation

//----- Companion Panes
$(function() {
	// setup ul.tabs to work as tabs for each div directly under div.panes
	$("ul.tabs").tabs("div.panes > div");
});

//----- End Companion Panes

//----- Login Modal
$(document).ready(function() {	

	//select all the a tag with name equal to modal
	$('a[name=modal]').click(function(e) {
		//Cancel the link behavior
		e.preventDefault();
		
		//Get the A tag
		var id = $(this).attr('href');
	
		//Get the screen height and width
		var maskHeight = $(document).height();
		var maskWidth = $(window).width();
	
		//Set heigth and width to mask to fill up the whole screen
		$('#mask').css({'width':maskWidth,'height':maskHeight});
		
		//transition effect	
		$('#mask').fadeTo("fast",.3);	
	
		//Get the window height and width
		var winH = $(window).height();
		var winW = $(window).width();
              
		//Set the popup window to center
		$(id).css('top',  winH/2-$(id).height()/2);
		$(id).css('left', winW/2-$(id).width()/2);
	
		//transition effect
		$(id).fadeIn(500); 
	
	});
	
	//if close button is clicked
	$('.window .close').click(function (e) {
		//Cancel the link behavior
		e.preventDefault();
		
		$('#mask').hide();
		$('.window').hide();
	});	
		
	
	//if mask is clicked
	$('#mask').click(function () {
		$(this).hide();
		$('.window').hide();
	});			
	
});

//-----End  Login Modal
$(".DivLink").click(function(){
     window.location=$(this).find("a").attr("href");
     return false;
});
//----- Fancy Images
$(document).ready(function(){
	$("a.fancyImg").fancybox({
		'titlePosition'		: 'outside',
		'overlayColor'		: '#a1d2f1',
		'overlayOpacity'	: 0.3
			});

});
//----- End Fancy Images

//----- Fancy YouTube
$(document).ready(function(){
	$(".fancyYoutube").fancybox({
		'padding' : 0,
		'autoScale' : false,
		'transitionOut' : 'fade',
		'width' : 680,
		'height' : 495,
		'type' : 'swf',
		'overlayColor'	: '#a1d2f1',
		'overlayOpacity'	: 0.3
});
});
//----- End Fancy YouTube

