<!-- Begin
   // Check browser version
   var isNav4 = false, isNav5 = false, isIE4 = false
   var strSeperator = "/"; 
   
   // If you are using any Java validation on the back side you will want to use the / because 
   // Java date validations do not recognize the dash as a valid date separator.
   var vDateType = 1; // Global value for type of date format
   //                1 = mm/dd/yyyy
   //                2 = yyyy/dd/mm  (Unable to do date check at this time)
   //                3 = dd/mm/yyyy

   var vYearType = 4;   // Set to 2 or 4 for number of digits in the year for Netscape
   var vYearLength = 2; // Set to 4 if you want to force the user to enter 4 digits for the year before validating.
   var err = 0;         // Set the error code to a default of zero

   if(navigator.appName == "Netscape") {
      if (navigator.appVersion < "5") {
         isNav4 = true;
         isNav5 = false;
      } else {
         if (navigator.appVersion > "4") {
            isNav4 = false;
            isNav5 = true;
         }
      }
   } else {
         isIE4 = true;
   }

   submenu0On = new Image(10,7);
   submenu0On.src = "/images/childover.gif";
   submenu0Off = new Image(10,7);
   submenu0Off.src = "/images/spacer.gif";  

   submenu1On = new Image(10,7);
   submenu1On.src = "/images/childover.gif";
   submenu1Off = new Image(10,7);
   submenu1Off.src = "/images/spacer.gif";

   submenu2On = new Image(10,7);
   submenu2On.src = "/images/childover.gif";
   submenu2Off = new Image(10,7);
   submenu2Off.src = "/images/spacer.gif";

   submenu3On = new Image(10,7);
   submenu3On.src = "/images/childover.gif";
   submenu3Off = new Image(10,7);
   submenu3Off.src = "/images/spacer.gif";

   submenu4On = new Image(10,7);
   submenu4On.src = "/images/childover.gif";
   submenu4Off = new Image(10,7);
   submenu4Off.src = "/images/spacer.gif";   

   submenu5On = new Image(10,7);
   submenu5On.src = "/images/childover.gif";
   submenu5Off = new Image(10,7);
   submenu5Off.src = "/images/spacer.gif";

   submenu6On = new Image(10,7);
   submenu6On.src = "/images/childover.gif";
   submenu6Off = new Image(10,7);
   submenu6Off.src = "/images/spacer.gif";  
   
   submenu7On = new Image(10,7);
   submenu7On.src = "/images/childover.gif";
   submenu7Off = new Image(10,7);
   submenu7Off.src = "/images/spacer.gif";

   submenu8On = new Image(10,7);
   submenu8On.src = "/images/childover.gif";
   submenu8Off = new Image(10,7);
   submenu8Off.src = "/images/spacer.gif";  
   
   submenu9On = new Image(10,7);
   submenu9On.src = "/images/childover.gif";
   submenu9Off = new Image(10,7);
   submenu9Off.src = "/images/spacer.gif";

function ImageOn(imgName) {
   imgOn=eval(imgName + "On.src");
   document[imgName].src = imgOn;
}

function ImageOff(imgName) {
   imgOff=eval(imgName + "Off.src");
   document[imgName].src = imgOff;
}
   
function DateValidator(objName) {
   var datefield = objName;
   if (datefield.value == " ") {
      return true;
   } else {
      if (chkdate(objName) == false) {
         datefield.value = " ";
         datefield.select();
         alert("That date is invalid.  Please try again.");
         datefield.focus();   
         return false;
      } else {
         return true;
      }
   }
}

function chkdate(objName) {
   var strValid = "0123456789"
   var strDate;
   var strDateArray;
   var strDay;
   var strMonth;
   var strYear;
   var intday;
   var intMonth;
   var intYear;
   var booFound = false;
   var datefield = objName;
   var strSeparator = "/";
   var intElementNr;
   var err = 0;

   // Verify length, must be minimum mm/dd/yy
   strDate = datefield.value;
   if (strDate.length < 6) {
      return false;
   }
   
   // Verify proper separator, and break into date components
   if (strDate.indexOf(strSeparator) != -1) {
      strDateArray = strDate.split(strSeparator);
      if (strDateArray.length != 3) {
         err = 1;
         return false;
      } else {
         strMonth = strDateArray[0];
         strDay   = strDateArray[1];
         strYear  = strDateArray[2];
      }
      booFound = true;
   } else {
      err = 1
      return false;
   }
   
   // To handle 2 digit year vs 4 digit year
   if (strYear.length == 2) {
      strYear = '20' + strYear;
   }

   // Verify if Day, Month, and Year are numbers
   intday = parseInt(strDay, 10);
   if (isNaN(intday)) {
      err = 2;
      return false;
   }
   if (intday < 10) {
      if (strDay.length < 2) {
         strDay = "0" + strDay;
      }
   }
   intMonth = parseInt(strMonth, 10);
   if (isNaN(intMonth)) {
      err = 3;
      return false;
   }
   if (intMonth < 10) {
      if (strMonth.length < 2) {
         strMonth = "0" + strMonth;
      }
   }
   intYear = parseInt(strYear, 10);
   if (isNaN(intYear)) {
      err = 4;
      return false;
   }

   // Perform Day and Month validations
   if (intMonth>12 || intMonth<1) {
      err = 5;
      return false;
   }
   if ((intMonth == 1 || intMonth == 3 || intMonth == 5 || intMonth == 7 || intMonth == 8 || intMonth == 10 || intMonth == 12) && (intday > 31 || intday < 1)) {
      err = 6;
      return false;
   }
   if ((intMonth == 4 || intMonth == 6 || intMonth == 9 || intMonth == 11) && (intday > 30 || intday < 1)) {
      err = 7;
      return false;
   }
   if (intMonth == 2) {
      if (intday < 1) {
         err = 8;
         return false;
      }
      if (LeapYear(intYear) == true) {
         if (intday > 29) {
            err = 9;
            return false;
         }
      } else {
         if (intday > 28) {
            err = 10;
            return false;
         }
      }
   }
   datefield.value = strMonth + strSeparator + strDay + strSeparator + strYear;
   return true;
}
   
function DateFormat(vDateName, vDateValue, e, dateCheck, dateType) {
   if (!is_mac) { 
      DateFormat2(vDateName, vDateValue, e, dateCheck, dateType);
   }
}
   
function DateFormat2(vDateName, vDateValue, e, dateCheck, dateType) {
   vDateType = dateType;
   // vDateName = object name
   // vDateValue = value in the field being checked
   // e = event
   // dateCheck 
   //    True  = Verify that the vDateValue is a valid date
   //    False = Format values being entered into vDateValue only
   // vDateType
   //    1 = mm/dd/yyyy
   //    2 = yyyy/mm/dd
   //    3 = dd/mm/yyyy

   // Enter a tilde sign for the first number and you can check the variable information.
   if (vDateValue == "~") {
      alert("AppVersion = "+navigator.appVersion+" \nNav. 4 Version = "+isNav4+" \nNav. 5 Version = "+isNav5+" \nIE Version = "+isIE4+" \nYear Type = "+vYearType+" \nDate Type = "+vDateType+" \nSeparator = "+strSeperator);
      vDateName.value = "";
      vDateName.focus();
      return true;
   }

   var whichCode = (window.Event) ? e.which : e.keyCode;
   // Check to see if a seperator is already present.
   // bypass the date if a seperator is present and the length greater than 8
   if (vDateValue.length > 8 && isNav4) {
      if ((vDateValue.indexOf("-") >= 1) || (vDateValue.indexOf("/") >= 1))
         return true;
   }
   
   // Eliminate all the ASCII codes that are not valid
   var alphaCheck = " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/-";
   if (alphaCheck.indexOf(vDateValue) >= 1) {
      if (isNav4) {
         vDateName.value = "";
         vDateName.focus();
         vDateName.select();
         return false;
      } else {
         vDateName.value = vDateName.value.substr(0, (vDateValue.length-1));
         return false;
      }
   }
   
   if (whichCode == 8) //Ignore the Netscape value for backspace. IE has no value
      return false;
   else {
      //Create numeric string values for 0123456789/
      //The codes provided include both keyboard and keypad values
      var strCheck = '47,48,49,50,51,52,53,54,55,56,57,58,59,95,96,97,98,99,100,101,102,103,104,105';
      if (strCheck.indexOf(whichCode) != -1) {
         if (isNav4) {
            if (((vDateValue.length < 6 && dateCheck) || (vDateValue.length == 7 && dateCheck)) && (vDateValue.length >=1)) {
               alert("Invalid Date\nPlease Re-Enter");
               vDateName.value = "";
               vDateName.focus();
               vDateName.select();
               return false;
            }
            if (vDateValue.length == 6 && dateCheck) {
               var mDay = vDateName.value.substr(2,2);
               var mMonth = vDateName.value.substr(0,2);
               var mYear = vDateName.value.substr(4,4)
               //Turn a two digit year into a 4 digit year
               if (mYear.length == 2 && vYearType == 4) {
                  var mToday = new Date();
                  //If the year is greater than 30 years from now use 19, otherwise use 20
                  var checkYear = mToday.getFullYear() + 30; 
                  var mCheckYear = '20' + mYear;
                  if (mCheckYear >= checkYear)
                     mYear = '19' + mYear;
                  else
                     mYear = '20' + mYear;
               }
               
               var vDateValueCheck = mMonth+strSeperator+mDay+strSeperator+mYear;
               if (!dateValid(vDateValueCheck)) {
                  alert("Invalid Date\nPlease Re-Enter");
                  vDateName.value = "";
                  vDateName.focus();
                  vDateName.select();
                  return false;
               }
               return true;
            } else {
               // Reformat the date for validation and set date type to a 1
               if (vDateValue.length >= 8  && dateCheck) {
                  if (vDateType == 1) // mmddyyyy
                  {
                     var mDay = vDateName.value.substr(2,2);
                     var mMonth = vDateName.value.substr(0,2);
                     var mYear = vDateName.value.substr(4,4)
                     vDateName.value = mMonth+strSeperator+mDay+strSeperator+mYear;
                  }
                  if (vDateType == 2) // yyyymmdd
                  {
                     var mYear = vDateName.value.substr(0,4)
                     var mMonth = vDateName.value.substr(4,2);
                     var mDay = vDateName.value.substr(6,2);
                     vDateName.value = mYear+strSeperator+mMonth+strSeperator+mDay;
                  }
                  if (vDateType == 3) // ddmmyyyy
                  {
                     var mMonth = vDateName.value.substr(2,2);
                     var mDay = vDateName.value.substr(0,2);
                     var mYear = vDateName.value.substr(4,4)
                     vDateName.value = mDay+strSeperator+mMonth+strSeperator+mYear;
                  }
                  //Create a temporary variable for storing the DateType and change
                  //the DateType to a 1 for validation.
                  var vDateTypeTemp = vDateType;
                  vDateType = 1;
                  var vDateValueCheck = mMonth+strSeperator+mDay+strSeperator+mYear;
                  if (!dateValid(vDateValueCheck)) {
                     alert("Invalid Date\nPlease Re-Enter");
                     vDateType = vDateTypeTemp;
                     vDateName.value = "";
                     vDateName.focus();
                     vDateName.select();
                     return false;
                  }
                  vDateType = vDateTypeTemp;
                  return true;
               } else {
                  if (((vDateValue.length < 8 && dateCheck) || (vDateValue.length == 9 && dateCheck)) && (vDateValue.length >=1)) {
                     alert("Invalid Date\nPlease Re-Enter");
                     vDateName.value = "";
                     vDateName.focus();
                     vDateName.select();
                     return false;
                  }
               }
            }
         } else {
            // Non isNav Check
            if (((vDateValue.length < 8 && dateCheck) || (vDateValue.length == 9 && dateCheck)) && (vDateValue.length >=1)) {
               alert("Invalid Date\nPlease Re-Enter");
               vDateName.value = "";
               vDateName.focus();
               return true;
            }
            // Reformat date to format that can be validated. mm/dd/yyyy
            if (vDateValue.length >= 8 && dateCheck) {
               // Additional date formats can be entered here and parsed out to
               // a valid date format that the validation routine will recognize.
               if (vDateType == 1) // mm/dd/yyyy
               {
                  var mMonth = vDateName.value.substr(0,2);
                  var mDay = vDateName.value.substr(3,2);
                  var mYear = vDateName.value.substr(6,4)
               }
               if (vDateType == 2) // yyyy/mm/dd
               {
                  var mYear = vDateName.value.substr(0,4)
                  var mMonth = vDateName.value.substr(5,2);
                  var mDay = vDateName.value.substr(8,2);
               }
               if (vDateType == 3) // dd/mm/yyyy
               {
                  var mDay = vDateName.value.substr(0,2);
                  var mMonth = vDateName.value.substr(3,2);
                  var mYear = vDateName.value.substr(6,4)
               }
               if (vYearLength == 4) {
                  if (mYear.length < 4) {
                     alert("Invalid Date\nPlease Re-Enter");
                     vDateName.value = "";
                     vDateName.focus();
                     return true;
                  }
               }
               // Create temp. variable for storing the current vDateType
               var vDateTypeTemp = vDateType;
               // Change vDateType to a 1 for standard date format for validation
               // Type will be changed back when validation is completed.
               vDateType = 1;
               // Store reformatted date to new variable for validation.
               var vDateValueCheck = mMonth+strSeperator+mDay+strSeperator+mYear;
               if (mYear.length == 2 && vYearType == 4 && dateCheck) {
                  //Turn a two digit year into a 4 digit year
                  var mToday = new Date();
                  //If the year is greater than 30 years from now use 19, otherwise use 20
                  var checkYear = mToday.getFullYear() + 30; 
                  var mCheckYear = '20' + mYear;
                  if (mCheckYear >= checkYear)
                     mYear = '19' + mYear;
                  else
                     mYear = '20' + mYear;
                  vDateValueCheck = mMonth+strSeperator+mDay+strSeperator+mYear;
                  // Store the new value back to the field.  This function will
                  // not work with date type of 2 since the year is entered first.
                  if (vDateTypeTemp == 1) // mm/dd/yyyy
                     vDateName.value = mMonth+strSeperator+mDay+strSeperator+mYear;
                     if (vDateTypeTemp == 3) // dd/mm/yyyy
                        vDateName.value = mDay+strSeperator+mMonth+strSeperator+mYear;
               } 
               if (!dateValid(vDateValueCheck)) {
                  alert("Invalid Date\nPlease Re-Enter");
                  vDateType = vDateTypeTemp;
                  vDateName.value = "";
                  vDateName.focus();
                  return true;
               }
               vDateType = vDateTypeTemp;
               return true;
            } else {
               if (vDateType == 1) {
                  if (vDateValue.length == 2) {
                     vDateName.value = vDateValue+strSeperator;
                  }
                  if (vDateValue.length == 5) {
                     vDateName.value = vDateValue+strSeperator;
                  }
               }
               if (vDateType == 2) {
                  if (vDateValue.length == 4) {
                     vDateName.value = vDateValue+strSeperator;
                  }
                  if (vDateValue.length == 7) {
                     vDateName.value = vDateValue+strSeperator;
                  }
               } 
               if (vDateType == 3) {
                  if (vDateValue.length == 2) {
                     vDateName.value = vDateValue+strSeperator;
                  }
                  if (vDateValue.length == 5) {
                     vDateName.value = vDateValue+strSeperator;
                  }
               }
               return true;
            }
         }
         if (vDateValue.length == 10&& dateCheck) {
            if (!dateValid(vDateName)) {
               // Un-comment the next line of code for debugging the dateValid() function error messages
               //alert(err);  
               alert("Invalid Date\nPlease Re-Enter");
               vDateName.focus();
               vDateName.select();
            }
         }
         return false;
      } else {
         // If the value is not in the string return the string minus the last
         // key entered.
         if (isNav4) {
            vDateName.value = "";
            vDateName.focus();
            vDateName.select();
            return false;
         } else {
            vDateName.value = vDateName.value.substr(0, (vDateValue.length-1));
            return false;
         }
      }
   }
}

function dateValid(objName) {
   var strDate;
   var strDateArray;
   var strDay;
   var strMonth;
   var strYear;
   var intday;
   var intMonth;
   var intYear;
   var booFound = false;
   var datefield = objName;
   var strSeparatorArray = new Array("-"," ","/",".");
   var intElementNr;
   // var err = 0;
   var strMonthArray = new Array(12);

   strMonthArray[0] = "Jan";
   strMonthArray[1] = "Feb";
   strMonthArray[2] = "Mar";
   strMonthArray[3] = "Apr";
   strMonthArray[4] = "May";
   strMonthArray[5] = "Jun";
   strMonthArray[6] = "Jul";
   strMonthArray[7] = "Aug";
   strMonthArray[8] = "Sep";
   strMonthArray[9] = "Oct";
   strMonthArray[10] = "Nov";
   strMonthArray[11] = "Dec";
   //strDate = datefield.value;
   strDate = objName;
   if (strDate.length < 1) {
      return true;
   }
   for (intElementNr = 0; intElementNr < strSeparatorArray.length; intElementNr++) {
      if (strDate.indexOf(strSeparatorArray[intElementNr]) != -1) {
         strDateArray = strDate.split(strSeparatorArray[intElementNr]);
         if (strDateArray.length != 3) {
            err = 1;
            return false;
         } else {
            strDay = strDateArray[0];
            strMonth = strDateArray[1];
            strYear = strDateArray[2];
         }
         booFound = true;
      }
   }
   if (booFound == false) {
      if (strDate.length>5) {
         strDay = strDate.substr(0, 2);
         strMonth = strDate.substr(2, 2);
         strYear = strDate.substr(4);
      }
   }
   //Adjustment for short years entered
   if (strYear.length == 2) {
      strYear = '20' + strYear;
   }
   strTemp = strDay;
   strDay = strMonth;
   strMonth = strTemp;
   intday = parseInt(strDay, 10);
   if (isNaN(intday)) {
      err = 2;
      return false;
   }
   intMonth = parseInt(strMonth, 10);
   if (isNaN(intMonth)) {
      for (i = 0;i<12;i++) {
         if (strMonth.toUpperCase() == strMonthArray[i].toUpperCase()) {
            intMonth = i+1;
            strMonth = strMonthArray[i];
            i = 12;
         }
      }
      if (isNaN(intMonth)) {
         err = 3;
         return false;
      }
   }
   intYear = parseInt(strYear, 10);
   if (isNaN(intYear)) {
      err = 4;
      return false;
   }
   if (intMonth>12 || intMonth<1) {
      err = 5;
      return false;
   }
   if ((intMonth == 1 || intMonth == 3 || intMonth == 5 || intMonth == 7 || intMonth == 8 || intMonth == 10 || intMonth == 12) && (intday > 31 || intday < 1)) {
      err = 6;
      return false;
   }
   if ((intMonth == 4 || intMonth == 6 || intMonth == 9 || intMonth == 11) && (intday > 30 || intday < 1)) {
      err = 7;
      return false;
   }
   if (intMonth == 2) {
      if (intday < 1) {
         err = 8;
         return false;
      }
      if (LeapYear(intYear) == true) {
         if (intday > 29) {
            err = 9;
            return false;
         }
      } else {
         if (intday > 28) {
            err = 10;
            return false;
         }
      }
   }
   return true;
}

function LeapYear(intYear) {
   if (intYear % 100 == 0) {
      if (intYear % 400 == 0) { return true; }
   } else {
      if ((intYear % 4) == 0) { return true; }
   }
   return false;
}

function showdate (dateLevel) {
   var days=new Array(8);
   days[1]="Sunday";
   days[2]="Monday";
   days[3]="Tuesday";
   days[4]="Wednesday";
   days[5]="Thursday";
   days[6]="Friday";
   days[7]="Saturday";

   var months=new Array(13);
   months[1]="January";
   months[2]="February";
   months[3]="March";
   months[4]="April";
   months[5]="May";
   months[6]="June";
   months[7]="July";
   months[8]="August";
   months[9]="September";
   months[10]="October";
   months[11]="November";
   months[12]="December";
   var time=new Date();
   var lday=days[time.getDay() + 1];
   var lmonth=months[time.getMonth() + 1];
   var date=time.getDate();
   var year=time.getYear();
   if (year < 2000)
      year = year + 1900;

   if (dateLevel == "1") {
      document.write(lday + ", " + lmonth + " " + date + ", " + year);
   } else {
      document.write(lmonth + " " + date + ", " + year);
   }
}

function PopWinMax(page) {
   window.open(page,'NewWin','toolbar=yes,menubar=yes,location=yes,scrollbars=yes,resizable=yes');
}

function PopWin(url,width,height,resizable,scrollbars) { 
   window.open(url,'NewWin','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars='+scrollbars+',resizable='+resizable+',width='+width+',height='+height);
} 

function PopWinHelp() { 
   var url        = '/inc/doc/help/help.htm'
   var width      = 650
   var height     = 400
   var resizable  = 'yes'
   var scrollbars = 'yes'
   var menubar    = 'no'

   window.open(url,'HelpWin','toolbar=no,location=no,directories=no,status=no,menubar='+menubar+',scrollbars='+scrollbars+',resizable='+resizable+',width='+width+',height='+height);
} 

function gallery(){
   if (i == 1){
      document.gallery.desc.value = description[1];
   }
   if (resKey[i] == "") {
      document.all["saveorder"].style.visibility  = 'hidden';
   } else {
      document.all["saveorder"].style.visibility  = 'visible';
   }     
}

function previmg(theme){
   if (i != 1) {
      i --;
      document.img.src = images[i];
      document.range.from.value = i;
      document.prev_button.src = "/inc/themes/album/" + theme + "/prev_on.gif";
      document.next_button.src = "/inc/themes/album/" + theme + "/next_on.gif";
      document.gallery.desc.value = description[i];
   }
   if (resKey[i] == "") {
      document.all["saveorder"].style.visibility  = 'hidden';
   } else {
      document.all["saveorder"].style.visibility  = 'visible';
   } 
   if (i == 1) {
      document.prev_button.src = "/inc/themes/album/" + theme + "/prev_off.gif"; }
}

function nextimg(maxSize,theme){
   if (i != maxSize) {
      i ++;
      image = images[i];
      document.range.from.value = i;
      document.next_button.src = "/inc/themes/album/" + theme + "/next_on.gif";
      document.prev_button.src = "/inc/themes/album/" + theme + "/prev_on.gif";
      document.img.src = image;
      document.gallery.desc.value = description[i];
   }
   if (resKey[i] == "") {
      document.all["saveorder"].style.visibility  = 'hidden';
   } else {
      document.all["saveorder"].style.visibility  = 'visible';
   } 
   if (i == maxSize){
      document.next_button.src = "/inc/themes/album/" + theme + "/next_off.gif"; }
}

function firstimg(theme){
   i = 1;
   document.img.src = images[i];
   document.gallery.desc.value = description[i];
   document.prev_button.src = "/inc/themes/album/" + theme + "/prev_off.gif";
   document.next_button.src = "/inc/themes/album/" + theme + "/next_on.gif";
   document.range.from.value = i;
   if (resKey[i] == "") {
      document.all["saveorder"].style.visibility  = 'hidden';
   } else {
      document.all["saveorder"].style.visibility  = 'visible';
   }  
}

function lastimg(maxSize,theme){
   i = maxSize;
   document.img.src = images[i];
   document.gallery.desc.value = description[i];
   document.prev_button.src = "/inc/themes/album/" + theme + "/prev_on.gif";
   document.next_button.src = "/inc/themes/album/" + theme + "/next_off.gif";
   document.range.from.value = i;
   if (resKey[i] == "") {
      document.all["saveorder"].style.visibility  = 'hidden';
   } else {
      document.all["saveorder"].style.visibility  = 'visible';
   }      
}

function printPhoto(){
   image = images[i];
   url = "/album/albumPrint.asp?pic=" + image;
   PopWin(url,500,500,'no','yes');
}

function savePhotoOLD(uid){
   if (resKey[i] != "") {
      myfile = resKey[i] + ".jpg";
      document.write("<a href=\"/inc/asp/saveFile.asp?uid=" + uid + "&file=" + myfile + "&att=true\" class=smallAlbumLink onmouseover=\"window.status='Save Photo';return true;\" onmouseout=\"window.status=' ';return true;\">Save</a>&nbsp;&nbsp;");
   }
}

function savePhoto(url){
   PopWin(url,50,50,'no','no');
}

function savePhoto2(uid){
   if (resKey[i] != "") {
      myfile = resKey[i] + ".jpg";
      url = "/inc/asp/saveFile.asp?uid=" + uid + "&file=" + myfile + "&att=true"
      PopWin(url,50,50,'no','no');
   }
}

function displayOrder(psid,gallery,uid){
   if (resKey[i] != "") {
      document.write("<a href=\"javascript:orderPrints('" + psid + "','" +gallery + "','" + uid + "');\" class=smallAlbumLink onmouseover=\"window.status='Order this Photo';return true;\" onmouseout=\"window.status=' ';return true;\">Order Prints</a>");
   }
}

function displayOrder2(psid,gallery,uid){
   if (resKey[i] != "") {
      document.write("|&nbsp;&nbsp;<a href=\"javascript:orderPrints('" + psid + "','" +gallery + "','" + uid + "');\" class=smallAlbumLink onmouseover=\"window.status='Order this Photo';return true;\" onmouseout=\"window.status=' ';return true;\">Order Prints</a>");
   }
}

function orderPrintsOLD(psid,gallery,site){
   var baby = "http://www.babysites.com/";
   var shutterfly = "http://www.shutterfly.com/c4p/UpdateCart.jsp";
   var v1 = "?" + "addim" + "=" + "1";
   var v2 = "&" + "protocol" + "=" + "SFP,100";
   var v3 = "&" + "pid" + "=" + "C4PP";
   var v4 = "&" + "psid" + "=" + psid;
   var v5 = "&" + "imnum" + "=" + "1";
   var v6 = "&" + "imraw-1" + "=" + baby + gallery + "/" + resKey[i] + ".jpg";
   var v7 = "&" + "imrawheight-1" + "=" + resHeight[i];
   var v8 = "&" + "imrawwidth-1" + "=" + resWidth[i];
   var v9 = "&" + "imthumb-1" + "=" + baby + gallery + "/" + resKey[i] + "t.jpg";
   if (resWidth[i] >= resHeight[i]) {
      var v10 = "&" + "imthumbwidth-1" + "=80";
      var v11 = "&" + "imthumbheight-1" + "=" + Math.round((80 / resWidth[i]) * resHeight[i]);
   } else {
      var v10 = "&" + "imthumbwidth-1" + "=" + Math.round((80 / resHeight[i]) * resWidth[i]);
      var v11 = "&" + "imthumbheight-1" + "=80";
   }
   var v12 = "&" + "returl" + "=" + baby + "sites/" + site + "/?page=order";
   var URL = shutterfly + v1 + v2 + v3 + v4 + v5 + v6 + v7 + v8 + v9 + v10 + v11 + v12;
  // alert(URL);
   PopWin(URL,800,600,'yes','yes');
}

function orderPrints(psid,gallery,site,key,width,height){
   var baby = "http://www.babysites.com/";
   var shutterfly = "http://www.shutterfly.com/c4p/UpdateCart.jsp";
   var v1 = "?" + "addim" + "=" + "1";
   var v2 = "&" + "protocol" + "=" + "SFP,100";
   var v3 = "&" + "pid" + "=" + "C4PP";
   var v4 = "&" + "psid" + "=" + psid;
   var v5 = "&" + "imnum" + "=" + "1";
   var v6 = "&" + "imraw-1" + "=" + baby + gallery + "/" + key + ".jpg";
   var v7 = "&" + "imrawheight-1" + "=" + height;
   var v8 = "&" + "imrawwidth-1" + "=" + width;
   var v9 = "&" + "imthumb-1" + "=" + baby + gallery + "/" + key + "t.jpg";
   if (width >= height) {
      var v10 = "&" + "imthumbwidth-1" + "=80";
      var v11 = "&" + "imthumbheight-1" + "=" + Math.round((80 / width) * height);
   } else {
      var v10 = "&" + "imthumbwidth-1" + "=" + Math.round((80 / height) * width);
      var v11 = "&" + "imthumbheight-1" + "=80";
   }
   var v12 = "&" + "returl" + "=" + baby + "sites/" + site + "/?page=order";
   var URL = shutterfly + v1 + v2 + v3 + v4 + v5 + v6 + v7 + v8 + v9 + v10 + v11 + v12;
  // alert(URL);
   PopWin(URL,800,600,'yes','yes');
}

function BrowserType() {
   document.write('<input type=hidden name=browser value=' + navigator.appName + '>');
}

function valudateJournalForm(thisform) {
   if (validateStoryForm(thisform)) {
      thisform.submit();
      return true;
   } else {
      return false;
   }
}

function formAction(action,thisform) {
   switch (action) {
      case (0) : thisform.a.value = "0"; 
                 thisform.c.value = "save"
                 if (validateStoryForm(thisform)) {
                    thisform.submit();
                    return true;
                 } else {
                    return false;
                 }                 
                 break;
      case (1) : thisform.a.value = "0";
                 thisform.c.value = "update"; 
                 if (validateStoryForm(thisform)) {
                    thisform.submit();
                    return true;
                 } else {
                    return false;
                 }               
                 break;
      case (2) : thisform.a.value = "0";
                 thisform.c.value = "preview"; 
                 if (validateStoryForm(thisform)) {
                    thisform.submit();
                    return true;
                 } else {
                    return false;
                 }                  
                 break;
      case (3) : thisform.a.value = "0";
                 thisform.c.value = "edit"; 
                 thisform.submit();
                 return true;                 
                 break;
      case (4) : thisform.a.value = "0";
                 thisform.c.value = "addpreview"; 
                 if (validateStoryForm(thisform)) {
                    thisform.submit();
                    return true;
                 } else {
                    return false;
                 }                  
                 break;
      case (5) : thisform.a.value = "0";
                 thisform.c.value = "add";
                 thisform.submit();
                 return true;      
                 break;
      default  : thisform.a.value = "0";
                 thisform.c.value = "";
                 thisform.submit();
                 return true;
   }
}

function formPicture(action,thisform) {
   switch (action) {
      case (0) : thisform.a.value = "0"; 
                 thisform.c.value = "upload"
                 break;
      case (1) : thisform.a.value = "0";
                 thisform.c.value = "upload"; 
                 break;
      case (2) : thisform.a.value = "0";
                 thisform.c.value = "process"; 
                 break;
      default  : thisform.a.value = "2";
                 thisform.albumtype.value = "baby";
   }
   thisform.submit();
   return true;
}

function formPswd(action,thisform) {
   switch (action) {
      case (0) : thisform.a.value = "0"; 
                 thisform.c.value = "change"
                 break;
      case (1) : thisform.a.value = "0";
                 thisform.c.value = "save"; 
                 break;
   }
   thisform.submit();
   return true;
}

function gbForm(action,thisform) {
   switch (action) {
      case (0) : thisform.c.value = " "
                 break;
      case (1) : thisform.c.value = "update"; 
                 break;
   }
   thisform.submit();
   return true;
}

function vlForm(action,thisform) {
   switch (action) {
      case (0) : thisform.c.value = "deletelog"
                 break;
      case (1) : thisform.c.value = "log"; 
                 break;
   }
   thisform.submit();
   return true;
}

function formOptions(action,thisform) {
   switch (action) {
      case (0) : thisform.optn.value = "editpic";
                 break;
      case (1) : thisform.optn.value = "editmsg";
                 break;
      case (2) : thisform.optn.value = "editcnt";
                 break;   
      case (3) : thisform.optn.value = "edittkr";
                 break;                    
   }
   thisform.submit();
   return true;                 
}

function formMenu(action,thisform) {
   switch (action) {
      case (0) : thisform.optn.value = "editBabPic";
                 break;
      case (1) : thisform.optn.value = "editFamPic";
                 break;
      case (2) : thisform.optn.value = "editBabVid";
                 break;   
      case (3) : thisform.optn.value = "editFamVid";
                 break;     
      case (4) : thisform.optn.value = "editBabAud";
                 break;  
      case (5) : thisform.optn.value = "editFamAud";
                 break;                   
   }
   thisform.submit();
   return true;                 
}

function validateZIP(field) {
   var valid = "0123456789-";
   var hyphencount = 0;

   if (field.length!=5 && field.length!=10) {
      alert("Please enter your 5 digit or 5 digit+4 zip code.");
      return false;
   }
   for (var i=0; i < field.length; i++) {
      temp = "" + field.substring(i, i+1);
      if (temp == "-") hyphencount++;
        if (valid.indexOf(temp) == "-1") {
           document.contact.zip.select();
           document.contact.zip.focus();
           alert("Invalid characters in your zip code.  Please try again.");
           return false;
        }
        if ((hyphencount > 1) || ((field.length==10) && ""+field.charAt(5)!="-")) {
           alert("The hyphen character should be used with a properly formatted 5 digit+four zip code, like '12345-6789'.   Please try again.");
           return false;
        }
   }
   return true;
}

function validateEmail(emailStr) {
   if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(emailStr)) {
      return true;
   }
   alert("Invalid E-mail Address! Please re-enter.")
   return false;
}

function validateEmail2(tempStr) {
   var emailStr = tempStr.toLowerCase();
   var invalid = " ";
   var checkTLD=1;
   var knownDomsPat = new Array("com","net","org","edu","int","mil","gov","biz","info","us","pro");
   var emailPat=/^(.+)@(.+)$/;
   var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";
   var validChars="\[^\\s" + specialChars + "\]";
   var quotedUser="(\"[^\"]*\")";
   var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
   var atom=validChars + '+';
   var word="(" + atom + "|" + quotedUser + ")";
   var userPat=new RegExp("^" + word + "(\\." + atom + ")*$");
   var domainPat=new RegExp("^" + atom + "(\\." + atom + ")*$");
   var matchArray=emailStr.match(emailPat);
   
   if (emailStr.indexOf(invalid) > -1) {
      alert("Spaces are not allowed in the email address.");
      return false;
   } 
   
   if (matchArray == null) {
      alert("Email address seems incorrect (check @ and .'s)");
      return false;
   }
   var user=matchArray[1];
   var domain=matchArray[2];
   
   for (i=0; i<user.length; i++) {
      if (user.charCodeAt(i)>127) {
         alert("The username contains invalid characters.");
         return false;
      }
   }
   for (i=0; i<domain.length; i++) {
      if (domain.charCodeAt(i)>127) {
         alert("The domain name contains invalid characters.");
         return false;
      }   
   }
   
   if (user.match(userPat) == null) {
      alert("The username doesn't seem to be valid.");
      return false;
   }
   
   var IPArray=domain.match(ipDomainPat);
   if (IPArray != null) {
      for (i=1; i<4; i++) {
         if (IPArray[i]>255) {
            alert("Destination IP address is invalid!");
            return false;
         }
      }
      return true;
   }
   
   var atomPat=new RegExp("^" + atom + "$");
   var domArr=domain.split(".");
   var len=domArr.length;
   
   for (i=0; i<len; i++) {
      if (domArr[i].search(atomPat) == 1) {
         alert("The domain name does not seem to be valid.");
         return false;
      }
   }
   
   var matchFound = false;
   for (i=0; i<knownDomsPat.length; i++) {
      if (knownDomsPat[i] == domArr[domArr.length-1]) {
         matchFound = true;
      }
   }
   if (!matchFound && checkTLD && domArr[domArr.length-1].length != 2) {
      alert("The email address must end in a well-known domain or two letter country." + domArr[domArr.length-1]);
      return false;   
   }
  
   if (len<2) {
      alert("This email address is missing a hostname!");
      return false;
   }
   return true;
}

function validateRequired(thisform) {
   if ((thisform.firstMom.value=="" || thisform.lastMom.value=="") && (thisform.firstDad.value=="" || thisform.lastDad.value=="")) {
      alert("You must specify the mother's or father's full name.");
      return false;
   }
   var themessage = "You are required to complete the following fields: ";
   if (thisform.email.value=="") {
   themessage = themessage + " Email";
   }   
   //alert if fields are empty and cancel form submit
   if (themessage == "You are required to complete the following fields: ") {
      return true;
   } else {
      alert(themessage);
      return false;      
   }
}

function submitBabyForm(thisform) {
   var themessage = "You are required to complete the following fields: ";
   if (thisform.first.value=="") {
      themessage = themessage + " - Baby's First Name";
   }
   if (thisform.last.value=="") {
      themessage = themessage + " - Baby's Last Name";
   }
   if (thisform.dob.value=="") {
      themessage = themessage + " - Baby's Date-of-Birth ";
   }
   if (thisform.gender.value=="") {
      themessage = themessage + " - Baby's Gender";
   }   
   //alert if fields are empty and cancel form submit
   if (themessage == "You are required to complete the following fields: ") {
      if (checkDate('Calendar1') == 1) {
         thisform.dob.focus();
         alert("Please enter a valid Due Date or Birthdate");
         return false;
      } else {
         return true;
      }
   } else {
      alert(themessage);
      return false;      
   }
}

function validateForm(thisform) {
   if (validateRequired(thisform)) {
      if (validateEmail2(thisform.email.value)) {
         return true;
      } else {
         thisform.email.select();
         thisform.email.focus();
         return false;
      }
      return true;
   } else {
      return false;
   }
}

function validatePswd(thisform) {
   var invalid = " "; // Invalid character is a space
   var minLength = 5; // Minimum length
   var pw1 = thisform.new1.value;
   var pw2 = thisform.new2.value;
   
   // check for a value in both fields.
   if (pw1 == '' || pw2 == '') {
      alert('Please enter your password twice.');
      return false;
   } else {
      // check for minimum length
      if (pw1.length < minLength) {
         alert('Your password must be at least ' + minLength + ' characters long. Try again.');
         return false;
      } else {
         // check for spaces
         if (pw1.indexOf(invalid) > -1) {
            alert("Sorry, spaces are not allowed.");
            return false;
         } else {
            if (pw1 != pw2) {
               alert ("You did not enter the same new password twice. Please re-enter your password.");
               return false;
            } else {
              return true;
            }
         }
      }
   }
}

function validateAccess(thisform) {
   var invalid = " "; // Invalid character is a space
   var minLength = 5; // Minimum length
   var accessID = thisform.aid.value;
   var accessPW = thisform.apw.value;
   
   if (eval("thisform.access[" + 1 + "].checked") == true) {
   // check for a value in both fields.
   if (accessID == '' || accessPW == '') {
      thisform.aid.focus();   
      alert('Please enter an Access ID and Password');
      return false;
   } else {
      // check for minimum length
      if (accessID.length < minLength) {
         thisform.aid.select();
         thisform.aid.focus();
         alert('Your Access ID must be at least ' + minLength + ' characters long. Try again.');
         return false;
      } else {
      // check for minimum length
         if (accessPW.length < minLength) {
            thisform.apw.select();
            thisform.apw.focus();         
            alert('Your Access Password must be at least ' + minLength + ' characters long. Try again.');
            return false;
         } else {
            // check for spaces
            if (accessID.indexOf(invalid) > -1) {
               thisform.aid.select();
               thisform.aid.focus();            
               alert("Sorry, spaces are not allowed.");
               return false;
            } else {
               // check for spaces
               if (accessPW.indexOf(invalid) > -1) {
                  thisform.apw.select();
                  thisform.apw.focus();                
                  alert("Sorry, spaces are not allowed.");
                  return false;
               } else {
                 return true;
               }
            }
         }   
      }
   }
   } else {
      thisform.access[0].checked;
      return true;
   }
}

function changeImage(thisform){
   var theme;
   theme = thisform.usrTheme.value;
   if (theme == 'none') {
      document.theme.src = "/images/spacer.gif";
   } else {
      document.theme.src = "/images/themes/" + theme + "-mini.jpg";
      thisform.submit.disabled = false;
   }
}

function changeImage2(thisform){
   var theme;
   theme = thisform.usrTheme.value;
   if (theme == 'none') {
      document.theme.src = "/images/spacer.gif";
   } else {
      document.theme.src = "/images/themes/" + theme + "-mini.jpg";
   }
}

function linkImage(theme){
   var url;
   if (theme != 'none') {
      url = "/images/themes/" + theme + ".jpg";
      PopWin(url,650,460,'no','no');   
   }
}

function changeFont(thisform){
   var font;
   font = thisform.cntFont.value;
   if (font == 'none') {
      document.font.src = "/images/spacer.gif";
   } else {
      document.font.src = "/images/cnt-" + font + ".gif";
   }
}

function validateAlbumForm(thisform){
   if (thisform.albumtype.value == "family") {
      thisform.newcat.disabled = true;
      thisform.newcat.value = "";
   } else {
      thisform.newcat.disabled = false;
      thisform.newcat.value = "00";
   }
}

function validateNewAlbumForm(thisform){
   var tempTitle = thisform.newalbum.value;
   var temp = 0;
   for (i=0; i<tempTitle.length; i++) {
      if (tempTitle.charAt(i) != " ") {
         temp = 1;
      }
   }
   if (temp == 0) {
      alert("You must enter a valid Album Title.");
      return false;
   }   
   if (thisform.newalbum.value == "") {
      thisform.newalbum.focus();
      alert("Please enter an Album Title");
      return false;
   }
   if (thisform.newdate.value == "") {
      thisform.newdate.focus();
      alert("Please enter an Album Date");
      return false;
   }
   if (checkDate('Calendar1') == 1) {
      thisform.newdate.focus();
      alert("Please enter a valid Album Date");
      return false;
   }
   return true;
}

function validateUploadForm(thisform) {
   if (thisform.file1.value == "" && thisform.file2.value == "" && thisform.file3.value == "" && thisform.file4.value == "" && thisform.file5.value == "" && thisform.file6.value == "" && thisform.file7.value == "" && thisform.file8.value == "" && thisform.file9.value == "" && thisform.file10.value == "") {
      thisform.file1.focus();
      alert("You must specify a file to upload.  Please try again.");
      return false;
   } else {
      if (is_win) {
         if (!limitAttach(thisform.file1.value)) { return false; }
         if (!limitAttach(thisform.file2.value)) { return false; }
         if (!limitAttach(thisform.file3.value)) { return false; }
         if (!limitAttach(thisform.file4.value)) { return false; }
         if (!limitAttach(thisform.file5.value)) { return false; }
         if (!limitAttach(thisform.file6.value)) { return false; }
         if (!limitAttach(thisform.file7.value)) { return false; }
         if (!limitAttach(thisform.file8.value)) { return false; }
         if (!limitAttach(thisform.file9.value)) { return false; }
         if (!limitAttach(thisform.file10.value)) { return false; }
      }
      return true;
   }
}

function validateVideoForm(thisform) {
   if (thisform.newtitle.value == "") {
      thisform.newtitle.focus();
      alert("Please enter a title for your video clip.  Please try again.");
      return false;
   }
   if (thisform.newdate.value == "") {
      thisform.newdate.focus();
      alert("Please enter a date for your video clip.  Please try again.");
      return false;
   }
   if (checkDate('Calendar1') == 1) {
      thisform.newdate.focus();
      alert("Please enter a valid Video Date");
      return false;
   }
   if (thisform.newfile.value == "") {
      thisform.newfile.focus();
      alert("You must specify a file to upload.  Please try again.");
      return false;
   } else {
      if (is_win) {
         if (!limitVideoAttach(thisform.newfile.value)) { return false; }
      }
      return true;
   }   
}

function validateVideoForm2(thisform) {
   if (thisform.newtitle.value == "") {
      thisform.newtitle.focus();
      alert("Please enter a title for your video clip.  Please try again.");
      return false;
   }
   if (thisform.newdate.value == "") {
      thisform.newdate.focus();
      alert("Please enter a date for your video clip.  Please try again.");
      return false;
   }
   if (checkDate('Calendar1') == 1) {
      thisform.newdate.focus();
      alert("Please enter a valid Video Date");
      return false;
   }
}

function validateAudioForm(thisform) {
   if (thisform.newtitle.value == "") {
      thisform.newtitle.focus();
      alert("Please enter a title for your audio clip.  Please try again.");
      return false;
   }
   if (thisform.newdate.value == "") {
      thisform.newdate.focus();
      alert("Please enter a date for your audio clip.  Please try again.");
      return false;
   }
   if (checkDate('Calendar1') == 1) {
      thisform.newdate.focus();
      alert("Please enter a valid Audio Date");
      return false;
   }
   if (thisform.newfile.value == "") {
      thisform.newfile.focus();
      alert("You must specify a file to upload.  Please try again.");
      return false;
   } else {
      if (is_win) {
         if (!limitAudioAttach(thisform.newfile.value)) { return false; }
      }
      return true;
   }   
}

function validateAudioForm2(thisform) {
   if (thisform.newtitle.value == "") {
      thisform.newtitle.focus();
      alert("Please enter a title for your audio clip.  Please try again.");
      return false;
   }
   if (thisform.newdate.value == "") {
      thisform.newdate.focus();
      alert("Please enter a date for your audio clip.  Please try again.");
      return false;
   }
   if (checkDate('Calendar1') == 1) {
      thisform.newdate.focus();
      alert("Please enter a valid Audio Date");
      return false;
   }
}

function limitAttach(file) { 
   var extArray = new Array(".jpg",".png",".bmp");
   var allowSubmit = false;

   if (!file) { return true; }
   // If path not included (e.g. Firefox)
   if (file.indexOf("\\") == -1) {
      ext = file.substr((file.length - 4), 4).toLowerCase();
      for (var i=0; i<extArray.length; i++) {
         if (extArray[i] == ext) {
            allowSubmit = true;
            break;
         }
      }
      if (allowSubmit) {
         return true;
      } else {
         alert("Invalid File type: " + file + "\nPlease only upload files that end in types: " + (extArray.join(" ")) + "\nPlease select a new file to upload.");
         return false;
      }
   }
   // Cycle through path to get to filename
   while (file.indexOf("\\") != -1) {
      tempFile = file.slice(file.indexOf("\\") + 1);
      ext = tempFile.substr((tempFile.length - 4), 4).toLowerCase();
      for (var i=0; i<extArray.length; i++) {
         if (extArray[i] == ext) {
            allowSubmit = true;
            break;
         }
      }
      if (allowSubmit) {
         return true;
      } else {
         alert("Invalid File type: " + file + "\nPlease only upload files that end in types: " + (extArray.join(" ")) + "\nPlease select a new file to upload.");
         return false;
      }
   }
}

function limitVideoAttach(file) { 
   var extArray = new Array(".mov",".mpg",".wmv",".avi", ".mp4");
   var allowSubmit = false;

   if (!file) { return true; }
   // If path not included (e.g. Firefox)
   if (file.indexOf("\\") == -1) {
      ext = file.substr((file.length - 4), 4).toLowerCase();
      for (var i=0; i<extArray.length; i++) {
         if (extArray[i] == ext) {
            allowSubmit = true;
            break;
         }
      }
      if (allowSubmit) {
         return true;
      } else {
         alert("Invalid File type: " + file + "\nPlease only upload files that end in types: " + (extArray.join(" ")) + "\nPlease select a new file to upload.");
         return false;
      }
   }
   // Cycle through path to get to filename
   while (file.indexOf("\\") != -1) {
      tempFile = file.slice(file.indexOf("\\") + 1);
      ext = tempFile.substr((tempFile.length - 4), 4).toLowerCase();
      for (var i=0; i<extArray.length; i++) {
         if (extArray[i] == ext) {
            allowSubmit = true;
            break;
         }
      }
      if (allowSubmit) {
         return true;
      } else {
         alert("Invalid File type: " + file + "\nPlease only upload files that end in types: " + (extArray.join(" ")) + "\nPlease select a new file to upload.");
         return false;
      }
   }
}

function limitAudioAttach(file) { 
   var extArray = new Array(".wma",".wav",".au",".mp3");
   var allowSubmit = false;

   if (!file) { return true; }
   // If path not included (e.g. Firefox)
   if (file.indexOf("\\") == -1) {
      ext = file.substr((file.length - 4), 4).toLowerCase();
      for (var i=0; i<extArray.length; i++) {
         if (extArray[i] == ext) {
            allowSubmit = true;
            break;
         }
      }
      if (allowSubmit) {
         return true;
      } else {
         alert("Invalid File type: " + file + "\nPlease only upload files that end in types: " + (extArray.join(" ")) + "\nPlease select a new file to upload.");
         return false;
      }
   }
   // Cycle through path to get to filename
   while (file.indexOf("\\") != -1) {
      tempFile = file.slice(file.indexOf("\\") + 1);
      // Validate for .wma, .wav and .mp3
      ext = tempFile.substr((tempFile.length - 4), 4).toLowerCase();
      for (var i=0; i<extArray.length; i++) {
         if (extArray[i] == ext) {
            allowSubmit = true;
            break;
         }
      }
      // Validate for .au
      ext = tempFile.substr((tempFile.length - 3), 3).toLowerCase();
      for (var i=0; i<extArray.length; i++) {
         if (extArray[i] == ext) {
            allowSubmit = true;
            break;
         }
      }
      if (allowSubmit) {
         return true;
      } else {
         alert("Invalid File type: " + file + "\nPlease only upload files that end in types: " + (extArray.join(" ")) + "\nPlease select a new file to upload.");
         return false;
      }
   }
}

function validateGbForm(thisform){
   if (thisform.user.value == "") {
      thisform.user.focus();
      alert("You must enter your name, please try again.");
      return false;
   }
   if (thisform.comments.value == "") {
      thisform.comments.focus();
      alert("You must enter some comments, please try again.");
      return false;
   }
   if (thisform.code.value == "") {
      thisform.code.focus();
      alert("You must enter the Verification Code.");
      return false;
   }
}

function validateGcForm(thisform){
   if (thisform.date.value == "") {
      thisform.date.focus();
      alert("You must enter a date, please try again.");
      return false;
   }
   if (checkDate('Calendar1') == 1) {
      thisform.date.focus();
      alert("Please enter a valid Growthchart Date");
      return false;
   }
   if (thisform.age.value == "") {
      thisform.age.focus();
      alert("You must enter an age, please try again.");
      return false;
   }
}

function validateEmailForm(thisform){
   if (thisform.name.value == "") {
      thisform.name.focus();
      alert("You must enter a name, please try again.");
      return false;
   }
   if (thisform.email.value == "") {
      thisform.email.focus();
      alert("You must specify an email address, please try again.");
      return false;
   }
   if (validateEmail2(thisform.email.value)) {
      return true;
   } else {
      thisform.email.focus();
      return false;
   }   
}

function validateNewUserForm(thisform) {
   var invalid = " "; // Invalid character is a space
   var minLength = 4; // Minimum length
   var pw1 = thisform.pswd1.value;
   var pw2 = thisform.pswd2.value;
   var alphanum = "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
   thisform.user.value.toLowerCase();

   if (thisform.user.value == '') {
      thisform.user.focus();
      alert('Please enter a User ID.');
      return false;
   } 
   if (thisform.user.value.length < minLength) {
      thisform.user.select();
      thisform.user.focus();
      alert('Your User ID must be at least ' + minLength + ' characters long. Try again.');
      return false;
   }
   for (var i=0;i < thisform.user.value.length;i++){
      temp=thisform.user.value.substring(i,i+1)
      if (alphanum.indexOf(temp)==-1){
         thisform.user.select();
         thisform.user.focus();      
         alert('Invalid User ID, must be alphanumeric with no spaces.  Please try again.');
         return false;
      }
   }   
   
   // check for a value in both fields.
   if (pw1 == '' || pw2 == '') {
      thisform.pswd1.select();
      thisform.pswd1.focus();
      alert('Please enter your password twice.');
      return false;
   }
   if (pw1 != pw2) {
      thisform.pswd1.select();
      thisform.pswd1.focus();
      alert('You did not enter the same new password twice. Please re-enter your password.');
      return false;
   }   
   // check for minimum length
   if (pw1.length < minLength) {
      thisform.pswd1.select();
      thisform.pswd1.focus();
      alert('Your password must be at least ' + minLength + ' characters long. Try again.');
      return false;
   } 
   // check for spaces
   if (pw1.indexOf(invalid) > -1) {
      thisform.pswd1.select();
      thisform.pswd1.focus();
      alert('Sorry, spaces are not allowed.');
      return false;
   }
   if (validateEmail2(thisform.email.value)) {
      return true;
   } else {
      thisform.email.select();
      thisform.email.focus();
      return false;
   }   
   return true;
}

function validateAcctForm(thisform) {
   var themessage = "You are required to complete the following fields: ";
   if (thisform.firstMom.value=="") {
   themessage = themessage + " - Mother's First Name";
   }
   if (thisform.lastMom.value=="") {
   themessage = themessage + " - Mother's Last Name";
   }
   if (thisform.firstDad.value=="") {
   themessage = themessage + " - Father's First Name";
   }
   if (thisform.lastDad.value=="") {
   themessage = themessage + " - Father's Last Name";
   }
   if (thisform.email.value=="") {
   themessage = themessage + " - Email";
   }   
   if (thisform.first.value=="") {
      themessage = themessage + " - Baby's First Name";
   }
   if (thisform.last.value=="") {
      themessage = themessage + " - Baby's Last Name";
   }
   if (thisform.dob.value=="") {
      themessage = themessage + " - Baby's Date-of-Birth ";
   }
   //alert if fields are empty and cancel form submit
   if (themessage == "You are required to complete the following fields: ") {
      return true;
   } else {
      alert(themessage);
      return false;      
   }
}

function validateStoryForm(thisform) {
   var tempDate  = thisform.date.value;
   var tempTitle = thisform.title.value;
   var tempJrnl  = thisform.journal.value;

   var temp = 0;
   for (i=0; i<tempDate.length; i++) {
      if (tempDate.charAt(i) != " ") {
         temp = 1;
      }
   }
   if (temp == 0) {
      alert("You must enter a Date for your Journal Entry.");
      return false;
   }
   if (checkDate('Calendar1') == 1) {
      thisform.date.focus();
      alert("Please enter a valid Journal Date");
      return false;
   }
   var temp = 0;
   for (i=0; i<tempTitle.length; i++) {
      if (tempTitle.charAt(i) != " ") {
         temp = 1;
      }
   }
   if (temp == 0) {
      alert("You must enter a Title for your Journal Entry.");
      return false;
   }
   var temp = 0;
   for (i=0; i<tempJrnl.length; i++) {
      if (tempJrnl.charAt(i) != " ") {
         temp = 1;
      }
   }
   if (temp == 0) {
      alert("You must enter a valid Journal Entry.");
      return false;
   }   
   return true;
}

function validateContactMe(thisform) {
   if (thisform.from.value == "") {
      thisform.from.focus();
      alert("Please enter your Name.");
      return false;
   }
   if (thisform.fromEmail.value == "") {
      thisform.fromEmail.focus();
      alert('Please enter your Email Address.');
      return false;
   }
   if (!(validateEmail2(thisform.fromEmail.value))) {
      thisform.fromEmail.focus();
      return false;
   }
   if (thisform.subject.value == "") {
      thisform.subject.focus();
      alert("Please enter a Subject.");
      return false;
   }
   if (thisform.message.value == "") {
      thisform.message.focus();
      alert("Please enter a Message.");
      return false;
   }
   if (thisform.code.value == "") {
      thisform.code.focus();
      alert('Please enter the Verification Code.');
      return false;
   }
   return true;
}

function validateTerms(thisform) {
   if (!thisform.elements[1].checked && !thisform.elements[2].checked) {
      alert("You must select ACCEPT or DECLINE, please try again.");
      return false;
   }
   return true;
}

function validateSetupForm(thisform) {
   if ((thisform.momfirst.value=="" || thisform.momlast.value=="") && (thisform.dadfirst.value=="" || thisform.dadlast.value=="")) {
      thisform.momfirst.focus();
      alert("You must specify the mother's or father's full name.");
      return false;
   }
   if (thisform.babyfirst.value=="") {
      thisform.babyfirst.focus();
      alert("You must specify the Baby's First Name.");
      return false;      
   }
   if (thisform.babylast.value=="") {
      thisform.babylast.focus();
      alert("You must specify the the Baby's Last Name");
      return false;      
   }
   if (thisform.babydob.value=="") {
      thisform.babydob.focus();
      alert("You must specify the Baby's Due Date or Birthdate.");
      return false;      
   }     
   if (thisform.hospID.value == "YY" && thisform.hospital.value == "") {
      thisform.hospital.focus();
      alert("You must enter a Hospital Name if you specified Other Hospital");
      return false;
   }   
   return true;
}

function validateSenderForm(thisform) {
   if (thisform.senderName.value == '') {
      thisform.senderName.focus();
      alert('Please enter your name.');
      return false;
   } 
   if (thisform.senderEmail.value == "") {
      thisform.senderEmail.focus();
      alert('Please enter your Email Address.');
      return false;
   }
   if (!validateEmail2(thisform.senderEmail.value)) {
      return false;
   }
   if (thisform.recipName.value == '') {
      thisform.recipName.focus();
      alert("Please enter the Gift Recipient's Name.");
      return false;
   }    
   if (thisform.recipEmail.value != "") {
      if (validateEmail2(thisform.recipEmail.value)) {
         return true;
      } else {
         return false;
      }
   }   
   return true;
}

function validateTrialForm(thisform) {
   if (thisform.userName.value == '') {
      thisform.userName.focus();
      alert('Please enter your name.');
      return false;
   } 
   if (thisform.userEmail.value == "") {
      thisform.userEmail.focus();
      alert('Please enter your Email Address.');
      return false;
   }
   if (!validateEmail2(thisform.userEmail.value)) {
      return false;
   }
   return true;
}

function validateConfirmForm(thisform) {
   if (thisform.sCode.value == '') {
      thisform.sCode.focus();
      alert('Please enter your Confirmation Code.');
      return false;
   } 
   return true;
}

function photoAction(action,thisform) {
   switch (action) {
      case (0): thisform.c.value = "savepic";
                thisform.optn.value = ""; 
                break;
      case (1): thisform.c.value    = "selectpic"; 
                thisform.optn.value = "tmp"; 
                break;
      case (2): thisform.c.value    = ""; 
                thisform.optn.value = ""; 
                break;                
   }
   thisform.submit();
   return true;   
}

function messageAction(action,thisform) {
   switch (action) {
      case (0): thisform.c.value = "saveoptn";
                break;
      case (1): thisform.c.value = ""; 
                break;                
   }
   thisform.submit();
   return true;   
}

function validateLinkForm(thisform){
   if (thisform.title.value == "") {
      thisform.title.focus();
      alert("Please enter a Link Title");
      return false;
   }
   if (thisform.url.value == "") {
      thisform.url.focus();
      alert("Please enter a Website Address. (e.g. http://www.babysites.com)");
      return false;
   }   
   return true;
}

function openDir(thisform) {
   var newIndex = thisform.seq.selectedIndex;
   cururl = thisform.seq.options[ newIndex ].value;
   window.location.href = cururl;
}

function validateFeedbackForm(thisform){
   if (thisform.issue.value == "") {
      thisform.issue.focus();
      alert("You must enter a Subject, please try again.");
      return false;
   }
   if (thisform.detail.value == "") {
      thisform.detail.focus();
      alert("Please provide us with some Feedback.  Try again.");
      return false;
   }
   if (thisform.code.value == "") {
      thisform.code.focus();
      alert("You must enter the Verification Code.");
      return false;
   }
}

function changeSlideshowSpeed(thisform) {
   if (thisform.slideSpeed.value == "S") {
      SLIDES.timeout = 6000;
   } else {
      if (thisform.slideSpeed.value == "F") {
         SLIDES.timeout = 2000;
      } else {
         SLIDES.timeout = 4000;
      }
   }
}

function updateKeepsakeTotal(thisform) {
   var shipping;
   var invcTotal;
   var qty   = thisform.ksQty.options[thisform.ksQty.selectedIndex].value;
   var total = qty * 15;
   thisform.ksTotal.value = "$" + total + ".00 USD";
   if (qty < 3) {
      shipping = 3;
   } else if (qty < 5) {
      shipping = 5;
   } else if (qty < 7) {
      shipping = 7;
   } else if (qty < 9) {
      shipping = 9;
   } else if (qty < 11) {
      shipping = 11;
   }
   thisform.ksShipping.value = "$" + shipping + ".00 USD";
   invcTotal = total + shipping;
   thisform.invcTotal.value = "$" + invcTotal + ".00 USD";
}

function validateKeepsakeOrder(thisform) {
   if (thisform.shipName.value == "") {
      thisform.shipName.focus();
      alert("** Error - You must enter a Shipping Recipient.  Please try again.");
      return false;
   }
   if (thisform.shipAddr1.value == "") {
      thisform.shipAddr1.focus();
      alert("** Error - You must enter a Shipping Address.  Please try again.");
      return false;
   }
   if (thisform.shipCity.value == "") {
      thisform.shipCity.focus();
      alert("** Error - You must enter a Shipping City.  Please try again.");
      return false;
   }
   return true;
}

function validateJournalForm(thisform) {
   if (thisform.date.value == "") {
      thisform.date.focus();
      alert("** Error - You must enter a Journal Date.  Please try again.");
      return false;
   }
   if (thisform.title.value == "") {
      thisform.title.focus();
      alert("** Error - You must enter a Journal Title.  Please try again.");
      return false;
   }
   if (thisform.journal.value == "") {
      thisform.journal.focus();
      alert("** Error - You must enter Journal Content.  Please try again.");
      return false;
   }
   return true;
}

function validateUpgrade(thisform) {
   if (thisform.domainopt.value != "X") {
      if (thisform.domain.value == "") {
         thisform.domain.focus();
         alert('** Error - To purchase a domain name, you must specify a value.  Please try again.');
         return false;
      }
   }
   return true;
}
-->