// JavaScript Document

var timer1;
var timer2;
var timer3;

function hideMenu(id) {
	setTimeout("hideME('"+id+"')",500);
}

function cancelHide() {
	clearTimeout();
}

function showAddCart(id) {
	var popDiv = top.document.getElementById(id);
	popDiv.style.display = 'block';
	setTimeout('hideME("'+id+'")',3000);	
}

function showLogin(id) {
	var popDiv = top.document.getElementById(id);
	var doc;

	if (document.documentElement) { // poor-man's check for DOC TYPE
		doc = top.document.documentElement;
	} else {
		doc = document.body;
	}

	scrollTop = doc.scrollTop;
	if (scrollTop <= 180) {
		yPos = 180;
	} else {
		yPos = scrollTop + 10;
	}
	
	popDiv.style.display = 'block';
	popDiv.style.right = '10px';
	popDiv.style.top = yPos+'px';
}

function showBuyNow(prodName,prodID) {
	var obj = doScrn();

	var popDiv = top.document.getElementById('buynowDiv');
	var popDivHdr = top.document.getElementById('buynowHdrText');
	var popFrame = top.document.getElementById('buynowFrame');

	if (popFrame.contentWindow.document.body.innerText != "")
	{
		// Clear iFrame results from last time it was displayed
		popFrame.contentWindow.document.body.innerText = "";
	}

	var d = new Date();
	popFrame.src = '/ax_commerce/ifr_buynow.cfm?item='+prodID+'&rand='+d.getTime();
	popDivHdr.innerHTML = prodName;
	popDiv.style.display = 'block';
	divWidth = popDiv.offsetWidth;
	divHeight = popDiv.offsetHeight;
	
	xPos = (obj.winWidth - divWidth)/2;
	yPos = (obj.winHeight - divHeight)/2 + obj.scrollTop;

	popDiv.style.left = xPos+'px';
	popDiv.style.top = yPos+'px';
}

function showLarge(image) {
	var obj = doScrn();	

	var popDiv = top.document.getElementById('largeDiv');
	var imgLarge = top.document.getElementById('largeImg');
	
	imgLarge.src = image;	
	popDiv.style.display = 'block';
	divWidth = popDiv.offsetWidth;
	divHeight = popDiv.offsetHeight;
	
	var xPos = (obj.winWidth - divWidth)/2;
	var yPos = (obj.winHeight - divHeight)/2 + obj.scrollTop;

	popDiv.style.left = xPos+'px';
	popDiv.style.top = yPos+'px';
	
	// alert ('div width: '+imgWidth+' | div height: '+imgHeight+' | caption width:'+capWidth+'');
}

function selectImage(id,img) {
	var option = document.getElementById(id).selectedIndex;
	var image = document.getElementById(img);
	
	if (option == 1 | option == 2) {
		image.src = "/_media/cvv2_visamc.gif";
	} else if (option == 3) {
		image.src = "/_media/cvv2_amex.gif";
	} else if (option == 4) {
		image.src = "/_media/cvv2_discover.gif";
	} else {
		image.src = "/_media/spacer.gif";
	}
}

var status = 0;
function showMEDelay(myDelay)
{
	status = 1;
	window.setTimeout('showMEStub()', myDelay);	
}

function showMEStub()
{
	 
	if (status==1)
	{
		showME('artsupplies_links');showME('writing_links');showME('industrial_links');
		status = 1;
	}
}

function hideMEDelay(myDelay)
{
	status = 0;
	window.setTimeout('hideMeStub()', myDelay);
	 
}

function hideMeStub()
{
 
	if (status==0)
	{
		hideME('artsupplies_links');hideME('writing_links');hideME('industrial_links');
		status = 0;
	}
}
