var headerImg = new Array();
var topbarImg = new Array();
var sidebarHeaderImg = new Array();
var headerImgCt = 0;
var topbarImgCt = 0;
var sidebarHeaderImgCt = 0;
var tempTopnav;
var tempBottomnav;
var tempBk;

function openReceipt() {
	popupWin = window.open('https://shop.naturalwellnessonline.com/popup-receipt.asp', '', 'toolbar=yes,scrollbars,resizable,width=700,height=500');
}
function openEAS() {
	popupWin = window.open('http://www.naturalwellnessonline.com/popeas.html', '', 'scrollbars,resizable,width=700,height=450');
}
function openCourse() {
	popupWin = window.open('http://www.naturalwellnessonline.com/popcourse.html', '', 'scrollbars,resizable,width=380,height=610');
}
function openSafelistWindow() {  
	popupWin = window.open('/email-safe-list.html', '', 'toolbar=yes,scrollbars,resizable,width=700,height=500');
}
function openWindow() {  popupWin = window.open('http://mail.mailordercentral.com/naturalwellness50/default.asp?item_url=http://shop.naturalwellnessonline.com/prodinfo.asp?number=N200&desc=UltraThistle™', '', 'scrollbars,resizable,width=550,height=450');
}
function openPrivacy() {  popupWin = window.open('http://naturalwellnessonline.com/privacy.htm', '', 'scrollbars,resizable,width=600,height=610');
}
function openSatis() {  popupWin = window.open('https://shop.naturalwellnessonline.com/guarantee.asp', '', 'scrollbars,resizable,width=600,height=610');
}
function openLongTermBen() {  popupWin = window.open('https://shop.naturalwellnessonline.com/long-term-benefits.asp', '', 'scrollbars,resizable,width=600,height=410');
}
function clearorder() {
	window.location="neworder2.asp";
}
function printWindow(){
	bV = parseInt(navigator.appVersion);
	if (bV >= 4) window.print();
}
/**
*
*	simpleTooltip jQuery plugin, by Marius ILIE
*	visit http://dev.mariusilie.net for details
*
**/
(function($){ $.fn.simpletooltip = function(){
	return this.each(function() {
		var text = $(this).attr("title");
		$(this).attr("title", "");
		if(text != undefined) {
			$(this).hover(function(e){
				var tipX = e.pageX + 12;
				var tipY = e.pageY + 12;
				$(this).attr("title", ""); 
				$("body").append("<div id='simpleTooltip' style='position: absolute; z-index: 100; display: none;'>" + text + "</div>");
				if($.browser.msie) var tipWidth = $("#simpleTooltip").outerWidth(true)
				else var tipWidth = $("#simpleTooltip").width()
				$("#simpleTooltip").width(tipWidth);
				$("#simpleTooltip").css("left", tipX).css("top", tipY).fadeIn("medium");
			}, function(){
				$("#simpleTooltip").remove();
				$(this).attr("title", text);
			});
			$(this).mousemove(function(e){
				var tipX = e.pageX + 12;
				var tipY = e.pageY + 12;
				var tipWidth = $("#simpleTooltip").outerWidth(true);
				var tipHeight = $("#simpleTooltip").outerHeight(true);
				if(tipX + tipWidth > $(window).scrollLeft() + $(window).width()) tipX = e.pageX - tipWidth;
				if($(window).height()+$(window).scrollTop() < tipY + tipHeight) tipY = e.pageY - tipHeight;
				$("#simpleTooltip").css("left", tipX).css("top", tipY).fadeIn("medium");
			});
		}
	});
}})(jQuery);

$(document).ready(function () {
	//$(window).unload( function () { alert("Bye now!"); } );
	$("#selectProd").change(function () {
		if ($(this).val() != "") {
			window.location.href = "/prodinfo.asp?number=" + $(this).val();
		}
	});
	$("div.rightSidebar input.searchTerm").focus(function () {
		$(this).val("");
		if ($("#searchTextBy").is(":hidden")) {
			$("#searchTextBy").slideDown("slow");
		}
	});
	$("div.footer input.searchTerm").focus(function () {
		$(this).val("");
	});
	$("p.displayCart a").click(function() {
		if ($("ul.cartItems").css("display") == "none") {
			$("ul.cartItems").slideDown("slow");
			$(this).html("- Hide items in cart");
		} else {
			$("ul.cartItems").hide();
			$(this).html("+ Show items in cart");
		}
	});
	$("ul.bottomNav li").mouseenter(function(){
		$(this).addClass("sfhover");
	});
	$("ul.bottomNav li").mouseleave(function(){
		$(this).removeClass("sfhover");
	});
	$("a.EASpop").click(function() {
		openEAS();
		return false;
	});
	$("a.longTermBen").click(function() {
		openLongTermBen();
		return false;
	});
	/*
	$("div.leftSidebar li a").mouseenter(function(){
		tempItem = $(this).parent().find("p.description");
		tempMid = ($(tempItem).height() / 2);
		tempMid = (-tempMid);
		$(tempItem).css("top",tempMid);
		$(tempItem).css("left","105%");
		$(tempItem).fadeTo(250,1);
	});
	$("div.leftSidebar li a").mouseleave(function(){
		$(this).parent().find("p.description").fadeTo(250,0,function() {
			$(this).css("left","-9999px");
		});
		
		//$(this).parent().find("p.description").css("opacity",0);
	});
	*/
	$("div.leftSidebar li ul li a").simpletooltip();
});