//Delish custom functions
$(document).ready(function() {
	//ShowTextHolder();
	SetupMenu();
	SetupMailingList();
});

function SetupMenu() {
	$('#PrimaryNav li a').hover(
		function() {
			$(this).children('img').attr('src', $(this).children('img').attr('src').replace('_normal', '_rolloveron'));
		},
		function () {
			$(this).children('img').attr('src', $(this).children('img').attr('src').replace('_rolloveron', '_normal'));
		}
	);
	$('a#mailing-list').hover(
		function() {
			$(this).children('img').attr('src', $(this).children('img').attr('src').replace('_normal', '_rolloveron'));
		},
		function () {
			$(this).children('img').attr('src', $(this).children('img').attr('src').replace('_rolloveron', '_normal'));
		}
	);
}

function SetupMailingList(){
	$("a#mailing-list").fancybox({
		'transitionIn'	:	'elastic',
		'transitionOut'	:	'elastic',
		'speedIn'		:	600, 
		'speedOut'		:	200, 
		'overlayShow'	:	true,
		'titleShow'		:	false,
		'hideOnOverlayClick'	:	false,
		'hideOnContentClick'	:	false
	});	
	$("a#quote-request").fancybox({
		'transitionIn'	:	'elastic',
		'transitionOut'	:	'elastic',
		'speedIn'		:	600, 
		'speedOut'		:	200, 
		'overlayShow'	:	true,
		'titleShow'		:	false,
		'hideOnOverlayClick'	:	false,
		'hideOnContentClick'	:	false
	});
	$("a#email-us-link").fancybox({
		'transitionIn'	:	'elastic',
		'transitionOut'	:	'elastic',
		'speedIn'		:	600, 
		'speedOut'		:	200, 
		'overlayShow'	:	true,
		'titleShow'		:	false,
		'hideOnOverlayClick'	:	false,
		'hideOnContentClick'	:	false
	});
	$("a.mailing-list-link").fancybox({
		'transitionIn'	:	'elastic',
		'transitionOut'	:	'elastic',
		'speedIn'		:	600, 
		'speedOut'		:	200, 
		'overlayShow'	:	true,
		'titleShow'		:	false,
		'hideOnOverlayClick'	:	false,
		'hideOnContentClick'	:	false
	});
}

function ShowTextHolder() {
	$.timer(750, function(timer) {
		$("#homepage-rotate-content").animate({
				opacity:"1.0" //how to do ie one?
			},
			{ duration:2000,easing:'easeOutCubic'}
	  );
	});
	SlideTextIn();
}

function SlideTextIn() {
	$.timer(750, function(timer) {
		$("#homepage-rotate-text-holder").animate({
				bottom:"0px",
				opacity:"1.0" //how to do ie one?
			},
			{ duration:950,easing:'easeOutCubic'},
			DoZoomPan()
	  );
	});
}

function DoZoomPan() {
	$.timer(500, function(timer) {
		$("#image-window > img").animate({
			 left: "0px", 
			 top: "0px", 
			 width: "900px",
			 height: "495px"
			 }, 
			 { duration:9000,easing:'easeOutCubic'}
			 );
	});
}
