function setDocumentCookie( oDoc, sName, sValue ) { if (sName.length < 1) return; if (0 < sValue.length) { var expDate = new Date(); expDate.setTime( expDate.getTime() + 365*24*60*60*1000 ); oDoc.cookie = "" + sName + "=" + sValue + "; " + "expires=" + expDate.toGMTString(); } else { oDoc.cookie = sName + "="; } } function setNamedCookie( sName, sValue ) { setDocumentCookie( document, sName, sValue ); } function deleteDocumentCookie( oDoc, sName ) { oDoc.cookie = sName + "="; } function deleteCookie( sName ) { deleteDocumentCookie( document, sName ); } function fetchDocumentCookie( oDoc, sName ) { var sValue = ""; var index = 0; if (oDoc.cookie) { index = oDoc.cookie.indexOf( sName + "=" ); } else { index = -1; } if (index < 0) { sValue = ""; } else { var countbegin = (oDoc.cookie.indexOf( "=", index ) + 1); if (0 < countbegin) { var countend = oDoc.cookie.indexOf( ";", countbegin ); if ( countend < 0 ) { countend = oDoc.cookie.length; } sValue = oDoc.cookie.substring( countbegin, countend ); } else { sValue = ""; } } return sValue; } function fetchNamedCookie( sName ) { return fetchDocumentCookie( document, sName ); } function setState() { if (fetchNamedCookie("down") == 'no') { showhide(); } else { document.getElementById('showhide').innerHTML = "Cancel Quote Request"; document.getElementById('tab').style.backgroundImage = "url(http://webdesignplaza.com/images/tab_on.jpg)"; } } function showhide() { var d = document.getElementById('head'); if (d.style.display == 'block') { d.style.display = 'none'; document.getElementById('showhide').innerHTML = "Request a
Free Quote"; document.getElementById('tab').style.backgroundImage = "url(http://webdesignplaza.com/images/tab_off.jpg)"; downState = 'no'; } else { d.style.display = 'block'; document.getElementById('showhide').innerHTML = "Cancel Quote Request"; document.getElementById('tab').style.backgroundImage = "url(http://webdesignplaza.com/images/tab_on.jpg)"; downState = 'yes'; } setNamedCookie("down", downState); } function validate() { var f = document.raq; var errors = []; if(f.clientName.value == '') errors.push("You did not enter your name."); if(f.comments.value == '') errors.push("You did not enter any comments."); if(f.contactMethod[1].checked == true) if (!isValidPhoneNumber(f.phoneNumber.value)) errors.push("You did not enter a valid phone number."); if(f.contactMethod[0].checked == true) if (!isValidEmailAddress(f.emailAddress.value)) errors.push("You did not enter a valid email address."); if (errors.length > 0) { alert(STD_ERROR_PREFIX + errors.join("\n")) return false; } // Close after validation showhide(); return true; } String.prototype.trim = function() { return this.replace(/^\s*|\s*$/g, "") } function isValidPhoneNumber(s) { var temp = s.replace(/\D/g, "") return temp.length > 9; } function isValidEmailAddress(s) { var temp = s.replace(/\s/g, "") return (temp.match(/^[\w\.\-]+\x40[\w\.\-]+\.\w{2,5}$/)) && temp.charAt(0) != "." && !(temp.match(/\.\./)) } function textFieldBlurHandler() { this.value = this.value.trim() } function phoneFieldBlurHandler() { var temp = this.value.replace(/\D/g, "") if (temp.length > 9 && temp.length < 26) if (temp.length == 10) { this.value = "(" + temp.substring(0,3) + ") " this.value += temp.substring(3,6) + "-" + temp.substring(6,10) } } function attachAllTextHandlers(f) { var el for (var i = 0; (el = f.elements[i]); i++) { if (el.type == "text" || el.type == "textarea") el.onblur = textFieldBlurHandler } } var STD_ERROR_PREFIX = "There were one or more problems with your quote request.\n" STD_ERROR_PREFIX += "Please check the following and try submitting the form again:\n\n" function clipBoard() { holdtext.innerText = copytext.innerText; Copied = holdtext.createTextRange(); Copied.execCommand("Copy"); }