// *********************** Browser DETECTION ************************* var AgntUsr = navigator.userAgent.toLowerCase(); var isDOM = (document.getElementById) ? 1:0; // is Document Object Model var isMZ = (AgntUsr.indexOf('mozilla') != -1) ? 1 : 0; // is Mozilla var isGK = ((AgntUsr.indexOf('gecko') != -1) && isMZ) ? 1 : 0; // is Gecko var isNS = (isMZ && isGK && (AgntUsr.indexOf('netscape') != -1)) ? 1 : 0; // is Netscape var isNS6 = (isNS && ((AgntUsr.indexOf('netscape 6') != -1) || (AgntUsr.indexOf('netscape/6')!=-1))) ? 1:0; // is Netscape 6 var isNS7 = (isNS && ((AgntUsr.indexOf('netscape 7') != -1) || (AgntUsr.indexOf('netscape/7')!=-1))) ? 1:0; // is Netscape 7 var isOP = (isMZ && !isGK && !isNS && (AgntUsr.indexOf('opera') != -1)) ? 1 : 0; // is Opera var isOP5 = (isOP && ((AgntUsr.indexOf('opera 5') != -1) || (AgntUsr.indexOf('opera/5')!=-1))) ? 1:0; // Opera 5 var isOP6 = (isOP && ((AgntUsr.indexOf('opera 6') != -1) || (AgntUsr.indexOf('opera/6')!=-1))) ? 1:0; // Opera 6 var isOP7 = (isOP && ((AgntUsr.indexOf('opera 7') != -1) || (AgntUsr.indexOf('opera/7')!=-1))) ? 1:0; // Opera 7 var isIE = (isMZ && !isGK && !isNS && !isOP && (AgntUsr.indexOf('msie') != -1)) ? 1 : 0; // is Internet Explorer var isIE4 = (isIE && (AgntUsr.indexOf('msie 4') != -1)) ? 1:0; // is Internet Explorer 4 var isIE5 = (isIE && (AgntUsr.indexOf('msie 5') != -1)) ? 1:0; // is Internet Explorer 5 var isIE6 = (isIE && (AgntUsr.indexOf('msie 6') != -1)) ? 1:0; // is Internet Explorer 6 var isFF = (isMZ && isGK && !isNS && !isOP && !isIE && (AgntUsr.indexOf('firefox') != -1)) ? 1 : 0; // is FireFox var isFF1 = (isFF && (AgntUsr.indexOf('firefox/1') != -1)) ? 1:0; // is FireFox 1 var isSF = (isMZ && isGK && !isNS && !isOP && !isIE && !isFF && (AgntUsr.indexOf('safari') != -1)) ? 1 : 0; // is Safari var isSF1 = (isSF && (AgntUsr.indexOf('safari/1') != -1)) ? 1 : 0; // is Safari 1 // *********************** Browser Variables ************************* // ONLY supports IE 4-6, NN 6-7, Opera 6-7, FireFox 1, and Safari 1 var isMyNS = (isNS && (isNS6 || isNS7))?1:0; var isMyOP = (isOP && (isOP6 || isOP7))?1:0; var isMyIE = (isIE && (isIE4 || isIE5 || isIE6))?1:0; var isMyFF = (isFF && (isFF1))?1:0; var isMySF = (isSF && (isSF1))?1:0; var DTI_FGCOLOR = "#2A2A2A"; var DTI_BGCOLOR = "#9AACC8"; var DTI_FGCOLOR_ONERROR = "#FFFFFF"; var DTI_BGCOLOR_ONERROR = "#FF0000"; var ErrCnt = 1; var ErrMsg = ""; var ErrFtr = "\n\nThis page only supports:\n"; ErrFtr += "FireFox 1.0, Internet Explorer 4.5 - 6.0,\n"; ErrFtr += "Netscape 6.0 - 7.2, Opera 6.0 - 7.5, Safari 1.0,\n"; ErrFtr += "Mozilla 4.0 - 5.0 (X11), and Konqueror 3.1\n\n"; ErrFtr += " - Omega Marketing Solutions.Com"; //window.onerror=null; // ******************** String :: Prototypes ***************** String.prototype.trim = function() { var x=this; x=x.replace(/^\s*(.*)/, "$1"); x=x.replace(/(.*?)\s*$/, "$1"); return x; } String.prototype.isEmail = function() { var x=this; var eRegex = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/; return eRegex.test(x); } String.prototype.isPhone = function() { var x=this; var eRegex = /^(01)?1?(-?\d\d\d?)+(-?\d{4})+$/; return eRegex.test(x); } // ******************** HTMLFormElement :: Prototypes ***************** /*Object.prototype.doSubmit = function() { var tForm=this; alert("SUS"); } */ function displayProps(obj) { var output = ""; for (var prop in obj) { output += obj.name + "." + prop + " = " + obj[prop] + "
\n"; if (typeof(obj[prop])==Object) { //displayProps(obj[prop]); } } document.writeln("

"+output+"

"); } // ******************** MyForm :: Class/Functions/Methods/Prototypes ***************** // ******************** Functions ***************** function doEval(pObject) { var tStr; if (document.all) { return eval("document.all['"+pObject+"']"); } else if (document.layers) { return eval("document.layers['"+pObject+"']"); } else if (document.getElementById) { return eval("document.getElementById('"+pObject+"')"); } else { return null; } } function isEmail(pLabel,pObject,pRequired) { var isValid = true; var eRegex = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/; try { pObject.value = pObject.value.trim(); if ((pObject.value.length<=0) && (pRequired)) { ErrMsg += (ErrCnt++) +". You forgot to enter '"+pLabel+"'\n"; isValid = false; } for (i=0;i=48)&&(pObject.value.charCodeAt(i)<=57 )) || // 0 ... 9 (pObject.value.charCodeAt(i)==64) || // @ ((pObject.value.charCodeAt(i)>=65)&&(pObject.value.charCodeAt(i)<=90 )) || // a, b ... z (pObject.value.charCodeAt(i)==95) || // _ ((pObject.value.charCodeAt(i)>=97)&&(pObject.value.charCodeAt(i)<=122)) ) && // A, B ... Z (isValid) ) { ErrMsg += (ErrCnt++) +". '"+(pObject.value.charAt(i)==' '?"[Space]":pObject.value.charAt(i))+"' is NOT allowed in '"+pLabel+"'\n"; isValid = false; } } if ((!(eRegex.test(pObject.value))) && (isValid) && (pRequired)) { ErrMsg += (ErrCnt++) +". Please properly enter '"+pLabel+"'\n"; isValid = false; } markError(pObject,!isValid); return isValid; } catch(err) { alert("\n"+err + "\nAn error has occored in funct: isEmail()"+ErrFtr); return false; } } function isText(pLabel,pObject,pRequired) { var isValid = true; try { pObject.value = pObject.value.trim(); if ((pObject.value.length<=0) && (pRequired)) { ErrMsg += (ErrCnt++) +". You forgot to enter '"+pLabel+"'\n"; isValid = false; } for (i=0;i=32)&&(pObject.value.charCodeAt(i)<=127)) || (pObject.value.charCodeAt(i)==160) ) && // Standered ASCII Characters (isValid) ) { //ErrMsg += (ErrCnt++) +". '"+pObject.value.charAt(i)+"' is NOT allowed in '"+pLabel+"'\n"; ErrMsg += (ErrCnt++) +". '"+pObject.value.charCodeAt(i)+"' is NOT allowed in '"+pLabel+"'\n"; isValid = false; } } markError(pObject,!isValid); return isValid; } catch(err) { alert("\n"+err + "\nAn error has occored in funct: isText()"+ErrFtr); return false; } } function isName(pLabel,pObject,pRequired) { var isValid = true; try { pObject.value = pObject.value.trim(); if ((pObject.value.length<=0) && (pRequired)) { ErrMsg += (ErrCnt++) +". You forgot to enter '"+pLabel+"'\n"; isValid = false; } for (i=0;i=48)&&(pObject.value.charCodeAt(i)<=57 )) || // 0 ... 9 ((pObject.value.charCodeAt(i)>=65)&&(pObject.value.charCodeAt(i)<=90 )) || // a, b ... z (pObject.value.charCodeAt(i)==95) || // _ ((pObject.value.charCodeAt(i)>=97)&&(pObject.value.charCodeAt(i)<=122)) ) && // A, B ... Z (isValid) ) { ErrMsg += (ErrCnt++) +". '"+pObject.value.charAt(i)+"' is NOT allowed in '"+pLabel+"'\n"; isValid = false; } } markError(pObject,!isValid); return isValid; } catch(err) { alert("\n"+err + "\nAn error has occored in funct: isName()"+ErrFtr); return false; } } function isPhone(pLabel,pObject,pRequired) { var isValid = true; var eRegex = /^(01)?1?(-?\d\d\d?)+(-?\d{4})+$/; try { pObject.value = pObject.value.trim(); if ((pObject.value.length<=0) && (pRequired)) { ErrMsg += (ErrCnt++) +". You forgot to enter '"+pLabel+"'\n"; isValid = false; } for (i=0;i=48)&&(pObject.value.charCodeAt(i)<=57 )) ) && // 0 ... 9 (isValid) ) { ErrMsg += (ErrCnt++) +". '"+pObject.value.charAt(i)+"' is NOT allowed in '"+pLabel+"'\n"; isValid = false; } } if ((!(eRegex.test(pObject.value))) && (isValid) && (pRequired)) { ErrMsg += (ErrCnt++) +". Please follow XXX-XXX-XXXX format for '"+pLabel+"'\n"; isValid = false; } markError(pObject,!isValid); return isValid; } catch(err) { alert("\n"+err + "\nAn error has occored in funct: isPhone()"+ErrFtr); return false; } } function isSelect(pLabel,pObject,pRequired) { var isValid = true; try { //pObject.value = pObject.value.trim(); if ( ( (pObject.value.length<=0) || (parseInt(pObject.value)<0) ) && (pRequired==true)) { ErrMsg += (ErrCnt++) +". You forgot to select '"+pLabel+"'\n"; isValid = false; } markError(pObject,!isValid); return isValid; } catch(err) { alert("\n"+err + "\nAn error has occored in funct: isSelect()"+ErrFtr); return false; } } function isNumber(pLabel,pObject,pRequired) { var isValid = true; try { pObject.value = pObject.value.trim(); if ((pObject.value.length<=0) && (pRequired)) { ErrMsg += (ErrCnt++) +". You forgot to enter '"+pLabel+"'\n"; isValid = false; } for (i=0;i=48)&&(pObject.value.charCodeAt(i)<=57 )) ) && // 0 ... 9 (isValid) ) { ErrMsg += (ErrCnt++) +". '"+(pObject.value.charAt(i)==' '?"[Space]":pObject.value.charAt(i))+"' is NOT allowed in '"+pLabel+"'\n"; isValid = false; } } markError(pObject,!isValid); return isValid; } catch(err) { alert("\n"+err + "\nAn error has occored in funct: isNumber()"+ErrFtr); return false; } } function isAlphaNumaric(pLabel,pObject,pRequired) { var isValid = true; try { pObject.value = pObject.value.trim(); if ((pObject.value.length<=0) && (pRequired)) { ErrMsg += (ErrCnt++) +". You forgot to enter '"+pLabel+"'\n"; isValid = false; } for (i=0;i=48)&&(pObject.value.charCodeAt(i)<=57 )) || // 0 ... 9 ((pObject.value.charCodeAt(i)>=65)&&(pObject.value.charCodeAt(i)<=90 )) || // a, b ... z ((pObject.value.charCodeAt(i)>=97)&&(pObject.value.charCodeAt(i)<=122)) ) && // A, B ... Z (isValid) ) { ErrMsg += (ErrCnt++) +". '"+(pObject.value.charAt(i)==' '?"[Space]":pObject.value.charAt(i))+"' is NOT allowed in '"+pLabel+"'\n"; isValid = false; } } markError(pObject,!isValid); return isValid; } catch(err) { alert("\n"+err + "\nAn error has occored in funct: isAlphaNumaric()"+ErrFtr); return false; } } function markError(pObject,pError) { if (pError==true) { if (isMyNS) { pObject.color = DTI_FGCOLOR_ONERROR; pObject.backgroundColor = DTI_BGCOLOR_ONERROR; } pObject.style.color = DTI_FGCOLOR_ONERROR; pObject.style.backgroundColor = DTI_BGCOLOR_ONERROR; } else { if (isMyNS) { pObject.color = DTI_FGCOLOR; pObject.backgroundColor = DTI_BGCOLOR; } pObject.style.color = DTI_FGCOLOR; pObject.style.backgroundColor = DTI_BGCOLOR; } } function formSubmit(pForm) { var tAction = ""; var i = 0; var tIframe = document.createElement("iframe"); tIframe.style.width = "0px"; tIframe.style.height = "0px"; tIframe.style.margin = "0px -500px"; tIframe.disabled = true; //tIframe.id = "AsdasdasD"; /*tIframe.style.visibility = "hidden"; tIframe.style.display = "none"; pForm.target = tIframe.name;*/ while (pForm[i]!=null) { tAction = tAction + '&' + pForm[i].name + '=' + escape(pForm[i].value); i++; } tIframe.src = pForm.action+'?'+tAction; document.getElementsByTagName("body")[0].appendChild(tIframe); /*tBody.appendChild(tIframe); var tItem = document.getElementsByTagName("iframe")[0]; alert(tItem.id); document.getElementsByTagName("body")[0].removeChild(document.getElementsByTagName("iframe")[0]);*/ } /* function messageWindow(title, msg) { var width="300", height="125"; var left = (screen.width/2) - width/2; var top = (screen.height/2) - height/2; var styleStr = 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbar=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+',top='+top+',screenX='+left+',screenY='+top; var msgWindow = window.open("","msgWindow", styleStr); var head = ''+title+''; var body = '
'+msg+'

'; msgWindow.document.write(head + body); } */ function messageWindow(pURL,pWidth,pHeight) { var width=pWidth, height=pHeight; var left = (screen.width/2) - width/2; var top = (screen.height/2) - height/2; var styleStr = 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbar=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+',top='+top+',screenX='+left+',screenY='+top; var msgWindow = window.open(pURL,'Resorts',styleStr); /*var head = ''+title+''; var body = '
'+msg+'

'; msgWindow.document.write(head + body);*/ } // ******************** BEGIN :: Emran's Mervelous Form Manupulation ******************** function doRedraw(pForm) { if (pForm!=null) { ErrCnt=1; ErrMsg=""; var i = 0; for (i=0;i= i + 3) { bits = (decStr.charCodeAt(i++) & 0xff) <<16 | (decStr.charCodeAt(i++) & 0xff) <<8 | decStr.charCodeAt(i++) & 0xff; encOut += base64s.charAt((bits & 0x00fc0000) >>18) + base64s.charAt((bits & 0x0003f000) >>12) + base64s.charAt((bits & 0x00000fc0) >> 6) + base64s.charAt((bits & 0x0000003f)); } if (decStr.length -i > 0 && decStr.length -i < 3) { dual = Boolean(decStr.length -i -1); bits = ((decStr.charCodeAt(i++) & 0xff) <<16) | (dual ? (decStr.charCodeAt(i) & 0xff) <<8 : 0); encOut += base64s.charAt((bits & 0x00fc0000) >>18) + base64s.charAt((bits & 0x0003f000) >>12) + (dual ? base64s.charAt((bits & 0x00000fc0) >>6) : '=') + '='; } return encOut } // ******************** Functions:: base64_decode ******************** function base64_decode(encStr) { var bits, decOut = '', i = 0; for(; i>16, (bits & 0xff00) >>8, bits & 0xff); } if (encStr.charCodeAt(i -2) == 61) { undecOut=decOut.substring(0, decOut.length -2); } else if(encStr.charCodeAt(i -1) == 61) { undecOut=decOut.substring(0, decOut.length -1); } else { undecOut=decOut; } //return unescape(undecOut); //unscaped .OR. line add for chinese char return undecOut; //unscaped .OR. line add for chinese char } // ******************** Functions:: doEncrypt ******************** function doEncrypt(pString) { //return base64_encode(base64_encode(pString)); // 2 x Base64 return base64_encode(pString); // 1 x Base64 } // ******************** Functions:: doDecrypt ******************** function doDecrypt(pString) { //return base64_decode(base64_decode(pString)); // 2 x Base64 Decode return base64_decode(pString); // 1 x Base64 Decode } // ******************** END :: Emran's Mervelous Form Manupulation ********************