var active_pid = "7D7CC394-1785-40C5-AE2E-6E492193A460"; var Default_Profile_Domain = "InformationPlatform.com"; var http = "http"; var bHttps = false ; N = (document.layers) ? true:false; // netscape 4 I = (document.all) ? true:false; // ie4+ DOM = ((document.getElementById)&&(!I))?true:false; // ns6 etc. function errHandler(sMsg,sUrl,sLine) { //IE,NS //This function will trap any errors generated by the scripts and filter the unhandled ones. //------------------------------ //Version 1.1 // //alert(sMsg); if(sMsg.substr(0,16)!="Access is denied"&&sMsg!="Permission denied") alert("Java Script Error\n" + "\nDescription: " + sMsg + "\nSource: " + sUrl + "\nLine: "+sLine); return true; } //window.onerror=errHandler; function _init_main_js(){ try { if (location.href.substring(0,5)=="https"){bHttps = true}; if(bHttps == true){http="https"} Default_Profile_Domain = Default_Profile_Domain.toLowerCase(); //alert(Default_Profile_Domain); if (top.location.href.indexOf(Default_Profile_Domain) == -1 && http!=='https'){top.location.href = 'http://'+Default_Profile_Domain;} } catch(err){//alert("Unable to attach top!"); } } function do_POSesCheck(){try {if (document.cookie == "" && top.location.href.indexOf("error.asp") == -1) {top.location.href= http +'://'+ Default_Profile_Domain + '/error.asp?pid='+active_pid+'&EC=NOCOOKIE';} }catch(err){/*alert("Unable to attach top!");*/}} var ran_number= Math.random()*4; function create_new_rn(){ ran_number= Math.random()*4 } function checkBlank(fieldObject, Message) {if ( fieldObject.value.length == 0){if (Message != "") alert(Message);fieldObject.focus();return false;}return true;} function stripSpaces (strArray) { ssresult = new Array(); for (i = 0; i < strArray.length; i++) { str = strArray[i]; while (str.charAt(str.length - 1) == ' ') str = str.substring(0, str.length - 2); while (str.charAt(0) == ' ') str = str.substring(1, str.length); ssresult[i] = str; } return(ssresult); } function IsValidEMail(emailaddr) { emailaddr = trim(emailaddr); var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/; if (filter.test(emailaddr)){return true;} else {return false}; } function MM_findObj(n, d) {var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i1) return(s.substring(0,l-2));return (s=="" ? "undefined":s);}function KM(k, o) {var k=k.toLowerCase();for (var u in o) {if (typeof(o[u])!="function" && u.toString().toLowerCase()==k) return u;};}if (window.location && window.location.search) {LS=window.location.search;var l=LS.length;if (l>0) {LS=LS.substring(1,l);var preAmpAt=0;var ampAt=-1;var eqAt=-1;var k=0;var skip=false;for (var i=0; ieqAt) {AVTK(URID(LS.substring(preAmpAt,eqAt)),URID(LS.substring(eqAt+1,ampAt)));preAmpAt=ampAt+1;eqAt=ampAt=-1;++k;};};if (LS.charAt(preAmpAt)!="=" && (preAmpAt!=0 || i!=0 || c!="=")) {if (preAmpAt!=l) {if (eqAt!=-1) AVTK(URID(LS.substring(preAmpAt,eqAt)),URID(LS.substring(eqAt+1,l)));else if (preAmpAt!=l-1) AVTK(URID(LS.substring(preAmpAt,l)),"");};if (l==1) AVTK(LS.substring(0,1),"");};};};var TC=OL(QS);if (!TC) TC=0;QS.toString=function() {return LS.toString()};QS.Count=function() {return (TC ? TC:0)};QS.Count.toString=function() {return (TC ? TC.toString():"0")};QS.Item=function(e) {if (typeof(e)=="undefined") return LS;else {if (typeof(e)=="number") {var e=Math.ceil(e);var c=0;for (var i in QS) {if (typeof(QS[i])!="function" && ++c==e) return QS[i];};Err("ERROR: Index out of range in\nRequest.QueryString().Item("+e+")");}else return QS[KM(e, QS)];};return "undefined";};QS.Item.toString=function() {return LS.toString()};QS.Key=function(e) {var t=typeof(e);if (t=="number") {var e=Math.ceil(e);var c=0;for (var i in QS) {if (typeof(QS[i])!="function" && ++c==e) return i;}}else if (t=="string") {var e=KM(e, QS);var a=QS[e];return (typeof(a)!="undefined" && a && a.toString() ? e:"");}else Err("ERROR: Wrong number of arguments or invalid property assignment\nRequest.QueryString().Key("+(e?e:"")+")");Err("ERROR: Index out of range in\nRequest.QueryString().Item("+e+")");};QS.Key.toString=function() {Err("ERROR: Wrong number of arguments or invalid property assignment\nRequest.QueryString().Key");};this.QueryString=function(k) {if (typeof(k)=="undefined") return QS;else {var k=KM(k, QS);if (typeof(QS[k])=="undefined") {t=new Object();t.Count=function() {return 0};t.Count.toString=function() {return "0"};t.toString=function() {return "undefined"};t.Item=function(e) {return "undefined"};t.Item.toString=function() {return "undefined"};t.Key=function(e) {Err("ERROR: Object doesn't support this property or method\nRequest.QueryString.Key("+(e?e:"")+")");};t.Key.toString=function() {return "undefined"};return t;}if (typeof(k)=="number") return QS.Item(k);else return QS[k];}}; this.QueryString.toString=function() {return LS.toString();};this.QueryString.Count=function() {return (TC ? TC:0)};this.QueryString.Count.toString=function() {return (TC ? TC.toString():"0")};this.QueryString.Item=function(e) {if (typeof(e)=="undefined") return LS.toString();else {if (typeof(e)=="number") {var e=Math.ceil(e);var c=0;for (var i in QS) {if (typeof(QS[i])!="function" && ++c==e) return QS[i];};Err("ERROR: Index out of range in\nRequest.QueryString.Item("+e+")");}else return QS[KM(e, QS)];}if (typeof(e)==("number")) Err("ERROR: Index out of range in\nRequest.QueryString.Item("+e+")");return "undefined";};this.QueryString.Item.toString=function() {return LS.toString()};this.QueryString.Key=function(e) {var t=typeof(e);if (t=="number") {var e=Math.ceil(e);var c=0;for (var i in QS) {if (typeof(QS[i])=="object" && (++c==e)) {return i;}}}else if (t=="string") {var e=KM(e, QS);var a=QS[e];return (typeof(a)!="undefined" && a && a.toString() ? e:"");}else Err("ERROR: Wrong number of arguments or invalid property assignment\nRequest.QueryString.Key("+(e?e:"")+")");Err("ERROR: Index out of range in\nRequest.QueryString.Item("+e+")");};this.QueryString.Key.toString=function() {Err("ERROR: Wrong number of arguments or invalid property assignment\nRequest.QueryString.Key");};}var Request=new RObj(false); function getCookieVal(offset){var endstr = document.cookie.indexOf (";", offset);if (endstr == -1)endstr = document.cookie.length;return unescape(document.cookie.substring(offset, endstr));} function GetCookie (name){var arg = name + "=";var alen = arg.length;var clen = document.cookie.length;var i = 0;while (i < clen) {var j = i + alen;if (document.cookie.substring(i, j) == arg);return getCookieVal (j);i = document.cookie.indexOf(" ", i) + 1;if (i == 0) break;}return null;}var expDays = 365;var exp = new Date();exp.setTime(exp.getTime() + (expDays*24*60*60*1000)); function setCookie(NameOfCookie, value) { var expiredays =365;var ExpireDate = new Date ();ExpireDate.setTime(ExpireDate.getTime() + (expiredays * 24 * 3600 * 1000));document.cookie = NameOfCookie + "=" + escape(value) + ";path=/" + ((expiredays == null) ? "" : ";expires=" + ExpireDate.toGMTString());} function delCookie (NameOfCookie) { if (GetCookie(NameOfCookie)) {document.cookie = NameOfCookie + "=" + "; expires=Thu, 01-Jan-70 00:00:01 GMT"; }} function trim(inputString) {if (typeof inputString != "string") { return inputString; }var retValue = inputString;var ch = retValue.substring(0, 1);while (ch == " ") { retValue = retValue.substring(1, retValue.length);ch = retValue.substring(0, 1);}ch = retValue.substring(retValue.length-1, retValue.length);while (ch == " ") { retValue = retValue.substring(0, retValue.length-1);ch = retValue.substring(retValue.length-1, retValue.length);};while (retValue.indexOf(" ") != -1) { retValue = retValue.substring(0, retValue.indexOf(" ")) + retValue.substring(retValue.indexOf(" ")+1, retValue.length);}return retValue;} var MONTH_NAMES = new Array('January','February','March','April','May','June','July','August','September','October','November','December','Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'); // ------------------------------------------------------------------ // isDate ( date_string, format_string ) // // Returns true if date string matches format of format string and // is a valid date. Else returns false. // // It is recommended that you trim whitespace around the value before // passing it to this function, as whitespace is NOT ignored! // ------------------------------------------------------------------ function isDate(val,format) {var date = getDateFromFormat(val,format);if (date == 0) { return false; }return true;} // ------------------------------------------------------------------- // compareDates(date1,date1format,date2,date2format) // Compare two date strings to see which is greater. // Returns: // 1 if date1 is greater than date2 // 0 if date2 is greater than date1 of if they are the same // -1 if either of the dates is in an invalid format // ------------------------------------------------------------------- function compareDates(date1,dateformat1,date2,dateformat2) {var d1 = getDateFromFormat(date1,dateformat1);var d2 = getDateFromFormat(date2,dateformat2);if (d1==0 || d2==0) {return -1;}else if (d1 > d2) {return 1;}return 0;} // ------------------------------------------------------------------ // formatDate (date_object, format) // // Returns a date in the output format specified. // The format string uses the same abbreviations as in getDateFromFormat() // ------------------------------------------------------------------ function formatDate(date,format) { format = format+""; var result = ""; var i_format = 0; var c = ""; var token = ""; var y = date.getYear()+""; var M = date.getMonth()+1; var d = date.getDate(); var H = date.getHours(); var m = date.getMinutes(); var s = date.getSeconds(); var yyyy,yy,MMM,MM,dd,hh,h,mm,ss,ampm,HH,H,KK,K,kk,k; // Convert real date parts into formatted versions // Year if (y.length < 4) { y = y-0+1900; } y = ""+y; yyyy = y; yy = y.substring(2,4); // Month if (M < 10) { MM = "0"+M; } else { MM = M; } MMM = MONTH_NAMES[M-1]; // Date if (d < 10) { dd = "0"+d; } else { dd = d; } // Hour h=H+1; K=H; k=H+1; if (h > 12) { h-=12; } if (h == 0) { h=12; } if (h < 10) { hh = "0"+h; } else { hh = h; } if (H < 10) { HH = "0"+K; } else { HH = H; } if (K > 11) { K-=12; } if (K < 10) { KK = "0"+K; } else { KK = K; } if (k < 10) { kk = "0"+k; } else { kk = k; } // AM/PM if (H > 11) { ampm="PM"; } else { ampm="AM"; } // Minute if (m < 10) { mm = "0"+m; } else { mm = m; } // Second if (s < 10) { ss = "0"+s; } else { ss = s; } // Now put them all into an object! var value = new Object(); value["yyyy"] = yyyy; value["yy"] = yy; value["y"] = y; value["MMM"] = MMM; value["MM"] = MM; value["M"] = M; value["dd"] = dd; value["d"] = d; value["hh"] = hh; value["h"] = h; value["HH"] = HH; value["H"] = H; value["KK"] = KK; value["K"] = K; value["kk"] = kk; value["k"] = k; value["mm"] = mm; value["m"] = m; value["ss"] = ss; value["s"] = s; value["a"] = ampm; while (i_format < format.length) { // Get next token from format string c = format.charAt(i_format); token = ""; while ((format.charAt(i_format) == c) && (i_format < format.length)) { token += format.charAt(i_format); i_format++; } if (value[token] != null) { result = result + value[token]; } else { result = result + token; } } return result; } // ------------------------------------------------------------------ // Utility functions for parsing in getDateFromFormat() // ------------------------------------------------------------------ function _isInteger(val) { var digits = "1234567890"; for (var i=0; i < val.length; i++) { if (digits.indexOf(val.charAt(i)) == -1) { return false; } } return true; } function _getInt(str,i,minlength,maxlength) { for (x=maxlength; x>=minlength; x--) { var token = str.substring(i,i+x); if (token.length < minlength) { return null; } if (_isInteger(token)) { return token; } } return null; } // ------------------------------------------------------------------ // END Utility Functions // ------------------------------------------------------------------ // ------------------------------------------------------------------ // getDateFromFormat( date_string , format_string ) // // This function takes a date string and a format string. It matches // If the date string matches the format string, it returns the // getTime() of the date. If it does not match, it returns 0. // // This function uses the same format strings as the // java.text.SimpleDateFormat class, with minor exceptions. // // The format string consists of the following abbreviations: // // Field | Full Form | Short Form // -------------+--------------------+----------------------- // Year | yyyy (4 digits) | yy (2 digits), y (2 or 4 digits) // Month | MMM (name or abbr.)| MM (2 digits), M (1 or 2 digits) // Day of Month | dd (2 digits) | d (1 or 2 digits) // Hour (1-12) | hh (2 digits) | h (1 or 2 digits) // Hour (0-23) | HH (2 digits) | H (1 or 2 digits) // Hour (0-11) | KK (2 digits) | K (1 or 2 digits) // Hour (1-24) | kk (2 digits) | k (1 or 2 digits) // Minute | mm (2 digits) | m (1 or 2 digits) // Second | ss (2 digits) | s (1 or 2 digits) // AM/PM | a | // // Examples: // "MMM d, y" matches: January 01, 2000 // Dec 1, 1900 // Nov 20, 00 // "m/d/yy" matches: 01/20/00 // 9/2/00 // "MMM dd, yyyy hh:mm:ssa" matches: "January 01, 2000 12:30:45AM" // ------------------------------------------------------------------ function getDateFromFormat(val,format) { val = val+""; format = format+""; var i_val = 0; var i_format = 0; var c = ""; var token = ""; var token2= ""; var x,y; var now = new Date(); var year = now.getYear(); var month = now.getMonth()+1; var date = now.getDate(); var hh = now.getHours(); var mm = now.getMinutes(); var ss = now.getSeconds(); var ampm = ""; while (i_format < format.length) { // Get next token from format string c = format.charAt(i_format); token = ""; while ((format.charAt(i_format) == c) && (i_format < format.length)) { token += format.charAt(i_format); i_format++; } // Extract contents of value based on format token if (token=="yyyy" || token=="yy" || token=="y") { if (token=="yyyy") { x=4;y=4; }// 4-digit year if (token=="yy") { x=2;y=2; }// 2-digit year if (token=="y") { x=2;y=4; }// 2-or-4-digit year year = _getInt(val,i_val,x,y); if (year == null) { return 0; } i_val += year.length; if (year.length == 2) { if (year > 70) { year = 1900+(year-0); } else { year = 2000+(year-0); } } } else if (token=="MMM"){// Month name month = 0; for (var i=0; i12) { month -= 12; } i_val += month_name.length; break; } } if (month == 0) { return 0; } if ((month < 1) || (month>12)) { return 0; } // TODO: Process Month Name } else if (token=="MM" || token=="M") { x=token.length; y=2; month = _getInt(val,i_val,x,y); if (month == null) { return 0; } if ((month < 1) || (month > 12)) { return 0; } i_val += month.length; } else if (token=="dd" || token=="d") { x=token.length; y=2; date = _getInt(val,i_val,x,y); if (date == null) { return 0; } if ((date < 1) || (date>31)) { return 0; } i_val += date.length; } else if (token=="hh" || token=="h") { x=token.length; y=2; hh = _getInt(val,i_val,x,y); if (hh == null) { return 0; } if ((hh < 1) || (hh > 12)) { return 0; } i_val += hh.length; hh--; } else if (token=="HH" || token=="H") { x=token.length; y=2; hh = _getInt(val,i_val,x,y); if (hh == null) { return 0; } if ((hh < 0) || (hh > 23)) { return 0; } i_val += hh.length; } else if (token=="KK" || token=="K") { x=token.length; y=2; hh = _getInt(val,i_val,x,y); if (hh == null) { return 0; } if ((hh < 0) || (hh > 11)) { return 0; } i_val += hh.length; } else if (token=="kk" || token=="k") { x=token.length; y=2; hh = _getInt(val,i_val,x,y); if (hh == null) { return 0; } if ((hh < 1) || (hh > 24)) { return 0; } i_val += hh.length; h--; } else if (token=="mm" || token=="m") { x=token.length; y=2; mm = _getInt(val,i_val,x,y); if (mm == null) { return 0; } if ((mm < 0) || (mm > 59)) { return 0; } i_val += mm.length; } else if (token=="ss" || token=="s") { x=token.length; y=2; ss = _getInt(val,i_val,x,y); if (ss == null) { return 0; } if ((ss < 0) || (ss > 59)) { return 0; } i_val += ss.length; } else if (token=="a") { if (val.substring(i_val,i_val+2).toLowerCase() == "am") { ampm = "AM"; } else if (val.substring(i_val,i_val+2).toLowerCase() == "pm") { ampm = "PM"; } else { return 0; } } else { if (val.substring(i_val,i_val+token.length) != token) { return 0; } else { i_val += token.length; } } } // If there are any trailing characters left in the value, it doesn't match if (i_val != val.length) { return 0; } // Is date valid for month? if (month == 2) { // Check for leap year if ( ( (year%4 == 0)&&(year%100 != 0) ) || (year%400 == 0) ) { // leap year if (date > 29){ return false; } } else { if (date > 28) { return false; } } } if ((month==4)||(month==6)||(month==9)||(month==11)) { if (date > 30) { return false; } } // Correct hours value if (hh<12 && ampm=="PM") { hh+=12; } else if (hh>11 && ampm=="AM") { hh-=12; } var newdate = new Date(year,month-1,date,hh,mm,ss); return newdate.getTime(); } function IsValidDate(Day,Month,Year) { //var myDayStr = document.CheckDate.formDate.value; //var myMonthStr = document.CheckDate.formMonth.value; //var myYearStr = document.CheckDate.formYear.value; //var myDateStr = myDayStr + ' ' + myMonthStr + ' ' + myYearStr; var myDayStr = Day; var myMonthStr = Month; var myYearStr = Year; var myDateStr = myDayStr + ' ' + myMonthStr + ' ' + myYearStr; //alert(myDateStr); /* Using form values, create a new date object which looks like "Wed Jan 1 00:00:00 EST 1975". */ var myDate = new Date( myDateStr ); //var myDate = new Date( indate ); // Convert the date to a string so we can parse it. var myDate_string = myDate.toGMTString(); //alert(Date.parse(indate)); //if(Date.parse(indate)==true){ //if(myDate_string=='NaN'){ // return false; //}else{ // return true; // } //alert(myDate_string); /* Split the string at every space and put the values into an array so, using the previous example, the first element in the array is "Wed", the second element is "Jan", the third element is "1", etc. */ var myDate_array = myDate_string.split( ' ' ); /* If we entered "Feb 31, 1975" in the form, the "new Date()" function converts the value to "Mar 3, 1975". Therefore, we compare the month in the array with the month we entered into the form. If they match, then the date is valid, otherwise, the date is NOT valid. */ if ( myDate_array[2] != myMonthStr ) { //alert( 'I\'m sorry, but "' + myDateStr + '" is NOT a valid date.' ); return false; } else { //alert( 'Congratulations! "' + myDateStr + '" IS a valid date.' ); return true; } } function checkpostcode(postcode){ test = postcode; size = test.length test = test.toUpperCase(); //Change to uppercase while (test.slice(0,1) == " ") //Strip leading spaces {test = test.substr(1,size-1);size = test.length } while(test.slice(size-1,size)== " ") //Strip trailing spaces {test = test.substr(0,size-1);size = test.length } //document.details.pcode.value = test; //write back to form field if (size < 6 || size > 8){ //Code length rule alert(test + " is not a valid postcode - wrong length"); //document.details.pcode.focus(); return false; } if (!(isNaN(test.charAt(0)))){ //leftmost character must be alpha character rule alert(test + " is not a valid postcode - cannot start with a number"); // document.details.pcode.focus(); return false; } if (isNaN(test.charAt(size-3))){ //first character of inward code must be numeric rule alert(test + " is not a valid postcode - alpha character in wrong position"); //document.details.pcode.focus(); return false; } if (!(isNaN(test.charAt(size-2)))){ //second character of inward code must be alpha rule alert(test + " is not a valid postcode - number in wrong position"); //document.details.pcode.focus(); return false; } if (!(isNaN(test.charAt(size-1)))){ //third character of inward code must be alpha rule alert(test + " is not a valid postcode - number in wrong position"); //document.details.pcode.focus(); return false; } if (!(test.charAt(size-4) == " ")){//space in position length-3 rule alert(test + " is not a valid postcode - no space or space in wrong position"); //document.details.pcode.focus(); return false; } count1 = test.indexOf(" ");count2 = test.lastIndexOf(" "); if (count1 != count2){//only one space rule alert(test + " is not a valid postcode - only one space allowed"); // document.details.pcode.focus(); return false; } //alert("Postcode Format OK"); return true; } function UpdateDisplay_Item_HTML(element_id,strHTML) { //alert("Changing display!") //var HolidaysFoundStr=""; if(DOM) { // Netscape version // alert("Doing DOM Bit!") var tmp_elementName = "Layer_"+element_id; var dc = document.getElementById(tmp_elementName); // var dc = document.layers[tmp_elementName]; // dc=dc.layers["InnerHTML"]; // dc.document.open(); // dc.document.write(strHTML); // dc.document.close(); // if (document.layers) { // document.layers["wait"].visibility="hidden"; // document.layers["mypage"].visibility="visible"; //} if(dc!=null) { dc.innerHTML = strHTML; } else { //alert('Document Layer cannot be found!'); } } else if(N) { //var dc=document.layers["DisplayHolidaysLayer"]; //dc=dc.layers["InnerHTML"]; //dc.document.open(); //dc.document.write(HolidaysFoundStr); //dc.document.close(); alert("SORRY! As a security precaution netscape versions other than V6.0+ are not supported at present!") } else { // alert("Doing IE Bit!") var tmp_elementName = "span_"+element_id; var DisplayDiv=document.all(tmp_elementName); if(DisplayDiv!=null) // alert("got div") DisplayDiv.innerHTML=strHTML; } } _init_main_js();