function replace(string,text,by) { // Replaces text with by in string var i = string.indexOf(text), newstr = ''; if ((!i) || (i == -1)) return string; newstr += string.substring(0,i) + by; if (i+text.length < string.length) newstr += replace(string.substring(i+text.length,string.length),text,by); return newstr; } function split(string,text) { splitArray = string.split(text); splitIndex = splitArray.length; } var xid=""; var passed = replace(replace(location.search.substring(1),"+"," "),"=","&"); var splitIndex = 0, splitArray = new Object(); split(passed,'&'); function findXID() { for (var i=0; i\n'); } else { if(errmsg != null && document.all.item("error") != null) document.all.item("error").innerText = errmsg; } } // hack for pid because engine is converting to lowercase if(key.toUpperCase() == "PID"){ if ( document.forms[formName].elements["PID"] != null ){ document.forms[formName].elements["PID"].value = val; } else if (document.forms[formName].elements["pid"] != null){ document.forms[formName].elements["pid"].value = val; } } else if ( document.forms[formName].elements[key] != null ) { switch ( document.forms[formName].elements[key].type ) { case "select-one": for (var so=0; so -1) { var val = new String(""); val = qs.slice(qs.indexOf("=", qs.indexOf(key))+1, qs.indexOf("&", qs.indexOf(key))-1); var qs1stSlice = new String(qs.slice(0, qs.indexOf(key)-1)); var qs2ndSlice = new String(""); if (qs.indexOf(val)+val.length < qs.length) qs2ndSlice = qs.slice(qs.indexOf("&", qs.indexOf(key)), qs.length); qs = qs1stSlice+qs2ndSlice; } return qs; } function getQueryValueCaseInsensitive(s){ var tmp = getQueryValue(s); if(typeof(tmp) != 'undefined' && tmp && tmp.length > 0){ return tmp; } tmp = getQueryValue(s.toLowerCase()); if(typeof(tmp) != 'undefined' && tmp && tmp.length > 0){ return tmp; } tmp = getQueryValue(s.toUpperCase()); if(typeof(tmp) != 'undefined' && tmp && tmp.length > 0){ return tmp; } return ""; } function replaceAll( str, from, to ) { var idx = str.indexOf( from ); while ( idx > -1 ) { str = str.replace( from, to ); idx = str.indexOf( from ); } return str; } function xmlUnescape(s){ s = replaceAll(s, "&", "&"); s = replaceAll(s, "'", "'"); s = replaceAll(s, """, "\""); s = replaceAll(s, "<", "<"); s = replaceAll(s, ">", ">"); return s; } function getJsUrl(){ var adurl = xmlUnescape(getQueryValueCaseInsensitive('ADURL')); var x_sell_url = getQueryValueCaseInsensitive('X_SELL_URL'); var jsurl = ""; if(adurl && adurl.length > 0){ // if adurl, use it jsurl = adurl; } else { // else use x_sell_url jsurl = x_sell_url; } // check for herb // TODO: comment out before production roll var flag = getQueryValueCaseInsensitive('email'); if(flag.substring(0, 4) == "herb"){ // alert(jsurl); } return jsurl; } function populateForms() { for (i=0; i 0){ if(pds != "0" && pds != 0){ form.pds.value = 0; } } // alert("form.pds is currently " + form.pds.value); } } function noThanksSubmit( ) { if (document.getElementById('SKIP_OFFER')) { document.getElementById('SKIP_OFFER').value="true"; if (document.getElementById("back_button" )) { document.getElementById("back_button").value = "true"; } if (document.getElementById("PID").value == '8805'){ window.location.href=document.getElementById('applyForm').elements["exurl"].value; }else{ if (document.getElementById('applyForm')) { document.getElementById('applyForm').submit(); } } } } // function for determining Skip Offer value // and switching flag on and off function setSkipOffer(form){ // find Skip Offer, if it exists and is "true", switch to "false" if(form.SKIP_OFFER){ if(form.SKIP_OFFER != "false"){ form.SKIP_OFFER.value = "false"; } } } function displayBack() { window.history.back(); } // this is simply a test function to // indicate the js file has loaded function adtQSScriptIsLoaded(){ return true; }