function updateCookie(name, value) { document.cookie=name+"="+value+"; expires=Saturday, 01-Apr-2200 08:00:00 GMT ; path=/"; return true; } function goBack() { var DBPath = document.forms[0].DBPath.value ; var searchString = document.forms[0].query.value ; var thehits = document.forms[0].Hits.value ; var totalhits = document.forms[0].totalhits.value ; var thestart = document.forms[0].start.value ; var thecount = document.forms[0].count.value ; if (parseInt(thestart) - parseInt(thecount) + 1 < 1 ) { startat = 1 ; } else { startat = parseInt(thestart) - parseInt(thecount) } window.location = ("/" + DBPath + "/SearchResults?SearchView&Query=" + searchString + "&Start=" + startat + "&Count=" + thecount + "&SearchOrder=1" + "&SearchWV=TRUE"); }; function goForward() { var computedString = document.forms[0].ComputedQuery.value ; var searchString = document.forms[0].query.value ; var thehits = document.forms[0].Hits.value ; var totalhits = document.forms[0].totalhits.value ; var thestart = document.forms[0].start.value ; var thecount = document.forms[0].count.value ; if (parseInt(thestart) + parseInt(thehits) > parseInt(totalhits) ) { startat = thestart ; } else { startat = parseInt(thestart) + parseInt(thecount) } window.location = ("/anaweb/petbookings.nsf/SearchResults?SearchView&Query=" + searchString + "&Start=" + startat + "&Count=" + thecount + "&SearchOrder=1" + "&SearchWV=TRUE"); }; function doSearch() { var searchString = ""; var computedString = "" ; computedString = document.forms[0].ComputedQuery.value ; searchString = document.forms[0].SearchFormula.value ; if (searchString == "" ) { alert("You have to enter something for me to search for!") ; } else { //window.open(computedString + searchString, window.name); window.location = ("/anaweb/petbookings.nsf/SearchResults?SearchView&Query=" + searchString + computedString); } } ; function doReminder() { var emailStr = document._DominoForm3.UserName.value; var reg1 = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/; var reg2 = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/; if ( !reg1.test( emailStr ) && reg2.test( emailStr ) ) { window.location = ("/anaweb/petbookings.nsf/Reminder?OpenAgent&address=" + emailStr); } else { alert('You must enter a valid email address for us to send you your password!'); } } ; function setFormFocus(e) { e.focus(); e.select(); }; function checkSubmitted(f) { if (isSubmitted =="NO") { isSubmitted = "YES"; f.submit(); } else { alert("You have already submitted this document, just waiting for response from the server. Please click 'OK' to continue.") } } ; function doSubmit(f, v){ if ( v ){ var a = new Array(); a[a.length] = [f.DepartureAirport, 'You must enter a departure airport!']; a[a.length] = [f.DestinationAirport, 'You must enter a destination airport!']; a[a.length] = [f.FlightDate, 'You must enter a date!', ['date', null, null, f.DateFormat.value]]; if ( validateRequiredFields( f, a ) ){ return true; }else{ return false; } } else { return true; } }; function doSubmitFinal(f, v){ if ( v ){ var a = new Array(); a[a.length] = [f.PetName, 'Please add details of the pet(s) for the booking request']; a[a.length] = [f.Requestor, 'Please enter the name of the shipper.']; a[a.length] = [f.Address1, 'Please enter the address of the shipper.']; a[a.length] = [f.Telephone, 'Please enter the telephone number of the shipper.']; a[a.length] = [f.EMail, 'Please enter the e-mail address of the shipper.']; a[a.length] = [f.Requestor_Rec, 'Please enter the name of the receiver.']; a[a.length] = [f.Address1_Rec, 'Please enter the address of the receiver.']; a[a.length] = [f.Telephone_Rec, 'Please enter the telephone number of the receiver.']; a[a.length] = [f.EMail_Rec, 'Please enter the e-mail address of the receiver.']; a[a.length] = [f.PetName, 'Please enter details of your pet.']; a[a.length] = [f.TermsAndConditions, 'Please check the box if you agree to the Terms and Conditions.']; if ( validateRequiredFields( f, a ) ){ return true; }else{ return false; } } else { return true; } }; function doSubmit2(f, v){ if ( v ){ var a = new Array(); a[a.length] = [f.FlightSelection, 'You must select a flight!']; if ( validateRequiredFields( f, a ) ){ return true; }else{ return false; } } else { return true; } }; function doSubmit3(f, v){ if ( v ){ var a = new Array(); a[a.length] = [f.PetType_1, 'You must select the pet type!']; a[a.length] = [f.Length_1, 'You must enter the box length (cm)']; a[a.length] = [f.Width_1, 'You must enter the box width (cm)']; a[a.length] = [f.Height_1, 'You must enter the box height (cm)']; a[a.length] = [f.Weight_1, 'You must enter the box weight (kilos)']; if ( (f.NumberOfPets[1].checked) ) { a[a.length] = [f.PetType_2, 'You must select the pet type!']; a[a.length] = [f.Length_2, 'You must enter the box length (cm)']; a[a.length] = [f.Width_2, 'You must enter the box width (cm)']; a[a.length] = [f.Height_2, 'You must enter the box height (cm)']; a[a.length] = [f.Weight_2, 'You must enter the box weight (kilos)']; } if ( f.NumberOfPets[2].checked ) { a[a.length] = [f.PetType_2, 'You must select the pet type!']; a[a.length] = [f.Length_2, 'You must enter the box length (cm)']; a[a.length] = [f.Width_2, 'You must enter the box width (cm)']; a[a.length] = [f.Height_2, 'You must enter the box height (cm)']; a[a.length] = [f.Weight_2, 'You must enter the box weight (kilos)']; a[a.length] = [f.PetType_3, 'You must select the pet type!']; a[a.length] = [f.Length_3, 'You must enter the box length (cm)']; a[a.length] = [f.Width_3, 'You must enter the box width (cm)']; a[a.length] = [f.Height_3, 'You must enter the box height (cm)']; a[a.length] = [f.Weight_3, 'You must enter the box weight (kilos)']; } if ( validateRequiredFields( f, a ) ){ return true; }else{ return false; } } else { return true; } }; function doSubmitPet(f, v){ if ( v ){ var a = new Array(); a[a.length] = [f.PetType, 'You must select the pet type!']; a[a.length] = [f.PetName, 'Please enter the name of the pet.']; a[a.length] = [f.Length, 'You must enter the box length (cm)', ['number', 0, null]]; a[a.length] = [f.Width, 'You must enter the box width (cm)', ['number', 0, null]]; a[a.length] = [f.Height, 'You must enter the box height (cm)', ['number', 0, null]]; a[a.length] = [f.Weight, 'You must enter the box weight (kilos)', ['number', 0, null]]; if ( validateRequiredFields( f, a ) ){ return true; }else{ return false; } } else { return true; } }; function doSubmit_Repatriation(f, v){ if ( v ){ var a = new Array(); a[a.length] = [f.Name, 'Please enter the name.']; a[a.length] = [f.CauseOfDeath, 'Please enter the cause of death.']; a[a.length] = [f.Ref, 'Please enter your reference.']; a[a.length] = [f.UKFD, 'Please enter the UK funeral directors.']; a[a.length] = [f.UKFD_Phone, 'Please enter the telephone number for the UK funeral directors.']; a[a.length] = [f.OFD, 'Please enter the overseas funeral directors.']; a[a.length] = [f.OFD_Phone, 'Please enter the telephone number for the overseas funeral directors.']; a[a.length] = [f.UKConsignee, 'Please enter the UK consignee.']; a[a.length] = [f.UKConsignee_Phone, 'Please enter the telephone number for the UK consignee.']; a[a.length] = [f.FamilyTravelling, 'Please indicate if any family is travelling.']; if ( validateRequiredFields( f, a ) ){ return true; }else{ return false; } } else { return true; } }; function readValues(){ var lastyear = new Date(); lastyear.setFullYear(lastyear.getFullYear() - 1); switch(document.forms[0].SubType.value) { case 'Homepage': document.cookie = "TitleCookie=Delete; expires=" + lastyear.toGMTString(); document.cookie = "LevelCookie=Delete; expires=" + lastyear.toGMTString(); break; case 'Sub Home' : switch(document.forms[0].Type.value) { case 'Thank You': document.cookie = "TitleCookie=Products;path=/"; document.cookie = "LevelCookie=Delete; expires=" + lastyear.toGMTString(); break; default: document.cookie = "TitleCookie=" + escape(document.forms[0].DisplayTag.value) + ";path=/"; document.cookie = "LevelCookie=Delete; expires=" + lastyear.toGMTString(); break; } ; break; case '1 level': document.cookie = "LevelCookie=" + escape(document.forms[0].DisplayTag.value) + ";path=/"; break; }; }; function openPetPopUp() { var popupwidth = 400 ; var popupheight = 400 ; var screenwidth = screen.availWidth ; var screenheight = screen.availHeight ; var xpos = (screenwidth - popupwidth) / 2 ; var ypos = (screenheight - popupheight) / 2 ; if (xpos < 0){ xpos = 0 } ; if (ypos < 0){ ypos = 0 } ; window.open("/anaweb/petbookings.nsf/PetPopUp!OpenForm","Add_Pet", "scrollbars=yes,status=yes,resizable=yes,width=" + popupwidth + ",height=" + popupheight + ", screenX =" + xpos + ", screenY = " + ypos+ ", left =" + xpos + ", top = " + ypos); } ; function addPet(){ var temp = document.forms[0].PetType; for (var i=0; i -1){ if(VALUE.charAt(iTemp) == w_space){ } else{ strTemp = VALUE.substring(0,iTemp +1); break; } iTemp = iTemp-1; } //End While return strTemp; } //End Function function LTrim(VALUE){ var w_space = String.fromCharCode(32); if(v_length < 1){ return""; } var v_length = VALUE.length; var strTemp = ""; var iTemp = 0; while(iTemp < v_length){ if(VALUE.charAt(iTemp) == w_space){ } else{ strTemp = VALUE.substring(iTemp,v_length); break; } iTemp = iTemp + 1; } //End While return strTemp; } //End Function function clearAirports() { document.forms[0].DepartureAirport.value = "...choose..."; document.forms[0].DestinationAirport.value = "...choose..."; document.forms[0].__Click.value = '$Refresh'; document.forms[0].submit(); } function flightSelected(docID, flightdate, flightday, deptime, arrtime, flightnum) { document.forms[0].SelectedFlightDocID.value = docID; document.forms[0].SelectedFlight.value = flightdate; document.forms[0].SelectedFlightDay.value = flightday; document.forms[0].SelectedFlightDepTime.value = deptime; document.forms[0].SelectedFlightArrTime.value = arrtime; document.forms[0].Status.value = 'Flight Selected'; document.forms[0].SelectedFlightNum.value = flightnum; document.forms[0].__Click.value = '$Refresh'; document.forms[0].submit(); } function backtoFlightSelection(){ document.forms[0].Status.value = 'Initial Enquiry'; document.forms[0].__Click.value = '$Refresh'; document.forms[0].submit(); } /*********************************************************** following two functions call the date picking dialog box ************************************************************/ function myDateDialog(){ var retDay; var retMonth; var retYear; } function openDatePickerDialog(wnd, field, dateFormat) { myDateDialog.retDay=""; myDateDialog.retMonth=""; myDateDialog.retYear=""; var pathname = window.location.pathname; var dlgURL = pathname.substring(0,(pathname.lastIndexOf(".nsf") + 5))+'dlgDatePicker?OpenForm'; if(wnd.showModalDialog(dlgURL,myDateDialog,"dialogHeight:380px;dialogWidth:280px;center")==true){ field.value=dateFormat.replace(/yyyy/, myDateDialog.retYear).replace(/mm/, myDateDialog.retMonth).replace(/dd/, myDateDialog.retDay); }else{ return; } }