
var clPopPop = null // handle for the pop window

// open a pop file
function Pop(szPop, sWidth, sHeight) {
        var szFile
        var szWinFeatures = ""
        var szErrMsg  = "\nYour web browser has failed to open a separate window "
                szErrMsg += "\nto display the requested document.  Please close all unused "
                szErrMsg += "\nbrowser windows, and try again." 

        if (szPop)  
                szFile = szPop   // open with a given file
        else
                szFile = "/def_pop.htm"  // by default, open the Default Pop file

        // Netscape Navigator allows only 100 windows at a time
        // use the existing one to avoid exceeding the limit
        if (clPopPop) {
                if (!clPopPop.closed)    // if Pop window not closed 
                        clPopPop.location.href = szFile
                else 
                        clPopPop = window.open(szFile, 'Pop', 'scrollbars=yes,width=' + sWidth + ',height=' + sHeight + ',menubar=yes,resizable=yes')
        } else 
                clPopPop = window.open(szFile, 'Pop', 'scrollbars=yes,width=' + sWidth + ',height=' + sHeight + ',menubar=yes,resizable=yes')
        
        // check if new window failed to open
        if (clPopPop) 
                clPopPop.focus() 
        else 
                alert(szErrMsg) 
}

// Verify to make sure only whole numbers are entered for the quantity field.
function ValidateQty(theForm)
{

  if (theForm.Quantity.value == "")
  {
    alert("Please specify the Quantity to Add to the Shopping Cart.");
    theForm.Quantity.focus();
    return (false);
  }

  if (theForm.Quantity.value.length < 1)
  {
    alert("Please specify the Quantity to Add to the Shopping Cart.");
    theForm.Quantity.focus();
    return (false);
  }

  var checkOK = "0123456789";
  var checkStr = theForm.Quantity.value;
  var allValid = true;
  var decPoints = 0;
  var allNum = "";
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
    allNum += ch;
  }
  if (!allValid)
  {
    alert("You entered an invalid \"Quantity\".  Please enter whole numbers only.");
    theForm.Quantity.focus();
    return (false);
  }


  var chkVal = allNum;
  var prsVal = parseInt(allNum);
  if (chkVal != "" && !(prsVal >= "1"))
  {
    alert("You entered an invalid \"Quantity\".  Please enter a value greater than \"1\".");
    theForm.Quantity.focus();
    return (false);
  }

  return (true);
}

 function createTarget(form) {
	_target = form.target;
	_colon = _target.indexOf(":");
	
	if(_colon != -1) {
		form.target = _target.substring(0,_colon);
		form.args = _target.substring(_colon+1);
	} 
	else if(typeof(form.args)=="undefined") {
		form.args = "";
	}
	
	if(form.args.indexOf("{")!=-1) {
		_args = form.args.split("{");
		form.args = _args[0];
		for(var i = 1; i < _args.length;i++) {
			_args[i] = _args[i].split("}");
			form.args += eval(_args[i][0]) + _args[i][1];
		}
	}
	
	form.args = form.args.replace(/ /g,"");
	_win = window.open('',form.target,form.args);
	
	if(typeof(focus)=="function")
	_win.focus();
	return true;
}


