// ######################### Form Validation Functions ############################# // Validates any form to determine if required fields are empty // This function checks for a hidden input field that has the required field name ending with '_required' // located within the form. If found, false is returned and the message alert box displays the value of the // hidden field as an error message. // For Example: Required Input Field: // Required hidden field with error message value: function isValidRequired(myForm) { var isValid=true; var msg = ""; for (var j=0; j<(myForm.elements.length); j++) { var indx = myForm.elements[j].name.indexOf('_required'); if (indx > 0) { var fieldname=myForm.elements[j].name.substring(0,indx); if ((myForm.elements[fieldname].type == 'text') || (myForm.elements[fieldname].type == 'textarea')) { if (myForm.elements[fieldname].value.length == 0) { if (msg == "") { msg = myForm.elements[j].value; } else { msg = msg + '\n\n' + myForm.elements[j].value; } myForm.elements[fieldname].focus(); } } else if (myForm.elements[fieldname].type == 'checkbox') { if (isValidCheckBox(myForm.elements[fieldname]) == false) { if (msg == "") { msg = myForm.elements[j].value; } else { msg = msg + '\n\n' + myForm.elements[j].value; } } myForm.elements[fieldname].focus(); } else if (myForm.elements[fieldname].type == 'radio') { if (isValidRadioButton (myForm.elements[fieldname]) == false) { if (msg == "") { msg = myForm.elements[j].value; } else { msg = msg + '\n\n' + myForm.elements[j].value; } } myForm.elements[fieldname].focus(); } else if (myForm.elements[fieldname].type == 'select') { if (isValidSelect (myForm.elements[fieldname]) == false) { if (msg == "") { msg = myForm.elements[j].value; } else { msg = msg + '\n\n' + myForm.elements[j].value; } } myForm.elements[fieldname].focus(); } } } if (msg != "") { alert(msg); isValid = false; } return isValid; } // Checks whether a required checkbox has been checked function isValidCheckBox(checkBoxName) { var isValid = true; if(checkBoxName.checked == false) { isValid = false; } return isValid; } // Checks whether a required radio group button has been selected function isValidRadioButton(radioGroup) { var isValid = false; for (var i=0; i < radioGroup.length; i++) { if (radioGroup[i].checked) { isValid = true; } } return isValid; } // Checks whether a required select box has been selected function isValidSelect(selectBox) { var isValid = true; if(selectBox.value == null || selectBox.value.length == 0) { isValid = false; } return isValid; } // Validates an email address for proper form function isValidEmail(s) { var Count; var s2; var isValid=true; // empty or blank email if (s.value == "") isValid=false; // email with whitespace if (s.indexOf(' ') != -1) isValid=false; // email without @ if (s.indexOf('@') == -1) isValid=false; // email with @ as the 1st char if (s.indexOf('@') == 0) isValid=false; // email with @ as the last char if ((s.indexOf('@')+1) == s.length) isValid=false; // email without . if (s.indexOf('.') == -1) isValid=false; // email with . as the 1st char if (s.indexOf('.') == 0) isValid=false; // email with . as the last char if ((s.indexOf('.')+1) == s.length) isValid=false; // Now look for the first . after the first @ // s2 = string after the first @ s2=s.substring(s.indexOf('@')+1,s.length); // email without a dot after the first @ if (s2.indexOf('.') == -1) isValid=false; // email dot right after the first @ if (s2.indexOf('.') == 0) isValid=false; return isValid; } function isPhoneNumber(s) { if (s == "") { return (true); } else { if (regExpSupported()) { // var re = /^1?s*-?s*(?s*[0-9]{3}s*)?s*-?s*[0-9]{3}s*-?s*[0-9]{4}$/; return re.test(s); } else { for (var i = 0; i < s.length; i++) { if (((s.charAt(i) < '0') || (s.charAt(i) > '9')) && (s.charAt(i) != '-') && (s.charAt(i) != '(') && (s.charAt(i) != ')')) return (false); } return (true); } } } function isZipCode(s) { if (EmptyString(s)) { return (false); } else { if (isValidUSZipCode(s) || isValidCanadianPostalCode(s)) { return (true); } else { return (false); } } } function isValidUSZipCode(s) { if ((s.length != 5) && (s.length != 10)) { return (false); } else { if (regExpSupported()) { var re = /^[0-9]{5}(-[0-9]{4})?$/; return re.test(s); } else { for (var i = 0; i < s.length; i++) { if ((s.charAt(i) < '0') || (s.charAt(i) > '9')) { if (s.charAt(i) == '-') { if (i != 5) return (false); } else { return (false); } } } return (true); } } } function isValidCanadianPostalCode(s) { if ((s.length != 6) && (s.length != 7)) { return (false); } else { if (regExpSupported()) { var re = /^[a-z|A-Z]{1}\d{1}[a-z|A-Z]{1}\-?\d{1}[a-z|A-Z]{1}\d{1}$/; return re.test(s); } else { for (var i = 0; i < s.length; i++) { if ((s.charAt(i) < '0') || (s.charAt(i) > '9')) { if (s.charAt(i) == '-') { if (i != 3) return (false); } else { if ((i != 0) && (i != 2)) { if (s.charAt(3) == '-') { if ((i != 5) || ((s.charAt(i) < 'A') || ((s.charAt(i) > 'Z') && ((s.charAt(i) < 'a') || (s.charAt(i) > 'z'))))) return (false); } else { if ((i != 4) || ((s.charAt(i) < 'A') || ((s.charAt(i) > 'Z') && ((s.charAt(i) < 'a') || (s.charAt(i) > 'z'))))) return (false); } } else { if ((s.charAt(i) < 'A') || ((s.charAt(i) > 'Z') && ((s.charAt(i) < 'a') || (s.charAt(i) > 'z')))) return (false); } } } else { if (s.charAt(3) == '-') { if ((i != 1) && (i != 4) && (i != 6)) return (false); } else { if ((i != 1) && (i != 3) && (i != 5)) return (false); } } } return (true); } } } function noNumbers(s) { if (s == "") { return (true); } else { if (regExpSupported()) { var re = /^[a-zA-Z]+[a-zA-Z\s]*$/; //var re = /D/; return re.test(s); } else { for (var i = 0; i < s.length; i++) { if ((s.charAt(i) >= '0') && (s.charAt(i) <= '9')) return (false); } return (true); } } } // Uses isValidRequired function to check for required fields and isValidEmail function to check // for valid email address format and returns result in massage box. Parameters passed are the form and // the field name for email address fields function validateNewsletterForm(myForm, emailFieldReq) { var isValid = true; if (isValidRequired(myForm) == false) { isValid = false; return isValid; } if (isValidEmail(myForm.elements[emailFieldReq].value) == false) { alert ('Please provide a valid email address.'); myForm.elements[emailFieldReq].select(); myForm.elements[emailFieldReq].focus(); return false; } return isValid; } function clear_text(defaultValue, textField) { if (textField.value == defaultValue) { textField.value = ""; } else { textField.value = defaultValue; } } /** * FlashObject is (c) 2006 Geoff Stearns and is released under the MIT License: */ if(typeof com=="undefined"){var com=new Object();} if(typeof com.deconcept=="undefined"){com.deconcept=new Object();} if(typeof com.deconcept.util=="undefined"){com.deconcept.util=new Object();} if(typeof com.deconcept.FlashObjectUtil=="undefined"){com.deconcept.FlashObjectUtil=new Object();} com.deconcept.FlashObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a,_b){ //this.instanceof=null; if(!document.createElement||!document.getElementById){return;} this.DETECT_KEY=_b?_b:"detectflash"; this.skipDetect=com.deconcept.util.getRequestParameter(this.DETECT_KEY); this.params=new Object(); this.variables=new Object(); this.attributes=new Array(); this.useExpressInstall=_7; if(_1){this.setAttribute("swf",_1);} if(id){this.setAttribute("id",id);} if(w){this.setAttribute("width",w);} if(h){this.setAttribute("height",h);} if(_5){this.setAttribute("version",new com.deconcept.PlayerVersion(_5.toString().split(".")));} this.installedVer=com.deconcept.FlashObjectUtil.getPlayerVersion(this.getAttribute("version"),_7); if(c){this.addParam("bgcolor",c);} var q=_8?_8:"high"; this.addParam("quality",q); var _d=(_9)?_9:window.location; this.setAttribute("xiRedirectUrl",_d); this.setAttribute("redirectUrl",""); if(_a){this.setAttribute("redirectUrl",_a);} }; com.deconcept.FlashObject.prototype={setAttribute:function(_e,_f){ this.attributes[_e]=_f; },getAttribute:function(_10){ return this.attributes[_10]; },addParam:function(_11,_12){ this.params[_11]=_12; },getParams:function(){ return this.params; },addVariable:function(_13,_14){ this.variables[_13]=_14; },getVariable:function(_15){ return this.variables[_15]; },getVariables:function(){ return this.variables; },createParamTag:function(n,v){ var p=document.createElement("param"); p.setAttribute("name",n); p.setAttribute("value",v); return p; },getVariablePairs:function(){ var _19=new Array(); var key; var _1b=this.getVariables(); for(key in _1b){_19.push(key+"="+_1b[key]);} return _19; },getFlashHTML:function(){ var _1c=""; if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){ if(this.getAttribute("doExpressInstall")){ this.addVariable("MMplayerType","PlugIn"); } _1c="0){_1c+="flashvars=\""+_1f+"\"";} _1c+="/>"; }else{ if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");} _1c=""; _1c+=""; var _20=this.getParams(); for(var key in _20){_1c+="";} var _22=this.getVariablePairs().join("&"); if(_22.length>0){_1c+=""; }_1c+="";} return _1c; },write:function(_23){ if(this.useExpressInstall){ var _24=new com.deconcept.PlayerVersion([6,0,65]); if(this.installedVer.versionIsValid(_24)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){ this.setAttribute("doExpressInstall",true); this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl"))); document.title=document.title.slice(0,47)+" - Flash Player Installation"; this.addVariable("MMdoctitle",document.title);} }else{this.setAttribute("doExpressInstall",false);} if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){ var n=(typeof _23=="string")?document.getElementById(_23):_23; if(typeof n != 'undefined'){ n.innerHTML=this.getFlashHTML(); }else{ document.writeln(this.getFlashHTML()); } }else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}}}; function tiiVBGetFlashVersionExists() { var result = true; try { var dontcare = tiiVBGetFlashVersion( 3 ); } catch(e) { result = false } return result; } com.deconcept.FlashObjectUtil.getPlayerVersion=function(_26,_27){ var _28 = new com.deconcept.PlayerVersion(0,0,0); if ( navigator.plugins && navigator.mimeTypes.length ){ var x = navigator.plugins["Shockwave Flash"]; if ( x && x.description ){ _28 = new com.deconcept.PlayerVersion(x.description.replace(/([a-z]|[A-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split(".")); } } else { try { if ( ! tiiVBGetFlashVersionExists() ) { var axo = new ActiveXObject( "ShockwaveFlash.ShockwaveFlash" ); for ( var i = 3; axo != null; i++ ) { axo = new ActiveXObject( "ShockwaveFlash.ShockwaveFlash." + i ); _28 = new com.deconcept.PlayerVersion( [ i, 0, 0 ] ); } } else { var versionStr = ""; for ( var i = 25; i > 0 ; i-- ) { var tempStr = tiiVBGetFlashVersion( i ); if ( tempStr != "" ) { versionStr = tempStr; break; } } if ( versionStr != "" ) { var splits = versionStr.split(" "); var splits2 = splits[1].split(","); _28 = new com.deconcept.PlayerVersion( [ splits2[0], splits2[1], splits2[2] ] ); } } } catch(e) {} if (_26&&_28.major>_26.major ){return _28;} if ( !_26 || ((_26.minor!=0||_26.rev!=0)&&_28.major==_26.major) || _28.major != 6 || _27){ try { _28 = new com.deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(",")); } catch(e) {} } } return _28; }; com.deconcept.PlayerVersion=function(_2c){ this.major=parseInt(_2c[0])||0; this.minor=parseInt(_2c[1])||0; this.rev=parseInt(_2c[2])||0; }; com.deconcept.PlayerVersion.prototype.versionIsValid=function(fv){ if(this.majorfv.major){return true;} if(this.minorfv.minor){return true;} if(this.rev-1)?q.indexOf("&",_30):q.length; if(q.length>1&&_30>-1){ return q.substring(q.indexOf("=",_30)+1,_31);}}return ""; },removeChildren:function(n){ while(n.hasChildNodes()){ n.removeChild(n.firstChild);}}}; if(Array.prototype.push==null){ Array.prototype.push=function(_33){ this[this.length]=_33; return this.length;};} var getQueryParamValue=com.deconcept.util.getRequestParameter; var FlashObject=com.deconcept.FlashObject; var PlayerVersion=com.deconcept.PlayerVersion; function tiiGetFlashVersion() { var flashversion = 0; if (navigator.plugins && navigator.plugins.length) { var x = navigator.plugins["Shockwave Flash"]; if(x){ if (x.description) { var y = x.description; flashversion = y.charAt(y.indexOf('.')-1); } } } else { result = false; for(var i = 15; i >= 3 && result != true; i--){ execScript('on error resume next: result = IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.'+i+'"))','VBScript'); flashversion = i; } } return flashversion; } function tiiDetectFlash(ver) { if (tiiGetFlashVersion() >= ver) { return true; } else { return false; } } /*-----------------------------------------------------------------------------*/ /* MB - 10/23/07 - Brightcove Wrapper / JavaScript support functions */ /* Function: TiiBcLcDcTracker - Called by Brightcove Flash wrapper to notify */ /* DoubleClick / DART that a Lightningcast ad was served */ /* Requirements: adsitename i.e. &adsitename=3745.mre needs to be passed to */ /* the BC wrapper. If no adzone is specified the default value will be used */ /*-----------------------------------------------------------------------------*/ function TiiBcLcDcTracker (omniAdSiteName,omniAdZone) { var defaultFlg = 'false'; if (omniAdZone == 'default') { omniAdZone = 'video_main_bc_lightningcast'; defaultFlg = 'true'; } var bcLCDCTmpPixel = new Image(); bcLCDCTmpPixel.src = 'http://ad.doubleclick.net/ad/'+omniAdSiteName+'/'+omniAdZone+';sz=1x1;ord='+Math.ceil(1+1E12*Math.random()); return 'Tracking successful - adSiteName="'+omniAdSiteName+'" ,adZone="'+omniAdZone+ '" defaultFlg="'+defaultFlg+'"'; } function TiiBrightcovePlayer() { this.cfg = new Array(); this.flashUrl = "/web/tii/shared/swf/BrightcoveWrapper.swf"; this.flashUrl = "/shared/static/swf/BrightcoveWrapper.swf"; this.bgcolor = "#ffffff"; // Default cfg this.cfg["objectId"] = "bcVideoPlayer"; this.cfg["divId"] = ""; this.cfg["testmode"] = ""; this.cfg["autostart"] = false; this.cfg["lctracking"] = ""; this.cfg["adsitename"] = ""; this.cfg["lcadzone"] = ""; this.setParam = TiiBcSetParam; this.write = TiiBcWrite; } function TiiBcSetParam(key, value) { this.cfg[key] = value; } function TiiBcWrite() { var fo = new FlashObject(this.flashUrl, this.cfg["objectId"], this.cfg["width"], this.cfg["height"], 8, this.bgcolor); fo.addParam("allowScriptAccess", "always"); fo.addParam("menu", "false"); fo.addParam("quality", "high"); fo.addParam("bgcolor", this.bgcolor); fo.addParam("loop", "false"); fo.addParam("wmode", "opaque"); fo.addVariable("account", this.cfg["account"]); fo.addVariable("channel", this.cfg["siteId"]); fo.addVariable("prop16", this.cfg["channel"]); fo.addVariable("playerwidth", this.cfg["width"]); fo.addVariable("playerheight", this.cfg["height"]); fo.addVariable("playerid", this.cfg["playerId"]); fo.addVariable("videoid", this.cfg["videoId"]); fo.addVariable("lineupid", this.cfg["lineupId"]); fo.addVariable("autostart", this.cfg["autostart"]); fo.addVariable("lctracking", this.cfg["lctracking"]); // MB - added 10/23/07 fo.addVariable("adsitename", this.cfg["adsitename"]); // MB - added 10/23/07 fo.addVariable("lcadzone", this.cfg["lcadzone"]); // MB - added 10/23/07 fo.addVariable("objectid", this.cfg["objectId"]); fo.addVariable("adserverurl", this.cfg["adServerUrl"]); if (this.cfg["testmode"] != "") { fo.addVariable("testmode", this.cfg["testmode"]); } fo.altTxt = ""; if (this.cfg["divId"] != "") { fo.write(this.cfg["divId"]); } else { fo.write(); } } var hasBrightcove = -1; // will be reset to 1 if the page loads a BC player // ### Array Helper Functions ### function tiiArrayContains (array, value) { if (array != null) { var al = array.length; for (var i = 0; i < al; i++) { if (array[i] == value) return true; } } return false; } // ### Key=Value; Functions ### function tiiHashKeys(string) { var keys = null; if (string != null) { var hash = string.split(';'); var hl = hash.length - 1; if(hl > 0){ keys = new Array(); for(var i = 0; i < hl; i++){ var data = hash[i].split('='); keys[i] = data[0].replace(' ', ''); } } } return keys; } function tiiHashGet(string, key) { var value = null; if (string != null) { var keyStart = key + '='; var offset = string.indexOf(keyStart); if (offset != -1) { offset += keyStart.length; var end = string.indexOf(';', offset); if (end == -1) { end = string.length; } value = string.substring(offset, end); } } return value; } function tiiHashSet(string, key, value) { var string = tiiHashDelete(string, key); var newValue = key + '=' + value + ';'; if (string != null) newValue = newValue + string; return newValue; } function tiiHashDelete(string, key) { var oldValue = tiiHashGet(string, key); var newString = string; if (oldValue != null) { var search = key + '='; var start = string.indexOf(search); var offset = start + search.length; var end = string.indexOf(';', offset) + 1; if (end == -1) end = string.length; newString = string.slice(0,start) + string.slice(end,string.length); return newString; } return newString; } function tiiGetQueryParamValue(param) { var startIndex; var endIndex; var valueStart; var qs = document.location.search; var detectIndex = qs.indexOf( "?" + param + "=" ); var detectIndex2 = qs.indexOf( "&" + param + "=" ); var key = "&" + param + "="; var keylen = key.length; if (qs.length > 1) { if (detectIndex != -1) { startIndex = detectIndex; } else if (detectIndex2 != -1) { startIndex = detectIndex2; } else { return null; } valueStart = startIndex + keylen; if (qs.indexOf("&", valueStart) != -1) { endIndex = qs.indexOf("&", startIndex + 1) } else { endIndex = qs.length } return (qs.substring(qs.indexOf("=", startIndex) + 1, endIndex)); } return null; } // ### Date/Time Functions ### function tiiDateGetOffsetMinutes(minutes) { var today = new Date(); return today.getTime() + (60000) * minutes;} function tiiDateGetOffsetHours(hours) { var today = new Date(); return today.getTime() + (3600000) * hours; } function tiiDateGetOffsetDays(days) { var today = new Date(); return today.getTime() + (86400000) * days; } function tiiDateGetOffsetWeeks(weeks) { var today = new Date(); return today.getTime() + (604800000) * weeks; } function tiiDateGetOffsetMonths(months) { var today = new Date(); return today.getTime() + (259200000) * months; } function tiiDateGetOffsetYears(years) { var today = new Date(); return today.getTime() + (31536000000) * years; } // ### Core Cookie Functions ### function tiiCookieExists(cookieName) { return tiiArrayContains(tiiCookieGet(), cookieName); } function tiiCookieGet(cookieName) { if (arguments.length == 0) { return tiiHashKeys(document.cookie); } var cookie = tiiHashGet(document.cookie, cookieName); if (cookie != null) cookie = unescape(cookie); return cookie; } function tiiCookieSet(cookieName, cookieValue, domain, path, expires, secure) { if (expires != null) { expire_date = new Date(); expire_date.setTime(expires); } var curCookie = cookieName + '=' + escape(cookieValue) + ((expires) ? '; expires=' + expire_date.toGMTString() : '') + ((path) ? '; path=' + path : '') + ((domain) ? '; domain=' + domain : '') + ((secure) ? '; secure' : ''); document.cookie = curCookie; } function tiiCookieSetUnescape(cookieName, cookieValue, domain, path, expires, secure) { if (expires != null) { expire_date = new Date(); expire_date.setTime(expires); } var curCookie = cookieName + '=' + cookieValue + ((expires) ? '; expires=' + expire_date.toGMTString() : '') + ((path) ? '; path=' + path : '') + ((domain) ? '; domain=' + domain : '') + ((secure) ? '; secure' : ''); document.cookie = curCookie; } function tiiCookieDelete(cookieName) { tiiCookieSet(cookieName, null, null, null, '', 0); } // ### Core Chip Functions ### function tiiCookieChipGet(cookieName, chipName) { if (arguments.length == 1) { return tiiHashKeys(tiiCookieGet(cookieName)); } return tiiHashGet(tiiCookieGet(cookieName), chipName); } function tiiCookieChipSet(cookieName, chipName, chipValue, domain, path, expire, secure) { var new_cookieValue = tiiHashSet(tiiCookieGet(cookieName), chipName, chipValue); tiiCookieSet(cookieName, new_cookieValue, domain, path, expire, secure); } function tiiCookieChipDelete(cookieName, chipName, domain, path, expire, secure) { var new_cookieValue = tiiHashDelete(tiiCookieGet(cookieName), chipName); if (new_cookieValue == null) new_cookieValue = ''; tiiCookieSet(cookieName, new_cookieValue, domain, path, expire, secure); } // ### Permanent Cookie/Chip Functions ### function tiiPermCookieChipGet(chipName) { return tiiCookieChipGet('tii_perm', chipName); } function tiiPermCookieChipSet(chipName, chipValue) { tiiCookieChipSet('tii_perm', chipName, chipValue, null, '/', tiiDateGetOffsetYears(2), 0); } function tiiPermCookieChipDelete(chipName) { tiiCookieChipDelete('tii_perm', chipName, null, '/', tiiDateGetOffsetYears(2), 0); } // ### Session Cookie/Chip Functions ### function tiiSessCookieChipGet(chipName) { return tiiCookieChipGet('tii_sess', chipName); } function tiiSessCookieChipSet(chipName, chipValue) { tiiCookieChipSet('tii_sess', chipName, chipValue, null, '/', null, 0); } function tiiSessCookieChipDelete(chipName) { tiiCookieChipDelete('tii_sess', chipName, null, '/', null, 0); } function tiiQuigoSetEnabled(b) { _tiiQuigoEnabled = b; } function tiiQuigoIsEnabled() { if (typeof(_tiiQuigoEnabled) == "boolean") { return _tiiQuigoEnabled; } return true; } function tiiQuigoWriteAd(pid, placementId, zw, zh, ps) { if (tiiQuigoIsEnabled()) { qas_writeAd(placementId, pid, ps, zw, zh, 'ads.adsonar.com'); } } function tii_callFunctionOnWindowLoad (functionToCall) { if (typeof window.addEventListener != 'undefined') { window.addEventListener ('load', functionToCall, false); } else if (typeof document.addEventListener != 'undefined') { document.addEventListener ('load', functionToCall, false); } else if (typeof window.attachEvent != 'undefined') { window.attachEvent ('onload', functionToCall); } else { var oldFunctionToCall = window.onload; if (typeof window.onload != 'function') { window.onload = functionToCall; } else { window.onload = function () { oldFunctionToCall (); functionToCall (); }; } } } function tii_callFunctionOnElementLoad (targetId, functionToCall) { var myArguments = arguments; tii_callFunctionOnWindowLoad (function () { window.loaded = true; }); var targetElement = document.getElementById (targetId); if (targetElement == null && !window.loaded) { var pollingInterval = setInterval (function () { if (window.loaded) { clearInterval (pollingInterval); } targetElement = document.getElementById (targetId); if (targetElement != null) { clearInterval (pollingInterval); var argumentsTemp = new Array (); var argumentsTempLength = myArguments.length - 2; for (var i = 0; i < argumentsTempLength; i++) { argumentsTemp [i] = myArguments [i + 2]; } functionToCall.apply (this, argumentsTemp); } }, 10); } } function tii_addEventHandlerOnElementLoad (targetId, eventType, functionToCall, bubbleEventUpDOMTree) { tii_callFunctionOnWindowLoad (function () { window.loaded = true; }); var targetElement = document.getElementById (targetId); if (targetElement == null && !window.loaded) { var pollingInterval = setInterval (function () { if (window.loaded) { clearInterval (pollingInterval); } targetElement = document.getElementById (targetId); if (targetElement != null) { clearInterval (pollingInterval); tii_addEventHandler (targetElement, eventType, functionToCall, bubbleEventUpDOMTree); } }, 10); } } function tii_addEventHandler (targetElement, eventType, functionToCall, bubbleEventUpDOMTree) { if (!targetElement) { window.status = 'Warning: Tried to attach event to null object'; return false; } if (typeof targetElement.addEventListener != 'undefined') { targetElement.addEventListener (eventType, functionToCall, bubbleEventUpDOMTree); } else if (typeof targetElement.attachEvent != 'undefined') { targetElement.attachEvent ('on' + eventType, functionToCall); } else { eventType = 'on' + eventType; if (typeof targetElement [eventType] == 'function') { var oldListener = targetElement [eventType]; targetElement [eventType] = function () { oldListener (); return functionToCall (); } } else { targetElement [eventType] = functionToCall; } } return true; } function tii_removeEventHandler (targetElement, eventType, functionToRemove, bubbleEventUpDOMTree) { if (typeof targetElement.removeEventListener != "undefined") { targetElement.removeEventListener (eventType, functionToRemove, bubbleEventUpDOMTree); } else if (typeof targetElement.detachEvent != "undefined") { targetElement.detachEvent ("on" + eventType, functionToRemove); } else { targetElement ["on" + eventType] = null; } return true; } function getDateCurrent () { var today = new Date() var monthName_List = new Date() var arrayMonthNames = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"); monthNumber = (today.getMonth()); monthName = arrayMonthNames[monthNumber]; dayNumber=today.getDate(); if(dayNumber < 10){ dayNumber="0" + dayNumber; } var yearNumber = today.getYear(); if(yearNumber < 1000) { yearNumber+=1900; } document.write(monthName + " " + dayNumber + ", " + yearNumber); } var macTest=(navigator.userAgent.toLowerCase().indexOf("macintosh") >= 0); function IMArticle() { if (isInAolClient()) { document.location.href = "aol://9293::Here's something that may interest you from People.com: " + document.location.href + ""; } else { document.location.href = "aim:goim?message=Here's+something+that+may+interest+you+from+People.com:+" + document.location.href; } return false; } function showCenteredPopup(name, url, features, width, height) { var top = (screen.height / 2) - height / 2; var left = (screen.width / 2) - width / 2; if (features == null || features == '') { features =" scrollbars=yes,toolbar=no,menubar=no,status=no,location=no"; } window.open(url, name, features + ",top=" + top + ",left=" + left + ",width=" + width + ",height=" + height); } // Transforms the url for quiz pages to return a link to the first page of the quiz rather than an internal page function transformURL(pageURL) { var tempURL = ""; var splitURL = pageURL.split(","); // Split the url to pull the oid out var oid = splitURL[2]; // Split the oid into its components of (package_id quiz_id question_id score_id) tempOid = oid.split("_"); // Check if the third position is a question_id or score_id if (tempOid[2] != "") { if (tempOid[2].length > 3) { // Its a package so this is a question_id var idThree = "articleId"; } else { // Its a regular article so this is a score_id var idThree = "scoreId"; } } else { var idThree = ""; } if (tempOid[3] != "") { // Its a package so this is a question_id var idFour = "scoreId"; } else { var idFour = ""; } // If a score is present then we are inside the quiz and must pull out the id for the initial page // otherwise we can return the original url becuase it is the first page of the quiz. if (idThree == "scoreId" || idFour == "scoreId") { if (idThree == "scoreId") { tempURL = splitURL[0] + "," + splitURL[1] + "," + tempOid[0] + "," + splitURL[3]; } else { tempURL = splitURL[0] + "," + splitURL[1] + "," + tempOid[0] + "_" + tempOid[1] + "," + splitURL[3]; } } else { tempURL = pageURL } return tempURL; } function popEmailWin() { var pageURL = document.URL; if (pageURL.substring(pageURL.length-1)=="#") { pageURL = pageURL.substring(0, pageURL.length-1); } //Check and see if this is a quiz to get the proper page url if (pageURL.match('/quizzes/')) { pageURL = transformURL(pageURL); } var pageTitle = self.document.title; if (pageTitle.indexOf('|') > 0) { pageTitle = pageTitle.substring(0, pageTitle.indexOf('|')); } var formURL = "http://cgi.pathfinder.com/cgi-bin/mail/mailurl2friend.cgi?path=/people/emailfriend&url=" + pageURL + "&group=people&title=" + escape(pageTitle); showCenteredPopup('emailpop', formURL, 'scrollbars=1', 460, 450); return false; } function popMediaPlayerWin(media_type, pageURL) { if (media_type == 'video') { var pageTitle = 'PeopleVideo'; } else if (media_type == 'audio') { var pageTitle = 'PeopleVideo'; } showCenteredPopup(pageTitle, pageURL, 'scrollbars=no, status=no', '735', '467'); } function drawPuzzler(codeBase,file){ var html=''; html+=''; html+=''; html+='Your web browser does not support Java applets or Java is not enabled in web browser preferences.'; html+=''; document.write(html); } function rollverGrid() { rolloverGrid(); }; function rolloverGrid(){ if ( document.getElementById("rolloverGrid") != null ) { this.container=document.getElementById("rolloverGrid"); this.buttons=this.container.getElementsByTagName("a"); for(var x=0;x"; this.buttons[x].appendChild(pinkDiv); } } } } function button_select(){ var buttons = document.getElementById("rolloverGrid").getElementsByTagName("a") for(i=0;i=5.0) return true; } function buildBrightcovePlayer (videoID) { var config = new Array(); config["videoId"] = videoID; config["videoRef"] = null; config["lineupId"] = null; config["playerTag"] = null; config["autoStart"] = false; config["preloadBackColor"] = "#FFFFFF"; config["width"] = 300; config["height"] = 320; if(brightcovePlayerID == ""){ config["playerId"] = 416421276; }else{ config["playerId"] = brightcovePlayerID; } createExperience(config, 8); } //set value of source a xid for ad tag source = "" if (tiiGetQueryParamValue("xid")!= null) { source = tiiGetQueryParamValue("xid"); } // Adding this to the site's central JavaScript library would allow us to disable Quigo across the site without flushing the entire site tiiQuigoSetEnabled(true); var adConfig = new TiiAdConfig("3475.peo"); adConfig.setCmSitename("cm.peo"); // Main /* alter adConfig if page is CBB */ if (location.href.indexOf('/celebritybabies/') > -1) {adConfig.sitename = "3475.cbb";}; /* fixes background image "blink" in IE6 */ try { document.execCommand('BackgroundImageCache', false, true);} catch(e) {} /* repairing old variable isFLASH5 */ isFLASH5 = (tiiGetFlashVersion() >= 5); /* repairing tiiGetFlashVersion */ function tiiGetFlashVersion() { var flashversion = 0; if (navigator.plugins && navigator.plugins.length) { var x = navigator.plugins["Shockwave Flash"]; if(x){ if (x.description) { var a = x.description; var b = a.split("."); var c = b[0].split(" "); flashversion = c[c.length-1]; } } } else { result = false; for(var i = 15; i >= 3 && result != true; i--){ execScript('on error resume next: result = IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.'+i+'"))','VBScript'); flashversion = i; } } return flashversion; } /* global Search Form function */ function SearchForm(form) { var inputs = form.getElementsByTagName("input"); for (i = 0; i < inputs.length; i++) { if (inputs[i].className.indexOf(form.inputClass)!=-1) { var input = inputs[i]; input.onfocus = function() { if (this.value == form.exampleText) { this.value = ""; if (this.className.indexOf("newsearchterm")==-1) { this.className = this.className + " newsearchterm"; } } } input.onblur = function() { if (this.value == "") { this.value = form.exampleText; this.className = this.className.replace(/ newsearchterm/,""); } } if (tiiGetQueryParamValue("search")) { input.value = cleanText(tiiGetQueryParamValue("search")); input.className = input.className + " newsearchterm"; } else { input.value = form.exampleText; } if (input.focus) { if (this.value == form.exampleText) { this.value = ""; if (this.className.indexOf("newsearchterm")==-1) { this.className = this.className + " newsearchterm"; } } } } } form.onsubmit = function() {if (input.value == form.exampleText) {input.value = ""};} function cleanText(str) { var t = unescape(str); return t.replace(/\+/g," "); } } /* search */ var searchOut = new Image(); searchOut.src = "http://img2.timeinc.net/people/static/i/home/navsearchoff.gif"; var searchOver = new Image(); searchOver.src = "http://img2.timeinc.net/people/static/i/home/navsearchover.gif"; if (window.location.host == "search.people.com"){ searchOut.src = "http://img2.timeinc.net/people/static/i/home/navsearchselected.gif"; document.getElementById("navigationSearchSubmit").src = searchOut.src; } function initSearch(){ if (!document.getElementById) return; if (!document.getElementsByTagName) return; if (!document.getElementsByTagName("form")) return; if(document.getElementById("navigationSearch") != null){ document.getElementById("navigationSearchSubmit").onmouseover = function(){this.src = searchOver.src}; document.getElementById("navigationSearchSubmit").onmouseout = function(){this.src = searchOut.src}; var forms = document.getElementsByTagName("form"); for (f = 0; f < forms.length; f++) { if (forms[f].className.indexOf("navigationSearch")!=-1) { forms[f].inputClass = "textEntry"; forms[f].exampleText = "Search"; var newForm = new SearchForm(forms[f]); } } } } tii_callFunctionOnWindowLoad(initSearch); /* Tacoda */ var tcdacmd="dt"; adConfig.setTacodaTracking(true); /* Revenue Science */ adConfig.setRevSciTracking(true); /* cm popups */ if (document.referrer.indexOf("google") >= 0) { adConfig.setPopups(false); } if (document.referrer.indexOf("cnn") >= 0) { adConfig.setPopups(false); } if (document.referrer.indexOf("aol") >= 0) { adConfig.setPopups(false); } if (document.referrer.indexOf("netzero") >= 0) { adConfig.setPopups(false); } if (document.referrer.indexOf("earthlink") >= 0) { adConfig.setPopups(false); } if (document.referrer.indexOf("yahoo") >= 0) { adConfig.setPopups(false); } if (document.referrer.indexOf("huffingtonpost") >= 0) { adConfig.setPopups(false); } if (document.referrer.indexOf("popsugar") >= 0) { adConfig.setPopups(false); } if (document.referrer.indexOf("tickle") >= 0) { adConfig.setPopups(false); } if (document.referrer.indexOf("myspace") >= 0) { adConfig.setPopups(false); } if (document.referrer.indexOf("juno") >= 0) { adConfig.setPopups(false); } /* attaches hover affects (t = tagnames to find; c = class to find within t; n = new class to add to c; id = optional parent id) */ tii_attachHoverAffect = function(t,c,n,id) { if (!document.getElementById) return; if (!document.getElementsByTagName) return; if (!id){p = document;} else if (document.getElementById(id) == null) {return false} else {p = document.getElementById(id);} var tags = p.getElementsByTagName(t); for (var i=0; i 0) { rollObj.className = oldClass.replace(" "+n,""); } else { rollObj.className = oldClass.replace(n,""); } }; } } } // function that creates hover state for all elements, even in IE addBookmarkDropdown = function(tag) { if (!document.getElementsByTagName) return; var items = document.getElementsByTagName(tag); if (items.length > 0) { for(var i = 0; i < items.length; i++) { var s = items[i]; if (s.className.indexOf("bookmarkList") > -1) { s.onmouseover = function() { this.className = this.className + " hover"; } s.onmouseout = function() { this.className = this.className.replace(/ hover/,""); } } } } } // adds functionality to String object to get # right characters String.prototype.right = function(n) { if (n <= 0) {return "";} else if (n > String(this).length) {return this;} else {var l = String(this).length; return String(this).substring(l, l - n);} } /* XML HTTP Request */ var xmlreqs = new Array(); // create HTTPRequest object createXMLHttpRequest = function(freed) { this.freed = freed; this.xmlhttp = false; if (window.XMLHttpRequest) { this.xmlhttp = new XMLHttpRequest(); } else if (window.ActiveXObject) { this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } } // check/change ready state, send response back to callback function XMLHttpChange = function(pos) { if (typeof(xmlreqs[pos]) != 'undefined' && xmlreqs[pos].freed == 0 && xmlreqs[pos].xmlhttp.readyState == 4) { if (xmlreqs[pos].xmlhttp.status == 200 || xmlreqs[pos].xmlhttp.status == 304) { if (xmlreqs[pos].url.right(3) == "xml") { xmlreqs[pos].callback(pos,xmlreqs[pos].xmlhttp.responseXML.documentElement); } else { xmlreqs[pos].callback(pos,xmlreqs[pos].xmlhttp.responseText); } } else { return; } xmlreqs[pos].freed = 1; } } // retrieve feed data getXMLHttpRequest = function(pos) { if (xmlreqs[pos].xmlhttp) { xmlreqs[pos].freed = 0; xmlreqs[pos].xmlhttp.open("GET",xmlreqs[pos].url,true); xmlreqs[pos].xmlhttp.onreadystatechange = function() { if (typeof(XMLHttpChange) != 'undefined') { XMLHttpChange(pos); } } if (window.XMLHttpRequest) { xmlreqs[pos].xmlhttp.send(null); } else if (window.ActiveXObject) { xmlreqs[pos].xmlhttp.send(); } } } /* recirculation feed functions */ // global variable initialization var arrRandomFeeds = new Array(); var arrStaticFeeds = new Array(); var arrCalendarDates = new Array(); // function to add feeds and randomize arrRandomFeeds addRandomFeed = function(name, url, website, image) { var n = arrRandomFeeds.length; arrRandomFeeds[n] = new Array(); arrRandomFeeds[n].name = name; arrRandomFeeds[n].url = url; arrRandomFeeds[n].website = website; arrRandomFeeds[n].image = image; arrRandomFeeds.sort(function() {return 0.5 - Math.random()}) } // function to add feeds to arrStaticFeeds addStaticFeed = function(name, url, website, image) { var n = arrStaticFeeds.length; arrStaticFeeds[n] = new Array(); arrStaticFeeds[n].name = name; arrStaticFeeds[n].url = url; arrStaticFeeds[n].website = website; arrStaticFeeds[n].image = image; } // function to add feeds and randomize arrRandomFeeds addCalendarDates = function(c,url) { var n = arrCalendarDates.length; arrCalendarDates[n] = new Array(); arrCalendarDates[n].url = url; arrCalendarDates[n].currPeriod = c; } // request ad feed file getFeed = function(arrPos,id,callbackFunction) { var pos = -1; for (var i=0; i < xmlreqs.length; i++) { if (xmlreqs[i].freed == 1) { pos = i; break; } } if (pos == -1) { pos = xmlreqs.length; xmlreqs[pos] = new createXMLHttpRequest(1); } xmlreqs[pos].url = arrPos.url; xmlreqs[pos].callback = callbackFunction; xmlreqs[pos].id = id; xmlreqs[pos].arrPos = arrPos; getXMLHttpRequest(pos); } // receive ad feed, build HTML elements, place in DOM getFeedCallback = function(pos,response) { if (!document.getElementById) return; if (!document.getElementById(xmlreqs[pos].id)) return; var name = xmlreqs[pos].arrPos.name; var url = xmlreqs[pos].arrPos.url; var website = xmlreqs[pos].arrPos.website; var image = xmlreqs[pos].arrPos.image; var divHTML = "
"; divHTML += "

From \""+name+"\"

"; divHTML += response; divHTML += "

More news at "+name+"

"; divHTML += "
"; document.getElementById(xmlreqs[pos].id).innerHTML = divHTML; } // various pop-ups function popNewsletterWin(page) { switch (page) { case "subscribe": var pageURL = "http://ebm.cheetahmail.com/r/regf2?a=0&aid=1078530696&n=6"; break; case "subscribeFromTout": var pageURL = "http://ebm.cheetahmail.com/r/regf2?a=0&aid=1078530696&n=6"; break; case "cheetah": var pageURL = "http://ebm.cheetahmail.com/r/regf2?a=0&aid=1078530696&n=6"; break; case "cheetahUnsubscribe": var pageURL = "http://ebm.cheetahmail.com/r/regf2?a=0&aid=1078530696&n=7"; break; default: var pageURL = "http://ebm.cheetahmail.com/r/regf2?a=0&aid=1078530696&n=6"; break; } var pageTitle = 'PeopleNewsletter'; showCenteredPopup(pageTitle, pageURL, '',492,500); return false; } var MasterArray = new Array(); /* global Partner Recirc function */ var PartnerRecirc = function(initialArray) { var arr = MasterArray; var nextFeed; var lastFeed; var recircCallback = function(pos) { if (!document.getElementById) return; if (!document.getElementById(pos.id)) return; divID = pos.name.replace(/\./,'').replace(/ /,''); divHTML = '
\n'; divHTML += '

From '+pos.name+'

\n'; divHTML += ' \n'; divHTML += '

'+pos.cta+'

\n'; divHTML += '
\n'; divHTML = document.getElementById(pos.id).innerHTML + divHTML + '\n'; document.getElementById(pos.id).innerHTML = divHTML; }; var checkScript = function(pos) { var recircInt = setInterval(function() { var name = pos.name.replace(/\./,'').replace(/ /,''); if (document.getElementById('recirc-'+name)) { pos.response = new Array(feed); feed = null; detachScript(name); recircCallback(pos); if(nextFeed < lastFeed) { getStarted(); }; clearInterval(recircInt); } },500); }; var detachScript = function(name) { elem = document.getElementById('recirc-'+name); elem.parentNode.removeChild(elem); }; var attachScript = function(pos) { var name = pos.name.replace(/\./,'').replace(/ /,''); var script = document.createElement('script'); script.setAttribute('type','text/javascript'); script.setAttribute('language','javascript'); script.setAttribute('id','recirc-'+name); script.setAttribute('src',pos.json); document.body.appendChild(script); checkScript(pos); }; var getStarted = function() { nextFeed++; if (document.getElementById(arr[nextFeed].id)) { arr[nextFeed].callback = (arr[nextFeed].callback) ? arr[nextFeed].callback : recircCallback; arr[nextFeed].display = (arr[nextFeed].display) ? arr[nextFeed].display : 3; arr[nextFeed].cta = (arr[nextFeed].cta) ? arr[nextFeed].cta : 'More news at '+arr[nextFeed].name; attachScript(arr[nextFeed]); } else { if(nextFeed < lastFeed) { getStarted(); }; } }; var init = function() { if (arr.length > 0) { nextFeed = -1; lastFeed = arr.length-1; getStarted(); } }; init(); } // initialize Partner Recirc feeds on photo channel page var initializeGlobalRecirc = function() { if (!document.getElementById) return; if (!document.getElementsByTagName) return; var recircArray = { 'recircs' : [ { 'id' : 'globalrecirc', 'feed' : [ { 'name' : 'InStyle.com', 'json' : 'http://www.people.com/people/static/json/instyle_parties/feed.js', 'site' : 'http://www.instyle.com', 'image' : 'http://img2.timeinc.net/people/static/i/photos/logoInstyle.gif' },{ 'name' : 'PopEater.com', 'json' : 'http://www.people.com/people/static/json/aol_news/feed.js', 'site' : 'http://www.PopEater.com', 'image' : 'http://img2.timeinc.net/people/static/i/news/logoPopEater.gif' },{ 'name' : 'FoxNews.com', 'json' : 'http://www.people.com/people/static/json/foxnews/feed.js', 'site' : 'http://www.foxnews.com', 'image' : 'http://img2.timeinc.net/people/static/i/news/logoFoxNews.gif' },{ 'name' : 'EW.com', 'json' : 'http://www.people.com/people/static/json/ew/feed.js', 'site' : 'http://www.ew.com', 'image' : 'http://img2.timeinc.net/people/static/i/news/logoEW.gif' },{ 'name' : 'Huffington Post', 'json' : 'http://www.people.com/people/static/json/huffingtonpost/feed.js', 'site' : 'http://www.huffingtonpost.com/entertainment/', 'image' : 'http://img2.timeinc.net/people/static/i/photos/logoHuffingtonPost3.gif' } ] }/*,{ // example of how to do random recircs in a single container; to randomize order, but show both, change 'display' to 2 'id' : 'globalrecirc', 'type' : 'random', 'display' : 1, 'feed' : [ { 'name' : 'Huffington Post', 'json' : 'http://www.people.com/people/static/json/huffingtonpost/feed.js', 'site' : 'http://www.huffingtonpost.com/entertainment/', 'image' : 'http://img2.timeinc.net/people/static/i/photos/logoHuffingtonPost3.gif' },{ 'name' : 'USATODAY.com', 'json' : 'http://www.people.com/people/static/json/usatoday/feed.js', 'site' : 'http://www.usatoday.com', 'image' : 'http://img2.timeinc.net/people/static/i/photos/logoUSAToday.gif' } ] }*/ ] }; for (var a = 0; a < recircArray.recircs.length; a++) { var tempArray = new Array(recircArray.recircs[a]); var last = tempArray[0].feed.length; if (tempArray[0].type && tempArray[0].type == 'random') { tempArray[0].feed.sort(function() {return 0.5 - Math.random();}); last = tempArray[0].display; } for (var f = 0; f < last; f++) { var ids = tempArray[0].id.split(','); var thisID = (ids.length > 1) ? ids[f] : tempArray[0].id; tempArray[0].feed[f].id = thisID; MasterArray.push(tempArray[0].feed[f]); } } } initializeGlobalRecirc(); // start recirc feed process var startRecircFeeds = function() { var n = new PartnerRecirc(); } // can list as many functions as you want and the loader below will load them as soon as the page is loaded var pageLoadFunctions = function() { addBookmarkDropdown("li"); startRecircFeeds(); } tii_callFunctionOnWindowLoad(pageLoadFunctions); // builds the embeddable Brightcove player var buildEmbeddedBrightcovePlayer = function(videoID,chann,peoplechann,packageid) { var config = new Array(); config["videoId"] = videoID; if(!chann){ var chann = ""; } if(!peoplechann){ var peoplechann = ""; } if(!packageid){ var packageid = ""; } config["additionalAdTargetingParams"] = ';chan='+chann+';pchan='+peoplechann+';pckge='+packageid; config["videoRef"] = null; config["lineupId"] = null; config["playerTag"] = null; config["autoStart"] = false; config["preloadBackColor"] = "#FFFFFF"; config["width"] = 466; config["height"] = 402; config["playerId"] = 1803212252; createExperience(config, 8); }