// JavaScript Document

function hideDiv(pass) { 
	var divs = document.getElementsByTagName('div'); 
	for(i=0;i<divs.length;i++) { 
		if(divs[i].id.match(pass)) { //if they are 'see' divs 
			if (document.getElementById) { // DOM3 = IE5, NS6 
				divs[i].style.visibility="hidden"; // show/hide 
			}
			else {
				if (document.layers) { // Netscape 4 
					document.layers[divs[i]].display = 'hidden'; 
				}
				else { // IE 4 
					document.all.hideShow.divs[i].visibility = 'hidden'; 
				}
			}
		}
	}
}

function showDiv(pass) { 
	var divs = document.getElementsByTagName('div'); 
	for(i=0;i<divs.length;i++) { 
		if(divs[i].id.match(pass)) { 
			if (document.getElementById) {
				divs[i].style.posLeft = document.body.scrollLeft + 0; // reposition layer to HERE
        		divs[i].style.posTop = document.body.scrollTop + 0; 
		  		divs[i].style.visibility="visible"; 
			}
			else { 
				if (document.layers) { // Netscape 4 
					document.layers[divs[i]].display = 'visible'; 
				}
				else { // IE 4 
					document.all.hideShow.divs[i].visibility = 'visible'; 
				}
			}
		}
	}
}


// ZOOM WINDOW FOR PRODUCT ZOOM.  
// url = path to zoom image
function openZoomWindow(url) {

	var myWidth = 320;
	var myHeight = 320;
	var myLeft = 20;
	var myTop = 20;
	
	var zoomWindow = window.open(url, 'zoom', 'scrollbars=no,titlebar=no,location=no,status=no,toolbar=no,width='+myWidth+',height='+myHeight+',top='+myTop+',left='+myLeft);

	zoomWindow.focus();
}



// ZOOM WINDOW FOR ESSENTIAL OIL DETAIL.  
// url = path to zoom image
function openEssentialOilWindow(url) {

	var myWidth = 520;
	var myHeight = 500;
	var myLeft = 20;
	var myTop = 20;
	
	var zoomWindow = window.open(url, 'zoom', 'scrollbars=no,titlebar=no,location=no,status=no,toolbar=no,width='+myWidth+',height='+myHeight+',top='+myTop+',left='+myLeft);

	zoomWindow.focus();
}



// ZOOM WINDOW FOR PRESS PHOTO ZOOM.  
// url = path to zoom image
function openPressZoom(url) {

	var myWidth = 640;
	var myHeight = 540;
	var myLeft = 0;
	var myTop = 0;
	
	var zoomWindow = window.open(url, 'zoom', 'scrollbars=yes,titlebar=no,location=no,status=no,toolbar=no,width='+myWidth+',height='+myHeight+',top='+myTop+',left='+myLeft);

	zoomWindow.focus();
}


function simple_popup(url, name, w, h) {
    my_simple_popup = open("" + url, name, "width=" + w + ",height=" + h +", scrollbars=yes, resizable=yes, status=yes");
}


function submitFormWithEvent(theEvent)
{
   var theForm = document.forms[0];

   theForm.event.value = theEvent;
   theForm.submit();
}

function addtocart() {
   var theForm = document.forms[0];
   theForm.sku.value = current_sku;
   theForm.submit();
}

function addtocart2() {
   var theForm = document.forms[0];
   theForm.submit();
}

function inline_addtocart (sku, qty, oEvent) {
	if (isKHTML) {
		x = oEvent.clientX;
		y = oEvent.clientY;
	}
	else {
		x = oEvent.clientX + document.body.scrollLeft;
		y = oEvent.clientY + document.body.scrollTop;
	}
	document.getElementById('div_inline_addtocart').style.display = 'block';
	document.getElementById('div_inline_addtocart').style.position = 'absolute';
	document.getElementById('div_inline_addtocart').style.top = y-58;
	document.getElementById('div_inline_addtocart').style.left = x-95;
	document.getElementById('iframe_inline_addtocart').src = 'cart-add.php?show_cart=no&sku=' + sku + '&qty=' + qty;
}

function swap(sku) {
	location.href='?sku='+sku;
}

function video_popup(clip) {
	window.open('popup-video.php?clip='+clip,'popup_video','width=400,height=326,top=160,status=0,resizable=0,scrollbars=0');
}
