//PENDX Corporation's Ship-Rate Shopper(TM), JavaScript Code-Behind Version: 2.0.2.4 for StoreFront 6.x

//(c) Copyright 2003 by PENDX Corporation. All rights reserved.

//The contents of this file are proprietary to PENDX Corporation and are protected by
//copyright law and international treaties. Unauthorized reproduction or distribution
//of this program, or any portion of it, may result in severe civil and criminal
//penalties, and will be prosecuted to the maximum extent possible under the law.

  function ValidateShipRate(strControlID) {

    //Validate Ship-To fields.

    if ( ValidShipRateFields() == true ) {
    
	document.SRS_Main.SRS_EventTarget.value = strControlID;

	document.SRS_Main.SRS_EventArgument.value = "valid";

	document.SRS_Main.submit();

	return true;
    }

    else{

      window.alert('Ship rate calculation requires a valid City, State, Postal Code and Country.');

      return false;

    }

  }
      
  function ValidShipRateFields() {

    //Are there valid City & Zip choices in the Shipping Address Column? Returns Boolean.

    var bolResult = true;

          //Is the City filled in?

          if (document.SRS_Main.txtShipCity.value.replace(/\s+/, '') == '') {

            bolResult = false;

            return bolResult;

          }


          //Is the Zip Code filled in?

          if (document.SRS_Main.txtShipZip.value.replace(/\s+/, '') == '') {

            bolResult = false;

            return bolResult;

          }


      return bolResult;

  }


  function PENDX_PopUp(strHref, intHeight, intWidth, strAttributes) {

    var intScreenHeight;
    var intScreenWidth;
    var strFeatures;
    var hWin;

    intScreenHeight = window.screen.availHeight;
    intScreenWidth = window.screen.availWidth;
    strFeatures = 'HEIGHT=' + intHeight + ',WIDTH=' + intWidth + ',SCREENY=' + (intScreenHeight*.30) + ',SCREENX=' + (intScreenWidth*.33) + ',TOP=' + (intScreenHeight*.30) + ',LEFT=' + (intScreenWidth*.33) + ',';

    if(strAttributes.replace(' ', '') == '') {

      strFeatures = strFeatures + 'TOOLBAR=no,scrollbars=yes,resizable=yes,location=no,status=yes';

    }

    else {

      strFeatures = strFeatures + strAttributes;

    }

    hWin = window.open(strHref,'SRS',strFeatures);
    return hWin;

  }
