function bigIMG(IMGName)
	{	
		var winRef;
		var page = "Viewer.asp?img=" + IMGName;
		winRef = window.open(page,'_IMG','scrollbars=no,left=10,right=10,width=550,height=550,resizable=0');	
	}
		
function toAscii(e)  
	{
		e = e || window.event;
		ch = e.which || e.keyCode;
		if( ch != null) 
		{
			if( (ch >= 48 && ch <= 57) || ch == 0 || ch == 8 || ch == 13 || ch == 9 ) 
			return true;
		}
		alert('Please enter a numeric value.');
		return false;
	}
		
var strM
strM = "";
function check_entry(user_val,strQtyF)
	{
		strM = "";
		var nQty = parseInt(user_val.value);
		var nQtyF = strQtyF;
		var nResult = nQty%nQtyF;
		if(nResult > 0)
		{
			var srtM1 =  nQtyF*1;
			var srtM2 =  nQtyF*2;
			var srtM3 =  nQtyF*3;
			var srtM4 =  nQtyF*4;
			strM = "items are sold in multiple of " + srtM1 + ". (" + srtM1 + ", " + srtM2 + ", " + srtM3 + ", " + srtM4 + ", etc.)";
			alert(strM);
			user_val.focus;
			user_val.select;
			user_val.value = "0";
			
			if (window.event) //IE
			{			 
			  window.event.returnValue = false;
			}
			else //Firefox
			{
			  event.preventDefault();
			}
		}
		if(checkint(user_val) == true)
		{
			user_val.style.backgroundColor='#E0E0E0';
		}
		else
		{
			user_val.value="0";
			user_val.style.backgroundColor='White';
		}
	}

function checkint(elm) 
	{
		
		var elmstr = elm.value + ""; 
		
		if (elmstr == "" || elmstr == "0")
		{
			return false;
		}
		
		if(elmstr.length > "0")
			{
				return true;
			}
	   
			if (elmstr < "0"){
				return false;
			}
			
		return true;
	}		

		
function AddToCart(itLoop)
	{	
		if(strM == "")
		{
			var strItems = "";
			var strQty = "";
			var stemp;
			var iLoop = document.frmSearch.QTYAmt.value;

			for(i=1;i<iLoop;i++)
			{
				stemp = "Qty0" + i;	
				try
				{
					var objtypetext = document.getElementById(stemp);					
					if( objtypetext.value > 0)
					{
						strItems = strItems + objtypetext.name + ",";						    
						strQty = strQty + objtypetext.value + ",";						    
						objtypetext.value = 0;
					}
				 }
				 catch(e)
				 {					 
				 }
			}
			
			if(strItems != "")
			{
				strQty = strQty.substr(0,strQty.length-1);
				strItems = strItems.substr(0,strItems.length-1);										
				document.frmSearch.action = "includes/AddToCart.asp?url=VC&qty=" + strQty + "&Ic=" + strItems + "&Type=I&EqCode="
				document.frmSearch.submit();
			}
			else
			{
				alert("Please entry quantity of products!!!");
			}
		}
	}

function ShowStock(obj,sQtyStock)
	{
		var objdiv = document.getElementById("divshowstock");
		var IE = document.all?true:false;
		//if (!IE) document.captureEvents(Event.MOUSEMOVE)

		if (IE) 
		{
			//X = event.clientX + document.body.scrollLeft;
			//Y = event.clientY + document.body.scrollTop;
			tempX = findPosX(obj);
			tempY = findPosY(obj) + 15;
	
		}
		else
		{
			tempX = findPosX(obj) + obj.offsetLeft;
			tempY = findPosY(obj) + 15;
		}
		objdiv.innerHTML= sQtyStock + "<br>In<br>Stock";
		objdiv.style.left = tempX;
		objdiv.style.top  = tempY;
	}
								
function findPosX(obj)
  {
	var curleft = 0;
	if(obj.offsetParent)
		while(1) 
		{
		  curleft += obj.offsetLeft;
		  if(!obj.offsetParent)
			break;
		  obj = obj.offsetParent;
		}
	else if(obj.x)
		curleft += obj.x;
	return curleft;
  }

function findPosY(obj)
  {
	var curtop = 0;
	if(obj.offsetParent)
		while(1)
		{
		  curtop += obj.offsetTop;
		  if(!obj.offsetParent)
			break;
		  obj = obj.offsetParent;
		}
	else if(obj.y)
		curtop += obj.y;
	return curtop;
  }
  
function EndShowStock()
  {
	 var odiv = document.getElementById("divshowstock");
	 odiv.innerHTML="";
  }
		  
function Checkpurchase(istock,obj)
  {
	if(istock < obj.value)
	{
		alert("The amount you order is more than our Stock Quantity of "+istock+". Please reduce the quantity amount.");
		obj.value = "0";
		event.returnValue = false;
	}
  }	

function doPopup(obj,strdate)
	{	
		obj.disabled=true;
		var objdiv = document.getElementById("divshowETA");
		document.getElementById("ETADate").innerHTML = strdate;
		var IE = document.all?true:false;
		
		if (IE) 
		{
			tempX = findPosX(obj)-70;
			tempY = findPosY(obj);
			objdiv.style.display = "";
			objdiv.style.left = tempX;
			objdiv.style.top  = tempY;
		}
		else
		{
			tempX = findPosX(obj)-200;
			tempY = findPosY(obj);
			objdiv.style.display = "";
			objdiv.style.left = tempX;
			objdiv.style.top  = tempY;		
		}			
	}

function closePopup(obj)
{
	var odiv = document.getElementById("divshowETA");
	var IE = document.all?true:false;
	
	if (IE) 
	{
		odiv.style.display ="none";	
	}
	else
	{
		odiv.style.display ="none";	
	}
}

function popup(cat)
{
  window.open("catpopup.asp?Item="+cat);
  return;
}