//email.js // JavaScript Document function emailFormField(p1,p2,type,extra){ this.label=p1; this.name=p2; this.type=type; this.extra=extra; } function showEmailForm(){ try{ logAction( 5, "show" ); }catch(e){} document.getElementById('emailCurtain').className = "visible"; document.getElementById('curtainBackground').className = "visible"; scroll(0,0); document.getElementById("name").value = "" document.getElementById("email").value = "" document.getElementById("phone").value = "" document.getElementById("message").value = "" } function hideEmailForm(){ try{ logAction( 5, "hide" ); }catch(e){} document.getElementById('emailCurtain').className = "hidden"; document.getElementById('curtainBackground').className = "hidden"; } function submitEmailForm( formID ){ if( validateForm() ) { $('emailForm').request({ onComplete: function( transport ){ var node = transport.responseXML.getElementsByTagName('message')[0].firstChild ; if( node != null ){ if( node.data == 1 ){ hideEmailForm(); }else{ } } } }); } return false; //kills form submission } /*function submitEmailFormPostback(o){ xmlhttp = o.getXMLHttpRequestObject() var message = xmlhttp.responseXML.getElementsByTagName('message')[0].firstChild.data if( message == 1 ){ hideEmailForm(); }else{ } }*/ function attachEmailForm( targetDiv ){ var mainDiv = document.createElement("div"); mainDiv.id = "emailCurtain"; var innerFormDiv = document.createElement("div"); innerFormDiv.id = "emailFormInner"; innerFormDiv.setAttribute("class","emailFormTable"); var cba = document.createElement("a"); cba.id = "closeButton"; cba.appendChild( document.createTextNode( "Close") ); cba.setAttribute( "href" , "#" ); innerFormDiv.appendChild( cba ) ; var title = document.createElement("h2"); title.appendChild( document.createTextNode( "Send us an email") ); innerFormDiv.appendChild( title ); var f = document.createElement("form"); f.id = "emailForm"; for ( i = 0 ; i < pgEmailFields.length; i++){ f.appendChild( attachEmailForm_helper_formField(pgEmailFields[i].label , pgEmailFields[i].name , pgEmailFields[i].type , pgEmailFields[i].extra ) ); } f.setAttribute("action","/index.php?method=sendemail"); f.setAttribute("method","POST"); //MESSAGE BOX var line = document.createElement("div"); var label = document.createElement("span"); label.id = "message_lbl"; label.appendChild( document.createTextNode( "Message" ) ); line.appendChild( label ) ; var input = document.createElement("textarea"); input.id = "message"; input.setAttribute( "name","message"); input.setAttribute( "cols",45); input.setAttribute( "rows",5); line.appendChild( input ) ; f.appendChild( line); //SUBMIT BUTTON line = document.createElement("div"); input = document.createElement("input"); input.id = "SendEmail"; input.setAttribute( "type","button"); input.setAttribute( "value","Send Email"); line.appendChild( input ) ; f.appendChild( line); innerFormDiv.appendChild( f); mainDiv.appendChild( innerFormDiv ); mainDiv.setAttribute("class","hidden"); jQuery(targetDiv).append( mainDiv) ; window.onload = function() { //addValidationRule( document.emailForm.name, 'name_lbl' , 'notnull', false ); } jQuery("#closeButton").click(function(){ hideEmailForm(); }); jQuery("#SendEmail").click(function(){ submitEmailForm('emailForm'); }); document.getElementById('emailCurtain').className = "hidden"; document.getElementById('curtainBackground').className = "hidden"; } function attachEmailForm_helper_formField( flabel , fname , type, extra ){ var line = document.createElement("div"); line.setAttribute( "class","emailFormLine"); switch(type){ case "html": break; case "select": case "label": case "textfield": default: var label = document.createElement("label"); label.id = fname+"_lbl"; label.setAttribute( "for",fname); label.setAttribute( "class","emailFormLabel emailFormLabel_" + type); label.appendChild( document.createTextNode( flabel ) ); line.appendChild( label ) ; } switch(type){ case "select": var input = document.createElement("select"); input.id = fname; //input.setAttribute( "type","text"); input.setAttribute( "name",fname); var opts = extra.split( ":"); for ( ii = 0 ; ii < opts.length; ii++){ var o = document.createElement("option"); o.setAttribute("value",opts[ii]); o.innerHTML = opts[ii]; input.appendChild(o); } line.appendChild( input ) ; break; case "label": break; case "html": var e = document.createElement("span"); e.id = fname; e.innerHTML = extra; line.appendChild( e ) ; break; case "textfield": default: var input = document.createElement("input"); input.id = fname; input.setAttribute( "type","text"); input.setAttribute( "name",fname); line.appendChild( input ) ; } return line; } //piwiki.js var _paq = _paq || []; (function(){ var u=(("https:" == document.location.protocol) ? "https://analytics.prospectgenius.com/" : "http://analytics.prospectgenius.com/"); _paq.push(['setSiteId', 1]); _paq.push(['setTrackerUrl', u+'piwik.php']); _paq.push(['setCustomVariable', '1','microsite',window.location.hostname+'']);//,'visit visitor _paq.push(['enableLinkTracking']); _paq.push(['trackPageView']); var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.type='text/javascript'; g.defer=true; g.async=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s); })(); //log.js // Logs user actions //Logs the action function logAction( categoryID, extra ){ try{ new Ajax.Request("/index.php?method=jslog&categoryID=" + categoryID + "&extra=" +extra , { method:'get', requestHeaders: {Accept: 'text/xml'}, /*onException: function(transport){ logError( "Exception in loadData" ); },*/ onFailure: function(transport){ //logError( "Failure in loadData" ); }, onSuccess: function(transport){ } }); }catch(err){ //console.log } } //validate_form.js // Similar to validate form used at innovectra // Both inherited from RPI var validationRules = new Array(); function vRule( formField, labelID, ruleParserName , aNull ){ this.formField = formField; this.labelID = labelID; this.ruleParserName = ruleParserName; this.allowNull = aNull; this.passed = false; this.validate = vr_validate this.validationFailureMessage = vr_validationFailureMessage this.displayVisual = vr_displayVisual this.vfmsg = "" this.oldClassName = "" } function vr_displayVisual(problem){ var identity var f f = this.labelID identity=document.getElementById( f ); if (problem == true && isNull( identity ) == false ) { this.oldClassName = identity.className; identity.className='validate_inputProblem'; }else{ if(this.oldClassName !="" ){ identity.className=this.oldClassName ; } } } function vr_validate(){ var r = true var v var cnt cnt = this.formField.length?this.formField.length:0 ; if( cnt != 0 ) { //Is bullet list var v = ""; for (i=0; i< this.formField.length; i++) { if (this.formField[i].checked) { v = this.formField[i].value ; //i; } } }else{ v = trim( this.formField.value ) } this.vfmsg = "" if( this.allowNull == true && v == '' ){ r = true; }else if( this.allowNull == false && v == '' ){ r = false; this.vfmsg = "Must be not be empty " }else{ switch(this.ruleParserName){ case 'money': if( !IsNumeric( v) ){ r = false; this.vfmsg = "Must be formated as money (XX.XX) " } break case 'sqldate': if( !matchEntireRegex( v, /[0-9]+\/[0-9]+\/[0-9]+/) ){ r = false; this.vfmsg = "Must be formated (MM/DD/YYYY)" } break case 'sqltime': if( !matchEntireRegex( v, /[0-9]+:[0-9]+\s*[APap][Mm]/) ){ r = false; this.vfmsg = "Must be formated (HH:MM PM)" } break case 'sqldatetime': if( !matchEntireRegex( v, /[0-9]+\/[0-9]+\/[0-9].\s[0-9]+:[0-9]+\s*[APap][Mm]/) ){ r = false; this.vfmsg = "Must be formated (YYYY/MM/DD HH:MM PM)" } break case 'numeric': if( !IsNumeric( v ) ){ r = false; this.vfmsg = "Must be a number" } break case 'integer': if( hasInvalidChars( v, "0123456789" ) ){ r = false this.vfmsg = "Must be an Integer" } break case 'notnull': if( v == "" ){ r = false this.vfmsg = "Cannot be empty" } break default: } } this.passed = r; return r; } function vr_validationFailureMessage(){ return this.vfmsg ; } function addValidationRule( formField, labelID, ruleParserName, aNull ){ var r r = new vRule( formField, labelID, ruleParserName , aNull ); validationRules.push(r); } function validateForm(){ var passed = true //for (i in validationRules ){ for (var i = 0; i < validationRules.length; i++) { if( !validationRules[i].validate() ){ passed = false; } } if ( passed == false){ var r r = "Please enter required values.\n\n" //for (i in validationRules ){ for (var i = 0; i < validationRules.length; i++) { if( validationRules[i].passed == false ){ r = r + "\n" + readLayer( validationRules[i].labelID ) + " : " + validationRules[i].validationFailureMessage(); validationRules[i].displayVisual(true) }else{ validationRules[i].displayVisual(false) } } alert(r); } return passed; } function vfr_Required( formField, labelID ){ if( formField.value != "" ){ return true; }else{ return false; } } function IsNumeric(sText){ var ValidChars = "0123456789."; var IsNumber=true; var Char; for (i = 0; i < sText.length && IsNumber == true; i++){ Char = sText.charAt(i); if (ValidChars.indexOf(Char) == -1){ IsNumber = false; } } return IsNumber; } function trim(str){ return str.replace(/^\s*|\s*$/g,""); } function matchEntireRegex( matchString, myRe ){ myArray = myRe.exec(matchString); if ( typeof myArray == 'object' && myArray ) { if( myArray[0] == matchString ){ return true; }else{ return false; } }else{ return false; } } /* case "alnum": case "alphanumeric": { var charpos = objValue.value.search("[^A-Za-z0-9]"); if(objValue.value.length > 0 && charpos >= 0) { if(!strError || strError.length ==0) { strError = objValue.name+": Only alpha-numeric characters allowed "; }//if alert(strError + "\n [Error character position " + eval(charpos+1)+"]"); return false; }//if break; }//case alphanumeric case "num": case "numeric": { var charpos = objValue.value.search("[^0-9]"); if(objValue.value.length > 0 && charpos >= 0) { if(!strError || strError.length ==0) { strError = objValue.name+": Only digits allowed "; }//if alert(strError + "\n [Error character position " + eval(charpos+1)+"]"); return false; }//if break; }//numeric case "alphabetic": case "alpha": { var charpos = objValue.value.search("[^A-Za-z]"); */ function hasInvalidChars( searchSet, allowedChar ){ var charpos = searchSet.search( "[^"+allowedChar+"]" ); if(searchSet.length > 0 && charpos >= 0) { return true; } return false } function preventCharacter( searchSet, disallowedChar ){ var charpos = searchSet.search( "["+disallowedChar+"]" ); if(searchSet.length > 0 && charpos >= 0) { return true; } return false } function isNull(a){ return typeof a == 'object' && !a; } function readLayer(ID,parentID) { if (document.layers) { var oLayer; if(parentID){ oLayer = eval('document.' + parentID + '.document.' + ID + '.document'); }else{ oLayer = document.layers[ID].document; } oLayer.open(); sText = oLayer.read(); oLayer.close(); } else if (parseInt(navigator.appVersion)>=5&&navigator.appName=="Netscape") { sText = document.getElementById(ID).innerHTML; }else if (document.all){ sText = document.all[ID].innerHTML ; } return sText; } //rotateImages.js // JavaScript Document to rotate images // all images with class rotateThisImage will be rotated. they can and should be grouped with an attribute of rgroup var rotationGroups = new Array(); try{ var a = $$('.rotateThisImage'); a.each(function(o){ o.hide(); i = getRotationGroup( o ); if( !isArray( rotationGroups[i] ) ){ rotationGroups[i] = new Array(); } rotationGroups[i].push( o ); }); rotationGroups.each(function(o){ oo = o[0]; oo.show(); setTimeout( "rotateImages( "+getRotationGroup( oo )+",0,1)" , 10000 ); }); }catch(err){ } function rotateImages( i, c, n ){ a = rotationGroups[i]; change( a[c],a[n] ); c = n; n = n + 1; if( n > a.length-1 ){ n = 0; } setTimeout( "rotateImages( "+i+","+c+","+n+");" , 10000 ) } function change( i, o ){ new Effect.Fade(i, { duration:2}); new Effect.Appear(o, { duration:2}); } function getRotationGroup( o ){ var i = o.readAttribute("rgroup"); if( i == null ){ i = 0; } return i; } function isArray(testObject) { return testObject && !(testObject.propertyIsEnumerable('length')) && typeof testObject === 'object' && typeof testObject.length === 'number'; } //curtain.js // JavaScript Document //base64.js // JavaScript Document /** * * Base64 encode / decode * http://www.webtoolkit.info/ * **/ var Base64 = { // private property _keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", // public method for encoding encode : function (input) { var output = ""; var chr1, chr2, chr3, enc1, enc2, enc3, enc4; var i = 0; input = Base64._utf8_encode(input); while (i < input.length) { chr1 = input.charCodeAt(i++); chr2 = input.charCodeAt(i++); chr3 = input.charCodeAt(i++); enc1 = chr1 >> 2; enc2 = ((chr1 & 3) << 4) | (chr2 >> 4); enc3 = ((chr2 & 15) << 2) | (chr3 >> 6); enc4 = chr3 & 63; if (isNaN(chr2)) { enc3 = enc4 = 64; } else if (isNaN(chr3)) { enc4 = 64; } output = output + this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) + this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4); } return output; }, // public method for decoding decode : function (input) { var output = ""; var chr1, chr2, chr3; var enc1, enc2, enc3, enc4; var i = 0; input = input.replace(/[^A-Za-z0-9\+\/\=]/g, ""); while (i < input.length) { enc1 = this._keyStr.indexOf(input.charAt(i++)); enc2 = this._keyStr.indexOf(input.charAt(i++)); enc3 = this._keyStr.indexOf(input.charAt(i++)); enc4 = this._keyStr.indexOf(input.charAt(i++)); chr1 = (enc1 << 2) | (enc2 >> 4); chr2 = ((enc2 & 15) << 4) | (enc3 >> 2); chr3 = ((enc3 & 3) << 6) | enc4; output = output + String.fromCharCode(chr1); if (enc3 != 64) { output = output + String.fromCharCode(chr2); } if (enc4 != 64) { output = output + String.fromCharCode(chr3); } } output = Base64._utf8_decode(output); return output; }, // private method for UTF-8 encoding _utf8_encode : function (string) { string = string.replace(/\r\n/g,"\n"); var utftext = ""; for (var n = 0; n < string.length; n++) { var c = string.charCodeAt(n); if (c < 128) { utftext += String.fromCharCode(c); } else if((c > 127) && (c < 2048)) { utftext += String.fromCharCode((c >> 6) | 192); utftext += String.fromCharCode((c & 63) | 128); } else { utftext += String.fromCharCode((c >> 12) | 224); utftext += String.fromCharCode(((c >> 6) & 63) | 128); utftext += String.fromCharCode((c & 63) | 128); } } return utftext; }, // private method for UTF-8 decoding _utf8_decode : function (utftext) { var string = ""; var i = 0; var c = c1 = c2 = 0; while ( i < utftext.length ) { c = utftext.charCodeAt(i); if (c < 128) { string += String.fromCharCode(c); i++; } else if((c > 191) && (c < 224)) { c2 = utftext.charCodeAt(i+1); string += String.fromCharCode(((c & 31) << 6) | (c2 & 63)); i += 2; } else { c2 = utftext.charCodeAt(i+1); c3 = utftext.charCodeAt(i+2); string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63)); i += 3; } } return string; } } //coupon.js // JavaScript Document function showFullCoupon( couponID ){ logAction( 4, "show" ); scroll(0,0); document.getElementById('couponHTML').innerHTML = couponHTML ; document.getElementById('curtainBackground').className = "visible"; document.getElementById('couponCurtain').className = "visible"; } function hideFullCoupon(){ logAction( 4, "hide" ); document.getElementById('couponCurtain').className = "hidden"; document.getElementById('curtainBackground').className = "hidden"; } function printCoupon( couponID ){ logAction( 4, "print" ); window.print(); } var couponHTML = ""; function coupon_buildHTML( parentDiv ){ //, couponID , catchText, html, couponStyle, couponStyleArg ){ new Ajax.Request('/index.php?method=jsDataRequest&dataBlock=couponText' , { method:'get', requestHeaders: {Accept: 'text/xml'}, /*onException: function(transport){ logError( "Exception in loadData" ); },*/ onFailure: function(transport){ //logError( "Failure in loadData" ); }, onSuccess: function(transport){ var node = transport.responseXML.getElementsByTagName('message')[0].firstChild ; if( node != null ){ couponHTML = node.data; }else{ couponHTML =""; } } }); var mainDiv = document.createElement("div"); mainDiv.id = "couponCurtain"; var ccI = document.createElement("div"); ccI.id = "couponCurtainInner"; var cba = document.createElement("a"); cba.id = "closeButtonLink"; cba.appendChild( document.createTextNode( "Close") ); var cb = document.createElement("div"); cb.id = "closeButtonLink"; cb.appendChild(cba); var c = document.createElement("div"); //c.innerHTML = couponHTML ; c.id = "couponHTML"; var pB = document.createElement("div"); pB.id = "printBar"; var pba = document.createElement("a"); pba.id="printCouponLink"; pba.appendChild( document.createTextNode( "Print this coupon" ) ); pB.appendChild(pba); ccI.appendChild( cb); ccI.appendChild( c ); ccI.appendChild( pB ); mainDiv.appendChild( ccI ); mainDiv.setAttribute("class","hidden"); jQuery(parentDiv).append( mainDiv); jQuery("#closeButtonLink").click(function(){ hideFullCoupon(); }); jQuery("#printCouponLink").click(function(){ printCoupon(); }); document.getElementById('couponCurtain').className = "hidden"; document.getElementById('curtainBackground').className = "hidden"; } function couponHTMLPostBack(o){ xmlhttp = o.getXMLHttpRequestObject() couponHTML = xmlhttp.responseXML.getElementsByTagName('message')[0].firstChild.data }