// JavaScript Document

function simpleGalleryInit () {
	var mygallery=new simpleGallery({
		wrapperid: "simplegallery1", //ID of main gallery container,
		dimensions: [550, 305], //width/height of gallery in pixels. Should reflect dimensions of the images exactly
		imagearray: [
			["/v/vspfiles/templates/zev1/images/HomePage/_rocketSlider/2010_01_tea_forte.jpg", "/tea-forte-s/927.htm", "_self", "CoffeeRocket.com proudly presents Tea Forte"],
			["/v/vspfiles/templates/zev1/images/HomePage/_rocketSlider/2010_01_blog.jpg", "http://www.coffeeamp.com", "_new", "Check out our new blog! www.CoffeeAmp.com"],
			["/v/vspfiles/templates/zev1/images/HomePage/_rocketSlider/2009_09_facebook_twitter.jpg", "http://www.facebook.com/coffeerocket", "_new", "Join CoffeeRocket.com on Facebook and Twitter - follow us for exclusive coupons, promotions & giveaways!"],
			["/v/vspfiles/templates/zev1/images/HomePage/_rocketSlider/2009_09_tassimo.jpg", "/Tassimo-Coffee-T-Discs-Bosch-Coffee-Machines-s/448.htm", "_self", "New on CoffeeRocket.com Tassimo TDISC Hot Beverage System and Bosch TDISC Makers"],
			["/v/vspfiles/templates/zev1/images/HomePage/_rocketSlider/2009_03_lavazza.jpg", "/Lavazza-Espresso-Whole-Bean-Espresso-Ground-Espresso-s/43.htm", "_self", "New on CoffeeRocket.com - Lavazza's full lineup of Lavazza Espresso products like: Lavazza Point Espresso, Lavazza Point Machines, Lavazza Espresso Pods, Lavazza Whole Bean Espresso, Lavazza Ground Espresso and Lavazza Espresso Capsules to name a few"],
			["/v/vspfiles/templates/zev1/images/HomePage/_rocketSlider/2008_12_welcome.jpg", "/", "_self", "We offer a huge selection of single serve coffee & tea like: Flavia, Keurig, Wolfgang Puck, Melitta One, Bigelow, Tetley, Tazo. More products added weekly! Can't find what you're looking for? Give us a call and we'll do our best to accommodate your needs."]
			
		],
		autoplay: [true, 6000, 6], //[auto_play_boolean, delay_btw_slide_millisec, cycles_before_stopping_int]
		persist: true, //remember last viewed slide and recall within same session?
		fadeduration: 800, //transition duration (milliseconds)
		oninit:function(){ //event that fires when gallery has initialized/ ready to run
			//Keyword "this": references current gallery instance (ie: try this.navigate("play/pause"))
		},
		onslide:function(curslide, i){ //event that fires after each slide is shown
			//Keyword "this": references current gallery instance
			//curslide: returns DOM reference to current slide's DIV (ie: try alert(curslide.innerHTML)
			//i: integer reflecting current image within collection being shown (0=1st image, 1=2nd etc)
		}
	})	
}


function checkCartForFreeShip () {
	var myURL = document.URL;
	myURL = myURL.toLowerCase();
	if (myURL.search("shoppingcart.asp") > 0) {
		if ($('#content_area div b:contains("Total:")')) {
			var priceString = $('#content_area font.pricecolor b:contains("$")').text();
			var priceString2 = 75.00 - priceString.substr(priceString.indexOf("$")+1,5);
			if (priceString2 > 0) {
				$('#content_area div').eq(0).after('<div class="InfoMessage">Free domestic shipping on orders over <strong>$75</strong>. Add <strong>$' + priceString2.toFixed(2) + '</strong> more to ship free!</div>');
			}
		}
	} // end top if
}



function productMenu () {
	
	var navLiWidth = 980 / $(".prodMenuItem").size();
	
	//alert($(".prodMenuWrapper").width());
	$(".prodMenuItem").width(navLiWidth -20);
		
	$('.activateProductMenu').click(function () {
		$('#crProductMenu').slideToggle("fast");
		
	}); // end click
	
}

function subCattMenu () {
	
	var isActive = false;
	
	$('.moreInfo').click(function () {
		$('.subCatMoreToggle').slideToggle("fast", switchBtn());
		
	}); // end click
	
	function switchBtn(isAct) {
		if ($('.moreInfo').text() == 'more +') {
			$('.moreInfo').text('close -');
		} else {
			$('.moreInfo').text('more +'); 
		}
	}
	
	$('#content_area table').eq(6).attr( {cellpadding : 0 , cellspacing: 0 } ); 
}

function addCartClone () {
	
	if ($('td.colors_backgroundlight input')) {
		$('form.search_results_section table').eq(4).addClass('myTable');
		$('td.colors_backgroundlight input').parent('td').parent('tr').clone().prependTo('form.search_results_section table.myTable').addClass('myAddToCart');;
		$('.myAddToCart td').html('To add the below items to your cart, click the "Add" checkboxes then click "Add To Cart" &gt;&gt;&gt; <input value="Add To Cart" onclick="refineResults=false;" name="checkboxes_mode_submitbtn" type="submit">');
	}

	
}

