/* Copyright (c) 2008, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.net/yui/license.txt version: 2.5.2 */ if(typeof YAHOO=="undefined"||!YAHOO){var YAHOO={};}YAHOO.namespace=function(){var A=arguments,E=null,C,B,D;for(C=0;C0)?A.dump(D[F],I-1):L);}else{K.push(D[F]);}K.push(J);}if(K.length>1){K.pop();}K.push("]");}else{K.push("{");for(F in D){if(A.hasOwnProperty(D,F)){K.push(F+G);if(A.isObject(D[F])){K.push((I>0)?A.dump(D[F],I-1):L);}else{K.push(D[F]);}K.push(J);}}if(K.length>1){K.pop();}K.push("}");}return K.join("");},substitute:function(S,E,L){var I,H,G,O,P,R,N=[],F,J="dump",M=" ",D="{",Q="}";for(;;){I=S.lastIndexOf(D);if(I<0){break;}H=S.indexOf(Q,I);if(I+1>=H){break;}F=S.substring(I+1,H);O=F;R=null;G=O.indexOf(M);if(G>-1){R=O.substring(G+1);O=O.substring(0,G);}P=E[O];if(L){P=L(O,P,R);}if(A.isObject(P)){if(A.isArray(P)){P=A.dump(P,parseInt(R,10));}else{R=R||"";var K=R.indexOf(J);if(K>-1){R=R.substring(4);}if(P.toString===Object.prototype.toString||K>-1){P=A.dump(P,parseInt(R,10));}else{P=P.toString();}}}else{if(!A.isString(P)&&!A.isNumber(P)){P="~-"+N.length+"-~";N[N.length]=F;}}S=S.substring(0,I)+P+S.substring(H+1);}for(I=N.length-1;I>=0;I=I-1){S=S.replace(new RegExp("~-"+I+"-~"),"{"+N[I]+"}","g");}return S;},trim:function(D){try{return D.replace(/^\s+|\s+$/g,"");}catch(E){return D;}},merge:function(){var G={},E=arguments;for(var F=0,D=E.length;F=this.left&&A.right<=this.right&&A.top>=this.top&&A.bottom<=this.bottom);};YAHOO.util.Region.prototype.getArea=function(){return((this.bottom-this.top)*(this.right-this.left));};YAHOO.util.Region.prototype.intersect=function(E){var C=Math.max(this.top,E.top);var D=Math.min(this.right,E.right);var A=Math.min(this.bottom,E.bottom);var B=Math.max(this.left,E.left);if(A>=C&&D>=B){return new YAHOO.util.Region(C,D,A,B);}else{return null;}};YAHOO.util.Region.prototype.union=function(E){var C=Math.min(this.top,E.top);var D=Math.max(this.right,E.right);var A=Math.max(this.bottom,E.bottom);var B=Math.min(this.left,E.left);return new YAHOO.util.Region(C,D,A,B);};YAHOO.util.Region.prototype.toString=function(){return("Region {"+"top: "+this.top+", right: "+this.right+", bottom: "+this.bottom+", left: "+this.left+"}");};YAHOO.util.Region.getRegion=function(D){var F=YAHOO.util.Dom.getXY(D);var C=F[1];var E=F[0]+D.offsetWidth;var A=F[1]+D.offsetHeight;var B=F[0];return new YAHOO.util.Region(C,E,A,B);};YAHOO.util.Point=function(A,B){if(YAHOO.lang.isArray(A)){B=A[1];A=A[0];}this.x=this.right=this.left=this[0]=A;this.y=this.top=this.bottom=this[1]=B;};YAHOO.util.Point.prototype=new YAHOO.util.Region();YAHOO.register("dom",YAHOO.util.Dom,{version:"2.5.2",build:"1076"});YAHOO.util.CustomEvent=function(D,B,C,A){this.type=D;this.scope=B||window;this.silent=C;this.signature=A||YAHOO.util.CustomEvent.LIST;this.subscribers=[];if(!this.silent){}var E="_YUICEOnSubscribe";if(D!==E){this.subscribeEvent=new YAHOO.util.CustomEvent(E,this,true);}this.lastError=null;};YAHOO.util.CustomEvent.LIST=0;YAHOO.util.CustomEvent.FLAT=1;YAHOO.util.CustomEvent.prototype={subscribe:function(B,C,A){if(!B){throw new Error("Invalid callback for subscriber to '"+this.type+"'");}if(this.subscribeEvent){this.subscribeEvent.fire(B,C,A);}this.subscribers.push(new YAHOO.util.Subscriber(B,C,A));},unsubscribe:function(D,F){if(!D){return this.unsubscribeAll();}var E=false;for(var B=0,A=this.subscribers.length;B0){B=I[0];}try{G=M.fn.call(L,B,M.obj);}catch(F){this.lastError=F;if(A){throw F;}}}else{try{G=M.fn.call(L,this.type,I,M.obj);}catch(H){this.lastError=H;if(A){throw H;}}}if(false===G){if(!this.silent){}break;}}}return(G!==false);},unsubscribeAll:function(){for(var A=this.subscribers.length-1;A>-1;A--){this._delete(A);}this.subscribers=[];return A;},_delete:function(A){var B=this.subscribers[A];if(B){delete B.fn;delete B.obj;}this.subscribers.splice(A,1);},toString:function(){return"CustomEvent: "+"'"+this.type+"', "+"scope: "+this.scope;}};YAHOO.util.Subscriber=function(B,C,A){this.fn=B;this.obj=YAHOO.lang.isUndefined(C)?null:C;this.override=A;};YAHOO.util.Subscriber.prototype.getScope=function(A){if(this.override){if(this.override===true){return this.obj;}else{return this.override;}}return A;};YAHOO.util.Subscriber.prototype.contains=function(A,B){if(B){return(this.fn==A&&this.obj==B);}else{return(this.fn==A);}};YAHOO.util.Subscriber.prototype.toString=function(){return"Subscriber { obj: "+this.obj+", override: "+(this.override||"no")+" }";};if(!YAHOO.util.Event){YAHOO.util.Event=function(){var H=false;var I=[];var J=[];var G=[];var E=[];var C=0;var F=[];var B=[];var A=0;var D={63232:38,63233:40,63234:37,63235:39,63276:33,63277:34,25:9};return{POLL_RETRYS:2000,POLL_INTERVAL:20,EL:0,TYPE:1,FN:2,WFN:3,UNLOAD_OBJ:3,ADJ_SCOPE:4,OBJ:5,OVERRIDE:6,lastError:null,isSafari:YAHOO.env.ua.webkit,webkit:YAHOO.env.ua.webkit,isIE:YAHOO.env.ua.ie,_interval:null,_dri:null,DOMReady:false,throwErrors:false,startInterval:function(){if(!this._interval){var K=this;var L=function(){K._tryPreloadAttach();};this._interval=setInterval(L,this.POLL_INTERVAL);}},onAvailable:function(P,M,Q,O,N){var K=(YAHOO.lang.isString(P))?[P]:P;for(var L=0;L-1;O--){U=(this.removeListener(L[O],K,T)&&U);}return U;}}if(!T||!T.call){return this.purgeElement(L,false,K);}if("unload"==K){for(O=J.length-1;O>-1;O--){V=J[O];if(V&&V[0]==L&&V[1]==K&&V[2]==T){J.splice(O,1);return true;}}return false;}var P=null;var Q=arguments[3];if("undefined"===typeof Q){Q=this._getCacheIndex(L,K,T);}if(Q>=0){P=I[Q];}if(!L||!P){return false;}if(this.useLegacyEvent(L,K)){var N=this.getLegacyIndex(L,K);var M=E[N];if(M){for(O=0,R=M.length;O0&&F.length>0);}var P=[];var R=function(T,U){var S=T;if(U.override){if(U.override===true){S=U.obj;}else{S=U.override;}}U.fn.call(S,U.obj);};var L,K,O,N,M=[];for(L=0,K=F.length;L-1;L--){O=F[L];if(!O||!O.id){F.splice(L,1);}}this.startInterval();}else{clearInterval(this._interval);this._interval=null;}this.locked=false;},purgeElement:function(O,P,R){var M=(YAHOO.lang.isString(O))?this.getEl(O):O;var Q=this.getListeners(M,R),N,K;if(Q){for(N=Q.length-1;N>-1;N--){var L=Q[N];this.removeListener(M,L.type,L.fn);}}if(P&&M&&M.childNodes){for(N=0,K=M.childNodes.length;N-1;M--){L=I[M];if(L){K.removeListener(L[K.EL],L[K.TYPE],L[K.FN],M);}}L=null;}G=null;K._simpleRemove(window,"unload",K._unload);},_getScrollLeft:function(){return this._getScroll()[1];},_getScrollTop:function(){return this._getScroll()[0];},_getScroll:function(){var K=document.documentElement,L=document.body;if(K&&(K.scrollTop||K.scrollLeft)){return[K.scrollTop,K.scrollLeft];}else{if(L){return[L.scrollTop,L.scrollLeft];}else{return[0,0];}}},regCE:function(){},_simpleAdd:function(){if(window.addEventListener){return function(M,N,L,K){M.addEventListener(N,L,(K));};}else{if(window.attachEvent){return function(M,N,L,K){M.attachEvent("on"+N,L);};}else{return function(){};}}}(),_simpleRemove:function(){if(window.removeEventListener){return function(M,N,L,K){M.removeEventListener(N,L,(K));};}else{if(window.detachEvent){return function(L,M,K){L.detachEvent("on"+M,K);};}else{return function(){};}}}()};}();(function(){var EU=YAHOO.util.Event;EU.on=EU.addListener; /* DOMReady: based on work by: Dean Edwards/John Resig/Matthias Miller */ if(EU.isIE){YAHOO.util.Event.onDOMReady(YAHOO.util.Event._tryPreloadAttach,YAHOO.util.Event,true);var n=document.createElement("p");EU._dri=setInterval(function(){try{n.doScroll("left");clearInterval(EU._dri);EU._dri=null;EU._ready();n=null;}catch(ex){}},EU.POLL_INTERVAL);}else{if(EU.webkit&&EU.webkit<525){EU._dri=setInterval(function(){var rs=document.readyState;if("loaded"==rs||"complete"==rs){clearInterval(EU._dri);EU._dri=null;EU._ready();}},EU.POLL_INTERVAL);}else{EU._simpleAdd(document,"DOMContentLoaded",EU._ready);}}EU._simpleAdd(window,"load",EU._load);EU._simpleAdd(window,"unload",EU._unload);EU._tryPreloadAttach();})();}YAHOO.util.EventProvider=function(){};YAHOO.util.EventProvider.prototype={__yui_events:null,__yui_subscribers:null,subscribe:function(A,C,F,E){this.__yui_events=this.__yui_events||{};var D=this.__yui_events[A];if(D){D.subscribe(C,F,E);}else{this.__yui_subscribers=this.__yui_subscribers||{};var B=this.__yui_subscribers;if(!B[A]){B[A]=[];}B[A].push({fn:C,obj:F,override:E});}},unsubscribe:function(C,E,G){this.__yui_events=this.__yui_events||{};var A=this.__yui_events;if(C){var F=A[C];if(F){return F.unsubscribe(E,G);}}else{var B=true;for(var D in A){if(YAHOO.lang.hasOwnProperty(A,D)){B=B&&A[D].unsubscribe(E,G);}}return B;}return false;},unsubscribeAll:function(A){return this.unsubscribe(A);},createEvent:function(G,D){this.__yui_events=this.__yui_events||{};var A=D||{};var I=this.__yui_events; if(I[G]){}else{var H=A.scope||this;var E=(A.silent);var B=new YAHOO.util.CustomEvent(G,H,E,YAHOO.util.CustomEvent.FLAT);I[G]=B;if(A.onSubscribeCallback){B.subscribeEvent.subscribe(A.onSubscribeCallback);}this.__yui_subscribers=this.__yui_subscribers||{};var F=this.__yui_subscribers[G];if(F){for(var C=0;C0)?E:0;}B.Dom.setStyle(this.getEl(),C,E+D);},getAttribute:function(C){var E=this.getEl();var G=B.Dom.getStyle(E,C);if(G!=="auto"&&!this.patterns.offsetUnit.test(G)){return parseFloat(G);}var D=this.patterns.offsetAttribute.exec(C)||[];var H=!!(D[3]);var F=!!(D[2]);if(F||(B.Dom.getStyle(E,"position")=="absolute"&&H)){G=E["offset"+D[0].charAt(0).toUpperCase()+D[0].substr(1)];}else{G=0;}return G;},getDefaultUnit:function(C){if(this.patterns.defaultUnit.test(C)){return"px";}return"";},setRuntimeAttribute:function(D){var I;var E;var F=this.attributes;this.runtimeAttributes[D]={};var H=function(J){return(typeof J!=="undefined");};if(!H(F[D]["to"])&&!H(F[D]["by"])){return false;}I=(H(F[D]["from"]))?F[D]["from"]:this.getAttribute(D);if(H(F[D]["to"])){E=F[D]["to"];}else{if(H(F[D]["by"])){if(I.constructor==Array){E=[];for(var G=0,C=I.length;G0&&isFinite(K)){if(G.currentFrame+K>=J){K=J-(I+1);}G.currentFrame+=K;}};};YAHOO.util.Bezier=new function(){this.getPosition=function(E,D){var F=E.length;var C=[];for(var B=0;B0&&!(L[0] instanceof Array)){L=[L];}else{var K=[];for(M=0,O=L.length;M0){this.runtimeAttributes[P]=this.runtimeAttributes[P].concat(L);}this.runtimeAttributes[P][this.runtimeAttributes[P].length]=I;}else{F.setRuntimeAttribute.call(this,P);}};var B=function(G,I){var H=E.Dom.getXY(this.getEl());G=[G[0]-H[0]+I[0],G[1]-H[1]+I[1]];return G;};var D=function(G){return(typeof G!=="undefined");};E.Motion=A;})();(function(){var D=function(F,E,G,H){if(F){D.superclass.constructor.call(this,F,E,G,H);}};D.NAME="Scroll";var B=YAHOO.util;YAHOO.extend(D,B.ColorAnim);var C=D.superclass;var A=D.prototype;A.doMethod=function(E,H,F){var G=null;if(E=="scroll"){G=[this.method(this.currentFrame,H[0],F[0]-H[0],this.totalFrames),this.method(this.currentFrame,H[1],F[1]-H[1],this.totalFrames)];}else{G=C.doMethod.call(this,E,H,F);}return G;};A.getAttribute=function(E){var G=null;var F=this.getEl();if(E=="scroll"){G=[F.scrollLeft,F.scrollTop];}else{G=C.getAttribute.call(this,E);}return G;};A.setAttribute=function(E,H,G){var F=this.getEl();if(E=="scroll"){F.scrollLeft=H[0];F.scrollTop=H[1];}else{C.setAttribute.call(this,E,H,G);}};B.Scroll=D;})();YAHOO.register("animation",YAHOO.util.Anim,{version:"2.5.2",build:"1076"}); /* Copyright (c) 2008, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.net/yui/license.txt version: 2.5.2 */ YAHOO.util.Connect={_msxml_progid:["Microsoft.XMLHTTP","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP"],_http_headers:{},_has_http_headers:false,_use_default_post_header:true,_default_post_header:"application/x-www-form-urlencoded; charset=UTF-8",_default_form_header:"application/x-www-form-urlencoded",_use_default_xhr_header:true,_default_xhr_header:"XMLHttpRequest",_has_default_headers:true,_default_headers:{},_isFormSubmit:false,_isFileUpload:false,_formNode:null,_sFormData:null,_poll:{},_timeOut:{},_polling_interval:50,_transaction_id:0,_submitElementValue:null,_hasSubmitListener:(function(){if(YAHOO.util.Event){YAHOO.util.Event.addListener(document,"click",function(B){var A=YAHOO.util.Event.getTarget(B);if(A.nodeName.toLowerCase()=="input"&&(A.type&&A.type.toLowerCase()=="submit")){YAHOO.util.Connect._submitElementValue=encodeURIComponent(A.name)+"="+encodeURIComponent(A.value);}});return true;}return false;})(),startEvent:new YAHOO.util.CustomEvent("start"),completeEvent:new YAHOO.util.CustomEvent("complete"),successEvent:new YAHOO.util.CustomEvent("success"),failureEvent:new YAHOO.util.CustomEvent("failure"),uploadEvent:new YAHOO.util.CustomEvent("upload"),abortEvent:new YAHOO.util.CustomEvent("abort"),_customEvents:{onStart:["startEvent","start"],onComplete:["completeEvent","complete"],onSuccess:["successEvent","success"],onFailure:["failureEvent","failure"],onUpload:["uploadEvent","upload"],onAbort:["abortEvent","abort"]},setProgId:function(A){this._msxml_progid.unshift(A);YAHOO.log("ActiveX Program Id "+A+" added to _msxml_progid.","info","Connection");},setDefaultPostHeader:function(A){if(typeof A=="string"){this._default_post_header=A;YAHOO.log("Default POST header set to "+A,"info","Connection");}else{if(typeof A=="boolean"){this._use_default_post_header=A;}}},setDefaultXhrHeader:function(A){if(typeof A=="string"){this._default_xhr_header=A;YAHOO.log("Default XHR header set to "+A,"info","Connection");}else{this._use_default_xhr_header=A;}},setPollingInterval:function(A){if(typeof A=="number"&&isFinite(A)){this._polling_interval=A;YAHOO.log("Default polling interval set to "+A+"ms","info","Connection");}},createXhrObject:function(E){var D,A;try{A=new XMLHttpRequest();D={conn:A,tId:E};YAHOO.log("XHR object created for transaction "+E,"info","Connection");}catch(C){for(var B=0;B=200&&D<300||D===1223){C=this.createResponseObject(F,B);if(G&&G.success){if(!G.scope){G.success(C);YAHOO.log("Success callback. HTTP code is "+D,"info","Connection");}else{G.success.apply(G.scope,[C]);YAHOO.log("Success callback with scope. HTTP code is "+D,"info","Connection");}}this.successEvent.fire(C);if(F.successEvent){F.successEvent.fire(C);}}else{switch(D){case 12002:case 12029:case 12030:case 12031:case 12152:case 13030:C=this.createExceptionObject(F.tId,B,(A?A:false));if(G&&G.failure){if(!G.scope){G.failure(C); YAHOO.log("Failure callback. Exception detected. Status code is "+D,"warn","Connection");}else{G.failure.apply(G.scope,[C]);YAHOO.log("Failure callback with scope. Exception detected. Status code is "+D,"warn","Connection");}}break;default:C=this.createResponseObject(F,B);if(G&&G.failure){if(!G.scope){G.failure(C);YAHOO.log("Failure callback. HTTP status code is "+D,"warn","Connection");}else{G.failure.apply(G.scope,[C]);YAHOO.log("Failure callback with scope. HTTP status code is "+D,"warn","Connection");}}}this.failureEvent.fire(C);if(F.failureEvent){F.failureEvent.fire(C);}}this.releaseObject(F);C=null;},createResponseObject:function(A,G){var D={};var I={};try{var C=A.conn.getAllResponseHeaders();var F=C.split("\n");for(var E=0;E');if(typeof A=="boolean"){C.src="javascript:false";}}else{C=document.createElement("iframe");C.id=B;C.name=B;}C.style.position="absolute";C.style.top="-1000px";C.style.left="-1000px";document.body.appendChild(C);YAHOO.log("File upload iframe created. Id is:"+B,"info","Connection");},appendPostData:function(A){var D=[];var B=A.split("&");for(var C=0;C0){for(var G=0;G0)){this.delimChar=[A];}else{if(!YAHOO.lang.isArray(A)){this.delimChar=null;}}var C=this.animSpeed;if((this.animHoriz||this.animVert)&&YAHOO.util.Anim){if(!YAHOO.lang.isNumber(C)||(C<0)){this.animSpeed=0.3;}if(!this._oAnim){this._oAnim=new YAHOO.util.Anim(this._elContent,{},this.animSpeed);}else{this._oAnim.duration=this.animSpeed;}}if(this.forceSelection&&A){}};YAHOO.widget.AutoComplete.prototype._initContainerHelpers=function(){if(this.useShadow&&!this._elShadow){var A=document.createElement("div");A.className="yui-ac-shadow";this._elShadow=this._elContainer.appendChild(A);}if(this.useIFrame&&!this._elIFrame){var B=document.createElement("iframe");B.src=this._iFrameSrc;B.frameBorder=0;B.scrolling="no";B.style.position="absolute";B.style.width="100%";B.style.height="100%";B.tabIndex=-1;this._elIFrame=this._elContainer.appendChild(B);}};YAHOO.widget.AutoComplete.prototype._initContainer=function(){YAHOO.util.Dom.addClass(this._elContainer,"yui-ac-container");if(!this._elContent){var C=document.createElement("div");C.className="yui-ac-content";C.style.display="none";this._elContent=this._elContainer.appendChild(C);var B=document.createElement("div");B.className="yui-ac-hd";B.style.display="none";this._elHeader=this._elContent.appendChild(B);var D=document.createElement("div");D.className="yui-ac-bd";this._elBody=this._elContent.appendChild(D);var A=document.createElement("div");A.className="yui-ac-ft";A.style.display="none";this._elFooter=this._elContent.appendChild(A);}else{}};YAHOO.widget.AutoComplete.prototype._initList=function(){this._aListItems=[];while(this._elBody.hasChildNodes()){var B=this.getListItems();if(B){for(var A=B.length-1;A>=0;A--){B[A]=null;}}this._elBody.innerHTML="";}var E=document.createElement("ul");E=this._elBody.appendChild(E);for(var C=0;C=18&&A<=20)||(A==27)||(A>=33&&A<=35)||(A>=36&&A<=40)||(A>=44&&A<=45)){return true;}return false;};YAHOO.widget.AutoComplete.prototype._sendQuery=function(G){if(this.minQueryLength==-1){this._toggleContainer(false);return ;}var C=(this.delimChar)?this.delimChar:null;if(C){var E=-1;for(var B=C.length-1;B>=0;B--){var F=G.lastIndexOf(C[B]);if(F>E){E=F; }}if(C[B]==" "){for(var A=C.length-1;A>=0;A--){if(G[E-1]==C[A]){E--;break;}}}if(E>-1){var D=E+1;while(G.charAt(D)==" "){D+=1;}this._sSavedQuery=G.substring(0,D);G=G.substr(D);}else{if(G.indexOf(this._sSavedQuery)<0){this._sSavedQuery=null;}}}if((G&&(G.length0)){if(this._nDelayID!=-1){clearTimeout(this._nDelayID);}this._toggleContainer(false);return ;}G=encodeURIComponent(G);this._nDelayID=-1;G=this.doBeforeSendQuery(G);this.dataRequestEvent.fire(this,G);this.dataSource.getResults(this._populateList,G,this);};YAHOO.widget.AutoComplete.prototype._populateList=function(K,L,I){if(L===null){I.dataErrorEvent.fire(I,K);}if(!I._bFocused||!L){return ;}var A=(navigator.userAgent.toLowerCase().indexOf("opera")!=-1);var O=I._elContent.style;O.width=(!A)?null:"";O.height=(!A)?null:"";var H=decodeURIComponent(K);I._sCurQuery=H;I._bItemSelected=false;if(I._maxResultsDisplayed!=I.maxResultsDisplayed){I._initList();}var C=Math.min(L.length,I.maxResultsDisplayed);I._nDisplayedItems=C;if(C>0){I._initContainerHelpers();var D=I._aListItems;for(var G=C-1;G>=0;G--){var N=D[G];var B=L[G];N.innerHTML=I.formatResult(B,H);N.style.display="list-item";N._sResultKey=B[0];N._oResultData=B;}for(var F=D.length-1;F>=C;F--){var M=D[F];M.innerHTML=null;M.style.display="none";M._sResultKey=null;M._oResultData=null;}var J=I.doBeforeExpandContainer(I._elTextbox,I._elContainer,K,L);I._toggleContainer(J);if(I.autoHighlight){var E=D[0];I._toggleHighlight(E,"to");I.itemArrowToEvent.fire(I,E);I._typeAhead(E,K);}else{I._oCurItem=null;}}else{I._toggleContainer(false);}I.dataReturnEvent.fire(I,K,L);};YAHOO.widget.AutoComplete.prototype._clearSelection=function(){var C=this._elTextbox.value;var B=(this.delimChar)?this.delimChar[0]:null;var A=(B)?C.lastIndexOf(B,C.length-2):-1;if(A>-1){this._elTextbox.value=C.substring(0,A);}else{this._elTextbox.value="";}this._sSavedQuery=this._elTextbox.value;this.selectionEnforceEvent.fire(this);};YAHOO.widget.AutoComplete.prototype._textMatchesOption=function(){var D=null;for(var A=this._nDisplayedItems-1;A>=0;A--){var C=this._aListItems[A];var B=C._sResultKey.toLowerCase();if(B==this._sCurQuery.toLowerCase()){D=C;break;}}return(D);};YAHOO.widget.AutoComplete.prototype._typeAhead=function(D,G){if(!this.typeAhead||(this._nKeyCode==8)){return ;}var F=this._elTextbox;var E=this._elTextbox.value;if(!F.setSelectionRange&&!F.createTextRange){return ;}var B=E.length;this._updateValue(D);var C=F.value.length;this._selectText(F,B,C);var A=F.value.substr(B,C);this.typeAheadEvent.fire(this,G,A);};YAHOO.widget.AutoComplete.prototype._selectText=function(D,A,B){if(D.setSelectionRange){D.setSelectionRange(A,B);}else{if(D.createTextRange){var C=D.createTextRange();C.moveStart("character",A);C.moveEnd("character",B-D.value.length);C.select();}else{D.select();}}};YAHOO.widget.AutoComplete.prototype._toggleContainerHelpers=function(B){var D=false;var C=this._elContent.offsetWidth+"px";var A=this._elContent.offsetHeight+"px";if(this.useIFrame&&this._elIFrame){D=true;if(B){this._elIFrame.style.width=C;this._elIFrame.style.height=A;}else{this._elIFrame.style.width=0;this._elIFrame.style.height=0;}}if(this.useShadow&&this._elShadow){D=true;if(B){this._elShadow.style.width=C;this._elShadow.style.height=A;}else{this._elShadow.style.width=0;this._elShadow.style.height=0;}}};YAHOO.widget.AutoComplete.prototype._toggleContainer=function(K){var E=this._elContainer;if(this.alwaysShowContainer&&this._bContainerOpen){return ;}if(!K){this._elContent.scrollTop=0;var C=this._aListItems;if(C&&(C.length>0)){for(var H=C.length-1;H>=0;H--){C[H].style.display="none";}}if(this._oCurItem){this._toggleHighlight(this._oCurItem,"from");}this._oCurItem=null;this._nDisplayedItems=0;this._sCurQuery=null;}if(!K&&!this._bContainerOpen){this._elContent.style.display="none";return ;}var B=this._oAnim;if(B&&B.getEl()&&(this.animHoriz||this.animVert)){if(!K){this._toggleContainerHelpers(K);}if(B.isAnimated()){B.stop();}var I=this._elContent.cloneNode(true);E.appendChild(I);I.style.top="-9000px";I.style.display="block";var G=I.offsetWidth;var D=I.offsetHeight;var A=(this.animHoriz)?0:G;var F=(this.animVert)?0:D;B.attributes=(K)?{width:{to:G},height:{to:D}}:{width:{to:A},height:{to:F}};if(K&&!this._bContainerOpen){this._elContent.style.width=A+"px";this._elContent.style.height=F+"px";}else{this._elContent.style.width=G+"px";this._elContent.style.height=D+"px";}E.removeChild(I);I=null;var J=this;var L=function(){B.onComplete.unsubscribeAll();if(K){J.containerExpandEvent.fire(J);}else{J._elContent.style.display="none";J.containerCollapseEvent.fire(J);}J._toggleContainerHelpers(K);};this._elContent.style.display="block";B.onComplete.subscribe(L);B.animate();this._bContainerOpen=K;}else{if(K){this._elContent.style.display="block";this.containerExpandEvent.fire(this);}else{this._elContent.style.display="none";this.containerCollapseEvent.fire(this);}this._toggleContainerHelpers(K);this._bContainerOpen=K;}};YAHOO.widget.AutoComplete.prototype._toggleHighlight=function(A,C){var B=this.highlightClassName;if(this._oCurItem){YAHOO.util.Dom.removeClass(this._oCurItem,B);}if((C=="to")&&B){YAHOO.util.Dom.addClass(A,B);this._oCurItem=A;}};YAHOO.widget.AutoComplete.prototype._togglePrehighlight=function(A,C){if(A==this._oCurItem){return ;}var B=this.prehighlightClassName;if((C=="mouseover")&&B){YAHOO.util.Dom.addClass(A,B);}else{YAHOO.util.Dom.removeClass(A,B);}};YAHOO.widget.AutoComplete.prototype._updateValue=function(E){var F=this._elTextbox;var D=(this.delimChar)?(this.delimChar[0]||this.delimChar):null;var B=this._sSavedQuery;var C=E._sResultKey;F.focus();F.value="";if(D){if(B){F.value=B;}F.value+=C+D;if(D!=" "){F.value+=" ";}}else{F.value=C;}if(F.type=="textarea"){F.scrollTop=F.scrollHeight;}var A=F.value.length;this._selectText(F,A,A);this._oCurItem=E;};YAHOO.widget.AutoComplete.prototype._selectItem=function(A){this._bItemSelected=true;this._updateValue(A);this._cancelIntervalDetection(this);this.itemSelectEvent.fire(this,A,A._oResultData); this._toggleContainer(false);};YAHOO.widget.AutoComplete.prototype._jumpSelection=function(){if(this._oCurItem){this._selectItem(this._oCurItem);}else{this._toggleContainer(false);}};YAHOO.widget.AutoComplete.prototype._moveSelection=function(G){if(this._bContainerOpen){var E=this._oCurItem;var F=-1;if(E){F=E._nItemIndex;}var D=(G==40)?(F+1):(F-1);if(D<-2||D>=this._nDisplayedItems){return ;}if(E){this._toggleHighlight(E,"from");this.itemArrowFromEvent.fire(this,E);}if(D==-1){if(this.delimChar&&this._sSavedQuery){if(!this._textMatchesOption()){this._elTextbox.value=this._sSavedQuery;}else{this._elTextbox.value=this._sSavedQuery+this._sCurQuery;}}else{this._elTextbox.value=this._sCurQuery;}this._oCurItem=null;return ;}if(D==-2){this._toggleContainer(false);return ;}var C=this._aListItems[D];var A=this._elContent;var B=((YAHOO.util.Dom.getStyle(A,"overflow")=="auto")||(YAHOO.util.Dom.getStyle(A,"overflowY")=="auto"));if(B&&(D>-1)&&(D(A.scrollTop+A.offsetHeight)){A.scrollTop=(C.offsetTop+C.offsetHeight)-A.offsetHeight;}else{if((C.offsetTop+C.offsetHeight)(A.scrollTop+A.offsetHeight)){this._elContent.scrollTop=(C.offsetTop+C.offsetHeight)-A.offsetHeight;}}}}this._toggleHighlight(C,"to");this.itemArrowToEvent.fire(this,C);if(this.typeAhead){this._updateValue(C);}}};YAHOO.widget.AutoComplete.prototype._onItemMouseover=function(A,B){if(B.prehighlightClassName){B._togglePrehighlight(this,"mouseover");}else{B._toggleHighlight(this,"to");}B.itemMouseOverEvent.fire(B,this);};YAHOO.widget.AutoComplete.prototype._onItemMouseout=function(A,B){if(B.prehighlightClassName){B._togglePrehighlight(this,"mouseout");}else{B._toggleHighlight(this,"from");}B.itemMouseOutEvent.fire(B,this);};YAHOO.widget.AutoComplete.prototype._onItemMouseclick=function(A,B){B._toggleHighlight(this,"to");B._selectItem(this);};YAHOO.widget.AutoComplete.prototype._onContainerMouseover=function(A,B){B._bOverContainer=true;};YAHOO.widget.AutoComplete.prototype._onContainerMouseout=function(A,B){B._bOverContainer=false;if(B._oCurItem){B._toggleHighlight(B._oCurItem,"to");}};YAHOO.widget.AutoComplete.prototype._onContainerScroll=function(A,B){B._elTextbox.focus();};YAHOO.widget.AutoComplete.prototype._onContainerResize=function(A,B){B._toggleContainerHelpers(B._bContainerOpen);};YAHOO.widget.AutoComplete.prototype._onTextboxKeyDown=function(A,B){var C=A.keyCode;switch(C){case 9:if((navigator.userAgent.toLowerCase().indexOf("mac")==-1)){if(B._oCurItem){if(B.delimChar&&(B._nKeyCode!=C)){if(B._bContainerOpen){YAHOO.util.Event.stopEvent(A);}}B._selectItem(B._oCurItem);}else{B._toggleContainer(false);}}break;case 13:if((navigator.userAgent.toLowerCase().indexOf("mac")==-1)){if(B._oCurItem){if(B._nKeyCode!=C){if(B._bContainerOpen){YAHOO.util.Event.stopEvent(A);}}B._selectItem(B._oCurItem);}else{B._toggleContainer(false);}}break;case 27:B._toggleContainer(false);return ;case 39:B._jumpSelection();break;case 38:YAHOO.util.Event.stopEvent(A);B._moveSelection(C);break;case 40:YAHOO.util.Event.stopEvent(A);B._moveSelection(C);break;default:break;}};YAHOO.widget.AutoComplete.prototype._onTextboxKeyPress=function(A,B){var C=A.keyCode;if((navigator.userAgent.toLowerCase().indexOf("mac")!=-1)){switch(C){case 9:if(B._oCurItem){if(B.delimChar&&(B._nKeyCode!=C)){if(B._bContainerOpen){YAHOO.util.Event.stopEvent(A);}}B._selectItem(B._oCurItem);}else{B._toggleContainer(false);}break;case 13:if(B._oCurItem){if(B._nKeyCode!=C){if(B._bContainerOpen){YAHOO.util.Event.stopEvent(A);}}B._selectItem(B._oCurItem);}else{B._toggleContainer(false);}break;default:break;}}else{if(C==229){B._queryInterval=setInterval(function(){B._onIMEDetected(B);},500);}}};YAHOO.widget.AutoComplete.prototype._onTextboxKeyUp=function(B,D){D._initProps();var E=B.keyCode;D._nKeyCode=E;var C=this.value;if(D._isIgnoreKey(E)||(C.toLowerCase()==D._sCurQuery)){return ;}else{D._bItemSelected=false;YAHOO.util.Dom.removeClass(D._oCurItem,D.highlightClassName);D._oCurItem=null;D.textboxKeyEvent.fire(D,E);}if(D.queryDelay>0){var A=setTimeout(function(){D._sendQuery(C);},(D.queryDelay*1000));if(D._nDelayID!=-1){clearTimeout(D._nDelayID);}D._nDelayID=A;}else{D._sendQuery(C);}};YAHOO.widget.AutoComplete.prototype._onTextboxFocus=function(A,B){B._elTextbox.setAttribute("autocomplete","off");B._bFocused=true;if(!B._bItemSelected){B.textboxFocusEvent.fire(B);}};YAHOO.widget.AutoComplete.prototype._onTextboxBlur=function(A,B){if(!B._bOverContainer||(B._nKeyCode==9)){if(!B._bItemSelected){var C=B._textMatchesOption();if(!B._bContainerOpen||(B._bContainerOpen&&(C===null))){if(B.forceSelection){B._clearSelection();}else{B.unmatchedItemSelectEvent.fire(B);}}else{if(B.forceSelection){B._selectItem(C);}}}if(B._bContainerOpen){B._toggleContainer(false);}B._cancelIntervalDetection(B);B._bFocused=false;B.textboxBlurEvent.fire(B);}};YAHOO.widget.AutoComplete.prototype._onWindowUnload=function(A,B){if(B&&B._elTextbox&&B.allowBrowserAutocomplete){B._elTextbox.setAttribute("autocomplete","on");}};YAHOO.widget.DataSource=function(){};YAHOO.widget.DataSource.ERROR_DATANULL="Response data was null";YAHOO.widget.DataSource.ERROR_DATAPARSE="Response data could not be parsed";YAHOO.widget.DataSource.prototype.maxCacheEntries=15;YAHOO.widget.DataSource.prototype.queryMatchContains=false;YAHOO.widget.DataSource.prototype.queryMatchSubset=false;YAHOO.widget.DataSource.prototype.queryMatchCase=false;YAHOO.widget.DataSource.prototype.toString=function(){return"DataSource "+this._sName;};YAHOO.widget.DataSource.prototype.getResults=function(A,D,B){var C=this._doQueryCache(A,D,B);if(C.length===0){this.queryEvent.fire(this,B,D);this.doQuery(A,D,B);}};YAHOO.widget.DataSource.prototype.doQuery=function(A,C,B){};YAHOO.widget.DataSource.prototype.flushCache=function(){if(this._aCache){this._aCache=[];}if(this._aCacheHelper){this._aCacheHelper=[]; }this.cacheFlushEvent.fire(this);};YAHOO.widget.DataSource.prototype.queryEvent=null;YAHOO.widget.DataSource.prototype.cacheQueryEvent=null;YAHOO.widget.DataSource.prototype.getResultsEvent=null;YAHOO.widget.DataSource.prototype.getCachedResultsEvent=null;YAHOO.widget.DataSource.prototype.dataErrorEvent=null;YAHOO.widget.DataSource.prototype.cacheFlushEvent=null;YAHOO.widget.DataSource._nIndex=0;YAHOO.widget.DataSource.prototype._sName=null;YAHOO.widget.DataSource.prototype._aCache=null;YAHOO.widget.DataSource.prototype._init=function(){var A=this.maxCacheEntries;if(!YAHOO.lang.isNumber(A)||(A<0)){A=0;}if(A>0&&!this._aCache){this._aCache=[];}this._sName="instance"+YAHOO.widget.DataSource._nIndex;YAHOO.widget.DataSource._nIndex++;this.queryEvent=new YAHOO.util.CustomEvent("query",this);this.cacheQueryEvent=new YAHOO.util.CustomEvent("cacheQuery",this);this.getResultsEvent=new YAHOO.util.CustomEvent("getResults",this);this.getCachedResultsEvent=new YAHOO.util.CustomEvent("getCachedResults",this);this.dataErrorEvent=new YAHOO.util.CustomEvent("dataError",this);this.cacheFlushEvent=new YAHOO.util.CustomEvent("cacheFlush",this);};YAHOO.widget.DataSource.prototype._addCacheElem=function(B){var A=this._aCache;if(!A||!B||!B.query||!B.results){return ;}if(A.length>=this.maxCacheEntries){A.shift();}A.push(B);};YAHOO.widget.DataSource.prototype._doQueryCache=function(A,I,N){var H=[];var G=false;var J=this._aCache;var F=(J)?J.length:0;var K=this.queryMatchContains;var D;if((this.maxCacheEntries>0)&&J&&(F>0)){this.cacheQueryEvent.fire(this,N,I);if(!this.queryMatchCase){D=I;I=I.toLowerCase();}for(var P=F-1;P>=0;P--){var E=J[P];var B=E.results;var C=(!this.queryMatchCase)?encodeURIComponent(E.query).toLowerCase():encodeURIComponent(E.query);if(C==I){G=true;H=B;if(P!=F-1){J.splice(P,1);this._addCacheElem(E);}break;}else{if(this.queryMatchSubset){for(var O=I.length-1;O>=0;O--){var R=I.substr(0,O);if(C==R){G=true;for(var M=B.length-1;M>=0;M--){var Q=B[M];var L=(this.queryMatchCase)?encodeURIComponent(Q[0]).indexOf(I):encodeURIComponent(Q[0]).toLowerCase().indexOf(I);if((!K&&(L===0))||(K&&(L>-1))){H.unshift(Q);}}E={};E.query=I;E.results=H;this._addCacheElem(E);break;}}if(G){break;}}}}if(G){this.getCachedResultsEvent.fire(this,N,D,H);A(D,H,N);}}return H;};YAHOO.widget.DS_XHR=function(C,A,D){if(D&&(D.constructor==Object)){for(var B in D){this[B]=D[B];}}if(!YAHOO.lang.isArray(A)||!YAHOO.lang.isString(C)){return ;}this.schema=A;this.scriptURI=C;this._init();};YAHOO.widget.DS_XHR.prototype=new YAHOO.widget.DataSource();YAHOO.widget.DS_XHR.TYPE_JSON=0;YAHOO.widget.DS_XHR.TYPE_XML=1;YAHOO.widget.DS_XHR.TYPE_FLAT=2;YAHOO.widget.DS_XHR.ERROR_DATAXHR="XHR response failed";YAHOO.widget.DS_XHR.prototype.connMgr=YAHOO.util.Connect;YAHOO.widget.DS_XHR.prototype.connTimeout=0;YAHOO.widget.DS_XHR.prototype.scriptURI=null;YAHOO.widget.DS_XHR.prototype.scriptQueryParam="query";YAHOO.widget.DS_XHR.prototype.scriptQueryAppend="";YAHOO.widget.DS_XHR.prototype.responseType=YAHOO.widget.DS_XHR.TYPE_JSON;YAHOO.widget.DS_XHR.prototype.responseStripAfter="\n0){D+="&"+this.scriptQueryAppend;}var C=null;var F=this;var I=function(K){if(!F._oConn||(K.tId!=F._oConn.tId)){F.dataErrorEvent.fire(F,B,G,YAHOO.widget.DataSource.ERROR_DATANULL);return ;}for(var N in K){}if(!J){K=K.responseText;}else{K=K.responseXML;}if(K===null){F.dataErrorEvent.fire(F,B,G,YAHOO.widget.DataSource.ERROR_DATANULL);return ;}var M=F.parseResponse(G,K,B);var L={};L.query=decodeURIComponent(G);L.results=M;if(M===null){F.dataErrorEvent.fire(F,B,G,YAHOO.widget.DataSource.ERROR_DATAPARSE);M=[];}else{F.getResultsEvent.fire(F,B,G,M);F._addCacheElem(L);}E(G,M,B);};var A=function(K){F.dataErrorEvent.fire(F,B,G,YAHOO.widget.DS_XHR.ERROR_DATAXHR);return ;};var H={success:I,failure:A};if(YAHOO.lang.isNumber(this.connTimeout)&&(this.connTimeout>0)){H.timeout=this.connTimeout;}if(this._oConn){this.connMgr.abort(this._oConn);}F._oConn=this.connMgr.asyncRequest("GET",D,H,null);};YAHOO.widget.DS_XHR.prototype.parseResponse=function(sQuery,oResponse,oParent){var aSchema=this.schema;var aResults=[];var bError=false;var nEnd=((this.responseStripAfter!=="")&&(oResponse.indexOf))?oResponse.indexOf(this.responseStripAfter):-1;if(nEnd!=-1){oResponse=oResponse.substring(0,nEnd);}switch(this.responseType){case YAHOO.widget.DS_XHR.TYPE_JSON:var jsonList,jsonObjParsed;if(YAHOO.lang.JSON){jsonObjParsed=YAHOO.lang.JSON.parse(oResponse);if(!jsonObjParsed){bError=true;break;}else{try{jsonList=eval("jsonObjParsed."+aSchema[0]);}catch(e){bError=true;break;}}}else{if(oResponse.parseJSON){jsonObjParsed=oResponse.parseJSON();if(!jsonObjParsed){bError=true;}else{try{jsonList=eval("jsonObjParsed."+aSchema[0]);}catch(e){bError=true;break;}}}else{if(window.JSON){jsonObjParsed=JSON.parse(oResponse);if(!jsonObjParsed){bError=true;break;}else{try{jsonList=eval("jsonObjParsed."+aSchema[0]);}catch(e){bError=true;break;}}}else{try{while(oResponse.substring(0,1)==" "){oResponse=oResponse.substring(1,oResponse.length);}if(oResponse.indexOf("{")<0){bError=true;break;}if(oResponse.indexOf("{}")===0){break;}var jsonObjRaw=eval("("+oResponse+")");if(!jsonObjRaw){bError=true;break;}jsonList=eval("(jsonObjRaw."+aSchema[0]+")");}catch(e){bError=true;break;}}}}if(!jsonList){bError=true;break;}if(!YAHOO.lang.isArray(jsonList)){jsonList=[jsonList];}for(var i=jsonList.length-1;i>=0;i--){var aResultItem=[];var jsonResult=jsonList[i];for(var j=aSchema.length-1;j>=1;j--){var dataFieldValue=jsonResult[aSchema[j]];if(!dataFieldValue){dataFieldValue="";}aResultItem.unshift(dataFieldValue);}if(aResultItem.length==1){aResultItem.push(jsonResult);}aResults.unshift(aResultItem);}break;case YAHOO.widget.DS_XHR.TYPE_XML:var xmlList=oResponse.getElementsByTagName(aSchema[0]);if(!xmlList){bError=true;break;}for(var k=xmlList.length-1;k>=0;k--){var result=xmlList.item(k); var aFieldSet=[];for(var m=aSchema.length-1;m>=1;m--){var sValue=null;var xmlAttr=result.attributes.getNamedItem(aSchema[m]);if(xmlAttr){sValue=xmlAttr.value;}else{var xmlNode=result.getElementsByTagName(aSchema[m]);if(xmlNode&&xmlNode.item(0)&&xmlNode.item(0).firstChild){sValue=xmlNode.item(0).firstChild.nodeValue;}else{sValue="";}}aFieldSet.unshift(sValue);}aResults.unshift(aFieldSet);}break;case YAHOO.widget.DS_XHR.TYPE_FLAT:if(oResponse.length>0){var newLength=oResponse.length-aSchema[0].length;if(oResponse.substr(newLength)==aSchema[0]){oResponse=oResponse.substr(0,newLength);}if(oResponse.length>0){var aRecords=oResponse.split(aSchema[0]);for(var n=aRecords.length-1;n>=0;n--){if(aRecords[n].length>0){aResults[n]=aRecords[n].split(aSchema[1]);}}}}break;default:break;}sQuery=null;oResponse=null;oParent=null;if(bError){return null;}else{return aResults;}};YAHOO.widget.DS_XHR.prototype._oConn=null;YAHOO.widget.DS_ScriptNode=function(D,A,C){if(C&&(C.constructor==Object)){for(var B in C){this[B]=C[B];}}if(!YAHOO.lang.isArray(A)||!YAHOO.lang.isString(D)){return ;}this.schema=A;this.scriptURI=D;this._init();};YAHOO.widget.DS_ScriptNode.prototype=new YAHOO.widget.DataSource();YAHOO.widget.DS_ScriptNode.prototype.getUtility=YAHOO.util.Get;YAHOO.widget.DS_ScriptNode.prototype.scriptURI=null;YAHOO.widget.DS_ScriptNode.prototype.scriptQueryParam="query";YAHOO.widget.DS_ScriptNode.prototype.asyncMode="allowAll";YAHOO.widget.DS_ScriptNode.prototype.scriptCallbackParam="callback";YAHOO.widget.DS_ScriptNode.callbacks=[];YAHOO.widget.DS_ScriptNode._nId=0;YAHOO.widget.DS_ScriptNode._nPending=0;YAHOO.widget.DS_ScriptNode.prototype.doQuery=function(A,F,C){var B=this;if(YAHOO.widget.DS_ScriptNode._nPending===0){YAHOO.widget.DS_ScriptNode.callbacks=[];YAHOO.widget.DS_ScriptNode._nId=0;}var E=YAHOO.widget.DS_ScriptNode._nId;YAHOO.widget.DS_ScriptNode._nId++;YAHOO.widget.DS_ScriptNode.callbacks[E]=function(G){if((B.asyncMode!=="ignoreStaleResponses")||(E===YAHOO.widget.DS_ScriptNode.callbacks.length-1)){B.handleResponse(G,A,F,C);}else{}delete YAHOO.widget.DS_ScriptNode.callbacks[E];};YAHOO.widget.DS_ScriptNode._nPending++;var D=this.scriptURI+"&"+this.scriptQueryParam+"="+F+"&"+this.scriptCallbackParam+"=YAHOO.widget.DS_ScriptNode.callbacks["+E+"]";this.getUtility.script(D,{autopurge:true,onsuccess:YAHOO.widget.DS_ScriptNode._bumpPendingDown,onfail:YAHOO.widget.DS_ScriptNode._bumpPendingDown});};YAHOO.widget.DS_ScriptNode.prototype.handleResponse=function(oResponse,oCallbackFn,sQuery,oParent){var aSchema=this.schema;var aResults=[];var bError=false;var jsonList,jsonObjParsed;try{jsonList=eval("(oResponse."+aSchema[0]+")");}catch(e){bError=true;}if(!jsonList){bError=true;jsonList=[];}else{if(!YAHOO.lang.isArray(jsonList)){jsonList=[jsonList];}}for(var i=jsonList.length-1;i>=0;i--){var aResultItem=[];var jsonResult=jsonList[i];for(var j=aSchema.length-1;j>=1;j--){var dataFieldValue=jsonResult[aSchema[j]];if(!dataFieldValue){dataFieldValue="";}aResultItem.unshift(dataFieldValue);}if(aResultItem.length==1){aResultItem.push(jsonResult);}aResults.unshift(aResultItem);}if(bError){aResults=null;}if(aResults===null){this.dataErrorEvent.fire(this,oParent,sQuery,YAHOO.widget.DataSource.ERROR_DATAPARSE);aResults=[];}else{var resultObj={};resultObj.query=decodeURIComponent(sQuery);resultObj.results=aResults;this._addCacheElem(resultObj);this.getResultsEvent.fire(this,oParent,sQuery,aResults);}oCallbackFn(sQuery,aResults,oParent);};YAHOO.widget.DS_ScriptNode._bumpPendingDown=function(){YAHOO.widget.DS_ScriptNode._nPending--;};YAHOO.widget.DS_JSFunction=function(A,C){if(C&&(C.constructor==Object)){for(var B in C){this[B]=C[B];}}if(!YAHOO.lang.isFunction(A)){return ;}else{this.dataFunction=A;this._init();}};YAHOO.widget.DS_JSFunction.prototype=new YAHOO.widget.DataSource();YAHOO.widget.DS_JSFunction.prototype.dataFunction=null;YAHOO.widget.DS_JSFunction.prototype.doQuery=function(C,F,D){var B=this.dataFunction;var E=[];E=B(F);if(E===null){this.dataErrorEvent.fire(this,D,F,YAHOO.widget.DataSource.ERROR_DATANULL);return ;}var A={};A.query=decodeURIComponent(F);A.results=E;this._addCacheElem(A);this.getResultsEvent.fire(this,D,F,E);C(F,E,D);return ;};YAHOO.widget.DS_JSArray=function(A,C){if(C&&(C.constructor==Object)){for(var B in C){this[B]=C[B];}}if(!YAHOO.lang.isArray(A)){return ;}else{this.data=A;this._init();}};YAHOO.widget.DS_JSArray.prototype=new YAHOO.widget.DataSource();YAHOO.widget.DS_JSArray.prototype.data=null;YAHOO.widget.DS_JSArray.prototype.doQuery=function(E,I,A){var F;var C=this.data;var J=[];var D=false;var B=this.queryMatchContains;if(I){if(!this.queryMatchCase){I=I.toLowerCase();}for(F=C.length-1;F>=0;F--){var H=[];if(YAHOO.lang.isString(C[F])){H[0]=C[F];}else{if(YAHOO.lang.isArray(C[F])){H=C[F];}}if(YAHOO.lang.isString(H[0])){var G=(this.queryMatchCase)?encodeURIComponent(H[0]).indexOf(I):encodeURIComponent(H[0]).toLowerCase().indexOf(I);if((!B&&(G===0))||(B&&(G>-1))){J.unshift(H);}}}}else{for(F=C.length-1;F>=0;F--){if(YAHOO.lang.isString(C[F])){J.unshift([C[F]]);}else{if(YAHOO.lang.isArray(C[F])){J.unshift(C[F]);}}}}this.getResultsEvent.fire(this,A,I,J);E(I,J,A);};YAHOO.register("autocomplete",YAHOO.widget.AutoComplete,{version:"2.5.2",build:"1076"}); /** * this files creates the base namespace for all core starwood * code -"sw". In addtion, shortcuts are created into the YAHOO.util for ease of coding. * @author Danlan */ if(YAHOO.util){ /** * create shortcuts into YAHOO lib, allows for easer coding/readability. * some of the shortcuts: yuiDom, yuiEvent, yuiAnim, yuiEasing... * Same as var yuiDom = YAHOO.util.Dom; */ for(var prop in YAHOO.util){ window["yui"+ prop] = YAHOO.util[prop]; } if(YAHOO.lang.JSON){ yuiJSON = YAHOO.lang.JSON; } // workaround for yui bug introduced in 2.4.0 causing onDOMReady to fire prematurely in iframe for IE // bug tracker request id: 2008289 if(yuiEvent){ try { document.createElement("p").doScroll("left"); // only get here if (IS IE and IS IFRAME) - it may be possible that another condition gets here, but that's ok yuiEvent.onDOMReady = function( p_fn , p_obj , p_scope ){ yuiEvent.addListener( window , "load" , p_fn , p_obj , p_scope); } } catch (err) { // all other conditions throw an error, which is good. } } // end workaround } /** * create the base "sw" namespace for all core starwood code. */ var SW = YAHOO.namespace("SW"); YAHOO.namespace("SW.tools"); // general utility objects and methods YAHOO.namespace("SW.customEvent"); // custom event models YAHOO.namespace("SW.widget"); // larger components YAHOO.namespace("SW.domWidget"); // built in dom scrubbing to gain hooks widgets YAHOO.namespace("SW.flash"); // adaptors for Flash. When Flash needs to call JS, it uses this namespace. Local flash code should prefix component name with brand (ie SW.flash.SPGTour) YAHOO.namespace("SW.local"); // namespace for any non-common code. All brand/page specific code resides here /** * extensions to core JavaScript objects: Function, Array... */ /** * Class method for copying psuedo-arrays to *real* arrays, such * as function arguments and dom node collections (ie, document.getElementsByTagName("div")) * @param {Object} original array * @return {Array} new *real* array */ Array.Copy = function(original){ var i,result = []; for(i=0;i"+ food.name +" ("+ food.type +")"; }); */ Array.prototype.map = function(fn, thisObj) { var scope = thisObj || window; var a = []; for ( var i=0, j=this.length; i < j; ++i){ a.push(fn.call(scope, this[i], i, this)); } return a; } } if(!Array.filter){ // create a new array of filtered results /* example: var myArray = [ {name:'apple',type:'fruit'}, {name:'steak',type:'meat'}, {name:'pear',type:'fruit'} ]; // returns true var fruits = myArray.map(function(food){ return (food.type == "fruit"); }); */ Array.prototype.filter = function(fn, thisObj) { var scope = thisObj || window; var a = []; for ( var i=0, j=this.length; i < j; ++i){ if(!fn.call(scope, this[i], i, this)){ continue; } a.push(this[i]); } return a; } } if(!Array.indexOf){ // returns index of specified element (-1 if not found) Array.prototype.indexOf = function(el, start) { var start = start || 0; for ( var i=start, j=this.length; i < j; ++i){ if(this[i] === el){ return i; } } return -1; } } if(!Array.lastIndexOf){ // returns the last index of specified element (-1 if not found) Array.prototype.lastIndexOf = function(el, start) { var start = start || this.length; if(start >= this.length){ start = this.length; } if(start < 0){ start = this.length + start; } for ( var i=start; i >= 0; --i){ if(this[i] === el){ return i; } } return -1; } } // more useful array methods if(!Array.splice){ Array.prototype.splice = function (iIndex , iLength ) { var i,aResult = new Array(); var aRemoved = new Array(); for (i=0; i < iIndex; i++){ aResult.push(this[i]); } for (i=iIndex; i < iIndex+iLength; i++) { aRemoved.push(this[i]); } if (arguments.length > 2) { for (i=2; i < arguments.length; i++) { aResult.push(arguments[i]); } } for (i=iIndex+iLength; i < this.length; i++) { aResult.push(this[i]); } for (i=0; i < aResult.length; i++) { this[i] = aResult[i]; } this.length = aResult.length; return aRemoved; } } if(!Array.remove){ Array.prototype.remove = function (vItem ) { this.removeAt(this.indexOf(vItem)); return vItem; } } if(!Array.removeAt){ Array.prototype.removeAt = function (iIndex ) { var vItem = this[iIndex]; if (vItem) { this.splice(iIndex, 1); } return vItem; } } /** * The utilities.js file provides additional functions, many built on top of yahoo * @module starwood utilities * @requires yahoo-dom-event */ // can be used in place of window.onload or yuiEvent.addListener(window,"load",...). // In theory, this fires when the closing body tag is drawn (before window.onload). // used to add or change value of parameter in url // var url = SW.tools.setUrlParamter(document.location.href,"propID",mySelect.value); SW.tools.setUrlParameter = function(url,param,val){ var curPairs; var hashString = ""; if(url.indexOf("#") > -1){ hashString = url.substr(url.indexOf("#")+1); url = url.substring(0,url.indexOf("#")); } var allPairs = []; var urlParts = url.split('?'); if(urlParts.length>1){ curPairs = urlParts[1].split('&'); curPairs.forEach(function(paramPair){ var paramParts = paramPair.split('='); if(paramParts[0] != param){ allPairs.push(paramParts[0] + '=' + (typeof paramParts[1] != "undefined" ? paramParts[1]:'') ); } }); } allPairs.push(param + '=' + val); return urlParts[0] + '?' + allPairs.join('&') + (hashString ? "#"+hashString:""); } /** * add to img tags which are using [semi]transparent png's to fix IE6 issue * This is only way to avoid *ALL* IE6 issues! (including browser freezing/locking up) * sample: * * @param img */ SW.tools.iePNGLoader = function(img){ if (navigator.userAgent.indexOf("MSIE") > -1 && parseInt(navigator.appVersion) <= 6) { var pSrc = img.src; img.onload = null; img.src = "/common/images/shim.gif"; img.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, src='" + pSrc + "')"; } } // used in conjunction with secure json calls // new yuiConnect( secureJsonUrl("/path/to/myData.jsp?someID=45") ); SW.tools.secureJsonUrl = function(url){ return SW.tools.setUrlParameter(url,"_jsk",SW.Cookie.get("JSESSIONID")); } // Begin Code from YUI: Colorpicker var HCHARS="0123456789ABCDEF"; /** * Converts decimal rgb values into a hex string * 255,255,255 -> FFFFFF * @method rgb2hex * @param r {int|[int, int, int]} the red value, or an * array containing all three parameters * @param g {int} the green value * @param b {int} the blue value * @return {string} the hex string */ SW.tools.rgb2hex = function(r, g, b) { var f=this.dec2hex; return f(r) + f(g) + f(b); }; /** * Converts an int 0...255 to hex pair 00...FF * @method dec2hex * @param n {int} the number to convert * @return {string} the hex equivalent */ SW.tools.dec2hex = function(n) { n = parseInt(n, 10); n = (n > 255 || n < 0) ? 0 : n; return HCHARS.charAt((n - n % 16) / 16) + HCHARS.charAt(n % 16); }; // End code from YUI: Colorpicker /* ### set cookie ### --> set basic session cookie SW.tools.Cookie.set("sid","somevalue"); --> set permanent cookie SW.tools.Cookie.set("sid","somevalue","NEVER"); --> set cookie to expire sometime in the future var exDate = new Date(); expires.setMonth(expires.getMonth()+1); SW.tools.Cookie.set("sid","somevalue",expires); ### get cookie ### --> get value of cookie SW.tools.Cookie.get("sid"); ### remove cookie ### --> remove cookie SW.tools.Cookie.remove("sid"); */ SW.tools.Cookie = { values:[], loaded:false, set:function(name, value, expires, path, domain, secure){ var cookieValue = new Array(); cookieValue.push(name + "=" + escape(value)); if(typeof expires != "undefined"){ if(typeof expires == "string"){ if(expires.toUpperCase() == "NEVER"){ expires = new Date(); expires.setFullYear(expires.getFullYear()+10); }else if(expires.toUpperCase() == "REMOVE"){ expires = new Date(); expires.setFullYear(expires.getFullYear()-1); } } cookieValue.push("expires=" + expires.toGMTString()); } if(typeof path == "undefined"){ path = "/"; } cookieValue.push("path="+ path); if(typeof domain != "undefined"){ cookieValue.push("domain=" + domain); } if(secure){ cookieValue.push("secure"); } document.cookie = cookieValue.join("; "); SW.tools.Cookie.loaded = false; }, get:function(name){ if (!SW.tools.Cookie.loaded) { SW.tools.Cookie._readCookie(); }; for (var i=0; i. * These settinsg will only apply to the "customToolTip". * @See SW.domWidget.toolTips.settings * @param {Object} className * @param {Object} classSettings */ addClassSettings:function(className,classSettings){ classSettings.triggerClassName = className; this.addSettings(classSettings,"class",className); }, /** * id based settings can be useful for specific placement of toolTip for a * single element (ie, when the toolTip might display over a select box) * @See SW.domWidget.toolTips.settings * @param {Object} id * @param {Object} idSettings */ addIdSettings:function(id,idSettings){ this.addSettings(idSettings,"id",id); }, /** * internal function for adding settings. * @param {Object} settings * @param {Object} type * @param {Object} id */ addSettings:function(settings,type,id){ var curSettings,setting; switch(type){ case "global": curSettings = this.settings; break; case "class": curSettings = this.classSettings[id] = {}; break; case "id": curSettings = this.idSettings[id] = {}; break; } if(curSettings && settings){ for(setting in settings){ curSettings[setting] = settings[setting]; } } }, /** * internal method to lookup a specific setting * @param {Object} config * @param {Object} setting */ getSetting:function(config,setting){ if(config.idSettings && typeof config.idSettings[setting] != "undefined"){ return config.idSettings[setting]; } if(config.classSettings && typeof config.classSettings[setting] != "undefined"){ return config.classSettings[setting]; } return this.settings[setting]; }, load:function(){ this.getElements(); }, update:function(root){ this.getElements(root); }, /** * find the tool tips * @param {Object} root */ getElements:function(root){ var self = this; var el,config,className,id; root = root || document; for(id in this.idSettings){ el = yuiDom.get(id); if(el){ config = { idSettings:this.idSettings[id] }; for(className in this.classSettings){ if(yuiDom.hasClass(el,className)){ config.classSettings = this.classSettings[className]; break; } } self.setup(el); } } for(className in this.classSettings){ config = { classSettings:this.classSettings[className] }; yuiDom.getElementsByClassName(className,self.getSetting(config,"triggerTagName"),root).forEach(function(element){ self.setup(element); }); } config = {}; yuiDom.getElementsByClassName(self.getSetting(config,"triggerClassName"),self.getSetting(config,"triggerTagName"),root).forEach(function(element){ self.setup(element); }); }, /** * initialize single tool tip * @param {Object} trigger */ setup:function(trigger){ var classSettings = null,idSettings = null; var tip,tipImage,closeButton; var animIn,animOut; var self = this; var primaryElements = []; if(!this.getConfig(trigger)){ // tip = yuiDom.getElementsByClassName("toolTip",null,trigger)[0]; closeButton = yuiDom.getElementsByClassName("toolTipClose",null,trigger)[0]; if(trigger.id && this.idSettings[trigger.id]){ idSettings = this.idSettings[trigger.id]; } for(var prop in this.classSettings){ if(yuiDom.hasClass(trigger,prop)){ classSettings = this.classSettings[prop]; break; } } /** * config object is attached to all import elements using this.setConfig(); * this contains all pertinent information about this instance. */ var config = { trigger:trigger, tip:null, tipImage:tipImage, isShowing:false, isOver:false, showTimeout:null, hideTimeout:null, classSettings:classSettings, idSettings:idSettings, x:0, y:0 }; tip = yuiDom.getElementsByClassName(self.getSetting(config,"tipClassName"),self.getSetting(config,"tipTagName"),trigger)[0]; config.tip = tip; if(this.getSetting(config,"appendTipToBody")){ document.body.appendChild(tip); } animIn = new yuiAnim(tip,this.getSetting(config,"showAttributes"),this.getSetting(config,"showDuration"),this.getSetting(config,"showTransition")); animIn.onStart.subscribe(function(){ self.getSetting(config,"showOnStart")(config); yuiDom.addClass(config.tip,"toolTipShowing"); }); animIn.onComplete.subscribe(function(){ self.getSetting(config,"showOnComplete")(config); }); animOut = new yuiAnim(tip,this.getSetting(config,"hideAttributes"),this.getSetting(config,"hideDuration"),this.getSetting(config,"hideTransition")); animOut.onStart.subscribe(function(){ self.getSetting(config,"hideOnStart")(config); }); animOut.onComplete.subscribe(function(){ self.getSetting(config,"hideOnComplete")(config); yuiDom.removeClass(config.tip,"toolTipShowing"); }); config.animIn = animIn; config.animOut = animOut; primaryElements.push(trigger); primaryElements.push(tip); if(closeButton){ primaryElements.push(closeButton); } this.setConfig(primaryElements,config); // in future allow config to set mouseover or click for showing yuiEvent.addListener(trigger,"mouseover",this.bridge.setShow); yuiEvent.addListener(trigger,"mouseout",this.bridge.setHide); yuiEvent.addListener(tip,"mouseover",this.bridge.clearHide); yuiEvent.addListener(tip,"mouseout",this.bridge.setHide); // should the following line be config based? this prevents onlcicks from triggering on parent nodes if(this.getSetting(config,"stopEventOnClick")){ yuiEvent.addListener(tip,"click",this.bridge.stopEvent); } if(closeButton){ yuiEvent.addListener(closeButton,"click",this.bridge.hideNow); } } }, /** * main internal methods to show and hide tool tips (using timeouts) */ show:function(config){ if(yuiDom.hasClass(config.tip,"toolTipShowing")){ return; } if(config.isOver && !config.isShowing){ config.isShowing = true; config.animIn.animate(); } }, hide:function(config){ config.isShowing = false; config.animOut.animate(); }, setShow:function(config){ var self = this; config.isOver = true; this.clearHide(config); if(!config.isShowing){ config.showTimeout = setTimeout(function(){ self.show(config); },this.getSetting(config,"showDelay")*1000); } }, setHide:function(config){ var self = this; config.isOver = false; if(!config.hideTimeout && config.isShowing){ clearTimeout(config.showTimeout); config.showTimeout = null; config.hideTimeout = setTimeout(function(){ self.hide(config); },this.getSetting(config,"hideDelay")*1000); } }, clearHide:function(config){ if(config.hideTimeout){ clearTimeout(config.hideTimeout); config.hideTimeout = null; } }, hideNow:function(config){ this.hide(config); }, /** * bridging methods to seperate event handlers from main methods */ bridge:{ setShow:function(e){ var self = SW.domWidget.toolTips; var config = self.getConfig(this); if(!config.isShowing){ self.getSetting(config,"setPosition")(config,e); } self.setShow(config); }, setHide:function(e){ var self = SW.domWidget.toolTips; var config = self.getConfig(this); self.setHide(config); }, clearHide:function(e){ var self = SW.domWidget.toolTips; var config = self.getConfig(this); self.clearHide(config); }, hideNow:function(e){ var self = SW.domWidget.toolTips; var config = self.getConfig(this); self.hideNow(config); yuiEvent.stopEvent(e); }, stopEvent:function(e){ yuiEvent.stopEvent(e); } } }); /** * handles onchange of select box where the option values are urls. * add a class of "urlSelect" to the select box. * @namespace SW.domWidget.urlSelect */ SW.domWidget.add({ id:"urlSelect", initialize:function(){ }, load:function(){ this.setup(); }, update:function(root){ this.setup(root); }, setup:function(root){ var self = this; yuiDom.getElementsByClassName("urlSelect","select",root).forEach(function(selectBox){ self.setupSelect(selectBox); }); }, setupSelect:function(selectBox){ var config; if(!this.getConfig(selectBox)){ config = { input:selectBox } this.setConfig(selectBox,config); yuiEvent.addListener(selectBox,"change",this.selectUrlBridge); } }, selectUrl:function(config){ if(config.input.value){ document.location.href = config.input.value; } }, /** * bridging method * @param {Object} e */ selectUrlBridge:function(e){ SW.domWidget.urlSelect.selectUrl(SW.domWidget.urlSelect.getConfig(this)); } }); SW.domWidget.add({ id:"dhtmlSelect", container:null, trigger:null, load:function(){ this.setup(); }, update:function(root){ this.setup(root); }, setup:function(root){ var self = this; yuiDom.getElementsByClassName("dhtmlSelect","div",root).forEach(function(container){ if(!self.getConfig(container)){ var config = { container:container, trigger:yuiDom.getElementsByClassName("dhtmlSelectTrigger",null,container)[0] }; self.setConfig([config.trigger,config.container],config); yuiEvent.addListener(config.trigger,"click",self.showBridge); SW.domWidget.bodyClickHandler.add(self.hideBridge,[config.container],config.trigger); } }); }, show:function(config){ yuiDom.addClass(config.container,"show"); }, hide:function(config){ yuiDom.removeClass(config.container,"show"); }, showBridge:function(e){ var self = SW.domWidget.dhtmlSelect; var config = self.getConfig(this); self.show(config); }, hideBridge:function(e){ var self = SW.domWidget.dhtmlSelect; var config = self.getConfig(this); self.hide(config); } }); /** * single handler for detecting body.onclick. Conditionally fires supplied method * if the cick did not originate within one of the supplied test elements. * Example usage: dhtml drop-down, when a click outside the drop-down is detected, the close method * would be called. * @namespace SW.domWidget.bodyClickHandler */ SW.domWidget.add({ id:"bodyClickHandler", initialized:false, handlers:[], load:function(){ yuiEvent.addListener(document.body,"click",this.clickBridge); }, /** * add a new handler * @param {Object} method - the method to be called, the event object will be passed as the only parameter to this method. * @param {Array} testElements - an array of container elements. If click originates inside one of these, the method will not be invoked. * @param {Object} context - Optional, supplies context for the method (the "this" object, defaults to window) */ add:function(method,testElements,context){ context = context || window; this.handlers.push({ method:method, context:context, testElements:testElements }); }, click:function(e){ var clickedElement = yuiEvent.getTarget(e); this.handlers.forEach(function(args){ var isContained = false; for(var i=0;i 1) { for (i = 0; i < self.errors.length; i++) { if (self.errors[i].errorCode.charAt(0) == "~") { self.errors[i].errorCode = null; } } self.errors[self.errors.length] = new error(errorCode); } } } function handleDisplay(_obj, reset) { if (_obj != null) { if (_obj.charAt(0) == "~") { _obj = _obj.substring(1); } if (_obj.charAt(0) == "!") { reset = !reset; _obj = _obj.substring(1); } var obj = document.getElementById(_obj); if (obj) { if (obj.tagName == "LABEL") { obj.className = reset ? "" : "error"; } else { obj.style.display = reset ? "none" : ""; } } } } function display(obj, state) { if (document.getElementById(obj)) { document.getElementById(obj).style.display = state; } } function validDate(_field) { var field; var d; var getDate = true; field = _field; _s = field.value; _d = getDateFromField(field, dateFormatString); this.valid = true; // safari will not return true for isNaN check even when the date is initialized with day = dd, month = mm, and year = yyyy if (isNaN(_d.getDate() ) || (field.value.toLowerCase() == dateFormatString.toLowerCase()) ) { // Basically, this allows the functions to gracefully return to the format string instead of putting a date in the field. this.valid = false; } this.d = _d; var xxxdgetY = function() { var y = (self.d.getYear() + 10000) % 100; y += (y < 38) ? 2000 : 1900; return y } this.setField = function() { writeDateToField(field, this.d, dateFormatString); } this.setD = function(_d) {self.d = _d} this.nextDay = function() {return this.d.setDate(self.d.getDate()+1);} this.diffDate = function(dd) { return Math.round( (makeDate(dd).getTime() - makeDate(self.d).getTime()) / (1000*60*60*24) ); } function makeDate(md) { return new Date( fixYear(md.getYear()), md.getMonth(), md.getDate() ); } function lZero(nr) {if (nr < 10) nr = "0" + nr;return nr;} var self = this; return this; } function fixYear(_y) { var y = (_y + 10000) % 100; y += (y < 38) ? 2000 : 1900; return y } function isValidEmail(field) { if (field != null && field != ''){ field = stripCharsInBag (field, ' ') var regexp = /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/; return (field.search(regexp) != -1); } } function doesUserNameContainHyphen(field) { var regExp = /-/; return (field.search(regExp) != -1) } function isValidZip(field, country){ if (field != '' && field != null && country != '' && country != null){ if (country == 'US'){ var regExp = /(^\d{5}$)|(^\d{5}-\d{4}$)/; return (field.search(regExp) != -1) } else if (country == 'CA'){ v = stripCharsInBag(field, "- "); var regexp = /^[A-Va-v]|[X,Y,x,y]\d[A-Za-z]\d[A-Za-z]\d$/; return (v.length == 6 && !hasChars(v,'D', 'F', 'I', 'O', 'Q', 'U') && v.search(regexp) != -1) } } } function isUSCanZip(zip,country){ if (zip != '' && zip != null) return (country == 'US' || country == 'CA'); } function isValidPhone(phone,country){ if (phone != null && phone != '' && country != null && country !=''){ return (country == 'US' && isUSPhoneNumber (phone)) || (country != 'US' && isInternationalPhoneNumber (phone)); } return true; } function isValidName(field){ var regExp = /[0-9]/; if (field != null && field != '') return (field.search(regExp) != -1); } function isUSPhoneNumber(s){ var phoneNumberDelimiters = "+.,()-xX# "; var digitsInUSPhoneNumber = 15; // allow 10 digits + 1- prefix (i.e +1 digit) + extension # (i.e +4 digits) var minDigitsInUSPhoneNumber = 10; s1 = stripCharsInBag(s, phoneNumberDelimiters); return (isInteger(s1) && (s1.length <= digitsInUSPhoneNumber && s1.length >= minDigitsInUSPhoneNumber)); } function isInternationalPhoneNumber(s){ var phoneNumberDelimiters = "+.,()-xX# "; s1 = stripCharsInBag(s, phoneNumberDelimiters); return (isInteger(s1)); } function isValidSPGNum(field) { if (field != null && field != ''){ // one optional letter + any number of digits + zero or more whitespace chars at the beginning and at the end var re = /^\s*[A-Za-z0-9]\d+\s*$/; if (field != null && field != ''){ return (field.search(re) != -1); } } } function parseDate(_s) { try { d = Date.parse(_s); return d; } catch(err) { var dateArray = _s.split("/"); var tempMonth = parseInt(dateArray[0],10); var tempDay = parseInt(dateArray[1],10); var tempYear = parseInt(dateArray[2],10); d = new Date(tempYear,(tempMonth-1),tempDay); return d; } } //-------------------------------------------------------- //Get the Date from a form field - Based on Internationalization Variables //-------------------------------------------------------- function getDateFromField(formField, dateFormat) { // formField is a reference to a text field // dateFormat is a string describing the local date format // Current options for dateFormat: // mm/dd/yyyy - English // dd/mm/yyyy - Non-English, Non-Japanese // yyyy/mm/dd - Japanese, Chinese // dd.mm.yyyy - German var date = new Date(); // Default the date to today ready to be overwritten. var currDate = new Date(); // Today's date and time for comparison's sake. dateFormat = dateFormat.toLowerCase(); var fieldString; var hasSlashOrDash = false; if (typeof formField == "object") { fieldString= formField.value; } // Get the current value of the field else { fieldString = formField; } // We were passed a direct value if (fieldString.search("/") > 0) { // check if we have / to delimit var dateValues = fieldString.split("/"); hasSlashOrDash = true; } else if (fieldString.search("-") > 0) { // They used - instead of / var dateValues = fieldString.split("-"); hasSlashOrDash = true; } else if (fieldString.indexOf(".") >= 0) { // They used . instead of / var dateValues = fieldString.split("."); }else if (fieldString != "") { // Assume there are no delimiters, assume one number var dateValues = new Array(fieldString); } else if (fieldString == "") { // If there's not data there, assume it was deleted, and throw back a validDate object compatible invalid date. date.setTime(Date.parse(dateFormatString)); return date; } if (fieldString.toLowerCase() == dateFormatString) { date.setTime(Date.parse(fieldString)); return date; } var year; var month; var day; switch(dateFormat) { case 'mm/dd/yyyy': if (dateValues[0]) month = dateValues[0]; if (dateValues[1]) day = dateValues[1]; if (dateValues[2]) year = dateValues[2]; break; case 'dd/mm/aaaa': case 'jj/mm/aaaa': case 'gg/mm/aaaa': case 'tt.mm.jjjj': if (dateValues[0]) day = dateValues[0]; if (dateValues[1]) month = dateValues[1]; if (dateValues[2]) year = dateValues[2]; break; case 'yyyy/mm/dd': if (dateValues[0]) year = dateValues[0]; if (dateValues[1]) month = dateValues[1]; if (dateValues[2]) day = dateValues[2]; break; case 'yyyy/dd/mm': if (dateValues[0]) year = dateValues[0]; if (dateValues[1]) day = dateValues[1]; if (dateValues[2]) month = dateValues[2]; break; case 'dd.mm.yyyy': if (dateValues[0]) day = dateValues[0]; if (dateValues[1]) month = dateValues[1]; if (dateValues[2]) year = dateValues[2]; break; case "yy\u5E74mm\u6708dd\u65E5": if(!hasSlashOrDash) { //dateValues = fieldString.split(" "); year = fieldString.substr(0,2); month = fieldString.substr(3,2); day = fieldString.substr(6,2); } else { if (dateValues[0]) year = dateValues[0]; if (dateValues[1]) month = dateValues[1]; if (dateValues[2]) day = dateValues[2]; } break; default: // Default to mm/dd/yyyy if (dateValues[0]) month = dateValues[0]; if (dateValues[1]) day = dateValues[1]; if (dateValues[2]) year = dateValues[2]; break; } if (year) { if (year.length == 2) { year = "20" + year; } // Try to make the year 4 digits if (year.length == 4) { // If it's not 4 digits, just fall back to using the current year date.setFullYear(year); } } date.setDate(1); if (month) date.setMonth(month - 1); // setMonth uses a zero-based number if (day) date.setDate(day); if (date.getTime() < currDate.getTime()) date.setYear(currDate.getFullYear() + 1); // For dates in the past, set to next year. // safari will not return true for isNaN check even when the date is initialized with day = dd, month = mm, and year = yyyy if(isNaN(month)&&isNaN(day)&&isNaN(year)) { if(!isNaN(date.getDate())) { date = { getDate: function() { return NaN; } } } } writeDateToField(formField, date, dateFormat); return date; } //-------------------------------------------------------- //Write the date to a form field - Based on Internationalization Variables //-------------------------------------------------------- function writeDateToField(formField, date, dateFormat) { // prevent "undefined" string from showing var dateString = ""; if (isNaN(date.getDate())) { formField.value = dateString; return; } dateFormat = dateFormat.toLowerCase(); var month = date.getMonth() + 1; month = paddZero(month); var day = date.getDate(); day = paddZero(day); var year = date.getFullYear(); var sep = "/"; var dot = "."; switch(dateFormat) { case 'mm/dd/yyyy': dateString = month + sep + day + sep + year; break; case 'dd/mm/aaaa': case 'jj/mm/aaaa': case 'gg/mm/aaaa': dateString = day + sep + month + sep + year; break; case 'tt.mm.jjjj': dateString = day + dot + month + dot + year; break; case 'yyyy/mm/dd': dateString = year + sep + month + sep + day; break; case 'yyyy/dd/mm': dateString = year + sep + day + sep + month; break; case "yy\u5E74mm\u6708dd\u65E5": dateString = String(year).substr(2,2) + "\u5E74" + month + "\u6708" + day + "\u65E5"; break; default: // Default to mm/dd/yyyy dateString = month + sep + day + sep + year; break; } formField.value = dateString; } //----------------------------------------------- // padd a zero if string is one char function paddZero(s) { if(s >= 0 && s <= 9){ s = '0' + s; } return s; } //------------------------------------------------------ /** * SWFObject v1.5: Flash Player detection and embed - http://blog.deconcept.com/swfobject/ * * SWFObject is (c) 2007 Geoff Stearns and is released under the MIT License: * http://www.opensource.org/licenses/mit-license.php * */ if(typeof deconcept=="undefined"){var deconcept=new Object();}if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a){if(!document.getElementById){return;}this.DETECT_KEY=_a?_a:"detectflash";this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params=new Object();this.variables=new Object();this.attributes=new Array();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 deconcept.PlayerVersion(_5.toString().split(".")));}this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(!window.opera&&document.all&&this.installedVer.major>7){deconcept.SWFObject.doPrepUnload=true;}if(c){this.addParam("bgcolor",c);}var q=_7?_7:"high";this.addParam("quality",q);this.setAttribute("useExpressInstall",false);this.setAttribute("doExpressInstall",false);var _c=(_8)?_8:window.location;this.setAttribute("xiRedirectUrl",_c);this.setAttribute("redirectUrl","");if(_9){this.setAttribute("redirectUrl",_9);}};deconcept.SWFObject.prototype={useExpressInstall:function(_d){this.xiSWFPath=!_d?"expressinstall.swf":_d;this.setAttribute("useExpressInstall",true);},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;},getVariablePairs:function(){var _16=new Array();var key;var _18=this.getVariables();for(key in _18){_16[_16.length]=key+"="+_18[key];}return _16;},getSWFHTML:function(){var _19="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");this.setAttribute("swf",this.xiSWFPath);}_19="0){_19+="flashvars=\""+_1c+"\"";}_19+="/>";}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");this.setAttribute("swf",this.xiSWFPath);}_19="";_19+="";var _1d=this.getParams();for(var key in _1d){_19+="";}var _1f=this.getVariablePairs().join("&");if(_1f.length>0){_19+="";}_19+="";}return _19;}, /* modified version that allows using document.write if no value is passed in. This has been created to avoid "operation aborted" errors in IE. */ write:function(_20) { if (this.getAttribute("useExpressInstall")) { var _21 = new deconcept.PlayerVersion([6,0,65]); if (this.installedVer.versionIsValid(_21) && !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); } } if (this.skipDetect || this.getAttribute("doExpressInstall") || this.installedVer.versionIsValid(this.getAttribute("version"))) { if(typeof _20 == "undefined"){ document.write(this.getSWFHTML()); }else{ var n = (typeof _20 == "string") ? document.getElementById(_20) : _20; n.innerHTML = this.getSWFHTML(); } return true; } else { if (this.getAttribute("redirectUrl") != "") { document.location.replace(this.getAttribute("redirectUrl")); } } return false; }}; deconcept.SWFObjectUtil.getPlayerVersion=function(){var _23=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var x=navigator.plugins["Shockwave Flash"];if(x&&x.description){_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}}else{if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){var axo=1;var _26=3;while(axo){try{_26++;axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+_26);_23=new deconcept.PlayerVersion([_26,0,0]);}catch(e){axo=null;}}}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");_23=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}catch(e){if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}catch(e){}}if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}}return _23;};deconcept.PlayerVersion=function(_29){this.major=_29[0]!=null?parseInt(_29[0]):0;this.minor=_29[1]!=null?parseInt(_29[1]):0;this.rev=_29[2]!=null?parseInt(_29[2]):0;};deconcept.PlayerVersion.prototype.versionIsValid=function(fv){if(this.majorfv.major){return true;}if(this.minorfv.minor){return true;}if(this.rev=0;i--){_2f[i].style.display="none";for(var x in _2f[i]){if(typeof _2f[i][x]=="function"){_2f[i][x]=function(){};}}}};if(deconcept.SWFObject.doPrepUnload){if(!deconcept.unloadSet){deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs);};window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet=true;}}if(!document.getElementById&&document.all){document.getElementById=function(id){return document.all[id];};}var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject; // System globals var flash2Installed = false; // boolean. true if flash 2 is installed var flash3Installed = false; // boolean. true if flash 3 is installed var flash4Installed = false; // boolean. true if flash 4 is installed var flash5Installed = false; // boolean. true if flash 5 is installed var flash6Installed = false; // boolean. true if flash 6 is installed var flash7Installed = false; // boolean. true if flash 7 is installed var flash8Installed = false; // boolean. true if flash 8 is installed var flash9Installed = false; // boolean. true if flash 9 is installed var flash10Installed = false; // boolean. true if flash 10 is installed var flash11Installed = false; // boolean. true if flash 11 is installed var flash12Installed = false; // boolean. true if flash 12 is installed // Vars for Backwards compatibiliy var flagVar = ""; var flashTrue = ""; var maxVersion = 12; // highest version we can actually detect var actualVersion = 0; // version the user really has var jsVersion = 1.1; // Check the browser...we're looking for ie/win var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false; // true if we're on ie var isWin = (navigator.appVersion.indexOf("Windows") != -1) ? true : false; // true if we're on windows // Write vbscript detection on ie win. IE on Windows doesn't support regular // JavaScript plugins array detection. if (isIE && isWin) { document.write(' \n'); document.write('on error resume next \n'); document.write('flash2Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.2"))) \n'); document.write('flash3Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.3"))) \n'); document.write('flash4Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.4"))) \n'); document.write('flash5Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.5"))) \n'); document.write('flash6Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.6"))) \n'); document.write('flash7Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.7"))) \n'); document.write('flash8Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.8"))) \n'); document.write('flash9Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.9"))) \n'); document.write('flash10Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.10"))) \n'); document.write('flash11Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.11"))) \n'); document.write('flash12Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.12"))) \n'); document.write(' \n'); // break up end tag so it doesn't end our script } // Next comes the standard javascript detection that uses the // navigator.plugins array. We pack the detector into a function so it loads // before we run it. function flashSniff() { // If navigator.plugins exists... if (navigator.plugins) { // ...then check for flash 2 or flash 3+. if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) { // Some version of Flash was found. Time to figure out which. // Set convenient references to flash 2 and the plugin description. var isVersion2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : ""; var flashDescription = navigator.plugins["Shockwave Flash" + isVersion2].description; // DEBUGGING: uncomment next line to see the actual description. // alert("Flash plugin description: " + flashDescription); // A flash plugin-description looks like this: Shockwave Flash 4.0 r5 // We can get the major version by grabbing the character before the period // note that we don't bother with minor version detection. // Do that in your movie with $version or getVersion(). var flashVersion = parseInt(/[0-9]{1,}./.exec(flashDescription)); // We found the version, now set appropriate version flags. Make sure // to use >= on the highest version so we don't prevent future version // users from entering the site. flash2Installed = flashVersion == 2; flash3Installed = flashVersion == 3; flash4Installed = flashVersion == 4; flash5Installed = flashVersion == 5; flash6Installed = flashVersion == 6; flash7Installed = flashVersion == 7; flash8Installed = flashVersion == 8; flash9Installed = flashVersion == 9; flash10Installed = flashVersion == 10; flash11Installed = flashVersion == 11; flash12Installed = flashVersion >= 12; } } // Loop through all versions we're checking, and // set actualVersion to highest detected version. for (var i = 2; i <= maxVersion; i++) { if (eval("flash" + i + "Installed") == true) actualVersion = i; } // Vars for backwards support if (i > 0) { flagVar = true; flashTrue = true; } // We're finished getting the version on all browsers that support detection. return actualVersion; } function setNonFlashUser(url) { document.cookie = 'isNonFlashUser=true; path=/'; location.replace(url + "?type=nonflash"); } function addLoadEvent(func) { var ssArray = ""; var oldonload = window.onload; if (typeof window.onload != 'function') { window.onload = func; } else { window.onload = function() { oldonload(); func(); } } } function addResizeEvent(func) { var oldresize = window.onresize; if (typeof window.onresize != 'function') { window.onresize= func; } else { window.onresize = function() { oldresize(); func(); } } } //Function that takes element ID and pixel offset and changes height of elment. function e(id) { return document.getElementById(id); } function autoResizeElement(id,bottomOffset) { var topOffset = 0; for (var elem = document.getElementById(id); elem != null; elem = elem.offsetParent) { topOffset += elem.offsetTop; } var windowHeight = getViewportHeight(); var height = windowHeight - topOffset - bottomOffset; if (height >= 0) { document.getElementById(id).style.height = height + "px"; } } function getViewportHeight() { if (window.self && self.innerHeight) { return self.innerHeight; } if (document.documentElement && document.documentElement.clientHeight) { return document.documentElement.clientHeight; } return 0; } function getViewportWidth() { if (window.self && self.innerWidth) { return self.innerWidth; } if ( (document.documentElement && document.documentElement.clientWidth) || (document.body && document.body.clientWidth) ) { if(document.documentElement.clientWidth > 0) { return document.documentElement.clientWidth; } else if (document.body.clientWidth > 0) { return document.body.clientWidth } } return 0; } function getDocumentHeight() { if (document.body && document.body.offsetHeight) { return document.body.offsetHeight; } if (document.body.document && document.body.document.height) { return document.body.document.height; } return 0; } function getDocumentWidth() { if (document.body && document.body.offsetWidth) { return document.body.offsetWidth; } if (document.body.document && document.body.document.width) { return document.body.document.width; } return 0; } // Function that takes a String URL and sets the parent's location to the URL function goToPage(obj) { if (obj.value != null && obj.value != "void" && obj.value != "") { parent.location =obj.value; } } // Generic pop up window function the window features are passed from the parent page function openBrWindow(theURL,winName,features) { var winObj = window.open(theURL,winName,features); if (!winObj.opener) winObj.opener = self; winObj.focus(); } // Function that takes in a name, reads that name from a cookie, and returns the value of that name. function readCookie(name) { var cookies = document.cookie; var start = cookies.indexOf(name + "="); if (start == -1) return null; start = cookies.indexOf("=", start) + 1; var end = cookies.indexOf(";", start); if (end == -1) end = cookies.length; var value = unescape(cookies.substring(start, end)); return value; } // Function that takes a name/value pair and sets them to a cookie /* name - name of the cookie value - value of the cookie [expires] - expiration date of the cookie in days (defaults to end of current session) [path] - path for which the cookie is valid (defaults to path of calling document) [secure] - Boolean value indicating if the cookie transmission requires a secure transmission [domain] - domain for which the cookie is valid (defaults to domain of calling document) * an argument defaults when it is assigned null as a placeholder * a null placeholder is not required for trailing omitted arguments */ function setCookie(name, value, expires, path, secure, domain) { var today = new Date(); today.setTime(today.getTime()); if (expires) { expires = expires * 1000 * 60 * 60 * 24; } var expires_date = new Date( today.getTime() + (expires) ); var curCookie = name + "=" + escape(value) + (( expires ) ? "; expires=" + expires_date.toGMTString() : "") + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : ""); document.cookie = curCookie; } // Function that deletes a cookie /* name - name of the cookie [path] - path of the cookie (must be same as path used to create cookie) [domain] - domain of the cookie (must be same as domain used to create cookie) * path and domain default if assigned null or omitted if no explicit argument proceeds */ function deleteCookie(name, path, domain) { if (readCookie(name)) { document.cookie = name + "=" + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + "; expires=Thu, 01-Jan-70 00:00:01 GMT"; } } // Function to switch current display of id between "block" and "none" function switchDisplay(elementID, swapType) { var element = document.getElementById(elementID); if (swapType == 'show'){ element.style.display = 'block'; } else { element.style.display = 'none'; } } // Function to toggle an elements display // elementID is the name of the element you want to toggle. // currentDisplay is a boolean that's passed in and represents the elements current display type. function toggleDisplay(elementID, currentDisplay) { var element = document.getElementById(elementID); if (currentDisplay){ element.style.display = "none"; currentDisplay = false; } else { element.style.display = "block"; currentDisplay = true; } return currentDisplay; } var currentClass; function classSwitcher(el,stateClass) { var element = (typeof el == "object") ? el : document.getElementById(el); if(currentClass==undefined || currentClass==stateClass) currentClass = element.className; if(element.className == currentClass || element.className == "") { element.className = stateClass; } else { element.className = currentClass; } } // Function to determine if a field is null function isNull(fieldValue) { if (fieldValue == null) {fieldValue=''}; return (fieldValue.length == 0); } // Function to determine if two fields match each other function isMatch(field1,field2) { if ((field1 != null && field1 != '') && ( field2 != null && field2 != '')) return (field1 == field2); } // Function to parse the querystring into useable variables var parsequery_args = new Object(); function parsequery(qs) { if (qs.length > 2) { var query = qs.substring(1); // get query string (without initial "?") var pairs = query.split("&") //break at ampersand into pairs var re = /\+/g; //the unescape() function does not remove + for (var i = 0; i < pairs.length; i++) { var pos = pairs[i].indexOf('='); //look for "name=value" if (pos == -1) continue; //if not found skip var argname = pairs[i].substring(0,pos); //extract the name var value = pairs[i].substring(pos + 1); //extract the value parsequery_args[argname] = unescape(value.replace(re," ")); //store as a property } } } // Function that takes a string (s) and 1 character (bag) to strip from the string. // the function returns the string without the 1 character (bag) in it. function stripCharsInBag (s, bag){ var i; var returnString = ""; for (i = 0; i < s.length; i++) { var c = s.charAt(i); if (bag.indexOf(c) == -1) returnString += c; } return returnString; } // Function that gives you the screen x and screen y, even after the user has scrolled var scrOfX = 0, scrOfY = 0; function getScrollXY() { if( typeof( window.pageYOffset ) == 'number' ) { //Netscape compliant scrOfY = window.pageYOffset; scrOfX = window.pageXOffset; } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) { //DOM compliant scrOfY = document.body.scrollTop; scrOfX = document.body.scrollLeft; } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) { //IE6 standards compliant mode scrOfY = document.documentElement.scrollTop; scrOfX = document.documentElement.scrollLeft; } return [ scrOfX, scrOfY ]; } // Fixes the IE background-image hover bug try { document.execCommand( "BackgroundImageCache", false, true ); } catch( e ) { }; /** * Selects all checkboxes under the given parent node. Set deep to true * to recursively set. * * @param {Node} parentNode node under which checkboxes can be found * @param {boolean} checked true to set checkboxes, false to clear (Default: true) * @param {boolean} deep true to recursively set children deeper than one level (Default: true) */ function setCheckboxes(parentNode, checked, deep) { if(parentNode == null) return; // defaults checked = (checked == null) ? true : checked; deep = (deep == null) ? true : deep; // loop through and select boxes for(var i=0; i < parentNode.childNodes.length; i++) { var node = parentNode.childNodes[i]; if(deep) { // recursively set deeper child nodes if(node.hasChildNodes()) { setCheckboxes(node, checked, deep); } } // set checkbox if(node.nodeType == 1 && node.getAttribute("type") == "checkbox") { node.checked = checked; } } } /** * Asynchronously fills a select dropdown with properties given a list of * property IDs via an XHR call. * * @param {String} propSelect select element containing property list * @param {String} propIds comma delimited list of property ids to populate with * @param {String} selectedPropId optional id of pre-selected property when the list is built * @param {function} onFailure optional reference to a failure callback function * @param {function} onSuccess optional reference to a success callback function */ function fillPropertySelect(propSelect, propIds, selectedPropId, onFailure, onSuccess) { // clear current select options while(propSelect.hasChildNodes()) { propSelect.removeChild(propSelect.childNodes[0]); } // remove spaces between properties in property list propIds = propIds.replace(/,\s+/g, ','); var url = "/whotels/property/propertyInfoAjax.html?propertyIDs=" + propIds; var callback = { success: _fillPropertySelectSuccess, failure: onFailure, argument: {'propSelect':propSelect, 'selectedPropId':selectedPropId, 'onSuccess':onSuccess} } // make the call var request = YAHOO.util.Connect.asyncRequest('GET', url, callback); } // success handler for fillPropertySelect XHR call function _fillPropertySelectSuccess(o) { var i,j; // get prop select element var propSelect = o.argument['propSelect']; if(propSelect == null) return; // get selected property id var selectedPropId = o.argument['selectedPropId']; // process response var propMap = eval(o.responseText)['data']; var propIds = propMap['propIds']; var propNames = propMap['propNames']; // sort alphabetically by property names var sortedPropNames = new Array(); for(i=0; i prop name mappings sorted by name for(i=0; i2) { local = local.split("_")[0]; } var theDateObject = null; var theDateArray = theDate.split("/"); if (local == "ja" || local=="zh") { // FORMAT: YYYY/MM/DD theDateArray = theDate.split(" "); //theDateObject = new Date(theDateArray[0].substr(0,4), theDateArray[1].substr(0,2)-1, theDateArray[2].substr(0,2)); theDateObject = new Date("20"+theDate.substr(0,2), theDate.substr(3,2)-1, theDate.substr(6,2)); } else if ((local == "es") || (local == "fr") || (local == "it")) { // FORMAT: DD/MM/YYYY theDateObject = new Date(theDateArray[2], theDateArray[1]-1, theDateArray[0]); } else if (local == "de") { theDateArray = theDate.split("."); theDateObject = new Date(theDateArray[2], theDateArray[1]-1, theDateArray[0]); } else { // FORMAT: MM/DD/YYYY theDateObject = new Date(theDateArray[2], theDateArray[0]-1, theDateArray[1]); } //alert("theDateObject: " + theDateObject); if ((theDateObject == "Invalid Date") || (isNaN(theDateObject))) { theDateObject = null; } return theDateObject; } /* This function is necessary because as of now the multiDisplayCalendar.js needs an empty form to process the curent dates */ function fnClearFormField(pDate) { if ((pDate == "MM/DD/YYYY") || (pDate == "DD/MM/AAAA") || (pDate == "JJ/MM/AAAA") ||(pDate == "GG/MM/AAAA") || (pDate == "TT.MM.JJJJ") || (pDate="YY\u5E74MM\u6708DD\u65E5")) { pDate = ""; } return pDate; } function fnGetDisplayDate(pDateToFormat){ var lsFormatDate = null; if(pDateToFormat){ var loDate = new Date(pDateToFormat); //var lsYear = loDate.getFullYear().toString().substring(2,4); var lsYear = loDate.getFullYear(); var lsMonth = moLanguageObj.calendarShortMonthArray[loDate.getMonth()] lsFormatDate = loDate.getDate() + ' ' + lsMonth + ' ' + lsYear; } return lsFormatDate; } function padZero(pNumber) { return (pNumber<0 || pNumber>9 ? "" : "0") + pNumber; } function fnGetDateDifference(pCIDay, pCODay){ var loStartDate = new Date(pCIDay); var loEndDate = new Date(pCODay); var lnDayDiff = Math.round((loEndDate.getTime() - loStartDate.getTime()) / (1000 * 60 * 60 * 24)); return Math.abs(lnDayDiff); } var varbookNowOpen = false; var varshowRoomOpts = false; var varshowCorpOptions = false; var varShowSearch = false; function checkFlashContainer(newWidth) { if (document.getElementById("flashContainer")) { document.getElementById("flashContainer").style.width = newWidth + "px"; } } function resizeBookingModule(newWidth) { if (document.getElementById("bookNowMod")) { document.getElementById("bookNowMod").style.width = newWidth + "px"; positionDivIframe("bookNowMod", "bookNowModIframe", 1); } } function showRoomOpts() { if (varshowRoomOpts) { var tempVar = (varshowCorpOptions); hideAll(); if (tempVar) { showCorpOptions(); } else { checkFlashContainer(771); } return false; } if (varshowCorpOptions) { showBothOpts(); } else { hideAll(); resizeBookingModule(376); checkFlashContainer(564); } document.getElementById("roomOptionsExpand").className = "expand"; document.getElementById("roomOptions").className = "locked"; hideElemnts(); varshowRoomOpts = true; } function showCorpOptions() { if (varshowCorpOptions) { var tempVar = (varshowRoomOpts); hideAll(); if (tempVar) { showRoomOpts() } else { checkFlashContainer(771); } return false; } if (varshowRoomOpts) { showBothOpts() } else { hideAll(); resizeBookingModule(404); checkFlashContainer(536); } document.getElementById("corpOptionExpand").className = "expand"; document.getElementById("corpOptions").className = "locked"; hideElemnts(); varshowCorpOptions = true; } function showBothOpts() { resizeBookingModule(595); checkFlashContainer(345); } function positionDivIframe(divId, iframeId, displayFlag) { var popUpDiv = document.getElementById(divId); var popUpIframe = document.getElementById(iframeId); if (popUpDiv && popUpIframe && document.documentElement.currentStyle) { if (displayFlag) { popUpIframe.style.width = popUpDiv.offsetWidth; popUpIframe.style.height = popUpDiv.offsetHeight; popUpIframe.style.zIndex = popUpDiv.currentStyle["zIndex"] - 1; popUpIframe.style.display = "block"; } else { popUpIframe.className = 'hiddenIframe'; } } } function hideElemnts() { document.getElementById("btnFindRates").style.display = "none"; //document.getElementById("checkRes").style.display = "none"; document.getElementById("btnExapnd").className = ""; } function showSearch() { var tempVar = false; if (varShowSearch) { tempVar = true; } hideAll(); if (tempVar) { return false; } document.getElementById("bookNowMod").style.width = "366px"; document.getElementById("moreSearchExpand").className = "expand"; document.getElementById("searchMore").className = "locked"; checkFlashContainer(574); varShowSearch = true; } function hideAll() { resizeBookingModule(169); document.getElementById("roomOptionsExpand").className = "hide"; document.getElementById("corpOptionExpand").className = "hide"; document.getElementById("moreSearchExpand").className = "hide"; document.getElementById("btnExapnd").className = "hide"; document.getElementById("btnFindRates").style.display = "block"; //document.getElementById("checkRes").style.display = "block"; document.getElementById("roomOptions").className = ""; document.getElementById("corpOptions").className = ""; if (document.getElementById("searchMore")) { document.getElementById("searchMore").className = ""; } varshowRoomOpts = false; varshowCorpOptions = false; varShowSearch = false; checkFlashContainer(940); } function showBookNow() { var bookingModule = document.getElementById("bookNowMod"); if (varbookNowOpen) { positionDivIframe("bookNowMod", "bookNowModIframe", 0); bookingModule.style.height = "1px"; bookingModule.style.visibility = "hidden"; hideAll(); varbookNowOpen = false; } else { checkFlashContainer(771); bookingModule.style.height = "410px"; bookingModule.style.visibility = "visible"; positionDivIframe("bookNowMod", "bookNowModIframe", 1); varbookNowOpen = true; } } function hideBookNow() { varbookNowOpen = true; showBookNow(); } var hoverMenuManager = new Array(); function showInfo(e, parentElement, divId) { if (!hoverMenuManager[divId]) { var tempDiv = document.getElementById("rsHover_" + divId); document.body.appendChild(tempDiv); hoverMenuManager[divId] = tempDiv; } var infoDiv = hoverMenuManager[divId]; var posX = getElementOffsetLeft(parentElement); var posY = getElementOffsetTop(parentElement); infoDiv.style.display = 'block'; infoDiv.style.left = posX + "px"; infoDiv.style.top = posY - infoDiv.offsetHeight + "px"; } function hideInfo(divId) { hoverMenuManager[divId].style.display = 'none'; } function searchHotels() { document.getElementById("destinationTab").className = ""; document.getElementById("hotelTab").className = "locked"; document.getElementById("selectDestinations").style.display = "none"; document.getElementById("selectHotels").style.display = "block"; document.bookingForm.searchType.value = "property"; document.bookingForm.action = "/whotels/search/results/property_ratelist.html"; } function searchDestinations() { document.getElementById("hotelTab").className = ""; document.getElementById("destinationTab").className = "locked"; document.getElementById("selectHotels").style.display = "none"; document.getElementById("selectDestinations").style.display = "block"; document.bookingForm.searchType.value = "destination"; document.bookingForm.action = "/whotels/search/results/destination.html"; } function toggleBedPreference() { var propertyValue = document.bookingForm.propertyID.value; var destinationValue = ""; if (typeof document.bookingForm.destinationID != "undefined") destinationValue = document.bookingForm.destinationID.value; var bedType = document.bookingForm.bedTypePreference; if (propertyValue == 0 && destinationValue == '') { bedType.selectedIndex = 0; bedType.disabled = true; } else { bedType.disabled = false; } } function validateForm_onSubmit(htmlForm, webFormObj) { var searchFormObj = webFormObj; searchFormObj.form = htmlForm; setErrorMsgDisplay(0); searchFormObj.resetErrors(); dateStatus = booking_checkDates(searchFormObj); numericFieldStatus = checkNumeric(searchFormObj); checkFavoriteSearch(searchFormObj); if (searchFormObj.hasErrors()) { searchFormObj.showErrors(); setErrorMsgDisplay(1); return false; } else { return true; } } function checkFavoriteSearch(searchFormObj) { if (searchFormObj.form.searchType.value == "property") { if (searchFormObj.form.propertyID.value < 1) { searchFormObj.addError("~propertyNotSelectedError_bm"); } } else if (searchFormObj.form.searchType.value == "destination") { if (searchFormObj.form.destinationID.value == '') { searchFormObj.addError("~destinationNotSelectedError_bm"); } } } function setErrorMsgDisplay(displayFlag) { var errorBlock = document.getElementById("errorBlock_booking"); errorBlock.style.display = (displayFlag) ? "block" : "none"; if (document.documentElement.currentStyle) { var errorIframe = document.getElementById("errorBlockIframe"); if (displayFlag) { errorIframe.style.width = parseFloat(errorBlock.currentStyle["width"]) - 10 + 'px'; errorIframe.style.height = parseFloat(errorBlock.clientHeight) - 9 + 'px'; errorIframe.style.top = parseFloat(errorBlock.currentStyle["top"]) + 5 + 'px'; errorIframe.style.left = parseFloat (errorBlock.currentStyle["left"]) + 5 + 'px'; errorIframe.style.margin = errorBlock.currentStyle["margin"]; errorIframe.style.zIndex = errorBlock.currentStyle["zIndex"] - 1; errorIframe.style.display = "block"; } else { errorIframe.style.display = "none"; } } } function booking_checkDates(searchFormObj) { if ((searchFormObj.form.arrivalDate.value == dateFormatString) && (searchFormObj.form.departureDate.value == dateFormatString)) { //return searchFormObj.addError("~datesAreRequiredError_bm","arrivalDateLabel_bm","departureDateLabel_bm"); return true; } var checkIn = new validBookingDate(searchFormObj.form.arrivalDate); var checkOut = new validBookingDate(searchFormObj.form.departureDate); if (!(checkIn.valid) && (!checkOut.valid)) { searchFormObj.addError("~ciAnddepartureDatesInvalidError_bm", "arrivalDateLabel_bm", "departureDateLabel_bm") } else if (!checkIn.valid) { searchFormObj.addError("~arrivalDateInvalidError_bm", "arrivalDateLabel_bm") } else if (!checkOut.valid) { searchFormObj.addError("~departureDateInvalidError_bm", "departureDateLabel_bm") } else if ((checkIn.valid) & (checkOut.valid)) { var datesDelta = checkIn.diffDate(checkOut.d); var nowDelta = checkIn.diffDate(new Date()); if (nowDelta > 0) { searchFormObj.addError("~checkInEarlierThanTodayError_bm", "arrivalDateLabel_bm"); } else if (nowDelta < -561) { searchFormObj.addError("~bookToFarInFutureError_bm", "arrivalDateLabel_bm"); } else if (datesDelta < 0) { searchFormObj.addError("~departureBeforeArrivalError_bm", "departureDateLabel_bm"); } else if (datesDelta > 30) { searchFormObj.addError("~maximumLengthStayExceededError_bm", "arrivalDateLabel_bm", "departureDateLabel_bm"); } else if (datesDelta < 1) { searchFormObj.addError("~arrivalEqualsDepartureError_bm", "arrivalDateLabel_bm", "departureDateLabel_bm"); } } return true; } function checkNumeric(searchFormObj) { var allowedCharacters = "- "; var set =""; var ata =""; var pro = ""; var rate = ""; if(typeof searchFormObj.form.corporateAccountNumber!='undefined') { var set = searchFormObj.form.corporateAccountNumber.value; } if(typeof searchFormObj.form.iataNumber!='undefined') { var ata = searchFormObj.form.iataNumber.value; } if(typeof searchFormObj.form.promotionCode!='undefined') { var pro = searchFormObj.form.promotionCode.value; } if(typeof searchFormObj.form.ratePlanName!='undefined') { var rate = searchFormObj.form.ratePlanName.options[searchFormObj.form.ratePlanName.selectedIndex].value; } // 1. check for errors in the numeric fields : SET and ATA number set = stripCharsInBag(set, allowedCharacters); if (set != '' && !isInt(set)) { searchFormObj.addError("~corporateAccountNumberNotNumericError_bm", "corporateAccountNumberLabel_bm"); } if (ata != '' && !isInt(ata)) { searchFormObj.addError("~iataNotNumericError_bm", "iataNumberLabel_bm"); } // 2. check if both promo code & rate plan are filled if (pro != '' && rate != '') { searchFormObj.addError("~bothPromoRateSetError_bm", "promotionCodeLabel_bm", "ratePlanNameLabel_bm"); } if (set != '' && rate != '') { searchFormObj.addError("~bothSetNumRateSetError_bm", "corporateAccountNumberLabel_bm", "ratePlanNameLabel_bm"); } } var bookingForm = new WebForm(); function validateBookingInfo(form) { if (form.searchType.value == 'property' && (typeof form.destinationID != "undefined")) { form.destinationID.selectedIndex = 0; } else if (form.searchType.value != 'property'){ form.propertyID.selectedIndex = 0; } promoCode_onFocus(); return validateForm_onSubmit(form, bookingForm); } function promoCode_onFocus() { if ((typeof document.bookingForm.promotionCode != "undefined") && defaultPromoText == document.bookingForm.promotionCode.value) { document.bookingForm.promotionCode.value = ''; } } function promoCode_onBlur() { if ((document.bookingForm.promotionCode.value != defaultPromoText) && (document.bookingForm.promotionCode.value == '')) { document.bookingForm.promotionCode.value = defaultPromoText; } } function checkBookingDates(form, event) { formObj = form; if (event.type == "focus") { if (formObj.arrivalDate.hasFocus == "true") { var checkIn = new validDate(formObj.arrivalDate); if (!checkIn.valid) { formObj.arrivalDate.value = ""; } } if (formObj.departureDate.hasFocus == "true") { var checkOut = new validDate(formObj.departureDate); if (!checkOut.valid) { formObj.departureDate.value = ""; } } } if (event.type == "blur") { if (formObj.arrivalDate.hasFocus == "false") { var checkOut = new validBookingDate(formObj.departureDate); var checkIn = new validBookingDate(formObj.arrivalDate); if (checkIn.valid) { checkIn.setField(); if (checkOut.valid) { before = (checkIn.diffDate(checkOut.d) <= 0); } if ((! (checkOut.valid)) || before) { checkOut.setD(checkIn.d); checkOut.nextDay(); checkOut.setField(); } } else { formObj.arrivalDate.value = dateFormatString; } } if (formObj.departureDate.hasFocus == "false") { var checkOut = new validDate(formObj.departureDate); if (checkOut.valid) { checkOut.setField(); } else { formObj.departureDate.value = dateFormatString; } } } } function isInt(s) { var re = /^\d+$/ return (s.search(re) != -1); } //------------------------------- // renamed copy of validDate from WebForm, work around for advance search page funtion overwrite function validBookingDate(_field) { var field; var d; field = _field; _s = field.value; _d = getDateFromField(field, dateFormatString); this.valid = !isNaN(_d.getDate()); this.d = _d; var xxxdgetY = function() { var y = (self.d.getYear() + 10000) % 100; y += (y < 38) ? 2000 : 1900; return y } this.setField = function() { writeDateToField(field, this.d, dateFormatString); } this.setD = function(_d) { self.d = _d } this.nextDay = function() { return this.d.setDate(self.d.getDate() + 1); } this.diffDate = function(dd) { return Math.round((makeDate(dd).getTime() - makeDate(self.d).getTime()) / (1000 * 60 * 60 * 24)); } function makeDate(md) { return new Date(fixYear(md.getYear()), md.getMonth(), md.getDate()); } function lZero(nr) { if (nr < 10) nr = "0" + nr; return nr; } var self = this; return this; } //------------------------------- var brandCode = null; // safari work around function for Date.setDate(); function addDays(daysToAdd,date) { var x = new Date(2000,1,1); var y = new Date(2000,1,1); if(x.setDate(128) > y.valueOf()) { date.setDate(date.getDate()+daysToAdd); return date; } // Safari setDate(uint8) workaround if(daysToAdd < 0) { for(var i= -97; daysToAdd < i; daysToAdd-= i) { date.setDate(date.getDate()+i); } } else { for(var i= 96; daysToAdd > i; daysToAdd-= i) { date.setDate(date.getDate()+i); } } date.setDate(date.getDate()+daysToAdd); return date; } // declare and set module variables var moCalendarManagerCiCo = new CalendarManager(); // Static date constants for today (not overwritten by functions) var mcCalsToDisplay = 2; var mcMaxBookDays = 30; var mcDisplayLimit = 549; var mcToday = new Date(); mcToday = new Date(mcToday.getFullYear(),mcToday.getMonth(),mcToday.getDate()); var mcMaxDisplay = new Date(); // safari fix // mcMaxDisplay = mcMaxDisplay.setDate(mcToday.getDate() + mcDisplayLimit); //today + 549 days = 550 days to display mcMaxDisplay = addDays(mcDisplayLimit, mcMaxDisplay) //today + 549 days = 550 days to display var moMonthDayCountArrayCiCo = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); var moLeftArrow = new Image(); moLeftArrow.src = "/alofthotels/images/calendar/prevDisabled.gif"; var moRightArrow = new Image(); moRightArrow.src = "/alofthotels/images/calendar/next.gif"; var moCloseX = new Image(); moCloseX.src = "/alofthotels/images/calendar/close.gif"; /* set up language object to display the correct strings on the cal for internationalization (can and should be overwritten on calling page) default to english and get populated on the page with the translated strings */ var moLanguageObjCiCo = { calendarErrorArray : [ "For stays longer than 31 nights, please call 866-539-3446.", "You can only book up to 550 days in advance.", "Arrival date cannot be earlier than today.", "Departure date cannot be earlier than arrival date.", "Arrival and departure date cannot be on the same day.", "Please select a check-in and checkout date.", "Please select a checkout date." ], calendarMonthNameArray : ["January","February","March","April","May","June","July","August","September","October","November","December"], calendarShortMonthArray : ["JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"], calendarDayNameArray : ["Su","M","Tu","W","Th","F","Sa"], menuNotSelected : "Not Selected", menuNoLOS : "--", menuTravelDatesTo : "to", menuLOSUnit : "nights", calendarClose : "Close", calendarInstructionLabel : '', calendarInstructionText : "Click your check-in date, and then click on your check-out date.", calendarClear : "Clear Calendar", calendarPrev : "Previous", calendarNext : "Next", menuTravelDates : "Travel Dates:", menuLengthOfStay : "Length of Stay:", calendarContinue : "Continue" }; // function to determine the offsetLeft of an element that is passed in function fnGetOffsetLeftCiCo (pElement) { var lsLeftOffset = pElement.offsetLeft; while ((pElement = pElement.offsetParent) != null){ lsLeftOffset += pElement.offsetLeft; } return lsLeftOffset; } // function to determine the offsetTop of an element that is passed in function fnGetOffsetTopCiCo (pElement) { var lsTopOffset = pElement.offsetTop; while ((pElement = pElement.offsetParent) != null){ lsTopOffset +=pElement.offsetTop; } return lsTopOffset; } var moCalendarObjCiCo = null; function CalendarManager(){ this.calArray = new Array(); } //Calendar Manager method to add a new calendar to the array CalendarManager.prototype.addCalendar = function(pCalendarObj){ this.calArray[pCalendarObj.calendarId] = pCalendarObj; } // Availability Calendar Constructor - takes in an id as a handle, a date string for ci and a date string for co in yyyy-mm-dd format function multiDisplayCalendar(pCalendarId, pCIDate, pCODate, pReturnFunction){ this.isRendered = 0; this.isCreated = 0; if(moCalendarManagerCiCo.calArray[pCalendarId]){ var loCalendarObj = moCalendarManagerCiCo.calArray[pCalendarId]; this.getCIDateFunction = pCIDate; this.getCODateFunction = pCODate; loCalendarObj.ciDateInitial = this.getCIDateFunction(); loCalendarObj.coDateInitial = this.getCODateFunction(); loCalendarObj.initializeObject(); return loCalendarObj; } else{ this.calendarId = pCalendarId; this.returnFunction = pReturnFunction; this.getCIDateFunction = pCIDate; this.getCODateFunction = pCODate; this.calLocation = "bottomRight"; this.ciDateInitial = this.getCIDateFunction(); this.coDateInitial = this.getCODateFunction(); this.ciDate = null; this.coDate = null; this.calStartDate = null; this.selectedLOS = null; this.dateDisplayMode = null; this.display = 'none'; this.calendarDivMonth = new Array(); this.calendarTravelDates = null; this.calendarLengthOfStay = null; this.calendarTravelDates = null; this.calendarLengthOfStay = null; this.errorMessageDiv = null; this.calendarContinue = null; this.calendarPrevious = null; this.calendarPreviousAction = null; this.calendarNext = null; this.calendarNextAction = null; this.hasError = null; this.errorArray = null; this.initializeObject(); this.ciCocalendarIframe = null; this.ciCocalendarContainer = null; moCalendarManagerCiCo.addCalendar(this); } // preload cal images preloadImageBgTop = new Image(); preloadImageBgTop.src = "/alofthotels/images/calendar/bgTop.gif"; preloadImageBgBottom = new Image(); preloadImageBgBottom.src = "/alofthotels/images/calendar/bgBottom.gif"; preloadImageBgCenter = new Image(); preloadImageBgCenter.src = "/alofthotels/images/calendar/bg.gif"; preloadImageBgDate = new Image(); preloadImageBgDate.src = "/alofthotels/images/calendar/dateBg.gif"; preloadImageBgLeft = new Image(); preloadImageBgLeft.src = "/alofthotels/images/global/btn/bgLeft.gif"; preloadImageBgRight = new Image(); preloadImageBgRight.src = "/alofthotels/images/global/btn/bgRight.gif"; } multiDisplayCalendar.prototype.initializeObject = function(){ //this.ciDate = this.formatDateOnImport(this.ciDateInitial); //this.coDate = this.formatDateOnImport(this.coDateInitial); this.ciDateInitial = this.getCIDateFunction(); this.coDateInitial = this.getCODateFunction(); this.ciDate = this.ciDateInitial; this.coDate = this.coDateInitial; this.calStartDate = this.getCalStartDate(); this.dateDisplayMode = this.getDisplayMode(); this.selectedLOS = this.getLengthOfStay(); this.hasError = false; } multiDisplayCalendar.prototype.getCalStartDate = function(){ var loStartDate = (this.ciDate) ? new Date(this.ciDate.getFullYear(),this.ciDate.getMonth(), 1) : new Date(mcToday.getFullYear(), mcToday.getMonth(), 1); //alert("loStartDate: " + loStartDate); return loStartDate; } multiDisplayCalendar.prototype.getDisplayMode = function(){ var lsDisplayMode; if(this.ciDateInitial != null && this.coDateInitial != null){ lsDisplayMode = 2; } else if(this.ciDateInitial != null && this.coDateInitial == null){ lsDisplayMode = 1; } else{ lsDisplayMode = 0; } return lsDisplayMode; } //Availability Calendar method to show and hide the coresponding div multiDisplayCalendar.prototype.toggleDisplay = function(){ this.display = (this.display == 'none') ? 'block' : 'none'; this.ciCocalendarContainer.style.display = this.display; // set the iframe dimensions, needs to be done after the calendar is displayed if(this.display == 'block'){ this.ciCocalendarIframe.width = this.ciCocalendarContainer.offsetWidth; this.ciCocalendarIframe.height = this.ciCocalendarContainer.offsetHeight; this.ciCocalendarIframe.style.zIndex = this.ciCocalendarContainer.style.zIndex - 1; } this.ciCocalendarIframe.style.display = this.display; } //Availability Calendar method to show and hide the coresponding div multiDisplayCalendar.prototype.show = function(pCalendarIcon, calLocation){ this.initializeObject(); if(!this.isCreated) { this.ciCocalendarContainer = this.createFramework(); this.isCreated = 1; } if(!this.isRendered) { this.renderCalDisplay(); this.isRendered = 1; } this.display = 'block'; this.ciCocalendarContainer.style.display = this.display; // set the iframe dimensions, needs to be done after the calendar is displayed if(this.display == 'block'){ this.ciCocalendarIframe.width = this.ciCocalendarContainer.offsetWidth; this.ciCocalendarIframe.height = this.ciCocalendarContainer.offsetHeight; this.ciCocalendarIframe.style.zIndex = this.ciCocalendarContainer.style.zIndex - 1; } this.ciCocalendarIframe.style.display = this.display; if(pCalendarIcon!=undefined) this.setCalendarPosition(pCalendarIcon, calLocation); } //Availability Calendar method to show and hide the coresponding div multiDisplayCalendar.prototype.hide = function(event){ this.display = 'none'; this.ciCocalendarContainer.style.display = this.display; this.ciCocalendarIframe.style.display = this.display; } multiDisplayCalendar.prototype.setCalendarPosition = function(pCalendarIcon, calLocation){ this.calLocation = calLocation; if (this.calLocation == "topLeft") { // display to the top left of the icon this.ciCocalendarContainer.style.top = (fnGetOffsetTopCiCo(pCalendarIcon, this.ciCocalendarContainer) - this.ciCocalendarContainer.offsetHeight) + 'px'; this.ciCocalendarContainer.style.left = (fnGetOffsetLeftCiCo(pCalendarIcon, this.ciCocalendarContainer) - this.ciCocalendarContainer.offsetWidth) + 'px'; } else if (this.calLocation == "topRight") { // display to the top left of the icon this.ciCocalendarContainer.style.top = (fnGetOffsetTopCiCo(pCalendarIcon, this.ciCocalendarContainer) - this.ciCocalendarContainer.offsetHeight) + 'px'; this.ciCocalendarContainer.style.left = fnGetOffsetLeftCiCo(pCalendarIcon, this.ciCocalendarContainer) + 'px'; } else if (this.calLocation == "bottomRight") { // display below and to the right of the icon this.ciCocalendarContainer.style.top = fnGetOffsetTopCiCo(pCalendarIcon, this.ciCocalendarContainer) + 'px'; this.ciCocalendarContainer.style.left = fnGetOffsetLeftCiCo(pCalendarIcon, this.ciCocalendarContainer) + 'px'; } else if (this.calLocation == "bottomLeft") { // display below and to the right of the icon this.ciCocalendarContainer.style.top = fnGetOffsetTopCiCo(pCalendarIcon, this.ciCocalendarContainer) + 'px'; this.ciCocalendarContainer.style.left = (fnGetOffsetLeftCiCo(pCalendarIcon, this.ciCocalendarContainer) - this.ciCocalendarContainer.offsetWidth) + 'px'; } else { // the user tells it where to be placed // expecting a string with x and y seperated by a comma var laUserLocation = this.calLocation.split(","); this.ciCocalendarContainer.style.top = laUserLocation[1] + 'px'; this.ciCocalendarContainer.style.left = laUserLocation[0] + 'px'; } this.ciCocalendarIframe.style.top = this.ciCocalendarContainer.style.top; this.ciCocalendarIframe.style.left = this.ciCocalendarContainer.style.left; } //Availability Calendar method to clear the calendar object, used in "Reset" multiDisplayCalendar.prototype.clearObject = function(){ this.ciDateInitial = ''; this.coDateInitial = ''; this.ciDate = null; this.coDate = null; this.dateDisplayMode = 0; this.selectedLOS = null; this.hasError = null; this.errorArray = null; //this.returnFunction(this.ciDate, this.coDate, false); } multiDisplayCalendar.prototype.createFramework = function(){ var lsText; var loTextNode; //create the iframe to sit behind the layer - workaround for IE and select boxes var loCalenderHolderIframe = document.createElement("iframe"); loCalenderHolderIframe.name = "ciCocalendarHolder_Iframe"; loCalenderHolderIframe.id = "ciCocalendarHolder_Iframe"; loCalenderHolderIframe.width = 0; loCalenderHolderIframe.height = 0; loCalenderHolderIframe.className = "ciCocalendarHolderIframe"; loCalenderHolderIframe.src = "/common/blank.htm"; this.ciCocalendarIframe = loCalenderHolderIframe; document.body.appendChild(this.ciCocalendarIframe); // create main calendar div var loCalenderHolder = document.createElement("div"); loCalenderHolder.style.zIndex = "2000"; loCalenderHolder.className = "ciCocalendarHolder"; loCalenderHolder.id = "ciCocalendarHolder"; document.body.appendChild(loCalenderHolder); // create header div for aloft var headerDiv = document.createElement("div"); headerDiv.id = "ciCoHeaderDiv"; // create close button var loClose = document.createElement("div"); loClose.className = "ciCocloseButton"; var loCloseAction = document.createElement("a"); loCloseAction.href = "javascript:fnCloseCalendarCiCo('" + this.calendarId + "');"; loCloseAction.title = moLanguageObjCiCo.calendarClose; // Aloft Does not need the close text var loCloseActionImg = document.createElement("img"); loCloseActionImg.src = moCloseX.src; loCloseActionImg.border = '0'; loCloseActionImg.alt = moLanguageObjCiCo.calendarClose; loCloseAction.appendChild(loCloseActionImg); loClose.appendChild(loCloseAction); // create instruction header var loInstructions = document.createElement("div"); loInstructions.className = "ciCocalendarInstructions"; var loInstructionLabel = document.createElement("div"); loInstructionLabel.className = "ciCocalendarInstructionsLabel"; lsText = moLanguageObjCiCo.calendarInstructionLabel; loTextNode = document.createTextNode(lsText); loInstructionLabel.appendChild(loTextNode); loInstructions.appendChild(loInstructionLabel); var loInstructionText = document.createElement("div"); lsText = moLanguageObjCiCo.calendarInstructionText; loTextNode = document.createTextNode(lsText); loInstructionText.appendChild(loTextNode); loInstructions.appendChild(loInstructionText); // create error display var loError = document.createElement("div"); loError.className = "ciCocalendarError"; loError.id = "ciCocalendarError"; this.errorMessageDiv = loError; headerDiv.appendChild(loClose); headerDiv.appendChild(loInstructions); headerDiv.appendChild(loError); loCalenderHolder.appendChild(headerDiv); // create the main calendar portion var loCalendarContainer = document.createElement("div"); loCalendarContainer.className = "ciCocalendarOuterContainer"; // Prev button var loPreviousButton = document.createElement("div"); loPreviousButton.className = "ciCocalendarNavigation"; var loPrevActionHolder = document.createElement("div"); loPrevActionHolder.id = "ciCocalendarNavigationPrev"; var loPrevAction = document.createElement("a"); this.calendarPreviousAction = "javascript:fnChangeMonthCiCo('" + this.calendarId + "',-1);"; loPrevAction.className = "ciCocalendarNavigationPrevActive" loPrevAction.href = this.calendarPreviousAction; loPrevAction.title = moLanguageObjCiCo.calendarPrev; this.calendarPrevious = loPrevAction; var loPrevActionImg = document.createElement("img"); loPrevActionImg.src = moLeftArrow.src; loPrevActionImg.border = '0'; loPrevActionImg.alt = moLanguageObjCiCo.calendarPrev; this.calendarPrevImage = loPrevActionImg; loPrevAction.appendChild(loPrevActionImg); loPrevActionHolder.appendChild(loPrevAction); loPreviousButton.appendChild(loPrevActionHolder); //this.calendarPrevious = loPreviousButton; loCalendarContainer.appendChild(loPreviousButton); // container var loCalendarInnerContainer = document.createElement("div"); loCalendarInnerContainer.className = "ciCocalendarInnerContainer"; /* ****************CAL BODY HERE******************* */ // left cal var loLeftCal = document.createElement("div"); loLeftCal.className = "ciCocalendarDiv"; loCalendarInnerContainer.appendChild(loLeftCal); this.calendarDivMonth[0] = loLeftCal; // spacer div var loSpacerDiv = document.createElement("div"); loSpacerDiv.className = "ciCospacerDiv"; loCalendarInnerContainer.appendChild(loSpacerDiv); // right cal var loRightCal = document.createElement("div"); loRightCal.className = "ciCocalendarDiv"; loCalendarInnerContainer.appendChild(loRightCal); this.calendarDivMonth[1] = loRightCal; // clear div var loClearDiv1 = document.createElement("div"); loClearDiv1.className = "ciCodivClear"; loCalendarInnerContainer.appendChild(loClearDiv1); // clear calendar var loClearCal = document.createElement("div"); loClearCal.className = "ciCoresetDates"; var loResetAction = document.createElement("a"); loResetAction.href = "javascript:fnResetCalendarCiCo('" + this.calendarId + "');"; loResetAction.title = moLanguageObjCiCo.calendarClear; lsText = moLanguageObjCiCo.calendarClear; loTextNode = document.createTextNode(lsText); loResetAction.appendChild(loTextNode); loClearCal.appendChild(loResetAction); loCalendarInnerContainer.appendChild(loClearCal); loCalendarContainer.appendChild(loCalendarInnerContainer); /* ****************END CAL BODY******************** */ // Next button var loNextButton = document.createElement("div"); loNextButton.className = "ciCocalendarNavigation"; var loNextActionHolder = document.createElement("div"); loNextActionHolder.id = "ciCocalendarNavigationNext"; var loNextAction = document.createElement("a"); this.calendarNextAction = "javascript:fnChangeMonthCiCo('" + this.calendarId + "',1);"; loNextAction.href = this.calendarNextAction; loNextAction.className = "ciCocalendarNavigationNextActive" loNextAction.title = moLanguageObjCiCo.calendarNext; this.calendarNext = loNextAction; var loNextActionImg = document.createElement("img"); loNextActionImg.src = moRightArrow.src; loNextActionImg.border = '0'; loNextActionImg.alt = moLanguageObjCiCo.calendarNext; this.calendarNextImage = loNextActionImg; loNextAction.appendChild(loNextActionImg); loNextActionHolder.appendChild(loNextAction); loNextButton.appendChild(loNextActionHolder); //this.calendarNext = loNextButton; loCalendarContainer.appendChild(loNextButton); // clear div var loClearDiv2 = document.createElement("div"); loClearDiv2.className = "ciCodivClear"; loCalendarContainer.appendChild(loClearDiv2); loCalenderHolder.appendChild(loCalendarContainer); // Add footer elements under footerDIV for ALOFT var footerDiv = document.createElement("div"); footerDiv.id = "ciCoFooterDiv"; // create continue button var loContinueButton = document.createElement("div"); loContinueButton.className = "ciCocontinueButton"; var loContinueAction = document.createElement("a"); loContinueAction.className = "ciCobutton_a"; loContinueAction.href = "javascript:fnContinueCiCo('" + this.calendarId + "');"; loContinueAction.title = moLanguageObjCiCo.calendarContinue; lsText = moLanguageObjCiCo.calendarContinue; loTextNode = document.createTextNode(lsText); loContinueAction.appendChild(loTextNode); loContinueButton.appendChild(loContinueAction); this.calendarContinue = loContinueButton; // create travel dates display var loMenuHolder = document.createElement("div"); loMenuHolder.className = 'ciComenuHolder'; var loTravelDateHolder = document.createElement("div"); loTravelDateHolder.className = "ciCotravelDateHolder"; var loTravelDateLabel = document.createElement("div"); loTravelDateLabel.className = "ciCotravelDateLabel"; lsText = moLanguageObjCiCo.menuTravelDates + ' '; loTextNode = document.createTextNode(lsText); loTravelDateLabel.appendChild(loTextNode); loTravelDateHolder.appendChild(loTravelDateLabel); var loTravelDates = document.createElement("div"); loTravelDates.className = "ciCotravelDates"; loTravelDates.id = "ciCotravelDates"; this.calendarTravelDates = loTravelDates; loTravelDateHolder.appendChild(loTravelDates); var loClearDiv3 = document.createElement("div"); loClearDiv3.className = "ciCodivClear"; loTravelDateHolder.appendChild(loClearDiv3); var loLengthOfStayLabel = document.createElement("div"); loLengthOfStayLabel.className = "ciCotravelDateLabel"; lsText = moLanguageObjCiCo.menuLengthOfStay + ' '; loTextNode = document.createTextNode(lsText); loLengthOfStayLabel.appendChild(loTextNode); loTravelDateHolder.appendChild(loLengthOfStayLabel); var loLengthOfStay = document.createElement("div"); loLengthOfStay.className = "ciColengthOfStay"; loLengthOfStay.id = "ciColengthOfStay"; this.calendarLengthOfStay = loLengthOfStay; loTravelDateHolder.appendChild(loLengthOfStay); loMenuHolder.appendChild(loTravelDateHolder); var loClearDiv4 = document.createElement("div"); loClearDiv4.className = "ciCodivClear"; loMenuHolder.appendChild(loClearDiv4); footerDiv.appendChild(loContinueButton); footerDiv.appendChild(loMenuHolder); loCalenderHolder.appendChild(footerDiv); return loCalenderHolder; } //Availability Calendar method to render the calendar, different results are shown based on the display mode multiDisplayCalendar.prototype.renderCalendar = function(){ for(var calIndex=0; calIndex'; } // Calendar Days lsOutput += '
 
'; // Figure out if it is a leap year and set accordingly moMonthDayCountArrayCiCo[1] = (((loCurrentYear % 4 == 0) && (loCurrentYear % 100 != 0)) || (loCurrentYear % 400 == 0)) ? 29 : 28; for (i=0; i' + loCurrentDate.getDate() +''; } else{ //day is past the book limit lsTempOutput = '
' + loCurrentDate.getDate() +'
'; } if(loCurrentDate < mcToday){ // day is less than today lsTempOutput = '
' + loCurrentDate.getDate() +'
'; } lsOutput += lsTempOutput; if (lvColumnIndex == 6) { lsOutput += '
 
'; lvColumnIndex = -1; } } break; case 1: var loSelectedCheckInDate = this.ciDate; for (var i=0; i<=moMonthDayCountArrayCiCo[loCurrentMonth]-1; i++, lvColumnIndex++) { var loCurrentDate = new Date(loCurrentYear,loCurrentMonth,1); loCurrentDate = new Date(loCurrentDate.setDate(loCurrentDate.getDate() + i)); var lsTempOutput = ''; if(loCurrentDate < mcMaxDisplay){ // day is valid lsTempOutput = ''; } else{ //day is past the book limit lsTempOutput = '
' + loCurrentDate.getDate() +'
'; } if(loCurrentDate.getTime() == loSelectedCheckInDate.getTime()){ lsTempOutput = ''; } if(loCurrentDate < mcToday){ // day is less than today lsTempOutput = '
' + loCurrentDate.getDate() +'
'; } lsOutput += lsTempOutput; if (lvColumnIndex == 6) { lsOutput += '
 
'; lvColumnIndex = -1; } } break; case 2: var loSelectedCheckInDate = this.ciDate; var loSelectedCheckOutDate = this.coDate; ////alert("loSelectedCheckInDate: " + loSelectedCheckInDate); ////alert("loSelectedCheckOutDate: " + loSelectedCheckOutDate); for (var i=0; i<=moMonthDayCountArrayCiCo[loCurrentMonth]-1; i++, lvColumnIndex++) { var loCurrentDate = new Date(loCurrentYear,loCurrentMonth,1); loCurrentDate = new Date(loCurrentDate.setDate(loCurrentDate.getDate() + i)); var lsTempOutput = ''; if (loCurrentDate.getTime() == loSelectedCheckInDate.getTime()){ // day is check in date lsTempOutput = ''; } else if (loCurrentDate.getTime() == loSelectedCheckOutDate.getTime()){ // day is check out date lsTempOutput = ''; } else if (loCurrentDate.getTime() > loSelectedCheckInDate.getTime() && loCurrentDate.getTime() < loSelectedCheckOutDate.getTime() ){ // day is a booked date lsTempOutput = ''; } else{ if(loCurrentDate < mcMaxDisplay){ // day is valid lsTempOutput = ''; } else{ //day is past the book limit lsTempOutput = '
' + loCurrentDate.getDate() +'
'; } } if(loCurrentDate < mcToday){ // day is less than today lsTempOutput = '
' + loCurrentDate.getDate() +'
'; } lsOutput += lsTempOutput; if (lvColumnIndex == 6) { lsOutput += '
 
'; lvColumnIndex = -1; } } break; } if (lvColumnIndex > 0) { for (i=1; lvColumnIndex<7; i++, lvColumnIndex++){ lsOutput += '
 
'; } } lsOutput += ''; //Write the newly constructed table to the div on the page this.calendarDivMonth[calIndex].innerHTML = lsOutput; } } multiDisplayCalendar.prototype.renderTravelDates = function(){ var lsOutput = ''; var lsCIDisplay = fnGetDisplayDateCiCo(this.ciDate); var lsCODisplay = fnGetDisplayDateCiCo(this.coDate); //alert("this.ciDate: " + this.ciDate); //alert("this.coDate: " + this.coDate); lsOutput += (lsCIDisplay) ? lsCIDisplay : moLanguageObjCiCo.menuNotSelected; lsOutput += '
 ' + moLanguageObjCiCo.menuTravelDatesTo + ' 
'; lsOutput += (lsCODisplay) ? lsCODisplay : moLanguageObjCiCo.menuNotSelected; // ouput the Travel Dates to the div this.calendarTravelDates.innerHTML = lsOutput; } multiDisplayCalendar.prototype.renderStayLength = function(){ var lsOutput = (this.selectedLOS) ? this.selectedLOS + ' ' + moLanguageObjCiCo.menuLOSUnit : moLanguageObjCiCo.menuNoLOS; this.calendarLengthOfStay.innerHTML = lsOutput; } multiDisplayCalendar.prototype.renderErrors = function(pFromContinue){ this.validateCalendar(pFromContinue); if(this.hasError){ var lsOutput = ''; for(var i=0; i' } this.errorMessageDiv.innerHTML = lsOutput; this.errorMessageDiv.style.display = 'block'; } else{ this.errorMessageDiv.style.display = 'none'; this.errorMessageDiv.innerHTML = ''; } } multiDisplayCalendar.prototype.validateCalendar = function(pFromContinue){ this.hasError = false; this.errorArray = new Array(); if(this.ciDate){ if(this.selectedLOS > mcMaxBookDays){ this.errorArray[this.errorArray.length] = moLanguageObjCiCo.calendarErrorArray[0]; this.hasError = true; } if(this.ciDate > mcMaxDisplay){ this.errorArray[this.errorArray.length] = moLanguageObjCiCo.calendarErrorArray[1]; this.hasError = true; } if(this.ciDate < mcToday){ this.errorArray[this.errorArray.length] = moLanguageObjCiCo.calendarErrorArray[2]; this.hasError = true; } } if(this.coDate){ if(this.coDate > mcMaxDisplay && this.ciDate < mcMaxDisplay){ this.errorArray[this.errorArray.length] = moLanguageObjCiCo.calendarErrorArray[1]; this.hasError = true; } if(this.coDate < this.ciDate){ this.errorArray[this.errorArray.length] = moLanguageObjCiCo.calendarErrorArray[3]; this.hasError = true; } if(this.ciDate == this.coDate){ this.errorArray[this.errorArray.length] = moLanguageObjCiCo.calendarErrorArray[4]; this.hasError = true; } } if(pFromContinue){ if(!this.ciDate){ this.errorArray[this.errorArray.length] = moLanguageObjCiCo.calendarErrorArray[5]; this.hasError = true; } else if(!this.coDate){ this.errorArray[this.errorArray.length] = moLanguageObjCiCo.calendarErrorArray[6]; this.hasError = true; } } } multiDisplayCalendar.prototype.setNavigation = function(){ var lvWorkingDate = new Date(this.calStartDate); lvWorkingDate = new Date(lvWorkingDate.setMonth(lvWorkingDate.getMonth() + 1)); var loMaxDisplay = new Date(mcMaxDisplay); var loDisableArray = new Array(false, false); // Prev button if(this.calStartDate.getMonth() == mcToday.getMonth() && this.calStartDate.getFullYear() == mcToday.getFullYear()){ this.calendarPrevious.className = 'ciCocalendarNavigationPrevDisabled'; this.calendarPrevious.href = "javascript:void(0);"; this.calendarPrevImage.src = '/alofthotels/images/calendar/prevDisabled.gif'; } else{ this.calendarPrevious.className = 'ciCocalendarNavigationPrevActive'; this.calendarPrevious.href = this.calendarPreviousAction; this.calendarPrevImage.src = '/alofthotels/images/calendar/prev.gif'; } // next button if(lvWorkingDate.getMonth() == loMaxDisplay.getMonth() && lvWorkingDate.getFullYear() == loMaxDisplay.getFullYear()){ this.calendarNext.className = 'ciCocalendarNavigationNextDisabled'; this.calendarNext.href = "javascript:void(0);"; this.calendarNextImage.src = '/alofthotels/images/calendar/nextDisabled.gif'; } else{ this.calendarNext.className = 'ciCocalendarNavigationNextActive'; this.calendarNext.href = this.calendarNextAction; this.calendarNextImage.src = '/alofthotels/images/calendar/next.gif'; } } multiDisplayCalendar.prototype.renderCalDisplay = function(){ this.renderCalendar(); this.setNavigation(); this.renderTravelDates(); this.renderStayLength(); this.renderErrors(); } multiDisplayCalendar.prototype.formatDateOnImport = function(pDate){ var loDateObj = null; if(pDate != ''){ var lsDateString = pDate; var loDateArray = new Array(); loDateArray = lsDateString.split("-"); loDateObj = new Date(loDateArray[1] + "/" + loDateArray[2] + "/" + new Number(loDateArray[0])); } return loDateObj; } multiDisplayCalendar.prototype.getLengthOfStay = function(){ var lnLengthOfStay = null; if(this.ciDate && this.coDate){ lnLengthOfStay = fnGetDateDifferenceCiCo(this.ciDate,this.coDate); } return lnLengthOfStay; } function fnCloseCalendarCiCo(pCalendarId){ var loCalendarObj = moCalendarManagerCiCo.calArray[pCalendarId]; //loCalendarObj.clearObject(); //loCalendarObj.initializeObject(); loCalendarObj.toggleDisplay(); } // function to select the day, different actions are taken based on the display mode (0-select check in, 1-select checkout, 2-detwermine if new date is Checkin or Checkout) function fnSelectDayCiCo(pCalendarId, pNewDate) { var loCalendarObj = moCalendarManagerCiCo.calArray[pCalendarId]; //alert("pNewDate: " + pNewDate); var loSelectedDate = new Date(pNewDate); var lvMode = loCalendarObj.dateDisplayMode; switch(lvMode) { case 0: loCalendarObj.ciDate = loSelectedDate; loCalendarObj.dateDisplayMode = 1; break; case 1: if(loSelectedDate < loCalendarObj.ciDate){ loCalendarObj.ciDate = loSelectedDate; loCalendarObj.dateDisplayMode = 1; } else{ loCalendarObj.coDate = loSelectedDate; loCalendarObj.dateDisplayMode = 2; } break; case 2: if(loSelectedDate < loCalendarObj.ciDate){ loCalendarObj.ciDate = loSelectedDate; } else if(loSelectedDate > loCalendarObj.coDate){ loCalendarObj.coDate = loSelectedDate; } else{ var loMidPoint = loCalendarObj.selectedLOS / 2; var loDateDifference = fnGetDateDifferenceCiCo(loCalendarObj.ciDate, loSelectedDate); if(loDateDifference >= loMidPoint){ loCalendarObj.coDate = loSelectedDate; } else{ loCalendarObj.ciDate = loSelectedDate; } } loCalendarObj.dateDisplayMode = 2; break; } loCalendarObj.selectedLOS = loCalendarObj.getLengthOfStay(); //alert("loCalendarObj.selectedLOS: " + loCalendarObj.selectedLOS); loCalendarObj.renderCalDisplay(); } function fnGetDateDifferenceCiCo(pCIDay, pCODay){ var loStartDate = new Date(pCIDay); var loEndDate = new Date(pCODay); var lnDayDiff = Math.round((loEndDate.getTime() - loStartDate.getTime()) / (1000 * 60 * 60 * 24)); return Math.abs(lnDayDiff); } // function to change the month. The month buttons pass pDirection to tell the function to move up or down one month and a new calendar is drawn function fnChangeMonthCiCo(pCalendarId,pDirection){ var loCalendarObj = moCalendarManagerCiCo.calArray[pCalendarId]; var loNewStart = new Date(loCalendarObj.calStartDate); var newMonth = loNewStart.getMonth() + pDirection; // safari fix if(newMonth < 0) { loNewStart.setFullYear(loNewStart.getFullYear()-1); newMonth = 11; } loCalendarObj.calStartDate = new Date(loNewStart.setMonth(newMonth)); loCalendarObj.renderCalDisplay(); } // function to select today. Reset day/month/year to today from the constants above and call fnChangeDay to reset the styles function fnResetCalendarCiCo(pCalendarId){ var loCalendarObj = moCalendarManagerCiCo.calArray[pCalendarId]; loCalendarObj.clearObject(); //loCalendarObj.initializeObject(); loCalendarObj.renderCalDisplay(); } function fnGetDisplayDateCiCo(pDateToFormat){ var lsFormatDate = null; if(pDateToFormat){ var loDate = new Date(pDateToFormat); //var lsYear = loDate.getFullYear().toString().substring(2,4); var lsYear = loDate.getFullYear(); var lsMonth = moLanguageObjCiCo.calendarShortMonthArray[loDate.getMonth()] lsFormatDate = loDate.getDate() + ' ' + lsMonth + ' ' + lsYear; } return lsFormatDate; } function fnContinueCiCo(pCalendarId){ var loCalendarObj = moCalendarManagerCiCo.calArray[pCalendarId]; loCalendarObj.renderErrors(true); if(!loCalendarObj.hasError){ // send back info call passed in function, pass the checkin and checkout date objs loCalendarObj.returnFunction(loCalendarObj.ciDate, loCalendarObj.coDate, true); fnCloseCalendarCiCo(loCalendarObj.calendarId); } } function fnFormatForExportCiCo(pDateToFormat){ var loFormatDate = new Date(pDateToFormat); if(!isNaN(loFormatDate)){ var lsDateString = loFormatDate.getFullYear() + '-' + padZero(loFormatDate.getMonth() +1) + '-' + padZero(loFormatDate.getDate()); return lsDateString; } } function padZero(pNumber) { return (pNumber<0 || pNumber>9 ? "" : "0") + pNumber; } SW.domWidget.add({ id:"sIFRManager", initialize:function(config) { // standard function name - manually called - SW.domWidget.WidgetId.initialize(params...); }, load:function() { // do load stuff, find elements and setup if (typeof sIFR == "function") { this.isSupported = true; sIFR.setup(); //sIFR.debug(); this.setup(); } }, update:function(root) { // do update stuff, find elements and setup. root element is passed in. if (self.isSupported) { } }, setup: function(root) { var self = this; if (self.isSupported) { // with out this sIFR will not work if swfObject existed on the page //sIFR.useDomContentLoaded = false; sIFR.replaceElement(named({ sSelector:"#primaryNavigation ul li.selected", sFlashSrc:"hotels_index_files/sIFR/digital.swf", sColor:"#EE4D9B", sLinkColor:"#EE4D9B", sHoverColor:"#EE4D9B", sCase:"lower", sWmode:"transparent" })) sIFR.replaceElement(named({ sSelector:"#primaryNavigation ul li", sFlashSrc:"hotels_index_files/sIFR/digital.swf", sColor:"#2c363c", sLinkColor:"#2c363c", sHoverColor:"#EE4D9B", sCase:"lower", sWmode:"transparent" })) // sIFR.replaceElement(named({ // sSelector:"#rightColumn .secondarySmallHeader", // sFlashSrc:"hotels_index_files/sIFR/digital.swf", // sColor:"#EE4D9B", // sCase:"lower", // sWmode:"transparent" // })) sIFR.replaceElement(named({ sSelector:"#leftColumn .pageHeader", sFlashSrc:"hotels_index_files/sIFR/digital.swf", sColor:"#EE4D9B", sCase:"lower", sWmode:"transparent", sFlashVars:"offsetTop=-5" })) sIFR.replaceElement(named({ sSelector:"#leftColumn .sectionHeader", sFlashSrc:"hotels_index_files/sIFR/digital.swf", sColor:"#556067", sCase:"lower", sWmode:"transparent", sFlashVars:"offsetTop=3" })) sIFR.replaceElement(named({ sSelector:"#leftColumn #regSelectHead", sFlashSrc:"hotels_index_files/sIFR/digital.swf", sColor:"#EE4D9B", sCase:"lower", sWmode:"transparent" })) sIFR.replaceElement(named({ sSelector:"#contentArea h1#taleoFAQHeader", sFlashSrc:"hotels_index_files/sIFR/digital.swf", sColor:"#556067", sCase:"lower", sWmode:"transparent" })) sIFR.replaceElement(named({ sSelector:"#consoleHeader h1#askHeader", sFlashSrc:"hotels_index_files/sIFR/digital.swf", sColor:"#556067", sCase:"lower", sWmode:"transparent" })) sIFR.replaceElement(named({ sSelector:"#leftColumn .bookingFlowStepsBanner", sFlashSrc:"hotels_index_files/sIFR/digital.swf", sColor:"#303E47", sCase:"lower", sWmode:"transparent" })) sIFR.replaceElement(named({ sSelector:"#leftColumn .content #rateListContainer #headContentArea h2", sFlashSrc:"hotels_index_files/sIFR/digital.swf", sColor:"#303E47", sCase:"lower", sWmode:"transparent" })) sIFR.replaceElement(named({ sSelector:"#leftColumn .content #rateListPage h2", sFlashSrc:"hotels_index_files/sIFR/digital.swf", sColor:"#303E47", sCase:"lower", sWmode:"transparent" })) sIFR.replaceElement(named({ sSelector:".content #searchResultPage #banner h1", sFlashSrc:"hotels_index_files/sIFR/digital.swf", sColor:"#303E47", sCase:"lower", sWmode:"transparent" })) sIFR.replaceElement(named({ sSelector:"#leftColumn .content #bookingHeader", sFlashSrc:"hotels_index_files/sIFR/digital.swf", sColor:"#303E47", sCase:"lower", sWmode:"transparent" })) sIFR.replaceElement(named({ sSelector:".popup .spgCategory h1, .popup .spgLimitedParticipation h2", sFlashSrc:"hotels_index_files/sIFR/digital.swf", sColor:"#303E47", sCase:"lower", sWmode:"transparent" })) sIFR.replaceElement(named({ sSelector:".popup #content h2", sFlashSrc:"hotels_index_files/sIFR/digital.swf", sColor:"#303E47", sCase:"lower", sWmode:"transparent" })) sIFR.replaceElement(named({ sSelector:"#leftColumn .content div #noAvailPageHeader h1", sFlashSrc:"hotels_index_files/sIFR/digital.swf", sColor:"#303E47", sCase:"lower", sWmode:"transparent" })) sIFR.replaceElement(named({ sSelector:"#leftColumn .content #genericHeader h2", sFlashSrc:"hotels_index_files/sIFR/digital.swf", sColor:"#303E47", sCase:"lower", sWmode:"transparent" })) sIFR.replaceElement(named({ sSelector:"#leftColumn .content #wwrPageContent .worldWideTitle", sFlashSrc:"hotels_index_files/sIFR/digital.swf", sColor:"#EE4D9B", sCase:"lower", sWmode:"transparent" })) sIFR.replaceElement(named({ sSelector:"#rightColumn #enrollNowContainer h2", sFlashSrc:"hotels_index_files/sIFR/digital.swf", sColor:"#EE4D9B", sCase:"lower", sWmode:"transparent", XsFlashVars:"offsetTop=-5" })) } } }); if (typeof SW.domWidget.sIFRManager!="undefined") SW.domWidget.sIFRManager.setEnabled(true); if (typeof SW.domWidget.dhtmlSelect!="undefined") SW.domWidget.dhtmlSelect.setEnabled(true); if (typeof SW.domWidget.bodyClickHandler!="undefined") SW.domWidget.bodyClickHandler.setEnabled(true);