
/* File: http://yui.yahooapis.com/2.3.0/build/yahoo-dom-event/yahoo-dom-event.js */

/*
Copyright (c) 2007, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.3.0
*/

if(typeof YAHOO=="undefined"){var YAHOO={};}
YAHOO.namespace=function(){var a=arguments,o=null,i,j,d;for(i=0;i<a.length;i=i+1){d=a[i].split(".");o=YAHOO;for(j=(d[0]=="YAHOO")?1:0;j<d.length;j=j+1){o[d[j]]=o[d[j]]||{};o=o[d[j]];}}
return o;};YAHOO.log=function(msg,cat,src){var l=YAHOO.widget.Logger;if(l&&l.log){return l.log(msg,cat,src);}else{return false;}};YAHOO.register=function(name,mainClass,data){var mods=YAHOO.env.modules;if(!mods[name]){mods[name]={versions:[],builds:[]};}
var m=mods[name],v=data.version,b=data.build,ls=YAHOO.env.listeners;m.name=name;m.version=v;m.build=b;m.versions.push(v);m.builds.push(b);m.mainClass=mainClass;for(var i=0;i<ls.length;i=i+1){ls[i](m);}
if(mainClass){mainClass.VERSION=v;mainClass.BUILD=b;}else{YAHOO.log("mainClass is undefined for module "+name,"warn");}};YAHOO.env=YAHOO.env||{modules:[],listeners:[]};YAHOO.env.getVersion=function(name){return YAHOO.env.modules[name]||null;};YAHOO.env.ua=function(){var o={ie:0,opera:0,gecko:0,webkit:0};var ua=navigator.userAgent,m;if((/KHTML/).test(ua)){o.webkit=1;}
m=ua.match(/AppleWebKit\/([^\s]*)/);if(m&&m[1]){o.webkit=parseFloat(m[1]);}
if(!o.webkit){m=ua.match(/Opera[\s\/]([^\s]*)/);if(m&&m[1]){o.opera=parseFloat(m[1]);}else{m=ua.match(/MSIE\s([^;]*)/);if(m&&m[1]){o.ie=parseFloat(m[1]);}else{m=ua.match(/Gecko\/([^\s]*)/);if(m){o.gecko=1;m=ua.match(/rv:([^\s\)]*)/);if(m&&m[1]){o.gecko=parseFloat(m[1]);}}}}}
return o;}();(function(){YAHOO.namespace("util","widget","example");if(typeof YAHOO_config!="undefined"){var l=YAHOO_config.listener,ls=YAHOO.env.listeners,unique=true,i;if(l){for(i=0;i<ls.length;i=i+1){if(ls[i]==l){unique=false;break;}}
if(unique){ls.push(l);}}}})();YAHOO.lang={isArray:function(o){if(o){var l=YAHOO.lang;return l.isNumber(o.length)&&l.isFunction(o.splice)&&!l.hasOwnProperty(o.length);}
return false;},isBoolean:function(o){return typeof o==='boolean';},isFunction:function(o){return typeof o==='function';},isNull:function(o){return o===null;},isNumber:function(o){return typeof o==='number'&&isFinite(o);},isObject:function(o){return(o&&(typeof o==='object'||YAHOO.lang.isFunction(o)))||false;},isString:function(o){return typeof o==='string';},isUndefined:function(o){return typeof o==='undefined';},hasOwnProperty:function(o,prop){if(Object.prototype.hasOwnProperty){return o.hasOwnProperty(prop);}
return!YAHOO.lang.isUndefined(o[prop])&&o.constructor.prototype[prop]!==o[prop];},_IEEnumFix:function(r,s){if(YAHOO.env.ua.ie){var add=["toString","valueOf"];for(i=0;i<add.length;i=i+1){var fname=add[i],f=s[fname];if(YAHOO.lang.isFunction(f)&&f!=Object.prototype[fname]){r[fname]=f;}}}},extend:function(subc,superc,overrides){if(!superc||!subc){throw new Error("YAHOO.lang.extend failed, please check that "+"all dependencies are included.");}
var F=function(){};F.prototype=superc.prototype;subc.prototype=new F();subc.prototype.constructor=subc;subc.superclass=superc.prototype;if(superc.prototype.constructor==Object.prototype.constructor){superc.prototype.constructor=superc;}
if(overrides){for(var i in overrides){subc.prototype[i]=overrides[i];}
YAHOO.lang._IEEnumFix(subc.prototype,overrides);}},augmentObject:function(r,s){if(!s||!r){throw new Error("Absorb failed, verify dependencies.");}
var a=arguments,i,p,override=a[2];if(override&&override!==true){for(i=2;i<a.length;i=i+1){r[a[i]]=s[a[i]];}}else{for(p in s){if(override||!r[p]){r[p]=s[p];}}
YAHOO.lang._IEEnumFix(r,s);}},augmentProto:function(r,s){if(!s||!r){throw new Error("Augment failed, verify dependencies.");}
var a=[r.prototype,s.prototype];for(var i=2;i<arguments.length;i=i+1){a.push(arguments[i]);}
YAHOO.lang.augmentObject.apply(this,a);},dump:function(o,d){var l=YAHOO.lang,i,len,s=[],OBJ="{...}",FUN="f(){...}",COMMA=', ',ARROW=' => ';if(!l.isObject(o)||o instanceof Date||("nodeType"in o&&"tagName"in o)){return o;}else if(l.isFunction(o)){return FUN;}
d=(l.isNumber(d))?d:3;if(l.isArray(o)){s.push("[");for(i=0,len=o.length;i<len;i=i+1){if(l.isObject(o[i])){s.push((d>0)?l.dump(o[i],d-1):OBJ);}else{s.push(o[i]);}
s.push(COMMA);}
if(s.length>1){s.pop();}
s.push("]");}else{s.push("{");for(i in o){if(l.hasOwnProperty(o,i)){s.push(i+ARROW);if(l.isObject(o[i])){s.push((d>0)?l.dump(o[i],d-1):OBJ);}else{s.push(o[i]);}
s.push(COMMA);}}
if(s.length>1){s.pop();}
s.push("}");}
return s.join("");},substitute:function(s,o,f){var i,j,k,key,v,meta,l=YAHOO.lang,saved=[],token,DUMP='dump',SPACE=' ',LBRACE='{',RBRACE='}';for(;;){i=s.lastIndexOf(LBRACE);if(i<0){break;}
j=s.indexOf(RBRACE,i);if(i+1>=j){break;}
token=s.substring(i+1,j);key=token;meta=null;k=key.indexOf(SPACE);if(k>-1){meta=key.substring(k+1);key=key.substring(0,k);}
v=o[key];if(f){v=f(key,v,meta);}
if(l.isObject(v)){if(l.isArray(v)){v=l.dump(v,parseInt(meta,10));}else{meta=meta||"";var dump=meta.indexOf(DUMP);if(dump>-1){meta=meta.substring(4);}
if(v.toString===Object.prototype.toString||dump>-1){v=l.dump(v,parseInt(meta,10));}else{v=v.toString();}}}else if(!l.isString(v)&&!l.isNumber(v)){v="~-"+saved.length+"-~";saved[saved.length]=token;}
s=s.substring(0,i)+v+s.substring(j+1);}
for(i=saved.length-1;i>=0;i=i-1){s=s.replace(new RegExp("~-"+i+"-~"),"{"+saved[i]+"}","g");}
return s;},trim:function(s){try{return s.replace(/^\s+|\s+$/g,"");}catch(e){return s;}},merge:function(){var o={},a=arguments,i;for(i=0;i<a.length;i=i+1){YAHOO.lang.augmentObject(o,a[i],true);}
return o;},isValue:function(o){var l=YAHOO.lang;return(l.isObject(o)||l.isString(o)||l.isNumber(o)||l.isBoolean(o));}};YAHOO.util.Lang=YAHOO.lang;YAHOO.lang.augment=YAHOO.lang.augmentProto;YAHOO.augment=YAHOO.lang.augmentProto;YAHOO.extend=YAHOO.lang.extend;YAHOO.register("yahoo",YAHOO,{version:"2.3.0",build:"442"});
(function(){var Y=YAHOO.util,getStyle,setStyle,id_counter=0,propertyCache={},reClassNameCache={};var isOpera=YAHOO.env.ua.opera,isSafari=YAHOO.env.ua.webkit,isGecko=YAHOO.env.ua.gecko,isIE=YAHOO.env.ua.ie;var patterns={HYPHEN:/(-[a-z])/i,ROOT_TAG:/^body|html$/i};var toCamel=function(property){if(!patterns.HYPHEN.test(property)){return property;}
if(propertyCache[property]){return propertyCache[property];}
var converted=property;while(patterns.HYPHEN.exec(converted)){converted=converted.replace(RegExp.$1,RegExp.$1.substr(1).toUpperCase());}
propertyCache[property]=converted;return converted;};var getClassRegEx=function(className){var re=reClassNameCache[className];if(!re){re=new RegExp('(?:^|\\s+)'+className+'(?:\\s+|$)');reClassNameCache[className]=re;}
return re;};if(document.defaultView&&document.defaultView.getComputedStyle){getStyle=function(el,property){var value=null;if(property=='float'){property='cssFloat';}
var computed=document.defaultView.getComputedStyle(el,'');if(computed){value=computed[toCamel(property)];}
return el.style[property]||value;};}else if(document.documentElement.currentStyle&&isIE){getStyle=function(el,property){switch(toCamel(property)){case'opacity':var val=100;try{val=el.filters['DXImageTransform.Microsoft.Alpha'].opacity;}catch(e){try{val=el.filters('alpha').opacity;}catch(e){}}
return val/100;case'float':property='styleFloat';default:var value=el.currentStyle?el.currentStyle[property]:null;return(el.style[property]||value);}};}else{getStyle=function(el,property){return el.style[property];};}
if(isIE){setStyle=function(el,property,val){switch(property){case'opacity':if(YAHOO.lang.isString(el.style.filter)){el.style.filter='alpha(opacity='+val*100+')';if(!el.currentStyle||!el.currentStyle.hasLayout){el.style.zoom=1;}}
break;case'float':property='styleFloat';default:el.style[property]=val;}};}else{setStyle=function(el,property,val){if(property=='float'){property='cssFloat';}
el.style[property]=val;};}
var testElement=function(node,method){return node&&node.nodeType==1&&(!method||method(node));};YAHOO.util.Dom={get:function(el){if(!el||el.tagName||el.item){return el;}
if(YAHOO.lang.isString(el)){return document.getElementById(el);}
if(el.splice){var c=[];for(var i=0,len=el.length;i<len;++i){c[c.length]=Y.Dom.get(el[i]);}
return c;}
return el;},getStyle:function(el,property){property=toCamel(property);var f=function(element){return getStyle(element,property);};return Y.Dom.batch(el,f,Y.Dom,true);},setStyle:function(el,property,val){property=toCamel(property);var f=function(element){setStyle(element,property,val);};Y.Dom.batch(el,f,Y.Dom,true);},getXY:function(el){var f=function(el){if((el.parentNode===null||el.offsetParent===null||this.getStyle(el,'display')=='none')&&el!=document.body){return false;}
var parentNode=null;var pos=[];var box;var doc=el.ownerDocument;if(el.getBoundingClientRect){box=el.getBoundingClientRect();return[box.left+Y.Dom.getDocumentScrollLeft(el.ownerDocument),box.top+Y.Dom.getDocumentScrollTop(el.ownerDocument)];}
else{pos=[el.offsetLeft,el.offsetTop];parentNode=el.offsetParent;var hasAbs=this.getStyle(el,'position')=='absolute';if(parentNode!=el){while(parentNode){pos[0]+=parentNode.offsetLeft;pos[1]+=parentNode.offsetTop;if(isSafari&&!hasAbs&&this.getStyle(parentNode,'position')=='absolute'){hasAbs=true;}
parentNode=parentNode.offsetParent;}}
if(isSafari&&hasAbs){pos[0]-=el.ownerDocument.body.offsetLeft;pos[1]-=el.ownerDocument.body.offsetTop;}}
parentNode=el.parentNode;while(parentNode.tagName&&!patterns.ROOT_TAG.test(parentNode.tagName))
{if(Y.Dom.getStyle(parentNode,'display').search(/^inline|table-row.*$/i)){pos[0]-=parentNode.scrollLeft;pos[1]-=parentNode.scrollTop;}
parentNode=parentNode.parentNode;}
return pos;};return Y.Dom.batch(el,f,Y.Dom,true);},getX:function(el){var f=function(el){return Y.Dom.getXY(el)[0];};return Y.Dom.batch(el,f,Y.Dom,true);},getY:function(el){var f=function(el){return Y.Dom.getXY(el)[1];};return Y.Dom.batch(el,f,Y.Dom,true);},setXY:function(el,pos,noRetry){var f=function(el){var style_pos=this.getStyle(el,'position');if(style_pos=='static'){this.setStyle(el,'position','relative');style_pos='relative';}
var pageXY=this.getXY(el);if(pageXY===false){return false;}
var delta=[parseInt(this.getStyle(el,'left'),10),parseInt(this.getStyle(el,'top'),10)];if(isNaN(delta[0])){delta[0]=(style_pos=='relative')?0:el.offsetLeft;}
if(isNaN(delta[1])){delta[1]=(style_pos=='relative')?0:el.offsetTop;}
if(pos[0]!==null){el.style.left=pos[0]-pageXY[0]+delta[0]+'px';}
if(pos[1]!==null){el.style.top=pos[1]-pageXY[1]+delta[1]+'px';}
if(!noRetry){var newXY=this.getXY(el);if((pos[0]!==null&&newXY[0]!=pos[0])||(pos[1]!==null&&newXY[1]!=pos[1])){this.setXY(el,pos,true);}}};Y.Dom.batch(el,f,Y.Dom,true);},setX:function(el,x){Y.Dom.setXY(el,[x,null]);},setY:function(el,y){Y.Dom.setXY(el,[null,y]);},getRegion:function(el){var f=function(el){if((el.parentNode===null||el.offsetParent===null||this.getStyle(el,'display')=='none')&&el!=document.body){return false;}
var region=Y.Region.getRegion(el);return region;};return Y.Dom.batch(el,f,Y.Dom,true);},getClientWidth:function(){return Y.Dom.getViewportWidth();},getClientHeight:function(){return Y.Dom.getViewportHeight();},getElementsByClassName:function(className,tag,root,apply){tag=tag||'*';root=(root)?Y.Dom.get(root):null||document;if(!root){return[];}
var nodes=[],elements=root.getElementsByTagName(tag),re=getClassRegEx(className);for(var i=0,len=elements.length;i<len;++i){if(re.test(elements[i].className)){nodes[nodes.length]=elements[i];if(apply){apply.call(elements[i],elements[i]);}}}
return nodes;},hasClass:function(el,className){var re=getClassRegEx(className);var f=function(el){return re.test(el.className);};return Y.Dom.batch(el,f,Y.Dom,true);},addClass:function(el,className){var f=function(el){if(this.hasClass(el,className)){return false;}
el.className=YAHOO.lang.trim([el.className,className].join(' '));return true;};return Y.Dom.batch(el,f,Y.Dom,true);},removeClass:function(el,className){var re=getClassRegEx(className);var f=function(el){if(!this.hasClass(el,className)){return false;}
var c=el.className;el.className=c.replace(re,' ');if(this.hasClass(el,className)){this.removeClass(el,className);}
el.className=YAHOO.lang.trim(el.className);return true;};return Y.Dom.batch(el,f,Y.Dom,true);},replaceClass:function(el,oldClassName,newClassName){if(!newClassName||oldClassName===newClassName){return false;}
var re=getClassRegEx(oldClassName);var f=function(el){if(!this.hasClass(el,oldClassName)){this.addClass(el,newClassName);return true;}
el.className=el.className.replace(re,' '+newClassName+' ');if(this.hasClass(el,oldClassName)){this.replaceClass(el,oldClassName,newClassName);}
el.className=YAHOO.lang.trim(el.className);return true;};return Y.Dom.batch(el,f,Y.Dom,true);},generateId:function(el,prefix){prefix=prefix||'yui-gen';var f=function(el){if(el&&el.id){return el.id;}
var id=prefix+id_counter++;if(el){el.id=id;}
return id;};return Y.Dom.batch(el,f,Y.Dom,true)||f.apply(Y.Dom,arguments);},isAncestor:function(haystack,needle){haystack=Y.Dom.get(haystack);if(!haystack||!needle){return false;}
var f=function(node){if(haystack.contains&&node.nodeType&&!isSafari){return haystack.contains(node);}
else if(haystack.compareDocumentPosition&&node.nodeType){return!!(haystack.compareDocumentPosition(node)&16);}else if(node.nodeType){return!!this.getAncestorBy(node,function(el){return el==haystack;});}
return false;};return Y.Dom.batch(needle,f,Y.Dom,true);},inDocument:function(el){var f=function(el){if(isSafari){while(el=el.parentNode){if(el==document.documentElement){return true;}}
return false;}
return this.isAncestor(document.documentElement,el);};return Y.Dom.batch(el,f,Y.Dom,true);},getElementsBy:function(method,tag,root,apply){tag=tag||'*';root=(root)?Y.Dom.get(root):null||document;if(!root){return[];}
var nodes=[],elements=root.getElementsByTagName(tag);for(var i=0,len=elements.length;i<len;++i){if(method(elements[i])){nodes[nodes.length]=elements[i];if(apply){apply(elements[i]);}}}
return nodes;},batch:function(el,method,o,override){el=(el&&el.tagName)?el:Y.Dom.get(el);if(!el||!method){return false;}
var scope=(override)?o:window;if(el.tagName||(!el.item&&!el.slice)){return method.call(scope,el,o);}
var collection=[];for(var i=0,len=el.length;i<len;++i){collection[collection.length]=method.call(scope,el[i],o);}
return collection;},getDocumentHeight:function(){var scrollHeight=(document.compatMode!='CSS1Compat')?document.body.scrollHeight:document.documentElement.scrollHeight;var h=Math.max(scrollHeight,Y.Dom.getViewportHeight());return h;},getDocumentWidth:function(){var scrollWidth=(document.compatMode!='CSS1Compat')?document.body.scrollWidth:document.documentElement.scrollWidth;var w=Math.max(scrollWidth,Y.Dom.getViewportWidth());return w;},getViewportHeight:function(){var height=self.innerHeight;var mode=document.compatMode;if((mode||isIE)&&!isOpera){height=(mode=='CSS1Compat')?document.documentElement.clientHeight:document.body.clientHeight;}
return height;},getViewportWidth:function(){var width=self.innerWidth;var mode=document.compatMode;if(mode||isIE){width=(mode=='CSS1Compat')?document.documentElement.clientWidth:document.body.clientWidth;}
return width;},getAncestorBy:function(node,method){while(node=node.parentNode){if(testElement(node,method)){return node;}}
return null;},getAncestorByClassName:function(node,className){node=Y.Dom.get(node);if(!node){return null;}
var method=function(el){return Y.Dom.hasClass(el,className);};return Y.Dom.getAncestorBy(node,method);},getAncestorByTagName:function(node,tagName){node=Y.Dom.get(node);if(!node){return null;}
var method=function(el){return el.tagName&&el.tagName.toUpperCase()==tagName.toUpperCase();};return Y.Dom.getAncestorBy(node,method);},getPreviousSiblingBy:function(node,method){while(node){node=node.previousSibling;if(testElement(node,method)){return node;}}
return null;},getPreviousSibling:function(node){node=Y.Dom.get(node);if(!node){return null;}
return Y.Dom.getPreviousSiblingBy(node);},getNextSiblingBy:function(node,method){while(node){node=node.nextSibling;if(testElement(node,method)){return node;}}
return null;},getNextSibling:function(node){node=Y.Dom.get(node);if(!node){return null;}
return Y.Dom.getNextSiblingBy(node);},getFirstChildBy:function(node,method){var child=(testElement(node.firstChild,method))?node.firstChild:null;return child||Y.Dom.getNextSiblingBy(node.firstChild,method);},getFirstChild:function(node,method){node=Y.Dom.get(node);if(!node){return null;}
return Y.Dom.getFirstChildBy(node);},getLastChildBy:function(node,method){if(!node){return null;}
var child=(testElement(node.lastChild,method))?node.lastChild:null;return child||Y.Dom.getPreviousSiblingBy(node.lastChild,method);},getLastChild:function(node){node=Y.Dom.get(node);return Y.Dom.getLastChildBy(node);},getChildrenBy:function(node,method){var child=Y.Dom.getFirstChildBy(node,method);var children=child?[child]:[];Y.Dom.getNextSiblingBy(child,function(node){if(!method||method(node)){children[children.length]=node;}
return false;});return children;},getChildren:function(node){node=Y.Dom.get(node);if(!node){}
return Y.Dom.getChildrenBy(node);},getDocumentScrollLeft:function(doc){doc=doc||document;return Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft);},getDocumentScrollTop:function(doc){doc=doc||document;return Math.max(doc.documentElement.scrollTop,doc.body.scrollTop);},insertBefore:function(newNode,referenceNode){newNode=Y.Dom.get(newNode);referenceNode=Y.Dom.get(referenceNode);if(!newNode||!referenceNode||!referenceNode.parentNode){return null;}
return referenceNode.parentNode.insertBefore(newNode,referenceNode);},insertAfter:function(newNode,referenceNode){newNode=Y.Dom.get(newNode);referenceNode=Y.Dom.get(referenceNode);if(!newNode||!referenceNode||!referenceNode.parentNode){return null;}
if(referenceNode.nextSibling){return referenceNode.parentNode.insertBefore(newNode,referenceNode.nextSibling);}else{return referenceNode.parentNode.appendChild(newNode);}}};})();YAHOO.util.Region=function(t,r,b,l){this.top=t;this[1]=t;this.right=r;this.bottom=b;this.left=l;this[0]=l;};YAHOO.util.Region.prototype.contains=function(region){return(region.left>=this.left&&region.right<=this.right&&region.top>=this.top&&region.bottom<=this.bottom);};YAHOO.util.Region.prototype.getArea=function(){return((this.bottom-this.top)*(this.right-this.left));};YAHOO.util.Region.prototype.intersect=function(region){var t=Math.max(this.top,region.top);var r=Math.min(this.right,region.right);var b=Math.min(this.bottom,region.bottom);var l=Math.max(this.left,region.left);if(b>=t&&r>=l){return new YAHOO.util.Region(t,r,b,l);}else{return null;}};YAHOO.util.Region.prototype.union=function(region){var t=Math.min(this.top,region.top);var r=Math.max(this.right,region.right);var b=Math.max(this.bottom,region.bottom);var l=Math.min(this.left,region.left);return new YAHOO.util.Region(t,r,b,l);};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(el){var p=YAHOO.util.Dom.getXY(el);var t=p[1];var r=p[0]+el.offsetWidth;var b=p[1]+el.offsetHeight;var l=p[0];return new YAHOO.util.Region(t,r,b,l);};YAHOO.util.Point=function(x,y){if(YAHOO.lang.isArray(x)){y=x[1];x=x[0];}
this.x=this.right=this.left=this[0]=x;this.y=this.top=this.bottom=this[1]=y;};YAHOO.util.Point.prototype=new YAHOO.util.Region();YAHOO.register("dom",YAHOO.util.Dom,{version:"2.3.0",build:"442"});
YAHOO.util.CustomEvent=function(type,oScope,silent,signature){this.type=type;this.scope=oScope||window;this.silent=silent;this.signature=signature||YAHOO.util.CustomEvent.LIST;this.subscribers=[];if(!this.silent){}
var onsubscribeType="_YUICEOnSubscribe";if(type!==onsubscribeType){this.subscribeEvent=new YAHOO.util.CustomEvent(onsubscribeType,this,true);}};YAHOO.util.CustomEvent.LIST=0;YAHOO.util.CustomEvent.FLAT=1;YAHOO.util.CustomEvent.prototype={subscribe:function(fn,obj,override){if(!fn){throw new Error("Invalid callback for subscriber to '"+this.type+"'");}
if(this.subscribeEvent){this.subscribeEvent.fire(fn,obj,override);}
this.subscribers.push(new YAHOO.util.Subscriber(fn,obj,override));},unsubscribe:function(fn,obj){if(!fn){return this.unsubscribeAll();}
var found=false;for(var i=0,len=this.subscribers.length;i<len;++i){var s=this.subscribers[i];if(s&&s.contains(fn,obj)){this._delete(i);found=true;}}
return found;},fire:function(){var len=this.subscribers.length;if(!len&&this.silent){return true;}
var args=[],ret=true,i,rebuild=false;for(i=0;i<arguments.length;++i){args.push(arguments[i]);}
var argslength=args.length;if(!this.silent){}
for(i=0;i<len;++i){var s=this.subscribers[i];if(!s){rebuild=true;}else{if(!this.silent){}
var scope=s.getScope(this.scope);if(this.signature==YAHOO.util.CustomEvent.FLAT){var param=null;if(args.length>0){param=args[0];}
ret=s.fn.call(scope,param,s.obj);}else{ret=s.fn.call(scope,this.type,args,s.obj);}
if(false===ret){if(!this.silent){}
return false;}}}
if(rebuild){var newlist=[],subs=this.subscribers;for(i=0,len=subs.length;i<len;++i){s=subs[i];newlist.push(subs[i]);}
this.subscribers=newlist;}
return true;},unsubscribeAll:function(){for(var i=0,len=this.subscribers.length;i<len;++i){this._delete(len-1-i);}
this.subscribers=[];return i;},_delete:function(index){var s=this.subscribers[index];if(s){delete s.fn;delete s.obj;}
this.subscribers[index]=null;},toString:function(){return"CustomEvent: "+"'"+this.type+"', "+"scope: "+this.scope;}};YAHOO.util.Subscriber=function(fn,obj,override){this.fn=fn;this.obj=YAHOO.lang.isUndefined(obj)?null:obj;this.override=override;};YAHOO.util.Subscriber.prototype.getScope=function(defaultScope){if(this.override){if(this.override===true){return this.obj;}else{return this.override;}}
return defaultScope;};YAHOO.util.Subscriber.prototype.contains=function(fn,obj){if(obj){return(this.fn==fn&&this.obj==obj);}else{return(this.fn==fn);}};YAHOO.util.Subscriber.prototype.toString=function(){return"Subscriber { obj: "+this.obj+", override: "+(this.override||"no")+" }";};if(!YAHOO.util.Event){YAHOO.util.Event=function(){var loadComplete=false;var DOMReady=false;var listeners=[];var unloadListeners=[];var legacyEvents=[];var legacyHandlers=[];var retryCount=0;var onAvailStack=[];var legacyMap=[];var counter=0;var webkitKeymap={63232:38,63233:40,63234:37,63235:39};return{POLL_RETRYS:4000,POLL_INTERVAL:10,EL:0,TYPE:1,FN:2,WFN:3,OBJ:3,ADJ_SCOPE:4,lastError:null,isSafari:YAHOO.env.ua.webkit,webkit:YAHOO.env.ua.webkit,isIE:YAHOO.env.ua.ie,_interval:null,startInterval:function(){if(!this._interval){var self=this;var callback=function(){self._tryPreloadAttach();};this._interval=setInterval(callback,this.POLL_INTERVAL);}},onAvailable:function(p_id,p_fn,p_obj,p_override){onAvailStack.push({id:p_id,fn:p_fn,obj:p_obj,override:p_override,checkReady:false});retryCount=this.POLL_RETRYS;this.startInterval();},onDOMReady:function(p_fn,p_obj,p_override){if(DOMReady){setTimeout(function(){var s=window;if(p_override){if(p_override===true){s=p_obj;}else{s=p_override;}}
p_fn.call(s,"DOMReady",[],p_obj);},0);}else{this.DOMReadyEvent.subscribe(p_fn,p_obj,p_override);}},onContentReady:function(p_id,p_fn,p_obj,p_override){onAvailStack.push({id:p_id,fn:p_fn,obj:p_obj,override:p_override,checkReady:true});retryCount=this.POLL_RETRYS;this.startInterval();},addListener:function(el,sType,fn,obj,override){if(!fn||!fn.call){return false;}
if(this._isValidCollection(el)){var ok=true;for(var i=0,len=el.length;i<len;++i){ok=this.on(el[i],sType,fn,obj,override)&&ok;}
return ok;}else if(YAHOO.lang.isString(el)){var oEl=this.getEl(el);if(oEl){el=oEl;}else{this.onAvailable(el,function(){YAHOO.util.Event.on(el,sType,fn,obj,override);});return true;}}
if(!el){return false;}
if("unload"==sType&&obj!==this){unloadListeners[unloadListeners.length]=[el,sType,fn,obj,override];return true;}
var scope=el;if(override){if(override===true){scope=obj;}else{scope=override;}}
var wrappedFn=function(e){return fn.call(scope,YAHOO.util.Event.getEvent(e),obj);};var li=[el,sType,fn,wrappedFn,scope];var index=listeners.length;listeners[index]=li;if(this.useLegacyEvent(el,sType)){var legacyIndex=this.getLegacyIndex(el,sType);if(legacyIndex==-1||el!=legacyEvents[legacyIndex][0]){legacyIndex=legacyEvents.length;legacyMap[el.id+sType]=legacyIndex;legacyEvents[legacyIndex]=[el,sType,el["on"+sType]];legacyHandlers[legacyIndex]=[];el["on"+sType]=function(e){YAHOO.util.Event.fireLegacyEvent(YAHOO.util.Event.getEvent(e),legacyIndex);};}
legacyHandlers[legacyIndex].push(li);}else{try{this._simpleAdd(el,sType,wrappedFn,false);}catch(ex){this.lastError=ex;this.removeListener(el,sType,fn);return false;}}
return true;},fireLegacyEvent:function(e,legacyIndex){var ok=true,le,lh,li,scope,ret;lh=legacyHandlers[legacyIndex];for(var i=0,len=lh.length;i<len;++i){li=lh[i];if(li&&li[this.WFN]){scope=li[this.ADJ_SCOPE];ret=li[this.WFN].call(scope,e);ok=(ok&&ret);}}
le=legacyEvents[legacyIndex];if(le&&le[2]){le[2](e);}
return ok;},getLegacyIndex:function(el,sType){var key=this.generateId(el)+sType;if(typeof legacyMap[key]=="undefined"){return-1;}else{return legacyMap[key];}},useLegacyEvent:function(el,sType){if(this.webkit&&("click"==sType||"dblclick"==sType)){var v=parseInt(this.webkit,10);if(!isNaN(v)&&v<418){return true;}}
return false;},removeListener:function(el,sType,fn){var i,len;if(typeof el=="string"){el=this.getEl(el);}else if(this._isValidCollection(el)){var ok=true;for(i=0,len=el.length;i<len;++i){ok=(this.removeListener(el[i],sType,fn)&&ok);}
return ok;}
if(!fn||!fn.call){return this.purgeElement(el,false,sType);}
if("unload"==sType){for(i=0,len=unloadListeners.length;i<len;i++){var li=unloadListeners[i];if(li&&li[0]==el&&li[1]==sType&&li[2]==fn){unloadListeners[i]=null;return true;}}
return false;}
var cacheItem=null;var index=arguments[3];if("undefined"==typeof index){index=this._getCacheIndex(el,sType,fn);}
if(index>=0){cacheItem=listeners[index];}
if(!el||!cacheItem){return false;}
if(this.useLegacyEvent(el,sType)){var legacyIndex=this.getLegacyIndex(el,sType);var llist=legacyHandlers[legacyIndex];if(llist){for(i=0,len=llist.length;i<len;++i){li=llist[i];if(li&&li[this.EL]==el&&li[this.TYPE]==sType&&li[this.FN]==fn){llist[i]=null;break;}}}}else{try{this._simpleRemove(el,sType,cacheItem[this.WFN],false);}catch(ex){this.lastError=ex;return false;}}
delete listeners[index][this.WFN];delete listeners[index][this.FN];listeners[index]=null;return true;},getTarget:function(ev,resolveTextNode){var t=ev.target||ev.srcElement;return this.resolveTextNode(t);},resolveTextNode:function(node){if(node&&3==node.nodeType){return node.parentNode;}else{return node;}},getPageX:function(ev){var x=ev.pageX;if(!x&&0!==x){x=ev.clientX||0;if(this.isIE){x+=this._getScrollLeft();}}
return x;},getPageY:function(ev){var y=ev.pageY;if(!y&&0!==y){y=ev.clientY||0;if(this.isIE){y+=this._getScrollTop();}}
return y;},getXY:function(ev){return[this.getPageX(ev),this.getPageY(ev)];},getRelatedTarget:function(ev){var t=ev.relatedTarget;if(!t){if(ev.type=="mouseout"){t=ev.toElement;}else if(ev.type=="mouseover"){t=ev.fromElement;}}
return this.resolveTextNode(t);},getTime:function(ev){if(!ev.time){var t=new Date().getTime();try{ev.time=t;}catch(ex){this.lastError=ex;return t;}}
return ev.time;},stopEvent:function(ev){this.stopPropagation(ev);this.preventDefault(ev);},stopPropagation:function(ev){if(ev.stopPropagation){ev.stopPropagation();}else{ev.cancelBubble=true;}},preventDefault:function(ev){if(ev.preventDefault){ev.preventDefault();}else{ev.returnValue=false;}},getEvent:function(e){var ev=e||window.event;if(!ev){var c=this.getEvent.caller;while(c){ev=c.arguments[0];if(ev&&Event==ev.constructor){break;}
c=c.caller;}}
return ev;},getCharCode:function(ev){var code=ev.keyCode||ev.charCode||0;if(YAHOO.env.ua.webkit&&(code in webkitKeymap)){code=webkitKeymap[code];}
return code;},_getCacheIndex:function(el,sType,fn){for(var i=0,len=listeners.length;i<len;++i){var li=listeners[i];if(li&&li[this.FN]==fn&&li[this.EL]==el&&li[this.TYPE]==sType){return i;}}
return-1;},generateId:function(el){var id=el.id;if(!id){id="yuievtautoid-"+counter;++counter;el.id=id;}
return id;},_isValidCollection:function(o){try{return(o&&o.length&&typeof o!="string"&&!o.tagName&&!o.alert&&typeof o[0]!="undefined");}catch(e){return false;}},elCache:{},getEl:function(id){return document.getElementById(id);},clearCache:function(){},DOMReadyEvent:new YAHOO.util.CustomEvent("DOMReady",this),_load:function(e){if(!loadComplete){loadComplete=true;var EU=YAHOO.util.Event;EU._ready();EU._tryPreloadAttach();}},_ready:function(e){if(!DOMReady){DOMReady=true;var EU=YAHOO.util.Event;EU.DOMReadyEvent.fire();EU._simpleRemove(document,"DOMContentLoaded",EU._ready);}},_tryPreloadAttach:function(){if(this.locked){return false;}
if(this.isIE){if(!DOMReady){this.startInterval();return false;}}
this.locked=true;var tryAgain=!loadComplete;if(!tryAgain){tryAgain=(retryCount>0);}
var notAvail=[];var executeItem=function(el,item){var scope=el;if(item.override){if(item.override===true){scope=item.obj;}else{scope=item.override;}}
item.fn.call(scope,item.obj);};var i,len,item,el;for(i=0,len=onAvailStack.length;i<len;++i){item=onAvailStack[i];if(item&&!item.checkReady){el=this.getEl(item.id);if(el){executeItem(el,item);onAvailStack[i]=null;}else{notAvail.push(item);}}}
for(i=0,len=onAvailStack.length;i<len;++i){item=onAvailStack[i];if(item&&item.checkReady){el=this.getEl(item.id);if(el){if(loadComplete||el.nextSibling){executeItem(el,item);onAvailStack[i]=null;}}else{notAvail.push(item);}}}
retryCount=(notAvail.length===0)?0:retryCount-1;if(tryAgain){this.startInterval();}else{clearInterval(this._interval);this._interval=null;}
this.locked=false;return true;},purgeElement:function(el,recurse,sType){var elListeners=this.getListeners(el,sType);if(elListeners){for(var i=0,len=elListeners.length;i<len;++i){var l=elListeners[i];this.removeListener(el,l.type,l.fn,l.index);}}
if(recurse&&el&&el.childNodes){for(i=0,len=el.childNodes.length;i<len;++i){this.purgeElement(el.childNodes[i],recurse,sType);}}},getListeners:function(el,sType){var results=[],searchLists;if(!sType){searchLists=[listeners,unloadListeners];}else if(sType=="unload"){searchLists=[unloadListeners];}else{searchLists=[listeners];}
for(var j=0;j<searchLists.length;++j){var searchList=searchLists[j];if(searchList&&searchList.length>0){for(var i=0,len=searchList.length;i<len;++i){var l=searchList[i];if(l&&l[this.EL]===el&&(!sType||sType===l[this.TYPE])){results.push({type:l[this.TYPE],fn:l[this.FN],obj:l[this.OBJ],adjust:l[this.ADJ_SCOPE],index:i});}}}}
return(results.length)?results:null;},_unload:function(e){var EU=YAHOO.util.Event,i,j,l,len,index;for(i=0,len=unloadListeners.length;i<len;++i){l=unloadListeners[i];if(l){var scope=window;if(l[EU.ADJ_SCOPE]){if(l[EU.ADJ_SCOPE]===true){scope=l[EU.OBJ];}else{scope=l[EU.ADJ_SCOPE];}}
l[EU.FN].call(scope,EU.getEvent(e),l[EU.OBJ]);unloadListeners[i]=null;l=null;scope=null;}}
unloadListeners=null;if(listeners&&listeners.length>0){j=listeners.length;while(j){index=j-1;l=listeners[index];if(l){EU.removeListener(l[EU.EL],l[EU.TYPE],l[EU.FN],index);}
j=j-1;}
l=null;EU.clearCache();}
for(i=0,len=legacyEvents.length;i<len;++i){legacyEvents[i][0]=null;legacyEvents[i]=null;}
legacyEvents=null;EU._simpleRemove(window,"unload",EU._unload);},_getScrollLeft:function(){return this._getScroll()[1];},_getScrollTop:function(){return this._getScroll()[0];},_getScroll:function(){var dd=document.documentElement,db=document.body;if(dd&&(dd.scrollTop||dd.scrollLeft)){return[dd.scrollTop,dd.scrollLeft];}else if(db){return[db.scrollTop,db.scrollLeft];}else{return[0,0];}},regCE:function(){},_simpleAdd:function(){if(window.addEventListener){return function(el,sType,fn,capture){el.addEventListener(sType,fn,(capture));};}else if(window.attachEvent){return function(el,sType,fn,capture){el.attachEvent("on"+sType,fn);};}else{return function(){};}}(),_simpleRemove:function(){if(window.removeEventListener){return function(el,sType,fn,capture){el.removeEventListener(sType,fn,(capture));};}else if(window.detachEvent){return function(el,sType,fn){el.detachEvent("on"+sType,fn);};}else{return function(){};}}()};}();(function(){var EU=YAHOO.util.Event;EU.on=EU.addListener;if(EU.isIE){YAHOO.util.Event.onDOMReady(YAHOO.util.Event._tryPreloadAttach,YAHOO.util.Event,true);var el,d=document,b=d.body;if(("undefined"!==typeof YAHOO_config)&&YAHOO_config.injecting){el=document.createElement("script");var p=d.getElementsByTagName("head")[0]||b;p.insertBefore(el,p.firstChild);}else{d.write('<scr'+'ipt id="_yui_eu_dr" defer="true" src="//:"><'+'/script>');el=document.getElementById("_yui_eu_dr");}
if(el){el.onreadystatechange=function(){if("complete"===this.readyState){this.parentNode.removeChild(this);YAHOO.util.Event._ready();}};}else{}
el=null;}else if(EU.webkit){EU._drwatch=setInterval(function(){var rs=document.readyState;if("loaded"==rs||"complete"==rs){clearInterval(EU._drwatch);EU._drwatch=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(p_type,p_fn,p_obj,p_override){this.__yui_events=this.__yui_events||{};var ce=this.__yui_events[p_type];if(ce){ce.subscribe(p_fn,p_obj,p_override);}else{this.__yui_subscribers=this.__yui_subscribers||{};var subs=this.__yui_subscribers;if(!subs[p_type]){subs[p_type]=[];}
subs[p_type].push({fn:p_fn,obj:p_obj,override:p_override});}},unsubscribe:function(p_type,p_fn,p_obj){this.__yui_events=this.__yui_events||{};var evts=this.__yui_events;if(p_type){var ce=evts[p_type];if(ce){return ce.unsubscribe(p_fn,p_obj);}}else{for(var i in evts){var ret=true;if(YAHOO.lang.hasOwnProperty(evts,i)){ret=ret&&evts[i].unsubscribe(p_fn,p_obj);}}
return ret;}
return false;},unsubscribeAll:function(p_type){return this.unsubscribe(p_type);},createEvent:function(p_type,p_config){this.__yui_events=this.__yui_events||{};var opts=p_config||{};var events=this.__yui_events;if(events[p_type]){}else{var scope=opts.scope||this;var silent=(opts.silent);var ce=new YAHOO.util.CustomEvent(p_type,scope,silent,YAHOO.util.CustomEvent.FLAT);events[p_type]=ce;if(opts.onSubscribeCallback){ce.subscribeEvent.subscribe(opts.onSubscribeCallback);}
this.__yui_subscribers=this.__yui_subscribers||{};var qs=this.__yui_subscribers[p_type];if(qs){for(var i=0;i<qs.length;++i){ce.subscribe(qs[i].fn,qs[i].obj,qs[i].override);}}}
return events[p_type];},fireEvent:function(p_type,arg1,arg2,etc){this.__yui_events=this.__yui_events||{};var ce=this.__yui_events[p_type];if(!ce){return null;}
var args=[];for(var i=1;i<arguments.length;++i){args.push(arguments[i]);}
return ce.fire.apply(ce,args);},hasEvent:function(type){if(this.__yui_events){if(this.__yui_events[type]){return true;}}
return false;}};YAHOO.util.KeyListener=function(attachTo,keyData,handler,event){if(!attachTo){}else if(!keyData){}else if(!handler){}
if(!event){event=YAHOO.util.KeyListener.KEYDOWN;}
var keyEvent=new YAHOO.util.CustomEvent("keyPressed");this.enabledEvent=new YAHOO.util.CustomEvent("enabled");this.disabledEvent=new YAHOO.util.CustomEvent("disabled");if(typeof attachTo=='string'){attachTo=document.getElementById(attachTo);}
if(typeof handler=='function'){keyEvent.subscribe(handler);}else{keyEvent.subscribe(handler.fn,handler.scope,handler.correctScope);}
function handleKeyPress(e,obj){if(!keyData.shift){keyData.shift=false;}
if(!keyData.alt){keyData.alt=false;}
if(!keyData.ctrl){keyData.ctrl=false;}
if(e.shiftKey==keyData.shift&&e.altKey==keyData.alt&&e.ctrlKey==keyData.ctrl){var dataItem;var keyPressed;if(keyData.keys instanceof Array){for(var i=0;i<keyData.keys.length;i++){dataItem=keyData.keys[i];if(dataItem==e.charCode){keyEvent.fire(e.charCode,e);break;}else if(dataItem==e.keyCode){keyEvent.fire(e.keyCode,e);break;}}}else{dataItem=keyData.keys;if(dataItem==e.charCode){keyEvent.fire(e.charCode,e);}else if(dataItem==e.keyCode){keyEvent.fire(e.keyCode,e);}}}}
this.enable=function(){if(!this.enabled){YAHOO.util.Event.addListener(attachTo,event,handleKeyPress);this.enabledEvent.fire(keyData);}
this.enabled=true;};this.disable=function(){if(this.enabled){YAHOO.util.Event.removeListener(attachTo,event,handleKeyPress);this.disabledEvent.fire(keyData);}
this.enabled=false;};this.toString=function(){return"KeyListener ["+keyData.keys+"] "+attachTo.tagName+
(attachTo.id?"["+attachTo.id+"]":"");};};YAHOO.util.KeyListener.KEYDOWN="keydown";YAHOO.util.KeyListener.KEYUP="keyup";YAHOO.register("event",YAHOO.util.Event,{version:"2.3.0",build:"442"});YAHOO.register("yahoo-dom-event", YAHOO, {version: "2.3.0", build: "442"});


/* File: http://yui.yahooapis.com/2.3.0/build/connection/connection-min.js */

/*
Copyright (c) 2007, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.3.0
*/

YAHOO.util.Connect={_msxml_progid:['MSXML2.XMLHTTP.3.0','MSXML2.XMLHTTP','Microsoft.XMLHTTP'],_http_headers:{},_has_http_headers:false,_use_default_post_header:true,_default_post_header:'application/x-www-form-urlencoded; charset=UTF-8',_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(e){var obj=YAHOO.util.Event.getTarget(e);if(obj.type=='submit'){YAHOO.util.Connect._submitElementValue=encodeURIComponent(obj.name)+"="+encodeURIComponent(obj.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(id)
{this._msxml_progid.unshift(id);},setDefaultPostHeader:function(b)
{this._use_default_post_header=b;},setDefaultXhrHeader:function(b)
{this._use_default_xhr_header=b;},setPollingInterval:function(i)
{if(typeof i=='number'&&isFinite(i)){this._polling_interval=i;}},createXhrObject:function(transactionId)
{var obj,http;try
{http=new XMLHttpRequest();obj={conn:http,tId:transactionId};}
catch(e)
{for(var i=0;i<this._msxml_progid.length;++i){try
{http=new ActiveXObject(this._msxml_progid[i]);obj={conn:http,tId:transactionId};break;}
catch(e){}}}
finally
{return obj;}},getConnectionObject:function(isFileUpload)
{var o;var tId=this._transaction_id;try
{if(!isFileUpload){o=this.createXhrObject(tId);}
else{o={};o.tId=tId;o.isUpload=true;}
if(o){this._transaction_id++;}}
catch(e){}
finally
{return o;}},asyncRequest:function(method,uri,callback,postData)
{var o=(this._isFileUpload)?this.getConnectionObject(true):this.getConnectionObject();if(!o){return null;}
else{if(callback&&callback.customevents){this.initCustomEvents(o,callback);}
if(this._isFormSubmit){if(this._isFileUpload){this.uploadFile(o,callback,uri,postData);return o;}
if(method.toUpperCase()=='GET'){if(this._sFormData.length!==0){uri+=((uri.indexOf('?')==-1)?'?':'&')+this._sFormData;}
else{uri+="?"+this._sFormData;}}
else if(method.toUpperCase()=='POST'){postData=postData?this._sFormData+"&"+postData:this._sFormData;}}
o.conn.open(method,uri,true);if(this._use_default_xhr_header){if(!this._default_headers['X-Requested-With']){this.initHeader('X-Requested-With',this._default_xhr_header,true);}}
if(this._isFormSubmit||(postData&&this._use_default_post_header)){this.initHeader('Content-Type',this._default_post_header);if(this._isFormSubmit){this.resetFormState();}}
if(this._has_default_headers||this._has_http_headers){this.setHeader(o);}
this.handleReadyState(o,callback);o.conn.send(postData||null);this.startEvent.fire(o);if(o.startEvent){o.startEvent.fire(o);}
return o;}},initCustomEvents:function(o,callback)
{for(var prop in callback.customevents){if(this._customEvents[prop][0]){o[this._customEvents[prop][0]]=new YAHOO.util.CustomEvent(this._customEvents[prop][1],(callback.scope)?callback.scope:null);o[this._customEvents[prop][0]].subscribe(callback.customevents[prop]);}}},handleReadyState:function(o,callback)
{var oConn=this;if(callback&&callback.timeout){this._timeOut[o.tId]=window.setTimeout(function(){oConn.abort(o,callback,true);},callback.timeout);}
this._poll[o.tId]=window.setInterval(function(){if(o.conn&&o.conn.readyState===4){window.clearInterval(oConn._poll[o.tId]);delete oConn._poll[o.tId];if(callback&&callback.timeout){window.clearTimeout(oConn._timeOut[o.tId]);delete oConn._timeOut[o.tId];}
oConn.completeEvent.fire(o);if(o.completeEvent){o.completeEvent.fire(o);}
oConn.handleTransactionResponse(o,callback);}},this._polling_interval);},handleTransactionResponse:function(o,callback,isAbort)
{if(!callback){this.releaseObject(o);return;}
var httpStatus,responseObject;try
{if(o.conn.status!==undefined&&o.conn.status!==0){httpStatus=o.conn.status;}
else{httpStatus=13030;}}
catch(e){httpStatus=13030;}
if(httpStatus>=200&&httpStatus<300||httpStatus===1223){responseObject=this.createResponseObject(o,callback.argument);if(callback.success){if(!callback.scope){callback.success(responseObject);}
else{callback.success.apply(callback.scope,[responseObject]);}}
this.successEvent.fire(responseObject);if(o.successEvent){o.successEvent.fire(responseObject);}}
else{switch(httpStatus){case 12002:case 12029:case 12030:case 12031:case 12152:case 13030:responseObject=this.createExceptionObject(o.tId,callback.argument,(isAbort?isAbort:false));if(callback.failure){if(!callback.scope){callback.failure(responseObject);}
else{callback.failure.apply(callback.scope,[responseObject]);}}
break;default:responseObject=this.createResponseObject(o,callback.argument);if(callback.failure){if(!callback.scope){callback.failure(responseObject);}
else{callback.failure.apply(callback.scope,[responseObject]);}}}
this.failureEvent.fire(responseObject);if(o.failureEvent){o.failureEvent.fire(responseObject);}}
this.releaseObject(o);responseObject=null;},createResponseObject:function(o,callbackArg)
{var obj={};var headerObj={};try
{var headerStr=o.conn.getAllResponseHeaders();var header=headerStr.split('\n');for(var i=0;i<header.length;i++){var delimitPos=header[i].indexOf(':');if(delimitPos!=-1){headerObj[header[i].substring(0,delimitPos)]=header[i].substring(delimitPos+2);}}}
catch(e){}
obj.tId=o.tId;obj.status=(o.conn.status==1223)?204:o.conn.status;obj.statusText=(o.conn.status==1223)?"No Content":o.conn.statusText;obj.getResponseHeader=headerObj;obj.getAllResponseHeaders=headerStr;obj.responseText=o.conn.responseText;obj.responseXML=o.conn.responseXML;if(typeof callbackArg!==undefined){obj.argument=callbackArg;}
return obj;},createExceptionObject:function(tId,callbackArg,isAbort)
{var COMM_CODE=0;var COMM_ERROR='communication failure';var ABORT_CODE=-1;var ABORT_ERROR='transaction aborted';var obj={};obj.tId=tId;if(isAbort){obj.status=ABORT_CODE;obj.statusText=ABORT_ERROR;}
else{obj.status=COMM_CODE;obj.statusText=COMM_ERROR;}
if(callbackArg){obj.argument=callbackArg;}
return obj;},initHeader:function(label,value,isDefault)
{var headerObj=(isDefault)?this._default_headers:this._http_headers;if(headerObj[label]===undefined){headerObj[label]=value;}
else{headerObj[label]=value+","+headerObj[label];}
if(isDefault){this._has_default_headers=true;}
else{this._has_http_headers=true;}},setHeader:function(o)
{if(this._has_default_headers){for(var prop in this._default_headers){if(YAHOO.lang.hasOwnProperty(this._default_headers,prop)){o.conn.setRequestHeader(prop,this._default_headers[prop]);}}}
if(this._has_http_headers){for(var prop in this._http_headers){if(YAHOO.lang.hasOwnProperty(this._http_headers,prop)){o.conn.setRequestHeader(prop,this._http_headers[prop]);}}
delete this._http_headers;this._http_headers={};this._has_http_headers=false;}},resetDefaultHeaders:function(){delete this._default_headers;this._default_headers={};this._has_default_headers=false;},setForm:function(formId,isUpload,secureUri)
{this.resetFormState();var oForm;if(typeof formId=='string'){oForm=(document.getElementById(formId)||document.forms[formId]);}
else if(typeof formId=='object'){oForm=formId;}
else{return;}
if(isUpload){var io=this.createFrame(secureUri?secureUri:null);this._isFormSubmit=true;this._isFileUpload=true;this._formNode=oForm;return;}
var oElement,oName,oValue,oDisabled;var hasSubmit=false;for(var i=0;i<oForm.elements.length;i++){oElement=oForm.elements[i];oDisabled=oForm.elements[i].disabled;oName=oForm.elements[i].name;oValue=oForm.elements[i].value;if(!oDisabled&&oName)
{switch(oElement.type)
{case'select-one':case'select-multiple':for(var j=0;j<oElement.options.length;j++){if(oElement.options[j].selected){if(window.ActiveXObject){this._sFormData+=encodeURIComponent(oName)+'='+encodeURIComponent(oElement.options[j].attributes['value'].specified?oElement.options[j].value:oElement.options[j].text)+'&';}
else{this._sFormData+=encodeURIComponent(oName)+'='+encodeURIComponent(oElement.options[j].hasAttribute('value')?oElement.options[j].value:oElement.options[j].text)+'&';}}}
break;case'radio':case'checkbox':if(oElement.checked){this._sFormData+=encodeURIComponent(oName)+'='+encodeURIComponent(oValue)+'&';}
break;case'file':case undefined:case'reset':case'button':break;case'submit':if(hasSubmit===false){if(this._hasSubmitListener&&this._submitElementValue){this._sFormData+=this._submitElementValue+'&';}
else{this._sFormData+=encodeURIComponent(oName)+'='+encodeURIComponent(oValue)+'&';}
hasSubmit=true;}
break;default:this._sFormData+=encodeURIComponent(oName)+'='+encodeURIComponent(oValue)+'&';}}}
this._isFormSubmit=true;this._sFormData=this._sFormData.substr(0,this._sFormData.length-1);return this._sFormData;},resetFormState:function(){this._isFormSubmit=false;this._isFileUpload=false;this._formNode=null;this._sFormData="";},createFrame:function(secureUri){var frameId='yuiIO'+this._transaction_id;var io;if(window.ActiveXObject){io=document.createElement('<iframe id="'+frameId+'" name="'+frameId+'" />');if(typeof secureUri=='boolean'){io.src='javascript:false';}
else if(typeof secureURI=='string'){io.src=secureUri;}}
else{io=document.createElement('iframe');io.id=frameId;io.name=frameId;}
io.style.position='absolute';io.style.top='-1000px';io.style.left='-1000px';document.body.appendChild(io);},appendPostData:function(postData)
{var formElements=[];var postMessage=postData.split('&');for(var i=0;i<postMessage.length;i++){var delimitPos=postMessage[i].indexOf('=');if(delimitPos!=-1){formElements[i]=document.createElement('input');formElements[i].type='hidden';formElements[i].name=postMessage[i].substring(0,delimitPos);formElements[i].value=postMessage[i].substring(delimitPos+1);this._formNode.appendChild(formElements[i]);}}
return formElements;},uploadFile:function(o,callback,uri,postData){var frameId='yuiIO'+o.tId;var uploadEncoding='multipart/form-data';var io=document.getElementById(frameId);var oConn=this;var rawFormAttributes={action:this._formNode.getAttribute('action'),method:this._formNode.getAttribute('method'),target:this._formNode.getAttribute('target')};this._formNode.setAttribute('action',uri);this._formNode.setAttribute('method','POST');this._formNode.setAttribute('target',frameId);if(this._formNode.encoding){this._formNode.setAttribute('encoding',uploadEncoding);}
else{this._formNode.setAttribute('enctype',uploadEncoding);}
if(postData){var oElements=this.appendPostData(postData);}
this._formNode.submit();this.startEvent.fire(o);if(o.startEvent){o.startEvent.fire(o);}
if(callback&&callback.timeout){this._timeOut[o.tId]=window.setTimeout(function(){oConn.abort(o,callback,true);},callback.timeout);}
if(oElements&&oElements.length>0){for(var i=0;i<oElements.length;i++){this._formNode.removeChild(oElements[i]);}}
for(var prop in rawFormAttributes){if(YAHOO.lang.hasOwnProperty(rawFormAttributes,prop)){if(rawFormAttributes[prop]){this._formNode.setAttribute(prop,rawFormAttributes[prop]);}
else{this._formNode.removeAttribute(prop);}}}
this.resetFormState();var uploadCallback=function()
{if(callback&&callback.timeout){window.clearTimeout(oConn._timeOut[o.tId]);delete oConn._timeOut[o.tId];}
oConn.completeEvent.fire(o);if(o.completeEvent){o.completeEvent.fire(o);}
var obj={};obj.tId=o.tId;obj.argument=callback.argument;try
{obj.responseText=io.contentWindow.document.body?io.contentWindow.document.body.innerHTML:io.contentWindow.document.documentElement.textContent;obj.responseXML=io.contentWindow.document.XMLDocument?io.contentWindow.document.XMLDocument:io.contentWindow.document;}
catch(e){}
if(callback&&callback.upload){if(!callback.scope){callback.upload(obj);}
else{callback.upload.apply(callback.scope,[obj]);}}
oConn.uploadEvent.fire(obj);if(o.uploadEvent){o.uploadEvent.fire(obj);}
if(YAHOO.util.Event){YAHOO.util.Event.removeListener(io,"load",uploadCallback);}
else if(window.detachEvent){io.detachEvent('onload',uploadCallback);}
else{io.removeEventListener('load',uploadCallback,false);}
setTimeout(function(){document.body.removeChild(io);oConn.releaseObject(o);},100);};if(YAHOO.util.Event){YAHOO.util.Event.addListener(io,"load",uploadCallback);}
else if(window.attachEvent){io.attachEvent('onload',uploadCallback);}
else{io.addEventListener('load',uploadCallback,false);}},abort:function(o,callback,isTimeout)
{var abortStatus;if(o.conn){if(this.isCallInProgress(o)){o.conn.abort();window.clearInterval(this._poll[o.tId]);delete this._poll[o.tId];if(isTimeout){window.clearTimeout(this._timeOut[o.tId]);delete this._timeOut[o.tId];}
abortStatus=true;}}
else if(o.isUpload===true){var frameId='yuiIO'+o.tId;var io=document.getElementById(frameId);if(io){document.body.removeChild(io);if(isTimeout){window.clearTimeout(this._timeOut[o.tId]);delete this._timeOut[o.tId];}
abortStatus=true;}}
else{abortStatus=false;}
if(abortStatus===true){this.abortEvent.fire(o);if(o.abortEvent){o.abortEvent.fire(o);}
this.handleTransactionResponse(o,callback,true);}
else{}
return abortStatus;},isCallInProgress:function(o)
{if(o&&o.conn){return o.conn.readyState!==4&&o.conn.readyState!==0;}
else if(o&&o.isUpload===true){var frameId='yuiIO'+o.tId;return document.getElementById(frameId)?true:false;}
else{return false;}},releaseObject:function(o)
{if(o.conn){o.conn=null;}
o=null;}};YAHOO.register("connection",YAHOO.util.Connect,{version:"2.3.0",build:"442"});

/* File: http://yui.yahooapis.com/2.3.0/build/container/container_core-min.js */

/*
Copyright (c) 2007, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.3.0
*/

(function(){YAHOO.util.Config=function(owner){if(owner){this.init(owner);}
if(!owner){}};var Lang=YAHOO.lang,CustomEvent=YAHOO.util.CustomEvent,Config=YAHOO.util.Config;Config.CONFIG_CHANGED_EVENT="configChanged";Config.BOOLEAN_TYPE="boolean";Config.prototype={owner:null,queueInProgress:false,config:null,initialConfig:null,eventQueue:null,configChangedEvent:null,init:function(owner){this.owner=owner;this.configChangedEvent=this.createEvent(Config.CONFIG_CHANGED_EVENT);this.configChangedEvent.signature=CustomEvent.LIST;this.queueInProgress=false;this.config={};this.initialConfig={};this.eventQueue=[];},checkBoolean:function(val){return(typeof val==Config.BOOLEAN_TYPE);},checkNumber:function(val){return(!isNaN(val));},fireEvent:function(key,value){var property=this.config[key];if(property&&property.event){property.event.fire(value);}},addProperty:function(key,propertyObject){key=key.toLowerCase();this.config[key]=propertyObject;propertyObject.event=this.createEvent(key,{scope:this.owner});propertyObject.event.signature=CustomEvent.LIST;propertyObject.key=key;if(propertyObject.handler){propertyObject.event.subscribe(propertyObject.handler,this.owner);}
this.setProperty(key,propertyObject.value,true);if(!propertyObject.suppressEvent){this.queueProperty(key,propertyObject.value);}},getConfig:function(){var cfg={},prop,property;for(prop in this.config){property=this.config[prop];if(property&&property.event){cfg[prop]=property.value;}}
return cfg;},getProperty:function(key){var property=this.config[key.toLowerCase()];if(property&&property.event){return property.value;}else{return undefined;}},resetProperty:function(key){key=key.toLowerCase();var property=this.config[key];if(property&&property.event){if(this.initialConfig[key]&&!Lang.isUndefined(this.initialConfig[key])){this.setProperty(key,this.initialConfig[key]);return true;}}else{return false;}},setProperty:function(key,value,silent){var property;key=key.toLowerCase();if(this.queueInProgress&&!silent){this.queueProperty(key,value);return true;}else{property=this.config[key];if(property&&property.event){if(property.validator&&!property.validator(value)){return false;}else{property.value=value;if(!silent){this.fireEvent(key,value);this.configChangedEvent.fire([key,value]);}
return true;}}else{return false;}}},queueProperty:function(key,value){key=key.toLowerCase();var property=this.config[key],foundDuplicate=false,iLen,queueItem,queueItemKey,queueItemValue,sLen,supercedesCheck,qLen,queueItemCheck,queueItemCheckKey,queueItemCheckValue,i,s,q;if(property&&property.event){if(!Lang.isUndefined(value)&&property.validator&&!property.validator(value)){return false;}else{if(!Lang.isUndefined(value)){property.value=value;}else{value=property.value;}
foundDuplicate=false;iLen=this.eventQueue.length;for(i=0;i<iLen;i++){queueItem=this.eventQueue[i];if(queueItem){queueItemKey=queueItem[0];queueItemValue=queueItem[1];if(queueItemKey==key){this.eventQueue[i]=null;this.eventQueue.push([key,(!Lang.isUndefined(value)?value:queueItemValue)]);foundDuplicate=true;break;}}}
if(!foundDuplicate&&!Lang.isUndefined(value)){this.eventQueue.push([key,value]);}}
if(property.supercedes){sLen=property.supercedes.length;for(s=0;s<sLen;s++){supercedesCheck=property.supercedes[s];qLen=this.eventQueue.length;for(q=0;q<qLen;q++){queueItemCheck=this.eventQueue[q];if(queueItemCheck){queueItemCheckKey=queueItemCheck[0];queueItemCheckValue=queueItemCheck[1];if(queueItemCheckKey==supercedesCheck.toLowerCase()){this.eventQueue.push([queueItemCheckKey,queueItemCheckValue]);this.eventQueue[q]=null;break;}}}}}
return true;}else{return false;}},refireEvent:function(key){key=key.toLowerCase();var property=this.config[key];if(property&&property.event&&!Lang.isUndefined(property.value)){if(this.queueInProgress){this.queueProperty(key);}else{this.fireEvent(key,property.value);}}},applyConfig:function(userConfig,init){var sKey,oValue,oConfig;if(init){oConfig={};for(sKey in userConfig){if(Lang.hasOwnProperty(userConfig,sKey)){oConfig[sKey.toLowerCase()]=userConfig[sKey];}}
this.initialConfig=oConfig;}
for(sKey in userConfig){if(Lang.hasOwnProperty(userConfig,sKey)){this.queueProperty(sKey,userConfig[sKey]);}}},refresh:function(){var prop;for(prop in this.config){this.refireEvent(prop);}},fireQueue:function(){var i,queueItem,key,value,property;this.queueInProgress=true;for(i=0;i<this.eventQueue.length;i++){queueItem=this.eventQueue[i];if(queueItem){key=queueItem[0];value=queueItem[1];property=this.config[key];property.value=value;this.fireEvent(key,value);}}
this.queueInProgress=false;this.eventQueue=[];},subscribeToConfigEvent:function(key,handler,obj,override){var property=this.config[key.toLowerCase()];if(property&&property.event){if(!Config.alreadySubscribed(property.event,handler,obj)){property.event.subscribe(handler,obj,override);}
return true;}else{return false;}},unsubscribeFromConfigEvent:function(key,handler,obj){var property=this.config[key.toLowerCase()];if(property&&property.event){return property.event.unsubscribe(handler,obj);}else{return false;}},toString:function(){var output="Config";if(this.owner){output+=" ["+this.owner.toString()+"]";}
return output;},outputEventQueue:function(){var output="",queueItem,q,nQueue=this.eventQueue.length;for(q=0;q<nQueue;q++){queueItem=this.eventQueue[q];if(queueItem){output+=queueItem[0]+"="+queueItem[1]+", ";}}
return output;},destroy:function(){var oConfig=this.config,sProperty,oProperty;for(sProperty in oConfig){if(Lang.hasOwnProperty(oConfig,sProperty)){oProperty=oConfig[sProperty];oProperty.event.unsubscribeAll();oProperty.event=null;}}
this.configChangedEvent.unsubscribeAll();this.configChangedEvent=null;this.owner=null;this.config=null;this.initialConfig=null;this.eventQueue=null;}};Config.alreadySubscribed=function(evt,fn,obj){var nSubscribers=evt.subscribers.length,subsc,i;if(nSubscribers>0){i=nSubscribers-1;do{subsc=evt.subscribers[i];if(subsc&&subsc.obj==obj&&subsc.fn==fn){return true;}}
while(i--);}
return false;};YAHOO.lang.augmentProto(Config,YAHOO.util.EventProvider);}());(function(){YAHOO.widget.Module=function(el,userConfig){if(el){this.init(el,userConfig);}else{}};var Dom=YAHOO.util.Dom,Config=YAHOO.util.Config,Event=YAHOO.util.Event,CustomEvent=YAHOO.util.CustomEvent,Module=YAHOO.widget.Module,m_oModuleTemplate,m_oHeaderTemplate,m_oBodyTemplate,m_oFooterTemplate,EVENT_TYPES={"BEFORE_INIT":"beforeInit","INIT":"init","APPEND":"append","BEFORE_RENDER":"beforeRender","RENDER":"render","CHANGE_HEADER":"changeHeader","CHANGE_BODY":"changeBody","CHANGE_FOOTER":"changeFooter","CHANGE_CONTENT":"changeContent","DESTORY":"destroy","BEFORE_SHOW":"beforeShow","SHOW":"show","BEFORE_HIDE":"beforeHide","HIDE":"hide"},DEFAULT_CONFIG={"VISIBLE":{key:"visible",value:true,validator:YAHOO.lang.isBoolean},"EFFECT":{key:"effect",suppressEvent:true,supercedes:["visible"]},"MONITOR_RESIZE":{key:"monitorresize",value:true}};Module.IMG_ROOT=null;Module.IMG_ROOT_SSL=null;Module.CSS_MODULE="yui-module";Module.CSS_HEADER="hd";Module.CSS_BODY="bd";Module.CSS_FOOTER="ft";Module.RESIZE_MONITOR_SECURE_URL="javascript:false;";Module.textResizeEvent=new CustomEvent("textResize");function createModuleTemplate(){if(!m_oModuleTemplate){m_oModuleTemplate=document.createElement("div");m_oModuleTemplate.innerHTML=("<div class=\""+
Module.CSS_HEADER+"\"></div>"+"<div class=\""+
Module.CSS_BODY+"\"></div><div class=\""+
Module.CSS_FOOTER+"\"></div>");m_oHeaderTemplate=m_oModuleTemplate.firstChild;m_oBodyTemplate=m_oHeaderTemplate.nextSibling;m_oFooterTemplate=m_oBodyTemplate.nextSibling;}
return m_oModuleTemplate;}
function createHeader(){if(!m_oHeaderTemplate){createModuleTemplate();}
return(m_oHeaderTemplate.cloneNode(false));}
function createBody(){if(!m_oBodyTemplate){createModuleTemplate();}
return(m_oBodyTemplate.cloneNode(false));}
function createFooter(){if(!m_oFooterTemplate){createModuleTemplate();}
return(m_oFooterTemplate.cloneNode(false));}
Module.prototype={constructor:Module,element:null,header:null,body:null,footer:null,id:null,imageRoot:Module.IMG_ROOT,initEvents:function(){var SIGNATURE=CustomEvent.LIST;this.beforeInitEvent=this.createEvent(EVENT_TYPES.BEFORE_INIT);this.beforeInitEvent.signature=SIGNATURE;this.initEvent=this.createEvent(EVENT_TYPES.INIT);this.initEvent.signature=SIGNATURE;this.appendEvent=this.createEvent(EVENT_TYPES.APPEND);this.appendEvent.signature=SIGNATURE;this.beforeRenderEvent=this.createEvent(EVENT_TYPES.BEFORE_RENDER);this.beforeRenderEvent.signature=SIGNATURE;this.renderEvent=this.createEvent(EVENT_TYPES.RENDER);this.renderEvent.signature=SIGNATURE;this.changeHeaderEvent=this.createEvent(EVENT_TYPES.CHANGE_HEADER);this.changeHeaderEvent.signature=SIGNATURE;this.changeBodyEvent=this.createEvent(EVENT_TYPES.CHANGE_BODY);this.changeBodyEvent.signature=SIGNATURE;this.changeFooterEvent=this.createEvent(EVENT_TYPES.CHANGE_FOOTER);this.changeFooterEvent.signature=SIGNATURE;this.changeContentEvent=this.createEvent(EVENT_TYPES.CHANGE_CONTENT);this.changeContentEvent.signature=SIGNATURE;this.destroyEvent=this.createEvent(EVENT_TYPES.DESTORY);this.destroyEvent.signature=SIGNATURE;this.beforeShowEvent=this.createEvent(EVENT_TYPES.BEFORE_SHOW);this.beforeShowEvent.signature=SIGNATURE;this.showEvent=this.createEvent(EVENT_TYPES.SHOW);this.showEvent.signature=SIGNATURE;this.beforeHideEvent=this.createEvent(EVENT_TYPES.BEFORE_HIDE);this.beforeHideEvent.signature=SIGNATURE;this.hideEvent=this.createEvent(EVENT_TYPES.HIDE);this.hideEvent.signature=SIGNATURE;},platform:function(){var ua=navigator.userAgent.toLowerCase();if(ua.indexOf("windows")!=-1||ua.indexOf("win32")!=-1){return"windows";}else if(ua.indexOf("macintosh")!=-1){return"mac";}else{return false;}}(),browser:function(){var ua=navigator.userAgent.toLowerCase();if(ua.indexOf('opera')!=-1){return'opera';}else if(ua.indexOf('msie 7')!=-1){return'ie7';}else if(ua.indexOf('msie')!=-1){return'ie';}else if(ua.indexOf('safari')!=-1){return'safari';}else if(ua.indexOf('gecko')!=-1){return'gecko';}else{return false;}}(),isSecure:function(){if(window.location.href.toLowerCase().indexOf("https")===0){return true;}else{return false;}}(),initDefaultConfig:function(){this.cfg.addProperty(DEFAULT_CONFIG.VISIBLE.key,{handler:this.configVisible,value:DEFAULT_CONFIG.VISIBLE.value,validator:DEFAULT_CONFIG.VISIBLE.validator});this.cfg.addProperty(DEFAULT_CONFIG.EFFECT.key,{suppressEvent:DEFAULT_CONFIG.EFFECT.suppressEvent,supercedes:DEFAULT_CONFIG.EFFECT.supercedes});this.cfg.addProperty(DEFAULT_CONFIG.MONITOR_RESIZE.key,{handler:this.configMonitorResize,value:DEFAULT_CONFIG.MONITOR_RESIZE.value});},init:function(el,userConfig){var elId,i,child;this.initEvents();this.beforeInitEvent.fire(Module);this.cfg=new Config(this);if(this.isSecure){this.imageRoot=Module.IMG_ROOT_SSL;}
if(typeof el=="string"){elId=el;el=document.getElementById(el);if(!el){el=(createModuleTemplate()).cloneNode(false);el.id=elId;}}
this.element=el;if(el.id){this.id=el.id;}
child=this.element.firstChild;if(child){do{switch(child.className){case Module.CSS_HEADER:this.header=child;break;case Module.CSS_BODY:this.body=child;break;case Module.CSS_FOOTER:this.footer=child;break;}}while((child=child.nextSibling));}
this.initDefaultConfig();Dom.addClass(this.element,Module.CSS_MODULE);if(userConfig){this.cfg.applyConfig(userConfig,true);}
if(!Config.alreadySubscribed(this.renderEvent,this.cfg.fireQueue,this.cfg)){this.renderEvent.subscribe(this.cfg.fireQueue,this.cfg,true);}
this.initEvent.fire(Module);},initResizeMonitor:function(){var oDoc,oIFrame,sHTML;function fireTextResize(){Module.textResizeEvent.fire();}
if(!YAHOO.env.ua.opera){oIFrame=Dom.get("_yuiResizeMonitor");if(!oIFrame){oIFrame=document.createElement("iframe");if(this.isSecure&&Module.RESIZE_MONITOR_SECURE_URL&&YAHOO.env.ua.ie){oIFrame.src=Module.RESIZE_MONITOR_SECURE_URL;}
if(YAHOO.env.ua.gecko){sHTML="<html><head><script "+"type=\"text/javascript\">"+"window.onresize=function(){window.parent."+"YAHOO.widget.Module.textResizeEvent."+"fire();};window.parent.YAHOO.widget.Module."+"textResizeEvent.fire();</script></head>"+"<body></body></html>";oIFrame.src="data:text/html;charset=utf-8,"+
encodeURIComponent(sHTML);}
oIFrame.id="_yuiResizeMonitor";oIFrame.style.position="absolute";oIFrame.style.visibility="hidden";document.body.appendChild(oIFrame);oIFrame.style.width="10em";oIFrame.style.height="10em";oIFrame.style.top=(-1*oIFrame.offsetHeight)+"px";oIFrame.style.left=(-1*oIFrame.offsetWidth)+"px";oIFrame.style.borderWidth="0";oIFrame.style.visibility="visible";if(YAHOO.env.ua.webkit){oDoc=oIFrame.contentWindow.document;oDoc.open();oDoc.close();}}
if(oIFrame&&oIFrame.contentWindow){Module.textResizeEvent.subscribe(this.onDomResize,this,true);if(!Module.textResizeInitialized){if(!Event.on(oIFrame.contentWindow,"resize",fireTextResize)){Event.on(oIFrame,"resize",fireTextResize);}
Module.textResizeInitialized=true;}
this.resizeMonitor=oIFrame;}}},onDomResize:function(e,obj){var nLeft=-1*this.resizeMonitor.offsetWidth,nTop=-1*this.resizeMonitor.offsetHeight;this.resizeMonitor.style.top=nTop+"px";this.resizeMonitor.style.left=nLeft+"px";},setHeader:function(headerContent){var oHeader=this.header||(this.header=createHeader());if(typeof headerContent=="string"){oHeader.innerHTML=headerContent;}else{oHeader.innerHTML="";oHeader.appendChild(headerContent);}
this.changeHeaderEvent.fire(headerContent);this.changeContentEvent.fire();},appendToHeader:function(element){var oHeader=this.header||(this.header=createHeader());oHeader.appendChild(element);this.changeHeaderEvent.fire(element);this.changeContentEvent.fire();},setBody:function(bodyContent){var oBody=this.body||(this.body=createBody());if(typeof bodyContent=="string"){oBody.innerHTML=bodyContent;}else{oBody.innerHTML="";oBody.appendChild(bodyContent);}
this.changeBodyEvent.fire(bodyContent);this.changeContentEvent.fire();},appendToBody:function(element){var oBody=this.body||(this.body=createBody());oBody.appendChild(element);this.changeBodyEvent.fire(element);this.changeContentEvent.fire();},setFooter:function(footerContent){var oFooter=this.footer||(this.footer=createFooter());if(typeof footerContent=="string"){oFooter.innerHTML=footerContent;}else{oFooter.innerHTML="";oFooter.appendChild(footerContent);}
this.changeFooterEvent.fire(footerContent);this.changeContentEvent.fire();},appendToFooter:function(element){var oFooter=this.footer||(this.footer=createFooter());oFooter.appendChild(element);this.changeFooterEvent.fire(element);this.changeContentEvent.fire();},render:function(appendToNode,moduleElement){var me=this,firstChild;function appendTo(element){if(typeof element=="string"){element=document.getElementById(element);}
if(element){element.appendChild(me.element);me.appendEvent.fire();}}
this.beforeRenderEvent.fire();if(!moduleElement){moduleElement=this.element;}
if(appendToNode){appendTo(appendToNode);}else{if(!Dom.inDocument(this.element)){return false;}}
if(this.header&&!Dom.inDocument(this.header)){firstChild=moduleElement.firstChild;if(firstChild){moduleElement.insertBefore(this.header,firstChild);}else{moduleElement.appendChild(this.header);}}
if(this.body&&!Dom.inDocument(this.body)){if(this.footer&&Dom.isAncestor(this.moduleElement,this.footer)){moduleElement.insertBefore(this.body,this.footer);}else{moduleElement.appendChild(this.body);}}
if(this.footer&&!Dom.inDocument(this.footer)){moduleElement.appendChild(this.footer);}
this.renderEvent.fire();return true;},destroy:function(){var parent,e;if(this.element){Event.purgeElement(this.element,true);parent=this.element.parentNode;}
if(parent){parent.removeChild(this.element);}
this.element=null;this.header=null;this.body=null;this.footer=null;Module.textResizeEvent.unsubscribe(this.onDomResize,this);this.cfg.destroy();this.cfg=null;this.destroyEvent.fire();for(e in this){if(e instanceof CustomEvent){e.unsubscribeAll();}}},show:function(){this.cfg.setProperty("visible",true);},hide:function(){this.cfg.setProperty("visible",false);},configVisible:function(type,args,obj){var visible=args[0];if(visible){this.beforeShowEvent.fire();Dom.setStyle(this.element,"display","block");this.showEvent.fire();}else{this.beforeHideEvent.fire();Dom.setStyle(this.element,"display","none");this.hideEvent.fire();}},configMonitorResize:function(type,args,obj){var monitor=args[0];if(monitor){this.initResizeMonitor();}else{Module.textResizeEvent.unsubscribe(this.onDomResize,this,true);this.resizeMonitor=null;}},toString:function(){return"Module "+this.id;}};YAHOO.lang.augmentProto(Module,YAHOO.util.EventProvider);}());(function(){YAHOO.widget.Overlay=function(el,userConfig){YAHOO.widget.Overlay.superclass.constructor.call(this,el,userConfig);};var Lang=YAHOO.lang,CustomEvent=YAHOO.util.CustomEvent,Module=YAHOO.widget.Module,Event=YAHOO.util.Event,Dom=YAHOO.util.Dom,Config=YAHOO.util.Config,Overlay=YAHOO.widget.Overlay,m_oIFrameTemplate,EVENT_TYPES={"BEFORE_MOVE":"beforeMove","MOVE":"move"},DEFAULT_CONFIG={"X":{key:"x",validator:Lang.isNumber,suppressEvent:true,supercedes:["iframe"]},"Y":{key:"y",validator:Lang.isNumber,suppressEvent:true,supercedes:["iframe"]},"XY":{key:"xy",suppressEvent:true,supercedes:["iframe"]},"CONTEXT":{key:"context",suppressEvent:true,supercedes:["iframe"]},"FIXED_CENTER":{key:"fixedcenter",value:false,validator:Lang.isBoolean,supercedes:["iframe","visible"]},"WIDTH":{key:"width",suppressEvent:true,supercedes:["context","fixedcenter","iframe"]},"HEIGHT":{key:"height",suppressEvent:true,supercedes:["context","fixedcenter","iframe"]},"ZINDEX":{key:"zindex",value:null},"CONSTRAIN_TO_VIEWPORT":{key:"constraintoviewport",value:false,validator:Lang.isBoolean,supercedes:["iframe","x","y","xy"]},"IFRAME":{key:"iframe",value:(YAHOO.env.ua.ie==6?true:false),validator:Lang.isBoolean,supercedes:["zindex"]}};Overlay.IFRAME_SRC="javascript:false;";Overlay.IFRAME_OFFSET=3;Overlay.TOP_LEFT="tl";Overlay.TOP_RIGHT="tr";Overlay.BOTTOM_LEFT="bl";Overlay.BOTTOM_RIGHT="br";Overlay.CSS_OVERLAY="yui-overlay";Overlay.windowScrollEvent=new CustomEvent("windowScroll");Overlay.windowResizeEvent=new CustomEvent("windowResize");Overlay.windowScrollHandler=function(e){if(YAHOO.env.ua.ie){if(!window.scrollEnd){window.scrollEnd=-1;}
clearTimeout(window.scrollEnd);window.scrollEnd=setTimeout(function(){Overlay.windowScrollEvent.fire();},1);}else{Overlay.windowScrollEvent.fire();}};Overlay.windowResizeHandler=function(e){if(YAHOO.env.ua.ie){if(!window.resizeEnd){window.resizeEnd=-1;}
clearTimeout(window.resizeEnd);window.resizeEnd=setTimeout(function(){Overlay.windowResizeEvent.fire();},100);}else{Overlay.windowResizeEvent.fire();}};Overlay._initialized=null;if(Overlay._initialized===null){Event.on(window,"scroll",Overlay.windowScrollHandler);Event.on(window,"resize",Overlay.windowResizeHandler);Overlay._initialized=true;}
YAHOO.extend(Overlay,Module,{init:function(el,userConfig){Overlay.superclass.init.call(this,el);this.beforeInitEvent.fire(Overlay);Dom.addClass(this.element,Overlay.CSS_OVERLAY);if(userConfig){this.cfg.applyConfig(userConfig,true);}
if(this.platform=="mac"&&YAHOO.env.ua.gecko){if(!Config.alreadySubscribed(this.showEvent,this.showMacGeckoScrollbars,this)){this.showEvent.subscribe(this.showMacGeckoScrollbars,this,true);}
if(!Config.alreadySubscribed(this.hideEvent,this.hideMacGeckoScrollbars,this)){this.hideEvent.subscribe(this.hideMacGeckoScrollbars,this,true);}}
this.initEvent.fire(Overlay);},initEvents:function(){Overlay.superclass.initEvents.call(this);var SIGNATURE=CustomEvent.LIST;this.beforeMoveEvent=this.createEvent(EVENT_TYPES.BEFORE_MOVE);this.beforeMoveEvent.signature=SIGNATURE;this.moveEvent=this.createEvent(EVENT_TYPES.MOVE);this.moveEvent.signature=SIGNATURE;},initDefaultConfig:function(){Overlay.superclass.initDefaultConfig.call(this);this.cfg.addProperty(DEFAULT_CONFIG.X.key,{handler:this.configX,validator:DEFAULT_CONFIG.X.validator,suppressEvent:DEFAULT_CONFIG.X.suppressEvent,supercedes:DEFAULT_CONFIG.X.supercedes});this.cfg.addProperty(DEFAULT_CONFIG.Y.key,{handler:this.configY,validator:DEFAULT_CONFIG.Y.validator,suppressEvent:DEFAULT_CONFIG.Y.suppressEvent,supercedes:DEFAULT_CONFIG.Y.supercedes});this.cfg.addProperty(DEFAULT_CONFIG.XY.key,{handler:this.configXY,suppressEvent:DEFAULT_CONFIG.XY.suppressEvent,supercedes:DEFAULT_CONFIG.XY.supercedes});this.cfg.addProperty(DEFAULT_CONFIG.CONTEXT.key,{handler:this.configContext,suppressEvent:DEFAULT_CONFIG.CONTEXT.suppressEvent,supercedes:DEFAULT_CONFIG.CONTEXT.supercedes});this.cfg.addProperty(DEFAULT_CONFIG.FIXED_CENTER.key,{handler:this.configFixedCenter,value:DEFAULT_CONFIG.FIXED_CENTER.value,validator:DEFAULT_CONFIG.FIXED_CENTER.validator,supercedes:DEFAULT_CONFIG.FIXED_CENTER.supercedes});this.cfg.addProperty(DEFAULT_CONFIG.WIDTH.key,{handler:this.configWidth,suppressEvent:DEFAULT_CONFIG.WIDTH.suppressEvent,supercedes:DEFAULT_CONFIG.WIDTH.supercedes});this.cfg.addProperty(DEFAULT_CONFIG.HEIGHT.key,{handler:this.configHeight,suppressEvent:DEFAULT_CONFIG.HEIGHT.suppressEvent,supercedes:DEFAULT_CONFIG.HEIGHT.supercedes});this.cfg.addProperty(DEFAULT_CONFIG.ZINDEX.key,{handler:this.configzIndex,value:DEFAULT_CONFIG.ZINDEX.value});this.cfg.addProperty(DEFAULT_CONFIG.CONSTRAIN_TO_VIEWPORT.key,{handler:this.configConstrainToViewport,value:DEFAULT_CONFIG.CONSTRAIN_TO_VIEWPORT.value,validator:DEFAULT_CONFIG.CONSTRAIN_TO_VIEWPORT.validator,supercedes:DEFAULT_CONFIG.CONSTRAIN_TO_VIEWPORT.supercedes});this.cfg.addProperty(DEFAULT_CONFIG.IFRAME.key,{handler:this.configIframe,value:DEFAULT_CONFIG.IFRAME.value,validator:DEFAULT_CONFIG.IFRAME.validator,supercedes:DEFAULT_CONFIG.IFRAME.supercedes});},moveTo:function(x,y){this.cfg.setProperty("xy",[x,y]);},hideMacGeckoScrollbars:function(){Dom.removeClass(this.element,"show-scrollbars");Dom.addClass(this.element,"hide-scrollbars");},showMacGeckoScrollbars:function(){Dom.removeClass(this.element,"hide-scrollbars");Dom.addClass(this.element,"show-scrollbars");},configVisible:function(type,args,obj){var visible=args[0],currentVis=Dom.getStyle(this.element,"visibility"),effect=this.cfg.getProperty("effect"),effectInstances=[],isMacGecko=(this.platform=="mac"&&YAHOO.env.ua.gecko),alreadySubscribed=Config.alreadySubscribed,eff,ei,e,i,j,k,h,nEffects,nEffectInstances;if(currentVis=="inherit"){e=this.element.parentNode;while(e.nodeType!=9&&e.nodeType!=11){currentVis=Dom.getStyle(e,"visibility");if(currentVis!="inherit"){break;}
e=e.parentNode;}
if(currentVis=="inherit"){currentVis="visible";}}
if(effect){if(effect instanceof Array){nEffects=effect.length;for(i=0;i<nEffects;i++){eff=effect[i];effectInstances[effectInstances.length]=eff.effect(this,eff.duration);}}else{effectInstances[effectInstances.length]=effect.effect(this,effect.duration);}}
if(visible){if(isMacGecko){this.showMacGeckoScrollbars();}
if(effect){if(visible){if(currentVis!="visible"||currentVis===""){this.beforeShowEvent.fire();nEffectInstances=effectInstances.length;for(j=0;j<nEffectInstances;j++){ei=effectInstances[j];if(j===0&&!alreadySubscribed(ei.animateInCompleteEvent,this.showEvent.fire,this.showEvent)){ei.animateInCompleteEvent.subscribe(this.showEvent.fire,this.showEvent,true);}
ei.animateIn();}}}}else{if(currentVis!="visible"||currentVis===""){this.beforeShowEvent.fire();Dom.setStyle(this.element,"visibility","visible");this.cfg.refireEvent("iframe");this.showEvent.fire();}}}else{if(isMacGecko){this.hideMacGeckoScrollbars();}
if(effect){if(currentVis=="visible"){this.beforeHideEvent.fire();nEffectInstances=effectInstances.length;for(k=0;k<nEffectInstances;k++){h=effectInstances[k];if(k===0&&!alreadySubscribed(h.animateOutCompleteEvent,this.hideEvent.fire,this.hideEvent)){h.animateOutCompleteEvent.subscribe(this.hideEvent.fire,this.hideEvent,true);}
h.animateOut();}}else if(currentVis===""){Dom.setStyle(this.element,"visibility","hidden");}}else{if(currentVis=="visible"||currentVis===""){this.beforeHideEvent.fire();Dom.setStyle(this.element,"visibility","hidden");this.hideEvent.fire();}}}},doCenterOnDOMEvent:function(){if(this.cfg.getProperty("visible")){this.center();}},configFixedCenter:function(type,args,obj){var val=args[0],alreadySubscribed=Config.alreadySubscribed,windowResizeEvent=Overlay.windowResizeEvent,windowScrollEvent=Overlay.windowScrollEvent;if(val){this.center();if(!alreadySubscribed(this.beforeShowEvent,this.center,this)){this.beforeShowEvent.subscribe(this.center);}
if(!alreadySubscribed(windowResizeEvent,this.doCenterOnDOMEvent,this)){windowResizeEvent.subscribe(this.doCenterOnDOMEvent,this,true);}
if(!alreadySubscribed(windowScrollEvent,this.doCenterOnDOMEvent,this)){windowScrollEvent.subscribe(this.doCenterOnDOMEvent,this,true);}}else{this.beforeShowEvent.unsubscribe(this.center);windowResizeEvent.unsubscribe(this.doCenterOnDOMEvent,this);windowScrollEvent.unsubscribe(this.doCenterOnDOMEvent,this);}},configHeight:function(type,args,obj){var height=args[0],el=this.element;Dom.setStyle(el,"height",height);this.cfg.refireEvent("iframe");},configWidth:function(type,args,obj){var width=args[0],el=this.element;Dom.setStyle(el,"width",width);this.cfg.refireEvent("iframe");},configzIndex:function(type,args,obj){var zIndex=args[0],el=this.element;if(!zIndex){zIndex=Dom.getStyle(el,"zIndex");if(!zIndex||isNaN(zIndex)){zIndex=0;}}
if(this.iframe){if(zIndex<=0){zIndex=1;}
Dom.setStyle(this.iframe,"zIndex",(zIndex-1));}
Dom.setStyle(el,"zIndex",zIndex);this.cfg.setProperty("zIndex",zIndex,true);},configXY:function(type,args,obj){var pos=args[0],x=pos[0],y=pos[1];this.cfg.setProperty("x",x);this.cfg.setProperty("y",y);this.beforeMoveEvent.fire([x,y]);x=this.cfg.getProperty("x");y=this.cfg.getProperty("y");this.cfg.refireEvent("iframe");this.moveEvent.fire([x,y]);},configX:function(type,args,obj){var x=args[0],y=this.cfg.getProperty("y");this.cfg.setProperty("x",x,true);this.cfg.setProperty("y",y,true);this.beforeMoveEvent.fire([x,y]);x=this.cfg.getProperty("x");y=this.cfg.getProperty("y");Dom.setX(this.element,x,true);this.cfg.setProperty("xy",[x,y],true);this.cfg.refireEvent("iframe");this.moveEvent.fire([x,y]);},configY:function(type,args,obj){var x=this.cfg.getProperty("x"),y=args[0];this.cfg.setProperty("x",x,true);this.cfg.setProperty("y",y,true);this.beforeMoveEvent.fire([x,y]);x=this.cfg.getProperty("x");y=this.cfg.getProperty("y");Dom.setY(this.element,y,true);this.cfg.setProperty("xy",[x,y],true);this.cfg.refireEvent("iframe");this.moveEvent.fire([x,y]);},showIframe:function(){var oIFrame=this.iframe,oParentNode;if(oIFrame){oParentNode=this.element.parentNode;if(oParentNode!=oIFrame.parentNode){oParentNode.appendChild(oIFrame);}
oIFrame.style.display="block";}},hideIframe:function(){if(this.iframe){this.iframe.style.display="none";}},syncIframe:function(){var oIFrame=this.iframe,oElement=this.element,nOffset=Overlay.IFRAME_OFFSET,nDimensionOffset=(nOffset*2),aXY;if(oIFrame){oIFrame.style.width=(oElement.offsetWidth+nDimensionOffset+"px");oIFrame.style.height=(oElement.offsetHeight+nDimensionOffset+"px");aXY=this.cfg.getProperty("xy");if(!Lang.isArray(aXY)||(isNaN(aXY[0])||isNaN(aXY[1]))){this.syncPosition();aXY=this.cfg.getProperty("xy");}
Dom.setXY(oIFrame,[(aXY[0]-nOffset),(aXY[1]-nOffset)]);}},configIframe:function(type,args,obj){var bIFrame=args[0];function createIFrame(){var oIFrame=this.iframe,oElement=this.element,oParent,aXY;if(!oIFrame){if(!m_oIFrameTemplate){m_oIFrameTemplate=document.createElement("iframe");if(this.isSecure){m_oIFrameTemplate.src=Overlay.IFRAME_SRC;}
if(YAHOO.env.ua.ie){m_oIFrameTemplate.style.filter="alpha(opacity=0)";m_oIFrameTemplate.frameBorder=0;}
else{m_oIFrameTemplate.style.opacity="0";}
m_oIFrameTemplate.style.position="absolute";m_oIFrameTemplate.style.border="none";m_oIFrameTemplate.style.margin="0";m_oIFrameTemplate.style.padding="0";m_oIFrameTemplate.style.display="none";}
oIFrame=m_oIFrameTemplate.cloneNode(false);oParent=oElement.parentNode;if(oParent){oParent.appendChild(oIFrame);}else{document.body.appendChild(oIFrame);}
this.iframe=oIFrame;}
this.showIframe();this.syncIframe();if(!this._hasIframeEventListeners){this.showEvent.subscribe(this.showIframe);this.hideEvent.subscribe(this.hideIframe);this.changeContentEvent.subscribe(this.syncIframe);this._hasIframeEventListeners=true;}}
function onBeforeShow(){createIFrame.call(this);this.beforeShowEvent.unsubscribe(onBeforeShow);this._iframeDeferred=false;}
if(bIFrame){if(this.cfg.getProperty("visible")){createIFrame.call(this);}
else{if(!this._iframeDeferred){this.beforeShowEvent.subscribe(onBeforeShow);this._iframeDeferred=true;}}}else{this.hideIframe();if(this._hasIframeEventListeners){this.showEvent.unsubscribe(this.showIframe);this.hideEvent.unsubscribe(this.hideIframe);this.changeContentEvent.unsubscribe(this.syncIframe);this._hasIframeEventListeners=false;}}},configConstrainToViewport:function(type,args,obj){var val=args[0];if(val){if(!Config.alreadySubscribed(this.beforeMoveEvent,this.enforceConstraints,this)){this.beforeMoveEvent.subscribe(this.enforceConstraints,this,true);}}else{this.beforeMoveEvent.unsubscribe(this.enforceConstraints,this);}},configContext:function(type,args,obj){var contextArgs=args[0],contextEl,elementMagnetCorner,contextMagnetCorner;if(contextArgs){contextEl=contextArgs[0];elementMagnetCorner=contextArgs[1];contextMagnetCorner=contextArgs[2];if(contextEl){if(typeof contextEl=="string"){this.cfg.setProperty("context",[document.getElementById(contextEl),elementMagnetCorner,contextMagnetCorner],true);}
if(elementMagnetCorner&&contextMagnetCorner){this.align(elementMagnetCorner,contextMagnetCorner);}}}},align:function(elementAlign,contextAlign){var contextArgs=this.cfg.getProperty("context"),me=this,context,element,contextRegion;function doAlign(v,h){switch(elementAlign){case Overlay.TOP_LEFT:me.moveTo(h,v);break;case Overlay.TOP_RIGHT:me.moveTo((h-element.offsetWidth),v);break;case Overlay.BOTTOM_LEFT:me.moveTo(h,(v-element.offsetHeight));break;case Overlay.BOTTOM_RIGHT:me.moveTo((h-element.offsetWidth),(v-element.offsetHeight));break;}}
if(contextArgs){context=contextArgs[0];element=this.element;me=this;if(!elementAlign){elementAlign=contextArgs[1];}
if(!contextAlign){contextAlign=contextArgs[2];}
if(element&&context){contextRegion=Dom.getRegion(context);switch(contextAlign){case Overlay.TOP_LEFT:doAlign(contextRegion.top,contextRegion.left);break;case Overlay.TOP_RIGHT:doAlign(contextRegion.top,contextRegion.right);break;case Overlay.BOTTOM_LEFT:doAlign(contextRegion.bottom,contextRegion.left);break;case Overlay.BOTTOM_RIGHT:doAlign(contextRegion.bottom,contextRegion.right);break;}}}},enforceConstraints:function(type,args,obj){var pos=args[0],x=pos[0],y=pos[1],offsetHeight=this.element.offsetHeight,offsetWidth=this.element.offsetWidth,viewPortWidth=Dom.getViewportWidth(),viewPortHeight=Dom.getViewportHeight(),scrollX=Dom.getDocumentScrollLeft(),scrollY=Dom.getDocumentScrollTop(),topConstraint=scrollY+10,leftConstraint=scrollX+10,bottomConstraint=scrollY+viewPortHeight-offsetHeight-10,rightConstraint=scrollX+viewPortWidth-offsetWidth-10;if(x<leftConstraint){x=leftConstraint;}else if(x>rightConstraint){x=rightConstraint;}
if(y<topConstraint){y=topConstraint;}else if(y>bottomConstraint){y=bottomConstraint;}
this.cfg.setProperty("x",x,true);this.cfg.setProperty("y",y,true);this.cfg.setProperty("xy",[x,y],true);},center:function(){var scrollX=Dom.getDocumentScrollLeft(),scrollY=Dom.getDocumentScrollTop(),viewPortWidth=Dom.getClientWidth(),viewPortHeight=Dom.getClientHeight(),elementWidth=this.element.offsetWidth,elementHeight=this.element.offsetHeight,x=(viewPortWidth/2)-(elementWidth/2)+scrollX,y=(viewPortHeight/2)-(elementHeight/2)+scrollY;this.cfg.setProperty("xy",[parseInt(x,10),parseInt(y,10)]);this.cfg.refireEvent("iframe");},syncPosition:function(){var pos=Dom.getXY(this.element);this.cfg.setProperty("x",pos[0],true);this.cfg.setProperty("y",pos[1],true);this.cfg.setProperty("xy",pos,true);},onDomResize:function(e,obj){var me=this;Overlay.superclass.onDomResize.call(this,e,obj);setTimeout(function(){me.syncPosition();me.cfg.refireEvent("iframe");me.cfg.refireEvent("context");},0);},bringToTop:function(){var aOverlays=[],oElement=this.element;function compareZIndexDesc(p_oOverlay1,p_oOverlay2){var sZIndex1=Dom.getStyle(p_oOverlay1,"zIndex"),sZIndex2=Dom.getStyle(p_oOverlay2,"zIndex"),nZIndex1=(!sZIndex1||isNaN(sZIndex1))?0:parseInt(sZIndex1,10),nZIndex2=(!sZIndex2||isNaN(sZIndex2))?0:parseInt(sZIndex2,10);if(nZIndex1>nZIndex2){return-1;}else if(nZIndex1<nZIndex2){return 1;}else{return 0;}}
function isOverlayElement(p_oElement){var oOverlay=Dom.hasClass(p_oElement,Overlay.CSS_OVERLAY),Panel=YAHOO.widget.Panel;if(oOverlay&&!Dom.isAncestor(oElement,oOverlay)){if(Panel&&Dom.hasClass(p_oElement,Panel.CSS_PANEL)){aOverlays[aOverlays.length]=p_oElement.parentNode;}
else{aOverlays[aOverlays.length]=p_oElement;}}}
Dom.getElementsBy(isOverlayElement,"DIV",document.body);aOverlays.sort(compareZIndexDesc);var oTopOverlay=aOverlays[0],nTopZIndex;if(oTopOverlay){nTopZIndex=Dom.getStyle(oTopOverlay,"zIndex");if(!isNaN(nTopZIndex)&&oTopOverlay!=oElement){this.cfg.setProperty("zindex",(parseInt(nTopZIndex,10)+2));}}},destroy:function(){if(this.iframe){this.iframe.parentNode.removeChild(this.iframe);}
this.iframe=null;Overlay.windowResizeEvent.unsubscribe(this.doCenterOnDOMEvent,this);Overlay.windowScrollEvent.unsubscribe(this.doCenterOnDOMEvent,this);Overlay.superclass.destroy.call(this);},toString:function(){return"Overlay "+this.id;}});}());(function(){YAHOO.widget.OverlayManager=function(userConfig){this.init(userConfig);};var Overlay=YAHOO.widget.Overlay,Event=YAHOO.util.Event,Dom=YAHOO.util.Dom,Config=YAHOO.util.Config,CustomEvent=YAHOO.util.CustomEvent,OverlayManager=YAHOO.widget.OverlayManager;OverlayManager.CSS_FOCUSED="focused";OverlayManager.prototype={constructor:OverlayManager,overlays:null,initDefaultConfig:function(){this.cfg.addProperty("overlays",{suppressEvent:true});this.cfg.addProperty("focusevent",{value:"mousedown"});},init:function(userConfig){this.cfg=new Config(this);this.initDefaultConfig();if(userConfig){this.cfg.applyConfig(userConfig,true);}
this.cfg.fireQueue();var activeOverlay=null;this.getActive=function(){return activeOverlay;};this.focus=function(overlay){var o=this.find(overlay);if(o){if(activeOverlay!=o){if(activeOverlay){activeOverlay.blur();}
this.bringToTop(o);activeOverlay=o;Dom.addClass(activeOverlay.element,OverlayManager.CSS_FOCUSED);o.focusEvent.fire();}}};this.remove=function(overlay){var o=this.find(overlay),originalZ;if(o){if(activeOverlay==o){activeOverlay=null;}
originalZ=Dom.getStyle(o.element,"zIndex");o.cfg.setProperty("zIndex",-1000,true);this.overlays.sort(this.compareZIndexDesc);this.overlays=this.overlays.slice(0,(this.overlays.length-1));o.hideEvent.unsubscribe(o.blur);o.destroyEvent.unsubscribe(this._onOverlayDestroy,o);if(o.element){Event.removeListener(o.element,this.cfg.getProperty("focusevent"),this._onOverlayElementFocus);}
o.cfg.setProperty("zIndex",originalZ,true);o.cfg.setProperty("manager",null);o.focusEvent.unsubscribeAll();o.blurEvent.unsubscribeAll();o.focusEvent=null;o.blurEvent=null;o.focus=null;o.blur=null;}};this.blurAll=function(){var nOverlays=this.overlays.length,i;if(nOverlays>0){i=nOverlays-1;do{this.overlays[i].blur();}
while(i--);}};this._onOverlayBlur=function(p_sType,p_aArgs){activeOverlay=null;};var overlays=this.cfg.getProperty("overlays");if(!this.overlays){this.overlays=[];}
if(overlays){this.register(overlays);this.overlays.sort(this.compareZIndexDesc);}},_onOverlayElementFocus:function(p_oEvent){var oTarget=Event.getTarget(p_oEvent),oClose=this.close;if(oClose&&(oTarget==oClose||Dom.isAncestor(oClose,oTarget))){this.blur();}
else{this.focus();}},_onOverlayDestroy:function(p_sType,p_aArgs,p_oOverlay){this.remove(p_oOverlay);},register:function(overlay){var mgr=this,zIndex,regcount,i,nOverlays;if(overlay instanceof Overlay){overlay.cfg.addProperty("manager",{value:this});overlay.focusEvent=overlay.createEvent("focus");overlay.focusEvent.signature=CustomEvent.LIST;overlay.blurEvent=overlay.createEvent("blur");overlay.blurEvent.signature=CustomEvent.LIST;overlay.focus=function(){mgr.focus(this);};overlay.blur=function(){if(mgr.getActive()==this){Dom.removeClass(this.element,OverlayManager.CSS_FOCUSED);this.blurEvent.fire();}};overlay.blurEvent.subscribe(mgr._onOverlayBlur);overlay.hideEvent.subscribe(overlay.blur);overlay.destroyEvent.subscribe(this._onOverlayDestroy,overlay,this);Event.on(overlay.element,this.cfg.getProperty("focusevent"),this._onOverlayElementFocus,null,overlay);zIndex=Dom.getStyle(overlay.element,"zIndex");if(!isNaN(zIndex)){overlay.cfg.setProperty("zIndex",parseInt(zIndex,10));}else{overlay.cfg.setProperty("zIndex",0);}
this.overlays.push(overlay);this.bringToTop(overlay);return true;}else if(overlay instanceof Array){regcount=0;nOverlays=overlay.length;for(i=0;i<nOverlays;i++){if(this.register(overlay[i])){regcount++;}}
if(regcount>0){return true;}}else{return false;}},bringToTop:function(p_oOverlay){var oOverlay=this.find(p_oOverlay),nTopZIndex,oTopOverlay,aOverlays;if(oOverlay){aOverlays=this.overlays;aOverlays.sort(this.compareZIndexDesc);oTopOverlay=aOverlays[0];if(oTopOverlay){nTopZIndex=Dom.getStyle(oTopOverlay.element,"zIndex");if(!isNaN(nTopZIndex)&&oTopOverlay!=oOverlay){oOverlay.cfg.setProperty("zIndex",(parseInt(nTopZIndex,10)+2));}
aOverlays.sort(this.compareZIndexDesc);}}},find:function(overlay){var aOverlays=this.overlays,nOverlays=aOverlays.length,i;if(nOverlays>0){i=nOverlays-1;if(overlay instanceof Overlay){do{if(aOverlays[i]==overlay){return aOverlays[i];}}
while(i--);}else if(typeof overlay=="string"){do{if(aOverlays[i].id==overlay){return aOverlays[i];}}
while(i--);}
return null;}},compareZIndexDesc:function(o1,o2){var zIndex1=o1.cfg.getProperty("zIndex"),zIndex2=o2.cfg.getProperty("zIndex");if(zIndex1>zIndex2){return-1;}else if(zIndex1<zIndex2){return 1;}else{return 0;}},showAll:function(){var aOverlays=this.overlays,nOverlays=aOverlays.length,i;if(nOverlays>0){i=nOverlays-1;do{aOverlays[i].show();}
while(i--);}},hideAll:function(){var aOverlays=this.overlays,nOverlays=aOverlays.length,i;if(nOverlays>0){i=nOverlays-1;do{aOverlays[i].hide();}
while(i--);}},toString:function(){return"OverlayManager";}};}());(function(){YAHOO.widget.ContainerEffect=function(overlay,attrIn,attrOut,targetElement,animClass){if(!animClass){animClass=YAHOO.util.Anim;}
this.overlay=overlay;this.attrIn=attrIn;this.attrOut=attrOut;this.targetElement=targetElement||overlay.element;this.animClass=animClass;};var Dom=YAHOO.util.Dom,CustomEvent=YAHOO.util.CustomEvent,Easing=YAHOO.util.Easing,ContainerEffect=YAHOO.widget.ContainerEffect;ContainerEffect.FADE=function(overlay,dur){var fade=new ContainerEffect(overlay,{attributes:{opacity:{from:0,to:1}},duration:dur,method:Easing.easeIn},{attributes:{opacity:{to:0}},duration:dur,method:Easing.easeOut},overlay.element);fade.handleStartAnimateIn=function(type,args,obj){Dom.addClass(obj.overlay.element,"hide-select");if(!obj.overlay.underlay){obj.overlay.cfg.refireEvent("underlay");}
if(obj.overlay.underlay){obj.initialUnderlayOpacity=Dom.getStyle(obj.overlay.underlay,"opacity");obj.overlay.underlay.style.filter=null;}
Dom.setStyle(obj.overlay.element,"visibility","visible");Dom.setStyle(obj.overlay.element,"opacity",0);};fade.handleCompleteAnimateIn=function(type,args,obj){Dom.removeClass(obj.overlay.element,"hide-select");if(obj.overlay.element.style.filter){obj.overlay.element.style.filter=null;}
if(obj.overlay.underlay){Dom.setStyle(obj.overlay.underlay,"opacity",obj.initialUnderlayOpacity);}
obj.overlay.cfg.refireEvent("iframe");obj.animateInCompleteEvent.fire();};fade.handleStartAnimateOut=function(type,args,obj){Dom.addClass(obj.overlay.element,"hide-select");if(obj.overlay.underlay){obj.overlay.underlay.style.filter=null;}};fade.handleCompleteAnimateOut=function(type,args,obj){Dom.removeClass(obj.overlay.element,"hide-select");if(obj.overlay.element.style.filter){obj.overlay.element.style.filter=null;}
Dom.setStyle(obj.overlay.element,"visibility","hidden");Dom.setStyle(obj.overlay.element,"opacity",1);obj.overlay.cfg.refireEvent("iframe");obj.animateOutCompleteEvent.fire();};fade.init();return fade;};ContainerEffect.SLIDE=function(overlay,dur){var x=overlay.cfg.getProperty("x")||Dom.getX(overlay.element),y=overlay.cfg.getProperty("y")||Dom.getY(overlay.element),clientWidth=Dom.getClientWidth(),offsetWidth=overlay.element.offsetWidth,slide=new ContainerEffect(overlay,{attributes:{points:{to:[x,y]}},duration:dur,method:Easing.easeIn},{attributes:{points:{to:[(clientWidth+25),y]}},duration:dur,method:Easing.easeOut},overlay.element,YAHOO.util.Motion);slide.handleStartAnimateIn=function(type,args,obj){obj.overlay.element.style.left=((-25)-offsetWidth)+"px";obj.overlay.element.style.top=y+"px";};slide.handleTweenAnimateIn=function(type,args,obj){var pos=Dom.getXY(obj.overlay.element),currentX=pos[0],currentY=pos[1];if(Dom.getStyle(obj.overlay.element,"visibility")=="hidden"&&currentX<x){Dom.setStyle(obj.overlay.element,"visibility","visible");}
obj.overlay.cfg.setProperty("xy",[currentX,currentY],true);obj.overlay.cfg.refireEvent("iframe");};slide.handleCompleteAnimateIn=function(type,args,obj){obj.overlay.cfg.setProperty("xy",[x,y],true);obj.startX=x;obj.startY=y;obj.overlay.cfg.refireEvent("iframe");obj.animateInCompleteEvent.fire();};slide.handleStartAnimateOut=function(type,args,obj){var vw=Dom.getViewportWidth(),pos=Dom.getXY(obj.overlay.element),yso=pos[1],currentTo=obj.animOut.attributes.points.to;obj.animOut.attributes.points.to=[(vw+25),yso];};slide.handleTweenAnimateOut=function(type,args,obj){var pos=Dom.getXY(obj.overlay.element),xto=pos[0],yto=pos[1];obj.overlay.cfg.setProperty("xy",[xto,yto],true);obj.overlay.cfg.refireEvent("iframe");};slide.handleCompleteAnimateOut=function(type,args,obj){Dom.setStyle(obj.overlay.element,"visibility","hidden");obj.overlay.cfg.setProperty("xy",[x,y]);obj.animateOutCompleteEvent.fire();};slide.init();return slide;};ContainerEffect.prototype={init:function(){this.beforeAnimateInEvent=this.createEvent("beforeAnimateIn");this.beforeAnimateInEvent.signature=CustomEvent.LIST;this.beforeAnimateOutEvent=this.createEvent("beforeAnimateOut");this.beforeAnimateOutEvent.signature=CustomEvent.LIST;this.animateInCompleteEvent=this.createEvent("animateInComplete");this.animateInCompleteEvent.signature=CustomEvent.LIST;this.animateOutCompleteEvent=this.createEvent("animateOutComplete");this.animateOutCompleteEvent.signature=CustomEvent.LIST;this.animIn=new this.animClass(this.targetElement,this.attrIn.attributes,this.attrIn.duration,this.attrIn.method);this.animIn.onStart.subscribe(this.handleStartAnimateIn,this);this.animIn.onTween.subscribe(this.handleTweenAnimateIn,this);this.animIn.onComplete.subscribe(this.handleCompleteAnimateIn,this);this.animOut=new this.animClass(this.targetElement,this.attrOut.attributes,this.attrOut.duration,this.attrOut.method);this.animOut.onStart.subscribe(this.handleStartAnimateOut,this);this.animOut.onTween.subscribe(this.handleTweenAnimateOut,this);this.animOut.onComplete.subscribe(this.handleCompleteAnimateOut,this);},animateIn:function(){this.beforeAnimateInEvent.fire();this.animIn.animate();},animateOut:function(){this.beforeAnimateOutEvent.fire();this.animOut.animate();},handleStartAnimateIn:function(type,args,obj){},handleTweenAnimateIn:function(type,args,obj){},handleCompleteAnimateIn:function(type,args,obj){},handleStartAnimateOut:function(type,args,obj){},handleTweenAnimateOut:function(type,args,obj){},handleCompleteAnimateOut:function(type,args,obj){},toString:function(){var output="ContainerEffect";if(this.overlay){output+=" ["+this.overlay.toString()+"]";}
return output;}};YAHOO.lang.augmentProto(ContainerEffect,YAHOO.util.EventProvider);})();YAHOO.register("container_core",YAHOO.widget.Module,{version:"2.3.0",build:"442"});

/* File: http://yui.yahooapis.com/2.3.0/build/animation/animation-min.js */

/*
Copyright (c) 2007, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.3.0
*/

YAHOO.util.Anim=function(el,attributes,duration,method){if(!el){}
this.init(el,attributes,duration,method);};YAHOO.util.Anim.prototype={toString:function(){var el=this.getEl();var id=el.id||el.tagName||el;return("Anim "+id);},patterns:{noNegatives:/width|height|opacity|padding/i,offsetAttribute:/^((width|height)|(top|left))$/,defaultUnit:/width|height|top$|bottom$|left$|right$/i,offsetUnit:/\d+(em|%|en|ex|pt|in|cm|mm|pc)$/i},doMethod:function(attr,start,end){return this.method(this.currentFrame,start,end-start,this.totalFrames);},setAttribute:function(attr,val,unit){if(this.patterns.noNegatives.test(attr)){val=(val>0)?val:0;}
YAHOO.util.Dom.setStyle(this.getEl(),attr,val+unit);},getAttribute:function(attr){var el=this.getEl();var val=YAHOO.util.Dom.getStyle(el,attr);if(val!=='auto'&&!this.patterns.offsetUnit.test(val)){return parseFloat(val);}
var a=this.patterns.offsetAttribute.exec(attr)||[];var pos=!!(a[3]);var box=!!(a[2]);if(box||(YAHOO.util.Dom.getStyle(el,'position')=='absolute'&&pos)){val=el['offset'+a[0].charAt(0).toUpperCase()+a[0].substr(1)];}else{val=0;}
return val;},getDefaultUnit:function(attr){if(this.patterns.defaultUnit.test(attr)){return'px';}
return'';},setRuntimeAttribute:function(attr){var start;var end;var attributes=this.attributes;this.runtimeAttributes[attr]={};var isset=function(prop){return(typeof prop!=='undefined');};if(!isset(attributes[attr]['to'])&&!isset(attributes[attr]['by'])){return false;}
start=(isset(attributes[attr]['from']))?attributes[attr]['from']:this.getAttribute(attr);if(isset(attributes[attr]['to'])){end=attributes[attr]['to'];}else if(isset(attributes[attr]['by'])){if(start.constructor==Array){end=[];for(var i=0,len=start.length;i<len;++i){end[i]=start[i]+attributes[attr]['by'][i]*1;}}else{end=start+attributes[attr]['by']*1;}}
this.runtimeAttributes[attr].start=start;this.runtimeAttributes[attr].end=end;this.runtimeAttributes[attr].unit=(isset(attributes[attr].unit))?attributes[attr]['unit']:this.getDefaultUnit(attr);return true;},init:function(el,attributes,duration,method){var isAnimated=false;var startTime=null;var actualFrames=0;el=YAHOO.util.Dom.get(el);this.attributes=attributes||{};this.duration=!YAHOO.lang.isUndefined(duration)?duration:1;this.method=method||YAHOO.util.Easing.easeNone;this.useSeconds=true;this.currentFrame=0;this.totalFrames=YAHOO.util.AnimMgr.fps;this.setEl=function(element){el=YAHOO.util.Dom.get(element);};this.getEl=function(){return el;};this.isAnimated=function(){return isAnimated;};this.getStartTime=function(){return startTime;};this.runtimeAttributes={};this.animate=function(){if(this.isAnimated()){return false;}
this.currentFrame=0;this.totalFrames=(this.useSeconds)?Math.ceil(YAHOO.util.AnimMgr.fps*this.duration):this.duration;if(this.duration===0&&this.useSeconds){this.totalFrames=1;}
YAHOO.util.AnimMgr.registerElement(this);return true;};this.stop=function(finish){if(finish){this.currentFrame=this.totalFrames;this._onTween.fire();}
YAHOO.util.AnimMgr.stop(this);};var onStart=function(){this.onStart.fire();this.runtimeAttributes={};for(var attr in this.attributes){this.setRuntimeAttribute(attr);}
isAnimated=true;actualFrames=0;startTime=new Date();};var onTween=function(){var data={duration:new Date()-this.getStartTime(),currentFrame:this.currentFrame};data.toString=function(){return('duration: '+data.duration+', currentFrame: '+data.currentFrame);};this.onTween.fire(data);var runtimeAttributes=this.runtimeAttributes;for(var attr in runtimeAttributes){this.setAttribute(attr,this.doMethod(attr,runtimeAttributes[attr].start,runtimeAttributes[attr].end),runtimeAttributes[attr].unit);}
actualFrames+=1;};var onComplete=function(){var actual_duration=(new Date()-startTime)/1000;var data={duration:actual_duration,frames:actualFrames,fps:actualFrames/actual_duration};data.toString=function(){return('duration: '+data.duration+', frames: '+data.frames+', fps: '+data.fps);};isAnimated=false;actualFrames=0;this.onComplete.fire(data);};this._onStart=new YAHOO.util.CustomEvent('_start',this,true);this.onStart=new YAHOO.util.CustomEvent('start',this);this.onTween=new YAHOO.util.CustomEvent('tween',this);this._onTween=new YAHOO.util.CustomEvent('_tween',this,true);this.onComplete=new YAHOO.util.CustomEvent('complete',this);this._onComplete=new YAHOO.util.CustomEvent('_complete',this,true);this._onStart.subscribe(onStart);this._onTween.subscribe(onTween);this._onComplete.subscribe(onComplete);}};YAHOO.util.AnimMgr=new function(){var thread=null;var queue=[];var tweenCount=0;this.fps=1000;this.delay=1;this.registerElement=function(tween){queue[queue.length]=tween;tweenCount+=1;tween._onStart.fire();this.start();};this.unRegister=function(tween,index){tween._onComplete.fire();index=index||getIndex(tween);if(index==-1){return false;}
queue.splice(index,1);tweenCount-=1;if(tweenCount<=0){this.stop();}
return true;};this.start=function(){if(thread===null){thread=setInterval(this.run,this.delay);}};this.stop=function(tween){if(!tween){clearInterval(thread);for(var i=0,len=queue.length;i<len;++i){if(queue[0].isAnimated()){this.unRegister(queue[0],0);}}
queue=[];thread=null;tweenCount=0;}
else{this.unRegister(tween);}};this.run=function(){for(var i=0,len=queue.length;i<len;++i){var tween=queue[i];if(!tween||!tween.isAnimated()){continue;}
if(tween.currentFrame<tween.totalFrames||tween.totalFrames===null)
{tween.currentFrame+=1;if(tween.useSeconds){correctFrame(tween);}
tween._onTween.fire();}
else{YAHOO.util.AnimMgr.stop(tween,i);}}};var getIndex=function(anim){for(var i=0,len=queue.length;i<len;++i){if(queue[i]==anim){return i;}}
return-1;};var correctFrame=function(tween){var frames=tween.totalFrames;var frame=tween.currentFrame;var expected=(tween.currentFrame*tween.duration*1000/tween.totalFrames);var elapsed=(new Date()-tween.getStartTime());var tweak=0;if(elapsed<tween.duration*1000){tweak=Math.round((elapsed/expected-1)*tween.currentFrame);}else{tweak=frames-(frame+1);}
if(tweak>0&&isFinite(tweak)){if(tween.currentFrame+tweak>=frames){tweak=frames-(frame+1);}
tween.currentFrame+=tweak;}};};YAHOO.util.Bezier=new function(){this.getPosition=function(points,t){var n=points.length;var tmp=[];for(var i=0;i<n;++i){tmp[i]=[points[i][0],points[i][1]];}
for(var j=1;j<n;++j){for(i=0;i<n-j;++i){tmp[i][0]=(1-t)*tmp[i][0]+t*tmp[parseInt(i+1,10)][0];tmp[i][1]=(1-t)*tmp[i][1]+t*tmp[parseInt(i+1,10)][1];}}
return[tmp[0][0],tmp[0][1]];};};(function(){YAHOO.util.ColorAnim=function(el,attributes,duration,method){YAHOO.util.ColorAnim.superclass.constructor.call(this,el,attributes,duration,method);};YAHOO.extend(YAHOO.util.ColorAnim,YAHOO.util.Anim);var Y=YAHOO.util;var superclass=Y.ColorAnim.superclass;var proto=Y.ColorAnim.prototype;proto.toString=function(){var el=this.getEl();var id=el.id||el.tagName;return("ColorAnim "+id);};proto.patterns.color=/color$/i;proto.patterns.rgb=/^rgb\(([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\)$/i;proto.patterns.hex=/^#?([0-9A-F]{2})([0-9A-F]{2})([0-9A-F]{2})$/i;proto.patterns.hex3=/^#?([0-9A-F]{1})([0-9A-F]{1})([0-9A-F]{1})$/i;proto.patterns.transparent=/^transparent|rgba\(0, 0, 0, 0\)$/;proto.parseColor=function(s){if(s.length==3){return s;}
var c=this.patterns.hex.exec(s);if(c&&c.length==4){return[parseInt(c[1],16),parseInt(c[2],16),parseInt(c[3],16)];}
c=this.patterns.rgb.exec(s);if(c&&c.length==4){return[parseInt(c[1],10),parseInt(c[2],10),parseInt(c[3],10)];}
c=this.patterns.hex3.exec(s);if(c&&c.length==4){return[parseInt(c[1]+c[1],16),parseInt(c[2]+c[2],16),parseInt(c[3]+c[3],16)];}
return null;};proto.getAttribute=function(attr){var el=this.getEl();if(this.patterns.color.test(attr)){var val=YAHOO.util.Dom.getStyle(el,attr);if(this.patterns.transparent.test(val)){var parent=el.parentNode;val=Y.Dom.getStyle(parent,attr);while(parent&&this.patterns.transparent.test(val)){parent=parent.parentNode;val=Y.Dom.getStyle(parent,attr);if(parent.tagName.toUpperCase()=='HTML'){val='#fff';}}}}else{val=superclass.getAttribute.call(this,attr);}
return val;};proto.doMethod=function(attr,start,end){var val;if(this.patterns.color.test(attr)){val=[];for(var i=0,len=start.length;i<len;++i){val[i]=superclass.doMethod.call(this,attr,start[i],end[i]);}
val='rgb('+Math.floor(val[0])+','+Math.floor(val[1])+','+Math.floor(val[2])+')';}
else{val=superclass.doMethod.call(this,attr,start,end);}
return val;};proto.setRuntimeAttribute=function(attr){superclass.setRuntimeAttribute.call(this,attr);if(this.patterns.color.test(attr)){var attributes=this.attributes;var start=this.parseColor(this.runtimeAttributes[attr].start);var end=this.parseColor(this.runtimeAttributes[attr].end);if(typeof attributes[attr]['to']==='undefined'&&typeof attributes[attr]['by']!=='undefined'){end=this.parseColor(attributes[attr].by);for(var i=0,len=start.length;i<len;++i){end[i]=start[i]+end[i];}}
this.runtimeAttributes[attr].start=start;this.runtimeAttributes[attr].end=end;}};})();YAHOO.util.Easing={easeNone:function(t,b,c,d){return c*t/d+b;},easeIn:function(t,b,c,d){return c*(t/=d)*t+b;},easeOut:function(t,b,c,d){return-c*(t/=d)*(t-2)+b;},easeBoth:function(t,b,c,d){if((t/=d/2)<1){return c/2*t*t+b;}
return-c/2*((--t)*(t-2)-1)+b;},easeInStrong:function(t,b,c,d){return c*(t/=d)*t*t*t+b;},easeOutStrong:function(t,b,c,d){return-c*((t=t/d-1)*t*t*t-1)+b;},easeBothStrong:function(t,b,c,d){if((t/=d/2)<1){return c/2*t*t*t*t+b;}
return-c/2*((t-=2)*t*t*t-2)+b;},elasticIn:function(t,b,c,d,a,p){if(t==0){return b;}
if((t/=d)==1){return b+c;}
if(!p){p=d*.3;}
if(!a||a<Math.abs(c)){a=c;var s=p/4;}
else{var s=p/(2*Math.PI)*Math.asin(c/a);}
return-(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b;},elasticOut:function(t,b,c,d,a,p){if(t==0){return b;}
if((t/=d)==1){return b+c;}
if(!p){p=d*.3;}
if(!a||a<Math.abs(c)){a=c;var s=p/4;}
else{var s=p/(2*Math.PI)*Math.asin(c/a);}
return a*Math.pow(2,-10*t)*Math.sin((t*d-s)*(2*Math.PI)/p)+c+b;},elasticBoth:function(t,b,c,d,a,p){if(t==0){return b;}
if((t/=d/2)==2){return b+c;}
if(!p){p=d*(.3*1.5);}
if(!a||a<Math.abs(c)){a=c;var s=p/4;}
else{var s=p/(2*Math.PI)*Math.asin(c/a);}
if(t<1){return-.5*(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b;}
return a*Math.pow(2,-10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p)*.5+c+b;},backIn:function(t,b,c,d,s){if(typeof s=='undefined'){s=1.70158;}
return c*(t/=d)*t*((s+1)*t-s)+b;},backOut:function(t,b,c,d,s){if(typeof s=='undefined'){s=1.70158;}
return c*((t=t/d-1)*t*((s+1)*t+s)+1)+b;},backBoth:function(t,b,c,d,s){if(typeof s=='undefined'){s=1.70158;}
if((t/=d/2)<1){return c/2*(t*t*(((s*=(1.525))+1)*t-s))+b;}
return c/2*((t-=2)*t*(((s*=(1.525))+1)*t+s)+2)+b;},bounceIn:function(t,b,c,d){return c-YAHOO.util.Easing.bounceOut(d-t,0,c,d)+b;},bounceOut:function(t,b,c,d){if((t/=d)<(1/2.75)){return c*(7.5625*t*t)+b;}else if(t<(2/2.75)){return c*(7.5625*(t-=(1.5/2.75))*t+.75)+b;}else if(t<(2.5/2.75)){return c*(7.5625*(t-=(2.25/2.75))*t+.9375)+b;}
return c*(7.5625*(t-=(2.625/2.75))*t+.984375)+b;},bounceBoth:function(t,b,c,d){if(t<d/2){return YAHOO.util.Easing.bounceIn(t*2,0,c,d)*.5+b;}
return YAHOO.util.Easing.bounceOut(t*2-d,0,c,d)*.5+c*.5+b;}};(function(){YAHOO.util.Motion=function(el,attributes,duration,method){if(el){YAHOO.util.Motion.superclass.constructor.call(this,el,attributes,duration,method);}};YAHOO.extend(YAHOO.util.Motion,YAHOO.util.ColorAnim);var Y=YAHOO.util;var superclass=Y.Motion.superclass;var proto=Y.Motion.prototype;proto.toString=function(){var el=this.getEl();var id=el.id||el.tagName;return("Motion "+id);};proto.patterns.points=/^points$/i;proto.setAttribute=function(attr,val,unit){if(this.patterns.points.test(attr)){unit=unit||'px';superclass.setAttribute.call(this,'left',val[0],unit);superclass.setAttribute.call(this,'top',val[1],unit);}else{superclass.setAttribute.call(this,attr,val,unit);}};proto.getAttribute=function(attr){if(this.patterns.points.test(attr)){var val=[superclass.getAttribute.call(this,'left'),superclass.getAttribute.call(this,'top')];}else{val=superclass.getAttribute.call(this,attr);}
return val;};proto.doMethod=function(attr,start,end){var val=null;if(this.patterns.points.test(attr)){var t=this.method(this.currentFrame,0,100,this.totalFrames)/100;val=Y.Bezier.getPosition(this.runtimeAttributes[attr],t);}else{val=superclass.doMethod.call(this,attr,start,end);}
return val;};proto.setRuntimeAttribute=function(attr){if(this.patterns.points.test(attr)){var el=this.getEl();var attributes=this.attributes;var start;var control=attributes['points']['control']||[];var end;var i,len;if(control.length>0&&!(control[0]instanceof Array)){control=[control];}else{var tmp=[];for(i=0,len=control.length;i<len;++i){tmp[i]=control[i];}
control=tmp;}
if(Y.Dom.getStyle(el,'position')=='static'){Y.Dom.setStyle(el,'position','relative');}
if(isset(attributes['points']['from'])){Y.Dom.setXY(el,attributes['points']['from']);}
else{Y.Dom.setXY(el,Y.Dom.getXY(el));}
start=this.getAttribute('points');if(isset(attributes['points']['to'])){end=translateValues.call(this,attributes['points']['to'],start);var pageXY=Y.Dom.getXY(this.getEl());for(i=0,len=control.length;i<len;++i){control[i]=translateValues.call(this,control[i],start);}}else if(isset(attributes['points']['by'])){end=[start[0]+attributes['points']['by'][0],start[1]+attributes['points']['by'][1]];for(i=0,len=control.length;i<len;++i){control[i]=[start[0]+control[i][0],start[1]+control[i][1]];}}
this.runtimeAttributes[attr]=[start];if(control.length>0){this.runtimeAttributes[attr]=this.runtimeAttributes[attr].concat(control);}
this.runtimeAttributes[attr][this.runtimeAttributes[attr].length]=end;}
else{superclass.setRuntimeAttribute.call(this,attr);}};var translateValues=function(val,start){var pageXY=Y.Dom.getXY(this.getEl());val=[val[0]-pageXY[0]+start[0],val[1]-pageXY[1]+start[1]];return val;};var isset=function(prop){return(typeof prop!=='undefined');};})();(function(){YAHOO.util.Scroll=function(el,attributes,duration,method){if(el){YAHOO.util.Scroll.superclass.constructor.call(this,el,attributes,duration,method);}};YAHOO.extend(YAHOO.util.Scroll,YAHOO.util.ColorAnim);var Y=YAHOO.util;var superclass=Y.Scroll.superclass;var proto=Y.Scroll.prototype;proto.toString=function(){var el=this.getEl();var id=el.id||el.tagName;return("Scroll "+id);};proto.doMethod=function(attr,start,end){var val=null;if(attr=='scroll'){val=[this.method(this.currentFrame,start[0],end[0]-start[0],this.totalFrames),this.method(this.currentFrame,start[1],end[1]-start[1],this.totalFrames)];}else{val=superclass.doMethod.call(this,attr,start,end);}
return val;};proto.getAttribute=function(attr){var val=null;var el=this.getEl();if(attr=='scroll'){val=[el.scrollLeft,el.scrollTop];}else{val=superclass.getAttribute.call(this,attr);}
return val;};proto.setAttribute=function(attr,val,unit){var el=this.getEl();if(attr=='scroll'){el.scrollLeft=val[0];el.scrollTop=val[1];}else{superclass.setAttribute.call(this,attr,val,unit);}};})();YAHOO.register("animation",YAHOO.util.Anim,{version:"2.3.0",build:"442"});

/* File: http://yui.yahooapis.com/2.3.0/build/autocomplete/autocomplete-min.js */

/*
Copyright (c) 2007, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.3.0
*/

YAHOO.widget.AutoComplete=function(elInput,elContainer,oDataSource,oConfigs){if(elInput&&elContainer&&oDataSource){if(oDataSource instanceof YAHOO.widget.DataSource){this.dataSource=oDataSource;}
else{return;}
if(YAHOO.util.Dom.inDocument(elInput)){if(YAHOO.lang.isString(elInput)){this._sName="instance"+YAHOO.widget.AutoComplete._nIndex+" "+elInput;this._oTextbox=document.getElementById(elInput);}
else{this._sName=(elInput.id)?"instance"+YAHOO.widget.AutoComplete._nIndex+" "+elInput.id:"instance"+YAHOO.widget.AutoComplete._nIndex;this._oTextbox=elInput;}
YAHOO.util.Dom.addClass(this._oTextbox,"yui-ac-input");}
else{return;}
if(YAHOO.util.Dom.inDocument(elContainer)){if(YAHOO.lang.isString(elContainer)){this._oContainer=document.getElementById(elContainer);}
else{this._oContainer=elContainer;}
if(this._oContainer.style.display=="none"){}
var elParent=this._oContainer.parentNode;var elTag=elParent.tagName.toLowerCase();while(elParent&&(elParent!="document")){if(elTag=="div"){YAHOO.util.Dom.addClass(elParent,"yui-ac");break;}
else{elParent=elParent.parentNode;elTag=elParent.tagName.toLowerCase();}}
if(elTag!="div"){}}
else{return;}
if(oConfigs&&(oConfigs.constructor==Object)){for(var sConfig in oConfigs){if(sConfig){this[sConfig]=oConfigs[sConfig];}}}
this._initContainer();this._initProps();this._initList();this._initContainerHelpers();var oSelf=this;var oTextbox=this._oTextbox;var oContent=this._oContainer._oContent;YAHOO.util.Event.addListener(oTextbox,"keyup",oSelf._onTextboxKeyUp,oSelf);YAHOO.util.Event.addListener(oTextbox,"keydown",oSelf._onTextboxKeyDown,oSelf);YAHOO.util.Event.addListener(oTextbox,"focus",oSelf._onTextboxFocus,oSelf);YAHOO.util.Event.addListener(oTextbox,"blur",oSelf._onTextboxBlur,oSelf);YAHOO.util.Event.addListener(oContent,"mouseover",oSelf._onContainerMouseover,oSelf);YAHOO.util.Event.addListener(oContent,"mouseout",oSelf._onContainerMouseout,oSelf);YAHOO.util.Event.addListener(oContent,"scroll",oSelf._onContainerScroll,oSelf);YAHOO.util.Event.addListener(oContent,"resize",oSelf._onContainerResize,oSelf);if(oTextbox.form){YAHOO.util.Event.addListener(oTextbox.form,"submit",oSelf._onFormSubmit,oSelf);}
YAHOO.util.Event.addListener(oTextbox,"keypress",oSelf._onTextboxKeyPress,oSelf);this.textboxFocusEvent=new YAHOO.util.CustomEvent("textboxFocus",this);this.textboxKeyEvent=new YAHOO.util.CustomEvent("textboxKey",this);this.dataRequestEvent=new YAHOO.util.CustomEvent("dataRequest",this);this.dataReturnEvent=new YAHOO.util.CustomEvent("dataReturn",this);this.dataErrorEvent=new YAHOO.util.CustomEvent("dataError",this);this.containerExpandEvent=new YAHOO.util.CustomEvent("containerExpand",this);this.typeAheadEvent=new YAHOO.util.CustomEvent("typeAhead",this);this.itemMouseOverEvent=new YAHOO.util.CustomEvent("itemMouseOver",this);this.itemMouseOutEvent=new YAHOO.util.CustomEvent("itemMouseOut",this);this.itemArrowToEvent=new YAHOO.util.CustomEvent("itemArrowTo",this);this.itemArrowFromEvent=new YAHOO.util.CustomEvent("itemArrowFrom",this);this.itemSelectEvent=new YAHOO.util.CustomEvent("itemSelect",this);this.unmatchedItemSelectEvent=new YAHOO.util.CustomEvent("unmatchedItemSelect",this);this.selectionEnforceEvent=new YAHOO.util.CustomEvent("selectionEnforce",this);this.containerCollapseEvent=new YAHOO.util.CustomEvent("containerCollapse",this);this.textboxBlurEvent=new YAHOO.util.CustomEvent("textboxBlur",this);oTextbox.setAttribute("autocomplete","off");YAHOO.widget.AutoComplete._nIndex++;}
else{}};YAHOO.widget.AutoComplete.prototype.dataSource=null;YAHOO.widget.AutoComplete.prototype.minQueryLength=1;YAHOO.widget.AutoComplete.prototype.maxResultsDisplayed=10;YAHOO.widget.AutoComplete.prototype.queryDelay=0.2;YAHOO.widget.AutoComplete.prototype.highlightClassName="yui-ac-highlight";YAHOO.widget.AutoComplete.prototype.prehighlightClassName=null;YAHOO.widget.AutoComplete.prototype.delimChar=null;YAHOO.widget.AutoComplete.prototype.autoHighlight=true;YAHOO.widget.AutoComplete.prototype.typeAhead=false;YAHOO.widget.AutoComplete.prototype.animHoriz=false;YAHOO.widget.AutoComplete.prototype.animVert=true;YAHOO.widget.AutoComplete.prototype.animSpeed=0.3;YAHOO.widget.AutoComplete.prototype.forceSelection=false;YAHOO.widget.AutoComplete.prototype.allowBrowserAutocomplete=true;YAHOO.widget.AutoComplete.prototype.alwaysShowContainer=false;YAHOO.widget.AutoComplete.prototype.useIFrame=false;YAHOO.widget.AutoComplete.prototype.useShadow=false;YAHOO.widget.AutoComplete.prototype.toString=function(){return"AutoComplete "+this._sName;};YAHOO.widget.AutoComplete.prototype.isContainerOpen=function(){return this._bContainerOpen;};YAHOO.widget.AutoComplete.prototype.getListItems=function(){return this._aListItems;};YAHOO.widget.AutoComplete.prototype.getListItemData=function(oListItem){if(oListItem._oResultData){return oListItem._oResultData;}
else{return false;}};YAHOO.widget.AutoComplete.prototype.setHeader=function(sHeader){if(sHeader){if(this._oContainer._oContent._oHeader){this._oContainer._oContent._oHeader.innerHTML=sHeader;this._oContainer._oContent._oHeader.style.display="block";}}
else{this._oContainer._oContent._oHeader.innerHTML="";this._oContainer._oContent._oHeader.style.display="none";}};YAHOO.widget.AutoComplete.prototype.setFooter=function(sFooter){if(sFooter){if(this._oContainer._oContent._oFooter){this._oContainer._oContent._oFooter.innerHTML=sFooter;this._oContainer._oContent._oFooter.style.display="block";}}
else{this._oContainer._oContent._oFooter.innerHTML="";this._oContainer._oContent._oFooter.style.display="none";}};YAHOO.widget.AutoComplete.prototype.setBody=function(sBody){if(sBody){if(this._oContainer._oContent._oBody){this._oContainer._oContent._oBody.innerHTML=sBody;this._oContainer._oContent._oBody.style.display="block";this._oContainer._oContent.style.display="block";}}
else{this._oContainer._oContent._oBody.innerHTML="";this._oContainer._oContent.style.display="none";}
this._maxResultsDisplayed=0;};YAHOO.widget.AutoComplete.prototype.formatResult=function(oResultItem,sQuery){var sResult=oResultItem[0];if(sResult){return sResult;}
else{return"";}};YAHOO.widget.AutoComplete.prototype.doBeforeExpandContainer=function(oTextbox,oContainer,sQuery,aResults){return true;};YAHOO.widget.AutoComplete.prototype.sendQuery=function(sQuery){this._sendQuery(sQuery);};YAHOO.widget.AutoComplete.prototype.doBeforeSendQuery=function(sQuery){return sQuery;};YAHOO.widget.AutoComplete.prototype.destroy=function(){var instanceName=this.toString();var elInput=this._oTextbox;var elContainer=this._oContainer;this.textboxFocusEvent.unsubscribe();this.textboxKeyEvent.unsubscribe();this.dataRequestEvent.unsubscribe();this.dataReturnEvent.unsubscribe();this.dataErrorEvent.unsubscribe();this.containerExpandEvent.unsubscribe();this.typeAheadEvent.unsubscribe();this.itemMouseOverEvent.unsubscribe();this.itemMouseOutEvent.unsubscribe();this.itemArrowToEvent.unsubscribe();this.itemArrowFromEvent.unsubscribe();this.itemSelectEvent.unsubscribe();this.unmatchedItemSelectEvent.unsubscribe();this.selectionEnforceEvent.unsubscribe();this.containerCollapseEvent.unsubscribe();this.textboxBlurEvent.unsubscribe();YAHOO.util.Event.purgeElement(elInput,true);YAHOO.util.Event.purgeElement(elContainer,true);elContainer.innerHTML="";for(var key in this){if(this.hasOwnProperty(key)){this[key]=null;}}};YAHOO.widget.AutoComplete.prototype.textboxFocusEvent=null;YAHOO.widget.AutoComplete.prototype.textboxKeyEvent=null;YAHOO.widget.AutoComplete.prototype.dataRequestEvent=null;YAHOO.widget.AutoComplete.prototype.dataReturnEvent=null;YAHOO.widget.AutoComplete.prototype.dataErrorEvent=null;YAHOO.widget.AutoComplete.prototype.containerExpandEvent=null;YAHOO.widget.AutoComplete.prototype.typeAheadEvent=null;YAHOO.widget.AutoComplete.prototype.itemMouseOverEvent=null;YAHOO.widget.AutoComplete.prototype.itemMouseOutEvent=null;YAHOO.widget.AutoComplete.prototype.itemArrowToEvent=null;YAHOO.widget.AutoComplete.prototype.itemArrowFromEvent=null;YAHOO.widget.AutoComplete.prototype.itemSelectEvent=null;YAHOO.widget.AutoComplete.prototype.unmatchedItemSelectEvent=null;YAHOO.widget.AutoComplete.prototype.selectionEnforceEvent=null;YAHOO.widget.AutoComplete.prototype.containerCollapseEvent=null;YAHOO.widget.AutoComplete.prototype.textboxBlurEvent=null;YAHOO.widget.AutoComplete._nIndex=0;YAHOO.widget.AutoComplete.prototype._sName=null;YAHOO.widget.AutoComplete.prototype._oTextbox=null;YAHOO.widget.AutoComplete.prototype._bFocused=true;YAHOO.widget.AutoComplete.prototype._oAnim=null;YAHOO.widget.AutoComplete.prototype._oContainer=null;YAHOO.widget.AutoComplete.prototype._bContainerOpen=false;YAHOO.widget.AutoComplete.prototype._bOverContainer=false;YAHOO.widget.AutoComplete.prototype._aListItems=null;YAHOO.widget.AutoComplete.prototype._nDisplayedItems=0;YAHOO.widget.AutoComplete.prototype._maxResultsDisplayed=0;YAHOO.widget.AutoComplete.prototype._sCurQuery=null;YAHOO.widget.AutoComplete.prototype._sSavedQuery=null;YAHOO.widget.AutoComplete.prototype._oCurItem=null;YAHOO.widget.AutoComplete.prototype._bItemSelected=false;YAHOO.widget.AutoComplete.prototype._nKeyCode=null;YAHOO.widget.AutoComplete.prototype._nDelayID=-1;YAHOO.widget.AutoComplete.prototype._iFrameSrc="javascript:false;";YAHOO.widget.AutoComplete.prototype._queryInterval=null;YAHOO.widget.AutoComplete.prototype._sLastTextboxValue=null;YAHOO.widget.AutoComplete.prototype._initProps=function(){var minQueryLength=this.minQueryLength;if(!YAHOO.lang.isNumber(minQueryLength)){this.minQueryLength=1;}
var maxResultsDisplayed=this.maxResultsDisplayed;if(!YAHOO.lang.isNumber(maxResultsDisplayed)||(maxResultsDisplayed<1)){this.maxResultsDisplayed=10;}
var queryDelay=this.queryDelay;if(!YAHOO.lang.isNumber(queryDelay)||(queryDelay<0)){this.queryDelay=0.2;}
var delimChar=this.delimChar;if(YAHOO.lang.isString(delimChar)){this.delimChar=[delimChar];}
else if(!YAHOO.lang.isArray(delimChar)){this.delimChar=null;}
var animSpeed=this.animSpeed;if((this.animHoriz||this.animVert)&&YAHOO.util.Anim){if(!YAHOO.lang.isNumber(animSpeed)||(animSpeed<0)){this.animSpeed=0.3;}
if(!this._oAnim){this._oAnim=new YAHOO.util.Anim(this._oContainer._oContent,{},this.animSpeed);}
else{this._oAnim.duration=this.animSpeed;}}
if(this.forceSelection&&delimChar){}};YAHOO.widget.AutoComplete.prototype._initContainerHelpers=function(){if(this.useShadow&&!this._oContainer._oShadow){var oShadow=document.createElement("div");oShadow.className="yui-ac-shadow";this._oContainer._oShadow=this._oContainer.appendChild(oShadow);}
if(this.useIFrame&&!this._oContainer._oIFrame){var oIFrame=document.createElement("iframe");oIFrame.src=this._iFrameSrc;oIFrame.frameBorder=0;oIFrame.scrolling="no";oIFrame.style.position="absolute";oIFrame.style.width="100%";oIFrame.style.height="100%";oIFrame.tabIndex=-1;this._oContainer._oIFrame=this._oContainer.appendChild(oIFrame);}};YAHOO.widget.AutoComplete.prototype._initContainer=function(){YAHOO.util.Dom.addClass(this._oContainer,"yui-ac-container");if(!this._oContainer._oContent){var oContent=document.createElement("div");oContent.className="yui-ac-content";oContent.style.display="none";this._oContainer._oContent=this._oContainer.appendChild(oContent);var oHeader=document.createElement("div");oHeader.className="yui-ac-hd";oHeader.style.display="none";this._oContainer._oContent._oHeader=this._oContainer._oContent.appendChild(oHeader);var oBody=document.createElement("div");oBody.className="yui-ac-bd";this._oContainer._oContent._oBody=this._oContainer._oContent.appendChild(oBody);var oFooter=document.createElement("div");oFooter.className="yui-ac-ft";oFooter.style.display="none";this._oContainer._oContent._oFooter=this._oContainer._oContent.appendChild(oFooter);}
else{}};YAHOO.widget.AutoComplete.prototype._initList=function(){this._aListItems=[];while(this._oContainer._oContent._oBody.hasChildNodes()){var oldListItems=this.getListItems();if(oldListItems){for(var oldi=oldListItems.length-1;oldi>=0;oldi--){oldListItems[oldi]=null;}}
this._oContainer._oContent._oBody.innerHTML="";}
var oList=document.createElement("ul");oList=this._oContainer._oContent._oBody.appendChild(oList);for(var i=0;i<this.maxResultsDisplayed;i++){var oItem=document.createElement("li");oItem=oList.appendChild(oItem);this._aListItems[i]=oItem;this._initListItem(oItem,i);}
this._maxResultsDisplayed=this.maxResultsDisplayed;};YAHOO.widget.AutoComplete.prototype._initListItem=function(oItem,nItemIndex){var oSelf=this;oItem.style.display="none";oItem._nItemIndex=nItemIndex;oItem.mouseover=oItem.mouseout=oItem.onclick=null;YAHOO.util.Event.addListener(oItem,"mouseover",oSelf._onItemMouseover,oSelf);YAHOO.util.Event.addListener(oItem,"mouseout",oSelf._onItemMouseout,oSelf);YAHOO.util.Event.addListener(oItem,"click",oSelf._onItemMouseclick,oSelf);};YAHOO.widget.AutoComplete.prototype._onIMEDetected=function(oSelf){oSelf._enableIntervalDetection();};YAHOO.widget.AutoComplete.prototype._enableIntervalDetection=function(){var currValue=this._oTextbox.value;var lastValue=this._sLastTextboxValue;if(currValue!=lastValue){this._sLastTextboxValue=currValue;this._sendQuery(currValue);}};YAHOO.widget.AutoComplete.prototype._cancelIntervalDetection=function(oSelf){if(oSelf._queryInterval){clearInterval(oSelf._queryInterval);}};YAHOO.widget.AutoComplete.prototype._isIgnoreKey=function(nKeyCode){if((nKeyCode==9)||(nKeyCode==13)||(nKeyCode==16)||(nKeyCode==17)||(nKeyCode>=18&&nKeyCode<=20)||(nKeyCode==27)||(nKeyCode>=33&&nKeyCode<=35)||(nKeyCode>=36&&nKeyCode<=40)||(nKeyCode>=44&&nKeyCode<=45)){return true;}
return false;};YAHOO.widget.AutoComplete.prototype._sendQuery=function(sQuery){if(this.minQueryLength==-1){this._toggleContainer(false);return;}
var aDelimChar=(this.delimChar)?this.delimChar:null;if(aDelimChar){var nDelimIndex=-1;for(var i=aDelimChar.length-1;i>=0;i--){var nNewIndex=sQuery.lastIndexOf(aDelimChar[i]);if(nNewIndex>nDelimIndex){nDelimIndex=nNewIndex;}}
if(aDelimChar[i]==" "){for(var j=aDelimChar.length-1;j>=0;j--){if(sQuery[nDelimIndex-1]==aDelimChar[j]){nDelimIndex--;break;}}}
if(nDelimIndex>-1){var nQueryStart=nDelimIndex+1;while(sQuery.charAt(nQueryStart)==" "){nQueryStart+=1;}
this._sSavedQuery=sQuery.substring(0,nQueryStart);sQuery=sQuery.substr(nQueryStart);}
else if(sQuery.indexOf(this._sSavedQuery)<0){this._sSavedQuery=null;}}
if((sQuery&&(sQuery.length<this.minQueryLength))||(!sQuery&&this.minQueryLength>0)){if(this._nDelayID!=-1){clearTimeout(this._nDelayID);}
this._toggleContainer(false);return;}
sQuery=encodeURIComponent(sQuery);this._nDelayID=-1;sQuery=this.doBeforeSendQuery(sQuery);this.dataRequestEvent.fire(this,sQuery);this.dataSource.getResults(this._populateList,sQuery,this);};YAHOO.widget.AutoComplete.prototype._populateList=function(sQuery,aResults,oSelf){if(aResults===null){oSelf.dataErrorEvent.fire(oSelf,sQuery);}
if(!oSelf._bFocused||!aResults){return;}
var isOpera=(navigator.userAgent.toLowerCase().indexOf("opera")!=-1);var contentStyle=oSelf._oContainer._oContent.style;contentStyle.width=(!isOpera)?null:"";contentStyle.height=(!isOpera)?null:"";var sCurQuery=decodeURIComponent(sQuery);oSelf._sCurQuery=sCurQuery;oSelf._bItemSelected=false;if(oSelf._maxResultsDisplayed!=oSelf.maxResultsDisplayed){oSelf._initList();}
var nItems=Math.min(aResults.length,oSelf.maxResultsDisplayed);oSelf._nDisplayedItems=nItems;if(nItems>0){oSelf._initContainerHelpers();var aItems=oSelf._aListItems;for(var i=nItems-1;i>=0;i--){var oItemi=aItems[i];var oResultItemi=aResults[i];oItemi.innerHTML=oSelf.formatResult(oResultItemi,sCurQuery);oItemi.style.display="list-item";oItemi._sResultKey=oResultItemi[0];oItemi._oResultData=oResultItemi;}
for(var j=aItems.length-1;j>=nItems;j--){var oItemj=aItems[j];oItemj.innerHTML=null;oItemj.style.display="none";oItemj._sResultKey=null;oItemj._oResultData=null;}
var ok=oSelf.doBeforeExpandContainer(oSelf._oTextbox,oSelf._oContainer,sQuery,aResults);oSelf._toggleContainer(ok);if(oSelf.autoHighlight){var oFirstItem=aItems[0];oSelf._toggleHighlight(oFirstItem,"to");oSelf.itemArrowToEvent.fire(oSelf,oFirstItem);oSelf._typeAhead(oFirstItem,sQuery);}
else{oSelf._oCurItem=null;}}
else{oSelf._toggleContainer(false);}
oSelf.dataReturnEvent.fire(oSelf,sQuery,aResults);};YAHOO.widget.AutoComplete.prototype._clearSelection=function(){var sValue=this._oTextbox.value;var sChar=(this.delimChar)?this.delimChar[0]:null;var nIndex=(sChar)?sValue.lastIndexOf(sChar,sValue.length-2):-1;if(nIndex>-1){this._oTextbox.value=sValue.substring(0,nIndex);}
else{this._oTextbox.value="";}
this._sSavedQuery=this._oTextbox.value;this.selectionEnforceEvent.fire(this);};YAHOO.widget.AutoComplete.prototype._textMatchesOption=function(){var foundMatch=null;for(var i=this._nDisplayedItems-1;i>=0;i--){var oItem=this._aListItems[i];var sMatch=oItem._sResultKey.toLowerCase();if(sMatch==this._sCurQuery.toLowerCase()){foundMatch=oItem;break;}}
return(foundMatch);};YAHOO.widget.AutoComplete.prototype._typeAhead=function(oItem,sQuery){if(!this.typeAhead||(this._nKeyCode==8)){return;}
var oTextbox=this._oTextbox;var sValue=this._oTextbox.value;if(!oTextbox.setSelectionRange&&!oTextbox.createTextRange){return;}
var nStart=sValue.length;this._updateValue(oItem);var nEnd=oTextbox.value.length;this._selectText(oTextbox,nStart,nEnd);var sPrefill=oTextbox.value.substr(nStart,nEnd);this.typeAheadEvent.fire(this,sQuery,sPrefill);};YAHOO.widget.AutoComplete.prototype._selectText=function(oTextbox,nStart,nEnd){if(oTextbox.setSelectionRange){oTextbox.setSelectionRange(nStart,nEnd);}
else if(oTextbox.createTextRange){var oTextRange=oTextbox.createTextRange();oTextRange.moveStart("character",nStart);oTextRange.moveEnd("character",nEnd-oTextbox.value.length);oTextRange.select();}
else{oTextbox.select();}};YAHOO.widget.AutoComplete.prototype._toggleContainerHelpers=function(bShow){var bFireEvent=false;var width=this._oContainer._oContent.offsetWidth+"px";var height=this._oContainer._oContent.offsetHeight+"px";if(this.useIFrame&&this._oContainer._oIFrame){bFireEvent=true;if(bShow){this._oContainer._oIFrame.style.width=width;this._oContainer._oIFrame.style.height=height;}
else{this._oContainer._oIFrame.style.width=0;this._oContainer._oIFrame.style.height=0;}}
if(this.useShadow&&this._oContainer._oShadow){bFireEvent=true;if(bShow){this._oContainer._oShadow.style.width=width;this._oContainer._oShadow.style.height=height;}
else{this._oContainer._oShadow.style.width=0;this._oContainer._oShadow.style.height=0;}}};YAHOO.widget.AutoComplete.prototype._toggleContainer=function(bShow){var oContainer=this._oContainer;if(this.alwaysShowContainer&&this._bContainerOpen){return;}
if(!bShow){this._oContainer._oContent.scrollTop=0;var aItems=this._aListItems;if(aItems&&(aItems.length>0)){for(var i=aItems.length-1;i>=0;i--){aItems[i].style.display="none";}}
if(this._oCurItem){this._toggleHighlight(this._oCurItem,"from");}
this._oCurItem=null;this._nDisplayedItems=0;this._sCurQuery=null;}
if(!bShow&&!this._bContainerOpen){oContainer._oContent.style.display="none";return;}
var oAnim=this._oAnim;if(oAnim&&oAnim.getEl()&&(this.animHoriz||this.animVert)){if(!bShow){this._toggleContainerHelpers(bShow);}
if(oAnim.isAnimated()){oAnim.stop();}
var oClone=oContainer._oContent.cloneNode(true);oContainer.appendChild(oClone);oClone.style.top="-9000px";oClone.style.display="block";var wExp=oClone.offsetWidth;var hExp=oClone.offsetHeight;var wColl=(this.animHoriz)?0:wExp;var hColl=(this.animVert)?0:hExp;oAnim.attributes=(bShow)?{width:{to:wExp},height:{to:hExp}}:{width:{to:wColl},height:{to:hColl}};if(bShow&&!this._bContainerOpen){oContainer._oContent.style.width=wColl+"px";oContainer._oContent.style.height=hColl+"px";}
else{oContainer._oContent.style.width=wExp+"px";oContainer._oContent.style.height=hExp+"px";}
oContainer.removeChild(oClone);oClone=null;var oSelf=this;var onAnimComplete=function(){oAnim.onComplete.unsubscribeAll();if(bShow){oSelf.containerExpandEvent.fire(oSelf);}
else{oContainer._oContent.style.display="none";oSelf.containerCollapseEvent.fire(oSelf);}
oSelf._toggleContainerHelpers(bShow);};oContainer._oContent.style.display="block";oAnim.onComplete.subscribe(onAnimComplete);oAnim.animate();this._bContainerOpen=bShow;}
else{if(bShow){oContainer._oContent.style.display="block";this.containerExpandEvent.fire(this);}
else{oContainer._oContent.style.display="none";this.containerCollapseEvent.fire(this);}
this._toggleContainerHelpers(bShow);this._bContainerOpen=bShow;}};YAHOO.widget.AutoComplete.prototype._toggleHighlight=function(oNewItem,sType){var sHighlight=this.highlightClassName;if(this._oCurItem){YAHOO.util.Dom.removeClass(this._oCurItem,sHighlight);}
if((sType=="to")&&sHighlight){YAHOO.util.Dom.addClass(oNewItem,sHighlight);this._oCurItem=oNewItem;}};YAHOO.widget.AutoComplete.prototype._togglePrehighlight=function(oNewItem,sType){if(oNewItem==this._oCurItem){return;}
var sPrehighlight=this.prehighlightClassName;if((sType=="mouseover")&&sPrehighlight){YAHOO.util.Dom.addClass(oNewItem,sPrehighlight);}
else{YAHOO.util.Dom.removeClass(oNewItem,sPrehighlight);}};YAHOO.widget.AutoComplete.prototype._updateValue=function(oItem){var oTextbox=this._oTextbox;var sDelimChar=(this.delimChar)?(this.delimChar[0]||this.delimChar):null;var sSavedQuery=this._sSavedQuery;var sResultKey=oItem._sResultKey;oTextbox.focus();oTextbox.value="";if(sDelimChar){if(sSavedQuery){oTextbox.value=sSavedQuery;}
oTextbox.value+=sResultKey+sDelimChar;if(sDelimChar!=" "){oTextbox.value+=" ";}}
else{oTextbox.value=sResultKey;}
if(oTextbox.type=="textarea"){oTextbox.scrollTop=oTextbox.scrollHeight;}
var end=oTextbox.value.length;this._selectText(oTextbox,end,end);this._oCurItem=oItem;};YAHOO.widget.AutoComplete.prototype._selectItem=function(oItem){this._bItemSelected=true;this._updateValue(oItem);this._cancelIntervalDetection(this);this.itemSelectEvent.fire(this,oItem,oItem._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(nKeyCode){if(this._bContainerOpen){var oCurItem=this._oCurItem;var nCurItemIndex=-1;if(oCurItem){nCurItemIndex=oCurItem._nItemIndex;}
var nNewItemIndex=(nKeyCode==40)?(nCurItemIndex+1):(nCurItemIndex-1);if(nNewItemIndex<-2||nNewItemIndex>=this._nDisplayedItems){return;}
if(oCurItem){this._toggleHighlight(oCurItem,"from");this.itemArrowFromEvent.fire(this,oCurItem);}
if(nNewItemIndex==-1){if(this.delimChar&&this._sSavedQuery){if(!this._textMatchesOption()){this._oTextbox.value=this._sSavedQuery;}
else{this._oTextbox.value=this._sSavedQuery+this._sCurQuery;}}
else{this._oTextbox.value=this._sCurQuery;}
this._oCurItem=null;return;}
if(nNewItemIndex==-2){this._toggleContainer(false);return;}
var oNewItem=this._aListItems[nNewItemIndex];var oContent=this._oContainer._oContent;var scrollOn=((YAHOO.util.Dom.getStyle(oContent,"overflow")=="auto")||(YAHOO.util.Dom.getStyle(oContent,"overflowY")=="auto"));if(scrollOn&&(nNewItemIndex>-1)&&(nNewItemIndex<this._nDisplayedItems)){if(nKeyCode==40){if((oNewItem.offsetTop+oNewItem.offsetHeight)>(oContent.scrollTop+oContent.offsetHeight)){oContent.scrollTop=(oNewItem.offsetTop+oNewItem.offsetHeight)-oContent.offsetHeight;}
else if((oNewItem.offsetTop+oNewItem.offsetHeight)<oContent.scrollTop){oContent.scrollTop=oNewItem.offsetTop;}}
else{if(oNewItem.offsetTop<oContent.scrollTop){this._oContainer._oContent.scrollTop=oNewItem.offsetTop;}
else if(oNewItem.offsetTop>(oContent.scrollTop+oContent.offsetHeight)){this._oContainer._oContent.scrollTop=(oNewItem.offsetTop+oNewItem.offsetHeight)-oContent.offsetHeight;}}}
this._toggleHighlight(oNewItem,"to");this.itemArrowToEvent.fire(this,oNewItem);if(this.typeAhead){this._updateValue(oNewItem);}}};YAHOO.widget.AutoComplete.prototype._onItemMouseover=function(v,oSelf){if(oSelf.prehighlightClassName){oSelf._togglePrehighlight(this,"mouseover");}
else{oSelf._toggleHighlight(this,"to");}
oSelf.itemMouseOverEvent.fire(oSelf,this);};YAHOO.widget.AutoComplete.prototype._onItemMouseout=function(v,oSelf){if(oSelf.prehighlightClassName){oSelf._togglePrehighlight(this,"mouseout");}
else{oSelf._toggleHighlight(this,"from");}
oSelf.itemMouseOutEvent.fire(oSelf,this);};YAHOO.widget.AutoComplete.prototype._onItemMouseclick=function(v,oSelf){oSelf._toggleHighlight(this,"to");oSelf._selectItem(this);};YAHOO.widget.AutoComplete.prototype._onContainerMouseover=function(v,oSelf){oSelf._bOverContainer=true;};YAHOO.widget.AutoComplete.prototype._onContainerMouseout=function(v,oSelf){oSelf._bOverContainer=false;if(oSelf._oCurItem){oSelf._toggleHighlight(oSelf._oCurItem,"to");}};YAHOO.widget.AutoComplete.prototype._onContainerScroll=function(v,oSelf){oSelf._oTextbox.focus();};YAHOO.widget.AutoComplete.prototype._onContainerResize=function(v,oSelf){oSelf._toggleContainerHelpers(oSelf._bContainerOpen);};YAHOO.widget.AutoComplete.prototype._onTextboxKeyDown=function(v,oSelf){var nKeyCode=v.keyCode;switch(nKeyCode){case 9:if(oSelf._oCurItem){if(oSelf.delimChar&&(oSelf._nKeyCode!=nKeyCode)){if(oSelf._bContainerOpen){YAHOO.util.Event.stopEvent(v);}}
oSelf._selectItem(oSelf._oCurItem);}
else{oSelf._toggleContainer(false);}
break;case 13:if(oSelf._oCurItem){if(oSelf._nKeyCode!=nKeyCode){if(oSelf._bContainerOpen){YAHOO.util.Event.stopEvent(v);}}
oSelf._selectItem(oSelf._oCurItem);}
else{oSelf._toggleContainer(false);}
break;case 27:oSelf._toggleContainer(false);return;case 39:oSelf._jumpSelection();break;case 38:YAHOO.util.Event.stopEvent(v);oSelf._moveSelection(nKeyCode);break;case 40:YAHOO.util.Event.stopEvent(v);oSelf._moveSelection(nKeyCode);break;default:break;}};YAHOO.widget.AutoComplete.prototype._onTextboxKeyPress=function(v,oSelf){var nKeyCode=v.keyCode;var isMac=(navigator.userAgent.toLowerCase().indexOf("mac")!=-1);if(isMac){switch(nKeyCode){case 9:if(oSelf.delimChar&&(oSelf._nKeyCode!=nKeyCode)){YAHOO.util.Event.stopEvent(v);}
break;case 13:if(oSelf._nKeyCode!=nKeyCode){YAHOO.util.Event.stopEvent(v);}
break;case 38:case 40:YAHOO.util.Event.stopEvent(v);break;default:break;}}
else if(nKeyCode==229){oSelf._queryInterval=setInterval(function(){oSelf._onIMEDetected(oSelf);},500);}};YAHOO.widget.AutoComplete.prototype._onTextboxKeyUp=function(v,oSelf){oSelf._initProps();var nKeyCode=v.keyCode;oSelf._nKeyCode=nKeyCode;var sText=this.value;if(oSelf._isIgnoreKey(nKeyCode)||(sText.toLowerCase()==oSelf._sCurQuery)){return;}
else{oSelf._bItemSelected=false;YAHOO.util.Dom.removeClass(oSelf._oCurItem,oSelf.highlightClassName);oSelf._oCurItem=null;oSelf.textboxKeyEvent.fire(oSelf,nKeyCode);}
if(oSelf.queryDelay>0){var nDelayID=setTimeout(function(){oSelf._sendQuery(sText);},(oSelf.queryDelay*1000));if(oSelf._nDelayID!=-1){clearTimeout(oSelf._nDelayID);}
oSelf._nDelayID=nDelayID;}
else{oSelf._sendQuery(sText);}};YAHOO.widget.AutoComplete.prototype._onTextboxFocus=function(v,oSelf){oSelf._oTextbox.setAttribute("autocomplete","off");oSelf._bFocused=true;if(!oSelf._bItemSelected){oSelf.textboxFocusEvent.fire(oSelf);}};YAHOO.widget.AutoComplete.prototype._onTextboxBlur=function(v,oSelf){if(!oSelf._bOverContainer||(oSelf._nKeyCode==9)){if(!oSelf._bItemSelected){var oMatch=oSelf._textMatchesOption();if(!oSelf._bContainerOpen||(oSelf._bContainerOpen&&(oMatch===null))){if(oSelf.forceSelection){oSelf._clearSelection();}
else{oSelf.unmatchedItemSelectEvent.fire(oSelf,oSelf._sCurQuery);}}
else{oSelf._selectItem(oMatch);}}
if(oSelf._bContainerOpen){oSelf._toggleContainer(false);}
oSelf._cancelIntervalDetection(oSelf);oSelf._bFocused=false;oSelf.textboxBlurEvent.fire(oSelf);}};YAHOO.widget.AutoComplete.prototype._onFormSubmit=function(v,oSelf){if(oSelf.allowBrowserAutocomplete){oSelf._oTextbox.setAttribute("autocomplete","on");}
else{oSelf._oTextbox.setAttribute("autocomplete","off");}};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(oCallbackFn,sQuery,oParent){var aResults=this._doQueryCache(oCallbackFn,sQuery,oParent);if(aResults.length===0){this.queryEvent.fire(this,oParent,sQuery);this.doQuery(oCallbackFn,sQuery,oParent);}};YAHOO.widget.DataSource.prototype.doQuery=function(oCallbackFn,sQuery,oParent){};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 maxCacheEntries=this.maxCacheEntries;if(!YAHOO.lang.isNumber(maxCacheEntries)||(maxCacheEntries<0)){maxCacheEntries=0;}
if(maxCacheEntries>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(oResult){var aCache=this._aCache;if(!aCache||!oResult||!oResult.query||!oResult.results){return;}
if(aCache.length>=this.maxCacheEntries){aCache.shift();}
aCache.push(oResult);};YAHOO.widget.DataSource.prototype._doQueryCache=function(oCallbackFn,sQuery,oParent){var aResults=[];var bMatchFound=false;var aCache=this._aCache;var nCacheLength=(aCache)?aCache.length:0;var bMatchContains=this.queryMatchContains;if((this.maxCacheEntries>0)&&aCache&&(nCacheLength>0)){this.cacheQueryEvent.fire(this,oParent,sQuery);if(!this.queryMatchCase){var sOrigQuery=sQuery;sQuery=sQuery.toLowerCase();}
for(var i=nCacheLength-1;i>=0;i--){var resultObj=aCache[i];var aAllResultItems=resultObj.results;var matchKey=(!this.queryMatchCase)?encodeURIComponent(resultObj.query).toLowerCase():encodeURIComponent(resultObj.query);if(matchKey==sQuery){bMatchFound=true;aResults=aAllResultItems;if(i!=nCacheLength-1){aCache.splice(i,1);this._addCacheElem(resultObj);}
break;}
else if(this.queryMatchSubset){for(var j=sQuery.length-1;j>=0;j--){var subQuery=sQuery.substr(0,j);if(matchKey==subQuery){bMatchFound=true;for(var k=aAllResultItems.length-1;k>=0;k--){var aRecord=aAllResultItems[k];var sKeyIndex=(this.queryMatchCase)?encodeURIComponent(aRecord[0]).indexOf(sQuery):encodeURIComponent(aRecord[0]).toLowerCase().indexOf(sQuery);if((!bMatchContains&&(sKeyIndex===0))||(bMatchContains&&(sKeyIndex>-1))){aResults.unshift(aRecord);}}
resultObj={};resultObj.query=sQuery;resultObj.results=aResults;this._addCacheElem(resultObj);break;}}
if(bMatchFound){break;}}}
if(bMatchFound){this.getCachedResultsEvent.fire(this,oParent,sOrigQuery,aResults);oCallbackFn(sOrigQuery,aResults,oParent);}}
return aResults;};YAHOO.widget.DS_XHR=function(sScriptURI,aSchema,oConfigs){if(oConfigs&&(oConfigs.constructor==Object)){for(var sConfig in oConfigs){this[sConfig]=oConfigs[sConfig];}}
if(!YAHOO.lang.isArray(aSchema)||!YAHOO.lang.isString(sScriptURI)){return;}
this.schema=aSchema;this.scriptURI=sScriptURI;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="\n<!-";YAHOO.widget.DS_XHR.prototype.doQuery=function(oCallbackFn,sQuery,oParent){var isXML=(this.responseType==YAHOO.widget.DS_XHR.TYPE_XML);var sUri=this.scriptURI+"?"+this.scriptQueryParam+"="+sQuery;if(this.scriptQueryAppend.length>0){sUri+="&"+this.scriptQueryAppend;}
var oResponse=null;var oSelf=this;var responseSuccess=function(oResp){if(!oSelf._oConn||(oResp.tId!=oSelf._oConn.tId)){oSelf.dataErrorEvent.fire(oSelf,oParent,sQuery,YAHOO.widget.DataSource.ERROR_DATANULL);return;}
for(var foo in oResp){}
if(!isXML){oResp=oResp.responseText;}
else{oResp=oResp.responseXML;}
if(oResp===null){oSelf.dataErrorEvent.fire(oSelf,oParent,sQuery,YAHOO.widget.DataSource.ERROR_DATANULL);return;}
var aResults=oSelf.parseResponse(sQuery,oResp,oParent);var resultObj={};resultObj.query=decodeURIComponent(sQuery);resultObj.results=aResults;if(aResults===null){oSelf.dataErrorEvent.fire(oSelf,oParent,sQuery,YAHOO.widget.DataSource.ERROR_DATAPARSE);aResults=[];}
else{oSelf.getResultsEvent.fire(oSelf,oParent,sQuery,aResults);oSelf._addCacheElem(resultObj);}
oCallbackFn(sQuery,aResults,oParent);};var responseFailure=function(oResp){oSelf.dataErrorEvent.fire(oSelf,oParent,sQuery,YAHOO.widget.DS_XHR.ERROR_DATAXHR);return;};var oCallback={success:responseSuccess,failure:responseFailure};if(YAHOO.lang.isNumber(this.connTimeout)&&(this.connTimeout>0)){oCallback.timeout=this.connTimeout;}
if(this._oConn){this.connMgr.abort(this._oConn);}
oSelf._oConn=this.connMgr.asyncRequest("GET",sUri,oCallback,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;var isNotMac=(navigator.userAgent.toLowerCase().indexOf('khtml')==-1);if(oResponse.parseJSON&&isNotMac){jsonObjParsed=oResponse.parseJSON();if(!jsonObjParsed){bError=true;}
else{try{jsonList=eval("jsonObjParsed."+aSchema[0]);}
catch(e){bError=true;break;}}}
else if(window.JSON&&isNotMac){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);}
var aRecords=oResponse.split(aSchema[0]);for(var n=aRecords.length-1;n>=0;n--){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_JSFunction=function(oFunction,oConfigs){if(oConfigs&&(oConfigs.constructor==Object)){for(var sConfig in oConfigs){this[sConfig]=oConfigs[sConfig];}}
if(!YAHOO.lang.isFunction(oFunction)){return;}
else{this.dataFunction=oFunction;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(oCallbackFn,sQuery,oParent){var oFunction=this.dataFunction;var aResults=[];aResults=oFunction(sQuery);if(aResults===null){this.dataErrorEvent.fire(this,oParent,sQuery,YAHOO.widget.DataSource.ERROR_DATANULL);return;}
var resultObj={};resultObj.query=decodeURIComponent(sQuery);resultObj.results=aResults;this._addCacheElem(resultObj);this.getResultsEvent.fire(this,oParent,sQuery,aResults);oCallbackFn(sQuery,aResults,oParent);return;};YAHOO.widget.DS_JSArray=function(aData,oConfigs){if(oConfigs&&(oConfigs.constructor==Object)){for(var sConfig in oConfigs){this[sConfig]=oConfigs[sConfig];}}
if(!YAHOO.lang.isArray(aData)){return;}
else{this.data=aData;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(oCallbackFn,sQuery,oParent){var i;var aData=this.data;var aResults=[];var bMatchFound=false;var bMatchContains=this.queryMatchContains;if(sQuery){if(!this.queryMatchCase){sQuery=sQuery.toLowerCase();}
for(i=aData.length-1;i>=0;i--){var aDataset=[];if(YAHOO.lang.isString(aData[i])){aDataset[0]=aData[i];}
else if(YAHOO.lang.isArray(aData[i])){aDataset=aData[i];}
if(YAHOO.lang.isString(aDataset[0])){var sKeyIndex=(this.queryMatchCase)?encodeURIComponent(aDataset[0]).indexOf(sQuery):encodeURIComponent(aDataset[0]).toLowerCase().indexOf(sQuery);if((!bMatchContains&&(sKeyIndex===0))||(bMatchContains&&(sKeyIndex>-1))){aResults.unshift(aDataset);}}}}
else{for(i=aData.length-1;i>=0;i--){if(YAHOO.lang.isString(aData[i])){aResults.unshift([aData[i]]);}
else if(YAHOO.lang.isArray(aData[i])){aResults.unshift(aData[i]);}}}
this.getResultsEvent.fire(this,oParent,sQuery,aResults);oCallbackFn(sQuery,aResults,oParent);};YAHOO.register("autocomplete",YAHOO.widget.AutoComplete,{version:"2.3.0",build:"442"});

/* File: http://yui.yahooapis.com/2.3.0/build/calendar/calendar-min.js */

/*
Copyright (c) 2007, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.3.0
*/

(function(){YAHOO.util.Config=function(owner){if(owner){this.init(owner);}
if(!owner){}};var Lang=YAHOO.lang,CustomEvent=YAHOO.util.CustomEvent,Config=YAHOO.util.Config;Config.CONFIG_CHANGED_EVENT="configChanged";Config.BOOLEAN_TYPE="boolean";Config.prototype={owner:null,queueInProgress:false,config:null,initialConfig:null,eventQueue:null,configChangedEvent:null,init:function(owner){this.owner=owner;this.configChangedEvent=this.createEvent(Config.CONFIG_CHANGED_EVENT);this.configChangedEvent.signature=CustomEvent.LIST;this.queueInProgress=false;this.config={};this.initialConfig={};this.eventQueue=[];},checkBoolean:function(val){return(typeof val==Config.BOOLEAN_TYPE);},checkNumber:function(val){return(!isNaN(val));},fireEvent:function(key,value){var property=this.config[key];if(property&&property.event){property.event.fire(value);}},addProperty:function(key,propertyObject){key=key.toLowerCase();this.config[key]=propertyObject;propertyObject.event=this.createEvent(key,{scope:this.owner});propertyObject.event.signature=CustomEvent.LIST;propertyObject.key=key;if(propertyObject.handler){propertyObject.event.subscribe(propertyObject.handler,this.owner);}
this.setProperty(key,propertyObject.value,true);if(!propertyObject.suppressEvent){this.queueProperty(key,propertyObject.value);}},getConfig:function(){var cfg={},prop,property;for(prop in this.config){property=this.config[prop];if(property&&property.event){cfg[prop]=property.value;}}
return cfg;},getProperty:function(key){var property=this.config[key.toLowerCase()];if(property&&property.event){return property.value;}else{return undefined;}},resetProperty:function(key){key=key.toLowerCase();var property=this.config[key];if(property&&property.event){if(this.initialConfig[key]&&!Lang.isUndefined(this.initialConfig[key])){this.setProperty(key,this.initialConfig[key]);}
return true;}else{return false;}},setProperty:function(key,value,silent){var property;key=key.toLowerCase();if(this.queueInProgress&&!silent){this.queueProperty(key,value);return true;}else{property=this.config[key];if(property&&property.event){if(property.validator&&!property.validator(value)){return false;}else{property.value=value;if(!silent){this.fireEvent(key,value);this.configChangedEvent.fire([key,value]);}
return true;}}else{return false;}}},queueProperty:function(key,value){key=key.toLowerCase();var property=this.config[key],foundDuplicate=false,iLen,queueItem,queueItemKey,queueItemValue,sLen,supercedesCheck,qLen,queueItemCheck,queueItemCheckKey,queueItemCheckValue,i,s,q;if(property&&property.event){if(!Lang.isUndefined(value)&&property.validator&&!property.validator(value)){return false;}else{if(!Lang.isUndefined(value)){property.value=value;}else{value=property.value;}
foundDuplicate=false;iLen=this.eventQueue.length;for(i=0;i<iLen;i++){queueItem=this.eventQueue[i];if(queueItem){queueItemKey=queueItem[0];queueItemValue=queueItem[1];if(queueItemKey==key){this.eventQueue[i]=null;this.eventQueue.push([key,(!Lang.isUndefined(value)?value:queueItemValue)]);foundDuplicate=true;break;}}}
if(!foundDuplicate&&!Lang.isUndefined(value)){this.eventQueue.push([key,value]);}}
if(property.supercedes){sLen=property.supercedes.length;for(s=0;s<sLen;s++){supercedesCheck=property.supercedes[s];qLen=this.eventQueue.length;for(q=0;q<qLen;q++){queueItemCheck=this.eventQueue[q];if(queueItemCheck){queueItemCheckKey=queueItemCheck[0];queueItemCheckValue=queueItemCheck[1];if(queueItemCheckKey==supercedesCheck.toLowerCase()){this.eventQueue.push([queueItemCheckKey,queueItemCheckValue]);this.eventQueue[q]=null;break;}}}}}
return true;}else{return false;}},refireEvent:function(key){key=key.toLowerCase();var property=this.config[key];if(property&&property.event&&!Lang.isUndefined(property.value)){if(this.queueInProgress){this.queueProperty(key);}else{this.fireEvent(key,property.value);}}},applyConfig:function(userConfig,init){var prop;if(init){this.initialConfig=userConfig;}
for(prop in userConfig){this.queueProperty(prop,userConfig[prop]);}},refresh:function(){var prop;for(prop in this.config){this.refireEvent(prop);}},fireQueue:function(){var i,queueItem,key,value,property;this.queueInProgress=true;for(i=0;i<this.eventQueue.length;i++){queueItem=this.eventQueue[i];if(queueItem){key=queueItem[0];value=queueItem[1];property=this.config[key];property.value=value;this.fireEvent(key,value);}}
this.queueInProgress=false;this.eventQueue=[];},subscribeToConfigEvent:function(key,handler,obj,override){var property=this.config[key.toLowerCase()];if(property&&property.event){if(!Config.alreadySubscribed(property.event,handler,obj)){property.event.subscribe(handler,obj,override);}
return true;}else{return false;}},unsubscribeFromConfigEvent:function(key,handler,obj){var property=this.config[key.toLowerCase()];if(property&&property.event){return property.event.unsubscribe(handler,obj);}else{return false;}},toString:function(){var output="Config";if(this.owner){output+=" ["+this.owner.toString()+"]";}
return output;},outputEventQueue:function(){var output="",queueItem,q,nQueue=this.eventQueue.length;for(q=0;q<nQueue;q++){queueItem=this.eventQueue[q];if(queueItem){output+=queueItem[0]+"="+queueItem[1]+", ";}}
return output;},destroy:function(){var oConfig=this.config,sProperty,oProperty;for(sProperty in oConfig){if(Lang.hasOwnProperty(oConfig,sProperty)){oProperty=oConfig[sProperty];oProperty.event.unsubscribeAll();oProperty.event=null;}}
this.configChangedEvent.unsubscribeAll();this.configChangedEvent=null;this.owner=null;this.config=null;this.initialConfig=null;this.eventQueue=null;}};Config.alreadySubscribed=function(evt,fn,obj){var nSubscribers=evt.subscribers.length,subsc,i;if(nSubscribers>0){i=nSubscribers-1;do{subsc=evt.subscribers[i];if(subsc&&subsc.obj==obj&&subsc.fn==fn){return true;}}
while(i--);}
return false;};YAHOO.lang.augmentProto(Config,YAHOO.util.EventProvider);}());YAHOO.widget.DateMath={DAY:"D",WEEK:"W",YEAR:"Y",MONTH:"M",ONE_DAY_MS:1000*60*60*24,add:function(date,field,amount){var d=new Date(date.getTime());switch(field){case this.MONTH:var newMonth=date.getMonth()+amount;var years=0;if(newMonth<0){while(newMonth<0){newMonth+=12;years-=1;}}else if(newMonth>11){while(newMonth>11){newMonth-=12;years+=1;}}
d.setMonth(newMonth);d.setFullYear(date.getFullYear()+years);break;case this.DAY:d.setDate(date.getDate()+amount);break;case this.YEAR:d.setFullYear(date.getFullYear()+amount);break;case this.WEEK:d.setDate(date.getDate()+(amount*7));break;}
return d;},subtract:function(date,field,amount){return this.add(date,field,(amount*-1));},before:function(date,compareTo){var ms=compareTo.getTime();if(date.getTime()<ms){return true;}else{return false;}},after:function(date,compareTo){var ms=compareTo.getTime();if(date.getTime()>ms){return true;}else{return false;}},between:function(date,dateBegin,dateEnd){if(this.after(date,dateBegin)&&this.before(date,dateEnd)){return true;}else{return false;}},getJan1:function(calendarYear){return new Date(calendarYear,0,1);},getDayOffset:function(date,calendarYear){var beginYear=this.getJan1(calendarYear);var dayOffset=Math.ceil((date.getTime()-beginYear.getTime())/this.ONE_DAY_MS);return dayOffset;},getWeekNumber:function(date,calendarYear){date=this.clearTime(date);var nearestThurs=new Date(date.getTime()+(4*this.ONE_DAY_MS)-((date.getDay())*this.ONE_DAY_MS));var jan1=new Date(nearestThurs.getFullYear(),0,1);var dayOfYear=((nearestThurs.getTime()-jan1.getTime())/this.ONE_DAY_MS)-1;var weekNum=Math.ceil((dayOfYear)/7);return weekNum;},isYearOverlapWeek:function(weekBeginDate){var overlaps=false;var nextWeek=this.add(weekBeginDate,this.DAY,6);if(nextWeek.getFullYear()!=weekBeginDate.getFullYear()){overlaps=true;}
return overlaps;},isMonthOverlapWeek:function(weekBeginDate){var overlaps=false;var nextWeek=this.add(weekBeginDate,this.DAY,6);if(nextWeek.getMonth()!=weekBeginDate.getMonth()){overlaps=true;}
return overlaps;},findMonthStart:function(date){var start=new Date(date.getFullYear(),date.getMonth(),1);return start;},findMonthEnd:function(date){var start=this.findMonthStart(date);var nextMonth=this.add(start,this.MONTH,1);var end=this.subtract(nextMonth,this.DAY,1);return end;},clearTime:function(date){date.setHours(12,0,0,0);return date;}};YAHOO.widget.Calendar=function(id,containerId,config){this.init(id,containerId,config);};YAHOO.widget.Calendar.IMG_ROOT=null;YAHOO.widget.Calendar.DATE="D";YAHOO.widget.Calendar.MONTH_DAY="MD";YAHOO.widget.Calendar.WEEKDAY="WD";YAHOO.widget.Calendar.RANGE="R";YAHOO.widget.Calendar.MONTH="M";YAHOO.widget.Calendar.DISPLAY_DAYS=42;YAHOO.widget.Calendar.STOP_RENDER="S";YAHOO.widget.Calendar.SHORT="short";YAHOO.widget.Calendar.LONG="long";YAHOO.widget.Calendar.MEDIUM="medium";YAHOO.widget.Calendar.ONE_CHAR="1char";YAHOO.widget.Calendar._DEFAULT_CONFIG={PAGEDATE:{key:"pagedate",value:null},SELECTED:{key:"selected",value:null},TITLE:{key:"title",value:""},CLOSE:{key:"close",value:false},IFRAME:{key:"iframe",value:(YAHOO.env.ua.ie&&YAHOO.env.ua.ie<=6)?true:false},MINDATE:{key:"mindate",value:null},MAXDATE:{key:"maxdate",value:null},MULTI_SELECT:{key:"multi_select",value:false},START_WEEKDAY:{key:"start_weekday",value:0},SHOW_WEEKDAYS:{key:"show_weekdays",value:true},SHOW_WEEK_HEADER:{key:"show_week_header",value:false},SHOW_WEEK_FOOTER:{key:"show_week_footer",value:false},HIDE_BLANK_WEEKS:{key:"hide_blank_weeks",value:false},NAV_ARROW_LEFT:{key:"nav_arrow_left",value:null},NAV_ARROW_RIGHT:{key:"nav_arrow_right",value:null},MONTHS_SHORT:{key:"months_short",value:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]},MONTHS_LONG:{key:"months_long",value:["January","February","March","April","May","June","July","August","September","October","November","December"]},WEEKDAYS_1CHAR:{key:"weekdays_1char",value:["S","M","T","W","T","F","S"]},WEEKDAYS_SHORT:{key:"weekdays_short",value:["Su","Mo","Tu","We","Th","Fr","Sa"]},WEEKDAYS_MEDIUM:{key:"weekdays_medium",value:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]},WEEKDAYS_LONG:{key:"weekdays_long",value:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},LOCALE_MONTHS:{key:"locale_months",value:"long"},LOCALE_WEEKDAYS:{key:"locale_weekdays",value:"short"},DATE_DELIMITER:{key:"date_delimiter",value:","},DATE_FIELD_DELIMITER:{key:"date_field_delimiter",value:"/"},DATE_RANGE_DELIMITER:{key:"date_range_delimiter",value:"-"},MY_MONTH_POSITION:{key:"my_month_position",value:1},MY_YEAR_POSITION:{key:"my_year_position",value:2},MD_MONTH_POSITION:{key:"md_month_position",value:1},MD_DAY_POSITION:{key:"md_day_position",value:2},MDY_MONTH_POSITION:{key:"mdy_month_position",value:1},MDY_DAY_POSITION:{key:"mdy_day_position",value:2},MDY_YEAR_POSITION:{key:"mdy_year_position",value:3},MY_LABEL_MONTH_POSITION:{key:"my_label_month_position",value:1},MY_LABEL_YEAR_POSITION:{key:"my_label_year_position",value:2},MY_LABEL_MONTH_SUFFIX:{key:"my_label_month_suffix",value:" "},MY_LABEL_YEAR_SUFFIX:{key:"my_label_year_suffix",value:""}};YAHOO.widget.Calendar._EVENT_TYPES={BEFORE_SELECT:"beforeSelect",SELECT:"select",BEFORE_DESELECT:"beforeDeselect",DESELECT:"deselect",CHANGE_PAGE:"changePage",BEFORE_RENDER:"beforeRender",RENDER:"render",RESET:"reset",CLEAR:"clear"};YAHOO.widget.Calendar._STYLES={CSS_ROW_HEADER:"calrowhead",CSS_ROW_FOOTER:"calrowfoot",CSS_CELL:"calcell",CSS_CELL_SELECTOR:"selector",CSS_CELL_SELECTED:"selected",CSS_CELL_SELECTABLE:"selectable",CSS_CELL_RESTRICTED:"restricted",CSS_CELL_TODAY:"today",CSS_CELL_OOM:"oom",CSS_CELL_OOB:"previous",CSS_HEADER:"calheader",CSS_HEADER_TEXT:"calhead",CSS_BODY:"calbody",CSS_WEEKDAY_CELL:"calweekdaycell",CSS_WEEKDAY_ROW:"calweekdayrow",CSS_FOOTER:"calfoot",CSS_CALENDAR:"yui-calendar",CSS_SINGLE:"single",CSS_CONTAINER:"yui-calcontainer",CSS_NAV_LEFT:"calnavleft",CSS_NAV_RIGHT:"calnavright",CSS_CLOSE:"calclose",CSS_CELL_TOP:"calcelltop",CSS_CELL_LEFT:"calcellleft",CSS_CELL_RIGHT:"calcellright",CSS_CELL_BOTTOM:"calcellbottom",CSS_CELL_HOVER:"calcellhover",CSS_CELL_HIGHLIGHT1:"highlight1",CSS_CELL_HIGHLIGHT2:"highlight2",CSS_CELL_HIGHLIGHT3:"highlight3",CSS_CELL_HIGHLIGHT4:"highlight4"};YAHOO.widget.Calendar.prototype={Config:null,parent:null,index:-1,cells:null,cellDates:null,id:null,oDomContainer:null,today:null,renderStack:null,_renderStack:null,_selectedDates:null,domEventMap:null};YAHOO.widget.Calendar.prototype.init=function(id,containerId,config){this.initEvents();this.today=new Date();YAHOO.widget.DateMath.clearTime(this.today);this.id=id;this.oDomContainer=document.getElementById(containerId);this.cfg=new YAHOO.util.Config(this);this.Options={};this.Locale={};this.initStyles();YAHOO.util.Dom.addClass(this.oDomContainer,this.Style.CSS_CONTAINER);YAHOO.util.Dom.addClass(this.oDomContainer,this.Style.CSS_SINGLE);this.cellDates=[];this.cells=[];this.renderStack=[];this._renderStack=[];this.setupConfig();if(config){this.cfg.applyConfig(config,true);}
this.cfg.fireQueue();};YAHOO.widget.Calendar.prototype.configIframe=function(type,args,obj){var useIframe=args[0];if(!this.parent){if(YAHOO.util.Dom.inDocument(this.oDomContainer)){if(useIframe){var pos=YAHOO.util.Dom.getStyle(this.oDomContainer,"position");if(pos=="absolute"||pos=="relative"){if(!YAHOO.util.Dom.inDocument(this.iframe)){this.iframe=document.createElement("iframe");this.iframe.src="javascript:false;";YAHOO.util.Dom.setStyle(this.iframe,"opacity","0");if(YAHOO.env.ua.ie&&YAHOO.env.ua.ie<=6){YAHOO.util.Dom.addClass(this.iframe,"fixedsize");}
this.oDomContainer.insertBefore(this.iframe,this.oDomContainer.firstChild);}}}else{if(this.iframe){if(this.iframe.parentNode){this.iframe.parentNode.removeChild(this.iframe);}
this.iframe=null;}}}}};YAHOO.widget.Calendar.prototype.configTitle=function(type,args,obj){var title=args[0];var close=this.cfg.getProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.CLOSE.key);var titleDiv;if(title&&title!==""){titleDiv=YAHOO.util.Dom.getElementsByClassName(YAHOO.widget.CalendarGroup.CSS_2UPTITLE,"div",this.oDomContainer)[0]||document.createElement("div");titleDiv.className=YAHOO.widget.CalendarGroup.CSS_2UPTITLE;titleDiv.innerHTML=title;this.oDomContainer.insertBefore(titleDiv,this.oDomContainer.firstChild);YAHOO.util.Dom.addClass(this.oDomContainer,"withtitle");}else{titleDiv=YAHOO.util.Dom.getElementsByClassName(YAHOO.widget.CalendarGroup.CSS_2UPTITLE,"div",this.oDomContainer)[0]||null;if(titleDiv){YAHOO.util.Event.purgeElement(titleDiv);this.oDomContainer.removeChild(titleDiv);}
if(!close){YAHOO.util.Dom.removeClass(this.oDomContainer,"withtitle");}}};YAHOO.widget.Calendar.prototype.configClose=function(type,args,obj){var close=args[0];var title=this.cfg.getProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.TITLE.key);var DEPR_CLOSE_PATH="us/my/bn/x_d.gif";var linkClose;if(close===true){linkClose=YAHOO.util.Dom.getElementsByClassName("link-close","a",this.oDomContainer)[0]||document.createElement("a");linkClose.href="#";linkClose.className="link-close";YAHOO.util.Event.addListener(linkClose,"click",function(e,cal){cal.hide();YAHOO.util.Event.preventDefault(e);},this);if(YAHOO.widget.Calendar.IMG_ROOT!==null){var imgClose=document.createElement("img");imgClose.src=YAHOO.widget.Calendar.IMG_ROOT+DEPR_CLOSE_PATH;imgClose.className=YAHOO.widget.CalendarGroup.CSS_2UPCLOSE;linkClose.appendChild(imgClose);}else{linkClose.innerHTML='<span class="'+YAHOO.widget.CalendarGroup.CSS_2UPCLOSE+' '+this.Style.CSS_CLOSE+'"></span>';}
this.oDomContainer.appendChild(linkClose);YAHOO.util.Dom.addClass(this.oDomContainer,"withtitle");}else{linkClose=YAHOO.util.Dom.getElementsByClassName("link-close","a",this.oDomContainer)[0]||null;if(linkClose){YAHOO.util.Event.purgeElement(linkClose);this.oDomContainer.removeChild(linkClose);}
if(!title||title===""){YAHOO.util.Dom.removeClass(this.oDomContainer,"withtitle");}}};YAHOO.widget.Calendar.prototype.initEvents=function(){var defEvents=YAHOO.widget.Calendar._EVENT_TYPES;this.beforeSelectEvent=new YAHOO.util.CustomEvent(defEvents.BEFORE_SELECT);this.selectEvent=new YAHOO.util.CustomEvent(defEvents.SELECT);this.beforeDeselectEvent=new YAHOO.util.CustomEvent(defEvents.BEFORE_DESELECT);this.deselectEvent=new YAHOO.util.CustomEvent(defEvents.DESELECT);this.changePageEvent=new YAHOO.util.CustomEvent(defEvents.CHANGE_PAGE);this.beforeRenderEvent=new YAHOO.util.CustomEvent(defEvents.BEFORE_RENDER);this.renderEvent=new YAHOO.util.CustomEvent(defEvents.RENDER);this.resetEvent=new YAHOO.util.CustomEvent(defEvents.RESET);this.clearEvent=new YAHOO.util.CustomEvent(defEvents.CLEAR);this.beforeSelectEvent.subscribe(this.onBeforeSelect,this,true);this.selectEvent.subscribe(this.onSelect,this,true);this.beforeDeselectEvent.subscribe(this.onBeforeDeselect,this,true);this.deselectEvent.subscribe(this.onDeselect,this,true);this.changePageEvent.subscribe(this.onChangePage,this,true);this.renderEvent.subscribe(this.onRender,this,true);this.resetEvent.subscribe(this.onReset,this,true);this.clearEvent.subscribe(this.onClear,this,true);};YAHOO.widget.Calendar.prototype.doSelectCell=function(e,cal){var cell,index,d,date;var target=YAHOO.util.Event.getTarget(e);var tagName=target.tagName.toLowerCase();var defSelector=false;while(tagName!="td"&&!YAHOO.util.Dom.hasClass(target,cal.Style.CSS_CELL_SELECTABLE)){if(!defSelector&&tagName=="a"&&YAHOO.util.Dom.hasClass(target,cal.Style.CSS_CELL_SELECTOR)){defSelector=true;}
target=target.parentNode;tagName=target.tagName.toLowerCase();if(tagName=="html"){return;}}
if(defSelector){YAHOO.util.Event.preventDefault(e);}
cell=target;if(YAHOO.util.Dom.hasClass(cell,cal.Style.CSS_CELL_SELECTABLE)){index=cell.id.split("cell")[1];d=cal.cellDates[index];date=new Date(d[0],d[1]-1,d[2]);var link;if(cal.Options.MULTI_SELECT){link=cell.getElementsByTagName("a")[0];if(link){link.blur();}
var cellDate=cal.cellDates[index];var cellDateIndex=cal._indexOfSelectedFieldArray(cellDate);if(cellDateIndex>-1){cal.deselectCell(index);}else{cal.selectCell(index);}}else{link=cell.getElementsByTagName("a")[0];if(link){link.blur();}
cal.selectCell(index);}}};YAHOO.widget.Calendar.prototype.doCellMouseOver=function(e,cal){var target;if(e){target=YAHOO.util.Event.getTarget(e);}else{target=this;}
while(target.tagName.toLowerCase()!="td"){target=target.parentNode;if(target.tagName.toLowerCase()=="html"){return;}}
if(YAHOO.util.Dom.hasClass(target,cal.Style.CSS_CELL_SELECTABLE)){YAHOO.util.Dom.addClass(target,cal.Style.CSS_CELL_HOVER);}};YAHOO.widget.Calendar.prototype.doCellMouseOut=function(e,cal){var target;if(e){target=YAHOO.util.Event.getTarget(e);}else{target=this;}
while(target.tagName.toLowerCase()!="td"){target=target.parentNode;if(target.tagName.toLowerCase()=="html"){return;}}
if(YAHOO.util.Dom.hasClass(target,cal.Style.CSS_CELL_SELECTABLE)){YAHOO.util.Dom.removeClass(target,cal.Style.CSS_CELL_HOVER);}};YAHOO.widget.Calendar.prototype.setupConfig=function(){var defCfg=YAHOO.widget.Calendar._DEFAULT_CONFIG;this.cfg.addProperty(defCfg.PAGEDATE.key,{value:new Date(),handler:this.configPageDate});this.cfg.addProperty(defCfg.SELECTED.key,{value:[],handler:this.configSelected});this.cfg.addProperty(defCfg.TITLE.key,{value:defCfg.TITLE.value,handler:this.configTitle});this.cfg.addProperty(defCfg.CLOSE.key,{value:defCfg.CLOSE.value,handler:this.configClose});this.cfg.addProperty(defCfg.IFRAME.key,{value:defCfg.IFRAME.value,handler:this.configIframe,validator:this.cfg.checkBoolean});this.cfg.addProperty(defCfg.MINDATE.key,{value:defCfg.MINDATE.value,handler:this.configMinDate});this.cfg.addProperty(defCfg.MAXDATE.key,{value:defCfg.MAXDATE.value,handler:this.configMaxDate});this.cfg.addProperty(defCfg.MULTI_SELECT.key,{value:defCfg.MULTI_SELECT.value,handler:this.configOptions,validator:this.cfg.checkBoolean});this.cfg.addProperty(defCfg.START_WEEKDAY.key,{value:defCfg.START_WEEKDAY.value,handler:this.configOptions,validator:this.cfg.checkNumber});this.cfg.addProperty(defCfg.SHOW_WEEKDAYS.key,{value:defCfg.SHOW_WEEKDAYS.value,handler:this.configOptions,validator:this.cfg.checkBoolean});this.cfg.addProperty(defCfg.SHOW_WEEK_HEADER.key,{value:defCfg.SHOW_WEEK_HEADER.value,handler:this.configOptions,validator:this.cfg.checkBoolean});this.cfg.addProperty(defCfg.SHOW_WEEK_FOOTER.key,{value:defCfg.SHOW_WEEK_FOOTER.value,handler:this.configOptions,validator:this.cfg.checkBoolean});this.cfg.addProperty(defCfg.HIDE_BLANK_WEEKS.key,{value:defCfg.HIDE_BLANK_WEEKS.value,handler:this.configOptions,validator:this.cfg.checkBoolean});this.cfg.addProperty(defCfg.NAV_ARROW_LEFT.key,{value:defCfg.NAV_ARROW_LEFT.value,handler:this.configOptions});this.cfg.addProperty(defCfg.NAV_ARROW_RIGHT.key,{value:defCfg.NAV_ARROW_RIGHT.value,handler:this.configOptions});this.cfg.addProperty(defCfg.MONTHS_SHORT.key,{value:defCfg.MONTHS_SHORT.value,handler:this.configLocale});this.cfg.addProperty(defCfg.MONTHS_LONG.key,{value:defCfg.MONTHS_LONG.value,handler:this.configLocale});this.cfg.addProperty(defCfg.WEEKDAYS_1CHAR.key,{value:defCfg.WEEKDAYS_1CHAR.value,handler:this.configLocale});this.cfg.addProperty(defCfg.WEEKDAYS_SHORT.key,{value:defCfg.WEEKDAYS_SHORT.value,handler:this.configLocale});this.cfg.addProperty(defCfg.WEEKDAYS_MEDIUM.key,{value:defCfg.WEEKDAYS_MEDIUM.value,handler:this.configLocale});this.cfg.addProperty(defCfg.WEEKDAYS_LONG.key,{value:defCfg.WEEKDAYS_LONG.value,handler:this.configLocale});var refreshLocale=function(){this.cfg.refireEvent(defCfg.LOCALE_MONTHS.key);this.cfg.refireEvent(defCfg.LOCALE_WEEKDAYS.key);};this.cfg.subscribeToConfigEvent(defCfg.START_WEEKDAY.key,refreshLocale,this,true);this.cfg.subscribeToConfigEvent(defCfg.MONTHS_SHORT.key,refreshLocale,this,true);this.cfg.subscribeToConfigEvent(defCfg.MONTHS_LONG.key,refreshLocale,this,true);this.cfg.subscribeToConfigEvent(defCfg.WEEKDAYS_1CHAR.key,refreshLocale,this,true);this.cfg.subscribeToConfigEvent(defCfg.WEEKDAYS_SHORT.key,refreshLocale,this,true);this.cfg.subscribeToConfigEvent(defCfg.WEEKDAYS_MEDIUM.key,refreshLocale,this,true);this.cfg.subscribeToConfigEvent(defCfg.WEEKDAYS_LONG.key,refreshLocale,this,true);this.cfg.addProperty(defCfg.LOCALE_MONTHS.key,{value:defCfg.LOCALE_MONTHS.value,handler:this.configLocaleValues});this.cfg.addProperty(defCfg.LOCALE_WEEKDAYS.key,{value:defCfg.LOCALE_WEEKDAYS.value,handler:this.configLocaleValues});this.cfg.addProperty(defCfg.DATE_DELIMITER.key,{value:defCfg.DATE_DELIMITER.value,handler:this.configLocale});this.cfg.addProperty(defCfg.DATE_FIELD_DELIMITER.key,{value:defCfg.DATE_FIELD_DELIMITER.value,handler:this.configLocale});this.cfg.addProperty(defCfg.DATE_RANGE_DELIMITER.key,{value:defCfg.DATE_RANGE_DELIMITER.value,handler:this.configLocale});this.cfg.addProperty(defCfg.MY_MONTH_POSITION.key,{value:defCfg.MY_MONTH_POSITION.value,handler:this.configLocale,validator:this.cfg.checkNumber});this.cfg.addProperty(defCfg.MY_YEAR_POSITION.key,{value:defCfg.MY_YEAR_POSITION.value,handler:this.configLocale,validator:this.cfg.checkNumber});this.cfg.addProperty(defCfg.MD_MONTH_POSITION.key,{value:defCfg.MD_MONTH_POSITION.value,handler:this.configLocale,validator:this.cfg.checkNumber});this.cfg.addProperty(defCfg.MD_DAY_POSITION.key,{value:defCfg.MD_DAY_POSITION.value,handler:this.configLocale,validator:this.cfg.checkNumber});this.cfg.addProperty(defCfg.MDY_MONTH_POSITION.key,{value:defCfg.MDY_MONTH_POSITION.value,handler:this.configLocale,validator:this.cfg.checkNumber});this.cfg.addProperty(defCfg.MDY_DAY_POSITION.key,{value:defCfg.MDY_DAY_POSITION.value,handler:this.configLocale,validator:this.cfg.checkNumber});this.cfg.addProperty(defCfg.MDY_YEAR_POSITION.key,{value:defCfg.MDY_YEAR_POSITION.value,handler:this.configLocale,validator:this.cfg.checkNumber});this.cfg.addProperty(defCfg.MY_LABEL_MONTH_POSITION.key,{value:defCfg.MY_LABEL_MONTH_POSITION.value,handler:this.configLocale,validator:this.cfg.checkNumber});this.cfg.addProperty(defCfg.MY_LABEL_YEAR_POSITION.key,{value:defCfg.MY_LABEL_YEAR_POSITION.value,handler:this.configLocale,validator:this.cfg.checkNumber});this.cfg.addProperty(defCfg.MY_LABEL_MONTH_SUFFIX.key,{value:defCfg.MY_LABEL_MONTH_SUFFIX.value,handler:this.configLocale});this.cfg.addProperty(defCfg.MY_LABEL_YEAR_SUFFIX.key,{value:defCfg.MY_LABEL_YEAR_SUFFIX.value,handler:this.configLocale});};YAHOO.widget.Calendar.prototype.configPageDate=function(type,args,obj){this.cfg.setProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.PAGEDATE.key,this._parsePageDate(args[0]),true);};YAHOO.widget.Calendar.prototype.configMinDate=function(type,args,obj){var val=args[0];if(YAHOO.lang.isString(val)){val=this._parseDate(val);this.cfg.setProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.MINDATE.key,new Date(val[0],(val[1]-1),val[2]));}};YAHOO.widget.Calendar.prototype.configMaxDate=function(type,args,obj){var val=args[0];if(YAHOO.lang.isString(val)){val=this._parseDate(val);this.cfg.setProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.MAXDATE.key,new Date(val[0],(val[1]-1),val[2]));}};YAHOO.widget.Calendar.prototype.configSelected=function(type,args,obj){var selected=args[0];var cfgSelected=YAHOO.widget.Calendar._DEFAULT_CONFIG.SELECTED.key;if(selected){if(YAHOO.lang.isString(selected)){this.cfg.setProperty(cfgSelected,this._parseDates(selected),true);}}
if(!this._selectedDates){this._selectedDates=this.cfg.getProperty(cfgSelected);}};YAHOO.widget.Calendar.prototype.configOptions=function(type,args,obj){this.Options[type.toUpperCase()]=args[0];};YAHOO.widget.Calendar.prototype.configLocale=function(type,args,obj){var defCfg=YAHOO.widget.Calendar._DEFAULT_CONFIG;this.Locale[type.toUpperCase()]=args[0];this.cfg.refireEvent(defCfg.LOCALE_MONTHS.key);this.cfg.refireEvent(defCfg.LOCALE_WEEKDAYS.key);};YAHOO.widget.Calendar.prototype.configLocaleValues=function(type,args,obj){var defCfg=YAHOO.widget.Calendar._DEFAULT_CONFIG;type=type.toLowerCase();var val=args[0];switch(type){case defCfg.LOCALE_MONTHS.key:switch(val){case YAHOO.widget.Calendar.SHORT:this.Locale.LOCALE_MONTHS=this.cfg.getProperty(defCfg.MONTHS_SHORT.key).concat();break;case YAHOO.widget.Calendar.LONG:this.Locale.LOCALE_MONTHS=this.cfg.getProperty(defCfg.MONTHS_LONG.key).concat();break;}
break;case defCfg.LOCALE_WEEKDAYS.key:switch(val){case YAHOO.widget.Calendar.ONE_CHAR:this.Locale.LOCALE_WEEKDAYS=this.cfg.getProperty(defCfg.WEEKDAYS_1CHAR.key).concat();break;case YAHOO.widget.Calendar.SHORT:this.Locale.LOCALE_WEEKDAYS=this.cfg.getProperty(defCfg.WEEKDAYS_SHORT.key).concat();break;case YAHOO.widget.Calendar.MEDIUM:this.Locale.LOCALE_WEEKDAYS=this.cfg.getProperty(defCfg.WEEKDAYS_MEDIUM.key).concat();break;case YAHOO.widget.Calendar.LONG:this.Locale.LOCALE_WEEKDAYS=this.cfg.getProperty(defCfg.WEEKDAYS_LONG.key).concat();break;}
var START_WEEKDAY=this.cfg.getProperty(defCfg.START_WEEKDAY.key);if(START_WEEKDAY>0){for(var w=0;w<START_WEEKDAY;++w){this.Locale.LOCALE_WEEKDAYS.push(this.Locale.LOCALE_WEEKDAYS.shift());}}
break;}};YAHOO.widget.Calendar.prototype.initStyles=function(){var defStyle=YAHOO.widget.Calendar._STYLES;this.Style={CSS_ROW_HEADER:defStyle.CSS_ROW_HEADER,CSS_ROW_FOOTER:defStyle.CSS_ROW_FOOTER,CSS_CELL:defStyle.CSS_CELL,CSS_CELL_SELECTOR:defStyle.CSS_CELL_SELECTOR,CSS_CELL_SELECTED:defStyle.CSS_CELL_SELECTED,CSS_CELL_SELECTABLE:defStyle.CSS_CELL_SELECTABLE,CSS_CELL_RESTRICTED:defStyle.CSS_CELL_RESTRICTED,CSS_CELL_TODAY:defStyle.CSS_CELL_TODAY,CSS_CELL_OOM:defStyle.CSS_CELL_OOM,CSS_CELL_OOB:defStyle.CSS_CELL_OOB,CSS_HEADER:defStyle.CSS_HEADER,CSS_HEADER_TEXT:defStyle.CSS_HEADER_TEXT,CSS_BODY:defStyle.CSS_BODY,CSS_WEEKDAY_CELL:defStyle.CSS_WEEKDAY_CELL,CSS_WEEKDAY_ROW:defStyle.CSS_WEEKDAY_ROW,CSS_FOOTER:defStyle.CSS_FOOTER,CSS_CALENDAR:defStyle.CSS_CALENDAR,CSS_SINGLE:defStyle.CSS_SINGLE,CSS_CONTAINER:defStyle.CSS_CONTAINER,CSS_NAV_LEFT:defStyle.CSS_NAV_LEFT,CSS_NAV_RIGHT:defStyle.CSS_NAV_RIGHT,CSS_CLOSE:defStyle.CSS_CLOSE,CSS_CELL_TOP:defStyle.CSS_CELL_TOP,CSS_CELL_LEFT:defStyle.CSS_CELL_LEFT,CSS_CELL_RIGHT:defStyle.CSS_CELL_RIGHT,CSS_CELL_BOTTOM:defStyle.CSS_CELL_BOTTOM,CSS_CELL_HOVER:defStyle.CSS_CELL_HOVER,CSS_CELL_HIGHLIGHT1:defStyle.CSS_CELL_HIGHLIGHT1,CSS_CELL_HIGHLIGHT2:defStyle.CSS_CELL_HIGHLIGHT2,CSS_CELL_HIGHLIGHT3:defStyle.CSS_CELL_HIGHLIGHT3,CSS_CELL_HIGHLIGHT4:defStyle.CSS_CELL_HIGHLIGHT4};};YAHOO.widget.Calendar.prototype.buildMonthLabel=function(){var pageDate=this.cfg.getProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.PAGEDATE.key);var monthLabel=this.Locale.LOCALE_MONTHS[pageDate.getMonth()]+this.Locale.MY_LABEL_MONTH_SUFFIX;var yearLabel=pageDate.getFullYear()+this.Locale.MY_LABEL_YEAR_SUFFIX;if(this.Locale.MY_LABEL_MONTH_POSITION==2||this.Locale.MY_LABEL_YEAR_POSITION==1){return yearLabel+monthLabel;}else{return monthLabel+yearLabel;}};YAHOO.widget.Calendar.prototype.buildDayLabel=function(workingDate){return workingDate.getDate();};YAHOO.widget.Calendar.prototype.renderHeader=function(html){var colSpan=7;var DEPR_NAV_LEFT="us/tr/callt.gif";var DEPR_NAV_RIGHT="us/tr/calrt.gif";var defCfg=YAHOO.widget.Calendar._DEFAULT_CONFIG;if(this.cfg.getProperty(defCfg.SHOW_WEEK_HEADER.key)){colSpan+=1;}
if(this.cfg.getProperty(defCfg.SHOW_WEEK_FOOTER.key)){colSpan+=1;}
html[html.length]="<thead>";html[html.length]="<tr>";html[html.length]='<th colspan="'+colSpan+'" class="'+this.Style.CSS_HEADER_TEXT+'">';html[html.length]='<div class="'+this.Style.CSS_HEADER+'">';var renderLeft,renderRight=false;if(this.parent){if(this.index===0){renderLeft=true;}
if(this.index==(this.parent.cfg.getProperty("pages")-1)){renderRight=true;}}else{renderLeft=true;renderRight=true;}
var cal=this.parent||this;if(renderLeft){var leftArrow=this.cfg.getProperty(defCfg.NAV_ARROW_LEFT.key);if(leftArrow===null&&YAHOO.widget.Calendar.IMG_ROOT!==null){leftArrow=YAHOO.widget.Calendar.IMG_ROOT+DEPR_NAV_LEFT;}
var leftStyle=(leftArrow===null)?"":' style="background-image:url('+leftArrow+')"';html[html.length]='<a class="'+this.Style.CSS_NAV_LEFT+'"'+leftStyle+' >&#160;</a>';}
html[html.length]=this.buildMonthLabel();if(renderRight){var rightArrow=this.cfg.getProperty(defCfg.NAV_ARROW_RIGHT.key);if(rightArrow===null&&YAHOO.widget.Calendar.IMG_ROOT!==null){rightArrow=YAHOO.widget.Calendar.IMG_ROOT+DEPR_NAV_RIGHT;}
var rightStyle=(rightArrow===null)?"":' style="background-image:url('+rightArrow+')"';html[html.length]='<a class="'+this.Style.CSS_NAV_RIGHT+'"'+rightStyle+' >&#160;</a>';}
html[html.length]='</div>\n</th>\n</tr>';if(this.cfg.getProperty(defCfg.SHOW_WEEKDAYS.key)){html=this.buildWeekdays(html);}
html[html.length]='</thead>';return html;};YAHOO.widget.Calendar.prototype.buildWeekdays=function(html){var defCfg=YAHOO.widget.Calendar._DEFAULT_CONFIG;html[html.length]='<tr class="'+this.Style.CSS_WEEKDAY_ROW+'">';if(this.cfg.getProperty(defCfg.SHOW_WEEK_HEADER.key)){html[html.length]='<th>&#160;</th>';}
for(var i=0;i<this.Locale.LOCALE_WEEKDAYS.length;++i){html[html.length]='<th class="calweekdaycell">'+this.Locale.LOCALE_WEEKDAYS[i]+'</th>';}
if(this.cfg.getProperty(defCfg.SHOW_WEEK_FOOTER.key)){html[html.length]='<th>&#160;</th>';}
html[html.length]='</tr>';return html;};YAHOO.widget.Calendar.prototype.renderBody=function(workingDate,html){var defCfg=YAHOO.widget.Calendar._DEFAULT_CONFIG;var startDay=this.cfg.getProperty(defCfg.START_WEEKDAY.key);this.preMonthDays=workingDate.getDay();if(startDay>0){this.preMonthDays-=startDay;}
if(this.preMonthDays<0){this.preMonthDays+=7;}
this.monthDays=YAHOO.widget.DateMath.findMonthEnd(workingDate).getDate();this.postMonthDays=YAHOO.widget.Calendar.DISPLAY_DAYS-this.preMonthDays-this.monthDays;workingDate=YAHOO.widget.DateMath.subtract(workingDate,YAHOO.widget.DateMath.DAY,this.preMonthDays);var weekNum,weekClass;var weekPrefix="w";var cellPrefix="_cell";var workingDayPrefix="wd";var dayPrefix="d";var cellRenderers;var renderer;var todayYear=this.today.getFullYear();var todayMonth=this.today.getMonth();var todayDate=this.today.getDate();var useDate=this.cfg.getProperty(defCfg.PAGEDATE.key);var hideBlankWeeks=this.cfg.getProperty(defCfg.HIDE_BLANK_WEEKS.key);var showWeekFooter=this.cfg.getProperty(defCfg.SHOW_WEEK_FOOTER.key);var showWeekHeader=this.cfg.getProperty(defCfg.SHOW_WEEK_HEADER.key);var mindate=this.cfg.getProperty(defCfg.MINDATE.key);var maxdate=this.cfg.getProperty(defCfg.MAXDATE.key);if(mindate){mindate=YAHOO.widget.DateMath.clearTime(mindate);}
if(maxdate){maxdate=YAHOO.widget.DateMath.clearTime(maxdate);}
html[html.length]='<tbody class="m'+(useDate.getMonth()+1)+' '+this.Style.CSS_BODY+'">';var i=0;var tempDiv=document.createElement("div");var cell=document.createElement("td");tempDiv.appendChild(cell);var jan1=new Date(useDate.getFullYear(),0,1);var cal=this.parent||this;for(var r=0;r<6;r++){weekNum=YAHOO.widget.DateMath.getWeekNumber(workingDate,useDate.getFullYear(),startDay);weekClass=weekPrefix+weekNum;if(r!==0&&hideBlankWeeks===true&&workingDate.getMonth()!=useDate.getMonth()){break;}else{html[html.length]='<tr class="'+weekClass+'">';if(showWeekHeader){html=this.renderRowHeader(weekNum,html);}
for(var d=0;d<7;d++){cellRenderers=[];renderer=null;this.clearElement(cell);cell.className=this.Style.CSS_CELL;cell.id=this.id+cellPrefix+i;if(workingDate.getDate()==todayDate&&workingDate.getMonth()==todayMonth&&workingDate.getFullYear()==todayYear){cellRenderers[cellRenderers.length]=cal.renderCellStyleToday;}
var workingArray=[workingDate.getFullYear(),workingDate.getMonth()+1,workingDate.getDate()];this.cellDates[this.cellDates.length]=workingArray;if(workingDate.getMonth()!=useDate.getMonth()){cellRenderers[cellRenderers.length]=cal.renderCellNotThisMonth;}else{YAHOO.util.Dom.addClass(cell,workingDayPrefix+workingDate.getDay());YAHOO.util.Dom.addClass(cell,dayPrefix+workingDate.getDate());for(var s=0;s<this.renderStack.length;++s){var rArray=this.renderStack[s];var type=rArray[0];var month;var day;var year;switch(type){case YAHOO.widget.Calendar.DATE:month=rArray[1][1];day=rArray[1][2];year=rArray[1][0];if(workingDate.getMonth()+1==month&&workingDate.getDate()==day&&workingDate.getFullYear()==year){renderer=rArray[2];this.renderStack.splice(s,1);}
break;case YAHOO.widget.Calendar.MONTH_DAY:month=rArray[1][0];day=rArray[1][1];if(workingDate.getMonth()+1==month&&workingDate.getDate()==day){renderer=rArray[2];this.renderStack.splice(s,1);}
break;case YAHOO.widget.Calendar.RANGE:var date1=rArray[1][0];var date2=rArray[1][1];var d1month=date1[1];var d1day=date1[2];var d1year=date1[0];var d1=new Date(d1year,d1month-1,d1day);var d2month=date2[1];var d2day=date2[2];var d2year=date2[0];var d2=new Date(d2year,d2month-1,d2day);if(workingDate.getTime()>=d1.getTime()&&workingDate.getTime()<=d2.getTime()){renderer=rArray[2];if(workingDate.getTime()==d2.getTime()){this.renderStack.splice(s,1);}}
break;case YAHOO.widget.Calendar.WEEKDAY:var weekday=rArray[1][0];if(workingDate.getDay()+1==weekday){renderer=rArray[2];}
break;case YAHOO.widget.Calendar.MONTH:month=rArray[1][0];if(workingDate.getMonth()+1==month){renderer=rArray[2];}
break;}
if(renderer){cellRenderers[cellRenderers.length]=renderer;}}}
if(this._indexOfSelectedFieldArray(workingArray)>-1){cellRenderers[cellRenderers.length]=cal.renderCellStyleSelected;}
if((mindate&&(workingDate.getTime()<mindate.getTime()))||(maxdate&&(workingDate.getTime()>maxdate.getTime()))){cellRenderers[cellRenderers.length]=cal.renderOutOfBoundsDate;}else{cellRenderers[cellRenderers.length]=cal.styleCellDefault;cellRenderers[cellRenderers.length]=cal.renderCellDefault;}
for(var x=0;x<cellRenderers.length;++x){if(cellRenderers[x].call(cal,workingDate,cell)==YAHOO.widget.Calendar.STOP_RENDER){break;}}
workingDate.setTime(workingDate.getTime()+YAHOO.widget.DateMath.ONE_DAY_MS);if(i>=0&&i<=6){YAHOO.util.Dom.addClass(cell,this.Style.CSS_CELL_TOP);}
if((i%7)===0){YAHOO.util.Dom.addClass(cell,this.Style.CSS_CELL_LEFT);}
if(((i+1)%7)===0){YAHOO.util.Dom.addClass(cell,this.Style.CSS_CELL_RIGHT);}
var postDays=this.postMonthDays;if(hideBlankWeeks&&postDays>=7){var blankWeeks=Math.floor(postDays/7);for(var p=0;p<blankWeeks;++p){postDays-=7;}}
if(i>=((this.preMonthDays+postDays+this.monthDays)-7)){YAHOO.util.Dom.addClass(cell,this.Style.CSS_CELL_BOTTOM);}
html[html.length]=tempDiv.innerHTML;i++;}
if(showWeekFooter){html=this.renderRowFooter(weekNum,html);}
html[html.length]='</tr>';}}
html[html.length]='</tbody>';return html;};YAHOO.widget.Calendar.prototype.renderFooter=function(html){return html;};YAHOO.widget.Calendar.prototype.render=function(){this.beforeRenderEvent.fire();var defCfg=YAHOO.widget.Calendar._DEFAULT_CONFIG;var workingDate=YAHOO.widget.DateMath.findMonthStart(this.cfg.getProperty(defCfg.PAGEDATE.key));this.resetRenderers();this.cellDates.length=0;YAHOO.util.Event.purgeElement(this.oDomContainer,true);var html=[];html[html.length]='<table cellSpacing="0" class="'+this.Style.CSS_CALENDAR+' y'+workingDate.getFullYear()+'" id="'+this.id+'">';html=this.renderHeader(html);html=this.renderBody(workingDate,html);html=this.renderFooter(html);html[html.length]='</table>';this.oDomContainer.innerHTML=html.join("\n");this.applyListeners();this.cells=this.oDomContainer.getElementsByTagName("td");this.cfg.refireEvent(defCfg.TITLE.key);this.cfg.refireEvent(defCfg.CLOSE.key);this.cfg.refireEvent(defCfg.IFRAME.key);this.renderEvent.fire();};YAHOO.widget.Calendar.prototype.applyListeners=function(){var root=this.oDomContainer;var cal=this.parent||this;var anchor="a";var mousedown="mousedown";var linkLeft=YAHOO.util.Dom.getElementsByClassName(this.Style.CSS_NAV_LEFT,anchor,root);var linkRight=YAHOO.util.Dom.getElementsByClassName(this.Style.CSS_NAV_RIGHT,anchor,root);if(linkLeft&&linkLeft.length>0){this.linkLeft=linkLeft[0];YAHOO.util.Event.addListener(this.linkLeft,mousedown,cal.previousMonth,cal,true);}
if(linkRight&&linkRight.length>0){this.linkRight=linkRight[0];YAHOO.util.Event.addListener(this.linkRight,mousedown,cal.nextMonth,cal,true);}
if(this.domEventMap){var el,elements;for(var cls in this.domEventMap){if(YAHOO.lang.hasOwnProperty(this.domEventMap,cls)){var items=this.domEventMap[cls];if(!(items instanceof Array)){items=[items];}
for(var i=0;i<items.length;i++){var item=items[i];elements=YAHOO.util.Dom.getElementsByClassName(cls,item.tag,this.oDomContainer);for(var c=0;c<elements.length;c++){el=elements[c];YAHOO.util.Event.addListener(el,item.event,item.handler,item.scope,item.correct);}}}}}
YAHOO.util.Event.addListener(this.oDomContainer,"click",this.doSelectCell,this);YAHOO.util.Event.addListener(this.oDomContainer,"mouseover",this.doCellMouseOver,this);YAHOO.util.Event.addListener(this.oDomContainer,"mouseout",this.doCellMouseOut,this);};YAHOO.widget.Calendar.prototype.getDateByCellId=function(id){var date=this.getDateFieldsByCellId(id);return new Date(date[0],date[1]-1,date[2]);};YAHOO.widget.Calendar.prototype.getDateFieldsByCellId=function(id){id=id.toLowerCase().split("_cell")[1];id=parseInt(id,10);return this.cellDates[id];};YAHOO.widget.Calendar.prototype.renderOutOfBoundsDate=function(workingDate,cell){YAHOO.util.Dom.addClass(cell,this.Style.CSS_CELL_OOB);cell.innerHTML=workingDate.getDate();return YAHOO.widget.Calendar.STOP_RENDER;};YAHOO.widget.Calendar.prototype.renderRowHeader=function(weekNum,html){html[html.length]='<th class="calrowhead">'+weekNum+'</th>';return html;};YAHOO.widget.Calendar.prototype.renderRowFooter=function(weekNum,html){html[html.length]='<th class="calrowfoot">'+weekNum+'</th>';return html;};YAHOO.widget.Calendar.prototype.renderCellDefault=function(workingDate,cell){cell.innerHTML='<a href="#" class="'+this.Style.CSS_CELL_SELECTOR+'">'+this.buildDayLabel(workingDate)+"</a>";};YAHOO.widget.Calendar.prototype.styleCellDefault=function(workingDate,cell){YAHOO.util.Dom.addClass(cell,this.Style.CSS_CELL_SELECTABLE);};YAHOO.widget.Calendar.prototype.renderCellStyleHighlight1=function(workingDate,cell){YAHOO.util.Dom.addClass(cell,this.Style.CSS_CELL_HIGHLIGHT1);};YAHOO.widget.Calendar.prototype.renderCellStyleHighlight2=function(workingDate,cell){YAHOO.util.Dom.addClass(cell,this.Style.CSS_CELL_HIGHLIGHT2);};YAHOO.widget.Calendar.prototype.renderCellStyleHighlight3=function(workingDate,cell){YAHOO.util.Dom.addClass(cell,this.Style.CSS_CELL_HIGHLIGHT3);};YAHOO.widget.Calendar.prototype.renderCellStyleHighlight4=function(workingDate,cell){YAHOO.util.Dom.addClass(cell,this.Style.CSS_CELL_HIGHLIGHT4);};YAHOO.widget.Calendar.prototype.renderCellStyleToday=function(workingDate,cell){YAHOO.util.Dom.addClass(cell,this.Style.CSS_CELL_TODAY);};YAHOO.widget.Calendar.prototype.renderCellStyleSelected=function(workingDate,cell){YAHOO.util.Dom.addClass(cell,this.Style.CSS_CELL_SELECTED);};YAHOO.widget.Calendar.prototype.renderCellNotThisMonth=function(workingDate,cell){YAHOO.util.Dom.addClass(cell,this.Style.CSS_CELL_OOM);cell.innerHTML=workingDate.getDate();return YAHOO.widget.Calendar.STOP_RENDER;};YAHOO.widget.Calendar.prototype.renderBodyCellRestricted=function(workingDate,cell){YAHOO.util.Dom.addClass(cell,this.Style.CSS_CELL);YAHOO.util.Dom.addClass(cell,this.Style.CSS_CELL_RESTRICTED);cell.innerHTML=workingDate.getDate();return YAHOO.widget.Calendar.STOP_RENDER;};YAHOO.widget.Calendar.prototype.addMonths=function(count){var cfgPageDate=YAHOO.widget.Calendar._DEFAULT_CONFIG.PAGEDATE.key;this.cfg.setProperty(cfgPageDate,YAHOO.widget.DateMath.add(this.cfg.getProperty(cfgPageDate),YAHOO.widget.DateMath.MONTH,count));this.resetRenderers();this.changePageEvent.fire();};YAHOO.widget.Calendar.prototype.subtractMonths=function(count){var cfgPageDate=YAHOO.widget.Calendar._DEFAULT_CONFIG.PAGEDATE.key;this.cfg.setProperty(cfgPageDate,YAHOO.widget.DateMath.subtract(this.cfg.getProperty(cfgPageDate),YAHOO.widget.DateMath.MONTH,count));this.resetRenderers();this.changePageEvent.fire();};YAHOO.widget.Calendar.prototype.addYears=function(count){var cfgPageDate=YAHOO.widget.Calendar._DEFAULT_CONFIG.PAGEDATE.key;this.cfg.setProperty(cfgPageDate,YAHOO.widget.DateMath.add(this.cfg.getProperty(cfgPageDate),YAHOO.widget.DateMath.YEAR,count));this.resetRenderers();this.changePageEvent.fire();};YAHOO.widget.Calendar.prototype.subtractYears=function(count){var cfgPageDate=YAHOO.widget.Calendar._DEFAULT_CONFIG.PAGEDATE.key;this.cfg.setProperty(cfgPageDate,YAHOO.widget.DateMath.subtract(this.cfg.getProperty(cfgPageDate),YAHOO.widget.DateMath.YEAR,count));this.resetRenderers();this.changePageEvent.fire();};YAHOO.widget.Calendar.prototype.nextMonth=function(){this.addMonths(1);};YAHOO.widget.Calendar.prototype.previousMonth=function(){this.subtractMonths(1);};YAHOO.widget.Calendar.prototype.nextYear=function(){this.addYears(1);};YAHOO.widget.Calendar.prototype.previousYear=function(){this.subtractYears(1);};YAHOO.widget.Calendar.prototype.reset=function(){var defCfg=YAHOO.widget.Calendar._DEFAULT_CONFIG;this.cfg.resetProperty(defCfg.SELECTED.key);this.cfg.resetProperty(defCfg.PAGEDATE.key);this.resetEvent.fire();};YAHOO.widget.Calendar.prototype.clear=function(){var defCfg=YAHOO.widget.Calendar._DEFAULT_CONFIG;this.cfg.setProperty(defCfg.SELECTED.key,[]);this.cfg.setProperty(defCfg.PAGEDATE.key,new Date(this.today.getTime()));this.clearEvent.fire();};YAHOO.widget.Calendar.prototype.select=function(date){var aToBeSelected=this._toFieldArray(date);var validDates=[];var selected=[];var cfgSelected=YAHOO.widget.Calendar._DEFAULT_CONFIG.SELECTED.key;for(var a=0;a<aToBeSelected.length;++a){var toSelect=aToBeSelected[a];if(!this.isDateOOB(this._toDate(toSelect))){if(validDates.length===0){this.beforeSelectEvent.fire();selected=this.cfg.getProperty(cfgSelected);}
validDates.push(toSelect);if(this._indexOfSelectedFieldArray(toSelect)==-1){selected[selected.length]=toSelect;}}}
if(validDates.length>0){if(this.parent){this.parent.cfg.setProperty(cfgSelected,selected);}else{this.cfg.setProperty(cfgSelected,selected);}
this.selectEvent.fire(validDates);}
return this.getSelectedDates();};YAHOO.widget.Calendar.prototype.selectCell=function(cellIndex){var cell=this.cells[cellIndex];var cellDate=this.cellDates[cellIndex];var dCellDate=this._toDate(cellDate);var selectable=YAHOO.util.Dom.hasClass(cell,this.Style.CSS_CELL_SELECTABLE);if(selectable){this.beforeSelectEvent.fire();var cfgSelected=YAHOO.widget.Calendar._DEFAULT_CONFIG.SELECTED.key;var selected=this.cfg.getProperty(cfgSelected);var selectDate=cellDate.concat();if(this._indexOfSelectedFieldArray(selectDate)==-1){selected[selected.length]=selectDate;}
if(this.parent){this.parent.cfg.setProperty(cfgSelected,selected);}else{this.cfg.setProperty(cfgSelected,selected);}
this.renderCellStyleSelected(dCellDate,cell);this.selectEvent.fire([selectDate]);this.doCellMouseOut.call(cell,null,this);}
return this.getSelectedDates();};YAHOO.widget.Calendar.prototype.deselect=function(date){var aToBeDeselected=this._toFieldArray(date);var validDates=[];var selected=[];var cfgSelected=YAHOO.widget.Calendar._DEFAULT_CONFIG.SELECTED.key;for(var a=0;a<aToBeDeselected.length;++a){var toDeselect=aToBeDeselected[a];if(!this.isDateOOB(this._toDate(toDeselect))){if(validDates.length===0){this.beforeDeselectEvent.fire();selected=this.cfg.getProperty(cfgSelected);}
validDates.push(toDeselect);var index=this._indexOfSelectedFieldArray(toDeselect);if(index!=-1){selected.splice(index,1);}}}
if(validDates.length>0){if(this.parent){this.parent.cfg.setProperty(cfgSelected,selected);}else{this.cfg.setProperty(cfgSelected,selected);}
this.deselectEvent.fire(validDates);}
return this.getSelectedDates();};YAHOO.widget.Calendar.prototype.deselectCell=function(cellIndex){var cell=this.cells[cellIndex];var cellDate=this.cellDates[cellIndex];var cellDateIndex=this._indexOfSelectedFieldArray(cellDate);var selectable=YAHOO.util.Dom.hasClass(cell,this.Style.CSS_CELL_SELECTABLE);if(selectable){this.beforeDeselectEvent.fire();var defCfg=YAHOO.widget.Calendar._DEFAULT_CONFIG;var selected=this.cfg.getProperty(defCfg.SELECTED.key);var dCellDate=this._toDate(cellDate);var selectDate=cellDate.concat();if(cellDateIndex>-1){if(this.cfg.getProperty(defCfg.PAGEDATE.key).getMonth()==dCellDate.getMonth()&&this.cfg.getProperty(defCfg.PAGEDATE.key).getFullYear()==dCellDate.getFullYear()){YAHOO.util.Dom.removeClass(cell,this.Style.CSS_CELL_SELECTED);}
selected.splice(cellDateIndex,1);}
if(this.parent){this.parent.cfg.setProperty(defCfg.SELECTED.key,selected);}else{this.cfg.setProperty(defCfg.SELECTED.key,selected);}
this.deselectEvent.fire(selectDate);}
return this.getSelectedDates();};YAHOO.widget.Calendar.prototype.deselectAll=function(){this.beforeDeselectEvent.fire();var cfgSelected=YAHOO.widget.Calendar._DEFAULT_CONFIG.SELECTED.key;var selected=this.cfg.getProperty(cfgSelected);var count=selected.length;var sel=selected.concat();if(this.parent){this.parent.cfg.setProperty(cfgSelected,[]);}else{this.cfg.setProperty(cfgSelected,[]);}
if(count>0){this.deselectEvent.fire(sel);}
return this.getSelectedDates();};YAHOO.widget.Calendar.prototype._toFieldArray=function(date){var returnDate=[];if(date instanceof Date){returnDate=[[date.getFullYear(),date.getMonth()+1,date.getDate()]];}else if(YAHOO.lang.isString(date)){returnDate=this._parseDates(date);}else if(YAHOO.lang.isArray(date)){for(var i=0;i<date.length;++i){var d=date[i];returnDate[returnDate.length]=[d.getFullYear(),d.getMonth()+1,d.getDate()];}}
return returnDate;};YAHOO.widget.Calendar.prototype._toDate=function(dateFieldArray){if(dateFieldArray instanceof Date){return dateFieldArray;}else{return new Date(dateFieldArray[0],dateFieldArray[1]-1,dateFieldArray[2]);}};YAHOO.widget.Calendar.prototype._fieldArraysAreEqual=function(array1,array2){var match=false;if(array1[0]==array2[0]&&array1[1]==array2[1]&&array1[2]==array2[2]){match=true;}
return match;};YAHOO.widget.Calendar.prototype._indexOfSelectedFieldArray=function(find){var selected=-1;var seldates=this.cfg.getProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.SELECTED.key);for(var s=0;s<seldates.length;++s){var sArray=seldates[s];if(find[0]==sArray[0]&&find[1]==sArray[1]&&find[2]==sArray[2]){selected=s;break;}}
return selected;};YAHOO.widget.Calendar.prototype.isDateOOM=function(date){return(date.getMonth()!=this.cfg.getProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.PAGEDATE.key).getMonth());};YAHOO.widget.Calendar.prototype.isDateOOB=function(date){var defCfg=YAHOO.widget.Calendar._DEFAULT_CONFIG;var minDate=this.cfg.getProperty(defCfg.MINDATE.key);var maxDate=this.cfg.getProperty(defCfg.MAXDATE.key);var dm=YAHOO.widget.DateMath;if(minDate){minDate=dm.clearTime(minDate);}
if(maxDate){maxDate=dm.clearTime(maxDate);}
var clearedDate=new Date(date.getTime());clearedDate=dm.clearTime(clearedDate);return((minDate&&clearedDate.getTime()<minDate.getTime())||(maxDate&&clearedDate.getTime()>maxDate.getTime()));};YAHOO.widget.Calendar.prototype._parsePageDate=function(date){var parsedDate;var defCfg=YAHOO.widget.Calendar._DEFAULT_CONFIG;if(date){if(date instanceof Date){parsedDate=YAHOO.widget.DateMath.findMonthStart(date);}else{var month,year,aMonthYear;aMonthYear=date.split(this.cfg.getProperty(defCfg.DATE_FIELD_DELIMITER.key));month=parseInt(aMonthYear[this.cfg.getProperty(defCfg.MY_MONTH_POSITION.key)-1],10)-1;year=parseInt(aMonthYear[this.cfg.getProperty(defCfg.MY_YEAR_POSITION.key)-1],10);parsedDate=new Date(year,month,1);}}else{parsedDate=new Date(this.today.getFullYear(),this.today.getMonth(),1);}
return parsedDate;};YAHOO.widget.Calendar.prototype.onBeforeSelect=function(){if(this.cfg.getProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.MULTI_SELECT.key)===false){if(this.parent){this.parent.callChildFunction("clearAllBodyCellStyles",this.Style.CSS_CELL_SELECTED);this.parent.deselectAll();}else{this.clearAllBodyCellStyles(this.Style.CSS_CELL_SELECTED);this.deselectAll();}}};YAHOO.widget.Calendar.prototype.onSelect=function(selected){};YAHOO.widget.Calendar.prototype.onBeforeDeselect=function(){};YAHOO.widget.Calendar.prototype.onDeselect=function(deselected){};YAHOO.widget.Calendar.prototype.onChangePage=function(){this.render();};YAHOO.widget.Calendar.prototype.onRender=function(){};YAHOO.widget.Calendar.prototype.onReset=function(){this.render();};YAHOO.widget.Calendar.prototype.onClear=function(){this.render();};YAHOO.widget.Calendar.prototype.validate=function(){return true;};YAHOO.widget.Calendar.prototype._parseDate=function(sDate){var aDate=sDate.split(this.Locale.DATE_FIELD_DELIMITER);var rArray;if(aDate.length==2){rArray=[aDate[this.Locale.MD_MONTH_POSITION-1],aDate[this.Locale.MD_DAY_POSITION-1]];rArray.type=YAHOO.widget.Calendar.MONTH_DAY;}else{rArray=[aDate[this.Locale.MDY_YEAR_POSITION-1],aDate[this.Locale.MDY_MONTH_POSITION-1],aDate[this.Locale.MDY_DAY_POSITION-1]];rArray.type=YAHOO.widget.Calendar.DATE;}
for(var i=0;i<rArray.length;i++){rArray[i]=parseInt(rArray[i],10);}
return rArray;};YAHOO.widget.Calendar.prototype._parseDates=function(sDates){var aReturn=[];var aDates=sDates.split(this.Locale.DATE_DELIMITER);for(var d=0;d<aDates.length;++d){var sDate=aDates[d];if(sDate.indexOf(this.Locale.DATE_RANGE_DELIMITER)!=-1){var aRange=sDate.split(this.Locale.DATE_RANGE_DELIMITER);var dateStart=this._parseDate(aRange[0]);var dateEnd=this._parseDate(aRange[1]);var fullRange=this._parseRange(dateStart,dateEnd);aReturn=aReturn.concat(fullRange);}else{var aDate=this._parseDate(sDate);aReturn.push(aDate);}}
return aReturn;};YAHOO.widget.Calendar.prototype._parseRange=function(startDate,endDate){var dStart=new Date(startDate[0],startDate[1]-1,startDate[2]);var dCurrent=YAHOO.widget.DateMath.add(new Date(startDate[0],startDate[1]-1,startDate[2]),YAHOO.widget.DateMath.DAY,1);var dEnd=new Date(endDate[0],endDate[1]-1,endDate[2]);var results=[];results.push(startDate);while(dCurrent.getTime()<=dEnd.getTime()){results.push([dCurrent.getFullYear(),dCurrent.getMonth()+1,dCurrent.getDate()]);dCurrent=YAHOO.widget.DateMath.add(dCurrent,YAHOO.widget.DateMath.DAY,1);}
return results;};YAHOO.widget.Calendar.prototype.resetRenderers=function(){this.renderStack=this._renderStack.concat();};YAHOO.widget.Calendar.prototype.clearElement=function(cell){cell.innerHTML="&#160;";cell.className="";};YAHOO.widget.Calendar.prototype.addRenderer=function(sDates,fnRender){var aDates=this._parseDates(sDates);for(var i=0;i<aDates.length;++i){var aDate=aDates[i];if(aDate.length==2){if(aDate[0]instanceof Array){this._addRenderer(YAHOO.widget.Calendar.RANGE,aDate,fnRender);}else{this._addRenderer(YAHOO.widget.Calendar.MONTH_DAY,aDate,fnRender);}}else if(aDate.length==3){this._addRenderer(YAHOO.widget.Calendar.DATE,aDate,fnRender);}}};YAHOO.widget.Calendar.prototype._addRenderer=function(type,aDates,fnRender){var add=[type,aDates,fnRender];this.renderStack.unshift(add);this._renderStack=this.renderStack.concat();};YAHOO.widget.Calendar.prototype.addMonthRenderer=function(month,fnRender){this._addRenderer(YAHOO.widget.Calendar.MONTH,[month],fnRender);};YAHOO.widget.Calendar.prototype.addWeekdayRenderer=function(weekday,fnRender){this._addRenderer(YAHOO.widget.Calendar.WEEKDAY,[weekday],fnRender);};YAHOO.widget.Calendar.prototype.clearAllBodyCellStyles=function(style){for(var c=0;c<this.cells.length;++c){YAHOO.util.Dom.removeClass(this.cells[c],style);}};YAHOO.widget.Calendar.prototype.setMonth=function(month){var cfgPageDate=YAHOO.widget.Calendar._DEFAULT_CONFIG.PAGEDATE.key;var current=this.cfg.getProperty(cfgPageDate);current.setMonth(parseInt(month,10));this.cfg.setProperty(cfgPageDate,current);};YAHOO.widget.Calendar.prototype.setYear=function(year){var cfgPageDate=YAHOO.widget.Calendar._DEFAULT_CONFIG.PAGEDATE.key;var current=this.cfg.getProperty(cfgPageDate);current.setFullYear(parseInt(year,10));this.cfg.setProperty(cfgPageDate,current);};YAHOO.widget.Calendar.prototype.getSelectedDates=function(){var returnDates=[];var selected=this.cfg.getProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.SELECTED.key);for(var d=0;d<selected.length;++d){var dateArray=selected[d];var date=new Date(dateArray[0],dateArray[1]-1,dateArray[2]);returnDates.push(date);}
returnDates.sort(function(a,b){return a-b;});return returnDates;};YAHOO.widget.Calendar.prototype.hide=function(){this.oDomContainer.style.display="none";};YAHOO.widget.Calendar.prototype.show=function(){this.oDomContainer.style.display="block";};YAHOO.widget.Calendar.prototype.browser=function(){var ua=navigator.userAgent.toLowerCase();if(ua.indexOf('opera')!=-1){return'opera';}else if(ua.indexOf('msie 7')!=-1){return'ie7';}else if(ua.indexOf('msie')!=-1){return'ie';}else if(ua.indexOf('safari')!=-1){return'safari';}else if(ua.indexOf('gecko')!=-1){return'gecko';}else{return false;}}();YAHOO.widget.Calendar.prototype.toString=function(){return"Calendar "+this.id;};YAHOO.widget.Calendar_Core=YAHOO.widget.Calendar;YAHOO.widget.Cal_Core=YAHOO.widget.Calendar;YAHOO.widget.CalendarGroup=function(id,containerId,config){if(arguments.length>0){this.init(id,containerId,config);}};YAHOO.widget.CalendarGroup.prototype.init=function(id,containerId,config){this.initEvents();this.initStyles();this.pages=[];this.id=id;this.containerId=containerId;this.oDomContainer=document.getElementById(containerId);YAHOO.util.Dom.addClass(this.oDomContainer,YAHOO.widget.CalendarGroup.CSS_CONTAINER);YAHOO.util.Dom.addClass(this.oDomContainer,YAHOO.widget.CalendarGroup.CSS_MULTI_UP);this.cfg=new YAHOO.util.Config(this);this.Options={};this.Locale={};this.setupConfig();if(config){this.cfg.applyConfig(config,true);}
this.cfg.fireQueue();if(YAHOO.env.ua.opera){this.renderEvent.subscribe(this._fixWidth,this,true);}};YAHOO.widget.CalendarGroup.prototype.setupConfig=function(){var defCfg=YAHOO.widget.CalendarGroup._DEFAULT_CONFIG;this.cfg.addProperty(defCfg.PAGES.key,{value:defCfg.PAGES.value,validator:this.cfg.checkNumber,handler:this.configPages});this.cfg.addProperty(defCfg.PAGEDATE.key,{value:new Date(),handler:this.configPageDate});this.cfg.addProperty(defCfg.SELECTED.key,{value:[],handler:this.configSelected});this.cfg.addProperty(defCfg.TITLE.key,{value:defCfg.TITLE.value,handler:this.configTitle});this.cfg.addProperty(defCfg.CLOSE.key,{value:defCfg.CLOSE.value,handler:this.configClose});this.cfg.addProperty(defCfg.IFRAME.key,{value:defCfg.IFRAME.value,handler:this.configIframe,validator:this.cfg.checkBoolean});this.cfg.addProperty(defCfg.MINDATE.key,{value:defCfg.MINDATE.value,handler:this.delegateConfig});this.cfg.addProperty(defCfg.MAXDATE.key,{value:defCfg.MAXDATE.value,handler:this.delegateConfig});this.cfg.addProperty(defCfg.MULTI_SELECT.key,{value:defCfg.MULTI_SELECT.value,handler:this.delegateConfig,validator:this.cfg.checkBoolean});this.cfg.addProperty(defCfg.START_WEEKDAY.key,{value:defCfg.START_WEEKDAY.value,handler:this.delegateConfig,validator:this.cfg.checkNumber});this.cfg.addProperty(defCfg.SHOW_WEEKDAYS.key,{value:defCfg.SHOW_WEEKDAYS.value,handler:this.delegateConfig,validator:this.cfg.checkBoolean});this.cfg.addProperty(defCfg.SHOW_WEEK_HEADER.key,{value:defCfg.SHOW_WEEK_HEADER.value,handler:this.delegateConfig,validator:this.cfg.checkBoolean});this.cfg.addProperty(defCfg.SHOW_WEEK_FOOTER.key,{value:defCfg.SHOW_WEEK_FOOTER.value,handler:this.delegateConfig,validator:this.cfg.checkBoolean});this.cfg.addProperty(defCfg.HIDE_BLANK_WEEKS.key,{value:defCfg.HIDE_BLANK_WEEKS.value,handler:this.delegateConfig,validator:this.cfg.checkBoolean});this.cfg.addProperty(defCfg.NAV_ARROW_LEFT.key,{value:defCfg.NAV_ARROW_LEFT.value,handler:this.delegateConfig});this.cfg.addProperty(defCfg.NAV_ARROW_RIGHT.key,{value:defCfg.NAV_ARROW_RIGHT.value,handler:this.delegateConfig});this.cfg.addProperty(defCfg.MONTHS_SHORT.key,{value:defCfg.MONTHS_SHORT.value,handler:this.delegateConfig});this.cfg.addProperty(defCfg.MONTHS_LONG.key,{value:defCfg.MONTHS_LONG.value,handler:this.delegateConfig});this.cfg.addProperty(defCfg.WEEKDAYS_1CHAR.key,{value:defCfg.WEEKDAYS_1CHAR.value,handler:this.delegateConfig});this.cfg.addProperty(defCfg.WEEKDAYS_SHORT.key,{value:defCfg.WEEKDAYS_SHORT.value,handler:this.delegateConfig});this.cfg.addProperty(defCfg.WEEKDAYS_MEDIUM.key,{value:defCfg.WEEKDAYS_MEDIUM.value,handler:this.delegateConfig});this.cfg.addProperty(defCfg.WEEKDAYS_LONG.key,{value:defCfg.WEEKDAYS_LONG.value,handler:this.delegateConfig});this.cfg.addProperty(defCfg.LOCALE_MONTHS.key,{value:defCfg.LOCALE_MONTHS.value,handler:this.delegateConfig});this.cfg.addProperty(defCfg.LOCALE_WEEKDAYS.key,{value:defCfg.LOCALE_WEEKDAYS.value,handler:this.delegateConfig});this.cfg.addProperty(defCfg.DATE_DELIMITER.key,{value:defCfg.DATE_DELIMITER.value,handler:this.delegateConfig});this.cfg.addProperty(defCfg.DATE_FIELD_DELIMITER.key,{value:defCfg.DATE_FIELD_DELIMITER.value,handler:this.delegateConfig});this.cfg.addProperty(defCfg.DATE_RANGE_DELIMITER.key,{value:defCfg.DATE_RANGE_DELIMITER.value,handler:this.delegateConfig});this.cfg.addProperty(defCfg.MY_MONTH_POSITION.key,{value:defCfg.MY_MONTH_POSITION.value,handler:this.delegateConfig,validator:this.cfg.checkNumber});this.cfg.addProperty(defCfg.MY_YEAR_POSITION.key,{value:defCfg.MY_YEAR_POSITION.value,handler:this.delegateConfig,validator:this.cfg.checkNumber});this.cfg.addProperty(defCfg.MD_MONTH_POSITION.key,{value:defCfg.MD_MONTH_POSITION.value,handler:this.delegateConfig,validator:this.cfg.checkNumber});this.cfg.addProperty(defCfg.MD_DAY_POSITION.key,{value:defCfg.MD_DAY_POSITION.value,handler:this.delegateConfig,validator:this.cfg.checkNumber});this.cfg.addProperty(defCfg.MDY_MONTH_POSITION.key,{value:defCfg.MDY_MONTH_POSITION.value,handler:this.delegateConfig,validator:this.cfg.checkNumber});this.cfg.addProperty(defCfg.MDY_DAY_POSITION.key,{value:defCfg.MDY_DAY_POSITION.value,handler:this.delegateConfig,validator:this.cfg.checkNumber});this.cfg.addProperty(defCfg.MDY_YEAR_POSITION.key,{value:defCfg.MDY_YEAR_POSITION.value,handler:this.delegateConfig,validator:this.cfg.checkNumber});this.cfg.addProperty(defCfg.MY_LABEL_MONTH_POSITION.key,{value:defCfg.MY_LABEL_MONTH_POSITION.value,handler:this.delegateConfig,validator:this.cfg.checkNumber});this.cfg.addProperty(defCfg.MY_LABEL_YEAR_POSITION.key,{value:defCfg.MY_LABEL_YEAR_POSITION.value,handler:this.delegateConfig,validator:this.cfg.checkNumber});this.cfg.addProperty(defCfg.MY_LABEL_MONTH_SUFFIX.key,{value:defCfg.MY_LABEL_MONTH_SUFFIX.value,handler:this.delegateConfig});this.cfg.addProperty(defCfg.MY_LABEL_YEAR_SUFFIX.key,{value:defCfg.MY_LABEL_YEAR_SUFFIX.value,handler:this.delegateConfig});};YAHOO.widget.CalendarGroup.prototype.initEvents=function(){var me=this;var strEvent="Event";var sub=function(fn,obj,bOverride){for(var p=0;p<me.pages.length;++p){var cal=me.pages[p];cal[this.type+strEvent].subscribe(fn,obj,bOverride);}};var unsub=function(fn,obj){for(var p=0;p<me.pages.length;++p){var cal=me.pages[p];cal[this.type+strEvent].unsubscribe(fn,obj);}};var defEvents=YAHOO.widget.Calendar._EVENT_TYPES;this.beforeSelectEvent=new YAHOO.util.CustomEvent(defEvents.BEFORE_SELECT);this.beforeSelectEvent.subscribe=sub;this.beforeSelectEvent.unsubscribe=unsub;this.selectEvent=new YAHOO.util.CustomEvent(defEvents.SELECT);this.selectEvent.subscribe=sub;this.selectEvent.unsubscribe=unsub;this.beforeDeselectEvent=new YAHOO.util.CustomEvent(defEvents.BEFORE_DESELECT);this.beforeDeselectEvent.subscribe=sub;this.beforeDeselectEvent.unsubscribe=unsub;this.deselectEvent=new YAHOO.util.CustomEvent(defEvents.DESELECT);this.deselectEvent.subscribe=sub;this.deselectEvent.unsubscribe=unsub;this.changePageEvent=new YAHOO.util.CustomEvent(defEvents.CHANGE_PAGE);this.changePageEvent.subscribe=sub;this.changePageEvent.unsubscribe=unsub;this.beforeRenderEvent=new YAHOO.util.CustomEvent(defEvents.BEFORE_RENDER);this.beforeRenderEvent.subscribe=sub;this.beforeRenderEvent.unsubscribe=unsub;this.renderEvent=new YAHOO.util.CustomEvent(defEvents.RENDER);this.renderEvent.subscribe=sub;this.renderEvent.unsubscribe=unsub;this.resetEvent=new YAHOO.util.CustomEvent(defEvents.RESET);this.resetEvent.subscribe=sub;this.resetEvent.unsubscribe=unsub;this.clearEvent=new YAHOO.util.CustomEvent(defEvents.CLEAR);this.clearEvent.subscribe=sub;this.clearEvent.unsubscribe=unsub;};YAHOO.widget.CalendarGroup.prototype.configPages=function(type,args,obj){var pageCount=args[0];var cfgPageDate=YAHOO.widget.CalendarGroup._DEFAULT_CONFIG.PAGEDATE.key;var sep="_";var groupCalClass="groupcal";var firstClass="first-of-type";var lastClass="last-of-type";for(var p=0;p<pageCount;++p){var calId=this.id+sep+p;var calContainerId=this.containerId+sep+p;var childConfig=this.cfg.getConfig();childConfig.close=false;childConfig.title=false;var cal=this.constructChild(calId,calContainerId,childConfig);var caldate=cal.cfg.getProperty(cfgPageDate);this._setMonthOnDate(caldate,caldate.getMonth()+p);cal.cfg.setProperty(cfgPageDate,caldate);YAHOO.util.Dom.removeClass(cal.oDomContainer,this.Style.CSS_SINGLE);YAHOO.util.Dom.addClass(cal.oDomContainer,groupCalClass);if(p===0){YAHOO.util.Dom.addClass(cal.oDomContainer,firstClass);}
if(p==(pageCount-1)){YAHOO.util.Dom.addClass(cal.oDomContainer,lastClass);}
cal.parent=this;cal.index=p;this.pages[this.pages.length]=cal;}};YAHOO.widget.CalendarGroup.prototype.configPageDate=function(type,args,obj){var val=args[0];var firstPageDate;var cfgPageDate=YAHOO.widget.CalendarGroup._DEFAULT_CONFIG.PAGEDATE.key;for(var p=0;p<this.pages.length;++p){var cal=this.pages[p];if(p===0){firstPageDate=cal._parsePageDate(val);cal.cfg.setProperty(cfgPageDate,firstPageDate);}else{var pageDate=new Date(firstPageDate);this._setMonthOnDate(pageDate,pageDate.getMonth()+p);cal.cfg.setProperty(cfgPageDate,pageDate);}}};YAHOO.widget.CalendarGroup.prototype.configSelected=function(type,args,obj){var cfgSelected=YAHOO.widget.CalendarGroup._DEFAULT_CONFIG.SELECTED.key;this.delegateConfig(type,args,obj);var selected=(this.pages.length>0)?this.pages[0].cfg.getProperty(cfgSelected):[];this.cfg.setProperty(cfgSelected,selected,true);};YAHOO.widget.CalendarGroup.prototype.delegateConfig=function(type,args,obj){var val=args[0];var cal;for(var p=0;p<this.pages.length;p++){cal=this.pages[p];cal.cfg.setProperty(type,val);}};YAHOO.widget.CalendarGroup.prototype.setChildFunction=function(fnName,fn){var pageCount=this.cfg.getProperty(YAHOO.widget.CalendarGroup._DEFAULT_CONFIG.PAGES.key);for(var p=0;p<pageCount;++p){this.pages[p][fnName]=fn;}};YAHOO.widget.CalendarGroup.prototype.callChildFunction=function(fnName,args){var pageCount=this.cfg.getProperty(YAHOO.widget.CalendarGroup._DEFAULT_CONFIG.PAGES.key);for(var p=0;p<pageCount;++p){var page=this.pages[p];if(page[fnName]){var fn=page[fnName];fn.call(page,args);}}};YAHOO.widget.CalendarGroup.prototype.constructChild=function(id,containerId,config){var container=document.getElementById(containerId);if(!container){container=document.createElement("div");container.id=containerId;this.oDomContainer.appendChild(container);}
return new YAHOO.widget.Calendar(id,containerId,config);};YAHOO.widget.CalendarGroup.prototype.setMonth=function(month){month=parseInt(month,10);var currYear;var cfgPageDate=YAHOO.widget.CalendarGroup._DEFAULT_CONFIG.PAGEDATE.key;for(var p=0;p<this.pages.length;++p){var cal=this.pages[p];var pageDate=cal.cfg.getProperty(cfgPageDate);if(p===0){currYear=pageDate.getFullYear();}else{pageDate.setYear(currYear);}
this._setMonthOnDate(pageDate,month+p);cal.cfg.setProperty(cfgPageDate,pageDate);}};YAHOO.widget.CalendarGroup.prototype.setYear=function(year){var cfgPageDate=YAHOO.widget.CalendarGroup._DEFAULT_CONFIG.PAGEDATE.key;year=parseInt(year,10);for(var p=0;p<this.pages.length;++p){var cal=this.pages[p];var pageDate=cal.cfg.getProperty(cfgPageDate);if((pageDate.getMonth()+1)==1&&p>0){year+=1;}
cal.setYear(year);}};YAHOO.widget.CalendarGroup.prototype.render=function(){this.renderHeader();for(var p=0;p<this.pages.length;++p){var cal=this.pages[p];cal.render();}
this.renderFooter();};YAHOO.widget.CalendarGroup.prototype.select=function(date){for(var p=0;p<this.pages.length;++p){var cal=this.pages[p];cal.select(date);}
return this.getSelectedDates();};YAHOO.widget.CalendarGroup.prototype.selectCell=function(cellIndex){for(var p=0;p<this.pages.length;++p){var cal=this.pages[p];cal.selectCell(cellIndex);}
return this.getSelectedDates();};YAHOO.widget.CalendarGroup.prototype.deselect=function(date){for(var p=0;p<this.pages.length;++p){var cal=this.pages[p];cal.deselect(date);}
return this.getSelectedDates();};YAHOO.widget.CalendarGroup.prototype.deselectAll=function(){for(var p=0;p<this.pages.length;++p){var cal=this.pages[p];cal.deselectAll();}
return this.getSelectedDates();};YAHOO.widget.CalendarGroup.prototype.deselectCell=function(cellIndex){for(var p=0;p<this.pages.length;++p){var cal=this.pages[p];cal.deselectCell(cellIndex);}
return this.getSelectedDates();};YAHOO.widget.CalendarGroup.prototype.reset=function(){for(var p=0;p<this.pages.length;++p){var cal=this.pages[p];cal.reset();}};YAHOO.widget.CalendarGroup.prototype.clear=function(){for(var p=0;p<this.pages.length;++p){var cal=this.pages[p];cal.clear();}};YAHOO.widget.CalendarGroup.prototype.nextMonth=function(){for(var p=0;p<this.pages.length;++p){var cal=this.pages[p];cal.nextMonth();}};YAHOO.widget.CalendarGroup.prototype.previousMonth=function(){for(var p=this.pages.length-1;p>=0;--p){var cal=this.pages[p];cal.previousMonth();}};YAHOO.widget.CalendarGroup.prototype.nextYear=function(){for(var p=0;p<this.pages.length;++p){var cal=this.pages[p];cal.nextYear();}};YAHOO.widget.CalendarGroup.prototype.previousYear=function(){for(var p=0;p<this.pages.length;++p){var cal=this.pages[p];cal.previousYear();}};YAHOO.widget.CalendarGroup.prototype.getSelectedDates=function(){var returnDates=[];var selected=this.cfg.getProperty(YAHOO.widget.CalendarGroup._DEFAULT_CONFIG.SELECTED.key);for(var d=0;d<selected.length;++d){var dateArray=selected[d];var date=new Date(dateArray[0],dateArray[1]-1,dateArray[2]);returnDates.push(date);}
returnDates.sort(function(a,b){return a-b;});return returnDates;};YAHOO.widget.CalendarGroup.prototype.addRenderer=function(sDates,fnRender){for(var p=0;p<this.pages.length;++p){var cal=this.pages[p];cal.addRenderer(sDates,fnRender);}};YAHOO.widget.CalendarGroup.prototype.addMonthRenderer=function(month,fnRender){for(var p=0;p<this.pages.length;++p){var cal=this.pages[p];cal.addMonthRenderer(month,fnRender);}};YAHOO.widget.CalendarGroup.prototype.addWeekdayRenderer=function(weekday,fnRender){for(var p=0;p<this.pages.length;++p){var cal=this.pages[p];cal.addWeekdayRenderer(weekday,fnRender);}};YAHOO.widget.CalendarGroup.prototype.renderHeader=function(){};YAHOO.widget.CalendarGroup.prototype.renderFooter=function(){};YAHOO.widget.CalendarGroup.prototype.addMonths=function(count){this.callChildFunction("addMonths",count);};YAHOO.widget.CalendarGroup.prototype.subtractMonths=function(count){this.callChildFunction("subtractMonths",count);};YAHOO.widget.CalendarGroup.prototype.addYears=function(count){this.callChildFunction("addYears",count);};YAHOO.widget.CalendarGroup.prototype.subtractYears=function(count){this.callChildFunction("subtractYears",count);};YAHOO.widget.CalendarGroup.prototype.show=function(){this.oDomContainer.style.display="block";if(YAHOO.env.ua.opera){this._fixWidth();}};YAHOO.widget.CalendarGroup.prototype._setMonthOnDate=function(date,iMonth){if(YAHOO.env.ua.webkit&&YAHOO.env.ua.webkit<420&&(iMonth<0||iMonth>11)){var DM=YAHOO.widget.DateMath;var newDate=DM.add(date,DM.MONTH,iMonth-date.getMonth());date.setTime(newDate.getTime());}else{date.setMonth(iMonth);}};YAHOO.widget.CalendarGroup.prototype._fixWidth=function(){var startW=this.oDomContainer.offsetWidth;var w=0;for(var p=0;p<this.pages.length;++p){var cal=this.pages[p];w+=cal.oDomContainer.offsetWidth;}
if(w>0){this.oDomContainer.style.width=w+"px";}};YAHOO.widget.CalendarGroup.CSS_CONTAINER="yui-calcontainer";YAHOO.widget.CalendarGroup.CSS_MULTI_UP="multi";YAHOO.widget.CalendarGroup.CSS_2UPTITLE="title";YAHOO.widget.CalendarGroup.CSS_2UPCLOSE="close-icon";YAHOO.lang.augmentProto(YAHOO.widget.CalendarGroup,YAHOO.widget.Calendar,"buildDayLabel","buildMonthLabel","renderOutOfBoundsDate","renderRowHeader","renderRowFooter","renderCellDefault","styleCellDefault","renderCellStyleHighlight1","renderCellStyleHighlight2","renderCellStyleHighlight3","renderCellStyleHighlight4","renderCellStyleToday","renderCellStyleSelected","renderCellNotThisMonth","renderBodyCellRestricted","initStyles","configTitle","configClose","configIframe","hide","browser");YAHOO.widget.CalendarGroup._DEFAULT_CONFIG=YAHOO.widget.Calendar._DEFAULT_CONFIG;YAHOO.widget.CalendarGroup._DEFAULT_CONFIG.PAGES={key:"pages",value:2};YAHOO.widget.CalendarGroup.prototype.toString=function(){return"CalendarGroup "+this.id;};YAHOO.widget.CalGrp=YAHOO.widget.CalendarGroup;YAHOO.widget.Calendar2up=function(id,containerId,config){this.init(id,containerId,config);};YAHOO.extend(YAHOO.widget.Calendar2up,YAHOO.widget.CalendarGroup);YAHOO.widget.Cal2up=YAHOO.widget.Calendar2up;YAHOO.register("calendar",YAHOO.widget.Calendar,{version:"2.3.0",build:"442"});

/* File: core.js */


YAHOO.namespace('YAHOO.EU.Shopping');YAHOO.log=function(msg,cat,src){var l=YAHOO.widget.Logger;if(l&&l.log){return l.log(msg,cat,src);}else if(console&&console.log){if(!cat)
var cat='info';return console.log(cat+':'+msg);}else{return false;}};if(!YAHOO.lang.isFunction(YAHOO.lang.later)){YAHOO.lang.later=function(when,o,fn,data,periodic){when=when||0;o=o||{};var m=fn,d=data,f,r;if(YAHOO.lang.isString(fn)){m=o[fn];}
if(!m){throw new TypeError("method undefined");}
if(!YAHOO.lang.isArray(d)){d=[data];}
f=function(){m.apply(o,d);};r=(periodic)?setInterval(f,when):setTimeout(f,when);return{interval:periodic,cancel:function(){if(this.interval){clearInterval(r);}else{clearTimeout(r);}}};};}
if(!Array.prototype.indexOf)
{Array.prototype.indexOf=function(elt)
{var len=this.length;var from=Number(arguments[1])||0;from=(from<0)?Math.ceil(from):Math.floor(from);if(from<0)
from+=len;for(;from<len;from++)
{if(from in this&&this[from]===elt)
return from;}
return-1;};}
YAHOO.EU.Shopping.tooltipMsg={handleMsgDivs:function(e,divIdToCheck){for(var i=0,j=divIdToCheck.length;i<j;i++){var errorDiv=document.getElementById(divIdToCheck[i]);if(errorDiv){var targetEl=YAHOO.util.Event.getTarget(e);var oSavedLs=YAHOO.EU.Shopping.userHist.config.oSavedLs;var aSavedLis=oSavedLs.getElementsByTagName("li");if(targetEl.nodeName.toLowerCase()!='a'&&YAHOO.util.Dom.hasClass(errorDiv,'hist-too-many-items')&&!YAHOO.util.Dom.isAncestor(targetEl,errorDiv)){errorDiv.parentNode.removeChild(errorDiv);}else if(targetEl.nodeName.toLowerCase()!='a'&&targetEl!=errorDiv&&!YAHOO.util.Dom.isAncestor(errorDiv,targetEl)&&aSavedLis.length<=5){errorDiv.parentNode.removeChild(errorDiv);}}}},setWarningMsg:function(targetEl,warningMsg,divId,action,sExtraClass){var divIdToCheck=["compare-max-error","compare-min-error","compare-min-error-2","hist-error-div","add-warning-msg"];for(var i=0,j=divIdToCheck.length;i<j;i++){var errorDiv=document.getElementById(divIdToCheck[i]);if(errorDiv){if(divId!="compare-min-error-2"){errorDiv.parentNode.removeChild(errorDiv);}}}
var warningDiv=document.createElement('div');var warningTxt=document.createTextNode(warningMsg);warningDiv.appendChild(warningTxt);var closeLnk=document.createElement('a');var closeImg=document.createElement('img');closeImg.setAttribute('src','http://r6.kelkoo.com/ux/buttons/orange-cross-button.gif');closeImg.setAttribute('alt',YAHOO.EU.Shopping.locale.close);closeLnk.appendChild(closeImg);closeLnk.href="#";warningDiv.appendChild(closeLnk);YAHOO.util.Event.addListener(closeLnk,'click',function(e){YAHOO.util.Event.preventDefault(e);warningDiv.parentNode.removeChild(warningDiv);},this,true);targetEl.parentNode.appendChild(warningDiv);if(action&&action=="delete"){var posY=YAHOO.util.Dom.getY(targetEl);posY=posY+15;YAHOO.util.Dom.setY(warningDiv,posY);}
warningDiv.setAttribute("id",divId);YAHOO.util.Dom.addClass(warningDiv,"warning-msg");if(sExtraClass){YAHOO.util.Dom.addClass(warningDiv,sExtraClass);}}};YAHOO.EU.Shopping.userHist={config:{sShowAllTxt:YAHOO.EU.Shopping.locale.showAll,sHideAllTxt:YAHOO.EU.Shopping.locale.hideAll},init:function(){var oCnf=YAHOO.EU.Shopping.userHist.config;var oMainContainer=document.getElementById("user-hist");if(!oMainContainer){return true;}
oCnf.oSavedLs=document.getElementById("sav-ls");var oSavedLs=oCnf.oSavedLs;if(oSavedLs.className!="intro"){oSavedLs.className="enhanced";}
var aHeadLs=oMainContainer.getElementsByTagName('h3');var aContLs=oMainContainer.getElementsByTagName('ol');var histCookie=YAHOO.EU.Shopping.cookie.get("histCookie");YAHOO.log(histCookie);if(!histCookie||histCookie=="undefined"){YAHOO.EU.Shopping.cookie.set("histCookie","sav=1,rv=0,rs=0",365,"."+YAHOO.EU.Shopping.locale.domain);YAHOO.log('firstCookie'+YAHOO.EU.Shopping.cookie.get("histCookie"));}
var iNbrVisibleCont=0;var aCookieKeys=["sav","rv","rs"];if(histCookie){for(i=0;i<3;i++){var iNbrVisibleCont=iNbrVisibleCont+parseInt(YAHOO.EU.Shopping.userHist.returnCookieVal(YAHOO.EU.Shopping.cookie.get("histCookie"),aCookieKeys[i],"read"));}}
var oUserCtrls=document.getElementById("user-ctrls");var oUserCtrlsLnk=document.createElement('a');oUserCtrlsLnk.setAttribute("href","#");oUserCtrlsLnk.setAttribute("id","user-ctrl-cl");if(iNbrVisibleCont==3){var sUserCtrlsLnkTxt=document.createTextNode(oCnf.sHideAllTxt);}
else{var sUserCtrlsLnkTxt=document.createTextNode(oCnf.sShowAllTxt);}
oUserCtrlsLnk.appendChild(sUserCtrlsLnkTxt);var oUserCtrlsLi=document.createElement('li');oUserCtrlsLi.appendChild(oUserCtrlsLnk);oUserCtrlsLi.className="ctrl-cls";oUserCtrls.appendChild(oUserCtrlsLi);for(var i=0,j=aHeadLs.length;i<j;i++){if(histCookie){if(YAHOO.EU.Shopping.userHist.returnCookieVal(YAHOO.EU.Shopping.cookie.get("histCookie"),aCookieKeys[i],"read")==1){YAHOO.util.Dom.addClass(aHeadLs[i],"hist-op");}
else{YAHOO.util.Dom.addClass(aHeadLs[i],"hist-cl");YAHOO.util.Dom.addClass(aContLs[i],'hide');}}
else{if(i==0){YAHOO.util.Dom.addClass(aHeadLs[i],"hist-op");}
else{YAHOO.util.Dom.addClass(aHeadLs[i],"hist-cl");YAHOO.util.Dom.addClass(aContLs[i],'hide');}}
var oHeadSpan=aHeadLs[i].getElementsByTagName('span')[0];var oParams={oMainCont:oMainContainer,aHeaders:aHeadLs,oHeader:aHeadLs[i],aContLs:aContLs,oContent:aContLs[i],oIndex:i,oChgAllLnk:document.getElementById("user-ctrl-cl")};YAHOO.util.Event.addListener(oHeadSpan,'click',switchListDisplay,oParams,true);}
YAHOO.util.Event.addListener(oUserCtrlsLnk,'click',chgAll,oUserCtrlsLnk,true);var aSavedLis=oSavedLs.getElementsByTagName("li");oCnf.aSavedLis=aSavedLis;YAHOO.util.Dom.addClass(aSavedLis[0],'selected');YAHOO.util.Event.addListener(oSavedLs,'click',YAHOO.EU.Shopping.userHist.clickItemHandler,true);function switchListDisplay(e,oParams){if(YAHOO.util.Dom.hasClass(oParams.oHeader,'hist-op')){YAHOO.util.Dom.removeClass(oParams.oHeader,'hist-op');YAHOO.util.Dom.addClass(oParams.oHeader,'hist-cl');YAHOO.util.Dom.addClass(oParams.oContent,'hide');iNbrVisibleCont=iNbrVisibleCont-1;if(histCookie){YAHOO.EU.Shopping.userHist.returnCookieVal(YAHOO.EU.Shopping.cookie.get("histCookie"),aCookieKeys[oParams.oIndex],"update");}}
else{YAHOO.util.Dom.removeClass(oParams.oHeader,'hist-cl');YAHOO.util.Dom.addClass(oParams.oHeader,'hist-op');YAHOO.util.Dom.removeClass(oParams.oContent,'hide');iNbrVisibleCont=iNbrVisibleCont+1;if(histCookie){YAHOO.EU.Shopping.userHist.returnCookieVal(YAHOO.EU.Shopping.cookie.get("histCookie"),aCookieKeys[oParams.oIndex],"update");}}
if(iNbrVisibleCont==3){oParams.oChgAllLnk.firstChild.nodeValue=oCnf.sHideAllTxt;}
else if(iNbrVisibleCont==0){oParams.oChgAllLnk.firstChild.nodeValue=oCnf.sShowAllTxt;}}
function chgAll(e){YAHOO.util.Event.preventDefault(e);if(this.firstChild.nodeValue==oCnf.sHideAllTxt){this.firstChild.nodeValue=oCnf.sShowAllTxt;for(var i=0,j=aHeadLs.length;i<j;i++){if(YAHOO.util.Dom.hasClass(aHeadLs[i],'hist-op')){YAHOO.util.Dom.removeClass(aHeadLs[i],'hist-op');YAHOO.util.Dom.addClass(aHeadLs[i],'hist-cl');YAHOO.util.Dom.addClass(aContLs[i],'hide');YAHOO.EU.Shopping.cookie.set("histCookie","sav=0,rv=0,rs=0",365,"."+YAHOO.EU.Shopping.locale.domain);YAHOO.log('cookieset'+YAHOO.EU.Shopping.cookie.get("histCookie"));}}
iNbrVisibleCont=0;}
else if(this.firstChild.nodeValue==oCnf.sShowAllTxt){this.firstChild.nodeValue=oCnf.sHideAllTxt;for(var i=0,j=aHeadLs.length;i<j;i++){if(YAHOO.util.Dom.hasClass(aHeadLs[i],'hist-cl')){YAHOO.util.Dom.removeClass(aHeadLs[i],'hist-cl');YAHOO.util.Dom.addClass(aHeadLs[i],'hist-op');YAHOO.util.Dom.removeClass(aContLs[i],'hide');YAHOO.EU.Shopping.cookie.set("histCookie","sav=1,rv=1,rs=1",365,"."+YAHOO.EU.Shopping.locale.domain);YAHOO.log('cookieset'+YAHOO.EU.Shopping.cookie.get("histCookie"));}}
iNbrVisibleCont=3;}}},clickItemHandler:function(e){var targetEl=YAHOO.util.Event.getTarget(e);if(targetEl.nodeName.toLowerCase()=='ol')return;var targetElName=targetEl.nodeName.toLowerCase();if(this.nodeName.toLowerCase()){var parentLI=targetEl;}
while(parentLI.nodeName.toLowerCase()!="li"){parentLI=parentLI.parentNode;}
var liFirstLnk=parentLI.getElementsByTagName("a")[0];if(targetElName=="img"||targetEl==liFirstLnk){YAHOO.util.Event.preventDefault(e);if(YAHOO.util.Dom.hasClass(parentLI,'selected')){return true;}
else{YAHOO.EU.Shopping.userHist.updateSelectedLI(parentLI);}}
else{if(targetElName=="a"&&YAHOO.util.Dom.hasClass(targetEl,'delete')){YAHOO.util.Event.preventDefault(e);YAHOO.EU.Shopping.userHist.setLinkAction(targetEl);}}},updateSelectedLI:function(li){var aSavedLis=YAHOO.EU.Shopping.userHist.config.aSavedLis;for(i=0,j=aSavedLis.length;i<j;i++){if(YAHOO.util.Dom.hasClass(aSavedLis[i],'selected')){YAHOO.util.Dom.removeClass(aSavedLis[i],'selected');}
YAHOO.util.Dom.addClass(li,'selected');}},returnCookieVal:function(cookieStr,key,action){var rExp=new RegExp(key+"=[01]","i");var match=rExp.exec(cookieStr);YAHOO.log(match);if(match){var keyValue=match[0].substring(match[0].length-1,match[0].length);}
else{var keyValue=1;}
if(action=="read"){return keyValue;}
if(action=="update"){YAHOO.log(keyValue);if(keyValue==0){var newKeyValue=1;}
else{var newKeyValue=0;}
var updatedStrValue=key+"="+newKeyValue;var histCookieValues=cookieStr.replace(match,updatedStrValue);YAHOO.EU.Shopping.cookie.set("histCookie",histCookieValues,365,"."+YAHOO.EU.Shopping.locale.domain);YAHOO.log('cookieset'+YAHOO.EU.Shopping.cookie.get("histCookie"));}},setLinkAction:function(targetEl){if(YAHOO.util.Dom.hasClass(targetEl,'delete')){var action="delete";}
else{var action="add";}
var oSavedLs=YAHOO.EU.Shopping.userHist.config.oSavedLs;var aSavedLis=oSavedLs.getElementsByTagName("li");var errorDiv=document.getElementById("hist-error-div");if(errorDiv){errorDiv.parentNode.removeChild(errorDiv);}
if(action=="add"&&aSavedLis.length==5){var errorMsg=YAHOO.EU.Shopping.locale.histOversize;YAHOO.EU.Shopping.tooltipMsg.setWarningMsg(targetEl,errorMsg,"hist-error-div",'add',"hist-too-many-items");return;}
var targetElUrl=targetEl.href;var catIdIndex=targetElUrl.indexOf('catId');if(catIdIndex==-1){var offerIdIndex=targetElUrl.indexOf('offerId');var offerId=targetElUrl.substring(offerIdIndex+8,targetElUrl.length);YAHOO.EU.Shopping.userHist.updateSavedList(targetEl,action,offerId);}
else{var pidIndex=targetElUrl.indexOf('pid');var catId=targetElUrl.substring(catIdIndex+6,pidIndex);var pid=targetElUrl.substring(pidIndex+4,targetElUrl.length);YAHOO.EU.Shopping.userHist.updateSavedList(targetEl,action,pid,catId);}},updateSavedList:function(srcLink,action,id,catId){var handleSuccess=function(o){if(o.responseText){var response=eval(o.responseText);if(response.error!=""){YAHOO.EU.Shopping.tooltipMsg.setWarningMsg(srcLink,response.error,"hist-error-div",action);}
else{var oSavedLs=YAHOO.EU.Shopping.userHist.config.oSavedLs;var aSavedLis=oSavedLs.getElementsByTagName("li");if(action=="delete"){if(aSavedLis.length>1){var startIndex=response.savedListContent.indexOf('<li>');response.savedListContent=response.savedListContent.substring(startIndex,response.savedListContent.length);oSavedLs.innerHTML=response.savedListContent;aSavedLis=oSavedLs.getElementsByTagName("li");YAHOO.EU.Shopping.userHist.updateSelectedLI(aSavedLis[0]);}
else{var startIndex=response.savedListContent.indexOf('<li>');response.savedListContent=response.savedListContent.substring(startIndex,response.savedListContent.length);YAHOO.util.Dom.replaceClass(oSavedLs,'enhanced','intro');oSavedLs.innerHTML=response.savedListContent;}}
else{if(YAHOO.util.Dom.hasClass(oSavedLs,'intro')){YAHOO.util.Dom.replaceClass(oSavedLs,'intro','enhanced');oSavedLs.innerHTML=response.savedListContent;aSavedLis=oSavedLs.getElementsByTagName("li");YAHOO.EU.Shopping.userHist.updateSelectedLI(aSavedLis[0]);}
else{oSavedLs.innerHTML=response.savedListContent;aSavedLis=oSavedLs.getElementsByTagName("li");YAHOO.EU.Shopping.userHist.updateSelectedLI(aSavedLis[0]);}
YAHOO.EU.Shopping.tooltipMsg.setWarningMsg(srcLink,YAHOO.EU.Shopping.locale.addedToSavedList,"add-warning-msg");var savedListTitle=document.getElementById("user-hist").getElementsByTagName("h3")[0];if(YAHOO.util.Dom.hasClass(savedListTitle,'hist-cl')){YAHOO.util.Dom.replaceClass(savedListTitle,'hist-cl','hist-op');YAHOO.util.Dom.removeClass(oSavedLs,'hide');}}}}};var handleFailure=function(o){};var callback={success:handleSuccess,failure:handleFailure,timeout:10000};if(catId){if(action=="add"){var url="/ctl/do/asyncCall/user-hist?action=add&id="+id+"&catId="+catId;}
else{var url="/ctl/do/asyncCall/user-hist?action=delete&id="+id+"&catId="+catId;}}
else{if(action=="add"){var url="/ctl/do/asyncCall/user-hist?action=add&id="+id;}
else{var url="/ctl/do/asyncCall/user-hist?action=delete&id="+id;}}
var request=YAHOO.util.Connect.asyncRequest('GET',url,callback);}};YAHOO.EU.Shopping.quickRating={init:function(){var productWrap=document.getElementById("level3");if(productWrap){YAHOO.util.Event.addListener(productWrap,'click',YAHOO.EU.Shopping.quickRating.identify,this,true);}},identify:function(e){var targetEl=YAHOO.util.Event.getTarget(e);var targetElName=targetEl.nodeName.toLowerCase();if(targetElName=="a"&&YAHOO.util.Dom.hasClass(targetEl,'quick-rating')){YAHOO.util.Event.preventDefault(e);YAHOO.EU.Shopping.quickRating.deploy(targetEl);}},deploy:function(targetEl){if(YAHOO.util.Dom.hasClass(targetEl,'qr-open')){return true;}
YAHOO.util.Dom.addClass(targetEl,'qr-open');var quickRateDiv=document.createElement("div");quickRateDiv.className="qr-wrap";YAHOO.util.Dom.generateId(quickRateDiv);var quickRateOl=document.createElement("ol");var sParamStarts=targetEl.href.indexOf("?");var oQuickRateParams=targetEl.href.substring(sParamStarts,targetEl.href.length);var quickRateClose=document.createElement("a");quickRateClose.href="#";quickRateClose.className="qr-close-lnk";quickRateClose.innerHTML='<img src="http://r6.kelkoo.com/ux/buttons/orange-cross-button.gif" width="" height="" alt="'+YAHOO.EU.Shopping.locale.close+'">';for(i=1;i<=5;i++){var quickRateLi=document.createElement("li");var quickRateLnk=document.createElement("a");quickRateLnk.className="qr-"+i;quickRateLnk.href="#";var quickRateLnkTxt=document.createTextNode(YAHOO.EU.Shopping.locale.rate+" "+i);quickRateLnk.appendChild(quickRateLnkTxt);quickRateLi.appendChild(quickRateLnk);quickRateOl.appendChild(quickRateLi);var oParams={oQuickRateContainer:quickRateDiv,sUrlParams:oQuickRateParams+"&quick_rating="+i,oCloseLnk:quickRateClose,iRate:i};YAHOO.util.Event.addListener(quickRateLnk,'click',YAHOO.EU.Shopping.quickRating.rate,oParams,true);}
quickRateDiv.appendChild(quickRateOl);quickRateDiv.appendChild(quickRateClose);YAHOO.util.Event.purgeElement(targetEl,0);YAHOO.util.Event.addListener([quickRateClose,targetEl],'click',YAHOO.EU.Shopping.quickRating.switchDisplay,quickRateDiv,true);YAHOO.util.Dom.insertAfter(quickRateDiv,targetEl);},switchDisplay:function(e,quickRateWrap){YAHOO.util.Event.preventDefault(e);if(YAHOO.util.Dom.hasClass(quickRateWrap,'hide')){YAHOO.util.Dom.removeClass(quickRateWrap,'hide');}
else{YAHOO.util.Dom.addClass(quickRateWrap,'hide');}},rate:function(e,oParams){YAHOO.util.Event.preventDefault(e);var handleSuccess=function(o){if(o.responseText){var response=eval(o.responseText);if(response.msgKey=="0"){var quickRateOl=oParams.oQuickRateContainer.getElementsByTagName('ol')[0];var ratingSpan=document.createElement('span');ratingSpan.className="rating rat"+oParams.iRate;ratingSpan.innerHTML='<span class="rating-wrap"><span class="value">'+oParams.iRate+'</span> out of <span class="best">5</span></span>';oParams.oQuickRateContainer.replaceChild(ratingSpan,quickRateOl);}
var message=document.createElement('div');message.className="qr-message";var messageTxt=document.createTextNode(response.quickRateMsg);message.appendChild(messageTxt);oParams.oQuickRateContainer.appendChild(message);}};var handleFailure=function(o){};var callback={success:handleSuccess,failure:handleFailure,timeout:10000};var url="/ctl/do/asyncCall/quick-rating-process"+oParams.sUrlParams+"&qrAjax=true";var request=YAHOO.util.Connect.asyncRequest('GET',url,callback);}};YAHOO.EU.Shopping.levelsSaveLnksListener={init:function(){YAHOO.util.Event.addListener(document.body,'click',function(e){YAHOO.EU.Shopping.levelsSaveLnksListener.targetSaveLnks(e);var divIdToCheck=["compare-max-error","compare-min-error","compare-min-error-2","hist-error-div","add-warning-msg"];YAHOO.EU.Shopping.tooltipMsg.handleMsgDivs(e,divIdToCheck);});},targetSaveLnks:function(e){var oSavedLs=document.getElementById("sav-ls");if(!oSavedLs){return;}
var aSavedLis=oSavedLs.getElementsByTagName("li");var oSavLsFirstLi=aSavedLis[0];if(oSavLsFirstLi){var targetEl=YAHOO.util.Event.getTarget(e);var targetElName=targetEl.nodeName.toLowerCase();if(targetElName=="a"&&YAHOO.util.Dom.hasClass(targetEl,'add-to-saved-list')){YAHOO.util.Event.preventDefault(e);YAHOO.EU.Shopping.userHist.setLinkAction(targetEl);}}}};YAHOO.util.Event.onDOMReady(YAHOO.EU.Shopping.levelsSaveLnksListener.init);YAHOO.util.Event.addListener(window,'load',YAHOO.EU.Shopping.userHist.init);YAHOO.util.Event.addListener(window,'load',YAHOO.EU.Shopping.quickRating.init,this,true);YAHOO.EU.Shopping.sortingFormEnhancement={init:function(){var oForm=document.getElementById("sorting-form");if(oForm){oForm.parentNode.style.paddingBottom="10px";var oSubmitButton=YAHOO.util.Dom.getElementsByClassName('cta','button',oForm)[0];oSubmitButton.style.display="none";var aSelects=oForm.getElementsByTagName("select");for(var i=0,j=aSelects.length;i<j;i++){YAHOO.util.Event.addListener(aSelects[i],'change',function(e){oForm.submit();},true);}}}};YAHOO.util.Event.onContentReady("sorting-form",YAHOO.EU.Shopping.sortingFormEnhancement.init);YAHOO.EU.Shopping.buying={formCallback:function(e){YAHOO.util.Event.stopEvent(e);var sDest=document.getElementById('bg-dd-select').value;if(sDest!=""){window.location=sDest;}},init:function(){var vToAttach=document.getElementById('buyguide-form-list');var vUl=document.getElementById('bg-dd-ul');var vForm=document.getElementById('bg-form');if(vForm){YAHOO.util.Event.addListener(vForm,"submit",YAHOO.EU.Shopping.buying.formCallback);var oSelect=document.createElement('select');oSelect.id="bg-dd-select";var aLis=YAHOO.util.Dom.getElementsByClassName('bg-dd-li','li');for(var i=0,j=aLis.length;i<j;i++){var oAs=aLis[i].firstChild;var oOption=document.createElement('option');var sText=oAs.textContent==""?oAs.textContent:oAs.innerHTML;var oOptionText=document.createTextNode(sText.replace(/&amp;/gi,"&"));oOption.value=oAs.href;oOption.appendChild(oOptionText);oSelect.appendChild(oOption);}
vForm.insertBefore(oSelect,vUl);vForm.removeChild(vUl);vForm.innerHTML+='<button class="cta internal" type="submit"><span class="t"><span></span></span><span class="cont"><span>Go</span></span><span class="b"><span> </span></span></button>';}}};YAHOO.EU.Shopping.contentnav={init:function(){var aUls=YAHOO.util.Dom.getElementsByClassName('corp-sublnk','ul');for(var i=0,j=aUls.length;i<j;i++){var aLis=YAHOO.util.Dom.getElementsByClassName('corp-active','li',aUls[i]);if(aLis.length==0){YAHOO.util.Dom.setStyle(aUls[i],'display','none');}
else
{var sParent=aUls[i].parentNode;var oH3=sParent.getElementsByTagName('h3');YAHOO.util.Dom.addClass(oH3,'corp-ttl-active');}}}};YAHOO.EU.Shopping.spop={init:function(){if(document.getElementById('giftform-mod')){YAHOO.util.Dom.setStyle(document.getElementById('giftform-mod'),'display','block');}
YAHOO.util.Event.addListener('spop-form','submit',YAHOO.EU.Shopping.spop.encodeFormBox,this,true);YAHOO.util.Event.addListener('spop-form-submit','click',YAHOO.EU.Shopping.spop.encodeFormBox,this,true);YAHOO.util.Event.addListener('spop-form-target','change',YAHOO.EU.Shopping.spop.updateFormBox,this,true);YAHOO.util.Event.addListener('spop-form-target','keydown',YAHOO.EU.Shopping.spop.spopSubmit,this,true);YAHOO.util.Event.addListener('spop-form-category','keydown',YAHOO.EU.Shopping.spop.spopSubmit,this,true);YAHOO.util.Event.addListener('spop-form-price','keydown',YAHOO.EU.Shopping.spop.spopSubmit,this,true);},encodeFormBox:function(e){YAHOO.util.Event.stopEvent(e);var sSelCategory="",sSelPrice="",sSelTarget="",sCatId="",sSpopN="";if(document.getElementById('spop-form')){var oForm=document.getElementById('spop-form');}
if(document.getElementById('spop-form-target')){var oTarget=document.getElementById('spop-form-target');sSelTarget=oTarget.value;}
if(document.getElementById('spop-form-category')){var oCategory=document.getElementById('spop-form-category');sSelCategory=oCategory.value;}
if(document.getElementById('spop-form-price')){var oPrice=document.getElementById('spop-form-price');sSelPrice=oPrice.value;}
if(document.getElementById('spop-form-catId')){var oCatId=document.getElementById('spop-form-catId');sCatId=oCatId.value;}
if(document.getElementById('spop-form-spopN')){var oSpopN=document.getElementById('spop-form-spopN');var sSpopN=oSpopN.value;}
var sLink="/ctl/do/spopResult?category="+sSelCategory+"&price="+sSelPrice+"&target="+sSelTarget+"&catId="+sCatId+"&spopn="+sSpopN+"&keepParams=true";var sDest="/ctl/do/contentWide?catId="+sCatId+"&url="+escape(sLink);window.location=sDest;},spopSubmit:function(e){if(!e)e=window.event;if(e.keyCode==13){YAHOO.EU.Shopping.spop.encodeFormBox(e);return false;}}};YAHOO.util.Event.onDOMReady(YAHOO.EU.Shopping.spop.init);YAHOO.util.Event.onDOMReady(YAHOO.EU.Shopping.contentnav.init);YAHOO.util.Event.onDOMReady(YAHOO.EU.Shopping.buying.init);YAHOO.util.Dom.addScriptNode=function(sUrl){oScript=document.createElement('script');oScript.type='text/javascript';oScript.src=sUrl;document.getElementsByTagName('head')[0].appendChild(oScript);};YAHOO.util.Dom.onMethodAvailable=function(sMethod,oCallback,o,bScope){if(typeof(eval(sMethod))==='function'){bScope?oCallback.call(o):oCallback(o);}else{setTimeout(function(){YAHOO.util.Dom.onMethodAvailable(sMethod,oCallback,o,bScope);},100);}};YAHOO.EU.Shopping.cookie={set:function(name,value,days,domain){var domain='; domain='+domain+';'||'';if(days){var date=new Date();date.setTime(date.getTime()+(days*24*60*60*1000));var expires="; expires="+date.toGMTString();}
else var expires="";document.cookie=name+"="+value+expires+"; path=/"+domain;},get:function(name){var nameEQ=name+"=";var ca=document.cookie.split(';');for(var i=0;i<ca.length;i++){var c=ca[i];while(c.charAt(0)==' ')c=c.substring(1,c.length);if(c.indexOf(nameEQ)==0)return c.substring(nameEQ.length,c.length);}
return null;},del:function(name){YAHOO.EU.Shopping.cookie.set(name,"",-1);}};YAHOO.EU.Shopping.openInPopup=function(e,iWidth,iHeight){var target=YAHOO.util.Event.getTarget(e);if(!target){return;}
if((target.tagName.toLowerCase()=='img')&&target.parentNode){target=target.parentNode;}
if(target&&target.tagName.toLowerCase()=='a'&&YAHOO.util.Dom.hasClass(target,'js-popup')){window.open(target.href,'popup','width='+iWidth+',height='+iHeight+',scrollbars=yes,menubar=no,status=no,toolbar=no');YAHOO.util.Event.stopEvent(e);}};YAHOO.EU.Shopping.validate={isDate:function(sDate){var myRE=new RegExp(/^(?:(?:0?[1-9]|1\d|2[0-8])(\/|-)(?:0?[1-9]|1[0-2]))(\/|-)(?:[1-9]\d\d\d|\d[1-9]\d\d|\d\d[1-9]\d|\d\d\d[1-9])$|^(?:(?:31(\/|-)(?:0?[13578]|1[02]))|(?:(?:29|30)(\/|-)(?:0?[1,3-9]|1[0-2])))(\/|-)(?:[1-9]\d\d\d|\d[1-9]\d\d|\d\d[1-9]\d|\d\d\d[1-9])$|^(29(\/|-)0?2)(\/|-)(?:(?:0[48]00|[13579][26]00|[2468][048]00)|(?:\d\d)?(?:0[48]|[2468][048]|[13579][26]))$/);if(!myRE.test(sDate)){return false;}
return true;}};YAHOO.widget.DateMath.getDate=function(sDate){if(YAHOO.lang.isString){if(!YAHOO.EU.Shopping.validate.isDate(sDate))
return false;var date=sDate.split(new RegExp(/-|\//));if(!date||!(date.length>0&&date.length<4))
return false;return new Date(date[YAHOO.EU.Shopping.YUICalendarConf.MDY_YEAR_POSITION-1],date[YAHOO.EU.Shopping.YUICalendarConf.MDY_MONTH_POSITION-1]-1,date[YAHOO.EU.Shopping.YUICalendarConf.MDY_DAY_POSITION-1]);}else{return new Date();}};YAHOO.util.Event.onDOMReady(function(){var iPopupWidth=550;var iPopupHeight=550;YAHOO.util.Event.addListener('level-results-page','click',function(e){YAHOO.EU.Shopping.openInPopup(e,iPopupWidth,iPopupHeight);});YAHOO.util.Event.addListener('merchant-desc','click',function(e){YAHOO.EU.Shopping.openInPopup(e,iPopupWidth,iPopupHeight);});YAHOO.util.Event.addListener('sbot','click',function(e){YAHOO.EU.Shopping.openInPopup(e,iPopupWidth,iPopupHeight);});YAHOO.util.Event.addListener('store-profile','click',function(e){YAHOO.EU.Shopping.openInPopup(e,iPopupWidth,iPopupHeight);});});YAHOO.util.Event.onDOMReady(function(){YAHOO.util.Event.addListener('mer-search','submit',function(e){var oSearchQuery=document.getElementById('mer-search-query');if(oSearchQuery.value==''){YAHOO.util.Event.stopEvent(e);if(!document.getElementById('merchant-search-error')){var oError=document.createElement('p');oError.id='merchant-search-error';oError.appendChild(document.createTextNode(YAHOO.EU.Shopping.locale.merchantSearchError));document.getElementById('mer-search').insertBefore(oError,oSearchQuery);}}});});YAHOO.util.Event.onDOMReady(function(){var oShowMoreCatsLnk=document.getElementById("pop-cats-show");var oMoreCatsDiv=document.getElementById('more-other-cats');if(oShowMoreCatsLnk){YAHOO.util.Dom.addClass(oMoreCatsDiv,'hide');YAHOO.util.Event.addListener(oShowMoreCatsLnk,'click',function(e){YAHOO.util.Event.preventDefault(e);if(YAHOO.util.Dom.hasClass(oMoreCatsDiv,'hide')){YAHOO.util.Dom.removeClass(oMoreCatsDiv,'hide');oShowMoreCatsLnk.innerHTML=YAHOO.EU.Shopping.locale.otherPopCatsHide;}
else{YAHOO.util.Dom.addClass(oMoreCatsDiv,'hide');oShowMoreCatsLnk.innerHTML=YAHOO.EU.Shopping.locale.otherPopCatsView;}});}});(function(){if(!window.console){window.console={};window.console.log=function(){return false;};}
var aPreload=['http://r6.kelkoo.com/ux/globalnav/dropgrad.png','http://r6.kelkoo.com/ux/buttons/button-sprite.png'];var pre=[];for(var i=0,j=aPreload.length;i<j;i++){pre[i]=new Image();pre[i].src=aPreload[i];}
YAHOO.util.Event.onAvailable('s',function(){YAHOO.util.Event.addListener('search','submit',function(e){if(this.value==""){YAHOO.util.Event.stopEvent(e);this.focus();}},this,true);});})();YAHOO.util.Event.addListener(window,'load',function(){if(document.getElementById("yahoo-sponsored-links-overturecomm")){document.getElementById("yahoo-sponsored-links-overturecomm").style.display="block";}
if(document.getElementById("yahoo-sponsored-links")){document.getElementById("yahoo-sponsored-links").style.display="block";}});YAHOO.EU.Shopping.partnerwithus={init:function(){var aLinks=YAHOO.util.Dom.getElementsByClassName('form-add-more','a');for(var i=0,j=aLinks.length;i<j;i++){YAHOO.util.Dom.setStyle(aLinks[i],'display','inline');YAHOO.util.Event.addListener(aLinks[i],'click',YAHOO.EU.Shopping.partnerwithus.createField,this,true);}},createField:function(e){YAHOO.util.Event.preventDefault(e);var targetEl=YAHOO.util.Event.getTarget(e);var targetElParent=targetEl.parentNode;var targetTitle=targetEl.title;var aSpan=YAHOO.util.Dom.getElementsByClassName('form-original-fields','span',targetElParent);var aMoreSpan=YAHOO.util.Dom.getElementsByClassName('form-more-fields','span',targetElParent);if(aMoreSpan.length<=8){if(aSpan[0]){var oSpan=document.createElement('span');YAHOO.util.Dom.addClass(oSpan,'form-more-fields');oSpan.innerHTML="<label>&nbsp;</label>"+aSpan[0].innerHTML;if(aMoreSpan.length<2){targetElParent.appendChild(oSpan);}
if(targetTitle=="input"){targetElParent.appendChild(oSpan);}}}}};YAHOO.util.Event.onDOMReady(YAHOO.EU.Shopping.partnerwithus.init);(function(){YAHOO.namespace('YAHOO.EU.Shopping');YAHOO.EU.Shopping.unObfuscateMails={init:function(){var links=YAHOO.util.Dom.getElementsByClassName('obfuscateEmail','a');var spans=YAHOO.util.Dom.getElementsByClassName('obfuscateEmail','span');return this.unObfuscate(links)&&this.unObfuscate(spans);},unObfuscate:function(aMails){var length=aMails.length;var obfuscationKey=YAHOO.EU.Shopping.locale.obfuscationKey;for(var i=0;i<length;i++){aMails[i].innerHTML=aMails[i].innerHTML.replace(obfuscationKey,"@","g");if(aMails[i].tagName.toLowerCase()=='a')
aMails[i].href=aMails[i].href.replace(obfuscationKey,"@","g");}
return true;}};YAHOO.util.Event.addListener(window,'load',function(){YAHOO.EU.Shopping.unObfuscateMails.init();});})();

/* File: globalnav.js */


YAHOO.namespace('YAHOO.EU.Shopping');YAHOO.EU.Shopping.globalnav={config:{mode:'ajax',width:676,debug:false,sIdent:"global-nav-drop-down",sUrl:YAHOO.EU.Shopping.config.globalnav.dataURL,iMouseOverDelay:1000,iMouseEnterDelay:3000,bCloseIfNotEntered:false,aTabs:['gn-categories','gn-brands','gn-stores','gn-themes']},cache:{sTabClickedId:""},init:function(){var YESg=YAHOO.EU.Shopping.globalnav;YESg.dropDown=new YAHOO.widget.Overlay(YESg.config.sIdent,{visible:false,monitorresize:true,iframe:true});YESg.cache.oDrop=document.getElementById(YESg.config.sIdent);var navWrapper=document.createElement('div');navWrapper.id='nav-wrapper';YESg.cache.oDrop.appendChild(navWrapper);YESg.navWrapper=navWrapper;var aTabs=YESg.config.aTabs;var oElm;for(var i=0,j=aTabs.length;i<j;i++){oElm=document.getElementById(aTabs[i]);YAHOO.util.Event.addListener(oElm,'mouseup',YESg.tabEventHandler,oElm,true);YAHOO.util.Event.addListener(oElm,'keypress',YESg.tabEventHandler,oElm,true);YAHOO.util.Event.addListener(oElm,'click',YESg.tabEventHandler,oElm,true);}
YAHOO.util.Event.addListener(document.getElementsByTagName('html')[0],'click',YESg.hideDropDown);var resetDropPos=function(){if(YESg.dropDown.cfg.getProperty("visible")){YESg.setDropCoords();}};YAHOO.widget.Module.textResizeEvent.subscribe(resetDropPos);YAHOO.widget.Overlay.windowResizeEvent.subscribe(resetDropPos);},tabEventHandler:function(e){var YESg=YAHOO.EU.Shopping.globalnav;var oTab=this;switch(e.type){case'mouseup':if(YESg.cache.oTabClicked){YAHOO.util.Dom.removeClass(YESg.cache.oTabClicked.parentNode,'gn-drop-down');YAHOO.util.Dom.removeClass(YESg.cache.oTabClicked.parentNode,'gn-drop-down-nosel');}
YESg.cache.isInDropDown=false;var tabLi=oTab.parentNode;YAHOO.util.Dom.addClass(tabLi,'gn-drop-down');var isMSIE=(window.ActiveXObject)?true:false;if(isMSIE&&tabLi.className.indexOf('subchoice')==-1){YAHOO.util.Dom.addClass(tabLi,'gn-drop-down-nosel');}
YESg.cache.sTabClickedId=oTab.id;YESg.cache.oTabClicked=oTab;YESg.loadDropDown(oTab);if(YESg.timedClose){window.clearTimeout(YESg.timedClose);}
if(!YESg.closeDropNotEntered&&!YESg.timedClose&&YESg.config.bCloseIfNotEntered){YESg.closeDropNotEntered=window.setTimeout(function(){if(YESg.cache.isInDropDown==false){YESg.dropDown.cfg.setProperty("visible",false);}
YESg.closeDropNotEntered=null;},YESg.config.iMouseEnterDelay);}
YAHOO.util.Event.stopEvent(e);break;case'keypress':if(e.keyCode==13){window.location=oTab.href;YAHOO.util.Event.stopEvent(e);}
break;case'click':YAHOO.util.Event.stopEvent(e);break;}},getNavData:function(){var YESg=YAHOO.EU.Shopping.globalnav;switch(YESg.config.mode){case'json':var head=document.getElementsByTagName('head')[0];var scpt=document.createElement('script');scpt.type='text/javascript';scpt.src=YESg.config.sUrl+'?JSON=dataCallBack';head.appendChild(scpt);break;case'ajax':var transaction=YAHOO.util.Connect.asyncRequest('GET',YESg.config.sUrl,YESg.ajaxHandler,null);break;}},dataCallBack:function(o){var YESg=YAHOO.EU.Shopping.globalnav;YESg.cache.dropDownData=o;if(YESg.cache.sTabClickedId&&YESg.cache.dropDownData&&!YAHOO.lang.isUndefined(YESg.cache.dropDownData[YESg.cache.sTabClickedId])){YESg.navWrapper.innerHTML=YESg.cache.dropDownData[YESg.cache.sTabClickedId];YESg.setCloseEvent();}else{YESg.hideDropDown();}},setCloseEvent:function(){var YESg=YAHOO.EU.Shopping.globalnav;var close=YAHOO.util.Dom.getElementsByClassName('close','a',YESg.cache.oDrop)[0];YAHOO.util.Event.addListener(close,'click',YESg.hideDropDown,{closelink:true},false);},ajaxHandler:{success:function(o){var YESg=YAHOO.EU.Shopping.globalnav;var sResponse=(o.responseText.indexOf('<!--')>-1)?o.responseText.replace(/<!--[\s\S]*?-->/g,''):o.responseText;oData=eval(sResponse);YESg.dataCallBack(oData);},failure:function(o){var YESg=YAHOO.EU.Shopping.globalnav;window.location=document.getElementById(YESg.cache.sTabClickedId).href;},timeout:5000},loadDropDown:function(oTab){var YESg=YAHOO.EU.Shopping.globalnav;if(!YESg.cache.dropDownData){YESg.getNavData();}else{YESg.navWrapper.innerHTML=YESg.cache.dropDownData[oTab.id];YESg.setCloseEvent();}
if(YESg.dropDown){YESg.setDropCoords(null,true);YAHOO.util.Event.addListener(YESg.cache.oDrop,'mouseover',YESg.dropDownEventHandler,this,true);YAHOO.util.Event.addListener(YESg.cache.oDrop,'mouseout',YESg.dropDownEventHandler,this,true);if(!YESg.cache.dropDownData){YESg.navWrapper.innerHTML='<img class="loading" src="http://r6.kelkoo.com/ux/globalnav/throbber.gif" alt=""><p class="loading">'+YAHOO.EU.Shopping.locale.loading+'</p>';}}},setDropCoords:function(e,bVisible){var x;var YESg=YAHOO.EU.Shopping.globalnav;var pageRegion=YAHOO.util.Dom.getRegion('page');var tabRegion=YAHOO.util.Dom.getRegion(YESg.cache.oTabClicked.parentNode?YESg.cache.oTabClicked.parentNode:YESg.cache.oTabClicked);var pageRight=pageRegion['right'];var pageLeft=pageRegion['left'];var tabLeft=tabRegion['left'];var tabRight=tabRegion['right'];var y=tabRegion['bottom']-2;var dropWidth=YESg.config.width;if((tabLeft+dropWidth)>pageRight){x=pageRight-dropWidth;}else{x=tabLeft-2;}
x=pageLeft;YESg.dropDown.cfg.setProperty('x',x);YESg.dropDown.cfg.setProperty('y',y);if(bVisible){YESg.dropDown.cfg.setProperty("visible",true);}},dropDownEventHandler:function(e){var YESg=YAHOO.EU.Shopping.globalnav;YAHOO.util.Event.stopPropagation(e);var oRelTarg=YAHOO.util.Event.getRelatedTarget(e);var oTarg=YAHOO.util.Event.getTarget(e);switch(e.type){case'mouseover':if(YESg.cache.isInDropDown==false){YESg.cache.isInDropDown=true;}
break;case'mouseout':if(oTarg==YESg.cache.oDrop||oTarg.parentNode==YESg.cache.oDrop){YESg.cache.isInDropDown=false;YESg.timedClose=window.setTimeout(function(){if(YESg.cache.isInDropDown==false){YESg.closeDrop();}},YESg.config.iMouseOverDelay);}
break;}},closeDrop:function(e){var YESg=YAHOO.EU.Shopping.globalnav;YESg.dropDown.cfg.setProperty("visible",false);if(YESg.cache.oTabClicked){YAHOO.util.Dom.removeClass(YESg.cache.oTabClicked.parentNode,'gn-drop-down');YAHOO.util.Dom.removeClass(YESg.cache.oTabClicked.parentNode,'gn-drop-down-nosel');}
YESg.cache.mouseInDropDown=false;},hideDropDown:function(e,o){o=o||null;var targ=YAHOO.util.Event.getTarget(e);var YESg=YAHOO.EU.Shopping.globalnav;if(o&&o.closelink){YESg.closeDrop(e);}else if(!YAHOO.util.Dom.isAncestor(YESg.cache.oDrop,targ)){YESg.closeDrop();}
if(e&&YAHOO.util.Event.getTarget(e).className=='close')YAHOO.util.Event.preventDefault(e);}};YAHOO.util.Event.onDOMReady(YAHOO.EU.Shopping.globalnav.init);

/* File: bookmarks.js */


YAHOO.namespace('YAHOO.EU.Shopping.Utils');YAHOO.EU.Shopping.Utils.BookmarkManager={createBookmark:function(url,title){if(typeof(window.external.AddFavorite)!="undefined"){if(title!=="undefined"){window.external.AddFavorite(url,title);}
else{window.external.AddFavorite(url,document.title);}
return true;}
return false;},setHomePage:function(ref,url){var a=document.createElement("a");a.href="#";a.style.behavior='url(#default#homepage)';if(typeof(a.setHomePage)!="undefined"){a.setHomePage(url);return true;}
return false;},initLinks:function(){YAHOO.util.Event.onAvailable("bookmark-list",function(){if(YAHOO.EU.Shopping.config.bookmark.isActivated&&window.external&&typeof(window.external.AddFavorite)!="undefined"){YAHOO.util.Dom.setStyle(this,'display','block');YAHOO.util.Event.addListener('bookmarkLink',"click",function(e){YAHOO.util.Event.preventDefault(e);var url=window.location.href;if(url.indexOf("?")>=0){url=url+"&source=bookmark";}
else{url=url+"?source=bookmark";}
var status=YAHOO.EU.Shopping.Utils.BookmarkManager.createBookmark(url,document.title);if(status){var sHref="http://"+window.location.host+YAHOO.EU.Shopping.config.bookmark.trackingUrl+"?"+YAHOO.EU.Shopping.config.bookmark.bookmarkParam;sHref=YAHOO.EU.Shopping.linkTracking.getTrackerLink(sHref,'globalnav');YAHOO.EU.Shopping.linkTracking.trackUxActions(sHref);}});YAHOO.util.Event.addListener('homepageLink',"click",function(e){YAHOO.util.Event.preventDefault(e);var url=window.location.href;if(url.indexOf("?")>=0){url=url+"&source=homepage";}
else{url=url+"?source=homepage";}
var status=YAHOO.EU.Shopping.Utils.BookmarkManager.setHomePage(e,url);if(status){var sHref="http://"+window.location.host+YAHOO.EU.Shopping.config.bookmark.trackingUrl+"?"+YAHOO.EU.Shopping.config.bookmark.homepageParam;sHref=YAHOO.EU.Shopping.linkTracking.getTrackerLink(sHref,'globalnav');YAHOO.EU.Shopping.linkTracking.trackUxActions(sHref);}});};})}};YAHOO.EU.Shopping.Utils.BookmarkManager.initLinks();

/* File: trv-hp.js */

YAHOO.namespace("YAHOO.EU.Kelkoo"); 
YAHOO.EU.Kelkoo.ajaxTabs={
  tabsInit:function(listId,mainContainerId,linksAjaxEnhancement,activeClass){
  	//object variables thta will be reused in oject methods
  	//the list of tabs
  	
  	//set up custom event
  	YAHOO.EU.Kelkoo.ajaxTabs.tabfired = new YAHOO.util.CustomEvent("tabfired", this); 
	
  	YAHOO.EU.Kelkoo.ajaxTabs.tabsList=document.getElementById(listId);
  	//the container that will hold all subconatiners associated with the tabs
  	YAHOO.EU.Kelkoo.ajaxTabs.contentMain=document.getElementById(mainContainerId);
  	//a generic warning message
  	YAHOO.EU.Kelkoo.ajaxTabs.activeClass=activeClass;
	
  	//we target the list items and the links inside them
  	var listTargetLis=YAHOO.EU.Kelkoo.ajaxTabs.tabsList.getElementsByTagName('li');
  	var listTargetLinks=YAHOO.EU.Kelkoo.ajaxTabs.tabsList.getElementsByTagName('a');
	
  	//we enhance them
  	for (var i=0; i<listTargetLis.length;i++){
  		//we generate unique ids so this script can be reused in the same page
  		var tempId=YAHOO.util.Dom.generateId();
  		//the list item id must end with 'tab', and its associated content subcontainer's id should have the same root but ends with 'cont', so we know they are 'linked'
  		var liId=tempId+'-tab';
  		var targContainerId=tempId+'-cont';
		
  		//for the default tab, the content has been already generated int the main content container by the ftl.
  		//So we just have a default id, and not a generated Id, and this default id is based on the listId (because it's the only way to "guess" it from the script, apart from using a new parameter to the function).
  		//This is due to the fact that if we copy the content of the default tab inside one of the generated containers to ensure mechansim is working right, 
  		//we lose all Dom references.
  		if(linksAjaxEnhancement[i].defaultActTab==='true'){
  			var liId='default-'+listId+'-tab';
  			var targContainerId='default-'+listId+'-cont';
  		}
  		//we set the id
  		listTargetLis[i].setAttribute('id',liId) ;
  		//we create a tabproperties object which will be passed has a parameter to the listeners
  		var tabProperties = {parentLi:listTargetLis[i].id,ajaxLink:linksAjaxEnhancement[i].ajaxlink, subCont:targContainerId}; 
  		//then we add the listener with the object as a parameter.reminder : true means that 'this' in the callback function will refer to the tabproperties object
  		YAHOO.util.Event.addListener(listTargetLinks[i], "click", YAHOO.EU.Kelkoo.ajaxTabs.displayContent, tabProperties, true);
  	}

  	//creates and hide the ajax loader to have it already created in case of ajax call
  	var ajaxLoader=document.createElement('img');
  	var ajaxLoaderId=YAHOO.util.Dom.generateId();
  	ajaxLoader.setAttribute('src','http://r6.kelkoo.com/misc/ajax-loader.gif');
  	ajaxLoader.setAttribute('id',ajaxLoaderId);
		ajaxLoader.setAttribute('alt','');
  	YAHOO.EU.Kelkoo.ajaxTabs.contentMain.appendChild(ajaxLoader);
  	//ajaxLoader.setAttribute('class',"hide ajaxtabs-loader");
  	//ajaxLoader.className = "hide ajaxtabs-loader";
  	YAHOO.util.Dom.addClass(ajaxLoader, 'hide ajaxtabs-loader');
  	//new object variable so we can call it during Ajax calls
  	YAHOO.EU.Kelkoo.ajaxTabs.ajaxLoader=document.getElementById(ajaxLoaderId);
	
  },
	
  displayContent:function(e){
  	//we prevent the default action
  	YAHOO.util.Event.preventDefault(e);
  	
  	YAHOO.EU.Kelkoo.ajaxTabs.tabfired.fire();

  	var clickedTab = document.getElementById(this.parentLi);
	
  	if(YAHOO.util.Dom.hasClass(clickedTab,YAHOO.EU.Kelkoo.ajaxTabs.activeClass)){
  	  //the clicked tab is already active, no point getting further...
  	  return;
  	}else{	
  		//we first need to change to change the class of the active tab and hide its content
  		var currentActiveTab = YAHOO.util.Dom.getElementsByClassName(YAHOO.EU.Kelkoo.ajaxTabs.activeClass, 'li',YAHOO.EU.Kelkoo.ajaxTabs.tabsList)[0];
  		if(currentActiveTab){
  			YAHOO.util.Dom.removeClass(currentActiveTab, YAHOO.EU.Kelkoo.ajaxTabs.activeClass);
  		}
  		//currentActiveTab Id ends with 'tab', and it's corresponding subcontainer's Id is the same except 'tab' is replaced by 'cont', cf. tabsInit function.
  		var currentActiveCont=(currentActiveTab.id).slice(0,-3);
  		currentActiveCont=currentActiveCont+'cont';
  		//Now we hide the current active content
  		YAHOO.util.Dom.addClass(currentActiveCont, 'hide');
  		//then  we change the clicked tab class
  		YAHOO.util.Dom.addClass(clickedTab, YAHOO.EU.Kelkoo.ajaxTabs.activeClass);
  	}
  	//Now we need to know if the clicked tab content already exists (for examples when the user has clicked on others tabs and then again on this tab)
  	if(document.getElementById(this.subCont)){
  		//if it's exists we just need to show it and return
  		YAHOO.util.Dom.removeClass(document.getElementById(this.subCont), 'hide');
  		return;
    }	else{
      //otherwise we create the subcaontainer, set its id, and append it to the main container
      var tabContent=document.createElement('div');
      tabContent.setAttribute('id',this.subCont);
      YAHOO.EU.Kelkoo.ajaxTabs.contentMain.appendChild(tabContent);
      //and we launch the function that handle the ajax call.The parameter clickedTab -corresponding to the list element taht wraps the link- will be used in case ajax calls fails, to retrieve the link href.
      YAHOO.EU.Kelkoo.ajaxTabs.ajaxCall(clickedTab,this.ajaxLink,tabContent);
    }
  },

  ajaxCall: function(clickedTab,url,tabContent){	
	  // we get the link attribute href
	  var linkElHref=clickedTab.getElementsByTagName('a')[0].href;
	
	  //in case of success, we hide the ajaxloader and fill the subcontainer content with the content which has been called
  	var handleSuccess = function(o){
  		if(o.responseText){
  			YAHOO.util.Dom.addClass(YAHOO.EU.Kelkoo.ajaxTabs.ajaxLoader, 'hide');
        // Get all of the backref matches
        function arrayBackRefs(rx,str){
          var m; var b=[];
          while((m = rx.exec(str)) != null){
            b.push(m[1]);
          }
          return b;
      	}
      	var rx = /<script.*?>([\s\S]*?)<\/script>/mg;
        // Extract all scripts into Backref
        var arrScripts = arrayBackRefs(rx,o.responseText); 
        // Strip script and add the pure code into the tab
        tabContent.innerHTML = o.responseText.replace(rx,"");
        var scr = document.createElement('script');
        scr.type= "text/javascript";
        
        var scriptCont = '';
        for(i=0, j=arrScripts.length; i<j; i++){
          scriptCont += arrScripts[i]; 
        }
        if (window.ActiveXObject){
          scr.text = scriptCont;
        }else{
          var txt = document.createTextNode(scriptCont);
          scr.appendChild(txt);
        }
        // Append Script
        var hd = document.getElementsByTagName('head')[0].appendChild(scr);  
  		}
  	};      

	  //in case of success, we hide the ajaxloader and fill the subcontainer content with the cwarning message  plus the href of the link, as a fallback.
  	var handleFailure = function(o){
  		//YAHOO.util.Dom.addClass(YAHOO.EU.Kelkoo.ajaxTabs.ajaxLoader, 'hide');
  		//tabContent.innerHTML=YAHOO.EU.Kelkoo.ajaxTabs.warningMsg+ ;
  		window.location=o.argument.fallbackHref;
  	};

	  var callback = {
  	  success:handleSuccess,
  	  failure: handleFailure,
  	  argument: {fallbackHref:linkElHref},
  		timeout:10000
  	};
  	//we show the ajax loader and launch the call
  	YAHOO.util.Dom.removeClass(YAHOO.EU.Kelkoo.ajaxTabs.ajaxLoader, 'hide');
  	//var sUrl = url;
  	var request = YAHOO.util.Connect.asyncRequest('GET', url, callback);
  }
//end object
};

YAHOO.EU.Kelkoo.travel={
	
	searchformscontrol: {
		
		ctrlInit: function(type,currentDate,warnings){
			var ykts=YAHOO.EU.Kelkoo.travel.searchformscontrol;	
			if(type=="flight"){
				ykts.removeWarnings("flightForm");

				if(!ykts.checkCity("ffl","flightFrom",warnings.departureWrong) || !ykts.checkCity("ftl","flightTo",warnings.arrivalWrong) || !ykts.checkDates('departureDate','ddf','returnDate','rdf',currentDate,warnings)){
				
					return false;
				}
				else{
					var flightf=document.getElementById("flightForm");
					//function kept for compatibility
					if(kk_flight_ctrlForm(flightf)){
						flightf.submit();	
						return true;
					}
					else{
						return false;
					}
				}
			}
			if(type=="hotel"){
				ykts.removeWarnings("hotelForm");

				if(!ykts.checkCity("hti","hotel-town-inp",warnings.destinationWrong) || !ykts.checkDates('departureDateHotel','ddh','returnDateHotel','rdh',currentDate,warnings)){
					return false;
				}
				else{
					var hotelf=document.getElementById("hotelForm");
					//function kept for compatibility
					if(kk_hotel_ctrlForm(hotelf)){
						hotelf.submit();	
						return true;
					}
					else{
						return false;
					}
				}
			}
			if(type=="car"){
				ykts.removeWarnings("carForm");

				if(!ykts.checkDates('departureDateCar','ddc','returnDateCar','rdc',currentDate,warnings)){
					return false;
				}
				else{
						var carf=document.getElementById("carForm");
						carf.submit();	
						return true;
				}
			}

		},
		
		removeWarnings: function(formId){		
			var warnings=YAHOO.util.Dom.getElementsByClassName("warningctrl","span",formId);
			var j=warnings.length;		
			for(var i=0;i<j;i++){
				warnings[i].parentNode.removeChild(warnings[i]);
			}
			var labelwarndate=YAHOO.util.Dom.getElementsByClassName("datewarn","label",formId);
			var j=labelwarndate.length;		
			for(var i=0;i<j;i++){
				YAHOO.util.Dom.removeClass(labelwarndate[i],'datewarn');
			}
			
		},
		
		checkCity: function(labelid,inputid,msg){
			
			var cityinpfield=document.getElementById(inputid);
			if(cityinpfield.value==""){
				var citylabel=document.getElementById(labelid);
				if(citylabel.getElementsByTagName('span')[0]!==true){
				var warningspan=document.createElement('span');
				warningspan.className='warningctrl';
				var warningspanmsg=document.createTextNode(msg);
				warningspan.appendChild(warningspanmsg);
				citylabel.appendChild(warningspan);
				}

				return false;
			}
			else{

				return true;
			}
			
		},
		
		warnDate: function(labelEl,msg){
			
			if(labelEl.getElementsByTagName('span')[0]!==true){
				YAHOO.util.Dom.addClass(labelEl,'datewarn');
				var warningspan=document.createElement('span');
				warningspan.className='warningctrl';
				var warningspanmsg=document.createTextNode(msg);
				warningspan.appendChild(warningspanmsg);
				labelEl.appendChild(warningspan);
			}
		},
		
		checkDates: function(firstDateInputId,firstDateLabelId,secDateInputId,secDateLabelId,currentDate,warnMsgs){
			var ykts=YAHOO.EU.Kelkoo.travel.searchformscontrol;	
			//warnMsgs is an array of translation composed of 4 messages.It's build inside by the template (because we can't have tk in the js...)
			
			var firstDate=document.getElementById(firstDateInputId);
			var secDate=document.getElementById(secDateInputId);
			var firstDateLabel=document.getElementById(firstDateLabelId);
			var secDateLabel=document.getElementById(secDateLabelId);
			//alert(firstDateLabelId+"dhjsk"+document.getElementById('triptypeOneWay').checked);
			//alert(firstDate+" "+secDate+" "+firstDateLabel+" "+secDateLabel);
			//First, we check that the date format entered is dd/mm/yyyy
			var myRE = new RegExp(/^(?:(?:0?[1-9]|1\d|2[0-8])(\/|-)(?:0?[1-9]|1[0-2]))(\/|-)(?:[1-9]\d\d\d|\d[1-9]\d\d|\d\d[1-9]\d|\d\d\d[1-9])$|^(?:(?:31(\/|-)(?:0?[13578]|1[02]))|(?:(?:29|30)(\/|-)(?:0?[1,3-9]|1[0-2])))(\/|-)(?:[1-9]\d\d\d|\d[1-9]\d\d|\d\d[1-9]\d|\d\d\d[1-9])$|^(29(\/|-)0?2)(\/|-)(?:(?:0[48]00|[13579][26]00|[2468][048]00)|(?:\d\d)?(?:0[48]|[2468][048]|[13579][26]))$/);
			
			//This is a flight form specific control (return date can be disabled in case of one way trip) :
			//we check we're int he flight form (first date label is ddf)

			if((firstDateLabelId=="ddf") && (document.getElementById('triptypeOneWay').checked==true) ){
					if(!myRE.test(firstDate.value)) {	
						
						ykts.warnDate(firstDateLabel,warnMsgs.wrongDateFormat);
						return false;
					}
				
			}
						
			//...if we re not in the flight form or if we are but return date hasn't been disabled
			else{
					if ((!myRE.test(firstDate.value)) ||(!myRE.test(secDate.value))  ) {
						if(!myRE.test(firstDate.value)){
							
							ykts.warnDate(firstDateLabel,warnMsgs.wrongDateFormat);
						}
						else{
							ykts.warnDate(secDateLabel,warnMsgs.wrongDateFormat);
						}				
						return false;
					}
			}


			//Specific control for hotel form: we check that dates are not equal (minimum one night)
			if((firstDateLabelId=="ddh") && (firstDate.value==secDate.value)){
				ykts.warnDate(secDateLabel,warnMsgs.equalDates);
				return false;
			}
			
			//next step, compare if the second date is not inferior to the first date.Before that, we need to transform the datea into dates object
			var firstDateArray=firstDate.value.split("/");
			var secDateArray=secDate.value.split("/");
			var currentDateArray=currentDate.split("/");
			
			var firstDateObj=new Date();
			var firstmonth= firstDateArray[1]-1;
			firstDateObj.setFullYear(firstDateArray[2],firstmonth,firstDateArray[0]);
			var secDateObj=new Date();
			var secmonth= secDateArray[1]-1;
			secDateObj.setFullYear(secDateArray[2],secmonth,secDateArray[0]);
			var currentDateObj=new Date();
			var currentDatemonth= currentDateArray[1]-1;
			currentDateObj.setFullYear(currentDateArray[2],currentDatemonth,currentDateArray[0]);
			
			//if we are in the flight and round trip is activated or if we are bnot in flight form
			if( ( (firstDateLabelId=="ddf") && (document.getElementById('triptypeOneWay').checked==false) ) || (firstDateLabelId!="ddf") ){
				if(firstDateObj.getTime()>secDateObj.getTime()){				
					ykts.warnDate(secDateLabel,warnMsgs.arrivalInf);
					return false;
				}
			}
		
			//Finally, we need to have a return date < current date + 350 for flight, or +730 for hotel and car hire
			
			//if we are in the flight form and round trip is activated 
			if(firstDateLabelId=="ddf") {
				if(document.getElementById('triptypeOneWay').checked==false){
					var maxDate = new Date();
					maxDate.setDate(currentDateObj.getDate()+350);
					if(secDateObj.getTime() > maxDate.getTime()){
						ykts.warnDate(secDateLabel,warnMsgs.arrivalTooFar);
						return false;
					}
				}
			}
		//...or if we're not in the flight form
			else{
				var maxDate = new Date();
				maxDate.setDate(currentDateObj.getDate()+730);
				
				if(secDateObj.getTime()>maxDate.getTime()){
					ykts.warnDate(secDateLabel,warnMsgs.arrivalTooFar);
					return false;
				}
			}
				
			//finally, we want to check that both dates are not inferior to todays's date, or today's date +1 day for hotelfor return.Also, we update the hidden field which is mandatory for some reason, the number of nights.
			//For hotel :
			if(firstDateLabelId=="ddh"){
				
				
				var minDate = new Date();
				minDate.setDate(currentDateObj.getDate()+1);
				if( (firstDateObj.getTime()<currentDateObj.getTime()) || (secDateObj.getTime()<minDate.getTime()) ) {
					if(firstDateObj.getTime()<currentDateObj.getTime()){
						ykts.warnDate(firstDateLabel,warnMsgs.departureInfCurr);
					}
					else{
						ykts.warnDate(secDateLabel,warnMsgs.arrivalInfCurr);	
					}
					return false;
				}
				//specific hotel control, coming from the old javascript
				var hform=document.getElementById("hotelForm");
				var hform = document.forms.searchFormHotel || document.forms.searchForm;
				hform.nbnights.value=Math.round((secDateObj.getTime()-firstDateObj.getTime())/(1000*3600*24));
				hform.town.value=document.getElementById("hotel-town-inp").value;
			}
			// for flight and cars form
			else{
				var minDate = new Date();
				minDate.setDate(currentDateObj.getDate());
				if(firstDateObj.getTime()<currentDateObj.getTime() ){
						ykts.warnDate(firstDateLabel,warnMsgs.departureInfCurr);
						return false;
					}
				if( ( (firstDateLabelId=="ddf")&&(document.getElementById('triptypeOneWay').checked==false) ) || (firstDateLabelId!="ddf") ){	
					if(secDateObj.getTime()<minDate.getTime()){
						ykts.warnDate(secDateLabel,warnMsgs.arrivalInfCurr);	
					}
				}	
			}
				
			return true;
			
		}
		//end searchformcontrol
	},  
	
	toggleMerchantVisibility: function(clsLinkTxt){
		
		YAHOO.EU.Kelkoo.ajaxTabs.tabfired.subscribe(YAHOO.EU.Kelkoo.travel.onTabFired); 
		
		var merchantlogos=document.getElementById("merchantlogos");
		merchantlogos.style.display="block";
		var mlTitleEmph=merchantlogos.getElementsByTagName('strong')[0];
		var mlTitleEmphTxt=mlTitleEmph.firstChild.nodeValue;
		var mlTitleLink=document.createElement('a');
		mlTitleLink.setAttribute("href","#");
		var mlTitleLinkTxt=document.createTextNode(mlTitleEmphTxt);
		mlTitleLink.appendChild(mlTitleLinkTxt);			
		mlTitleEmph.parentNode.insertBefore(mlTitleLink,mlTitleEmph);
		mlTitleEmph.parentNode.removeChild(mlTitleEmph);
		var mlCont=document.getElementById("ml-cont");
		var mlContCls=document.createElement('a');
		mlContCls.setAttribute("href","#");
		mlContCls.className="cont-cls";
		var mlContClsTxt=document.createTextNode(clsLinkTxt);
		mlContCls.appendChild(mlContClsTxt);
		mlCont.appendChild(mlContCls);
		YAHOO.util.Dom.addClass(mlCont, 'hide');
		YAHOO.util.Event.addListener(mlContCls, 'click', toggleVisibility);			
		YAHOO.util.Event.addListener(mlTitleLink, 'click', toggleVisibility);
		
			
  	function toggleVisibility(e) {
			if (YAHOO.util.Dom.hasClass('ml-cont', 'hide')){
		  	YAHOO.util.Dom.removeClass('ml-cont', 'hide');
		  }	else {
		  	YAHOO.util.Dom.addClass('ml-cont', 'hide');
		  }      
			YAHOO.util.Event.preventDefault(e);
		};
	},
	onTabFired: function() {
	  if (!YAHOO.util.Dom.hasClass('ml-cont', 'hide')){
	    YAHOO.util.Dom.addClass('ml-cont', 'hide');
	  }
	},
		
	searchform: {	
    createAdvLink: function(formId,labelAdv,linkAdv,linkSimple){
      var sf = document.getElementById(formId);
      // Advanced link
      var p1=document.createElement('p');    
      p1.className='avtogg';
      var txt1=document.createTextNode(labelAdv);
      p1.appendChild(txt1);
      var a1=document.createElement('a');
      a1.setAttribute('href','#');
      p1.appendChild(a1);
      var txt2=document.createTextNode(linkAdv);
      a1.appendChild(txt2);
      sf.appendChild(p1);
      // Simple link
      var p2=document.createElement('p');
      p2.className='avtogg';
      var a2=document.createElement('a');
      a2.setAttribute('href','#');
      var txt3=document.createTextNode(' '+linkSimple);
      a2.appendChild(txt3);
      p2.appendChild(a2);
			
			
      function toggleAdvSearch(e){
			
        if (YAHOO.util.Dom.hasClass('advanced', 'hide')){
          YAHOO.util.Dom.removeClass('advanced', 'hide');
          sf.removeChild(p1);
          sf.appendChild(p2);
        }else{
          YAHOO.util.Dom.addClass('advanced','hide');
          sf.removeChild(p2);
          sf.appendChild(p1);
        }      
        YAHOO.util.Event.preventDefault(e);
      };
			
      YAHOO.util.Event.addListener(a1, 'click', toggleAdvSearch);
      YAHOO.util.Event.addListener(a2, 'click', toggleAdvSearch);
    }
	}
};





function kk_setTrackingTravel(baseUrl,trackingName,moduleId){
   return false;
}

YAHOO.EU.Kelkoo.generic = {	
	tabs: {
		activeClass: 'active',
		contentDispClass: 'show',
		init: function(){
		  var YEKgt = YAHOO.EU.Kelkoo.generic.tabs;
		  YEKgt.container = this;
		  // Tabs
		  YEKgt.tabnav = YAHOO.util.Dom.getElementsByClassName('tabs', 'ul', this)[0];
		  if(YEKgt.tabnav) {
			  YEKgt.tabLinks = YEKgt.tabnav.getElementsByTagName('a');
			  YEKgt.tabLis = YEKgt.tabnav.getElementsByTagName('li');
			  // Tab content
			  YEKgt.tabContent = YAHOO.util.Dom.getElementsByClassName('cont', '', this);
			  YAHOO.util.Event.addListener(YEKgt.tabnav, 'click', YEKgt.switchTabs);
		  }
  	},
  	getIndex: function(o,coll){
  	  var tabIndex = false;
  	  for (i=0, j=coll.length; i<j; i++){
        if (o === coll[i]){
          tabIndex = i;
          break;
        }
      }
      return tabIndex;  	  
  	},
  	switchTabs: function(e){
  	  YAHOO.util.Event.preventDefault(e);
  	  var YEKgt = YAHOO.EU.Kelkoo.generic.tabs;
  	  // Get tab clicked
  	  var t = YAHOO.util.Event.getTarget(e);
  	  if (t.nodeType == 3) return;
  	  var tabIndex = YEKgt.getIndex(t,YEKgt.tabLinks);
  	  if (tabIndex === false) return;
      // Current active elements
  	  YEKgt.activeTab = (YEKgt.activeTab) ? YEKgt.activeTab : YAHOO.util.Dom.getElementsByClassName('active', 'li', YEKgt.tabnav)[0];
  	  YEKgt.activeContent = (YEKgt.activeContent) ? YEKgt.activeContent : YAHOO.util.Dom.getElementsByClassName('show', '', YEKgt.container)[0];
  	  // Bin this if we are already on the tab that we clicked.
  	  if (YEKgt.activeTab === YEKgt.tabLis[tabIndex]) return;
  	  YAHOO.util.Dom.removeClass(YEKgt.activeTab, YEKgt.activeClass);
  	  YAHOO.util.Dom.removeClass(YEKgt.activeContent, YEKgt.contentDispClass);
  	  // Cache currently active 
  	  YEKgt.activeTab = YEKgt.tabLis[tabIndex];
  	  YEKgt.activeContent = YEKgt.tabContent[tabIndex];
  	  YAHOO.util.Dom.addClass(YEKgt.activeTab, YEKgt.activeClass);
  	  YAHOO.util.Dom.addClass(YEKgt.activeContent, YEKgt.contentDispClass);
  	}
  }
};
  
/* Set-up the tab controller -----------------------------------------------------------------*/
YAHOO.util.Event.onAvailable("tagcloud", YAHOO.EU.Kelkoo.generic.tabs.init);



YAHOO.namespace("YAHOO.EU.Kelkoo.Travel"); 
YAHOO.EU.Kelkoo.travel.AZtabs={
	sTabContainerId:'az-result-tabs',
	sTabContainerTagname:'UL',
	sTabTagname:'LI',
	sClassNameSelected:'active',
	aTabs:[],
	aContentAnchors:[],
	//iCurrentSelectedIndex:0,
	init:function() {
		var me = YAHOO.EU.Kelkoo.travel.AZtabs;
		// getting the tabs container
		var eTabs = document.getElementById(me.sTabContainerId);
		if(!eTabs) return false;
		// getting the tabs elements
		me.aTabs = eTabs.getElementsByTagName(me.sTabTagname);
		if(!me.aTabs || me.aTabs.length < 1)return;
		
		// extracting all of the anchors from the tabs
		for(var i =0; i < me.aTabs.length; i++) {
			me.aContentAnchors[i]  = me.getAnchor( me.aTabs[i] );
		}
		// hide all
		me.hideContent();
		// but display the first tab
		me.focusOnContent( me.aContentAnchors[0] );
		
		// once we know if we got tabs, we attach an onClick listener to the tabs container
		YAHOO.util.Event.addListener(eTabs, 'click', me.onTabClick); 
	},
	onTabClick:function(e) {
		var me = YAHOO.EU.Kelkoo.travel.AZtabs;
		// trying to get which element of the UL was clicked
		var target = YAHOO.util.Event.getTarget(e);
		//alert(target);
		YAHOO.util.Event.stopEvent(e);
		
		// looking for the li element
		if(target.tagName.toUpperCase() != me.sTabTagname.toUpperCase() ) {
			// if we clicked on the container itself (in the space between tabs for example)
			if(target.id == me.sTabContainerId) {
				return false;
			}
			// getting up the dom tree to find the clicked tab
			while(target.parentNode) {
				target = target.parentNode;
				// if we are up do the root element, we probably missed something
				if(!target.tagName) return false;
				if(target.tagName.toUpperCase() == me.sTabTagname.toUpperCase() )
					break;
			}
		}
		// moving the focus to the clicked tab and its related content
		me.moveSelectionTo( target );
		me.focusOnContent( me.getAnchor(target) );
	},
	moveSelectionTo:function( eTab ) {
		var me = YAHOO.EU.Kelkoo.travel.AZtabs;
		for( var i=0, tab = null; i < me.aTabs.length; i++) {
			tab = me.aTabs[i];
			// remove the "selected" class from everywhere
			YAHOO.util.Dom.removeClass(tab, me.sClassNameSelected);
			// then add it only on the actually clicked tab
			if( tab == eTab) {
				YAHOO.util.Dom.addClass(eTab, me.sClassNameSelected);
			}
		}
	},
	// will let appear the div around the h2 around the given anchor
	focusOnContent:function( marker ) {
		YAHOO.EU.Kelkoo.travel.AZtabs.hideContent();

		marker = YAHOO.util.Dom.getElementsBy( 
				function(el) {
					if(!el.name) return false;
					return (el.name == marker);
				},
				'a'
			)[0];
			
		if(marker) {
			YAHOO.util.Dom.setStyle( marker.parentNode.parentNode, 'display', 'block');
		}
	},
	// extracts the anchor from a tab element
	getAnchor:function( eTab ) {
		var link = eTab.getElementsByTagName('A')[0].href;
		if( link.indexOf("#") == -1) return;
		return link.substring( link.indexOf("#") + 1 );
	},
	// hide all of the tabs content
	hideContent:function() {
		var me = YAHOO.EU.Kelkoo.travel.AZtabs;
		var marker = null;
		for(var i =0; i < me.aContentAnchors.length; i++) {
			//alert(me.aContentAnchors[i]);
			// IE tends to also perform a getElementsById when doing an getElementsByName, which of course causes bugs, so we dont use this function anymore
			//marker = document.getElementsByName( me.aContentAnchors[i] )[0];
			
			marker = YAHOO.util.Dom.getElementsBy( 
					function(el) {
						if(!el.name) return false;
						return (el.name == me.aContentAnchors[i]);
					},
					'a'
				)[0];
				
			
			if(	marker 
			   && marker.parentNode 
			   && YAHOO.util.Dom.hasClass(marker.parentNode, 'az-tabtitle') ) {
				//YAHOO.util.Dom.setStyle( marker.parentNode.parentNode, 'color', 'red');
				YAHOO.util.Dom.setStyle( marker.parentNode.parentNode, 'display', 'none');
			}
		}
	}
};

/* File: trv-forms.js */

//original kk js for hotels
function kk_hotel_changed_adults() {
	var searchFormHotel = document.forms.searchFormHotel || document.forms.searchForm;
var Max=roomTypeMaxTotal[roomTypeCurr]-(searchFormHotel.nbadults.selectedIndex-1);
var idx=searchFormHotel.nbchildren.selectedIndex;
if (idx>=Max) searchFormHotel.nbchildren.selectedIndex=Max-1;
}

function kk_hotel_changed_children() {
	var searchFormHotel = document.forms.searchFormHotel || document.forms.searchForm;
var Max=roomTypeMaxTotal[roomTypeCurr] - (searchFormHotel.nbchildren.selectedIndex-1);
var idx=searchFormHotel.nbadults.selectedIndex;
if (idx>=Max) searchFormHotel.nbadults.selectedIndex=Max-1;
}

function kk_hotel_isNewCalendar(){
	return (document.getElementById("yfcMiniCalDiv")!=null) || !!document.getElementById("returnDate");
}

function kk_hotel_isDate(dtStr){

  //var daysInMonth=[0,31,29,31,30,31,30,31,31,30,31,30,31];
        var daysInMonth = kk_hotel_DaysArray(12);
        var pos1=dtStr.indexOf(dtCh);
        var pos2=dtStr.indexOf(dtCh,pos1+1);
        var strDay=dtStr.substring(0,pos1);
        var strMonth=dtStr.substring(pos1+1,pos2);
        var strYear=dtStr.substring(pos2+1);
        strYr=strYear;
        if (strDay.charAt(0)=="0" && strDay.length>1) {strDay=strDay.substring(1);}
        if (strMonth.charAt(0)=="0" && strMonth.length>1) {strMonth=strMonth.substring(1);}
        for (var i = 1; i <= 3; i++) {
                if (strYr.charAt(0)=="0" && strYr.length>1) {strYr=strYr.substring(1);}
        }
        month=parseInt(strMonth);
        day=parseInt(strDay);
        year=parseInt(strYr);
        if (pos1==-1 || pos2==-1){
                alert(alert1 + "(dd/mm/yyyy)");
                return false;
        }
        if (strMonth.length<1 || month<1 || month>12){
                alert(alert1);
                return false;
        }
        if (strDay.length<1 || day<1 || day>31 || (month==2 && day>kk_hotel_daysInFebruary(year)) || day > daysInMonth[month]){
                alert(alert1);
                return false;
        }
        if ((strYear.length != 4 && strYear.length != 2) || year==0 ){
                alert(alert1);
                return false;
        }
        if (dtStr.indexOf(dtCh,pos2+1)!=-1 || kk_hotel_IsInterger(kk_hotel_stripCharsInBag(dtStr, dtCh))==false){
                alert(alert1);
                return false;
        }
return true;
}

function kk_hotel_DaysArray(n) {
        for (var i = 1; i <= n; i++) {
                this[i] = 31;
                if (i==4 || i==6 || i==9 || i==11) {this[i] = 30;}
                if (i==2) {this[i] = 29;}
   }
   return this;
}

function kk_hotel_IsFourDigitsYear(year){
 return (year.search(/\d{4}/) != -1);
}

function kk_hotel_IsInterger(s){
        var i;
    for (i = 0; i < s.length; i++){
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}

function kk_hotel_ConvertToFourDigitsYear(year){
var yearToConvert = "20" + year;
return yearToConvert;
}

function kk_hotel_stripCharsInBag(s, bag){
        var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++){
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}

function kk_hotel_daysInFebruary(year){
        // February has 29 days in any year evenly divisible by four,
    // EXCEPT for centurial years which are not also divisible by 400.
    return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
}


function kk_hotel_fill_guests() {
	var searchFormHotel = document.forms.searchFormHotel || document.forms.searchForm;
if (searchFormHotel.roomtype.selectedIndex){
roomType=searchFormHotel.roomtype.options[searchFormHotel.roomtype.selectedIndex].value;
for (i=0;i<roomTypeValue.length;i++)
if (roomType==roomTypeValue[i]) roomTypeCurr=i;
}
var adultSel=searchFormHotel.nbadults;
var childSel=searchFormHotel.nbchildren;
var a=searchFormHotel.nbadults.selectedIndex;
var c=searchFormHotel.nbchildren.selectedIndex;
for (i=0;i<=roomTypeGuestOption[roomTypeCurr];i++) {
adultSel.options[i]=new Option (i,i,false,false);
childSel.options[i]=new Option (i,i,false,false);
}
childSel.length=roomTypeGuestOption[roomTypeCurr]+1;
adultSel.length=roomTypeGuestOption[roomTypeCurr]+1;
var url=window.location.href;
var reg=new RegExp("\/do\/","g");
if (url.match(reg)&&roomtypeBool=="true") { 
searchFormHotel.nbadults.selectedIndex=a;
kk_hotel_changed_adults();
searchFormHotel.nbchildren.selectedIndex=c;
kk_hotel_changed_children();
roomtypeBool="false";
}
else if (!url.match(reg)&&roomtypeBool=="true") {
searchFormHotel.nbadults.selectedIndex=defaultAdultIndex;
searchFormHotel.nbchildren.selectedIndex=0;
roomtypeBool="false";
}
else {
searchFormHotel.nbadults.selectedIndex=adultSel.length-1;
searchFormHotel.nbchildren.selectedIndex=0;
}
}

function kk_hotel_cleanTown(fromField) {
if (fromField=="townSEL"&&(typeof(document.searchForm.townTEXT)!="undefined")){document.searchForm.townTEXT.value="";}
if (fromField=="townTEXT"&&(typeof(document.searchForm.townSEL)!="undefined")){document.searchForm.townSEL.selectedIndex=0;}
}


function kk_hotel_setMonth() {
	var searchFormHotel = document.forms.searchFormHotel || document.forms.searchForm;
searchFormHotel.mreturn.selectedIndex=searchFormHotel.marrival.selectedIndex;
kk_hotel_updateWeekDay();
}

function kk_hotel_setYear() {
	var searchFormHotel = document.forms.searchFormHotel || document.forms.searchForm;
searchFormHotel.yreturn.selectedIndex=searchFormHotel.yarrival.selectedIndex;
kk_hotel_updateWeekDay();
}

function kk_hotel_updateWeekDay() {
	var searchFormHotel = document.forms.searchFormHotel || document.forms.searchForm;
var dd=searchFormHotel.darrival.value;
var dm=searchFormHotel.marrival.value;
var dy=searchFormHotel.yarrival.value;
if (dy%4==0) var DMonthDays=new Array(31,29,31,30,31,30,31,31,30,31,30,31);
else var DMonthDays=new Array(31,28,31,30,31,30,31,31,30,31,30,31);
if (dd>DMonthDays[dm-1]) {
dd=DMonthDays[dm-1];
searchFormHotel.darrival.value=dd;
}
var rd=searchFormHotel.dreturn.value;
var rm=searchFormHotel.mreturn.value;
var ry=searchFormHotel.yreturn.value;
if (ry%4==0) var RMonthDays=new Array(31,29,31,30,31,30,31,31,30,31,30,31);
else var RMonthDays=new Array(31,28,31,30,31,30,31,31,30,31,30,31);
if (rd>RMonthDays[rm-1]) {
rd=RMonthDays[rm-1];
searchFormHotel.dreturn.value=rd;
}
kk_hotel_getDepWeekDay(dd,dm,dy);
kk_hotel_getRetWeekDay(rd,rm,ry);
}

function kk_hotel_getDepWeekDay(d,m,y) {
	var searchFormHotel = document.forms.searchFormHotel || document.forms.searchForm;
var daysinmonth=[31,28,31,30,31,30,31,31,30,31,30,31];
var day=searchFormHotel.darrival.options[searchFormHotel.darrival.selectedIndex].value-1;
var month=searchFormHotel.marrival.options[searchFormHotel.marrival.selectedIndex].value-1;
var year=searchFormHotel.yarrival.options[searchFormHotel.yarrival.selectedIndex].value;
if (year%4==0) daysinmonth[1]=29;
if (typeof(searchFormHotel.wdday)!="undefined"){
if (daysinmonth[month]>=day) {
var testdate=new Date(y,m-1,d);
var weekday=testdate.getDay();
if (weekday==0) searchFormHotel.wdday.value=Sun;
if (weekday==1) searchFormHotel.wdday.value=Mon;
if (weekday==2) searchFormHotel.wdday.value=Tue;
if (weekday==3) searchFormHotel.wdday.value=Wed;
if (weekday==4) searchFormHotel.wdday.value=Thu;
if (weekday==5) searchFormHotel.wdday.value=Fri;
if (weekday==6) searchFormHotel.wdday.value=Sat;
}
}      
}

function kk_hotel_getRetWeekDay(d,m,y) {
	var searchFormHotel = document.forms.searchFormHotel || document.forms.searchForm;
var daysinmonth=[31,28,31,30,31,30,31,31,30,31,30,31];
var day=searchFormHotel.dreturn.options[searchFormHotel.dreturn.selectedIndex].value-1;
var month=searchFormHotel.mreturn.options[searchFormHotel.mreturn.selectedIndex].value-1;
var year=searchFormHotel.yreturn.options[searchFormHotel.yreturn.selectedIndex].value;
if (year%4==0) daysinmonth[1]=29;
if (typeof(searchFormHotel.wrday)!="undefined"){
if (daysinmonth[month]>=day) {
var testdate=new Date(y,m-1,d);
var weekday=testdate.getDay();
if (weekday==0) searchFormHotel.wrday.value=Sun;
if (weekday==1) searchFormHotel.wrday.value=Mon;
if (weekday==2) searchFormHotel.wrday.value=Tue;
if (weekday==3) searchFormHotel.wrday.value=Wed;
if (weekday==4) searchFormHotel.wrday.value=Thu;
if (weekday==5) searchFormHotel.wrday.value=Fri;
if (weekday==6) searchFormHotel.wrday.value=Sat;
}
}
}

function kk_hotel_ctrlForm(form) {
	var isNewCalendar = kk_hotel_isNewCalendar();
	
	if (isNewCalendar)
	{
	  var departureDate=form.departureDate.value;
	  var returnDate=form.returnDate.value;
	  if (!kk_hotel_isDate(departureDate) || !kk_hotel_isDate(returnDate)) {return false;}
	  var splitDepDate=departureDate.split("/");
	  var splitRetDate=returnDate.split("/");
	  selectedDepDay=splitDepDate[0];
	  selectedDepMonth=splitDepDate[1];
	  selectedDepYear=splitDepDate[2];
	  selectedRetDay=splitRetDate[0];
	  selectedRetMonth=splitRetDate[1];
	  selectedRetYear=splitRetDate[2];
	
	  if (!kk_hotel_IsFourDigitsYear(selectedDepYear)) {
			selectedDepYear=kk_hotel_ConvertToFourDigitsYear(selectedDepYear);
	  }
	  if (!kk_hotel_IsFourDigitsYear(selectedRetYear)) {
			selectedRetYear=kk_hotel_ConvertToFourDigitsYear(selectedRetYear);
	  }
	}
	else
	{
	selectedDepDay=form.darrival.options[form.darrival.selectedIndex].value;
	selectedDepMonth=form.marrival.options[form.marrival.selectedIndex].value;
	selectedDepYear=form.yarrival.options[form.yarrival.selectedIndex].value;
	selectedRetDay=form.dreturn.options[form.dreturn.selectedIndex].value;
	selectedRetMonth=form.mreturn.options[form.mreturn.selectedIndex].value;
	selectedRetYear=form.yreturn.options[form.yreturn.selectedIndex].value;
	}
	selectedDepDate=new Date(selectedDepYear,selectedDepMonth-1,selectedDepDay);
	selectedRetDate=new Date(selectedRetYear,selectedRetMonth-1,selectedRetDay);
	today=new Date();
	tableJJ=[31,29,31,30,31,30,31,31,30,31,30,31];
	if (topDestValues== null||topDestValues=="I"||topDestValues=="") {
	if (form.townTEXT.value==""||form.townTEXT.value==null) {alert(alertNoDestination);return false;}
	else {
	for (i=0;i<correctDestination.length;i+=2) {
	if (form.townTEXT.value.toUpperCase()==correctDestination[i]) {
	form.townTEXT.value=correctDestination[i+1];
	i=correctDestination.length;
	}
	}
	form.town.value=form.townTEXT.value;
	}
	}
	else {
	if (form.townSEL.selectedIndex==0) {
	if (form.townTEXT.value==""||form.townTEXT.value==null) {
	alert(alertNoDestination);
	return false;
	}
	else {
	for (i=0;i<correctDestination.length;i+=2) {
	if (form.townTEXT.value.toUpperCase()==correctDestination[i]) {
	form.townTEXT.value=correctDestination[i+1];
	i=correctDestination.length;
	}
	}
	form.town.value=form.townTEXT.value;
	}
	}
	else {form.town.value=form.townSEL.options[form.townSEL.selectedIndex].value;}
	}
	if (selectedDepDay>tableJJ[selectedDepMonth-1]||(selectedRetDay>tableJJ[selectedRetMonth-1])) {
	alert(alert1);
	return false;
	}
	selectedDepTime=selectedDepDate.getTime()+82800000;
	selectedRetTime=selectedRetDate.getTime()+82800000;
	if (today.getTime()>selectedDepTime||today.getTime()>selectedRetTime) {
	alert(alert2);
	return false;
	}
	if (selectedRetTime<selectedDepTime) {alert(alert3);return false;}
	if ((form.nbadults.selectedIndex+form.nbchildren.selectedIndex)<=0) {
	alert(alertNoPerson);
	return false;
	}
	// following condition test if new calendar is actif or not, DO NOT REMOVE IT UNTIL NEW CALENDAR IS ON PROD
	if (!isNewCalendar){
	if ((form.yreturn.selectedIndex==form.yarrival.selectedIndex)&&(form.mreturn.selectedIndex==form.marrival.selectedIndex) &&(form.dreturn.selectedIndex==form.darrival.selectedIndex)) {alert(alert4);return false;}
	}else{
	if (form.departureDate.value==form.returnDate.value){alert(alert4);return false;}	
	}
	form.nbnights.value=Math.round((selectedRetTime-selectedDepTime)/(1000*3600*24));
	if (typeof (form.priceList)!="undefined") {
	interval=form.priceInterval.value;
	if (interval==interval1) {form.pricemin.value=0; form.price.value=price1;}
	if (interval==interval2) {form.pricemin.value=price1; form.price.value=price2;}
	if (interval==interval3) {form.pricemin.value=price2; form.price.value=10000;}
	}
	if (typeof(kk_hotel_dayRangeValidDate)=="undefined") kk_hotel_dayRangeValidDate=730;
	validDepDate=today.getTime()+24*3600*1000*kk_hotel_dayRangeValidDate;
	if (validDepDate<=selectedDepTime) {
	alert(alert5);
	return false;
	}
	return true;
}

function kk_hotel_majDate() {
	var searchFormHotel = document.forms.searchFormHotel || document.forms.searchForm;
if (searchFormHotel.darrival.value =="01" && searchFormHotel.marrival.value =="01" && searchFormHotel.dreturn.value =="01" && searchFormHotel.mreturn.value=="01") {
var now=new Date();
var tmp=now.getTime()+(86400000*7);
now.setTime(tmp);
var month=now.getMonth()+1;
var year=now.getFullYear();
var day=now.getDate();
searchFormHotel.darrival.options[day-1].selected=true;
searchFormHotel.marrival.options[month-1].selected=true;
searchFormHotel.yarrival.options[year-this_year].selected=true;
var now2=new Date();
tmp=now2.getTime()+(86400000*8);
now2.setTime(tmp);
month=now2.getMonth()+1;
year=now2.getFullYear();
day=now2.getDate();
searchFormHotel.dreturn.options[day-1].selected=true;
searchFormHotel.mreturn.options[month-1].selected=true;
searchFormHotel.yreturn.options[year-this_year].selected=true;
}
}

function kk_hotel_relativeDates() {
	var searchFormHotel = document.forms.searchFormHotel || document.forms.searchForm;
var v=new Array();
v["name"]=new Array();
v["val"]=new Array();
var RelativeDay;
var RelativeWeek;
var RelativeMonth;
var RelativeDelay;
var url=location.href;
var urlVars=url.split("?");
var vars=urlVars[1].split("&");
for (var i=0;i<vars.length;i++) {
v["name"][i]=vars[i].split("=")[0];
v["val"][i]=vars[i].split("=")[1];
if (v["name"][i]=="departureRelativeDay") RelativeDay=v["val"][i];
if (v["name"][i]=="departureRelativeWeek") RelativeWeek=v["val"][i];
if (v["name"][i]=="departureRelativeMonth") RelativeMonth=v["val"][i];
if (v["name"][i]=="RelativeDelay") RelativeDelay=v["val"][i];
}
if (RelativeDay==null) RelativeDay=0;
if (RelativeWeek==null) RelativeWeek=0;
if (RelativeMonth==null) RelativeMonth=0;
if (RelativeDelay==null) RelativeDelay=0;
var DateActuelle=new Date();
day=DateActuelle.getDate().toString(10);
month=(DateActuelle.getMonth()+1).toString(10);
this_year=(DateActuelle.getYear()+1900).toString(10);
if (this_year>=3905) {this_year=this_year - 1900;}
if (RelativeDay!=0||RelativeWeek!=0||RelativeMonth!=0) {
var ArriveeHotel=kk_hotel_calculArrival(RelativeDay,RelativeMonth,RelativeWeek);
day=ArriveeHotel.substring(0,2);
month=ArriveeHotel.substring(2,4);
year=ArriveeHotel.substring(4,8);
if (day<10) day=day.substring(1,2);
if (month<10) month=month.substring(1,2);
searchFormHotel.darrival.options[day-1].selected=true;
searchFormHotel.marrival.options[month].selected=true;
searchFormHotel.yarrival.options[year-this_year].selected=true;
}
var Aday=day;
var Amonth=month;
var Ayear=year;
var now2=new Date();
month=now2.getMonth()+1;
this_year=now2.getFullYear();
if (this_year>=3905) {this_year=this_year-1900;}
day=now2.getDate();
if (RelativeDelay!=0) {
var DepartHotel=kk_hotel_calculDeparture(Aday,Amonth,Ayear,RelativeDelay);
day=DepartHotel.substring(0,2);
month=DepartHotel.substring(2,4);
year=DepartHotel.substring(4,8);
if (day<10) day=day.substring(1,2);
if (month<10) month=month.substring(1,2);
searchFormHotel.dreturn.options[day-1].selected=true;
searchFormHotel.mreturn.options[month].selected=true;
searchFormHotel.yreturn.options[year-this_year].selected=true;
}
}

function kk_hotel_calculDeparture(darrival,marrival,yarrival,returnDelay) {
var DECEMBER=11;
var JANUARY=0;
var jour=darrival;
var mois=marrival;
var annee=yarrival;
if (annee>3904) {annee=annee-1900;}
var DateActuelle=new Date();
var retour=returnDelay;
while(retour>0) {
if (jour==kk_hotel_DAY_MAX_MONTH(mois,annee)) {
mois++;
if (mois>DECEMBER) {mois=JANUARY;annee++;}
retour--;
jour=1;
DateActuelle.setDate(jour);
DateActuelle.setMonth(mois);
DateActuelle.setYear(annee);
}
else {
jour++;
DateActuelle.setDate(jour);
DateActuelle.setMonth(mois);
DateActuelle.setYear(annee);
retour--;
}
}
var Jour="";
var Mois="";
var Annee="";
Jour=DateActuelle.getDate().toString(10);
Mois=(DateActuelle.getMonth()+0).toString(10);
Annee=(DateActuelle.getYear()+1900).toString(10);
if (Annee>3904) {Annee=Annee-1900;}
if (Mois<10) Mois="0"+Mois;
if (Jour<10) Jour="0"+Jour;
if (jour==31) Jour=31;
return Jour+Mois+Annee;
}

function kk_hotel_calculArrival(RelativeDay,RelativeMonth,RelativeWeek) {
var CodeJour=-1;
var CodeMois=-1;
var JourNumero=0;
var JourSemaine;
var NbreJoursSemaine;
var DECEMBER=11;
var JANUARY=0;
var DateActuelle=new Date();
var jour=DateActuelle.getDate();
var mois=DateActuelle.getMonth();
var annee=DateActuelle.getYear()+1900;
if (annee>3904) {annee=annee-1900;}
CodeMois=kk_hotel_getCodeMois(RelativeMonth);
CodeJour=kk_hotel_getCodeJour(RelativeDay);
if (CodeMois==-1) {
while (RelativeMonth!=0) {
mois++;
if (mois>DECEMBER) {mois=JANUARY;annee++;}
RelativeMonth--;
}
if (jour>kk_hotel_DAY_MAX_MONTH(mois,annee)) {
jour=1;
mois++;
if(mois>DECEMBER) {mois=JANUARY;annee++;}
}
DateActuelle.setDate(jour);
DateActuelle.setMonth(mois);
DateActuelle.setYear(annee);
}
else {
while(mois!=kk_hotel_getCodeMois(RelativeMonth)) {
if (jour>kk_hotel_DAY_MAX_MONTH(mois,annee)) {
jour=1;
mois++;
}
else mois++;
if (mois>DECEMBER) {
mois=JANUARY;
annee++;
}
}
DateActuelle.setDate(jour);
DateActuelle.setMonth(mois);
DateActuelle.setYear(annee);
}
NbreJoursSemaine=7*RelativeWeek;
if (CodeJour==-1) {
JourNumero=1;
while(RelativeDay+NbreJoursSemaine>0)
{
if (jour==kk_hotel_DAY_MAX_MONTH(mois,annee))
{
mois++;
if (mois>DECEMBER) {
mois=JANUARY;
annee++;
}
RelativeDay--;
DateActuelle.setDate(jour);
DateActuelle.setMonth(mois);
DateActuelle.setYear(annee);
jour=1;
}
else {
jour++;
DateActuelle.setDate(jour);;
DateActuelle.setMonth(mois);
DateActuelle.setYear(annee);
RelativeDay--;
}
}
}
else {
while((JourSemaine!=CodeJour|NbreJoursSemaine>0) & JourNumero==0) {
if (jour==kk_hotel_DAY_MAX_MONTH(mois,annee)) {
mois++;
jour=1;
NbreJoursSemaine--;
DateActuelle.setDate(jour);
DateActuelle.setMonth(mois);
DateActuelle.setYear(annee);
JourSemaine=DateActuelle.getDay();
if (mois>DECEMBER) {mois=JANUARY;annee++;}
}
jour++;
NbreJoursSemaine--;
DateActuelle.setDate(jour);
DateActuelle.setMonth(mois);
DateActuelle.setYear(annee);
JourSemaine=DateActuelle.getDay();
}
}
var Jour="";
var Mois="";
var Annee="";
Jour=DateActuelle.getDate().toString(10);
Mois=(DateActuelle.getMonth()+0).toString(10);
Annee=(DateActuelle.getYear()+1900).toString(10);
if (Annee>3904) {Annee=Annee-1900;}
if (Mois<10) Mois="0"+Mois;
if (Jour<10) Jour="0"+Jour;
if (JourSemaine==31) Jour=31;
return Jour+Mois+Annee;
}

function kk_hotel_isBissextile(annee) {
if (annee%400==0) {return true;}
else if ((annee%4==0)||(annee % 100!=0)) {return true;}
else {return false;}
}

function kk_hotel_DAY_MAX_MONTH(mois,annee) {
if(mois==kk_hotel_getCodeMois("January")||mois==0) return 31;
if(mois==kk_hotel_getCodeMois("March")||mois==2) return 31;
if(mois==kk_hotel_getCodeMois("April")||mois==3)return 30;
if(mois==kk_hotel_getCodeMois("May")||mois==4) return 31;
if(mois==kk_hotel_getCodeMois("June")||mois==5) return 30;
if(mois==kk_hotel_getCodeMois("July")||mois==6) return 31;
if(mois==kk_hotel_getCodeMois("August")||mois==7) return 31;
if(mois==kk_hotel_getCodeMois("September")||mois==8) return 30;
if(mois==kk_hotel_getCodeMois("October")||mois==9) return 1;
if(mois==kk_hotel_getCodeMois("November")||mois==10) return 30;
if(mois==kk_hotel_getCodeMois("December")||mois==11) return 31;
if(mois==kk_hotel_getCodeMois("February")||mois==1) {if (kk_hotel_isBissextile(annee)) return 29; else return 28;}
}

function kk_hotel_getCodeMois(RelativeMonth) {
if (RelativeMonth=="January") return 0;
if (RelativeMonth=="February") return 1;
if (RelativeMonth=="March") return 2;
if (RelativeMonth=="April") return 3;
if (RelativeMonth=="May") return 4;
if (RelativeMonth=="June") return 5;
if (RelativeMonth=="July") return 6;
if (RelativeMonth=="August") return 7;
if (RelativeMonth=="September") return 8;
if (RelativeMonth=="October") return 9;
if (RelativeMonth=="November") return 10;
if (RelativeMonth=="December") return 11;
else return -1;
}

function kk_hotel_getCodeJour(RelativeDay) {
if (RelativeDay=="Monday") return 1;
if (RelativeDay=="Thuesday") return 2;
if (RelativeDay=="Wednesday") return 3;
if (RelativeDay=="Thursday") return 4;
if (RelativeDay=="Friday") return 5;
if (RelativeDay=="Saturday") return 6;
if (RelativeDay=="Sunday") return 0;
else return -1;
}

function kk_hotel_checkRoomtype(form) {
var nbadults=parseInt(form.nbadults.options[form.nbadults.selectedIndex].value);
var nbchilds=0;
if (form.nbchildren.options) {
nbchilds=parseInt(form.nbchildren.options[form.nbchildren.selectedIndex].value);
if (isNaN(nbchilds)) {nbchilds=0;}
}
var nbPeople=nbadults+nbchilds;
var kkRoomType=form.roomtype.options[form.roomtype.selectedIndex].value.toUpperCase();
if (nbPeople==2) {
if (FORBIDEN_ROOMTYPE_BY_PEOPLE[2].indexOf(kkRoomType)!=-1) {return confirm(CONFIRM_ROOMTYPE);}		
}
else if (nbPeople==3) {
if (FORBIDEN_ROOMTYPE_BY_PEOPLE[3].indexOf(kkRoomType)!=-1) {return confirm(CONFIRM_ROOMTYPE);}
}
else if (nbPeople==4) {
if (FORBIDEN_ROOMTYPE_BY_PEOPLE[4].indexOf(kkRoomType)!=-1) {return confirm(CONFIRM_ROOMTYPE);}		
}
else if (nbPeople>=5) {
if (FORBIDEN_ROOMTYPE_BY_PEOPLE[5].indexOf(kkRoomType)!=-1) {return confirm(CONFIRM_ROOMTYPE);}
return true;
}
}


function kk_hotel_getTown(form){
      var ele = form.options[form.selectedIndex];
      if (ele.textContent) var text = ele.textContent;
    if (ele.innerText) var text = ele.innerText;
    if (ele.innerHTML) var text = ele.innerHTML;

    text = text.replace(/&nbsp;/g, '');
          if (ele.value.length > 2) document.getElementById('hotel-town-inp').value = text;
    }


//function kept for compatibility

function kk_flight_ctrlForm(form) {
	if (typeof(form.airline)!="undefined") {
		
		if (form.airlineFormatted != null && form.airline.type.toLowerCase() == 'select') {
			var airlineName2=form.airline.options[form.airline.selectedIndex].text;
			form.airlineFormatted.value=airlineName2;
		}
	}
	
	form.departureTEXT.value=form.departure.value ;
	form.arrivalTEXT.value=form.arrival.value ;
	
	if (form.from.value=="kelbest") {
		form.from.value="shopbot";
		}
	
	return true;
}

// original js for flights
function kk_updateType() {
var str = location.href;
var upperTypeParameter = str.match("TYPE=Oneway");
if (upperTypeParameter=="TYPE=Oneway") kk_updateSearchForm(document.searchForm.type, 'Oneway');
}

function kk_flight_toggleOneTwoWay(){
var returnDate=document.getElementById('returnDateDiv');
var returnTimeDiv=document.getElementById('returnTimeDiv');
var returning=document.getElementById('returning');
if(document.searchForm.type[0].checked){returnDate.style.display="block";returnTimeDiv.style.display="block";returning.style.display="block";}
else if(document.searchForm.type[1].checked){returnDate.style.display="none";returnTimeDiv.style.display="none";returning.style.display="none";}
}

function kk_flightToMultistop(){
        var uri = "/b/a/c_100342123_multistop.html?forceVisible=true";
        document.location.href=uri;
}

function kk_flightToTripPlanner(){
        if ( !document.searchForm.allSubCatId[0].checked ){
            for (i=1; i < 4; i++) {
                if (document.searchForm.allSubCatId[i].checked) {
                        var allSubCatId = document.searchForm.allSubCatId[i].value;
                }
            }
            //retrieves parameters
            var url = "/b/a/c_100371323_trip_planner.html";
            var departure = document.searchForm.departure.value;
            var arrival = document.searchForm.arrival.value;
	    var departureDate = document.searchForm.departureDate.value;
	    var returnDate = document.searchForm.returnDate.value;
            var nbadults = document.searchForm.nbadults.value;

            url = url + '?allSubCatId=' + allSubCatId + '&townDeparture=' + departure + '&destination=' + arrival + '&departureDate=' + departureDate + '&returnDate=' + returnDate  + '&nbAdults=' + nbadults;
            document.location.href = url;
    }
}

function checkForm(form) {
return kk_flight_ctrlForm(form);
}


function kk_flight_caculateNumberOfDays(maxMonth){
today=new Date();
var currentMonth = today.getMonth();
var lastMonth = (maxMonth + currentMonth + 1)%12; //caculate the current month + maxMonth
var daysInMonth = kk_flight_DaysArray(12);
var lastDate = daysInMonth[lastMonth];
var lastDay;
if (lastMonth!=0)
{
 lastDay=new Date(today.getFullYear()+1, lastMonth-1,lastDate);
}
else { lastDay=new Date(today.getFullYear(), lastMonth-1, lastDate);}
var one_day=1000*60*60*24;
var numberOfDays=(Math.ceil((lastDay.getTime()-today.getTime())/(one_day)));
return numberOfDays;

}

function kk_flight_IsFourDigitsYear(year){
 return (year.search(/\d{4}/) != -1);
}

function kk_flight_ConvertToFourDigitsYear(year){ 
var yearToConvert = "20" + year;
return yearToConvert;
}

function kk_flight_isNewCalendar(){
	return (document.getElementById("yfcMiniCalDiv")!=null) || !!document.getElementById("returnDate");
}

var dtCh= "/";
function kk_flight_IsInterger(s){
	var i;
    for (i = 0; i < s.length; i++){   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}

function kk_flight_stripCharsInBag(s, bag){
	var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++){   
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}

function kk_flight_daysInFebruary(year){
	// February has 29 days in any year evenly divisible by four,
    // EXCEPT for centurial years which are not also divisible by 400.
    return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
}

function kk_flight_DaysArray(n) {
	for (var i = 1; i <= n; i++) {
		this[i] = 31;
		if (i==4 || i==6 || i==9 || i==11) {this[i] = 30;}
		if (i==2) {this[i] = 29;}
   } 
   return this;
}


function kk_flight_isDate(dtStr){

  //var daysInMonth=[0,31,29,31,30,31,30,31,31,30,31,30,31];
	var daysInMonth = kk_flight_DaysArray(12);
	var pos1=dtStr.indexOf(dtCh);
	var pos2=dtStr.indexOf(dtCh,pos1+1);
	var strDay=dtStr.substring(0,pos1);
	var strMonth=dtStr.substring(pos1+1,pos2);
	var strYear=dtStr.substring(pos2+1);
	strYr=strYear;
	if (strDay.charAt(0)=="0" && strDay.length>1) {strDay=strDay.substring(1);}
	if (strMonth.charAt(0)=="0" && strMonth.length>1) {strMonth=strMonth.substring(1);}
	for (var i = 1; i <= 3; i++) {
		if (strYr.charAt(0)=="0" && strYr.length>1) {strYr=strYr.substring(1);}
	}
	month=parseInt(strMonth);
	day=parseInt(strDay);
	year=parseInt(strYr);
	if (pos1==-1 || pos2==-1){
		alert(alert1);
		return false;
	}
	if (strMonth.length<1 || month<1 || month>12){
		alert(alert1);
		return false;
	}
	if (strDay.length<1 || day<1 || day>31 || (month==2 && day>kk_flight_daysInFebruary(year)) || day > daysInMonth[month]){
		alert(alert1);
		return false;
	}
	if ((strYear.length != 4 && strYear.length != 2) || year==0 ){
		alert(alert1);
		return false;
	}
	if (dtStr.indexOf(dtCh,pos2+1)!=-1 || kk_flight_IsInterger(kk_flight_stripCharsInBag(dtStr, dtCh))==false){
		alert(alert1);
		return false;
	}
return true;
}

function kk_flight_openDepartureDateCalendar() {
if (cal==null) {
cal=new kk_CalendarPopup();
cal.setReturnFunction("kk_flight_setDepDate");
cal.setMonthNames(month1,month2,month3,month4,month5,month6,month7,month8,month9,month10,month11,month12);
cal.setDayHeaders(day1,day2,day3,day4,day5,day6,day7);
cal.setWeekStartDay(1);
cal.setTodayLabel(todayLabel);
}
month=document.searchForm.dmonth.options[document.searchForm.dmonth.selectedIndex].value;
year=document.searchForm.dyear.options[document.searchForm.dyear.selectedIndex].value;
cal.showCalendar('depdate',month,year); 
return false;
}

function kk_flight_openReturnDateCalendar() {
if (cal2==null) {
cal2=new kk_CalendarPopup();
cal2.setReturnFunction("kk_flight_setRetDate");
cal2.setMonthNames(month1,month2,month3,month4,month5,month6,month7,month8,month9,month10,month11,month12);
cal2.setDayHeaders(day1,day2,day3,day4,day5,day6,day7);
cal2.setWeekStartDay(1);
cal2.setTodayLabel(todayLabel);
}
month=document.searchForm.rmonth.options[document.searchForm.rmonth.selectedIndex].value;
year=document.searchForm.ryear.options[document.searchForm.ryear.selectedIndex].value;
cal2.showCalendar('retdate',month,year); 
return false;
}

function kk_flight_cleanTown(fromField) {
if (fromField=="departureSEL"){document.searchForm.departureTEXT.value="";}
if (fromField=="departureTEXT") {
document.searchForm.departureSEL.selectedIndex=0;
document.searchForm.departure.value=document.searchForm.departureTEXT.value;
}
if (fromField=="arrivalSEL") {document.searchForm.arrivalTEXT.value="";}
if (fromField=="arrivalTEXT") {
document.searchForm.arrivalSEL.selectedIndex=0;
document.searchForm.arrival.value=document.searchForm.arrivalTEXT.value;
}
}

function kk_flight_currentYear() {
var now=new Date(); 
var year=now.getYear(); 
if(year<999) year+=1900;
return year;
}

function kk_flight_setDepDate(y,m,d) {
var year=kk_flight_currentYear();
document.searchForm.dday.selectedIndex=d-1;
document.searchForm.dmonth.selectedIndex=m-1;
if (y==year) document.searchForm.dyear.selectedIndex=0;
if (y==year+1) document.searchForm.dyear.selectedIndex=1;
kk_flight_setMonth();
kk_flight_setYear();
if (typeof(document.searchForm.wdday)!="undefined") kk_flight_getDepWeekDay(d,m,y);
}

function kk_flight_setRetDate(y,m,d) {
var year=kk_flight_currentYear();
document.searchForm.rday.selectedIndex=d-1;
document.searchForm.rmonth.selectedIndex=m-1;
if (y==year) document.searchForm.ryear.selectedIndex=0;
if (y==year+1) document.searchForm.ryear.selectedIndex=1;
if (typeof(document.searchForm.wrday)!="undefined") kk_flight_getRetWeekDay(d,m,y);
}


function kk_flight_ctrlForm(form) {
	if (typeof(form.airline)!="undefined") {
		if (form.airlineFormatted != null && form.airline.type.toLowerCase() == 'select') {
			var airlineName2=form.airline.options[form.airline.selectedIndex].text;
			form.airlineFormatted.value=airlineName2;
		}
	}
	var daysinmonthR=[31,28,31,30,31,30,31,31,30,31,30,31];
	var daysinmonthD=[31,28,31,30,31,30,31,31,30,31,30,31];
	
	var isNewCalendar = kk_flight_isNewCalendar();
	
	if (isNewCalendar)
	{
	  var departureDate=form.departureDate.value;
	  var returnDate=form.returnDate.value;
	  if (!kk_flight_isDate(departureDate) || !kk_flight_isDate(returnDate)) {return false;}
	  var splitDepDate=departureDate.split("/");
	  var splitRetDate=returnDate.split("/");
	  selectedDepDay=splitDepDate[0];
	  selectedDepMonth=splitDepDate[1];
	  selectedDepYear=splitDepDate[2];
	  selectedRetDay=splitRetDate[0];
	  selectedRetMonth=splitRetDate[1];
	  selectedRetYear=splitRetDate[2];
	 
	  if (!kk_flight_IsFourDigitsYear(selectedDepYear)) {
		selectedDepYear=kk_flight_ConvertToFourDigitsYear(selectedDepYear);
	  }
	  if (!kk_flight_IsFourDigitsYear(selectedRetYear)) {
		selectedRetYear=kk_flight_ConvertToFourDigitsYear(selectedRetYear);
	  }	
}
	else
{
	  selectedDepDay=form.dday.options[form.dday.selectedIndex].value;
	  selectedDepMonth=form.dmonth.options[form.dmonth.selectedIndex].value;
	  selectedDepYear=form.dyear.options[form.dyear.selectedIndex].value;
	  if( form.rday ){
		selectedRetDay=form.rday.options[form.rday.selectedIndex].value;
		selectedRetMonth=form.rmonth.options[form.rmonth.selectedIndex].value;
	  	selectedRetYear=form.ryear.options[form.ryear.selectedIndex].value;
	  } else {
		selectedRetDay = selectedRetMonth = selectedRetYear = '';
	  }
	  
}
	selectedDepDate=new Date(selectedDepYear, selectedDepMonth -1, selectedDepDay);
	selectedRetDate=new Date(selectedRetYear, selectedRetMonth -1, selectedRetDay);
	today=new Date();
	if (typeof(form.departureTEXT)!="undefined" ) { selectedDepartureText=form.departureTEXT.value;}
	else {selectedDepartureText=form.departure.value;}
	if (typeof(form.departureSEL)!="undefined") { selectedDepartureSelect=form.departureSEL.options[form.departureSEL.selectedIndex].value;}
	else {selectedDepartureSelect ="I";}
	if ((selectedDepartureText==null||selectedDepartureText=="")&&(selectedDepartureSelect != null&&selectedDepartureSelect != "I")) { form.departure.value=selectedDepartureSelect;}
	else {
	if (form.arrivalTEXT.type!="hidden") {form.departure.value=selectedDepartureText;}
	}
	if (typeof(form.arrivalTEXT)!="undefined") {selectedArrivalText=form.arrivalTEXT.value;}
	else {selectedArrivalText=form.arrival.value;}
	if (typeof(form.arrivalSEL)!="undefined") {selectedArrivalSelect=form.arrivalSEL.options[form.arrivalSEL.selectedIndex].value;}
	else {selectedArrivalSelect="I";}
	if ((selectedArrivalText==null||selectedArrivalText=="")&&(selectedArrivalSelect!=null&&selectedArrivalSelect!="I")) { form.arrival.value=selectedArrivalSelect;}
	else {
	if (form.arrivalTEXT.type!="hidden") { form.arrival.value=selectedArrivalText; }
	}
	if (selectedDepYear%4==0) daysinmonthD[1]=29;
	if (selectedRetYear%4==0) daysinmonthR[1]=29;
	if (selectedDepDay>daysinmonthD[selectedDepMonth-1]||((form.type.type=="hidden"||!form.type[1].checked)&&selectedRetDay>daysinmonthR[selectedRetMonth-1])) {
		alert (alert1);
		return false;
	}
	selectedDepTime=selectedDepDate.getTime() + 24*3600*1000;	
	selectedRetTime=selectedRetDate.getTime() + 24*3600*1000;
	if (today.getTime()>selectedDepTime||((today.getTime()>selectedRetTime )&&(form.type.type=="hidden"||!form.type[1].checked))) {
		alert (alert2);
		return false;
	}
	if (form.type.type=="hidden"||form.type[0].checked) {
		if (selectedRetTime<selectedDepTime) {
			alert (alert3);
			return false;
		}
	}
	if (form.departureTEXT.type=="hidden"&&form.arrivalTEXT.type=="hidden") {
		form.departureTEXT.value=form.departure.value ;
		form.arrivalTEXT.value=form.arrival.value ;
	}
	if (form.departure.value==""||form.arrival.value=="") {
		alert (alert4);
		return false;
	}
	if (form.type.type!="hidden"
		&& form.type[1].checked
		&& form.rday) {
		form.rday.value="";
		form.rmonth.value="";
		form.ryear.value="";
	}
	if (isNewCalendar)
	{	if ((yfcMiniCal.maxMonth != null)&&(yfcMiniCal.maxMonth.length != 0)) 						
			{kk_flight_dayRangeValidDate=kk_flight_caculateNumberOfDays(yfcMiniCal.maxMonth)+1;}
		else {kk_flight_dayRangeValidDate=kk_flight_caculateNumberOfDays(11)+1;}
			validDepDate=today.getTime()+24*3600*1000*kk_flight_dayRangeValidDate;
		if (validDepDate<=selectedDepTime) {
			if (typeof(alert7)=="undefined") {alert("The departure date you can choose is up to 11 months from today");}
					else{alert(alert7);}
		return false;
		}
	}
	else  //old calendar
	{	if (typeof(kk_flight_dayRangeValidDate)=="undefined") kk_flight_dayRangeValidDate=350;
			validDepDate=today.getTime()+24*3600*1000*kk_flight_dayRangeValidDate;
		if (validDepDate<=selectedDepTime) {
			alert(alert5);
			return false;
		}
	}
	
	if (form.from.value=="kelbest") {form.from.value="shopbot";}
	
	return true;
	
}


function kk_flight_setMonth() {
document.searchForm.rmonth.selectedIndex=document.searchForm.dmonth.selectedIndex  ;
if (typeof(document.searchForm.wdday)!="undefined") kk_flight_updateWeekDay();
}
   
function kk_flight_setYear() {
document.searchForm.ryear.selectedIndex=document.searchForm.dyear.selectedIndex  ;
if (typeof(document.searchForm.wdday)!="undefined") kk_flight_updateWeekDay();
}

function kk_flight_updateWeekDay() {
var dd=document.searchForm.dday.value;
var dm=document.searchForm.dmonth.value;
var dy=document.searchForm.dyear.value;
if (dy%4==0) var DMonthDays=new Array(31,29,31,30,31,30,31,31,30,31,30,31);
else var DMonthDays=new Array(31,28,31,30,31,30,31,31,30,31,30,31);
if (dd>DMonthDays[dm-1]) {
dd=DMonthDays[dm-1];
document.searchForm.dday.value=dd;
}
var rd=document.searchForm.rday.value;
var rm=document.searchForm.rmonth.value;
var ry=document.searchForm.ryear.value;
if (ry%4==0) var RMonthDays=new Array(31,29,31,30,31,30,31,31,30,31,30,31);
else var RMonthDays=new Array(31,28,31,30,31,30,31,31,30,31,30,31);
if (rd>RMonthDays[rm-1]) {
rd=RMonthDays[rm-1];
document.searchForm.rday.value=rd;
}
kk_flight_getDepWeekDay(dd,dm,dy);
kk_flight_getRetWeekDay(rd,rm,ry);
}

function kk_flight_getDepWeekDay(d,m,y) {
var daysinmonth=[31,28,31,30,31,30,31,31,30,31,30,31];
var day=document.searchForm.dday.options[document.searchForm.dday.selectedIndex].value-1;
var month=document.searchForm.dmonth.options[document.searchForm.dmonth.selectedIndex].value-1;
var year=document.searchForm.dyear.options[document.searchForm.dyear.selectedIndex].value;
if (year%4==0) daysinmonth[1]=29;
if (typeof(document.searchForm.wdday)!="undefined"){
if (daysinmonth[month]>=day) {
var testdate=new Date(y,m-1,d);
var weekday=testdate.getDay();
if (weekday==0) document.searchForm.wdday.value=Sun;
if (weekday==1) document.searchForm.wdday.value=Mon;
if (weekday==2) document.searchForm.wdday.value=Tue;
if (weekday==3) document.searchForm.wdday.value=Wed;
if (weekday==4) document.searchForm.wdday.value=Thu;
if (weekday==5) document.searchForm.wdday.value=Fri;
if (weekday==6) document.searchForm.wdday.value=Sat;
}
else {document.searchForm.wdday.value="";}
}   
}

function kk_flight_getRetWeekDay(d,m,y) {
var daysinmonth=[31,28,31,30,31,30,31,31,30,31,30,31];
var day=document.searchForm.rday.options[document.searchForm.rday.selectedIndex].value-1;
var month=document.searchForm.rmonth.options[document.searchForm.rmonth.selectedIndex].value-1;
var year=document.searchForm.ryear.options[document.searchForm.ryear.selectedIndex].value;
if (year%4==0) daysinmonth[1]=29;
if (typeof(document.searchForm.wrday)!="undefined"){
if (daysinmonth[month]>=day) {
var testdate=new Date(y,m-1,d);
var weekday=testdate.getDay();
if (weekday==0) document.searchForm.wrday.value=Sun;
if (weekday==1) document.searchForm.wrday.value=Mon;
if (weekday==2) document.searchForm.wrday.value=Tue;
if (weekday==3) document.searchForm.wrday.value=Wed;
if (weekday==4) document.searchForm.wrday.value=Thu;
if (weekday==5) document.searchForm.wrday.value=Fri;
if (weekday==6) document.searchForm.wrday.value=Sat;
}
else {document.searchForm.wdday.value="";}    
}  
}

function kk_flight_pV(airPort) {
var selectedBox=parent.opener.window.document.formulaire.selectedBox.value;
var selectedBoxText=selectedBox+"TEXT";
parent.opener.window.document.formulaire.elements[selectedBox].value=airPort;	
parent.opener.window.document.formulaire.elements[selectedBoxText].value=airPort;
closePopup();
}

function kk_flight_checkEmptyAirport() {
if (typeof(document.forms.formulaire.departure)!="undefined") {document.forms.formulaire.departureTEXT.value=document.forms.formulaire.departure.value;}
if (typeof(document.forms.formulaire.arrival)!="undefined") {document.forms.formulaire.arrivalTEXT.value=document.forms.formulaire.arrival.value;}
var departure=document.forms.formulaire.departureTEXT.value;
var arrival=document.forms.formulaire.arrivalTEXT.value;
departure=kk_flight_stringTrim(departure);
arrival=kk_flight_stringTrim(arrival);		
if (arrival.length==0||departure.length==0) {
alert(ALERT_AIRPORT_EMPTY); 
return false;
}
else {return true;}
}

function kk_flight_stringTrim(strToTrim) {
if (strToTrim!=null) {strToTrim= strToTrim.replace(/^\s+|\s+$/g, '');}
return strToTrim;
}

function  kk_flight_updateDepartureTextFromSel() {
document.forms.formulaire.departureTEXT.value=document.forms.formulaire.departure.options[document.forms.formulaire.departure.selectedIndex].value;
document.forms.formulaire.departureSelected.value=document.forms.formulaire.departure.selectedIndex;
return true;
}

function  kk_flight_updateArrivalTextFromSel() {
document.forms.formulaire.arrivalTEXT.value=document.forms.formulaire.arrival.options[document.forms.formulaire.arrival.selectedIndex].value;
document.forms.formulaire.arrivalSelected.value=document.forms.formulaire.arrival.selectedIndex;
return true;
}

function  kk_flight_updateDepartureText() {
document.forms.formulaire.departureTEXT.value=document.forms.formulaire.departure.value;
return true;
}

function  kk_flight_updateArrivalText() {
document.forms.formulaire.arrivalTEXT.value=document.forms.formulaire.arrival.value;
return true;
}

function  kk_flight_majDate() {
if (document.searchForm.dday.value=="1"&&document.searchForm.dmonth.value=="1"&&document.searchForm.rday.value=="1"&&document.searchForm.rmonth.value=="1") {
var now=new Date();
var tmp=now.getTime()+(86400000*7);
now.setTime(tmp);
var month=now.getMonth()+1;
var year=now.getFullYear();
var day=now.getDate();    
document.searchForm.dday.options[day-1].selected=true;
document.searchForm.dmonth.options[month-1].selected=true;
document.searchForm.dyear.options[year-this_year].selected=true;
var now2=new Date();
tmp=now2.getTime()+(86400000*14);
now2.setTime(tmp);
month=now2.getMonth()+1;
year=now2.getFullYear();
day=now2.getDate();
document.searchForm.rday.options[day-1].selected=true;
document.searchForm.rmonth.options[month-1].selected=true;
document.searchForm.ryear.options[year-this_year].selected=true;
}
}

/* KK js for car form ... */
Locations=new Array();
Towns=new Array();
newLetter="";
function kk_carHire_add_CityObj(region,iata_code,city,product) {
  this.REGION=region;
  this.IATA_CODE=iata_code;
  this.CITY=city;
  this.PRODUCT=product; 
}
function kk_carHire_add_TownObj(town,type) {
  this.town=town;
  this.type=type;
}
function kk_carHire_initLocation(){
  Locations=new Array();
}
function kk_carHire_initTown() {
  Towns=new Array();
}
function kk_carHire_add_and_set(region, iata_code, city,  product) {
  Locations[Locations.length]=new kk_carHire_add_CityObj(region,iata_code,city,product);
}
function kk_carHire_optionObj(thevalue,theText) {
  this.value=thevalue;this.text=theText;
}
function kk_carHire_addTown(town,air) {
  Towns[Towns.length]=new kk_carHire_add_TownObj(town,air);
}
function kk_carHire_replaceIn(theString,toReplace,replaceBy) {
  cL=new String(theString);
  lg=toReplace.length;
  i=cL.indexOf(toReplace);
  while ( i >0) {
    cL=cL.substring(0,i)+replaceBy+cL.substring(i+lg,cL.length);i=cL.indexOf(toReplace);
  }
  return(cL);
}
function kk_carHire_getParam(theUrl,theParam) {
  i=theUrl.indexOf("&"+theParam+"=");
  j=theUrl.indexOf("&",i+3);
  return( theUrl.substring(i+9, j)); 
}
function kk_carHire_setDropDowns(theField) {
if (theField.name=="pickUpCountry") { 
  theCountry=theField.options[theField.selectedIndex].value;
  theCountryUrl=kk_carHire_replaceIn(theCountry," ","-");
  window.document.getElementById("townList").src="/content/"+countryDir+"/travel/carHire/"+theCountryUrl+"/townList_"+theCountryUrl+"R6.html";
  newLetter="";
  citySelected="";
  kk_carHire_setDropDowns(parent.document.getElementById("pickUpTown"));
} else if (theField.name=="pickUpTown" ) { 
  if (theField.form.pickUpTown.options[theField.form.pickUpTown.selectedIndex].value!=""){
    citySelected=theField.form.pickUpTown.options[theField.form.pickUpTown.selectedIndex].value;
  }
  theCountry=theField.form.pickUpCountry.options[theField.form.pickUpCountry.selectedIndex].value;
  oldLetter= newLetter;
  newLetter= citySelected.charAt(0);
  if (newLetter.length>0&&newLetter!=oldLetter) { 
    theField.form.classCity.value=newLetter;
    theCountryUrl=kk_carHire_replaceIn(theCountry," ","-");
    newLetter=escape(newLetter);
    theCountryUrl=escape(theCountryUrl);
    window.document.getElementById("locationList").src="/content/"+countryDir+"/travel/carHire/"+theCountryUrl+"/locationList_"+theCountryUrl+"_"+newLetter+"R6.html";
  } else if (newLetter.length<1) {
    optionList=new Array();
    kk_carHire_reWriteDropDown(document.getElementById("pickUpAdress"),optionList,selectLocation);
  } else {
    optionList=kk_carHire_getLocOptObjsAdress(document.getElementById("pickUpAdress").form);
    kk_carHire_reWriteDropDown(document.getElementById("pickUpAdress"),optionList,selectLocation);
    kk_carHire_setLastValue(parent.document.getElementById("pickUpAdress"), "");
    kk_carHire_setDropDowns(parent.document.getElementById("pickUpAdress"));
  }
} else if (theField.name=="pickUpAdress") {
  if (theField.form.pickUpTown.selectedIndex==0){
    optionList=new Array();
    kk_carHire_reWriteDropDown(document.getElementById("pickUpAdress"),optionList,selectLocation);
    kk_carHire_setLastValue(parent.document.getElementById("pickUpAdress"), "");
  }
  citySplit=theField.form.pickUpAdress.value.split("#");
  theField.form.pickUpAirportCode.value=citySplit[0];
  }
}
function kk_carHire_getEmptyList() {
  itemList=new Array();
  itemList[itemList.length]=new kk_carHire_optionObj("","");
  return itemList;
}
function kk_carHire_getLocOptObjsTown(theForm) {
  if (theForm.airportSel[0].checked){
    airport="A";
  } else {
    airport="C";
  }
  itemList=new Array();
  for(i=0;i<Towns.length;i++) {
    if ((Towns[i].type).indexOf(airport)>=0) {
      itemList[itemList.length]=new kk_carHire_optionObj(Towns[i].town,Towns[i].town);
    }
  }
  return itemList;
}
function kk_carHire_getLocOptObjsAdress(theForm) {
  if (theForm.airportSel[0].checked){
    airport="A";
  } else {
    airport="C";
  }
  itemList=new Array();
  for(i=0;i<Locations.length;i++) {
    if ((Locations[i].PRODUCT==airport||theForm.pickUpTown.value.length<1) &&(Locations[i].REGION==theForm.pickUpTown.value||theForm.pickUpTown.value.length<1)) {
      itemList[itemList.length]=new kk_carHire_optionObj((Locations[i].IATA_CODE+"#"+Locations[i].CITY),Locations[i].CITY); 
    }
  }
  return itemList;
}
function kk_carHire_reWriteDropDown(theField,optionList,defaultText) {
  theField.length=0;
  theField[0]=new Option(defaultText,"");
  OptionIndex=1;
  for(i=0;i<optionList.length;i++) {
    theField[OptionIndex]=new Option(optionList[i].text,optionList[i].value);
    OptionIndex++;
  }
  if (theField.selectedIndex<0) {theField.options[0].selected=true;}
  if (theField.length==2&&theField.options[0].value.length<1) {theField.options[1].selected=true;}
}
function kk_carHire_defaultLocations(theForm) {
  theForm.pickUpCountry.selectedIndex=0;
  kk_carHire_setDropDowns(theForm.pickUpCountry);
  theForm.pickUpTown.selectedIndex=0;
  kk_carHire_setDropDowns(theForm.pickUpTown);
  theForm.pickUpAdress.selectedIndex=0;
  kk_carHire_setDropDowns(theForm.pickUpAdress);
}
function kk_carHire_setLastValue(theField,theValue) {
  if (theField.length==2&&theField.options[0].value.length<1) {
    theField.options[1].selected=true;
  } else {
    var hasBeenSet=false;
    for(i=0;i<theField.length;i++) {
      if (theField.options[i].value==theValue) {
        theField.selectedIndex=i;
        hasBeenSet=true;
        break;
      }
    }
    if (!hasBeenSet){
      theField.options[0].selected=true;
    }
  }
}
function kk_carHireToTripPlanner(){

        if ( !document.searchForm.allSubCatId[0].checked )
                {

                for (i=1; i < 3; i++) {
                        if (document.searchForm.allSubCatId[i].checked) {
                                var allSubCatId = document.searchForm.allSubCatId[i].value;
                                }
                }
                var url = "/b/a/c_100371323_trip_planner.html";
	        var departureDate = document.searchForm.departureDate.value;
                var returnDate = document.searchForm.returnDate.value;
		var timeDeparture = document.searchForm.timeDeparture.value;
                var minuteDeparture = document.searchForm.minuteDeparture.value;
                var timeReturn = document.searchForm.timeReturn.value;
                var minuteReturn = document.searchForm.minuteReturn.value;
                var carType = document.searchForm.carType.value;

                url = url + '?allSubCatId=' + allSubCatId + '&departureDate=' + departureDate + '&returnDate=' + returnDate + '&pickupHour=' + timeDeparture +'&pickupMinute=' + minuteDeparture + '&dropoffHour=' + timeReturn + '&dropoffMinute=' + minuteReturn + '&carType=' + carType;
                document.location.href = url;
                }
}

function kk_carHire_IsFourDigitsYear(year){
 return (year.search(/\d{4}/) != -1);
}

function kk_carHire_ConvertToFourDigitsYear(year){
var yearToConvert = "20" + year;
return yearToConvert;
}

function kk_carHire_isNewCalendar(){
return (document.getElementById("yfcMiniCalDiv")!=null);
}

var dtCh= "/";
function kk_carHire_IsInterger(s){
        var i;
    for (i = 0; i < s.length; i++){
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}

function kk_carHire_stripCharsInBag(s, bag){
        var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++){
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}

function kk_carHire_daysInFebruary(year){
        // February has 29 days in any year evenly divisible by four,
    // EXCEPT for centurial years which are not also divisible by 400.
    return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
}

function kk_carHire_DaysArray(n) {
        for (var i = 1; i <= n; i++) {
                this[i] = 31;
                if (i==4 || i==6 || i==9 || i==11) {this[i] = 30;}
                if (i==2) {this[i] = 29;}
   }
   return this;
}

function kk_carHire_isDate(dtStr){

  //var daysInMonth=[0,31,29,31,30,31,30,31,31,30,31,30,31];
        var daysInMonth = kk_carHire_DaysArray(12);
        var pos1=dtStr.indexOf(dtCh);
        var pos2=dtStr.indexOf(dtCh,pos1+1);
        var strDay=dtStr.substring(0,pos1);
        var strMonth=dtStr.substring(pos1+1,pos2);
        var strYear=dtStr.substring(pos2+1);
        strYr=strYear;
        if (strDay.charAt(0)=="0" && strDay.length>1) {strDay=strDay.substring(1);}
        if (strMonth.charAt(0)=="0" && strMonth.length>1) {strMonth=strMonth.substring(1);}
        for (var i = 1; i <= 3; i++) {
                if (strYr.charAt(0)=="0" && strYr.length>1) {strYr=strYr.substring(1);}
        }
        month=parseInt(strMonth);
        day=parseInt(strDay);
        year=parseInt(strYr);
        if (pos1==-1 || pos2==-1){
                alert(alert1 + "(dd/mm/yyyy)");
                return false;
        }
        if (strMonth.length<1 || month<1 || month>12){
                alert(alert1);
                return false;
        }
        if (strDay.length<1 || day<1 || day>31 || (month==2 && day>kk_carHire_daysInFebruary(year)) || day > daysInMonth[month]){
                alert(alert1);
                return false;
        }
        if ((strYear.length != 4 && strYear.length != 2) || year==0 ){
                alert(alert1);
                return false;
        }
        if (dtStr.indexOf(dtCh,pos2+1)!=-1 || kk_carHire_IsInterger(kk_carHire_stripCharsInBag(dtStr, dtCh))==false){
                alert(alert1);
                return false;
        }
return true;
}

function kk_carHire_openDepartureDateCalendar() {
if (cal==null) {
cal=new kk_CalendarPopup();
cal.setReturnFunction("kk_carHire_setDepDate");
cal.setMonthNames(month1,month2,month3,month4,month5,month6,month7,month8,month9,month10,month11,month12);
cal.setDayHeaders(day1,day2,day3,day4,day5,day6,day7);
cal.setWeekStartDay(1);
cal.setTodayLabel(todayLabel);
}
month=document.searchForm.monthDeparture.options[document.searchForm.monthDeparture.selectedIndex].value;
year=document.searchForm.yearDeparture.options[document.searchForm.yearDeparture.selectedIndex].value;
cal.showCalendar('depdate',month,year); 
return false;
}

function kk_carHire_openReturnDateCalendar() {
if (cal2==null) {
cal2=new kk_CalendarPopup();
cal2.setReturnFunction("kk_carHire_setRetDate");
cal2.setMonthNames(month1,month2,month3,month4,month5,month6,month7,month8,month9,month10,month11,month12);
cal2.setDayHeaders(day1,day2,day3,day4,day5,day6,day7);
cal2.setWeekStartDay(1);
cal2.setTodayLabel(todayLabel); 
}
month=document.searchForm.monthReturn.options[document.searchForm.monthReturn.selectedIndex].value;
year=document.searchForm.yearReturn.options[document.searchForm.yearReturn.selectedIndex].value;
cal2.showCalendar('retdate',month,year);
return false;
}

function kk_carHire_ctrlForm(form) {
if (form.carTypeFormatted!=null) {
var carTypeName2=form.carType.options[form.carType.selectedIndex].text;
form.carTypeFormatted.value=carTypeName2;
}
var now=new Date();
var month=now.getMonth()+1;
var year=now.getFullYear();
var day=now.getDate();

var isNewCalendar = kk_carHire_isNewCalendar();

if (isNewCalendar)
{
  var departureDate=form.departureDate.value;
  var returnDate=form.returnDate.value;
  if (!kk_carHire_isDate(departureDate) || !kk_carHire_isDate(returnDate)) {return false;}
  var splitDepDate=departureDate.split("/");
  var splitRetDate=returnDate.split("/");
  selectedDepDay=splitDepDate[0];
  selectedDepMonth=splitDepDate[1];
  selectedDepYear=splitDepDate[2];
  selectedRetDay=splitRetDate[0];
  selectedRetMonth=splitRetDate[1];
  selectedRetYear=splitRetDate[2];

  if (!kk_carHire_IsFourDigitsYear(selectedDepYear)) {
        selectedDepYear=kk_carHire_ConvertToFourDigitsYear(selectedDepYear);
  }
  if (!kk_carHire_IsFourDigitsYear(selectedRetYear)) {
        selectedRetYear=kk_carHire_ConvertToFourDigitsYear(selectedRetYear);
  }
}
else
{
selectedDepDay=form.dayDeparture.options[form.dayDeparture.selectedIndex].value;
selectedDepMonth=form.monthDeparture.options[form.monthDeparture.selectedIndex].value;
selectedDepYear=form.yearDeparture.options[form.yearDeparture.selectedIndex].value;
selectedRetDay=form.dayReturn.options[form.dayReturn.selectedIndex].value;
selectedRetMonth=form.monthReturn.options[form.monthReturn.selectedIndex].value;
selectedRetYear=form.yearReturn.options[form.yearReturn.selectedIndex].value;
}
selectedDepDate=new Date(selectedDepYear,selectedDepMonth -1,selectedDepDay);
selectedRetDate=new Date(selectedRetYear,selectedRetMonth -1,selectedRetDay);

today=new Date();
tableJJ=[31,29,31,30,31,30,31,31,30,31,30,31];
if (selectedDepDay>tableJJ[selectedDepMonth-1]||selectedRetDay>tableJJ[selectedRetMonth-1]) {
alert(alert1);
return false;
}
selectedDepTime=selectedDepDate.getTime()+24*3600*1000;	
selectedRetTime=selectedRetDate.getTime()+24*3600*1000;
if ((today.getTime()>selectedDepTime)|| (today.getTime()>selectedRetTime)) {
alert(alert2);
return false;
}
if (selectedRetTime<selectedDepTime) {
alert(alert3);
return false;
}
if (typeof(kk_carHire_dayRangeValidDate)=="undefined") kk_carHire_dayRangeValidDate=730;
validDepDate=today.getTime()+24*3600*1000*kk_carHire_dayRangeValidDate;
if (validDepDate<=selectedDepTime) {
alert(alert4);
return false;
}
var testLocation="|"+document.searchForm.pickUpCountry.options[document.searchForm.pickUpCountry.selectedIndex].value+"|"+document.searchForm.pickUpTown.options[document.searchForm.pickUpTown.selectedIndex].value+"|"+document.searchForm.pickUpAdress.options[document.searchForm.pickUpAdress.selectedIndex].value+"|";
if ((testLocation.indexOf("------")>=0)||(testLocation.indexOf("Select")>=0)||(testLocation.indexOf("||") >=0)) {
alert(YAHOO.EU.Shopping.locale.TravelNoDestination);
return(false);
}
return true;
}

function kk_carHire_currentYear() {
var now=new Date(); 
var year=now.getYear(); 
if(year<999) year+=1900;
return year;
}

function kk_carHire_setDepDate(y,m,d) {
var year=kk_carHire_currentYear();
document.searchForm.dayDeparture.selectedIndex=d-1;
document.searchForm.monthDeparture.selectedIndex=m-1;
if (y==year) document.searchForm.yearDeparture.selectedIndex=0;
if (y==year+1) document.searchForm.yearDeparture.selectedIndex=1;
kk_carHire_setMonth();
kk_carHire_setYear();
if (typeof(document.searchForm.wdday)!="undefined") kk_carHire_getDepWeekDay(d,m,y);
}

function kk_carHire_setRetDate(y,m,d) {	
var year=kk_carHire_currentYear();
document.searchForm.dayReturn.selectedIndex=d-1;
document.searchForm.monthReturn.selectedIndex=m-1;
if (y==year) document.searchForm.yearReturn.selectedIndex=0;
if (y==year+1) document.searchForm.yearReturn.selectedIndex=1;
if (typeof(document.searchForm.wrday)!="undefined") kk_carHire_getRetWeekDay(d,m,y);
}

function kk_carHire_setMonth() {
document.searchForm.monthReturn.selectedIndex=document.searchForm.monthDeparture.selectedIndex;
if (typeof(document.searchForm.wrday)!="undefined") kk_carHire_updateWeekDay();
}
                   
function kk_carHire_setYear() {
document.searchForm.yearReturn.selectedIndex=document.searchForm.yearDeparture.selectedIndex;
if (typeof(document.searchForm.wrday)!="undefined") kk_carHire_updateWeekDay();
}

function kk_carHire_updateWeekDay() {
var dd=document.searchForm.dayDeparture.value;
var dm=document.searchForm.monthDeparture.value;
var dy=document.searchForm.yearDeparture.value;
if (dy%4==0) var DMonthDays=new Array(31,29,31,30,31,30,31,31,30,31,30,31);
else var DMonthDays=new Array(31,28,31,30,31,30,31,31,30,31,30,31);
if (dd>DMonthDays[dm-1]) {
dd=DMonthDays[dm-1];
document.searchForm.dayDeparture.value=dd;
}
var rd=document.searchForm.dayReturn.value;
var rm=document.searchForm.monthReturn.value;
var ry=document.searchForm.yearReturn.value;
if (ry%4==0) var RMonthDays=new Array(31,29,31,30,31,30,31,31,30,31,30,31);
else var RMonthDays=new Array(31,28,31,30,31,30,31,31,30,31,30,31);
if (rd>RMonthDays[rm-1]) {
rd=RMonthDays[rm-1];
document.searchForm.dayReturn.value=rd;
}
kk_carHire_getDepWeekDay(dd,dm,dy);
kk_carHire_getRetWeekDay(rd,rm,ry);
}

function kk_carHire_getDepWeekDay(d,m,y) {
if (typeof(document.searchForm.wdday)!="undefined") {
var testdate=new Date(y,m-1,d);
var weekday = testdate.getDay();
if (weekday==0) document.searchForm.wdday.value=Sun;
if (weekday==1) document.searchForm.wdday.value=Mon;
if (weekday==2) document.searchForm.wdday.value=Tue;
if (weekday==3) document.searchForm.wdday.value=Wed;
if (weekday==4) document.searchForm.wdday.value=Thu;
if (weekday==5) document.searchForm.wdday.value=Fri;
if (weekday==6) document.searchForm.wdday.value=Sat;
}
}

function kk_carHire_getRetWeekDay(d,m,y) {
if (typeof(document.searchForm.wrday)!="undefined") {
var testdate=new Date(y,m-1,d);
var weekday = testdate.getDay();
if (weekday==0) document.searchForm.wrday.value=Sun;
if (weekday==1) document.searchForm.wrday.value=Mon;
if (weekday==2) document.searchForm.wrday.value=Tue;
if (weekday==3) document.searchForm.wrday.value=Wed;
if (weekday==4) document.searchForm.wrday.value=Thu;
if (weekday==5) document.searchForm.wrday.value=Fri;
if (weekday==6) document.searchForm.wrday.value=Sat;
}     
}

function kk_carHire_majDate() {
if (document.searchForm.dayDeparture.value =="1"&&document.searchForm.dayReturn.value=="1"&&document.searchForm.monthDeparture.value=="1"&&document.searchForm.monthReturn.value=="1") {
var now=new Date();
var tmp=now.getTime()+(86400000*7);
now.setTime(tmp);
var month=now.getMonth()+1;
var year=now.getFullYear();
var day=now.getDate();
document.searchForm.dayDeparture.options[day-1].selected=true;
document.searchForm.monthDeparture.options[month-1].selected=true;
document.searchForm.yearDeparture.options[year-this_year].selected=true;
var now2=new Date();
tmp=now2.getTime()+(86400000*10);
now2.setTime(tmp);
month=now2.getMonth()+1;
year=now2.getFullYear();
day=now2.getDate();
document.searchForm.dayReturn.options[day-1].selected=true;
document.searchForm.monthReturn.options[month-1].selected=true;
document.searchForm.yearReturn.options[year-this_year].selected=true;
}
}

//**** functions needed for compatibility
function add_CityObj(region,iata_code,city,product) {kk_carHire_add_CityObj(region,iata_code,city,product);}
function add_TownObj(town,type) {kk_carHire_add_TownObj(town,type);}
function initLocation(){kk_carHire_initLocation();}
function initTown(){kk_carHire_initTown();}
function add_and_set(region,iata_code,city,product) {kk_carHire_add_and_set(region,iata_code,city,product);}
function optionObj(thevalue,theText) {kk_carHire_optionObj(thevalue,theText);}
function addTown(town,air){kk_carHire_addTown(town,air);}
function getLocOptObjsTown(theForm) {return kk_carHire_getLocOptObjsTown(theForm);}
function getLocOptObjsAdress(theForm) {return kk_carHire_getLocOptObjsAdress(theForm);}
function reWriteDropDown(theField,optionList,defaultText) {kk_carHire_reWriteDropDown(theField,optionList,defaultText);}
function setLastValue(theField,theValue) {kk_carHire_setLastValue(theField,theValue);}
function setDropDowns(theField) {kk_carHire_setDropDowns(theField);}

// Script to update the shopbot search form

// p: possible input of search form
// v: value
function kk_updateSearchForm(p, v) {
  v=unescape(v);
  if(p)
  {
    if (p.type == 'text' || p.type == 'hidden')
    {
      p.value = kk_decodeParams(v);
    }
    else
      if (p.type == 'select-one')
      {
        for( i = 0; i < p.length; i++)
        {
          if (p.options[i].value == v)
            p.selectedIndex = i;
        }
      }
      else if (p.type == 'checkbox')
      {
        p.checked = true;
      }
      else if (p[0])
      {
        for( i = 0; i < p.length; i++ )
        {
          if (p[i].value == v)
            p[i].checked=true;
        }
      }
  }
}

function kk_decodeParams(v) {
  var q = v;
  while (q.indexOf("&#39;") > -1) q = q.replace("&#39;", "'");
  while (q.indexOf("&quot;") > -1) q = q.replace("&quot;", "\"");
  while (q.indexOf("&#34;") > -1) q = q.replace("&#34;", "\"");
  while (q.indexOf("&amp;") > -1) q = q.replace("&amp;", "&");
  return q;
}


// yfc_mini_cal

function yfcMiniCalPrevMonth() {
	if (this.currField == undefined) return;
	if (this.currMonth > 0)
		this.currMonth--;
	if (this.currMonth == 0)
		document.getElementById('yfcMiniCalPrevMonthDiv').style.visibility = 'hidden';
	document.getElementById('yfcMiniCalNextMonthDiv').style.visibility = 'visible';
	if (this.disableSelectbox) {
		document.getElementById('yfcMiniCalThisMonthTitle').innerHTML = this.months[this.currMonth].dropDownLabel;
	}
	else {
		document.getElementById('yfcMiniCalMonthSelect').selectedIndex = this.currMonth;
	}
	this.showMonth();  
}

function yfcMiniCalNextMonth() {
	if (this.currField == undefined) return;
	if (this.currMonth < this.maxMonth)
		this.currMonth++;
	if (this.currMonth == this.maxMonth-1)
		document.getElementById('yfcMiniCalNextMonthDiv').style.visibility = 'hidden';
	document.getElementById('yfcMiniCalPrevMonthDiv').style.visibility = 'visible';
	if (this.disableSelectbox) {
		document.getElementById('yfcMiniCalThisMonthTitle').innerHTML = this.months[this.currMonth].dropDownLabel;
	}
	else {
		document.getElementById('yfcMiniCalMonthSelect').selectedIndex = this.currMonth;
	}
	this.showMonth();
}

function yfcMiniCalCloseCal() {
	var cal = document.getElementById('yfcMiniCalDiv');
	var iframed = document.getElementById('yfcMiniCalIFrame');
	var iframe = document.getElementById('yfcMiniCalIFrameIn');
	if (!cal || !iframe || !iframed) return;
	cal.style.visibility = 'hidden';
	iframed.style.height = "0px";
	iframed.style.width = "0px";
	iframe.style.height = "0px";
	iframe.style.width = "0px";
	iframed.style.visibility = 'hidden';
	document.getElementById('yfcMiniCalNextMonthDiv').style.visibility = 'hidden';
	document.getElementById('yfcMiniCalPrevMonthDiv').style.visibility = 'hidden';
	this.displayed[this.currField] = 0;
	this.currField = undefined;
    if (this.closeCalHandler != undefined) {
        this.closeCalHandler();
    }
	delete(cal);
}

function yfcMiniCalOpenCal(fldDiv,fld,startFld, xOffset, yOffset) {
    if (!xOffset) {xOffset = 0;};
    if (!yOffset) {yOffset = 24;}; 

	var fldDiv = document.getElementById(fldDiv);
	var parentForm = YAHOO.util.Dom.getAncestorByTagName(fldDiv,'form');
	var cal = document.getElementById('yfcMiniCalDiv');
	var iframeDiv = document.getElementById('yfcMiniCalIFrame');
	var iframe = document.getElementById('yfcMiniCalIFrameIn');
	var field = this.fields[fld];
	var calWidth = 390;
	
    console.log(field);
	if (!fldDiv) return;
	if (!cal) return;
	if (!iframeDiv || !iframe) return;
	if (!field) return;
	
	var maxWidth = parentForm? parentForm.offsetWidth : 662;
	var parentLeft = parentForm? getAbsoluteLeft(parentForm) : 0;
	var absoluteLeft = getAbsoluteLeft(fldDiv);
	var absoluteTop  = getAbsoluteTop (fldDiv);
	var computedRight = absoluteLeft + xOffset + calWidth;
	var computedLeft = (computedRight >maxWidth+parentLeft)? (parentLeft + maxWidth - calWidth) : (absoluteLeft + xOffset);
	var left = fldDiv? computedLeft + 'px' : 0;
	var top  = fldDiv? absoluteTop + yOffset + 'px' : 0;

	cal.style.top  = top;
	cal.style.left = left;
	iframeDiv.style.top = top;
	iframeDiv.style.left = left;
	iframeDiv.style.height = "197px";
	iframeDiv.style.width = calWidth + "px";
	iframe.style.height = "197px";
	iframe.style.width = calWidth+"px";
	
	cal.style.visibility = 'visible';
	if (navigator.userAgent.indexOf('Opera') == -1) {
		iframeDiv.style.visibility = 'visible';
	}
	
	this.displayed[this.currField] = 0;
	this.currField = fld;
	this.displayed[fld] = 1;
	this.startField = startFld;
	this.showMonth(true);

	if (typeof(horizontalResizeManager)!='undefined') {
		horizontalResizeManager.attach(iframeDiv,fldDiv);
		horizontalResizeManager.attach(cal,fldDiv);
	}
	delete(cal);
}

function getAbsoluteLeft (e) {
	var p = 0;
  while (e.offsetParent) {
 	  p += e.offsetLeft;
    e = e.offsetParent;
  }
  return p;
}

function getAbsoluteTop (e) {
  var p = 0;
  while (e.offsetParent) {
 	  p += e.offsetTop;
    e = e.offsetParent;
  }
  return p;
}

function yfcMiniCalUpdateArrows() {
	var pm = document.getElementById('yfcMiniCalPrevMonthDiv');
	var nm = document.getElementById('yfcMiniCalNextMonthDiv');
	if (this.currMonth == this.maxMonth-1) {
  		nm.style.visibility = 'hidden';
		pm.style.visibility = 'visible';
	}
	else if (this.currMonth == 0) {
  		nm.style.visibility = 'visible';
		pm.style.visibility = 'hidden';
	}
	else {
  		nm.style.visibility = 'visible';
		pm.style.visibility = 'visible';
	}
	delete pm;
	delete nm;
}

function yfcMiniCalShowMonth(jumpToMonth) {
	var formNames = this.currField.split(this.formFieldSeparator);
	var currFieldDate = document.forms[formNames[0]][formNames[1]].value;
	var currFieldDateParse = currFieldDate.split('/');
	if (this.dayMonthDate) {
		var selDay = currFieldDateParse[0];
		var selMon = currFieldDateParse[1];
	} else {
		var selMon = currFieldDateParse[0];
		var selDay = currFieldDateParse[1];
	}
	var selMonForCheck = (selMon && selMon.indexOf("0")==0) ? selMon.substring(1) : selMon;
	var selDayForCheck = (selDay && selDay.indexOf("0")==0) ? selDay.substring(1) : selDay;
	var selYear = currFieldDateParse[2];
	if (!parseInt(selMonForCheck) || !parseInt(selDayForCheck) || !parseInt(selYear)) {
		var todayDate = new Date();
		selMon = todayDate.getMonth();
		if (selMon<10) selMon = "0" + selMon;
		selDay = todayDate.getDate();
		if (selDay<10) selDay = "0" + selDay;
		selYear = todayDate.getFullYear() % 100;
		if (selYear<10) selYear = "0" + selYear;
	}
	var startFieldDate = null;
	var startMon = null;
	var startDay = null;
	var startYear = null;
	if (this.startField) {
		formNames = this.startField.split(this.formFieldSeparator);
		startFieldDate = document.forms[formNames[0]][formNames[1]].value;
		currFieldDateParse = startFieldDate.split('/');
		if (this.dayMonthDate) {
			startDay = currFieldDateParse[0];
			startMon = currFieldDateParse[1];
		} else {
			startMon = currFieldDateParse[0];
			startDay = currFieldDateParse[1];
		}
		startYear = currFieldDateParse[2];
	}
	var nextMonth = this.currMonth + 1;
	if (jumpToMonth) {
		if (selMon.length == 1) selMon = '0' + selMon;
		for (var m = 0; m < this.maxMonth; m++) {
			if (this.months[m].mon != selMon || this.months[m].yr != selYear) continue;
			if (this.disableSelectbox) {
				this.currMonth = m;
				document.getElementById('yfcMiniCalThisMonthTitle').innerHTML = this.months[this.currMonth].dropDownLabel;
			}
			else {
				this.currMonth = ((startMon == selMon || startMon == null) ? m : m-1);
                if(this.currMonth < 0) { this.currMonth = 0; }
				document.getElementById('yfcMiniCalMonthSelect').selectedIndex = this.currMonth;
			}
			nextMonth = this.currMonth+1;
			break;
		}
	}
	nextMonthTitleDiv = document.getElementById('yfcMiniCalNextMonthTitle');
	nextMonthTitleDiv.innerHTML = this.months[nextMonth].dropDownLabel;
	var sdow = this.months[this.currMonth].startDOW;
	var lday = this.months[this.currMonth].lastDay;
	var mon = this.months[this.currMonth].mon;
	var yr = this.months[this.currMonth].yr;
	var today = (this.currMonth == 0)? this.today:0;

	var isSelMonth = (this.months[this.currMonth].mon == selMon);
	var isStartMon = (this.months[this.currMonth].mon == startMon);
	var isSelYear = (this.months[this.currMonth].yr == selYear);
	var isStartYear = (this.months[this.currMonth].yr == startYear);
	var href = '<a href="javascript:void(0);" onClick="yfcMiniCal.updateField(\''+this.currField+'\',\''+mon+'\',\'';
	var md = 1;
	var nextMd = 1;
	for (i = 0; i < 42; i++) {
		dayDiv = document.getElementById('yfcMiniCalDayDiv'+Number(i));
		dayDiv.className = 'yfcMiniCalDay' + 
						( (md >= today || this.disableSelectbox) ? 
							( (md > lday) ? 
								'Next' 
								: ( ((md == startDay) && isStartMon && isStartYear) ?
                                                                        'Start'
									: ( ((md == selDay) && isSelMonth && isSelYear) ? 
										'Sel' 
										: ''
									) 
								)
							)
							: (this.disableSelectbox ? '' : 'Past')
						);
		if (i < sdow || md > lday) {
			dayDiv.innerHTML = '&nbsp;';
		}
		else {
			dayDiv.innerHTML = (md < today && !this.disableSelectbox)? md : href+((md > 9)? md :'0'+md)+'\',\''+yr+'\'); return false;">'+md+'</a>';
			md++;
		}
	}

	sdow = this.months[nextMonth].startDOW;
	lday = this.months[nextMonth].lastDay;
	mon = this.months[nextMonth].mon;
	yr = this.months[nextMonth].yr;
	today = 0;

	isSelMonth = (this.months[nextMonth].mon == selMon);
	isStartMon = (this.months[nextMonth].mon == startMon);
	isSelYear = (this.months[nextMonth].yr == selYear);
	isStartYear = (this.months[nextMonth].yr == startYear);
	href = '<a href="javascript:void(0);" onClick="yfcMiniCal.updateField(\''+this.currField+'\',\''+mon+'\',\'';
	md = 1;
	nextMd = 1;
	for (i = 0; i < 42; i++) {
		dayDiv = document.getElementById('yfcMiniCalDayDivNext'+Number(i));
		dayDiv.className = 'yfcMiniCalDay' +
			( (md >= today || this.disableSelectbox) ?
				( (md > lday) ?
					'Next'
					: ( ((md == startDay) && isStartMon && isStartYear) ?
						'Start'
						: ( ((md == selDay) && isSelMonth && isSelYear) ?
							'Sel'
							: ''
						)
					)
				)
				: (this.disableSelectbox ? '' : 'Past')
			);
		if (i < sdow || md > lday) {
			dayDiv.innerHTML = '&nbsp;';
		}
		else {
			dayDiv.innerHTML = (md < today && !this.disableSelectbox)? md : href+((md > 9)? md :'0'+md)+'\',\''+yr+'\'); return false;">'+
				md+'</a>';
			md++;
		}
	}

	this.updateArrows();
	delete(dayDiv);
}

function yfcMiniCalInitCalendar() {
	var wkDiv = document.getElementById('yfcMiniCalWeekdays');
	var wkDivNext = document.getElementById('yfcMiniCalWeekdaysNext');
	if (!wkDiv || !wkDivNext) return;
  	var day = 0;
	var newDay;
	
	while (day < 42) {
		newDay = document.createElement('div');
		newDay.id = 'yfcMiniCalDayDiv'+Number(day);
		newDay.className = 'yfcMiniCalDay';
		wkDiv.appendChild(newDay);
                newDay = document.createElement('div');
                newDay.id = 'yfcMiniCalDayDivNext'+Number(day);
                newDay.className = 'yfcMiniCalDay';
                wkDivNext.appendChild(newDay);
		day++;
	}
	
	newClr = document.createElement('br');
	newClr.className = 'ygcl';
	wkDiv.appendChild(newClr);
}

function yfcMiniCalField(formName,fldName,depFldName,depInc) {
	this.formName = formName;
	this.fldName = fldName;
	this.depFldName = depFldName;
	this.depInc = (depInc == undefined)? 3 : depInc;
	this.depSet = false;
}

function yfcMiniCalAddField(formName,fldName,depFldName,depInc) {
	this.fields[formName+this.formFieldSeparator+fldName] = new yfcMiniCalField(formName,fldName,depFldName,depInc);
}

function yfcMiniCalUpdateField(fld,m,d,y) {
	if (!this.fields[fld]) return;
	var formName = this.fields[fld].formName;
	var fldName = this.fields[fld].fldName;
	if (this.dayMonthDate) {
		document.forms[formName][fldName].value = d+'/'+m+'/'+y;
	} else {
		document.forms[formName][fldName].value = m+'/'+d+'/'+y;
	}
	if (document.forms[formName][fldName].onchange)
		document.forms[formName][fldName].onchange();
	var depFldName = this.fields[fld].depFldName;
	if (!depFldName || this.fields[fld].depSet) {
		this.closeCal();
		document.forms[formName][fldName].focus();
		return;
	}
	var depDate = new Date(Number(y),m - 1,d);
	var tmp = document.forms[formName][depFldName].value;
	var slash = tmp.indexOf('/');
	var lastSlash = tmp.lastIndexOf('/');
	var ry = (Number(tmp.substring(lastSlash+1)) % 100); // this way we support both 4 and 2 digits year format
	if (this.dayMonthDate) {
		var rd = tmp.substring(0,slash);
		var rm = tmp.substring(slash+1,lastSlash);
	} else {
		var rm = tmp.substring(0,slash);
		var rd = tmp.substring(slash+1,lastSlash);
	}
	var retDate = new Date(ry,rm-1,rd);
	var validDate = false;
	if (ry>=0 && parseInt(ry)>=0 && rm>=0 && parseInt(rm)>=0 && rd>=0 && parseInt(rd)>=0) validDate = true;
	if (!validDate || retDate<=depDate) {
		depDate.setDate(depDate.getDate()+this.fields[fld].depInc);
		m = depDate.getMonth() + 1;
		if (m < 10) m = '0'+m;
		d = depDate.getDate();
		if (d < 10) d = '0'+d;
		y = depDate.getFullYear().toString();
		//y = y.substr(2,2);
		if (this.dayMonthDate) {
			document.forms[formName][depFldName].value = d+'/'+m+'/'+y;
		} else {
			document.forms[formName][depFldName].value = m+'/'+d+'/'+y;
		}
	}
	document.forms[formName][fldName].focus();
	this.closeCal();
}

function yfcMiniCalMonth(mon,yr,startDOW,lastDay,dropDownLabel) {
	this.mon = mon;
	this.yr = yr;
	this.startDOW = startDOW;
	this.lastDay = lastDay;
	this.dropDownLabel = dropDownLabel;
}

function yfcMiniCalAddMonth(mon,yr,startDOW,lastDay,dropDownLabel) {
	this.months.push(new yfcMiniCalMonth(mon,yr,startDOW,lastDay,dropDownLabel));
}

function yfcMiniCalSetMonth(objId) {
	this.currMonth = objId.selectedIndex;
	this.showMonth();
}

function yfcToggleDisplay(fldDiv,fld,startFld, xOffset, yOffset) {
	if (this.displayed[fld]) {
		this.closeCal();
	} else {
		this.openCal(fldDiv,fld,startFld,xOffset,yOffset);
	}
}

function yfcMiniCalClass() {
	this.months = new Array();
	this.fields = new Array();
	this.currMonth = 0;
	this.maxMonth = 11;
	this.currField = undefined;
	this.today = 0;
	this.formFieldSeparator = '_';
	this.displayed = new Array();
	this.init = yfcMiniCalInitCalendar;
	this.prevMonth = yfcMiniCalPrevMonth;
	this.nextMonth = yfcMiniCalNextMonth;
	this.closeCal = yfcMiniCalCloseCal;
    this.closeCalHandler = undefined;
	this.openCal = yfcMiniCalOpenCal;
	this.toggleDisplay  = yfcToggleDisplay;
	this.addField = yfcMiniCalAddField;
	this.addMonth = yfcMiniCalAddMonth;
	this.showMonth = yfcMiniCalShowMonth;
	this.setMonth = yfcMiniCalSetMonth;
	this.updateArrows = yfcMiniCalUpdateArrows;
	this.updateField = yfcMiniCalUpdateField;
	this.dayMonthDate = false;
}


/*
 * yfcMiniCalAttachFields - 
 *      Attaches onclick handlers for the edit field/calendar image.
 *      This function replaces initialCalendarOnload() from Tiger's version
 *      of yfcMiniCal.
 * 
 * Required:
 * start_item, end_item - HTML input fields for dates
 * start_cal, end_cal   - Element containing calendar image
 * start_div, end_div   - Div containing input field/calendar image
 * form_name            - Form containing calendar
 * form_symbol          - Seperator character used by yfcMiniCal.openCal
 * 
 * Optional:
 * close_cal_handler    - This function is called when the calendar is closed
 * display_handler      - This function is called when the calendar is opened (e.g. when the user clicks on the input field)
 * toggle_handler       - This function is called when the calendar is 'toggled' (e.g. when the user clicks on the calendar image)
 * .*Offset             - Adjust the positioning of the calendar widget
 */
function yfcMiniCalAttachFields(start_item, end_item, start_cal, end_cal, start_div, end_div, form_name, form_symbol, 
                                close_cal_handler, display_handler, toggle_handler, xStartOffset, yStartOffset, xEndOffset, yEndOffset) {

    var start_date = document.getElementById(start_item);
    var end_date = document.getElementById(end_item);
    var start_date_Cal = document.getElementById(start_cal);
    var end_date_Cal = document.getElementById(end_cal);
    var form_start_item = form_name + form_symbol + start_item;
    var form_end_item = form_name + form_symbol + end_item;

    var f;

    if (close_cal_handler) {
        yfcMiniCal.closeCalHandler = close_cal_handler;
    }

    if (start_date && start_date.type != 'hidden')
    {
        f = function () { yfcMiniCal.openCal(start_div,form_start_item,null,xStartOffset,yStartOffset); if(display_handler) { display_handler(start_item); }};

        start_date.onclick =f;

        if (start_date_Cal)
        {
            f = function () { yfcMiniCal.toggleDisplay(start_div,form_start_item,null,xStartOffset,yStartOffset); if(toggle_handler) { toggle_handler(start_item); }};
            start_date_Cal.onclick = f;
        }
    }

    if (end_date && end_date.type != 'hidden')
    {
        f = function () { yfcMiniCal.openCal(end_div,form_end_item,form_start_item,xEndOffset,yEndOffset); if(display_handler) { display_handler(end_item); }};
        end_date.onclick = f;

        if (end_date_Cal)
        {
            f = function () { yfcMiniCal.toggleDisplay(end_div,form_end_item,form_start_item,xEndOffset,yEndOffset); if(toggle_handler) { toggle_handler(end_item); }};
            end_date_Cal.onclick = f;
        }
    }
}

var yfcMiniCal = new yfcMiniCalClass();

function kk_autosuggest_AutoSuggest(elem,suggestions,baseurl,autosuggestDiv,nbItems,className,navigation,separator) {
var me=this;
this.elem=elem;this.suggestions=suggestions;this.eligible=new Array();this.inputText=null;
this.baseurl=baseurl;this.highlighted=-1;this.div=document.getElementById(autosuggestDiv);
this.data="dynamic";this.navigation=navigation;this.toDisable=false;
this.separator=separator;this.addIframe=false;
this.myLastValue="";this.buffer="";this.startList=0;this.sizeList=nbItems;
this.itemLess = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<< << <<";
this.itemMore = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;>> >> >>";
this.timeToDisable = 10000;this.startWith = false;this.boldSelection = true;this.nbLetters = 3;this.sep = "&nbsp;";this.uniqueRequest = true;
this.timeNotReceived = 0;

if (suggestions!="") this.data="static";
if (this.data!="static") var obj=ygConn.getObject();

var lessId=-1;var moreId=-1;
var TAB=9;var ESC=27;var KEYUP=38;var KEYDN=40;var KEYRIGHT=39;var KEYLEFT=37;var ENTER=13;var DEL=8;

elem.setAttribute("autocomplete","off");
if(!elem.id) {var id="autosuggest"+idCounter;idCounter++;elem.id=id;}

this.kk_autosuggest_disableAutosuggest=function() {
var ul=document.createElement('ul');this.div.replaceChild(ul,this.div.childNodes[0]);
this.toDisable=true;this.suggestions=[];
ygConn.http.abort(obj);ygConn.releaseObject(obj);
elem.setAttribute("autocomplete","on");
};

this.kk_autosuggest_isValidBrowser=function() {
var ua=navigator.userAgent.toLowerCase();
isGecko=(ua.indexOf('gecko')!=-1&&ua.indexOf('safari')==-1);isSafari=(ua.indexOf('safari')!=- 1);isOpera=(ua.indexOf('opera')!=-1);isIE=(ua.indexOf('msie')!=-1&&!isOpera&&(ua.indexOf('webtv')==-1));isMozilla=(isGecko&&ua.indexOf('gecko/')+14==ua.length);
isNS=((isGecko)?(ua.indexOf('netscape')!=-1):((ua.indexOf('mozilla')!=-1)&&!isOpera&&!isSafari&&(ua.indexOf('spoofer')==-1)&&(ua.indexOf('compatible')==-1)&&(ua.indexOf('webtv')==-1)&&(ua.indexOf('hotjava')==-1)));
isIECompatible=((ua.indexOf('msie')!=-1)&&!isIE);
isNSCompatible=((ua.indexOf('mozilla')!=-1)&&!isNS&&!isMozilla&&!isIECompatible&&!isIE);
geckoVersion=((isGecko)?ua.substring((ua.lastIndexOf('gecko/')+6),(ua.lastIndexOf('gecko/')+14)):-1);
equivalentMozilla=((isGecko)?parseFloat(ua.substring(ua.indexOf('rv:')+3)):-1);versionMinor=parseFloat(navigator.appVersion);
if (isGecko&&!isMozilla) {versionMinor=parseFloat(ua.substring(ua.indexOf('/',ua.indexOf('gecko/')+6)+1));}
else if (isMozilla) {versionMinor=parseFloat(ua.substring(ua.indexOf('rv:')+3));}
else if (isIE&&versionMinor>=4) {versionMinor=parseFloat(ua.substring( ua.indexOf('msie')+5));}
else if (isSafari) {versionMinor=parseFloat(ua.substring(ua.lastIndexOf('safari/')+7));}
else if (isOpera) {versionMinor=parseFloat(ua.substring(ua.indexOf('opera')+6));}
versionMajor=parseInt(versionMinor);
isNS6up=(isNS&&versionMajor>=6);
isIE55up=(isIE&&versionMinor>=5.5);
this.addIframe=isIE55up;
if (!isMozilla&&!isNSCompatible&&!isNS6up&&!isIE55up&&!isOpera) this.kk_autosuggest_disableAutosuggest();
};
this.kk_autosuggest_isValidBrowser();

this.kk_autosuggest_showAutosuggest=function() {
   this.toDisable=false;
   elem.setAttribute("autocomplete","off");
   var obj=ygConn.getObject();
   this.kk_autosuggest_isValidBrowser();
   setTimeout("document.getElementById('"+me.elem.id+"').focus()",0);
   if (elem.value.length>=me.nbLetters) this.kk_autosuggest_sendQuery(elem.value); 
};

this.kk_autosuggest_updateStatus=function(id,str_hide,str_show) {
   if (this.toDisable) {
      this.kk_autosuggest_showAutosuggest();document.getElementById(id).innerHTML=str_hide;
   }else{
      this.kk_autosuggest_disableAutosuggest();document.getElementById(id).innerHTML=str_show;
   }   
};

this.kk_autosuggest_sendQuery=function(key) {
   if (!this.toDisable) {
      var url=baseurl+key;
      if (!ygConn.http.isCallInProgress(obj)) {
         ygConn.http.asyncRequest(obj,'GET',url,false,this.kk_autosuggest_callBack);
      }else {
         timeNotReceived = 0;
         if (this.buffer!=null) {
            this.buffer=key;setTimeout("reSendQuery()",500);
         }else{
           this.buffer=key;
         }    
      }
   }

   reSendQuery=function() {
      if (!this.toDisable) {
          timeNotReceived = timeNotReceived + 500;
         if (me.timeToDisable <= timeNotReceived) {
            this.toDisable=true;me.kk_autosuggest_disableAutosuggest();
         }
         if (me.buffer!=null) {
            if (!ygConn.http.isCallInProgress(obj)) {
               var url=baseurl+me.buffer;
               ygConn.http.asyncRequest(obj,'GET',url,false,me.kk_autosuggest_callBack);
               me.buffer=null;
            }else{
              setTimeout("reSendQuery();",500);
            }   
         }    
      } 
   };
};

this.kk_autosuggest_callBack=function() {
if (arguments[0].readyState==4) {
if (arguments[0].status==200) {
if(arguments[0].responseText=="") {me.kk_autosuggest_hideDiv();}
else {
suggestions=eval(arguments[0].responseText);
me.suggestions=suggestions;
me.kk_autosuggest_getEligible();
if (me.eligible.length>0) {me.kk_autosuggest_createDiv();me.kk_autosuggest_positionDiv();me.kk_autosuggest_showDiv();}
else {me.kk_autosuggest_hideDiv();}
}
}
else {me.kk_autosuggest_hideDiv();}
}
else {me.kk_autosuggest_hideDiv();}
ygConn.releaseObject(obj);
};

elem.onfocus=function() {
if (!this.toDisable&&(elem.value.length>=me.nbLetters||me.data=="static")&&(me.div.style.display=="none"||me.div.style.display=="")) {
me.inputText=elem.value;me.kk_autosuggest_getEligible();
if (me.eligible.length>0) {me.kk_autosuggest_createDiv();me.kk_autosuggest_positionDiv();me.kk_autosuggest_showDiv();}
}
};

elem.onblur=function() {
if (me.highlighted>-1&&(me.highlighted==moreId||me.highlighted==lessId)) {setTimeout("document.getElementById('"+me.elem.id+"').focus()",0);}
else {setTimeout("hideDiv()",200);}
hideDiv=function() {me.div.style.display='none';me.highlighted=-1;me.startList=0;};
};

elem.onkeydown=function(ev) {
var key=me.kk_autosuggest_getKeyCode(ev);
switch(key) {
case TAB:
if (me.highlighted>0) {me.kk_autosuggest_useSuggestion();me.kk_autosuggest_hideDiv();}
else {me.kk_autosuggest_createDiv();me.kk_autosuggest_positionDiv();me.kk_autosuggest_showDiv();}
break;
case ESC:me.kk_autosuggest_hideDiv();break;
case KEYRIGHT:case KEYLEFT:
if (me.highlighted==moreId &&me.highlighted!=-1) {
me.startList=me.startList+me.sizeList;
me.kk_autosuggest_createDiv();me.kk_autosuggest_positionDiv();me.kk_autosuggest_showDiv();
}
else if (me.highlighted==lessId&&me.highlighted!=-1) {
me.startList=me.startList-me.sizeList;
me.kk_autosuggest_createDiv();me.kk_autosuggest_positionDiv();me.kk_autosuggest_showDiv();
}
else if (me.highlighted==-1) me.kk_autosuggest_hideDiv();
else me.kk_autosuggest_useSuggestion();
break;
case KEYUP:
if (me.highlighted>0) {me.highlighted--;}
me.kk_autosuggest_changeHighlight(key);
break;
case KEYDN:
if (me.navigation==true) {
if (moreId!=-1) max=moreId;
else max=me.eligible.length % me.sizeList;
}
else max=me.eligible.length-1;
if (me.highlighted<max) {me.highlighted++;}
me.kk_autosuggest_changeHighlight(key);
break;
default:me.kk_autosuggest_positionDiv();break;
}
};

elem.onkeypress=function(ev) {
var key=me.kk_autosuggest_getKeyCode(ev);
switch(key){case ENTER:if (me.highlighted>-1) {me.kk_autosuggest_useSuggestion();return false;}}
};

elem.onkeyup=function(ev)  {
var key=me.kk_autosuggest_getKeyCode(ev);
switch(key)
{
case TAB:case ESC:case ENTER:case KEYUP:case KEYDN:case KEYRIGHT:case KEYLEFT:return;
default:
me.startList=0;
if (me.data=="static") {
if (this.value !=me.inputText) {
me.inputText=this.value;me.kk_autosuggest_getEligible();
if (me.eligible.length>0) {me.kk_autosuggest_createDiv();me.kk_autosuggest_positionDiv();me.kk_autosuggest_showDiv();}
else {me.kk_autosuggest_hideDiv();}
}
else {me.kk_autosuggest_hideDiv();}
}
else {
if (me.uniqueRequest) {
if (this.value.length==me.nbLetters && this.value!="") {myValue=this.value;me.inputText=this.value;if (key==DEL) me.kk_autosuggest_hideDiv();me.kk_autosuggest_sendQuery(myValue);}
else {
if (this.value !=me.inputText && this.value.length>me.nbLetters) {
me.inputText=this.value;me.kk_autosuggest_getEligible();
if (me.eligible.length>0) {me.kk_autosuggest_createDiv();me.kk_autosuggest_positionDiv();me.kk_autosuggest_showDiv();}
else {me.kk_autosuggest_hideDiv();}
}
else {me.kk_autosuggest_hideDiv();}
}
}
else {
if (this.value.length>=me.nbLetters && this.value!="") {myValue=this.value;me.inputText=this.value;if (key==DEL) me.kk_autosuggest_hideDiv();setTimeout("kk_autosuggest_waitSendQuery(myValue)",300);}
else {me.kk_autosuggest_hideDiv();}
}
}
}

kk_autosuggest_waitSendQuery=function(key) {
if (me.inputText==key&&key!=me.myLastValue) {me.kk_autosuggest_sendQuery(key);}
me.myLastValue=key;
};
};

this.kk_autosuggest_useSuggestion=function() {
if (this.highlighted>-1&&me.navigation!=true)
{
if (separator==true)
this.elem.value=this.eligible[this.highlighted].substring(0,this.eligible[this.highlighted].indexOf(me.sep));
else
this.elem.value=this.eligible[this.highlighted];
this.kk_autosuggest_hideDiv();
}
else if (this.highlighted==moreId) {
this.startList=this.startList+this.sizeList;
me.kk_autosuggest_createDiv();me.kk_autosuggest_positionDiv();me.kk_autosuggest_showDiv();
}
else if (this.highlighted==lessId) {
this.startList=this.startList-this.sizeList;
if (this.startList<=0) {this.startList=0; lessId=0;}
me.kk_autosuggest_createDiv();me.kk_autosuggest_positionDiv();me.kk_autosuggest_showDiv();
}
else  {
itemId=this.startList+parseInt(this.highlighted)-(lessId+1);
val=this.eligible[itemId];
if (separator==true) me.inputText=val.substring(0,val.indexOf(me.sep));
else me.inputText=val;
this.elem.value=me.inputText;
this.kk_autosuggest_hideDiv();
}
};

this.kk_autosuggest_showDiv=function() {this.div.style.display='block';};

this.kk_autosuggest_hideDiv=function() {this.div.style.display='none';this.highlighted=-1;this.startList=0;};

this.kk_autosuggest_changeHighlight=function() {
var lis=this.div.getElementsByTagName('LI');
for (i=0;i<lis.length;i++) {
var li=lis[i];
if (this.highlighted==i) {li.className="selected";}
else {li.className="";}
}
};

this.kk_autosuggest_positionDiv=function() {
var el=this.elem;var x=0;var y=el.offsetHeight;
while (el.offsetParent&&el.tagName.toUpperCase() !='BODY') {x+=el.offsetLeft;y+=el.offsetTop;el=el.offsetParent;}
x+=el.offsetLeft;y+=el.offsetTop;
this.div.style.left=x+'px';this.div.style.top=y+'px';
};

this.kk_autosuggest_createDiv=function() {
var ul=document.createElement('ul');
if (this.navigation!=true) {
for (i=0;i<this.eligible.length;i++) {
var word=this.eligible[i];
var li=document.createElement('li');
var a=document.createElement('a');a.href="javascript:false";a.innerHTML=word;li.appendChild(a);
if (me.highlighted==i) {li.className="selected";}
ul.appendChild(li);
}
endList=this.suggestions.length;
}
else {
endList=this.startList+this.sizeList;
if (endList>this.eligible.length) endList=this.eligible.length;
if (this.startList>=this.sizeList) {
var li=document.createElement('li');
var a=document.createElement('a');a.href="javascript:false";a.innerHTML=this.itemLess;li.appendChild(a);
lessId=0;
ul.appendChild(li);
}
else lessId=-1;
me.highlighted=-1;
for (i=this.startList;i<endList; i++) {
var word= new String(this.eligible[i]);
var li=document.createElement('li');
var a=document.createElement('a');a.href="javascript:false";
if (me.boldSelection) {
wordFormatted = word.replace(cnvrt2Title(me.inputText),"<b>"+cnvrt2Title(me.inputText)+"</b>");
if (wordFormatted.indexOf("<b>")==-1)
wordFormatted=wordFormatted.replace(me.inputText,"<b>"+me.inputText+"</b>");
if (wordFormatted.indexOf("<b>")==-1)
wordFormatted = wordFormatted.replace(me.inputText.toUpperCase(),"<b>"+me.inputText.toUpperCase()+"</b>");
 wordFormatted = wordFormatted.replace("&<b>nbsp</b>;","&nbsp;").replace("&<b>nbs</b>p;","&nbsp;").replace("&<b>n</b>bsp;","&nbsp;").replace("&<b>nb</b>sp;","&nbsp;").replace("&<b>nbsp;</b>","&nbsp;");
a.innerHTML=wordFormatted;
}
else a.innerHTML=word;
li.appendChild(a);
ul.appendChild(li);
}
if (this.eligible.length>endList) {
var li=document.createElement('li');
var a=document.createElement('a');a.href="javascript:false";a.innerHTML=this.itemMore;li.appendChild(a);
if (lessId==0) moreId=lessId+this.sizeList+1; else moreId=this.startList+this.sizeList;
ul.appendChild(li);
}
else moreId=-1;
}
if (this.addIframe) {
var iframe=document.createElement('iframe');iframe.frameBorder=0;iframe.style.display='block';iframe.style.position='absolute';iframe.style.top=ul.offsetTop;
iframe.style.left=0;iframe.style.filter='progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)';iframe.id=this.div.id+"BackGround";
iframe.style.zIndex="-10";
ul.appendChild(iframe);
}
this.div.replaceChild(ul,this.div.childNodes[0]);

ul.onmouseover=function(ev) {
var target=me.kk_autosuggest_getEventSource(ev);
while (target.parentNode&&target.nodeName.toUpperCase() !='LI') {target=target.parentNode;}
var lis=me.div.getElementsByTagName('LI');
for (i=0;i<lis.length;i++) {
var li=lis[i];
if (li==target) {me.highlighted=i;break;}
}
me.kk_autosuggest_changeHighlight();
};
ul.onclick=function(ev) {me.kk_autosuggest_useSuggestion();me.kk_autosuggest_cancelEvent(ev);return false;};

this.div.className=className;this.div.style.position='absolute';
if (this.addIframe) {
if (this.div.offsetHeight>0) height=this.div.offsetHeight;
else if (endList>0) height=endList*17+20;
document.getElementById(this.div.id+"BackGround").style.height=height+"px";
}

function cnvrt2Title(str) {return str.toLowerCase().replace(/\b[a-z]/g, cnvrt);function cnvrt() {return arguments[0].toUpperCase();}}
};

this.kk_autosuggest_getEligible=function() {
this.eligible=new Array();
if (me.navigation!=true) this.suggestions.length=this.sizeList;
for (var i=0; i< this.suggestions.length; i++) {
var suggestion=this.suggestions[i];
if ((me.startWith&&suggestion.toLowerCase().indexOf(me.inputText.toLowerCase())==0)) {this.eligible[this.eligible.length]=suggestion;}
else if (!(me.startWith&&suggestion.toLowerCase().indexOf(me.inputText.toLowerCase())>=0)){this.eligible[this.eligible.length]=suggestion;}
}
};

this.kk_autosuggest_getKeyCode=function(ev) {if(ev) {return ev.keyCode;} if(window.event) {return window.event.keyCode;}};

this.kk_autosuggest_getEventSource=function(ev) {if(ev) {return ev.target;} if(window.event) {return window.event.srcElement;}};

this.kk_autosuggest_cancelEvent=function(ev) {if(ev) {ev.preventDefault();ev.stopPropagation();} if(window.event) {window.event.returnValue=false;}};

}
var idCounter=0;


function ygConnect(){}
ygConnect.prototype={_msxml_progid:['MSXML2.XMLHTTP.5.0','MSXML2.XMLHTTP.4.0','MSXML2.XMLHTTP.3.0','MSXML2.XMLHTTP','Microsoft.XMLHTTP'],_async_response:{},_http_header:[],_isFormPost:false,_sFormData:null,getConnObject:function(objectId,transactionId)
{var obj,http;try
{http=new XMLHttpRequest();obj={conn:http,oId:objectId,tId:transactionId};}
catch(e)
{for(var i=0;i<this._msxml_progid.length;++i){try
{http=new ActiveXObject(this._msxml_progid[i]);obj={conn:http,oId:objectId,tId:transactionId};}
catch(e){}}}
finally
{if(http!=undefined||obj!=undefined){var connObj=arguments.length>0?obj:http;return connObj;}
else{return null;}}},setProgId:function(id)
{this.msxml_progid.unshift(id);},syncRequest:function(o,sMethod,sUri,bXml,oPostData)
{if(!o){return;}
o.conn.open(sMethod,sUri,false);if(this._http_header.length>0)
this.setHeader(o);if(this._isFormPost){oPostData=this._sFormData;this._isFormPost=false;}
else if(oPostData){this.initHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8');}
oPostData?o.conn.send(oPostData):o.conn.send(null);try
{if(o.conn.status==200){response=(bXml?o.conn.responseXML:o.conn.responseText);}
else{response=this.connectException(o);}}
catch(e)
{response=this.connectException(e,o.tId);}
finally
{ygConnect.superclass.releaseObject(o);return response;}},asyncRequest:function(o,sMethod,sUri,bXml,oCallback,oCallbackArgs,oPostData)
{if(!o){var queueObject={method:sMethod,uri:sUri,isXml:bXml,callback:oCallback,argument:oCallbackArgs,data:oPostData};
ygConnect.superclass.queueRequest(queueObject);}
else{var self=this;o.conn.open(sMethod,sUri,true);if(oCallback){o.conn.onreadystatechange=function()
{if(o.conn.readyState==4){try
{if(o.conn.status==200){oCallback(o.conn,o.tId,oCallbackArgs);}
else{var errorObj=self.connectException(o);oCallback(errorObj,oCallbackArgs);}}
catch(e)
{var errorObj=self.connectException(e,o.tId);oCallback(errorObj,oCallbackArgs);}
finally
{ygConnect.superclass.releaseObject(o);}}};}
else{o.conn.onreadystatechange=function(){self.stateChange(o,bXml);};}
if(this._http_header.length>0){this.setHeader(o);}
if(this._isFormPost){oPostData=this._sFormData;this._isFormPost=false;}
else if(oPostData){this.initHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8');}
oPostData?o.conn.send(oPostData):o.conn.send(null);}},stateChange:function(o,bXml)
{var oResponse;switch(o.conn.readyState){case 4:try
{if(o.conn.status==200){oResponse={tId:o.tId,status:o.conn.status,message:(bXml?o.conn.responseXML:o.conn.responseText)};}
else
oResponse=this.connectException(o);}
catch(e)
{oResponse=this.connectException(e,o.tId);}
finally
{this.setResponse(oResponse);ygConnect.superclass.releaseObject(o);}
break;}},setResponse:function(o)
{this._async_response[o.tId]=o;},getResponse:function(tId)
{var oResponse=this._async_response[tId];if(oResponse){delete this._async_response[tId];return oResponse;}},initHeader:function(label,value)
{var oHeader=[label,value];this._http_header.push(oHeader);},setHeader:function(o)
{var oHeader=this._http_header;for(var i=0;i<oHeader.length;i++)
o.conn.setRequestHeader(oHeader[i][0],oHeader[i][1]);oHeader.splice(0,oHeader.length);},getHeader:function(o,label)
{return o.conn.getResponseHeader(label);},getAllHeaders:function(o)
{return o.conn.getAllResponseHeaders();},setForm:function(formName)
{this._sFormData='';var prevElName;var oForm=document.forms[formName];for(var i=0;i<oForm.elements.length;i++){oElement=oForm.elements[i];elName=oForm.elements[i].name;elValue=oForm.elements[i].value;switch(oElement.type)
{case'select-multiple':for(var j=0;j<oElement.options.length;j++){if(oElement.options[j].selected){this._sFormData+=encodeURIComponent(elName)+'='+encodeURIComponent(oElement.options[j].value)+'&';}}
break;case'radio':case'checkbox':if(oElement.checked){this._sFormData+=encodeURIComponent(elName)+'='+encodeURIComponent(elValue)+'&';}
break;case'file':break;case undefined:break;default:this._sFormData+=encodeURIComponent(elName)+'='+encodeURIComponent(elValue)+'&';break;}}
this._sFormData=this._sFormData.substr(0,this._sFormData.length-1);this._isFormPost=true;this.initHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8');},abort:function(o)
{if(this.isCallInProgress(o)){o.conn.abort();ygConnect.superclass.releaseObject(o);}},isCallInProgress:function(o)
{if(o)
return o.conn.readyState!=4&&o.conn.readyState!=0;},connectException:function(o,transactionId)
{if(o.conn){return{tId:o.tId,status:o.conn.status,message:o.conn.statusText};}
else{return{tId:transactionId,status:o.name,message:o.message};}}};
var ygConnManager=function(){};
ygConnManager.prototype={_object_count:0,_available_pool:[],_request_queue:[],_enable_pool:true,_max_pool_size:2,_transaction_id:0,http:new ygConnect()};
var ygConn=ygConnManager.prototype;ygConnect.superclass=ygConnManager.prototype;ygConnManager.prototype.setPoolSize=function(i)
{this._max_pool_size=2;};
ygConnManager.prototype.disablePooling=function()
{this._enable_pool=false;};
ygConnManager.prototype.enablePooling=function()
{this._enable_pool=true;};
ygConnManager.prototype.getTransactionId=function()
{return this._transaction_id;};
ygConnManager.prototype.incrObjCount=function()
{this._object_count++;};
ygConnManager.prototype.incrTransactionId=function()
{this._transaction_id++;};
ygConnManager.prototype.getObject=function()
{var o;var oId;var tId=this.getTransactionId();if(this._enable_pool){try
{if(window.XMLHttpRequest){oId=this._object_count;o=this.http.getConnObject(oId,tId);if(o){this.incrTransactionId();}
return o;}
else if(window.ActiveXObject){return this.getActiveXObject();}}
catch(e)
{return this.getActiveXObject();}}
else{return this.http.getConnObject();}};
ygConnManager.prototype.getActiveXObject=function()
{var o;var oId;var tId=this.getTransactionId();if(this._object_count<this._max_pool_size&&this._available_pool.length==0){oId=this._object_count;o=this.http.getConnObject(oId,tId);if(o){this.incrObjCount();this.incrTransactionId();}}
else if(this._available_pool.length>0){o=this.getAvailableObject();if(o){o.tId=tId;this.incrTransactionId();}}
return o;};
ygConnManager.prototype.getAvailableObject=function()
{return this._available_pool.shift();};
ygConnManager.prototype.releaseObject=function(o)
{try
{if(window.XMLHttpRequest){o=null;}
else{o.conn.onreadystatechange=detachStateListener;this._available_pool.push(o);}}
catch(e)
{o.conn.onreadystatechange=detachStateListener;this._available_pool.push(o);}
finally
{this.checkRequestQueue();}};
ygConnManager.prototype.checkRequestQueue=function()
{if(this._request_queue.length>0){var o=this.getObject();var q=this._request_queue.shift();this.http.asyncRequest(o,q.method,q.uri,q.isXml,q.callback,q.argument,q.data);}};
ygConnManager.prototype.queueRequest=function(o)
{this._request_queue.push(o);};
function detachStateListener(){return null;};

function kk_multistop_IsFourDigitsYear(year){
 return (year.search(/\d{4}/) != -1);
};

function kk_multistop_ConvertToFourDigitsYear(year){ 
var yearToConvert = "20" + year;
return yearToConvert;
};

function kk_multistop_isNewCalendar(){
return (document.getElementById("yfcMiniCalDiv")!=null);
};

var dtCh= "/";
function kk_multistop_IsInterger(s){
	var i;
    for (i = 0; i < s.length; i++){
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
};

function kk_multistop_stripCharsInBag(s, bag){
	var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++){   
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
};

function kk_multistop_daysInFebruary(year){
	// February has 29 days in any year evenly divisible by four,
    // EXCEPT for centurial years which are not also divisible by 400.
    return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
};

function kk_multistop_DaysArray(n) {
	for (var i = 1; i <= n; i++) {
		this[i] = 31;
		if (i==4 || i==6 || i==9 || i==11) {this[i] = 30;}
		if (i==2) {this[i] = 29;}
   } 
   return this;
};


function kk_multistop_isDate(dtStr){

  //var daysInMonth=[0,31,29,31,30,31,30,31,31,30,31,30,31];
	var daysInMonth = kk_multistop_DaysArray(12);
	var pos1=dtStr.indexOf(dtCh);
	var pos2=dtStr.indexOf(dtCh,pos1+1);
	var strDay=dtStr.substring(0,pos1);
	var strMonth=dtStr.substring(pos1+1,pos2);
	var strYear=dtStr.substring(pos2+1);
	strYr=strYear;
	if (strDay.charAt(0)=="0" && strDay.length>1) {strDay=strDay.substring(1);}
	if (strMonth.charAt(0)=="0" && strMonth.length>1) {strMonth=strMonth.substring(1);}
	for (var i = 1; i <= 3; i++) {
		if (strYr.charAt(0)=="0" && strYr.length>1) {strYr=strYr.substring(1);}
	}
	month=parseInt(strMonth);
	day=parseInt(strDay);
	year=parseInt(strYr);
	if (pos1==-1 || pos2==-1){
		alert(alert1);
		return false;
	}
	if (strMonth.length<1 || month<1 || month>12){
		alert(alert1);
		return false;
	}
	if (strDay.length<1 || day<1 || day>31 || (month==2 && day>kk_multistop_daysInFebruary(year)) || day > daysInMonth[month]){
		alert(alert1);
		return false;
	}
	if ((strYear.length != 4 && strYear.length != 2) || year==0 ){
		alert(alert1);
		return false;
	}
	if (dtStr.indexOf(dtCh,pos2+1)!=-1 || kk_multistop_IsInterger(kk_multistop_stripCharsInBag(dtStr, dtCh))==false){
		alert(alert1);
		return false;
	}
return true;
};

function kk_multistop_openDepartureDateLeg1Calendar() {
if (cal==null) {
cal=new kk_CalendarPopup();
cal.setReturnFunction("kk_multistop_setDepDate_leg1");
cal.setMonthNames(month1,month2,month3,month4,month5,month6,month7,month8,month9,month10,month11,month12);
cal.setDayHeaders(day1,day2,day3,day4,day5,day6,day7);
cal.setWeekStartDay(1);
cal.setTodayLabel(todayLabel,month,year);
};
month=document.searchForm.dmonth_leg1.options[document.searchForm.dmonth_leg1.selectedIndex].value;
year=document.searchForm.dyear_leg1.options[document.searchForm.dyear_leg1.selectedIndex].value;
cal.showCalendar('depdate_leg1',month,year); 
return false;
};

function kk_multistop_openDepartureDateLeg2Calendar() {
if (cal2==null) {
cal2=new kk_CalendarPopup();
cal2.setReturnFunction("kk_multistop_setDepDate_leg2");
cal2.setMonthNames(month1,month2,month3,month4,month5,month6,month7,month8,month9,month10,month11,month12);
cal2.setDayHeaders(day1,day2,day3,day4,day5,day6,day7);
cal2.setWeekStartDay(1);
cal2.setTodayLabel(todayLabel);
}
month=document.searchForm.dmonth_leg2.options[document.searchForm.dmonth_leg2.selectedIndex].value;
year=document.searchForm.dyear_leg2.options[document.searchForm.dyear_leg2.selectedIndex].value;
cal2.showCalendar('depdate_leg2',month,year); 
return false;
}

function kk_multistop_openDepartureDateLeg3Calendar() {
if (cal3==null) {
cal3=new kk_CalendarPopup();
cal3.setReturnFunction("kk_multistop_setDepDate_leg3");
cal3.setMonthNames(month1,month2,month3,month4,month5,month6,month7,month8,month9,month10,month11,month12);
cal3.setDayHeaders(day1,day2,day3,day4,day5,day6,day7);
cal3.setWeekStartDay(1);
cal3.setTodayLabel(todayLabel);
}
month=document.searchForm.dmonth_leg3.options[document.searchForm.dmonth_leg3.selectedIndex].value;
year=document.searchForm.dyear_leg3.options[document.searchForm.dyear_leg3.selectedIndex].value;
cal3.showCalendar('depdate_leg3',month,year); 
return false;
}

function kk_multistop_cleanTown(fromField){}

function kk_multistop_currentYear() {
var now=new Date(); 
var year=now.getYear(); 
if(year<999) year+=1900;
return year;
}

function kk_multistop_setDepDate_leg1(y,m,d) {
var year=kk_multistop_currentYear();
document.searchForm.dday_leg1.selectedIndex=d-1;
document.searchForm.dmonth_leg1.selectedIndex=m-1;
if (y==year) document.searchForm.dyear_leg1.selectedIndex=0;
if (y==year+1) document.searchForm.dyear_leg1.selectedIndex=1;
kk_multistop_setMonth_leg1();
kk_multistop_setYear_leg1();
kk_multistop_getDepWeekDay_leg1(d,m,y);
}

function kk_multistop_setDepDate_leg2(y,m,d) {
var year=kk_multistop_currentYear();
document.searchForm.dday_leg2.selectedIndex=d-1;
document.searchForm.dmonth_leg2.selectedIndex=m-1;
if (y==year) document.searchForm.dyear_leg2.selectedIndex=0;
if (y==year+1) document.searchForm.dyear_leg2.selectedIndex=1;
kk_multistop_setMonth_leg2();
kk_multistop_setYear_leg2();
kk_multistop_getDepWeekDay_leg2(d,m,y);
}

function kk_multistop_setDepDate_leg3(y,m,d) {
var year=kk_multistop_currentYear();
document.searchForm.dday_leg3.selectedIndex=d-1;
document.searchForm.dmonth_leg3.selectedIndex=m-1;
if (y==year) document.searchForm.dyear_leg3.selectedIndex=0;
if (y==year+1) document.searchForm.dyear_leg3.selectedIndex=1;
kk_multistop_getDepWeekDay_leg3(d,m,y);
}

function kk_multistop_ctrlForm(form) {

if (typeof(form.airline)!="undefined") {
if (form.airlineFormatted!=null && form.airline.type.toLowerCase() == 'select') {
var airlineName2=form.airline.options[form.airline.selectedIndex].text;
form.airlineFormatted.value=airlineName2;
}
}
var daysinmonthR=[31,28,31,30,31,30,31,31,30,31,30,31];
var daysinmonthD=[31,28,31,30,31,30,31,31,30,31,30,31];

var isNewCalendar = kk_multistop_isNewCalendar();

if (isNewCalendar)
{	
 	var departureDate1=form.departureDate1.value;
        var departureDate2=form.departureDate2.value;
        var departureDate3=form.departureDate3.value;

	if (!kk_multistop_isDate(departureDate1) || !kk_multistop_isDate(departureDate2) || !kk_multistop_isDate(departureDate3) ) {return false;}

	var splitDepDate1=departureDate1.split("/"); 
	var splitDepDate2=departureDate2.split("/");
	var splitDepDate3=departureDate3.split("/");

	selectedDepDay_leg1=splitDepDate1[0];
	selectedDepMonth_leg1=splitDepDate1[1];
	selectedDepYear_leg1=splitDepDate1[2];

	selectedDepDay_leg2=splitDepDate2[0];
	selectedDepMonth_leg2=splitDepDate2[1];
	selectedDepYear_leg2=splitDepDate2[2];
	
	selectedDepDay_leg3=splitDepDate3[0];
	selectedDepMonth_leg3=splitDepDate3[1];
	selectedDepYear_leg3=splitDepDate3[2];

 	if (!kk_multistop_IsFourDigitsYear(selectedDepYear_leg1)) {
	selectedDepYear=kk_multistop_ConvertToFourDigitsYear(selectedDepYear_leg1);
  	}
	if (!kk_multistop_IsFourDigitsYear(selectedDepYear_leg2)) {
	selectedDepYear=kk_multistop_ConvertToFourDigitsYear(selectedDepYear_leg2);
  	}
	if (!kk_multistop_IsFourDigitsYear(selectedDepYear_leg3)) {
	selectedDepYear=kk_multistop_ConvertToFourDigitsYear(selectedDepYear_leg3);
  	}
 
}
else
{
	selectedDepDay_leg1=form.dday_leg1.options[form.dday_leg1.selectedIndex].value;
	selectedDepMonth_leg1=form.dmonth_leg1.options[form.dmonth_leg1.selectedIndex].value;
	selectedDepYear_leg1=form.dyear_leg1.options[form.dyear_leg1.selectedIndex].value;
	selectedDepDay_leg2=form.dday_leg2.options[form.dday_leg2.selectedIndex].value;
	selectedDepMonth_leg2=form.dmonth_leg2.options[form.dmonth_leg2.selectedIndex].value;
	selectedDepYear_leg2=form.dyear_leg2.options[form.dyear_leg2.selectedIndex].value;
	selectedDepDay_leg3=form.dday_leg3.options[form.dday_leg3.selectedIndex].value;
	selectedDepMonth_leg3=form.dmonth_leg3.options[form.dmonth_leg3.selectedIndex].value;
	selectedDepYear_leg3=form.dyear_leg3.options[form.dyear_leg3.selectedIndex].value;
}
selectedDepDate_leg1=new Date(selectedDepYear_leg1,selectedDepMonth_leg1-1,selectedDepDay_leg1);
selectedDepDate_leg2=new Date(selectedDepYear_leg2,selectedDepMonth_leg2-1,selectedDepDay_leg2);
selectedDepDate_leg3=new Date(selectedDepYear_leg3,selectedDepMonth_leg3-1,selectedDepDay_leg3);

today=new Date();
selectedDepTime_leg1=selectedDepDate_leg1.getTime()+24*3600*1000;
selectedDepTime_leg2=selectedDepDate_leg2.getTime()+24*3600*1000;
selectedDepTime_leg3=selectedDepDate_leg3.getTime()+24*3600*1000;
var departureleg1="";
var arrivalleg1="";
var departureleg2="";
var arrivalleg2="";
var departureleg3="";
var arrivalleg3="";
departureleg1=form.departure_leg1.value;
arrivalleg1=form.arrival_leg1.value;
departureleg2=form.departure_leg2.value;
arrivalleg2=form.arrival_leg2.value;
departureleg3=form.departure_leg3.value;
arrivalleg3=form.arrival_leg3.value;
if (departureleg1==""||arrivalleg1=="") {
alert(alert4);
return false;
}
else {
if (today.getTime()>selectedDepTime_leg1) {
alert(alert2);
return false;
}
}
if ((departureleg2!=""&&arrivalleg2=="")||(departureleg2 ==""&&arrivalleg2 !="")) {
alert(alert5);
return false;
}
if ((departureleg3!=""&&arrivalleg3=="")||(departureleg3 ==""&&arrivalleg3 !="")) {
alert(alert6);
return false;
}
if (departureleg2!=""&&arrivalleg2!="") {
if (today.getTime()>selectedDepTime_leg2) {
alert (alert7);
return false;
}
if (selectedDepTime_leg1>selectedDepTime_leg2) {
alert (alert8);
return false;
}
}
if (departureleg3!=""&&arrivalleg3!="") {
if (today.getTime()>selectedDepTime_leg2) {
alert (alert9);
return false;
}
if (selectedDepTime_leg1>selectedDepTime_leg3) {
alert (alert10);
return false;
}
if (selectedDepTime_leg2>selectedDepTime_leg3) {
alert (alert11);
return false;
}
}
return true;
}

function kk_multistop_setMonth_leg1() {
document.searchForm.dmonth_leg2.selectedIndex=document.searchForm.dmonth_leg1.selectedIndex  ;
document.searchForm.dmonth_leg3.selectedIndex=document.searchForm.dmonth_leg1.selectedIndex  ;
kk_multistop_updateWeekDay_leg1();
kk_multistop_updateWeekDay_leg2();
kk_multistop_updateWeekDay_leg3();
}

function kk_multistop_setMonth_leg2() {
document.searchForm.dmonth_leg3.selectedIndex=document.searchForm.dmonth_leg2.selectedIndex  ;
kk_multistop_updateWeekDay_leg2();
kk_multistop_updateWeekDay_leg3();
}

function kk_multistop_setYear_leg1() {
document.searchForm.dyear_leg2.selectedIndex=document.searchForm.dyear_leg1.selectedIndex  ;
document.searchForm.dyear_leg3.selectedIndex=document.searchForm.dyear_leg1.selectedIndex  ;
kk_multistop_updateWeekDay_leg1();
kk_multistop_updateWeekDay_leg2();
kk_multistop_updateWeekDay_leg3();
}

function kk_multistop_setYear_leg2() {
document.searchForm.dyear_leg3.selectedIndex=document.searchForm.dyear_leg2.selectedIndex  ;
kk_multistop_updateWeekDay_leg2();
kk_multistop_updateWeekDay_leg3();
}

function kk_multistop_updateWeekDay_leg1() {
var dd_leg1=document.searchForm.dday_leg1.value;
var dm_leg1=document.searchForm.dmonth_leg1.value;
var dy_leg1=document.searchForm.dyear_leg1.value;
if (dy_leg1%4==0) var DMonthDays=new Array(31,29,31,30,31,30,31,31,30,31,30,31);
else var DMonthDays=new Array(31,28,31,30,31,30,31,31,30,31,30,31);
if (dd_leg1>DMonthDays[dm_leg1-1]) {
dd_leg1=DMonthDays[dm_leg1-1];
document.searchForm.dday_leg1.value=dd_leg1;
}
kk_multistop_getDepWeekDay_leg1(dd_leg1,dm_leg1,dy_leg1);
}

function kk_multistop_getDepWeekDay_leg1(d,m,y) {
var testdate=new Date(y,m-1,d);
var weekday=testdate.getDay();
if (weekday==0) document.searchForm.wdday_leg1.value=Sun;
if (weekday==1) document.searchForm.wdday_leg1.value=Mon;
if (weekday==2) document.searchForm.wdday_leg1.value=Tue;
if (weekday==3) document.searchForm.wdday_leg1.value=Wed;
if (weekday==4) document.searchForm.wdday_leg1.value=Thu;
if (weekday==5) document.searchForm.wdday_leg1.value=Fri;
if (weekday==6) document.searchForm.wdday_leg1.value=Sat;
}

function kk_multistop_updateWeekDay_leg2() {
var dd_leg2=document.searchForm.dday_leg2.value;
var dm_leg2=document.searchForm.dmonth_leg2.value;
var dy_leg2=document.searchForm.dyear_leg2.value;
if (dy_leg2%4==0) var DMonthDays=new Array(31,29,31,30,31,30,31,31,30,31,30,31);
else var DMonthDays=new Array(31,28,31,30,31,30,31,31,30,31,30,31);
if (dd_leg2>DMonthDays[dm_leg2-1]) {
dd_leg2=DMonthDays[dm_leg2-1];
document.searchForm.dday_leg2.value=dd_leg2;
}
kk_multistop_getDepWeekDay_leg2(dd_leg2,dm_leg2,dy_leg2);
}

function kk_multistop_getDepWeekDay_leg2(d,m,y) {
var testdate=new Date(y,m-1,d);
var weekday=testdate.getDay();
if (weekday==0) document.searchForm.wdday_leg2.value=Sun;
if (weekday==1) document.searchForm.wdday_leg2.value=Mon;
if (weekday==2) document.searchForm.wdday_leg2.value=Tue;
if (weekday==3) document.searchForm.wdday_leg2.value=Wed;
if (weekday==4) document.searchForm.wdday_leg2.value=Thu;
if (weekday==5) document.searchForm.wdday_leg2.value=Fri;
if (weekday==6) document.searchForm.wdday_leg2.value=Sat;
}

function kk_multistop_updateWeekDay_leg3() {
var dd_leg3=document.searchForm.dday_leg3.value;
var dm_leg3=document.searchForm.dmonth_leg3.value;
var dy_leg3=document.searchForm.dyear_leg3.value;
if (dy_leg3%4==0) var DMonthDays=new Array(31,29,31,30,31,30,31,31,30,31,30,31);
else var DMonthDays=new Array(31,28,31,30,31,30,31,31,30,31,30,31);
if (dd_leg3>DMonthDays[dm_leg3-1]) {
dd_leg3=DMonthDays[dm_leg3-1];
document.searchForm.dday_leg3.value=dd_leg3;
}
kk_multistop_getDepWeekDay_leg3(dd_leg3,dm_leg3,dy_leg3);
}

function kk_multistop_getDepWeekDay_leg3(d,m,y) {
var testdate=new Date(y,m-1,d);
var weekday=testdate.getDay();
if (weekday==0) document.searchForm.wdday_leg3.value=Sun;
if (weekday==1) document.searchForm.wdday_leg3.value=Mon;
if (weekday==2) document.searchForm.wdday_leg3.value=Tue;
if (weekday==3) document.searchForm.wdday_leg3.value=Wed;
if (weekday==4) document.searchForm.wdday_leg3.value=Thu;
if (weekday==5) document.searchForm.wdday_leg3.value=Fri;
if (weekday==6) document.searchForm.wdday_leg3.value=Sat;
}

function kk_multistop_pV(airPort) {
var selectedBox=parent.opener.window.document.formulaire.selectedBox.value;
var selectedBoxText=selectedBox+"TEXT";
parent.opener.window.document.formulaire.elements[selectedBox].value=airPort;
parent.opener.window.document.formulaire.elements[selectedBoxText].value=airPort;
closePopup();
}

function kk_multistop_checkEmptyAirport() {
if (typeof(document.forms.formulaire.departure)!="undefined") {document.forms.formulaire.departureTEXT.value=document.forms.formulaire.departure.value;}
if (typeof(document.forms.formulaire.arrival)!="undefined" ) {document.forms.formulaire.arrivalTEXT.value=document.forms.formulaire.arrival.value;}
var departure=document.forms.formulaire.departureTEXT.value;
var arrival=document.forms.formulaire.arrivalTEXT.value;
departure=kk_multistop_stringTrim(departure);
arrival=kk_multistop_stringTrim(arrival);
if (arrival.length==0||departure.length==0) {
alert(ALERT_AIRPORT_EMPTY); 
return false;
}
else {return true;}
}

function kk_multistop_stringTrim(strToTrim) {
if (strToTrim!=null) {strToTrim= strToTrim.replace(/^\s+|\s+$/g, '');}
return strToTrim;
}

function kk_multistop_majDate() {
if (document.searchForm.dday_leg3.value =="1"&&document.searchForm.dday_leg2.value =="1"&&document.searchForm.dday_leg1.value =="1"&&document.searchForm.dmonth_leg3.value =="1"&&document.searchForm.dmonth_leg2.value =="1"&&document.searchForm.dmonth_leg1.value =="1") {
var now=new Date();
var tmp=now.getTime()+(86400000*7);
now.setTime(tmp);
var month=now.getMonth()+1;
var year=now.getFullYear();
var day=now.getDate();   
document.searchForm.dday_leg1.options[day-1].selected=true;
document.searchForm.dmonth_leg1.options[month-1].selected=true;
document.searchForm.dyear_leg1.options[year-this_year].selected=true;
var now2=new Date();
tmp=now2.getTime()+(86400000*14);
now2.setTime(tmp);
month=now2.getMonth()+1;
year=now2.getFullYear();
day=now2.getDate();
document.searchForm.dday_leg2.options[day-1].selected=true;
document.searchForm.dmonth_leg2.options[month-1].selected=true;
document.searchForm.dyear_leg2.options[year-this_year].selected=true;
var now3=new Date();
tmp=now3.getTime()+(86400000*21);
now3.setTime(tmp);
month=now3.getMonth()+1;
year=now3.getFullYear();
day=now3.getDate();
document.searchForm.dday_leg3.options[day-1].selected=true;
document.searchForm.dmonth_leg3.options[month-1].selected=true;
document.searchForm.dyear_leg3.options[year-this_year].selected=true;
}
}

// from 
function kk_go(u) {document.location.href=u;}

// Javascript function to display non-crawlable Javascript links
// Links to the page given by an URL encoded using Base64
function kk_link3(url)
{
    var url = kk_decode64(url);
    kk_go(url);
}

var kk_keyStr = "ABCDEFGHIJKLMNOP" +
                "QRSTUVWXYZabcdef" +
                "ghijklmnopqrstuv" +
                "wxyz0123456789+/" +
                "=";

function kk_decode64(input) {
   var output = "";
   var chr1, chr2, chr3 = "";
   var enc1, enc2, enc3, enc4 = "";
   var i = 0;

   // remove all characters that are not A-Z, a-z, 0-9, +, /, or =
   var base64test = /[^A-Za-z0-9\+\/\=]/g;
   if (base64test.exec(input)) {
      return '';
   }
   input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");

   do {
      enc1 = kk_keyStr.indexOf(input.charAt(i++));
      enc2 = kk_keyStr.indexOf(input.charAt(i++));
      enc3 = kk_keyStr.indexOf(input.charAt(i++));
      enc4 = kk_keyStr.indexOf(input.charAt(i++));

      chr1 = (enc1 << 2) | (enc2 >> 4);
      chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
      chr3 = ((enc3 & 3) << 6) | enc4;

      output = output + String.fromCharCode(chr1);

      if (enc3 != 64) {
         output = output + String.fromCharCode(chr2);
      }
      if (enc4 != 64) {
         output = output + String.fromCharCode(chr3);
      }

      chr1 = chr2 = chr3 = "";
      enc1 = enc2 = enc3 = enc4 = "";

   } while (i < input.length);

   return output;
}

function validate(textbox, msg){
  txt=textbox.value;
  if (txt=="") {
   alert(msg);
   textbox.focus();
   return false;
  }
  return true;
}

function buy(form){
  if(ctrlPSForm(form)){
    form.mode.value='buy';
    form.target='_blank';
    form.submit();
    form.onsubmit = f1;
  }
}

function compare(form){
  if(ctrlPSForm(form)){
    form.mode.value='compare';
    form.target='_self';
    form.submit();
    form.onsubmit = f1;
  }
}

function f1() {
  return false;
}

function ctrlPSForm(form)
{
  selectedDepDay = form.dday.options[form.dday.selectedIndex].value;
  selectedDepMonth = form.dmonth.options[form.dmonth.selectedIndex].value;
  selectedDepYear = form.dyear.options[form.dyear.selectedIndex].value;
  selectedRetDay = form.rday.options[form.rday.selectedIndex].value;
  selectedRetMonth = form.rmonth.options[form.rmonth.selectedIndex].value;
  selectedRetYear = form.ryear.options[form.ryear.selectedIndex].value;
 
  selectedDepDate = new Date(selectedDepYear, selectedDepMonth -1, selectedDepDay);
  selectedRetDate = new Date(selectedRetYear, selectedRetMonth -1, selectedRetDay);

  today = new Date();
  tableJJ=[31,29,31,30,31,30,31,31,30,31,30,31];

  //check if dates are correct (if not selected from calendar)
  if (selectedDepDay>tableJJ[selectedDepMonth-1] || (true && selectedRetDay>tableJJ[selectedRetMonth-1]))
  {
    alert (jsalert1);
    return false;
  }

 selectedDepTime=selectedDepDate.getTime() + 24*3600*1000;   
 selectedRetTime=selectedRetDate.getTime() + 24*3600*1000;

  //check if departure date is correct
  if (today.getTime() > selectedDepTime ||  ((today.getTime() > selectedRetTime ) && true   ))

  {
    alert (jsalert2);
    return false;
  }

  //check if departure date < arival date
  if ( ( selectedRetTime  <  selectedDepTime ) && (true) )
  {
    alert (jsalert3);
    return false;
  }

  return true;
}

function calendar(months){

	document.write('<div class="calendar_form">\n');
	
	var d = new Date();
	d.setDate(d.getDate() + dday);
	var day=d.getDate(); 
	var month=d.getMonth() + 1;
	var year=d.getFullYear();
	
	// departure day
	document.write('<select name="dday">\n');
	for (i = 1; i <= 31; i++){
	  if(day==i){
	    document.write('<option value=' + i + ' selected>' + i + '</option>\n');
	  }else{
	    document.write('<option value=' + i + '>' + i + '</option>\n');
	  }
	}
	document.write('</select>\n');
	
	// departure month
	document.write('<select name="dmonth" >\n');
	for (i = 1; i <= 12; i++){
	  if(month==i){
	    document.write('<option value=' + i + ' selected>' + months[i-1] + '</option>\n');
	  }else{
	    document.write('<option value=' + i + '>' + months[i-1] + '</option>\n');
	  }
	}
	document.write('</select> \n');
	
	// departure year
	document.write('<select name="dyear" >\n');
	for (i = year; i <= (year + 5); i++){
	  if(year==i){
	    document.write('<option value=' + i + ' selected>' + i + '</option>\n');
	  }else{
	    document.write('<option value=' + i + '>' + i + '</option>\n');
	  }
	}
	document.write('</select><br>\n');
	
	
	// day + 7
	d = new Date();
	d.setDate(d.getDate() + rday);
	day=d.getDate();
	month=d.getMonth() + 1;
	year=d.getFullYear();
	
	// arrival day
	document.write('<select name="rday" >\n');
	for (i = 1; i <= 31; i++){
	  if(day==i){
	    document.write('<option value=' + i + ' selected>' + i + '</option>\n');
	  }else{
	    document.write('<option value=' + i + '>' + i + '</option>\n');
	  }
	}
	document.write('</select>\n');
	
	// arrival month
	document.write('<select name="rmonth" >\n');
	for (i = 1; i <= 12; i++){
	  if(month==i){
	    document.write('<option value=' + i + ' selected>' + months[i-1] + '</option>\n');
	  }else{
	    document.write('<option value=' + i + '>' + months[i-1] + '</option>\n');
	  }
	}
	document.write('</select>\n');
	
	// arrival year
	document.write('<select name="ryear" >\n');
	for (i = year; i <= (year + 5); i++){
	  if(year==i){
	    document.write('<option value=' + i + ' selected>' + i + '</option>\n');
	  }else{
	    document.write('<option value=' + i + '>' + i + '</option>\n');
	  }
	}
	document.write('</select>\n');
	
	document.write('</div>\n');
}


function longcalendar(months){

	document.write('<div class="calendar_form">\n');
	
	var d = new Date();
	d.setDate(d.getDate() + dday);
	var day=d.getDate(); 
	var month=d.getMonth() + 1;
	var year=d.getFullYear();
	
	// departure day
	document.write('<select name="dday">\n');
	for (i = 1; i <= 31; i++){
	  if(day==i){
	    document.write('<option value=' + i + ' selected>' + i + '</option>\n');
	  }else{
	    document.write('<option value=' + i + '>' + i + '</option>\n');
	  }
	}
	document.write('</select>\n');
	
	// departure month
	document.write('<select name="dmonth" >\n');
	for (i = 1; i <= 12; i++){
	  if(month==i){
	    document.write('<option value=' + i + ' selected>' + months[i-1] + '</option>\n');
	  }else{
	    document.write('<option value=' + i + '>' + months[i-1] + '</option>\n');
	  }
	}
	document.write('</select> \n');
	
	// departure year
	document.write('<select name="dyear" >\n');
	for (i = year; i <= (year + 5); i++){
	  if(year==i){
	    document.write('<option value=' + i + ' selected>' + i + '</option>\n');
	  }else{
	    document.write('<option value=' + i + '>' + i + '</option>\n');
	  }
	}
	document.write('</select> \n');

	// departure hour
	document.write('<select name="dhour" >\n');
	for (i = 0; i <= 23; i++){
	  if(i<10){
	    document.write('<option value=0' + i + ' selected>' + '0' + i + '</option>\n');
	  }else{
	    if (i==10) {
	      document.write('<option value=' + i + ' selected>' + i + '</option>\n');
	    }else {
		  document.write('<option value=' + i + '>' + i + '</option>\n');
	    }
	  }
	}
	document.write('</select> \n');
   document.write('<span class="ss-n">h</span>\n');

	// departure minute
	document.write('<select name="dminute" >\n');
	for (i = 0; i <= 50; i+=10){
	  if(i==0){
	    document.write('<option value=0' + i + ' selected>' + +'0' + i + '</option>\n');
	  }else{
	    document.write('<option value=' + i + '>' + i + '</option>\n');
	  }
	}
	
	
	document.write('</select><br>\n');
	
	
	// day + 7
	d = new Date();
	d.setDate(d.getDate() + rday);
	day=d.getDate();
	month=d.getMonth() + 1;
	year=d.getFullYear();
	
	// return day
	document.write('<select name="rday" >\n');
	for (i = 1; i <= 31; i++){
	  if(day==i){
	    document.write('<option value=' + i + ' selected>' + i + '</option>\n');
	  }else{
	    document.write('<option value=' + i + '>' + i + '</option>\n');
	  }
	}
	document.write('</select>\n');
	
	// return month
	document.write('<select name="rmonth" >\n');
	for (i = 1; i <= 12; i++){
	  if(month==i){
	    document.write('<option value=' + i + ' selected>' + months[i-1] + '</option>\n');
	  }else{
	    document.write('<option value=' + i + '>' + months[i-1] + '</option>\n');
	  }
	}
	document.write('</select>\n');
	
	// return year
	document.write('<select name="ryear" >\n');
	for (i = year; i <= (year + 5); i++){
	  if(year==i){
	    document.write('<option value=' + i + ' selected>' + i + '</option>\n');
	  }else{
	    document.write('<option value=' + i + '>' + i + '</option>\n');
	  }
	}
	document.write('</select>\n');

	// return  hour
	document.write('<select name="rhour" >\n');
	for (i = 0; i <= 23; i++){
	  if(i<10){
	    document.write('<option value=0' + i + ' selected>' + '0' + i + '</option>\n');
	  }else{
	    if (i==10) {
	      document.write('<option value=' + i + ' selected>' + i + '</option>\n');
	    }else {
		  document.write('<option value=' + i + '>' + i + '</option>\n');
	    }
	  }
	}
	document.write('</select>\n');
   document.write('<span class="ss-n">h</span>\n');

	// return minute
	document.write('<select name="rminute" >\n');
	for (i = 0; i <= 50; i+=10){
	  if(i==0){
	    document.write('<option value=0' + i + ' selected>' + +'0' + i + '</option>\n');
	  }else{
	    document.write('<option value=' + i + '>' + i + '</option>\n');
	  }
	}
	document.write('</select>\n');
	
	document.write('</div>\n');
}
function kk_holiday_currentYear() {
var now=new Date(); 
var year=now.getYear(); 
if(year<999) year+=1900;
return year;
}

// AJAX classes

/***** 
* function AJAX.insertHTML(DOMObject)	<- the DOM object where to put the HTML and it does the rest.
* function AJAX.SetCallback(callback, cas) <- 
* EXAMPLE:
* <script>
* // declaring the object with the url where to get the HTML
* ajax = new AJAX('./test.html');
* < / script >
* <!-- when clicking on the div, the url is called and replace the current HTML by the new one -->
* <div id="where_to_put" onClick="javascript:ajax.insertHTML( this );">
*   This should be replaced if you click here</div>
* <script language="javascript" type="text/javascript">
* // we could display a loading message in the div. Here we do a simple alert
* function loading() {
* 	alert('loading');
* }
* // and we link the function with the loading state
* ajax.SetCallback( loading , 0);
*
* // for managing errors, we link the following function ...
* function errorLoading() {
* 	alert('404 error');
* }
* // ... with the error state
* ajax.SetCallback( errorLoading, 2);
* < / script >
*****/
function kk_AJAX(Url) {
	// public	: how does the server expect the request ? (GET|POST|HEAD)
	this.requestMethod = 'GET';
	// public	: response of the server (when fully loaded, see method AJAX.SetCallback() )
	this.response = '';

	/**
	* public	: retrieving an XML response
	* for documentation on this object, see http://www.devguru.com/Technologies/xmldom/quickref/obj_httpRequest.html
	* callbackWhenOK	: the callback that will receive the responseXML object
	*/
	this.getXML = function(callbackWhenOK) {
		if(callbackWhenOK) {
			this.callbackXML = callbackWhenOK;
		}
		this.SetCallback(this.getXMLCallback, 1);
		this.Get(this.source);
	};

	/**
	* public	: retrieving teh text contained in a url
	* callbackWhenOK	: the callback that will receive the responseText object
	*/
	this.getText = function(callbackWhenOK) {
		if(callbackWhenOK) {
			this.callbackText = callbackWhenOK;
		}
		this.SetCallback(this.getTextCallback, 1);
		this.Get(this.source);
	};
	
	/**
	* public	: registers a callback, depending on the state of the connection
	* case 0	=> initializing and loading (happens many times)
	* case 1	=> the source is fully loaded
	* case 2	=> failure (404 ...)
	*/
	this.SetCallback = function(callback, cas) {
		if(cas > 2 || cas < 0) {
			return;
		}
		this.callbacks[cas].push(callback);
	};

	/**
	* public	: gets and inserts the text from the source at a given DOM object
	*/
	this.insertHTML = function(DOMObject) {
		this.DOMObject = DOMObject;
		//this.SetCallback(this.insertHTMLCallback, 1);
		this.getText(this.insertHTMLCallback);
	};

/******************************/

	// private	: location of the ressource
	this.source = Url;
	// private	: XMLHTTPRequest Object
	this.request = new Object;
	// private	: list of the callback
	this.callbacks = new Array(new Array(), new Array(), new Array());
	// private	: if needed, the pointer to the DOM object where the HTML will be written is stocked here
	this.DOMObject = new Object;
	// private	: if needed, stocks the callback waiting for an XML feed. Used by getXML()
	this.callbackXML = new Function;
	// private	: if needed, stocks the callback waiting for the responseText to be complete
	this.callbackText = new Function;

// trick for the callbacks function to access to this object
	var me = this;

	/**
	* private	: called when source is available. it puts the requested HTML at the given DOM object
	*/
	this.insertHTMLCallback = function(responseText) {
		me.DOMObject.innerHTML = responseText;
	};
	
	/**
	* private	: called when source is available. it calls back the registered callbackXML function
	*/
	this.getXMLCallback = function() {
		me.callbackXML(me.request.responseXML);
	};
	
	/**
	* private	: called when source is available.
	*/
	this.getTextCallback = function() {
		me.callbackText(me.request.responseText);
	};
	
	/**
	* private	: called when the readystate of the connection changes, then calls the registered callbacks (see method AJAX.SetCallback() )
	*/
	this.GetCallback = function() {
		// case OK (1)
		if (me.request.readyState == 4 && me.request.status == 200) {
			cas = 1;
			//alert('received headers :'+me.request.getAllResponseHeaders() );
		}
		// case failure (2)
		if (me.request.readyState == 4 && me.request.status != 200)
			cas = 2;
		// case loading (0)
		if (me.request.readyState < 4)
			cas = 0;
		//alert(me.callbacks[cas]);
		for(var i = 0; i < me.callbacks[cas].length; i++) {
			me.callbacks[cas][i](me.request);
		}
	};

	/**
	* private	: runs the XMLHttpRequest request, assigning private method GetCallback as callback
	*/
	this.Get = function( Url) {
		// code for Mozilla, etc.
		if (window.XMLHttpRequest) {
			this.request = new XMLHttpRequest();
			this.request.onreadystatechange = this.GetCallback;
			this.request.open(this.requestMethod, Url, true);
			this.request.send(null);
		} // code for IE
		else if (window.ActiveXObject) {
			this.request = new ActiveXObject("Microsoft.XMLHTTP");
			if (this.request) {
				this.request.onreadystatechange = this.GetCallback;
				this.request.open(this.requestMethod, Url, true);
				this.request.send();
			}
		}
	};
}

// Scripts to update the status bar of the shopbot
// from http://r6.kelkoo.com/scripts/rd/kk_updateShopbot_1-2.js
// These scripts enable to dynamically replace the content of the status bar elements.
// The use of document.getElementById to get the elements is supported since NS6 and IE5.

// update the status bar of the shopbot
// used with empty parameter to hide the status bar when no result
function kk_updateStatusBar() {
   if (eval(document.getElementById)) {
      var d = document.getElementById('statusBar');
      // Make sure the element exists
      if (d) {
         d.innerHTML = arguments[0];
      }
   }
}

// update the status of the search
// the parameter is the text of the status (eg "completed", "in progress", ...)
function kk_updateStatus() {
   if (eval(document.getElementById)) {
      var d = document.getElementById('currentStatus');
      // Make sure the element exists
      if (d) {
         d.innerHTML = arguments[0];
      }
   }
}

// update the counter of the status bar
// the parameter is the text giving the number of results (eg "10 results (of total 118) from 30 shops")
function kk_updateCounter() {
   if (eval(document.getElementById)) {
      var d = document.getElementById('counter');
      // Make sure the element exists
      if (d) {
         d.innerHTML = arguments[0];
      }
   }
}

function kk_updatePage(currentPage, totalPage) {
   if (eval(document.getElementById)) {
      for (i = currentPage + 1; i <= totalPage; i++) {
         var id = 'page' + i;
         var pageDiv = document.getElementById(id);
         if (pageDiv) {
            pageDiv.style.display = "inline";
         }
      }
      if (totalPage>currentPage)
      {
         var pageDiv = document.getElementById("nextpage");
         if (pageDiv) {
            pageDiv.style.display = "inline";
         }
      }
   }
}

//script to update the label Infos site in Infos 'merchant_name'
function kk_showMerchantName(m){
        document.getElementById("newName_" + m).innerHTML=document.getElementById("layer_m_" + m).innerHTML;
}

function kk_hideMerchantName(m,v){
	setTimeout("kk_realHideMerchantName(\""+ m +"\",\""+ v +"\")",2000);
}
function kk_realHideMerchantName(m,v){
        document.getElementById("newName_" + m).innerHTML=v;
}


/* File: trv-results.js */

/// from http://r6.kelkoo.com/scripts/rd/kk_travel_1-3.js
var date_start = new Date();
var timer;
var standPopup_travel = 5000;
var noResult = 0;

function kk_openTravelWaitingPopup(widthPopup, heightPopup, topPopup, standPopup_choosed, leftPopup) {
if (topPopup == null) {
widthPopup=400;
heightPopup=270;
topPopup=350;
standPopup_choosed=5000;
}

date_start = new Date();
clearTimeout(timer);
standPopup_travel = standPopup_choosed;

var url = window.location.href;
var reg = new RegExp("page=|sort\?","g");
if (!url.match(reg)) {    	
if (leftPopup == null){
larg_total = (document.body.clientWidth - widthPopup);
larg = (larg_total / 2);
}
else {
larg = leftPopup;
}
document.write('<table><tr align="center"><td><div id="travelWait">');
document.write('<iframe width="'+widthPopup+'px" height="'+heightPopup+'px" name="waitSearch" ID="waitSearch"  src="/ctl/do/popup?url=/WEB-INF/jsp/shopbot/shared/waitingFrame.jsp" align="middle" frameborder=0  position="absolute" scrolling=no rightmargin=0 marginwidth=0 marginheight=0 leftmargin=0 topmargin=0 bottommargin=0 z-index="10" allowTransparency="true"> </iframe>');
document.write('</div></td></tr></table>');
document.write('<script language="javascript">');
document.write(' document.getElementById("waitSearch").style.display = "inline";');
document.write(' document.getElementById("waitSearch").style.position = "absolute";');
document.write(' document.getElementById("waitSearch").style.left = "'+larg+'px";');
document.write(' document.getElementById("waitSearch").style.top = "'+topPopup+'px";');
document.write(' document.getElementById("waitSearch").style.width="'+widthPopup+'px"; ');
document.write(' document.getElementById("waitSearch").style.height="'+heightPopup+'px"; ');
document.write('</script>');
}
}


function kk_closeWaitingPopup() {
var mill = new Date();
var diff = mill - date_start;
var waitSearch = document.getElementById("waitSearch");
if( waitSearch ) {
	if ( (diff > standPopup_travel) || (noResult == 1) ) {
	document.getElementById("waitSearch").style.display = "none";
	}
	else {
	timer = setTimeout('document.getElementById("waitSearch").style.display = "none";',standPopup_travel);
	}
}
}


/*
 * Close waiting pop up to trip planner
 */
function kk_closeWaitingPopup2() {
	//alert("kk_closeWaitingPopup2");
	var mill = new Date();
	var diff = mill - date_start;
	if ( (diff > standPopup_travel) ) {
		kk_hiddeWaitingPopup2();
	}
	else {
		timer = setTimeout(kk_hiddeWaitingPopup2,standPopup_travel);
	}
}

function kk_hiddeWaitingPopup2() {
	//alert("kk_hiddeWaitingPopup2");
	var popup = parent.document.getElementById("waitSearch");
	if (popup) {
		popup.style.display = "none";
	}
	var iFrameCache = parent.document.getElementById("iFrameCache");
	//alert(iFrameCache);
	if ( iFrameCache ) {
		iFrameCache.style.display = "none";
	}
}



function kk_closeIntersticiel() { 
var mill = new Date();
var diff = mill - date_start;
var waitSearch = document.getElementById("waitSearch");
if(waitSearch) {
	if( diff > standPopup_travel ) {
	document.getElementById("waitSearch").style.display = "none";
	}
	else {
	timer =  setTimeout('document.getElementById("waitSearch").style.display = "none";',standPopup_travel);
	}
}
}

function kk_closeWaitingPage() {
var mill = new Date();
var diff = mill - date_start;
var waitSearch = document.getElementById("waitSearch");
if(waitSearch) {
	if( diff > standPopup_travel ) {
	document.getElementById("waitSearch").style.display = "none";
	}
	else {
	timer =  setTimeout('document.getElementById("waitSearch").style.display = "none";',standPopup_travel);
	}
}
}

function kk_closePopupNoResult() {
noResult = 1;
}

var date_start = new Date();
var timer;
var standPopup_travel = 5000;
var noResult = 0;

 

function openTravelWaitingPopup(widthPopup, heightPopup, topPopup, standPopup_choosed, leftPopup)
{
  if (topPopup == null) {
    widthPopup=400;
    heightPopup=270;
    topPopup=350;
    standPopup_choosed=5000;
  }

date_start = new Date();
clearTimeout(timer);
 standPopup_travel = standPopup_choosed;

var url = window.location.href;
var reg = new RegExp("page=|sort\?","g");
if (!url.match(reg))
{    	

	
  if (leftPopup == null){
    larg_total = (document.body.clientWidth - widthPopup);
    larg = (larg_total / 2);
  }else{
    larg = leftPopup;
  }

document.write('<table><tr align="center"><td><div id="travelWait">');
  document.write('<iframe width="'+widthPopup+'px" height="'+heightPopup+'px" name="waitSearch" ID="waitSearch"  src="/ctl/do/popup?url=/WEB-INF/jsp/shopbot/shared/waitingFrame.jsp" align="middle" frameborder=0  position="absolute" scrolling=no rightmargin=0 marginwidth=0 marginheight=0 leftmargin=0 topmargin=0 bottommargin=0 z-index="10" allowTransparency="true"> </iframe>');

  document.write('</div></td></tr></table>');
  document.write('<script language="javascript">');
  document.write(' document.getElementById("waitSearch").style.display = "inline";');
  document.write(' document.getElementById("waitSearch").style.position = "absolute";');
  document.write(' document.getElementById("waitSearch").style.left = "'+larg+'px";');
  document.write(' document.getElementById("waitSearch").style.top = "'+topPopup+'px";');
  document.write(' document.getElementById("waitSearch").style.width="'+widthPopup+'px"; ');
  document.write(' document.getElementById("waitSearch").style.height="'+heightPopup+'px"; ');
  document.write('</script>');
}
}


function closeWaitingPopup()
{
    var mill = new Date();
    var diff = mill - date_start;
	var waitSearch = document.getElementById("waitSearch");
	if(waitSearch) {
		if ( (diff > standPopup_travel) || (noResult == 1) ) {
		  document.getElementById("waitSearch").style.display = "none";
		}else{
		  timer = setTimeout('document.getElementById("waitSearch").style.display = "none";',standPopup_travel);
		}
	}
}


function closeIntersticiel()
{ 
  var mill = new Date();
  var diff = mill - date_start;
  var waitSearch = document.getElementById("waitSearch");
  if(waitSearch) {
	if( diff > standPopup_travel ) {
	waitSearch.style.display = "none";
	}else{
	timer =  setTimeout('document.getElementById("waitSearch").style.display = "none";',standPopup_travel);
	}
  }
}


function closeWaitingPage()
{
  var mill = new Date();
  var diff = mill - date_start;
  var waitSearch = document.getElementById("waitSearch");
  if(waitSearch) {
	if( diff > standPopup_travel ) {
	   waitSearch.style.display = "none";
	}else{
   	   timer =  setTimeout('document.getElementById("waitSearch").style.display = "none";',standPopup_travel);
  	}
  }
}


function closePopupNoResult()
{
  noResult = 1;
}


// http://www.kelkoo.co.uk/scripts/rd/kk_popup3_1-2-14-1.js
// Displays the page given by a splitted URL
function kk_afficheCommande2()
{
    w = (document.all ? screen.width : screen.width) * 0.9;
    h = (document.all ? screen.height : screen.height-150) * 0.9;
    op = 'scrollbars=yes,toolbar=yes,location=yes,directories=yes,menubar=yes,resizable=yes,status=yes,width=' + w + ',height=' + h + ',screenX=0,screenY=0,top=0,left=0';
    var url = kk_recomposeUrl(kk_afficheCommande2.arguments);
    com=open(url,'',op);
}

function kk_recomposeUrl()
{
    var args = arguments[0];

    var absolute = args[0];
    var url = '';
    var startingIndex = 1;

    var sep = '/';
    var middle = '?';

    if (absolute && args.length > 1) {
        // absolute not-empty url, first element is the protocol
    	url = args[1] + ':' + sep;
	startingIndex++;
    }

    // Test if argument 2 already contains a ?
    var isPartialURL = false;
    var arg2 = args[1];
    if (arg2.indexOf('?') != -1) {
	isPartialURL = true;
    }

    var firstElem = true;
    for (i = startingIndex; i < args.length; i++)
    {
	if (args[i] == middle) {
      	    // Starting the query string
      	    i++;
      	    if (i < args.length) {
            	// if query string not empty
            	url += middle + args[i];
            	sep = '&';
      	    }
   	} else {
            // Simply concatenate the argument
	    if (!isPartialURL) {
		url += sep + args[i];
	    } else {
		if (firstElem) {
		    url += args[i];
		    firstElem = false;
		    // Bug #1158751: add "&addedParams=true" to the first argument, mandatory to validate the signature of shopbot URLs
                    url += "&addedParams=true";
		} else {
		    url += '&' + args[i];
		}
 	    }
   	}
    }
    return url;
}

/* from kk_productSearch_flight.js */
function kk_validate(textbox, msg){
  txt=textbox.value;
  if (txt=="") {
   alert(msg);
   textbox.focus();
   return false;
  }
  return true;
}

function kk_buy(form){
  if(kk_ctrlPSForm(form)){
    form.mode.value='buy';
    form.target='_blank';
    form.submit();
    form.onsubmit = kk_f1;
  }
}

function kk_compare(form){
  if(kk_ctrlPSForm(form)){
    form.mode.value='compare';
    form.target='_self';
    form.submit();
    form.onsubmit = kk_f1;
  }
}

function kk_f1() {
  return false;
}

function kk_ctrlPSForm(form)
{
  selectedDepDay = form.dday.options[form.dday.selectedIndex].value;
  selectedDepMonth = form.dmonth.options[form.dmonth.selectedIndex].value;
  selectedDepYear = form.dyear.options[form.dyear.selectedIndex].value;

  if (form.rday.value!="") {
  selectedRetDay = form.rday.options[form.rday.selectedIndex].value;
  selectedRetMonth = form.rmonth.options[form.rmonth.selectedIndex].value;
  selectedRetYear = form.ryear.options[form.ryear.selectedIndex].value;
  }
  else
  {
  selectedRetDay = selectedDepDay;
  selectedRetMonth = selectedDepMonth;
  selectedRetYear = selectedDepYear;
  }
  selectedDepDate = new Date(selectedDepYear, selectedDepMonth -1, selectedDepDay);
  selectedRetDate = new Date(selectedRetYear, selectedRetMonth -1, selectedRetDay);

  today = new Date();
  tableJJ=[31,29,31,30,31,30,31,31,30,31,30,31];

  //check if dates are correct (if not selected from calendar)
  if (selectedDepDay>tableJJ[selectedDepMonth-1] || (true && selectedRetDay>tableJJ[selectedRetMonth-1]))
  {
    alert (jsalert1);
    return false;
  }

 selectedDepTime=selectedDepDate.getTime() + 24*3600*1000;   
 selectedRetTime=selectedRetDate.getTime() + 24*3600*1000;

  //check if departure date is correct
  if (today.getTime() > selectedDepTime ||  ((today.getTime() > selectedRetTime ) && true   ))

  {
    alert (jsalert2);
    return false;
  }

  //check if departure date < arival date
  if ( ( selectedRetTime  <  selectedDepTime ) && (true) )
  {
    alert (jsalert3);
    return false;
  }

  return true;
}


function kk_PSsetMonth(form) {
if (typeof(form.rday)!="undefined") {form.rmonth.selectedIndex=form.dmonth.selectedIndex;}
}

function kk_PSsetYear(form) {
if (typeof(form.rday)!="undefined") {form.ryear.selectedIndex=form.dyear.selectedIndex;}
}


function kk_calendar(months){

	document.write('<div class="calendar_form">\n');
	
	var d = new Date();
	d.setDate(d.getDate() + dday);
	var day=d.getDate() ;
	var month=d.getMonth() + 1;
	var year=d.getFullYear();
	
	// departure day
	document.write('<select name="dday">\n');
	for (i = 1; i <= 31; i++){
	  if(day==i){
	    document.write('<option value=' + i + ' selected>' + i + '</option>\n');
	  }else{
	    document.write('<option value=' + i + '>' + i + '</option>\n');
	  }
	}
	document.write('</select>\n');
	
	// departure month
	document.write('<select name="dmonth" >\n');
	for (i = 1; i <= 12; i++){
	  if(month==i){
	    document.write('<option value=' + i + ' selected>' + months[i-1] + '</option>\n');
	  }else{
	    document.write('<option value=' + i + '>' + months[i-1] + '</option>\n');
	  }
	}
	document.write('</select> \n');
	
	// departure year
	document.write('<select name="dyear" >\n');
	for (i = year; i <= (year + 5); i++){
	  if(year==i){
	    document.write('<option value=' + i + ' selected>' + i + '</option>\n');
	  }else{
	    document.write('<option value=' + i + '>' + i + '</option>\n');
	  }
	}
	document.write('</select><br>\n');
	
	
	// day + 7
	d = new Date();
	d.setDate(d.getDate() + rday);
	day=d.getDate();
	month=d.getMonth() + 1;
	year=d.getFullYear();
	
	// arrival day
	document.write('<select name="rday" >\n');
	for (i = 1; i <= 31; i++){
	  if(day==i){
	    document.write('<option value=' + i + ' selected>' + i + '</option>\n');
	  }else{
	    document.write('<option value=' + i + '>' + i + '</option>\n');
	  }
	}
	document.write('</select>\n');
	
	// arrival month
	document.write('<select name="rmonth" >\n');
	for (i = 1; i <= 12; i++){
	  if(month==i){
	    document.write('<option value=' + i + ' selected>' + months[i-1] + '</option>\n');
	  }else{
	    document.write('<option value=' + i + '>' + months[i-1] + '</option>\n');
	  }
	}
	document.write('</select>\n');
	
	// arrival year
	document.write('<select name="ryear" >\n');
	for (i = year; i <= (year + 5); i++){
	  if(year==i){
	    document.write('<option value=' + i + ' selected>' + i + '</option>\n');
	  }else{
	    document.write('<option value=' + i + '>' + i + '</option>\n');
	  }
	}
	document.write('</select>\n');
	
	document.write('</div>\n');
}


function kk_longcalendar(months){

	document.write('<div class="calendar_form">\n');
	
	var d = new Date();
	d.setDate(d.getDate() + dday);
	var day=d.getDate() ;
	var month=d.getMonth() + 1;
	var year=d.getFullYear();
	
	// departure day;
	document.write('<select name="dday">\n');
	for (i = 1; i <= 31; i++){
	  if(day==i){
	    document.write('<option value=' + i + ' selected>' + i + '</option>\n');
	  }else{
	    document.write('<option value=' + i + '>' + i + '</option>\n');
	  }
	}
	document.write('</select>\n');
	
	// departure month
	document.write('<select name="dmonth" >\n');
	for (i = 1; i <= 12; i++){
	  if(month==i){
	    document.write('<option value=' + i + ' selected>' + months[i-1] + '</option>\n');
	  }else{
	    document.write('<option value=' + i + '>' + months[i-1] + '</option>\n');
	  }
	}
	document.write('</select> \n');
	
	// departure year
	document.write('<select name="dyear" >\n');
	for (i = year; i <= (year + 5); i++){
	  if(year==i){
	    document.write('<option value=' + i + ' selected>' + i + '</option>\n');
	  }else{
	    document.write('<option value=' + i + '>' + i + '</option>\n');
	  }
	}
	document.write('</select> \n');

	// departure hour
	document.write('<select name="dhour" >\n');
	for (i = 0; i <= 23; i++){
	  if(i<10){
	    document.write('<option value=0' + i + ' selected>' + '0' + i + '</option>\n');
	  }else{
	    if (i==10) {
	      document.write('<option value=' + i + ' selected>' + i + '</option>\n');
	    }else {
		  document.write('<option value=' + i + '>' + i + '</option>\n');
	    }
	  }
	}
	document.write('</select> \n');
        document.write('<span class="ss-n">h</span>\n');

	// departure minute
	document.write('<select name="dminute" >\n');
	for (i = 0; i <= 50; i+=10){
	  if(i==0){
	    document.write('<option value=0' + i + ' selected>' + +'0' + i + '</option>\n');
	  }else{
	    document.write('<option value=' + i + '>' + i + '</option>\n');
	  }
	}
	
	
	document.write('</select><br>\n');
	
	
	// day + 7
	d = new Date();
	d.setDate(d.getDate() + rday);
	day=d.getDate();
	month=d.getMonth() + 1;
	year=d.getFullYear();
	
	// return day
	document.write('<select name="rday" >\n');
	for (i = 1; i <= 31; i++){
	  if(day==i){
	    document.write('<option value=' + i + ' selected>' + i + '</option>\n');
	  }else{
	    document.write('<option value=' + i + '>' + i + '</option>\n');
	  }
	}
	document.write('</select>\n');
	
	// return month
	document.write('<select name="rmonth" >\n');
	for (i = 1; i <= 12; i++){
	  if(month==i){
	    document.write('<option value=' + i + ' selected>' + months[i-1] + '</option>\n');
	  }else{
	    document.write('<option value=' + i + '>' + months[i-1] + '</option>\n');
	  }
	}
	document.write('</select>\n');
	
	// return year
	document.write('<select name="ryear" >\n');
	for (i = year; i <= (year + 5); i++){
	  if(year==i){
	    document.write('<option value=' + i + ' selected>' + i + '</option>\n');
	  }else{
	    document.write('<option value=' + i + '>' + i + '</option>\n');
	  }
	}
	document.write('</select>\n');

	// return  hour
	document.write('<select name="rhour" >\n');
	for (i = 0; i <= 23; i++){
	  if(i<10){
	    document.write('<option value=0' + i + ' selected>' + '0' + i + '</option>\n');
	  }else{
	    if (i==10) {
	      document.write('<option value=' + i + ' selected>' + i + '</option>\n');
	    }else {
		  document.write('<option value=' + i + '>' + i + '</option>\n');
	    }
	  }
	}
	document.write('</select>\n');
        document.write('<span class="ss-n">h</span>\n');

	// return minute
	document.write('<select name="rminute" >\n');
	for (i = 0; i <= 50; i+=10){
	  if(i==0){
	    document.write('<option value=0' + i + ' selected>' + +'0' + i + '</option>\n');
	  }else{
	    document.write('<option value=' + i + '>' + i + '</option>\n');
	  }
	}
	document.write('</select>\n');
	
	document.write('</div>\n');
}
/* progress bar on live cat results*/
var kk_trv_wait = {
	// manages the loading bar animation (start|stop|null)
	progressing: function(moment,message){
		if(moment == 'start') {
			iPos= 0;
			oMover = document.getElementById("mover");
			iMoverId = setInterval("kk_trv_wait.progressing()",50);
		} else if(moment == 'stop'){
			clearInterval(iMoverId);
			oLoadingAnim.style.display="none";
			oLoadingAnim.style.border="0";
			oLoadStatus=document.getElementById('loading-animation-progress');
			oLoadStatus.style.textAlign="left";
			oLoadStatus.innerHTML=message;
			
		} else {
			if(++iPos>29)
				iPos=0;
			oMover.style.left=(iPos-60)+'px';
		}
	},	

	// used to manage the loading animation (moment = start|stop|force )
	kk_loading_animation: function (moment) {
		if(!oSettings.bDisplayLoading)
			return;
		
		var SFD_position = ygPos.getPos(oLoadingAnim);
		if(moment == 'start') {
			kk_trv_wait.progressing('start');
			ygPos.setPos(oLoadingAnim, SFD_position );
			var oAnim = new ygAnim_Fade(oLoadingAnim, 0.6, 0.9);
			oAnim.animate();
		} else if(moment == 'stop' || moment == 'force') {
			if(!state_search_button || moment == 'force') {
				var oAnim = new ygAnim_Fade(oLoadingAnim, 0.4, 0);
				oAnim.onComplete = function() {
						ygPos.setPos(oDomRef, [-1000 , SFD_position[1] ]);
						if(document.hacking_iframe != false) {
							ygPos.setPos(document.hacking_iframe, [-1000 , SFD_position[1] ]);
						}
					};
				oAnim.animate();
				kk_trv_wait.progressing('stop');
			}
		}
	}
};



/* File: links.js */


function uxViewLink(sBase64,bOpenInPopup){var sUrl=uxDecode64(sBase64);uxViewDecodedLink(sUrl,bOpenInPopup);}
function uxViewDecodedLink(sUrl,bOpenInPopup){if(bOpenInPopup){var op='scrollbars=yes,toolbar=yes,location=yes,directories=yes,menubar=yes,resizable=yes,status=yes,width=800,height=500';window.open(sUrl,'',op);}else{window.location.href=sUrl;}}
function uxDecode64(sBase64){var kk_keyStr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";var chr1,chr2,chr3,enc1,enc2,enc3,enc4;var output='';var i=0;sBase64=sBase64.replace(/-/g,'+').replace(/_/g,'=').replace(/\./g,'/');if(sBase64.match('/[^A-Za-z0-9\+\\/\=]/'))return'';do{enc1=kk_keyStr.indexOf(sBase64.charAt(i++));enc2=kk_keyStr.indexOf(sBase64.charAt(i++));enc3=kk_keyStr.indexOf(sBase64.charAt(i++));enc4=kk_keyStr.indexOf(sBase64.charAt(i++));chr1=(enc1<<2)|(enc2>>4);chr2=((enc2&15)<<4)|(enc3>>2);chr3=((enc3&3)<<6)|enc4;output+=String.fromCharCode(chr1);if(enc3!=64){output+=String.fromCharCode(chr2);}
if(enc4!=64){output+=String.fromCharCode(chr3);}
chr1=chr2=chr3=enc1=enc2=enc3=enc4='';}while(i<sBase64.length);return output;}
function uxStoreRefererCookie(){var sUrl=unescape(document.location.href);YAHOO.EU.Shopping.cookie.set('Referer',sUrl,1);}
function uxTrvVisit(sProductId){var form=YAHOO.util.Dom.get('lvl-form-'+sProductId);if(YAHOO.lang.isObject(form)){if(YAHOO.lang.isObject(form['mode'])){form['mode'].value='buy';}
if((arguments.length>1)&&arguments[1]){form.target='_blank';}
YAHOO.EU.Shopping.Results.validateDateForm(null,form);}}
function kk_link(sUrl){uxViewLink(sUrl);}
function kk_link3(sUrl){uxViewLink(sUrl);}
function kk_afficheCommande3(sUrl){uxViewLink(sUrl,true);}
function kk_afficheCommande(sUrl){uxViewDecodedLink(sUrl,true);}
function kk_go3(sUrl){uxViewLink(sUrl);}
function kk_viewMerchant3(sUrl){uxViewLink(sUrl,true);}
function addBookmark(){var bookmarkURL=window.document.URL;var bookmarkTitle=window.document.title;if(window.ActiveXObject){window.external.AddFavorite(bookmarkURL,bookmarkTitle);}else if(navigator.userAgent.indexOf('Opera')!=-1){alert(YAHOO.EU.Shopping.locale.bookmarkMsg.replace(/\{0\}/,"CTRL + T"));}else{alert(YAHOO.EU.Shopping.locale.bookmarkMsg.replace(/\{0\}/,"CTRL + D"));}}

/* File: suggestAsYouType.js */


YAHOO.namespace('YAHOO.EU.Shopping.Utils');YAHOO.EU.Shopping.Utils.SuggestAsYouType={currentValue:0,startsFrom:YAHOO.EU.Shopping.config.suggestAsYouType.startsFrom,minimumFrom:YAHOO.EU.Shopping.config.suggestAsYouType.minimumFrom,init:function(sInputName,sContainerName){if(YAHOO.util.Dom.get(sContainerName)===null&&document.getElementById("product-overlay")!==null){var elSuggestContainer=document.createElement("div");elSuggestContainer.id=sContainerName;document.getElementById("product-overlay").appendChild(elSuggestContainer);YAHOO.util.Dom.addClass(elSuggestContainer,"sContainer");YAHOO.util.Dom.addClass(elSuggestContainer,"hide");}
if(YAHOO.EU.Shopping.config.suggestAsYouType.isActivated&&YAHOO.util.Dom.get(sInputName)&&YAHOO.util.Dom.get(sContainerName)){try{YAHOO.util.Event.purgeElement(sInputName);this.oACDS=new YAHOO.widget.DS_XHR("/ctl/do/asyncCall/suggest-as-you-type",["searchResult.result","label"]);this.oACDS.queryMatchContains=true;this.oACDS.scriptQueryAppend="output=json";this.oAutoComp=new YAHOO.widget.AutoComplete(sInputName,sContainerName,this.oACDS);this.oAutoComp.autoHighlight=false;this.oAutoComp.maxResultsDisplayed=20;this.oAutoComp.queryDelay=0.3;if(!isNaN(parseFloat(YAHOO.EU.Shopping.config.suggestAsYouType.sendDelay))){this.oAutoComp.queryDelay=YAHOO.EU.Shopping.config.suggestAsYouType.sendDelay;}
this.oAutoComp.minQueryLength=YAHOO.EU.Shopping.Utils.SuggestAsYouType.minimumFrom;this.oAutoComp.sInputName=sInputName;this.oAutoComp.sContainerName=sContainerName;this.oAutoComp.setHeader("<span id=\"sClose\" class=\"sClose\">"+YAHOO.EU.Shopping.locale.suggestClose+"</span>");this.oAutoComp.setFooter("<span class=\"sSuggestions\">"+YAHOO.EU.Shopping.locale.suggestSuggestion+"</span>");this.oAutoComp.formatResult=function(oResultItem,sQuery){if(sQuery){var lowerQuery=removeAccents(sQuery.toLowerCase());var lowerQuerySplitted=lowerQuery.split(" ");var resultItem=removeAccents(oResultItem[1].label.toLowerCase());var resultItemSplitted=resultItem.split(" ");var finalResult="";for(var i=0;i<lowerQuerySplitted.length;i++){for(var j=0;j<resultItemSplitted.length;j++){var reg=new RegExp("^"+lowerQuerySplitted[i]);if(reg.test(resultItemSplitted[j])){resultItemSplitted[j]=resultItemSplitted[j].replace(lowerQuerySplitted[i],"<SPAN class=\"sHighlighted\">"+lowerQuerySplitted[i]+"</SPAN>");}}}
for(var j=0;j<resultItemSplitted.length;j++){finalResult+=resultItemSplitted[j]+" ";}
return finalResult;}
else{return oResultItem[1].label;}};this.oAutoComp.doBeforeExpandContainer=function(oTextbox,oContainer,sQuery,aResults){containerShow(null,null,{sContainerName:oContainer});var pos=YAHOO.util.Dom.getXY(oTextbox);if(navigator.appName.toLowerCase().indexOf('netscape')!==-1){pos[0]=pos[0]+1;}
pos[1]+=YAHOO.util.Dom.get(oTextbox).offsetHeight+2;YAHOO.util.Dom.setXY(oContainer,pos);return true;};var updateQueryInput=function(e,query,o){if(YAHOO.util.Dom.get(o.sInputName)!==null){YAHOO.util.Dom.get(o.sInputName).value=removeAccents(YAHOO.util.Dom.get(o.sInputName).value);}};var removeAccents=function(str){if(str!==null){str=str.replace(/[áàâäåÁÀÄÂÅ]/gi,"a");str=str.replace(/[éèêëÉÈÊË]/gi,"e");str=str.replace(/[íîïÍÏÎ]/gi,"i");str=str.replace(/[óòôöøÓÒÖÔØ]/gi,"o");str=str.replace(/[úùûüÚÙÜÛ]/gi,"u");str=str.replace(/[ñÑ]/gi,"n");str=str.replace(/[çÇ]/gi,"c");str=str.replace(/[ÿ]/gi,"y");str=str.replace(/[æÆ]/gi,"ae");}
return str;}
var containerHide=function(e,a,o){YAHOO.util.Dom.addClass(o.sContainerName,"hide");};var containerShow=function(e,a,o){YAHOO.util.Dom.removeClass(o.sContainerName,"hide");};var containerForceHide=function(e,o){if(o.oAutoComp.containerCollapseEvent){o.oAutoComp.containerCollapseEvent.fire();}}
var containerClose=function(e,oAutoComp){var sInputName=oAutoComp.sInputName;var sContainerName=oAutoComp.sContainerName;if(oAutoComp.containerCollapseEvent){oAutoComp.containerCollapseEvent.fire();}
oAutoComp.destroy();YAHOO.util.Event.addListener(sInputName,"keyup",YAHOO.EU.Shopping.Utils.SuggestAsYouType.resetSuggest,{sInputName:sInputName,sContainerName:sContainerName});YAHOO.util.Dom.get(sInputName).focus();};var setSuggestFlag=function(e,a,o){if(o.oAutoComp.containerCollapseEvent){o.oAutoComp.containerCollapseEvent.fire();}
if((searchForm=YAHOO.util.Dom.get("search"))!==null&&YAHOO.util.Dom.get("suggest")===null){var elSuggestFlag=document.createElement("input");elSuggestFlag.type="hidden";elSuggestFlag.id="suggest";elSuggestFlag.name="suggest";elSuggestFlag.value="true";searchForm.appendChild(elSuggestFlag);}
YAHOO.util.Dom.get("search").submit();};this.oAutoComp.containerCollapseEvent.subscribe(containerHide,{sContainerName:this.oAutoComp.sContainerName});this.oAutoComp.containerExpandEvent.subscribe(containerShow,{sContainerName:this.oAutoComp.sContainerName});this.oAutoComp.containerCollapseEvent.subscribe(YAHOO.EU.Shopping.Utils.SuggestAsYouType.resetSuggestFlag);this.oAutoComp.itemSelectEvent.subscribe(setSuggestFlag,{sContainerName:this.oAutoComp.sContainerName,oAutoComp:this.oAutoComp});YAHOO.util.Event.removeListener(this.oAutoComp.sInputName,"keyup");YAHOO.util.Event.addListener(this.oAutoComp.sInputName,"keyup",YAHOO.EU.Shopping.Utils.SuggestAsYouType.updateAutocomplete,{sInputName:this.oAutoComp.sInputName,oAutoComp:this.oAutoComp});YAHOO.util.Event.addListener(this.oAutoComp.sInputName,"keyup",YAHOO.EU.Shopping.Utils.SuggestAsYouType.reset,{sInputName:this.oAutoComp.sInputName,oAutoComp:this.oAutoComp});YAHOO.util.Event.addListener(this.oAutoComp.sContainerName,"blur",containerForceHide,{sContainerName:this.oAutoComp.sContainerName,oAutoComp:this.oAutoComp});if((searchForm=YAHOO.util.Dom.get("search"))!==null){YAHOO.util.Event.addListener("search","submit",containerForceHide,{sContainerName:this.oAutoComp.sContainerName,oAutoComp:this.oAutoComp});}
YAHOO.util.Event.addListener("sClose","click",containerClose,this.oAutoComp);}
catch(exception){YAHOO.log("Exception :"+exception);}}},updateAutocomplete:function(e,o){var sInput=YAHOO.util.Dom.get(o.sInputName);var sInputPreviousLength=0,sInputNextLength=0;if(sInput!==null&&sInput.value!==""){sInputPreviousLength=YAHOO.EU.Shopping.Utils.SuggestAsYouType.currentValue;YAHOO.EU.Shopping.Utils.SuggestAsYouType.currentValue=sInputNextLength=sInput.value.length;if(((sInputPreviousLength<sInputNextLength&&sInputNextLength>=(YAHOO.EU.Shopping.Utils.SuggestAsYouType.startsFrom)))||((navigator.appName.toLowerCase().indexOf('netscape')==-1))&&((sInputPreviousLength<sInputNextLength&&sInputNextLength>=(YAHOO.EU.Shopping.Utils.SuggestAsYouType.startsFrom-1)))){YAHOO.util.Event.removeListener(o.sInputName,"keyup");YAHOO.util.Event.addListener(o.sInputName,"keyup",YAHOO.widget.AutoComplete.prototype._onTextboxKeyUp,o.oAutoComp);YAHOO.util.Event.addListener(o.sInputName,"keyup",YAHOO.EU.Shopping.Utils.SuggestAsYouType.reset,{sInputName:o.sInputName,oAutoComp:o.oAutoComp});o.oAutoComp.textboxKeyEvent.fire(o.oAutoComp,"keyup");}}},reset:function(e,o){if(YAHOO.util.Dom.get(o.sInputName).value===""){YAHOO.EU.Shopping.Utils.SuggestAsYouType.currentValue=0;YAHOO.util.Event.removeListener(o.sInputName,"keyup");YAHOO.util.Event.addListener(o.sInputName,"keyup",YAHOO.EU.Shopping.Utils.SuggestAsYouType.updateAutocomplete,{sInputName:o.sInputName,oAutoComp:o.oAutoComp});YAHOO.util.Event.addListener(o.sInputName,"keyup",YAHOO.EU.Shopping.Utils.SuggestAsYouType.reset,{sInputName:o.sInputName,oAutoComp:o.oAutoComp});}},resetSuggest:function(e,o){if(YAHOO.util.Dom.get(o.sInputName).value===""){YAHOO.EU.Shopping.Utils.SuggestAsYouType.resetSuggestFlag();YAHOO.EU.Shopping.Utils.SuggestAsYouType.currentValue=0;YAHOO.EU.Shopping.Utils.SuggestAsYouType.init(o.sInputName,o.sContainerName);}},resetSuggestFlag:function(){if((searchForm=YAHOO.util.Dom.get("search"))!==null&&(suggestFlag=YAHOO.util.Dom.get("suggest"))!==null){searchForm.removeChild(suggestFlag);}}}