// JavaScript Document
function itemPop(item) {
	
	popUpWindowItem("/item/index.php?item=" + item, 100, 100, 340, 520); 
	return false;
}

function popUpImg(src,w,h,title) {
	popUpWindowItem("/item/img.php?src=" + src + "&w=" + w + "&title=" + title, 100, 100, w, h); 
	return false;
}

var popUpWin=0;
function popUpWindowItem(URLStr, left, top, width, height)
{
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}

function getTarget(target) {
 	if(document.all) {
		obj = document.all[target];
	} else {
		obj = document.getElementById(target);
	}
	return obj;
}

function showhide(id) {
	mytarget = getTarget(id);
	if(mytarget.style.display=='none' || mytarget.style.display=='') {
		mytarget.style.display='inline';
	} else {
		mytarget.style.display='none';
	}
}

function popUpWindow(URLStr, left, top, width, height)
{
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbar=no,resizable=yes,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}

function addToCart(item,doclose) {
	var qty = getTarget("itemQuantity").value;
	if(qty != "" && qty != "Qty") {
		if(doclose == 1) {
			opener.location.href='/orderEntry/index.php?item=' + item + '&qty=' + qty;
			window.close();
		} else {
			location.href='/orderEntry/index.php?item=' + item + '&qty=' + qty;
		}
	} else { 
		alert("Please enter a quantity");
	}
}
