﻿    function fnTrapKD(btn) {
        if (document.all) {
            if (event.keyCode == 13) {
                event.returnValue = false;
                event.cancel = true;
                btn.click();
            }
        }
        else if (document.getElementById) {
            if (event.which == 13) {
                event.returnValue = false;
                event.cancel = true;
                btn.click();
            }
        }
        else if (document.layers) {
            if (event.which == 13) {
                event.returnValue = false;
                event.cancel = true;
                btn.click();
            }
        }
    }


    function pageNavGoBack(formid)
    {
        document.getElementById("move" + formid).value = "prev";
        document.getElementById("pageview" + formid).submit();
    }

    function pageNavGoNext(formid)
    {
        document.getElementById("move" + formid).value = "next";
        document.getElementById("pageview" + formid).submit();
    }   
	function openpopup(url, width, height)
	{
	  day = new Date(); id = day.getTime(); 
	  eval("page" + id + " = window.open(url, '" + 'popup' + "','toolbar=0, scrollbars=0, location=0, statusbar=0, resizable=yes, menubar=0, width=' + width + ', height=' + height + ', left = 50, top = 50');");
	}
	function openscrollingpopup(url, width, height)
	{
	  day = new Date(); id = day.getTime(); 
	  eval("page" + id + " = window.open(url, '" + 'popup' + "','toolbar=0, scrollbars=1, location=0, statusbar=0, resizable=yes, menubar=0, width=' + width + ', height=' + height + ', left = 50, top = 50');");
	}	
	function popUpImage(ProductName, ImageName)
	{
	    window.open("/Products/ImageView.asp?img=/Products/i/" + ImageName + "&name=" + ProductName + "', 'superSize', 'toolbar=0,scrollbars=auto,location=0,statusbar=0,menubar=0,width=200,height=200,left=50,top=50");
	}
	function sizeWindow(height, width)
	{
	    height = height + 250;
	    width = width + 75;
	    if (height > 950) {height = 950;}
	    if (width > 1000) {width = 1000;}
	    window.resizeTo(width, height);
	}
	function changeQuantitySelector(id, changeby)
	{
	    var ctlName = 'qty_' + id;
	    
	    // find control
	    var qtyBox = document.getElementById(ctlName)
	    
	    // read the current quantity
	    var curQty = qtyBox.value;
	    var newQty = curQty;
	    
	    // if is numeric, add the changeby
	    if (qtyIsNumeric(curQty) == true)
	    {
	        newQty = parseInt(qtyBox.value) + parseInt(changeby);
	    }
	    
	    if (parseInt(newQty) >= 0)
	    {
	        if (parseInt(newQty) <= 99999)
	        { 
	            qtyBox.value = newQty; 
	        }
	    }
	}
	
    function qtyIsNumeric(checkThis)
    {
       var checkChars = "0123456789.";
       var isnum = true;
       var Char;
     
       for (i = 0; i < checkThis.length && isnum == true; i++) 
       { 
          Char = checkThis.charAt(i); 
          if (checkChars.indexOf(Char) == -1) 
          {
             isnum = false;
          }
       }
       return isnum;
    }
	function setSearchValues()
	{
		document.forms["quicksearchform"].zoom_query.value = document.forms["quicksearchform"].Keyword.value;
	}	