<!-- logic_checkform.js JavaScript for sr.asp
 var bValidateSearchResultForm=false;

 function CheckGotoPage(iValue, iTotalPages)
 {
  //NOTE: isNaN(iValue) isn't supported by NS 3 (it still gives a non numeric value when called), so create our own functions.
  var msg;
  msg='Invalid page number!\n\nPlease enter a number between 1 and ' + iTotalPages + ' pages.';
  if (!IsNumeric(iValue)) {
   alert(msg);
   return false;
  }
  else if (iValue <= 0 || iValue > iTotalPages) {
   alert(msg);
   return false;
  }
  else return true;
 }

 function IsNumeric(str)
 {
        var rResult     = false;
        var ch          = "";
        var i;

        if (str!=null)
        {
                for (var i=0; i < str.length; i++)
                {
                        ch=str.substring(i,i+1);
                        if ((ch.length == 1) && (ch >= '0' && ch <= '9'))
                        {
                                rResult=true;
                        }
                        else {
                           rResult=false;
                           break;
                        }
                }
        }
        return rResult;
 }

 //---------------------------------------------------------
 //fnSaveRecentPlan
 //Prereq: Requires logic_cookiekey.js for setSHPCookieKey
 function fnSaveRecentPlan(sPlanNum, sPlanCoID, sPlanImage, iDays) {
   var cookieName, iValue, sRecentPlans, c_max=3, i;
   cookieName="recentplans";
   sRecentPlans="";
   try {
   if(document.cookie) {
     //Get current recent
     iValue=getSHPCookieKey(cookieName,"irecent");
     if (iValue > '') {
        iValue=new Number(iValue);
        iValue+=1;
        if (iValue >= c_max) { //Keep up to max
           iValue=0;
        }
     }
     else
        iValue=0;

     //Still check up to < c_max, even though iValue was just incremented above for new plan due to
     //0 case, we need to run this for all possible available slots to add to sRecentPlans, even if only 1 is available (will return "" for other cookies not found)
     //so that can compare existence against entire possible set.
     for(i=0;i<c_max;i++) {  
        sRecentPlans=sRecentPlans + getSHPCookieKey(cookieName,i+'plannum') + "|";
     }

     //Does plan already exist in Recent list. If so, indexOf will be >= 0.
     if (sRecentPlans.indexOf(sPlanNum) < 0) {
	//Writes cookie since plan doesn't already exist.
	setSHPCookieKey(cookieName, "irecent", iValue, "/", iDays);
	setSHPCookieKey(cookieName, iValue+'plannum', sPlanNum, "/", iDays);
	setSHPCookieKey(cookieName, iValue+'plancoid', sPlanCoID, "/", iDays);
	setSHPCookieKey(cookieName, iValue+'planimage', sPlanImage, "/", iDays);
     }
   }
   } 
   catch(e) {
     //DEBUG alert(e.number+ " " + e.description)
   }
 
 }

// -->

