﻿
showLog = true;
function log(m) { if (window.console && showLog) { console.log(m); } }


// Landing Page custom jQuery

var ImagePreload = function () {
	
	if ($('#notcalifornia').length > 0)
		{
		var Images = 
			[
			'Images/Landing/landing_products-over.png', 
			'Images/Landing/landing_dannon-products.png', 
			'Images/Landing/landing_pod1_over2.png', 
			'Images/Landing/landing_pod1.png', 
			'Images/Landing/landing_pod2_over2.png', 
			'Images/Landing/landing_pod2.png'
			] 
		}

	if ($('#california').length > 0)
		{ 
		var Images = 
			[
			'Images/Landing/geotargeting/products_over.png', 
			'Images/Landing/geotargeting/products_over.gif',
			'Images/Landing/geotargeting/products/canoe_bg.jpg',
			'Images/Landing/geotargeting/products/family_on_beach_bg.jpg',
			'Images/Landing/geotargeting/products/groovier_bg.jpg',
			'Images/Landing/geotargeting/products/runner_bg.jpg'
			] 
		}
		
	//log("i: "+Images.length);

	for (var i = 0; i < Images.length; ++i) {
		$('<img/>').attr('src', Images[i]);
	}
};


$(document).ready(function () {

	// preload
	ImagePreload();

	//non-california products rollover
	$('.Landing_Dannon_Products img').hover(function () {
		$(this).attr("src", "Images/Landing/product_lineup/products_over.png");
	}, function () {
		$(this).attr("src", "Images/Landing/product_lineup/products.png");
	});

	// california products rollover
	$('.geoproducts img').hover(function () {
		$(this).attr("src", "Images/Landing/product_lineup/products_over.png");
	}, function () {
		$(this).attr("src", "Images/Landing/product_lineup/products.png");
	});





	// footer rollovers

	/*	$('.landingPod1 img').hover(function () {
	$(this).attr("src", "Images/Landing/landing_pod1_over2.png");
	}, function () {
	$(this).attr("src", "Images/Landing/landing_pod1.png");
	});*/

	$('.landingPod2 img').hover(function () {
		$(this).attr("src", "Images/Landing/landing_pod2_over2.png");
	}, function () {
		$(this).attr("src", "Images/Landing/landing_pod2.png");
	});


	//Landing Page transitions
	$('#content').cycle({
		timeout: 6000, // slide time
		speed: 1500,  // transistion speed
		random: 0, // Randomizes slides
		//pause: 1, // Pause on Hover
		delay: 1000 // Time until first transition
	});

});
