;
/* AGGREGATED JS FILE: misc/jquery.js */
/*
 * jQuery 1.2.6 - New Wave Javascript
 *
 * Copyright (c) 2008 John Resig (jquery.com)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * $Date: 2008-05-24 14:22:17 -0400 (Sat, 24 May 2008) $
 * $Rev: 5685 $
 */
(function(){var _jQuery=window.jQuery,_$=window.$;var jQuery=window.jQuery=window.$=function(selector,context){return new jQuery.fn.init(selector,context);};var quickExpr=/^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/,isSimple=/^.[^:#\[\.]*$/,undefined;jQuery.fn=jQuery.prototype={init:function(selector,context){selector=selector||document;if(selector.nodeType){this[0]=selector;this.length=1;return this;}if(typeof selector=="string"){var match=quickExpr.exec(selector);if(match&&(match[1]||!context)){if(match[1])selector=jQuery.clean([match[1]],context);else{var elem=document.getElementById(match[3]);if(elem){if(elem.id!=match[3])return jQuery().find(selector);return jQuery(elem);}selector=[];}}else
return jQuery(context).find(selector);}else if(jQuery.isFunction(selector))return jQuery(document)[jQuery.fn.ready?"ready":"load"](selector);return this.setArray(jQuery.makeArray(selector));},jquery:"1.2.6",size:function(){return this.length;},length:0,get:function(num){return num==undefined?jQuery.makeArray(this):this[num];},pushStack:function(elems){var ret=jQuery(elems);ret.prevObject=this;return ret;},setArray:function(elems){this.length=0;Array.prototype.push.apply(this,elems);return this;},each:function(callback,args){return jQuery.each(this,callback,args);},index:function(elem){var ret=-1;return jQuery.inArray(elem&&elem.jquery?elem[0]:elem,this);},attr:function(name,value,type){var options=name;if(name.constructor==String)if(value===undefined)return this[0]&&jQuery[type||"attr"](this[0],name);else{options={};options[name]=value;}return this.each(function(i){for(name in options)jQuery.attr(type?this.style:this,name,jQuery.prop(this,options[name],type,i,name));});},css:function(key,value){if((key=='width'||key=='height')&&parseFloat(value)<0)value=undefined;return this.attr(key,value,"curCSS");},text:function(text){if(typeof text!="object"&&text!=null)return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(text));var ret="";jQuery.each(text||this,function(){jQuery.each(this.childNodes,function(){if(this.nodeType!=8)ret+=this.nodeType!=1?this.nodeValue:jQuery.fn.text([this]);});});return ret;},wrapAll:function(html){if(this[0])jQuery(html,this[0].ownerDocument).clone().insertBefore(this[0]).map(function(){var elem=this;while(elem.firstChild)elem=elem.firstChild;return elem;}).append(this);return this;},wrapInner:function(html){return this.each(function(){jQuery(this).contents().wrapAll(html);});},wrap:function(html){return this.each(function(){jQuery(this).wrapAll(html);});},append:function(){return this.domManip(arguments,true,false,function(elem){if(this.nodeType==1)this.appendChild(elem);});},prepend:function(){return this.domManip(arguments,true,true,function(elem){if(this.nodeType==1)this.insertBefore(elem,this.firstChild);});},before:function(){return this.domManip(arguments,false,false,function(elem){this.parentNode.insertBefore(elem,this);});},after:function(){return this.domManip(arguments,false,true,function(elem){this.parentNode.insertBefore(elem,this.nextSibling);});},end:function(){return this.prevObject||jQuery([]);},find:function(selector){var elems=jQuery.map(this,function(elem){return jQuery.find(selector,elem);});return this.pushStack(/[^+>] [^+>]/.test(selector)||selector.indexOf("..")>-1?jQuery.unique(elems):elems);},clone:function(events){var ret=this.map(function(){if(jQuery.browser.msie&&!jQuery.isXMLDoc(this)){var clone=this.cloneNode(true),container=document.createElement("div");container.appendChild(clone);return jQuery.clean([container.innerHTML])[0];}else
return this.cloneNode(true);});var clone=ret.find("*").andSelf().each(function(){if(this[expando]!=undefined)this[expando]=null;});if(events===true)this.find("*").andSelf().each(function(i){if(this.nodeType==3)return;var events=jQuery.data(this,"events");for(var type in events)for(var handler in events[type])jQuery.event.add(clone[i],type,events[type][handler],events[type][handler].data);});return ret;},filter:function(selector){return this.pushStack(jQuery.isFunction(selector)&&jQuery.grep(this,function(elem,i){return selector.call(elem,i);})||jQuery.multiFilter(selector,this));},not:function(selector){if(selector.constructor==String)if(isSimple.test(selector))return this.pushStack(jQuery.multiFilter(selector,this,true));else
selector=jQuery.multiFilter(selector,this);var isArrayLike=selector.length&&selector[selector.length-1]!==undefined&&!selector.nodeType;return this.filter(function(){return isArrayLike?jQuery.inArray(this,selector)<0:this!=selector;});},add:function(selector){return this.pushStack(jQuery.unique(jQuery.merge(this.get(),typeof selector=='string'?jQuery(selector):jQuery.makeArray(selector))));},is:function(selector){return!!selector&&jQuery.multiFilter(selector,this).length>0;},hasClass:function(selector){return this.is("."+selector);},val:function(value){if(value==undefined){if(this.length){var elem=this[0];if(jQuery.nodeName(elem,"select")){var index=elem.selectedIndex,values=[],options=elem.options,one=elem.type=="select-one";if(index<0)return null;for(var i=one?index:0,max=one?index+1:options.length;i<max;i++){var option=options[i];if(option.selected){value=jQuery.browser.msie&&!option.attributes.value.specified?option.text:option.value;if(one)return value;values.push(value);}}return values;}else
return(this[0].value||"").replace(/\r/g,"");}return undefined;}if(value.constructor==Number)value+='';return this.each(function(){if(this.nodeType!=1)return;if(value.constructor==Array&&/radio|checkbox/.test(this.type))this.checked=(jQuery.inArray(this.value,value)>=0||jQuery.inArray(this.name,value)>=0);else if(jQuery.nodeName(this,"select")){var values=jQuery.makeArray(value);jQuery("option",this).each(function(){this.selected=(jQuery.inArray(this.value,values)>=0||jQuery.inArray(this.text,values)>=0);});if(!values.length)this.selectedIndex=-1;}else
this.value=value;});},html:function(value){return value==undefined?(this[0]?this[0].innerHTML:null):this.empty().append(value);},replaceWith:function(value){return this.after(value).remove();},eq:function(i){return this.slice(i,i+1);},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments));},map:function(callback){return this.pushStack(jQuery.map(this,function(elem,i){return callback.call(elem,i,elem);}));},andSelf:function(){return this.add(this.prevObject);},data:function(key,value){var parts=key.split(".");parts[1]=parts[1]?"."+parts[1]:"";if(value===undefined){var data=this.triggerHandler("getData"+parts[1]+"!",[parts[0]]);if(data===undefined&&this.length)data=jQuery.data(this[0],key);return data===undefined&&parts[1]?this.data(parts[0]):data;}else
return this.trigger("setData"+parts[1]+"!",[parts[0],value]).each(function(){jQuery.data(this,key,value);});},removeData:function(key){return this.each(function(){jQuery.removeData(this,key);});},domManip:function(args,table,reverse,callback){var clone=this.length>1,elems;return this.each(function(){if(!elems){elems=jQuery.clean(args,this.ownerDocument);if(reverse)elems.reverse();}var obj=this;if(table&&jQuery.nodeName(this,"table")&&jQuery.nodeName(elems[0],"tr"))obj=this.getElementsByTagName("tbody")[0]||this.appendChild(this.ownerDocument.createElement("tbody"));var scripts=jQuery([]);jQuery.each(elems,function(){var elem=clone?jQuery(this).clone(true)[0]:this;if(jQuery.nodeName(elem,"script"))scripts=scripts.add(elem);else{if(elem.nodeType==1)scripts=scripts.add(jQuery("script",elem).remove());callback.call(obj,elem);}});scripts.each(evalScript);});}};jQuery.fn.init.prototype=jQuery.fn;function evalScript(i,elem){if(elem.src)jQuery.ajax({url:elem.src,async:false,dataType:"script"});else
jQuery.globalEval(elem.text||elem.textContent||elem.innerHTML||"");if(elem.parentNode)elem.parentNode.removeChild(elem);}function now(){return+new Date;}jQuery.extend=jQuery.fn.extend=function(){var target=arguments[0]||{},i=1,length=arguments.length,deep=false,options;if(target.constructor==Boolean){deep=target;target=arguments[1]||{};i=2;}if(typeof target!="object"&&typeof target!="function")target={};if(length==i){target=this;--i;}for(;i<length;i++)if((options=arguments[i])!=null)for(var name in options){var src=target[name],copy=options[name];if(target===copy)continue;if(deep&&copy&&typeof copy=="object"&&!copy.nodeType)target[name]=jQuery.extend(deep,src||(copy.length!=null?[]:{}),copy);else if(copy!==undefined)target[name]=copy;}return target;};var expando="jQuery"+now(),uuid=0,windowData={},exclude=/z-?index|font-?weight|opacity|zoom|line-?height/i,defaultView=document.defaultView||{};jQuery.extend({noConflict:function(deep){window.$=_$;if(deep)window.jQuery=_jQuery;return jQuery;},isFunction:function(fn){return!!fn&&typeof fn!="string"&&!fn.nodeName&&fn.constructor!=Array&&/^[\s[]?function/.test(fn+"");},isXMLDoc:function(elem){return elem.documentElement&&!elem.body||elem.tagName&&elem.ownerDocument&&!elem.ownerDocument.body;},globalEval:function(data){data=jQuery.trim(data);if(data){var head=document.getElementsByTagName("head")[0]||document.documentElement,script=document.createElement("script");script.type="text/javascript";if(jQuery.browser.msie)script.text=data;else
script.appendChild(document.createTextNode(data));head.insertBefore(script,head.firstChild);head.removeChild(script);}},nodeName:function(elem,name){return elem.nodeName&&elem.nodeName.toUpperCase()==name.toUpperCase();},cache:{},data:function(elem,name,data){elem=elem==window?windowData:elem;var id=elem[expando];if(!id)id=elem[expando]=++uuid;if(name&&!jQuery.cache[id])jQuery.cache[id]={};if(data!==undefined)jQuery.cache[id][name]=data;return name?jQuery.cache[id][name]:id;},removeData:function(elem,name){elem=elem==window?windowData:elem;var id=elem[expando];if(name){if(jQuery.cache[id]){delete jQuery.cache[id][name];name="";for(name in jQuery.cache[id])break;if(!name)jQuery.removeData(elem);}}else{try{delete elem[expando];}catch(e){if(elem.removeAttribute)elem.removeAttribute(expando);}delete jQuery.cache[id];}},each:function(object,callback,args){var name,i=0,length=object.length;if(args){if(length==undefined){for(name in object)if(callback.apply(object[name],args)===false)break;}else
for(;i<length;)if(callback.apply(object[i++],args)===false)break;}else{if(length==undefined){for(name in object)if(callback.call(object[name],name,object[name])===false)break;}else
for(var value=object[0];i<length&&callback.call(value,i,value)!==false;value=object[++i]){}}return object;},prop:function(elem,value,type,i,name){if(jQuery.isFunction(value))value=value.call(elem,i);return value&&value.constructor==Number&&type=="curCSS"&&!exclude.test(name)?value+"px":value;},className:{add:function(elem,classNames){jQuery.each((classNames||"").split(/\s+/),function(i,className){if(elem.nodeType==1&&!jQuery.className.has(elem.className,className))elem.className+=(elem.className?" ":"")+className;});},remove:function(elem,classNames){if(elem.nodeType==1)elem.className=classNames!=undefined?jQuery.grep(elem.className.split(/\s+/),function(className){return!jQuery.className.has(classNames,className);}).join(" "):"";},has:function(elem,className){return jQuery.inArray(className,(elem.className||elem).toString().split(/\s+/))>-1;}},swap:function(elem,options,callback){var old={};for(var name in options){old[name]=elem.style[name];elem.style[name]=options[name];}callback.call(elem);for(var name in options)elem.style[name]=old[name];},css:function(elem,name,force){if(name=="width"||name=="height"){var val,props={position:"absolute",visibility:"hidden",display:"block"},which=name=="width"?["Left","Right"]:["Top","Bottom"];function getWH(){val=name=="width"?elem.offsetWidth:elem.offsetHeight;var padding=0,border=0;jQuery.each(which,function(){padding+=parseFloat(jQuery.curCSS(elem,"padding"+this,true))||0;border+=parseFloat(jQuery.curCSS(elem,"border"+this+"Width",true))||0;});val-=Math.round(padding+border);}if(jQuery(elem).is(":visible"))getWH();else
jQuery.swap(elem,props,getWH);return Math.max(0,val);}return jQuery.curCSS(elem,name,force);},curCSS:function(elem,name,force){var ret,style=elem.style;function color(elem){if(!jQuery.browser.safari)return false;var ret=defaultView.getComputedStyle(elem,null);return!ret||ret.getPropertyValue("color")=="";}if(name=="opacity"&&jQuery.browser.msie){ret=jQuery.attr(style,"opacity");return ret==""?"1":ret;}if(jQuery.browser.opera&&name=="display"){var save=style.outline;style.outline="0 solid black";style.outline=save;}if(name.match(/float/i))name=styleFloat;if(!force&&style&&style[name])ret=style[name];else if(defaultView.getComputedStyle){if(name.match(/float/i))name="float";name=name.replace(/([A-Z])/g,"-$1").toLowerCase();var computedStyle=defaultView.getComputedStyle(elem,null);if(computedStyle&&!color(elem))ret=computedStyle.getPropertyValue(name);else{var swap=[],stack=[],a=elem,i=0;for(;a&&color(a);a=a.parentNode)stack.unshift(a);for(;i<stack.length;i++)if(color(stack[i])){swap[i]=stack[i].style.display;stack[i].style.display="block";}ret=name=="display"&&swap[stack.length-1]!=null?"none":(computedStyle&&computedStyle.getPropertyValue(name))||"";for(i=0;i<swap.length;i++)if(swap[i]!=null)stack[i].style.display=swap[i];}if(name=="opacity"&&ret=="")ret="1";}else if(elem.currentStyle){var camelCase=name.replace(/\-(\w)/g,function(all,letter){return letter.toUpperCase();});ret=elem.currentStyle[name]||elem.currentStyle[camelCase];if(!/^\d+(px)?$/i.test(ret)&&/^\d/.test(ret)){var left=style.left,rsLeft=elem.runtimeStyle.left;elem.runtimeStyle.left=elem.currentStyle.left;style.left=ret||0;ret=style.pixelLeft+"px";style.left=left;elem.runtimeStyle.left=rsLeft;}}return ret;},clean:function(elems,context){var ret=[];context=context||document;if(typeof context.createElement=='undefined')context=context.ownerDocument||context[0]&&context[0].ownerDocument||document;jQuery.each(elems,function(i,elem){if(!elem)return;if(elem.constructor==Number)elem+='';if(typeof elem=="string"){elem=elem.replace(/(<(\w+)[^>]*?)\/>/g,function(all,front,tag){return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?all:front+"></"+tag+">";});var tags=jQuery.trim(elem).toLowerCase(),div=context.createElement("div");var wrap=!tags.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!tags.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||tags.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!tags.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!tags.indexOf("<td")||!tags.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!tags.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||jQuery.browser.msie&&[1,"div<div>","</div>"]||[0,"",""];div.innerHTML=wrap[1]+elem+wrap[2];while(wrap[0]--)div=div.lastChild;if(jQuery.browser.msie){var tbody=!tags.indexOf("<table")&&tags.indexOf("<tbody")<0?div.firstChild&&div.firstChild.childNodes:wrap[1]=="<table>"&&tags.indexOf("<tbody")<0?div.childNodes:[];for(var j=tbody.length-1;j>=0;--j)if(jQuery.nodeName(tbody[j],"tbody")&&!tbody[j].childNodes.length)tbody[j].parentNode.removeChild(tbody[j]);if(/^\s/.test(elem))div.insertBefore(context.createTextNode(elem.match(/^\s*/)[0]),div.firstChild);}elem=jQuery.makeArray(div.childNodes);}if(elem.length===0&&(!jQuery.nodeName(elem,"form")&&!jQuery.nodeName(elem,"select")))return;if(elem[0]==undefined||jQuery.nodeName(elem,"form")||elem.options)ret.push(elem);else
ret=jQuery.merge(ret,elem);});return ret;},attr:function(elem,name,value){if(!elem||elem.nodeType==3||elem.nodeType==8)return undefined;var notxml=!jQuery.isXMLDoc(elem),set=value!==undefined,msie=jQuery.browser.msie;name=notxml&&jQuery.props[name]||name;if(elem.tagName){var special=/href|src|style/.test(name);if(name=="selected"&&jQuery.browser.safari)elem.parentNode.selectedIndex;if(name in elem&&notxml&&!special){if(set){if(name=="type"&&jQuery.nodeName(elem,"input")&&elem.parentNode)throw"type property can't be changed";elem[name]=value;}if(jQuery.nodeName(elem,"form")&&elem.getAttributeNode(name))return elem.getAttributeNode(name).nodeValue;return elem[name];}if(msie&&notxml&&name=="style")return jQuery.attr(elem.style,"cssText",value);if(set)elem.setAttribute(name,""+value);var attr=msie&&notxml&&special?elem.getAttribute(name,2):elem.getAttribute(name);return attr===null?undefined:attr;}if(msie&&name=="opacity"){if(set){elem.zoom=1;elem.filter=(elem.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(value)+''=="NaN"?"":"alpha(opacity="+value*100+")");}return elem.filter&&elem.filter.indexOf("opacity=")>=0?(parseFloat(elem.filter.match(/opacity=([^)]*)/)[1])/100)+'':"";}name=name.replace(/-([a-z])/ig,function(all,letter){return letter.toUpperCase();});if(set)elem[name]=value;return elem[name];},trim:function(text){return(text||"").replace(/^\s+|\s+$/g,"");},makeArray:function(array){var ret=[];if(array!=null){var i=array.length;if(i==null||array.split||array.setInterval||array.call)ret[0]=array;else
while(i)ret[--i]=array[i];}return ret;},inArray:function(elem,array){for(var i=0,length=array.length;i<length;i++)if(array[i]===elem)return i;return-1;},merge:function(first,second){var i=0,elem,pos=first.length;if(jQuery.browser.msie){while(elem=second[i++])if(elem.nodeType!=8)first[pos++]=elem;}else
while(elem=second[i++])first[pos++]=elem;return first;},unique:function(array){var ret=[],done={};try{for(var i=0,length=array.length;i<length;i++){var id=jQuery.data(array[i]);if(!done[id]){done[id]=true;ret.push(array[i]);}}}catch(e){ret=array;}return ret;},grep:function(elems,callback,inv){var ret=[];for(var i=0,length=elems.length;i<length;i++)if(!inv!=!callback(elems[i],i))ret.push(elems[i]);return ret;},map:function(elems,callback){var ret=[];for(var i=0,length=elems.length;i<length;i++){var value=callback(elems[i],i);if(value!=null)ret[ret.length]=value;}return ret.concat.apply([],ret);}});var userAgent=navigator.userAgent.toLowerCase();jQuery.browser={version:(userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[])[1],safari:/webkit/.test(userAgent),opera:/opera/.test(userAgent),msie:/msie/.test(userAgent)&&!/opera/.test(userAgent),mozilla:/mozilla/.test(userAgent)&&!/(compatible|webkit)/.test(userAgent)};var styleFloat=jQuery.browser.msie?"styleFloat":"cssFloat";jQuery.extend({boxModel:!jQuery.browser.msie||document.compatMode=="CSS1Compat",props:{"for":"htmlFor","class":"className","float":styleFloat,cssFloat:styleFloat,styleFloat:styleFloat,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing"}});jQuery.each({parent:function(elem){return elem.parentNode;},parents:function(elem){return jQuery.dir(elem,"parentNode");},next:function(elem){return jQuery.nth(elem,2,"nextSibling");},prev:function(elem){return jQuery.nth(elem,2,"previousSibling");},nextAll:function(elem){return jQuery.dir(elem,"nextSibling");},prevAll:function(elem){return jQuery.dir(elem,"previousSibling");},siblings:function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem);},children:function(elem){return jQuery.sibling(elem.firstChild);},contents:function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes);}},function(name,fn){jQuery.fn[name]=function(selector){var ret=jQuery.map(this,fn);if(selector&&typeof selector=="string")ret=jQuery.multiFilter(selector,ret);return this.pushStack(jQuery.unique(ret));};});jQuery.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(name,original){jQuery.fn[name]=function(){var args=arguments;return this.each(function(){for(var i=0,length=args.length;i<length;i++)jQuery(args[i])[original](this);});};});jQuery.each({removeAttr:function(name){jQuery.attr(this,name,"");if(this.nodeType==1)this.removeAttribute(name);},addClass:function(classNames){jQuery.className.add(this,classNames);},removeClass:function(classNames){jQuery.className.remove(this,classNames);},toggleClass:function(classNames){jQuery.className[jQuery.className.has(this,classNames)?"remove":"add"](this,classNames);},remove:function(selector){if(!selector||jQuery.filter(selector,[this]).r.length){jQuery("*",this).add(this).each(function(){jQuery.event.remove(this);jQuery.removeData(this);});if(this.parentNode)this.parentNode.removeChild(this);}},empty:function(){jQuery(">*",this).remove();while(this.firstChild)this.removeChild(this.firstChild);}},function(name,fn){jQuery.fn[name]=function(){return this.each(fn,arguments);};});jQuery.each(["Height","Width"],function(i,name){var type=name.toLowerCase();jQuery.fn[type]=function(size){return this[0]==window?jQuery.browser.opera&&document.body["client"+name]||jQuery.browser.safari&&window["inner"+name]||document.compatMode=="CSS1Compat"&&document.documentElement["client"+name]||document.body["client"+name]:this[0]==document?Math.max(Math.max(document.body["scroll"+name],document.documentElement["scroll"+name]),Math.max(document.body["offset"+name],document.documentElement["offset"+name])):size==undefined?(this.length?jQuery.css(this[0],type):null):this.css(type,size.constructor==String?size:size+"px");};});function num(elem,prop){return elem[0]&&parseInt(jQuery.curCSS(elem[0],prop,true),10)||0;}var chars=jQuery.browser.safari&&parseInt(jQuery.browser.version)<417?"(?:[\\w*_-]|\\\\.)":"(?:[\\w\u0128-\uFFFF*_-]|\\\\.)",quickChild=new RegExp("^>\\s*("+chars+"+)"),quickID=new RegExp("^("+chars+"+)(#)("+chars+"+)"),quickClass=new RegExp("^([#.]?)("+chars+"*)");jQuery.extend({expr:{"":function(a,i,m){return m[2]=="*"||jQuery.nodeName(a,m[2]);},"#":function(a,i,m){return a.getAttribute("id")==m[2];},":":{lt:function(a,i,m){return i<m[3]-0;},gt:function(a,i,m){return i>m[3]-0;},nth:function(a,i,m){return m[3]-0==i;},eq:function(a,i,m){return m[3]-0==i;},first:function(a,i){return i==0;},last:function(a,i,m,r){return i==r.length-1;},even:function(a,i){return i%2==0;},odd:function(a,i){return i%2;},"first-child":function(a){return a.parentNode.getElementsByTagName("*")[0]==a;},"last-child":function(a){return jQuery.nth(a.parentNode.lastChild,1,"previousSibling")==a;},"only-child":function(a){return!jQuery.nth(a.parentNode.lastChild,2,"previousSibling");},parent:function(a){return a.firstChild;},empty:function(a){return!a.firstChild;},contains:function(a,i,m){return(a.textContent||a.innerText||jQuery(a).text()||"").indexOf(m[3])>=0;},visible:function(a){return"hidden"!=a.type&&jQuery.css(a,"display")!="none"&&jQuery.css(a,"visibility")!="hidden";},hidden:function(a){return"hidden"==a.type||jQuery.css(a,"display")=="none"||jQuery.css(a,"visibility")=="hidden";},enabled:function(a){return!a.disabled;},disabled:function(a){return a.disabled;},checked:function(a){return a.checked;},selected:function(a){return a.selected||jQuery.attr(a,"selected");},text:function(a){return"text"==a.type;},radio:function(a){return"radio"==a.type;},checkbox:function(a){return"checkbox"==a.type;},file:function(a){return"file"==a.type;},password:function(a){return"password"==a.type;},submit:function(a){return"submit"==a.type;},image:function(a){return"image"==a.type;},reset:function(a){return"reset"==a.type;},button:function(a){return"button"==a.type||jQuery.nodeName(a,"button");},input:function(a){return/input|select|textarea|button/i.test(a.nodeName);},has:function(a,i,m){return jQuery.find(m[3],a).length;},header:function(a){return/h\d/i.test(a.nodeName);},animated:function(a){return jQuery.grep(jQuery.timers,function(fn){return a==fn.elem;}).length;}}},parse:[/^(\[) *@?([\w-]+) *([!*$^~=]*) *('?"?)(.*?)\4 *\]/,/^(:)([\w-]+)\("?'?(.*?(\(.*?\))?[^(]*?)"?'?\)/,new RegExp("^([:.#]*)("+chars+"+)")],multiFilter:function(expr,elems,not){var old,cur=[];while(expr&&expr!=old){old=expr;var f=jQuery.filter(expr,elems,not);expr=f.t.replace(/^\s*,\s*/,"");cur=not?elems=f.r:jQuery.merge(cur,f.r);}return cur;},find:function(t,context){if(typeof t!="string")return[t];if(context&&context.nodeType!=1&&context.nodeType!=9)return[];context=context||document;var ret=[context],done=[],last,nodeName;while(t&&last!=t){var r=[];last=t;t=jQuery.trim(t);var foundToken=false,re=quickChild,m=re.exec(t);if(m){nodeName=m[1].toUpperCase();for(var i=0;ret[i];i++)for(var c=ret[i].firstChild;c;c=c.nextSibling)if(c.nodeType==1&&(nodeName=="*"||c.nodeName.toUpperCase()==nodeName))r.push(c);ret=r;t=t.replace(re,"");if(t.indexOf(" ")==0)continue;foundToken=true;}else{re=/^([>+~])\s*(\w*)/i;if((m=re.exec(t))!=null){r=[];var merge={};nodeName=m[2].toUpperCase();m=m[1];for(var j=0,rl=ret.length;j<rl;j++){var n=m=="~"||m=="+"?ret[j].nextSibling:ret[j].firstChild;for(;n;n=n.nextSibling)if(n.nodeType==1){var id=jQuery.data(n);if(m=="~"&&merge[id])break;if(!nodeName||n.nodeName.toUpperCase()==nodeName){if(m=="~")merge[id]=true;r.push(n);}if(m=="+")break;}}ret=r;t=jQuery.trim(t.replace(re,""));foundToken=true;}}if(t&&!foundToken){if(!t.indexOf(",")){if(context==ret[0])ret.shift();done=jQuery.merge(done,ret);r=ret=[context];t=" "+t.substr(1,t.length);}else{var re2=quickID;var m=re2.exec(t);if(m){m=[0,m[2],m[3],m[1]];}else{re2=quickClass;m=re2.exec(t);}m[2]=m[2].replace(/\\/g,"");var elem=ret[ret.length-1];if(m[1]=="#"&&elem&&elem.getElementById&&!jQuery.isXMLDoc(elem)){var oid=elem.getElementById(m[2]);if((jQuery.browser.msie||jQuery.browser.opera)&&oid&&typeof oid.id=="string"&&oid.id!=m[2])oid=jQuery('[@id="'+m[2]+'"]',elem)[0];ret=r=oid&&(!m[3]||jQuery.nodeName(oid,m[3]))?[oid]:[];}else{for(var i=0;ret[i];i++){var tag=m[1]=="#"&&m[3]?m[3]:m[1]!=""||m[0]==""?"*":m[2];if(tag=="*"&&ret[i].nodeName.toLowerCase()=="object")tag="param";r=jQuery.merge(r,ret[i].getElementsByTagName(tag));}if(m[1]==".")r=jQuery.classFilter(r,m[2]);if(m[1]=="#"){var tmp=[];for(var i=0;r[i];i++)if(r[i].getAttribute("id")==m[2]){tmp=[r[i]];break;}r=tmp;}ret=r;}t=t.replace(re2,"");}}if(t){var val=jQuery.filter(t,r);ret=r=val.r;t=jQuery.trim(val.t);}}if(t)ret=[];if(ret&&context==ret[0])ret.shift();done=jQuery.merge(done,ret);return done;},classFilter:function(r,m,not){m=" "+m+" ";var tmp=[];for(var i=0;r[i];i++){var pass=(" "+r[i].className+" ").indexOf(m)>=0;if(!not&&pass||not&&!pass)tmp.push(r[i]);}return tmp;},filter:function(t,r,not){var last;while(t&&t!=last){last=t;var p=jQuery.parse,m;for(var i=0;p[i];i++){m=p[i].exec(t);if(m){t=t.substring(m[0].length);m[2]=m[2].replace(/\\/g,"");break;}}if(!m)break;if(m[1]==":"&&m[2]=="not")r=isSimple.test(m[3])?jQuery.filter(m[3],r,true).r:jQuery(r).not(m[3]);else if(m[1]==".")r=jQuery.classFilter(r,m[2],not);else if(m[1]=="["){var tmp=[],type=m[3];for(var i=0,rl=r.length;i<rl;i++){var a=r[i],z=a[jQuery.props[m[2]]||m[2]];if(z==null||/href|src|selected/.test(m[2]))z=jQuery.attr(a,m[2])||'';if((type==""&&!!z||type=="="&&z==m[5]||type=="!="&&z!=m[5]||type=="^="&&z&&!z.indexOf(m[5])||type=="$="&&z.substr(z.length-m[5].length)==m[5]||(type=="*="||type=="~=")&&z.indexOf(m[5])>=0)^not)tmp.push(a);}r=tmp;}else if(m[1]==":"&&m[2]=="nth-child"){var merge={},tmp=[],test=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(m[3]=="even"&&"2n"||m[3]=="odd"&&"2n+1"||!/\D/.test(m[3])&&"0n+"+m[3]||m[3]),first=(test[1]+(test[2]||1))-0,last=test[3]-0;for(var i=0,rl=r.length;i<rl;i++){var node=r[i],parentNode=node.parentNode,id=jQuery.data(parentNode);if(!merge[id]){var c=1;for(var n=parentNode.firstChild;n;n=n.nextSibling)if(n.nodeType==1)n.nodeIndex=c++;merge[id]=true;}var add=false;if(first==0){if(node.nodeIndex==last)add=true;}else if((node.nodeIndex-last)%first==0&&(node.nodeIndex-last)/first>=0)add=true;if(add^not)tmp.push(node);}r=tmp;}else{var fn=jQuery.expr[m[1]];if(typeof fn=="object")fn=fn[m[2]];if(typeof fn=="string")fn=eval("false||function(a,i){return "+fn+";}");r=jQuery.grep(r,function(elem,i){return fn(elem,i,m,r);},not);}}return{r:r,t:t};},dir:function(elem,dir){var matched=[],cur=elem[dir];while(cur&&cur!=document){if(cur.nodeType==1)matched.push(cur);cur=cur[dir];}return matched;},nth:function(cur,result,dir,elem){result=result||1;var num=0;for(;cur;cur=cur[dir])if(cur.nodeType==1&&++num==result)break;return cur;},sibling:function(n,elem){var r=[];for(;n;n=n.nextSibling){if(n.nodeType==1&&n!=elem)r.push(n);}return r;}});jQuery.event={add:function(elem,types,handler,data){if(elem.nodeType==3||elem.nodeType==8)return;if(jQuery.browser.msie&&elem.setInterval)elem=window;if(!handler.guid)handler.guid=this.guid++;if(data!=undefined){var fn=handler;handler=this.proxy(fn,function(){return fn.apply(this,arguments);});handler.data=data;}var events=jQuery.data(elem,"events")||jQuery.data(elem,"events",{}),handle=jQuery.data(elem,"handle")||jQuery.data(elem,"handle",function(){if(typeof jQuery!="undefined"&&!jQuery.event.triggered)return jQuery.event.handle.apply(arguments.callee.elem,arguments);});handle.elem=elem;jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];handler.type=parts[1];var handlers=events[type];if(!handlers){handlers=events[type]={};if(!jQuery.event.special[type]||jQuery.event.special[type].setup.call(elem)===false){if(elem.addEventListener)elem.addEventListener(type,handle,false);else if(elem.attachEvent)elem.attachEvent("on"+type,handle);}}handlers[handler.guid]=handler;jQuery.event.global[type]=true;});elem=null;},guid:1,global:{},remove:function(elem,types,handler){if(elem.nodeType==3||elem.nodeType==8)return;var events=jQuery.data(elem,"events"),ret,index;if(events){if(types==undefined||(typeof types=="string"&&types.charAt(0)=="."))for(var type in events)this.remove(elem,type+(types||""));else{if(types.type){handler=types.handler;types=types.type;}jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];if(events[type]){if(handler)delete events[type][handler.guid];else
for(handler in events[type])if(!parts[1]||events[type][handler].type==parts[1])delete events[type][handler];for(ret in events[type])break;if(!ret){if(!jQuery.event.special[type]||jQuery.event.special[type].teardown.call(elem)===false){if(elem.removeEventListener)elem.removeEventListener(type,jQuery.data(elem,"handle"),false);else if(elem.detachEvent)elem.detachEvent("on"+type,jQuery.data(elem,"handle"));}ret=null;delete events[type];}}});}for(ret in events)break;if(!ret){var handle=jQuery.data(elem,"handle");if(handle)handle.elem=null;jQuery.removeData(elem,"events");jQuery.removeData(elem,"handle");}}},trigger:function(type,data,elem,donative,extra){data=jQuery.makeArray(data);if(type.indexOf("!")>=0){type=type.slice(0,-1);var exclusive=true;}if(!elem){if(this.global[type])jQuery("*").add([window,document]).trigger(type,data);}else{if(elem.nodeType==3||elem.nodeType==8)return undefined;var val,ret,fn=jQuery.isFunction(elem[type]||null),event=!data[0]||!data[0].preventDefault;if(event){data.unshift({type:type,target:elem,preventDefault:function(){},stopPropagation:function(){},timeStamp:now()});data[0][expando]=true;}data[0].type=type;if(exclusive)data[0].exclusive=true;var handle=jQuery.data(elem,"handle");if(handle)val=handle.apply(elem,data);if((!fn||(jQuery.nodeName(elem,'a')&&type=="click"))&&elem["on"+type]&&elem["on"+type].apply(elem,data)===false)val=false;if(event)data.shift();if(extra&&jQuery.isFunction(extra)){ret=extra.apply(elem,val==null?data:data.concat(val));if(ret!==undefined)val=ret;}if(fn&&donative!==false&&val!==false&&!(jQuery.nodeName(elem,'a')&&type=="click")){this.triggered=true;try{elem[type]();}catch(e){}}this.triggered=false;}return val;},handle:function(event){var val,ret,namespace,all,handlers;event=arguments[0]=jQuery.event.fix(event||window.event);namespace=event.type.split(".");event.type=namespace[0];namespace=namespace[1];all=!namespace&&!event.exclusive;handlers=(jQuery.data(this,"events")||{})[event.type];for(var j in handlers){var handler=handlers[j];if(all||handler.type==namespace){event.handler=handler;event.data=handler.data;ret=handler.apply(this,arguments);if(val!==false)val=ret;if(ret===false){event.preventDefault();event.stopPropagation();}}}return val;},fix:function(event){if(event[expando]==true)return event;var originalEvent=event;event={originalEvent:originalEvent};var props="altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target timeStamp toElement type view wheelDelta which".split(" ");for(var i=props.length;i;i--)event[props[i]]=originalEvent[props[i]];event[expando]=true;event.preventDefault=function(){if(originalEvent.preventDefault)originalEvent.preventDefault();originalEvent.returnValue=false;};event.stopPropagation=function(){if(originalEvent.stopPropagation)originalEvent.stopPropagation();originalEvent.cancelBubble=true;};event.timeStamp=event.timeStamp||now();if(!event.target)event.target=event.srcElement||document;if(event.target.nodeType==3)event.target=event.target.parentNode;if(!event.relatedTarget&&event.fromElement)event.relatedTarget=event.fromElement==event.target?event.toElement:event.fromElement;if(event.pageX==null&&event.clientX!=null){var doc=document.documentElement,body=document.body;event.pageX=event.clientX+(doc&&doc.scrollLeft||body&&body.scrollLeft||0)-(doc.clientLeft||0);event.pageY=event.clientY+(doc&&doc.scrollTop||body&&body.scrollTop||0)-(doc.clientTop||0);}if(!event.which&&((event.charCode||event.charCode===0)?event.charCode:event.keyCode))event.which=event.charCode||event.keyCode;if(!event.metaKey&&event.ctrlKey)event.metaKey=event.ctrlKey;if(!event.which&&event.button)event.which=(event.button&1?1:(event.button&2?3:(event.button&4?2:0)));return event;},proxy:function(fn,proxy){proxy.guid=fn.guid=fn.guid||proxy.guid||this.guid++;return proxy;},special:{ready:{setup:function(){bindReady();return;},teardown:function(){return;}},mouseenter:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseover",jQuery.event.special.mouseenter.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseover",jQuery.event.special.mouseenter.handler);return true;},handler:function(event){if(withinElement(event,this))return true;event.type="mouseenter";return jQuery.event.handle.apply(this,arguments);}},mouseleave:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseout",jQuery.event.special.mouseleave.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseout",jQuery.event.special.mouseleave.handler);return true;},handler:function(event){if(withinElement(event,this))return true;event.type="mouseleave";return jQuery.event.handle.apply(this,arguments);}}}};jQuery.fn.extend({bind:function(type,data,fn){return type=="unload"?this.one(type,data,fn):this.each(function(){jQuery.event.add(this,type,fn||data,fn&&data);});},one:function(type,data,fn){var one=jQuery.event.proxy(fn||data,function(event){jQuery(this).unbind(event,one);return(fn||data).apply(this,arguments);});return this.each(function(){jQuery.event.add(this,type,one,fn&&data);});},unbind:function(type,fn){return this.each(function(){jQuery.event.remove(this,type,fn);});},trigger:function(type,data,fn){return this.each(function(){jQuery.event.trigger(type,data,this,true,fn);});},triggerHandler:function(type,data,fn){return this[0]&&jQuery.event.trigger(type,data,this[0],false,fn);},toggle:function(fn){var args=arguments,i=1;while(i<args.length)jQuery.event.proxy(fn,args[i++]);return this.click(jQuery.event.proxy(fn,function(event){this.lastToggle=(this.lastToggle||0)%i;event.preventDefault();return args[this.lastToggle++].apply(this,arguments)||false;}));},hover:function(fnOver,fnOut){return this.bind('mouseenter',fnOver).bind('mouseleave',fnOut);},ready:function(fn){bindReady();if(jQuery.isReady)fn.call(document,jQuery);else
jQuery.readyList.push(function(){return fn.call(this,jQuery);});return this;}});jQuery.extend({isReady:false,readyList:[],ready:function(){if(!jQuery.isReady){jQuery.isReady=true;if(jQuery.readyList){jQuery.each(jQuery.readyList,function(){this.call(document);});jQuery.readyList=null;}jQuery(document).triggerHandler("ready");}}});var readyBound=false;function bindReady(){if(readyBound)return;readyBound=true;if(document.addEventListener&&!jQuery.browser.opera)document.addEventListener("DOMContentLoaded",jQuery.ready,false);if(jQuery.browser.msie&&window==top)(function(){if(jQuery.isReady)return;try{document.documentElement.doScroll("left");}catch(error){setTimeout(arguments.callee,0);return;}jQuery.ready();})();if(jQuery.browser.opera)document.addEventListener("DOMContentLoaded",function(){if(jQuery.isReady)return;for(var i=0;i<document.styleSheets.length;i++)if(document.styleSheets[i].disabled){setTimeout(arguments.callee,0);return;}jQuery.ready();},false);if(jQuery.browser.safari){var numStyles;(function(){if(jQuery.isReady)return;if(document.readyState!="loaded"&&document.readyState!="complete"){setTimeout(arguments.callee,0);return;}if(numStyles===undefined)numStyles=jQuery("style, link[rel=stylesheet]").length;if(document.styleSheets.length!=numStyles){setTimeout(arguments.callee,0);return;}jQuery.ready();})();}jQuery.event.add(window,"load",jQuery.ready);}jQuery.each(("blur,focus,load,resize,scroll,unload,click,dblclick,"+"mousedown,mouseup,mousemove,mouseover,mouseout,change,select,"+"submit,keydown,keypress,keyup,error").split(","),function(i,name){jQuery.fn[name]=function(fn){return fn?this.bind(name,fn):this.trigger(name);};});var withinElement=function(event,elem){var parent=event.relatedTarget;while(parent&&parent!=elem)try{parent=parent.parentNode;}catch(error){parent=elem;}return parent==elem;};jQuery(window).bind("unload",function(){jQuery("*").add(document).unbind();});jQuery.fn.extend({_load:jQuery.fn.load,load:function(url,params,callback){if(typeof url!='string')return this._load(url);var off=url.indexOf(" ");if(off>=0){var selector=url.slice(off,url.length);url=url.slice(0,off);}callback=callback||function(){};var type="GET";if(params)if(jQuery.isFunction(params)){callback=params;params=null;}else{params=jQuery.param(params);type="POST";}var self=this;jQuery.ajax({url:url,type:type,dataType:"html",data:params,complete:function(res,status){if(status=="success"||status=="notmodified")self.html(selector?jQuery("<div/>").append(res.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(selector):res.responseText);self.each(callback,[res.responseText,status,res]);}});return this;},serialize:function(){return jQuery.param(this.serializeArray());},serializeArray:function(){return this.map(function(){return jQuery.nodeName(this,"form")?jQuery.makeArray(this.elements):this;}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password/i.test(this.type));}).map(function(i,elem){var val=jQuery(this).val();return val==null?null:val.constructor==Array?jQuery.map(val,function(val,i){return{name:elem.name,value:val};}):{name:elem.name,value:val};}).get();}});jQuery.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(i,o){jQuery.fn[o]=function(f){return this.bind(o,f);};});var jsc=now();jQuery.extend({get:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data=null;}return jQuery.ajax({type:"GET",url:url,data:data,success:callback,dataType:type});},getScript:function(url,callback){return jQuery.get(url,null,callback,"script");},getJSON:function(url,data,callback){return jQuery.get(url,data,callback,"json");},post:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data={};}return jQuery.ajax({type:"POST",url:url,data:data,success:callback,dataType:type});},ajaxSetup:function(settings){jQuery.extend(jQuery.ajaxSettings,settings);},ajaxSettings:{url:location.href,global:true,type:"GET",timeout:0,contentType:"application/x-www-form-urlencoded",processData:true,async:true,data:null,username:null,password:null,accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(s){s=jQuery.extend(true,s,jQuery.extend(true,{},jQuery.ajaxSettings,s));var jsonp,jsre=/=\?(&|$)/g,status,data,type=s.type.toUpperCase();if(s.data&&s.processData&&typeof s.data!="string")s.data=jQuery.param(s.data);if(s.dataType=="jsonp"){if(type=="GET"){if(!s.url.match(jsre))s.url+=(s.url.match(/\?/)?"&":"?")+(s.jsonp||"callback")+"=?";}else if(!s.data||!s.data.match(jsre))s.data=(s.data?s.data+"&":"")+(s.jsonp||"callback")+"=?";s.dataType="json";}if(s.dataType=="json"&&(s.data&&s.data.match(jsre)||s.url.match(jsre))){jsonp="jsonp"+jsc++;if(s.data)s.data=(s.data+"").replace(jsre,"="+jsonp+"$1");s.url=s.url.replace(jsre,"="+jsonp+"$1");s.dataType="script";window[jsonp]=function(tmp){data=tmp;success();complete();window[jsonp]=undefined;try{delete window[jsonp];}catch(e){}if(head)head.removeChild(script);};}if(s.dataType=="script"&&s.cache==null)s.cache=false;if(s.cache===false&&type=="GET"){var ts=now();var ret=s.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+ts+"$2");s.url=ret+((ret==s.url)?(s.url.match(/\?/)?"&":"?")+"_="+ts:"");}if(s.data&&type=="GET"){s.url+=(s.url.match(/\?/)?"&":"?")+s.data;s.data=null;}if(s.global&&!jQuery.active++)jQuery.event.trigger("ajaxStart");var remote=/^(?:\w+:)?\/\/([^\/?#]+)/;if(s.dataType=="script"&&type=="GET"&&remote.test(s.url)&&remote.exec(s.url)[1]!=location.host){var head=document.getElementsByTagName("head")[0];var script=document.createElement("script");script.src=s.url;if(s.scriptCharset)script.charset=s.scriptCharset;if(!jsonp){var done=false;script.onload=script.onreadystatechange=function(){if(!done&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){done=true;success();complete();head.removeChild(script);}};}head.appendChild(script);return undefined;}var requestDone=false;var xhr=window.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest();if(s.username)xhr.open(type,s.url,s.async,s.username,s.password);else
xhr.open(type,s.url,s.async);try{if(s.data)xhr.setRequestHeader("Content-Type",s.contentType);if(s.ifModified)xhr.setRequestHeader("If-Modified-Since",jQuery.lastModified[s.url]||"Thu, 01 Jan 1970 00:00:00 GMT");xhr.setRequestHeader("X-Requested-With","XMLHttpRequest");xhr.setRequestHeader("Accept",s.dataType&&s.accepts[s.dataType]?s.accepts[s.dataType]+", */*":s.accepts._default);}catch(e){}if(s.beforeSend&&s.beforeSend(xhr,s)===false){s.global&&jQuery.active--;xhr.abort();return false;}if(s.global)jQuery.event.trigger("ajaxSend",[xhr,s]);var onreadystatechange=function(isTimeout){if(!requestDone&&xhr&&(xhr.readyState==4||isTimeout=="timeout")){requestDone=true;if(ival){clearInterval(ival);ival=null;}status=isTimeout=="timeout"&&"timeout"||!jQuery.httpSuccess(xhr)&&"error"||s.ifModified&&jQuery.httpNotModified(xhr,s.url)&&"notmodified"||"success";if(status=="success"){try{data=jQuery.httpData(xhr,s.dataType,s.dataFilter);}catch(e){status="parsererror";}}if(status=="success"){var modRes;try{modRes=xhr.getResponseHeader("Last-Modified");}catch(e){}if(s.ifModified&&modRes)jQuery.lastModified[s.url]=modRes;if(!jsonp)success();}else
jQuery.handleError(s,xhr,status);complete();if(s.async)xhr=null;}};if(s.async){var ival=setInterval(onreadystatechange,13);if(s.timeout>0)setTimeout(function(){if(xhr){xhr.abort();if(!requestDone)onreadystatechange("timeout");}},s.timeout);}try{xhr.send(s.data);}catch(e){jQuery.handleError(s,xhr,null,e);}if(!s.async)onreadystatechange();function success(){if(s.success)s.success(data,status);if(s.global)jQuery.event.trigger("ajaxSuccess",[xhr,s]);}function complete(){if(s.complete)s.complete(xhr,status);if(s.global)jQuery.event.trigger("ajaxComplete",[xhr,s]);if(s.global&&!--jQuery.active)jQuery.event.trigger("ajaxStop");}return xhr;},handleError:function(s,xhr,status,e){if(s.error)s.error(xhr,status,e);if(s.global)jQuery.event.trigger("ajaxError",[xhr,s,e]);},active:0,httpSuccess:function(xhr){try{return!xhr.status&&location.protocol=="file:"||(xhr.status>=200&&xhr.status<300)||xhr.status==304||xhr.status==1223||jQuery.browser.safari&&xhr.status==undefined;}catch(e){}return false;},httpNotModified:function(xhr,url){try{var xhrRes=xhr.getResponseHeader("Last-Modified");return xhr.status==304||xhrRes==jQuery.lastModified[url]||jQuery.browser.safari&&xhr.status==undefined;}catch(e){}return false;},httpData:function(xhr,type,filter){var ct=xhr.getResponseHeader("content-type"),xml=type=="xml"||!type&&ct&&ct.indexOf("xml")>=0,data=xml?xhr.responseXML:xhr.responseText;if(xml&&data.documentElement.tagName=="parsererror")throw"parsererror";if(filter)data=filter(data,type);if(type=="script")jQuery.globalEval(data);if(type=="json")data=eval("("+data+")");return data;},param:function(a){var s=[];if(a.constructor==Array||a.jquery)jQuery.each(a,function(){s.push(encodeURIComponent(this.name)+"="+encodeURIComponent(this.value));});else
for(var j in a)if(a[j]&&a[j].constructor==Array)jQuery.each(a[j],function(){s.push(encodeURIComponent(j)+"="+encodeURIComponent(this));});else
s.push(encodeURIComponent(j)+"="+encodeURIComponent(jQuery.isFunction(a[j])?a[j]():a[j]));return s.join("&").replace(/%20/g,"+");}});jQuery.fn.extend({show:function(speed,callback){return speed?this.animate({height:"show",width:"show",opacity:"show"},speed,callback):this.filter(":hidden").each(function(){this.style.display=this.oldblock||"";if(jQuery.css(this,"display")=="none"){var elem=jQuery("<"+this.tagName+" />").appendTo("body");this.style.display=elem.css("display");if(this.style.display=="none")this.style.display="block";elem.remove();}}).end();},hide:function(speed,callback){return speed?this.animate({height:"hide",width:"hide",opacity:"hide"},speed,callback):this.filter(":visible").each(function(){this.oldblock=this.oldblock||jQuery.css(this,"display");this.style.display="none";}).end();},_toggle:jQuery.fn.toggle,toggle:function(fn,fn2){return jQuery.isFunction(fn)&&jQuery.isFunction(fn2)?this._toggle.apply(this,arguments):fn?this.animate({height:"toggle",width:"toggle",opacity:"toggle"},fn,fn2):this.each(function(){jQuery(this)[jQuery(this).is(":hidden")?"show":"hide"]();});},slideDown:function(speed,callback){return this.animate({height:"show"},speed,callback);},slideUp:function(speed,callback){return this.animate({height:"hide"},speed,callback);},slideToggle:function(speed,callback){return this.animate({height:"toggle"},speed,callback);},fadeIn:function(speed,callback){return this.animate({opacity:"show"},speed,callback);},fadeOut:function(speed,callback){return this.animate({opacity:"hide"},speed,callback);},fadeTo:function(speed,to,callback){return this.animate({opacity:to},speed,callback);},animate:function(prop,speed,easing,callback){var optall=jQuery.speed(speed,easing,callback);return this[optall.queue===false?"each":"queue"](function(){if(this.nodeType!=1)return false;var opt=jQuery.extend({},optall),p,hidden=jQuery(this).is(":hidden"),self=this;for(p in prop){if(prop[p]=="hide"&&hidden||prop[p]=="show"&&!hidden)return opt.complete.call(this);if(p=="height"||p=="width"){opt.display=jQuery.css(this,"display");opt.overflow=this.style.overflow;}}if(opt.overflow!=null)this.style.overflow="hidden";opt.curAnim=jQuery.extend({},prop);jQuery.each(prop,function(name,val){var e=new jQuery.fx(self,opt,name);if(/toggle|show|hide/.test(val))e[val=="toggle"?hidden?"show":"hide":val](prop);else{var parts=val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),start=e.cur(true)||0;if(parts){var end=parseFloat(parts[2]),unit=parts[3]||"px";if(unit!="px"){self.style[name]=(end||1)+unit;start=((end||1)/e.cur(true))*start;self.style[name]=start+unit;}if(parts[1])end=((parts[1]=="-="?-1:1)*end)+start;e.custom(start,end,unit);}else
e.custom(start,val,"");}});return true;});},queue:function(type,fn){if(jQuery.isFunction(type)||(type&&type.constructor==Array)){fn=type;type="fx";}if(!type||(typeof type=="string"&&!fn))return queue(this[0],type);return this.each(function(){if(fn.constructor==Array)queue(this,type,fn);else{queue(this,type).push(fn);if(queue(this,type).length==1)fn.call(this);}});},stop:function(clearQueue,gotoEnd){var timers=jQuery.timers;if(clearQueue)this.queue([]);this.each(function(){for(var i=timers.length-1;i>=0;i--)if(timers[i].elem==this){if(gotoEnd)timers[i](true);timers.splice(i,1);}});if(!gotoEnd)this.dequeue();return this;}});var queue=function(elem,type,array){if(elem){type=type||"fx";var q=jQuery.data(elem,type+"queue");if(!q||array)q=jQuery.data(elem,type+"queue",jQuery.makeArray(array));}return q;};jQuery.fn.dequeue=function(type){type=type||"fx";return this.each(function(){var q=queue(this,type);q.shift();if(q.length)q[0].call(this);});};jQuery.extend({speed:function(speed,easing,fn){var opt=speed&&speed.constructor==Object?speed:{complete:fn||!fn&&easing||jQuery.isFunction(speed)&&speed,duration:speed,easing:fn&&easing||easing&&easing.constructor!=Function&&easing};opt.duration=(opt.duration&&opt.duration.constructor==Number?opt.duration:jQuery.fx.speeds[opt.duration])||jQuery.fx.speeds.def;opt.old=opt.complete;opt.complete=function(){if(opt.queue!==false)jQuery(this).dequeue();if(jQuery.isFunction(opt.old))opt.old.call(this);};return opt;},easing:{linear:function(p,n,firstNum,diff){return firstNum+diff*p;},swing:function(p,n,firstNum,diff){return((-Math.cos(p*Math.PI)/2)+0.5)*diff+firstNum;}},timers:[],timerId:null,fx:function(elem,options,prop){this.options=options;this.elem=elem;this.prop=prop;if(!options.orig)options.orig={};}});jQuery.fx.prototype={update:function(){if(this.options.step)this.options.step.call(this.elem,this.now,this);(jQuery.fx.step[this.prop]||jQuery.fx.step._default)(this);if(this.prop=="height"||this.prop=="width")this.elem.style.display="block";},cur:function(force){if(this.elem[this.prop]!=null&&this.elem.style[this.prop]==null)return this.elem[this.prop];var r=parseFloat(jQuery.css(this.elem,this.prop,force));return r&&r>-10000?r:parseFloat(jQuery.curCSS(this.elem,this.prop))||0;},custom:function(from,to,unit){this.startTime=now();this.start=from;this.end=to;this.unit=unit||this.unit||"px";this.now=this.start;this.pos=this.state=0;this.update();var self=this;function t(gotoEnd){return self.step(gotoEnd);}t.elem=this.elem;jQuery.timers.push(t);if(jQuery.timerId==null){jQuery.timerId=setInterval(function(){var timers=jQuery.timers;for(var i=0;i<timers.length;i++)if(!timers[i]())timers.splice(i--,1);if(!timers.length){clearInterval(jQuery.timerId);jQuery.timerId=null;}},13);}},show:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.show=true;this.custom(0,this.cur());if(this.prop=="width"||this.prop=="height")this.elem.style[this.prop]="1px";jQuery(this.elem).show();},hide:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0);},step:function(gotoEnd){var t=now();if(gotoEnd||t>this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var done=true;for(var i in this.options.curAnim)if(this.options.curAnim[i]!==true)done=false;if(done){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(jQuery.css(this.elem,"display")=="none")this.elem.style.display="block";}if(this.options.hide)this.elem.style.display="none";if(this.options.hide||this.options.show)for(var p in this.options.curAnim)jQuery.attr(this.elem.style,p,this.options.orig[p]);}if(done)this.options.complete.call(this.elem);return false;}else{var n=t-this.startTime;this.state=n/this.options.duration;this.pos=jQuery.easing[this.options.easing||(jQuery.easing.swing?"swing":"linear")](this.state,n,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update();}return true;}};jQuery.extend(jQuery.fx,{speeds:{slow:600,fast:200,def:400},step:{scrollLeft:function(fx){fx.elem.scrollLeft=fx.now;},scrollTop:function(fx){fx.elem.scrollTop=fx.now;},opacity:function(fx){jQuery.attr(fx.elem.style,"opacity",fx.now);},_default:function(fx){fx.elem.style[fx.prop]=fx.now+fx.unit;}}});jQuery.fn.offset=function(){var left=0,top=0,elem=this[0],results;if(elem)with(jQuery.browser){var parent=elem.parentNode,offsetChild=elem,offsetParent=elem.offsetParent,doc=elem.ownerDocument,safari2=safari&&parseInt(version)<522&&!/adobeair/i.test(userAgent),css=jQuery.curCSS,fixed=css(elem,"position")=="fixed";if(elem.getBoundingClientRect){var box=elem.getBoundingClientRect();add(box.left+Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),box.top+Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));add(-doc.documentElement.clientLeft,-doc.documentElement.clientTop);}else{add(elem.offsetLeft,elem.offsetTop);while(offsetParent){add(offsetParent.offsetLeft,offsetParent.offsetTop);if(mozilla&&!/^t(able|d|h)$/i.test(offsetParent.tagName)||safari&&!safari2)border(offsetParent);if(!fixed&&css(offsetParent,"position")=="fixed")fixed=true;offsetChild=/^body$/i.test(offsetParent.tagName)?offsetChild:offsetParent;offsetParent=offsetParent.offsetParent;}while(parent&&parent.tagName&&!/^body|html$/i.test(parent.tagName)){if(!/^inline|table.*$/i.test(css(parent,"display")))add(-parent.scrollLeft,-parent.scrollTop);if(mozilla&&css(parent,"overflow")!="visible")border(parent);parent=parent.parentNode;}if((safari2&&(fixed||css(offsetChild,"position")=="absolute"))||(mozilla&&css(offsetChild,"position")!="absolute"))add(-doc.body.offsetLeft,-doc.body.offsetTop);if(fixed)add(Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));}results={top:top,left:left};}function border(elem){add(jQuery.curCSS(elem,"borderLeftWidth",true),jQuery.curCSS(elem,"borderTopWidth",true));}function add(l,t){left+=parseInt(l,10)||0;top+=parseInt(t,10)||0;}return results;};jQuery.fn.extend({position:function(){var left=0,top=0,results;if(this[0]){var offsetParent=this.offsetParent(),offset=this.offset(),parentOffset=/^body|html$/i.test(offsetParent[0].tagName)?{top:0,left:0}:offsetParent.offset();offset.top-=num(this,'marginTop');offset.left-=num(this,'marginLeft');parentOffset.top+=num(offsetParent,'borderTopWidth');parentOffset.left+=num(offsetParent,'borderLeftWidth');results={top:offset.top-parentOffset.top,left:offset.left-parentOffset.left};}return results;},offsetParent:function(){var offsetParent=this[0].offsetParent;while(offsetParent&&(!/^body|html$/i.test(offsetParent.tagName)&&jQuery.css(offsetParent,'position')=='static'))offsetParent=offsetParent.offsetParent;return jQuery(offsetParent);}});jQuery.each(['Left','Top'],function(i,name){var method='scroll'+name;jQuery.fn[method]=function(val){if(!this[0])return;return val!=undefined?this.each(function(){this==window||this==document?window.scrollTo(!i?val:jQuery(window).scrollLeft(),i?val:jQuery(window).scrollTop()):this[method]=val;}):this[0]==window||this[0]==document?self[i?'pageYOffset':'pageXOffset']||jQuery.boxModel&&document.documentElement[method]||document.body[method]:this[0][method];};});jQuery.each(["Height","Width"],function(i,name){var tl=i?"Left":"Top",br=i?"Right":"Bottom";jQuery.fn["inner"+name]=function(){return this[name.toLowerCase()]()+num(this,"padding"+tl)+num(this,"padding"+br);};jQuery.fn["outer"+name]=function(margin){return this["inner"+name]()+num(this,"border"+tl+"Width")+num(this,"border"+br+"Width")+(margin?num(this,"margin"+tl)+num(this,"margin"+br):0);};});})();
;
/* AGGREGATED JS FILE: misc/drupal.js */
// $Id: drupal.js,v 1.29.2.2 2008/08/13 18:12:23 drumm Exp $

var Drupal = Drupal || {};

/**
 * Set the variable that indicates if JavaScript behaviors should be applied
 */
Drupal.jsEnabled = document.getElementsByTagName && document.createElement && document.createTextNode && document.documentElement && document.getElementById;

/**
 * Extends the current object with the parameter. Works recursively.
 */
Drupal.extend = function(obj) {
  for (var i in obj) {
    if (this[i]) {
      Drupal.extend.apply(this[i], [obj[i]]);
    }
    else {
      this[i] = obj[i];
    }
  }
};

/**
 * Redirects a button's form submission to a hidden iframe and displays the result
 * in a given wrapper. The iframe should contain a call to
 * window.parent.iframeHandler() after submission.
 */
Drupal.redirectFormButton = function (uri, button, handler) {
  // Trap the button
  button.onmouseover = button.onfocus = function() {
    button.onclick = function() {
      // Create target iframe
      Drupal.createIframe();

      // Prepare variables for use in anonymous function.
      var button = this;
      var action = button.form.action;
      var target = button.form.target;

      // Redirect form submission to iframe
      this.form.action = uri;
      this.form.target = 'redirect-target';

      handler.onsubmit();

      // Set iframe handler for later
      window.iframeHandler = function () {
        var iframe = $('#redirect-target').get(0);
        // Restore form submission
        button.form.action = action;
        button.form.target = target;

        // Get response from iframe body
        try {
          response = (iframe.contentWindow || iframe.contentDocument || iframe).document.body.innerHTML;
          // Firefox 1.0.x hack: Remove (corrupted) control characters
          response = response.replace(/[\f\n\r\t]/g, ' ');
          if (window.opera) {
            // Opera-hack: it returns innerHTML sanitized.
            response = response.replace(/&quot;/g, '"');
          }
        }
        catch (e) {
          response = null;
        }

        response = Drupal.parseJson(response);
        // Check response code
        if (response.status == 0) {
          handler.onerror(response.data);
          return;
        }
        handler.oncomplete(response.data);

        return true;
      }

      return true;
    }
  }
  button.onmouseout = button.onblur = function() {
    button.onclick = null;
  }
};

/**
 * Retrieves the absolute position of an element on the screen
 */
Drupal.absolutePosition = function (el) {
  var sLeft = 0, sTop = 0;
  var isDiv = /^div$/i.test(el.tagName);
  if (isDiv && el.scrollLeft) {
    sLeft = el.scrollLeft;
  }
  if (isDiv && el.scrollTop) {
    sTop = el.scrollTop;
  }
  var r = { x: el.offsetLeft - sLeft, y: el.offsetTop - sTop };
  if (el.offsetParent) {
    var tmp = Drupal.absolutePosition(el.offsetParent);
    r.x += tmp.x;
    r.y += tmp.y;
  }
  return r;
};

/**
 * Return the dimensions of an element on the screen
 */
Drupal.dimensions = function (el) {
  return { width: el.offsetWidth, height: el.offsetHeight };
};

/**
 *  Returns the position of the mouse cursor based on the event object passed
 */
Drupal.mousePosition = function(e) {
  return { x: e.clientX + document.documentElement.scrollLeft, y: e.clientY + document.documentElement.scrollTop };
};

/**
 * Parse a JSON response.
 *
 * The result is either the JSON object, or an object with 'status' 0 and 'data' an error message.
 */
Drupal.parseJson = function (data) {
  if ((data.substring(0, 1) != '{') && (data.substring(0, 1) != '[')) {
    return { status: 0, data: data.length ? data : 'Unspecified error' };
  }
  return eval('(' + data + ');');
};

/**
 * Create an invisible iframe for form submissions.
 */
Drupal.createIframe = function () {
  if ($('#redirect-holder').size()) {
    return;
  }
  // Note: some browsers require the literal name/id attributes on the tag,
  // some want them set through JS. We do both.
  window.iframeHandler = function () {};
  var div = document.createElement('div');
  div.id = 'redirect-holder';
  $(div).html('<iframe name="redirect-target" id="redirect-target" class="redirect" onload="window.iframeHandler();"></iframe>');
  var iframe = div.firstChild;
  $(iframe)
    .attr({
      name: 'redirect-target',
      id: 'redirect-target'
    })
    .css({
      position: 'absolute',
      height: '1px',
      width: '1px',
      visibility: 'hidden'
    });
  $('body').append(div);
};

/**
 * Delete the invisible iframe
 */
Drupal.deleteIframe = function () {
  $('#redirect-holder').remove();
};

/**
 * Freeze the current body height (as minimum height). Used to prevent
 * unnecessary upwards scrolling when doing DOM manipulations.
 */
Drupal.freezeHeight = function () {
  Drupal.unfreezeHeight();
  var div = document.createElement('div');
  $(div).css({
    position: 'absolute',
    top: '0px',
    left: '0px',
    width: '1px',
    height: $('body').css('height')
  }).attr('id', 'freeze-height');
  $('body').append(div);
};

/**
 * Unfreeze the body height
 */
Drupal.unfreezeHeight = function () {
  $('#freeze-height').remove();
};

/**
 * Wrapper to address the mod_rewrite url encoding bug
 * (equivalent of drupal_urlencode() in PHP).
 */
Drupal.encodeURIComponent = function (item, uri) {
  uri = uri || location.href;
  item = encodeURIComponent(item).replace(/%2F/g, '/');
  return (uri.indexOf('?q=') != -1) ? item : item.replace(/%26/g, '%2526').replace(/%23/g, '%2523').replace(/\/\//g, '/%252F');
};

// Global Killswitch on the <html> element
if (Drupal.jsEnabled) {
  $(document.documentElement).addClass('js');
}

;
/* AGGREGATED JS FILE: sites/all/modules/date/date_timezone/date_timezone.js */
// $Id: date_timezone.js,v 1.1.2.3 2008/06/20 12:26:06 karens Exp $
/**
 * Set the client's system time zone as default values of form fields.
 */
Drupal.setDefaultTimezone = function() {
  var dateString = Date();
  // In some client environments, date strings include a time zone 
  // abbreviation which can be interpreted by PHP.
  var matches = Date().match(/\(([A-Z]{3,5})\)/);
  var abbreviation = matches ? matches[1] : 0;

  // For all other client environments, the abbreviation is set to "0" 
  // and the current offset from UTC and daylight saving time status are 
  // used to guess the time zone.
  var dateNow = new Date();
  var offsetNow = dateNow.getTimezoneOffset() * -60;

  // Use January 1 and July 1 as test dates for determining daylight 
  // saving time status by comparing their offsets.
  var dateJan = new Date(dateNow.getFullYear(), 0, 1, 12, 0, 0, 0);
  var dateJul = new Date(dateNow.getFullYear(), 6, 1, 12, 0, 0, 0);
  var offsetJan = dateJan.getTimezoneOffset() * -60;
  var offsetJul = dateJul.getTimezoneOffset() * -60;

  // If the offset from UTC is identical on January 1 and July 1, 
  // assume daylight saving time is not used in this time zone.
  if (offsetJan == offsetJul) {
    var isDaylightSavingTime = '';
  }
  // If the maximum annual offset is equivalent to the current offset, 
  // assume daylight saving time is in effect.
  else if (Math.max(offsetJan, offsetJul) == offsetNow) {
    var isDaylightSavingTime = 1;
  }
  // Otherwise, assume daylight saving time is not in effect.
  else {
    var isDaylightSavingTime = 0;
  }

  // Submit request to the user/timezone callback and set the form field 
  // to the response time zone.
  var path = 'user/timezone/' + abbreviation + '/' + offsetNow + '/' + isDaylightSavingTime;
  $.getJSON(location.pathname, { q: path, date: dateString }, function (data) {
    if (data) {
      $("#edit-date-default-timezone, #edit-user-register-timezone, #edit-timezone-name").val(data);
    }
  });
};
;
/* AGGREGATED JS FILE: sites/all/modules/jquery_update/compat-1.0.js */
// UPGRADE: The following attribute helpers should now be used as:
// .attr("title") or .attr("title","new title")
jQuery.each(["id","title","name","href","src","rel"], function(i,n){
  jQuery.fn[ n ] = function(h) {
    return h == undefined ?
      this.length ? this[0][n] : null :
      this.attr( n, h );
  };
});

// UPGRADE: The following css helpers should now be used as:
// .css("top") or .css("top","30px")
jQuery.each("top,left,position,float,overflow,color,background".split(","), function(i,n){
  jQuery.fn[ n ] = function(h) {
    return h == undefined ?
      ( this.length ? jQuery.css( this[0], n ) : null ) :
      this.css( n, h );
  };
});

// UPGRADE: The following event helpers should now be used as such:
// .oneblur(fn) -> .one("blur",fn)
// .unblur(fn) -> .unbind("blur",fn)
var e = ("blur,focus,load,resize,scroll,unload,click,dblclick," +
  "mousedown,mouseup,mousemove,mouseover,mouseout,change,reset,select," + 
  "submit,keydown,keypress,keyup,error").split(",");

// Go through all the event names, but make sure that
// it is enclosed properly
for ( var i = 0; i < e.length; i++ ) new function(){
      
  var o = e[i];
    
  // Handle event unbinding
  jQuery.fn["un"+o] = function(f){ return this.unbind(o, f); };
    
  // Finally, handle events that only fire once
  jQuery.fn["one"+o] = function(f){
    // save cloned reference to this
    var element = jQuery(this);
    var handler = function() {
      // unbind itself when executed
      element.unbind(o, handler);
      element = null;
      // apply original handler with the same arguments
      return f.apply(this, arguments);
    };
    return this.bind(o, handler);
  };
      
};

// UPGRADE: .ancestors() was removed in favor of .parents()
jQuery.fn.ancestors = jQuery.fn.parents;

// UPGRADE: The CSS selector :nth-child() now starts at 1, instead of 0
jQuery.expr[":"]["nth-child"] = "jQuery.nth(a.parentNode.firstChild,parseInt(m[3])+1,'nextSibling')==a";

// UPGRADE: .filter(["div", "span"]) now becomes .filter("div, span")
jQuery.fn._filter = jQuery.fn.filter;
jQuery.fn.filter = function(arr){
  return this._filter( arr.constructor == Array ? arr.join(",") : arr );
};

;
/* AGGREGATED JS FILE: sites/all/modules/panels/js/panels.js */
// $Id: panels.js,v 1.1.2.9 2008/05/27 19:25:57 sdboyer Exp $

Drupal.Panels = {};

Drupal.Panels.autoAttach = function() {
  if ($.browser.msie) {
    // If IE, attach a hover event so we can see our admin links.
    $("div.panel-pane").hover(
      function() {
        $('div.panel-hide', this).addClass("panel-hide-hover"); return true;
      },
      function() {
        $('div.panel-hide', this).removeClass("panel-hide-hover"); return true;
      }
    );
    $("div.admin-links").hover(
      function() {
        $(this).addClass("admin-links-hover"); return true;
      },
      function(){
        $(this).removeClass("admin-links-hover"); return true;
      }
    );
  }
};

$(Drupal.Panels.autoAttach);

;
/* AGGREGATED JS FILE: sites/all/themes/zen/atb_zen/views-more-infos.js */
var id_open = '';

// Display a div "more info"
function atb_view_display_details(id, isActu) {
    // Clic sur une actu
    if (isActu) {
        // Fermeture des autres actualités éventuellement ouvertes
        $("div.actu_invisible").hide();
        
        // Affichage de l'actualité
        $('#'+id).toggle();
    }
    else {
        //alert(id_open);
        atb_view_hide_details();
        $('#'+id).toggle();
        id_open = id;
        if (id != 'id_view_hidden_block_1' && id != 'id_view_hidden_block_2' && id != 'id_view_hidden_block_3' && id != 'id_view_hidden_block_4') {
            atb_view_display_main_bloc();
        }
    }
    return false;
}
// Hide the div "more info"
function atb_view_hide_details(idActu) {
    // Clic sur une actu
    if (idActu) {
        $('#'+idActu).toggle();
    }
    else {
        //si l'élément precedement ouvert est une div vol de la page offre speciale
        if(id_open.substr(0,3)=='vol') {
            document.getElementById(id_open).style.display = 'none';
            id_open='id_view_hidden_block_1';
        }

        //si l'élément precedement ouvert est une div promo vacances de la page offre speciale
        if(id_open.substr(0,3)=='vac') {
            document.getElementById(id_open).style.display = 'none';
            document.getElementById(id_open+'_link').style.display = '';
            id_open='id_view_hidden_block_1';
        }
        $('#'+id_open).toggle();
        id_open = '';
    }
    return false;
}

/**
 * Evol Lot 1 NMA - 28/09/09
 * fonction d'ouverture/fermeture des div de contenu
 */
 
//affiche le bloc offre speciale/notre selection
function atb_view_display_main_bloc() {
  document.getElementById('id_view_hidden_block_1').style.display = '';
  return false;
}

// Hide the div "Promo vacances" de la page offre speciale
function atb_view_hide_details_promo_vac() {
  $('#'+id_open).toggle();
  $('#'+id_open+'_link').toggle();
  id_open = '';
  return false;
}

// Display a div for promo vacances details or page offre speciale
function atb_view_display_details_promo_vac(id) {
  atb_view_hide_details_promo_vac();
  $('#'+id).toggle();
  id_open = id;
  atb_view_display_main_bloc();
  document.getElementById(id+'_link').style.display = 'none'; 
  return false;
}

//Afficher la page offre speciale/promo vacances, ouvrir le div de la promo vacances concernée
//et focus sur le div
function atb_view_display_selected_promo_vacances(id) {
window.location.href = "/viatoulouse/offres-speciales/promo-vacances#promo"+id;
document.getElementById("vac_id_view_hidden_" + id).style.display = ""; 

//document.getElementById("vac_id_view_hidden_" + id + "_link").style.display = "none"; 
id_open = "vac_id_view_hidden_" + id;

//$("#vac_id_view_hidden_" + id).focus();
//return false;

}

;
/* AGGREGATED JS FILE: sites/all/modules/atb/atb_menu_dynamique/js/atb_menu_dynamique.js */
$(document).ready(function() {


  if (jQuery.browser.msie && jQuery.browser.version=="6.0") {
  return;
  }
  else {
    $("#navbar .menu li").mouseover(function() {
      $('#navbar .menu li a').removeClass('menuactive');
      if ($(this).children('a').attr('href')!='/fr/viatoulouse') {
        $(this).children('a').addClass('menuactive');
      }
      
	  var titre = $(this).children('a').attr('href');
		if ((titre == "/fr/aeroport" || titre == "/en/airport") && $("#menu_dynamic_1").css("display")!='none') {	
			$("#menu_dynamic_1").fadeIn("slow",function(){ });

		}
		if ((titre == "/fr/vols/recherche" || titre == "/en/vols/recherche") && $("#menu_dynamic_2").css("display")!='none') {	
			$("#menu_dynamic_2").fadeIn("slow",function(){ });

		}
		if ((titre == "/fr/guide-du-voyageur" || titre == "/en/travellers-guide") && $("#menu_dynamic_3").css("display")!='none') {	
			$("#menu_dynamic_3").fadeIn("slow",function(){ });

		}
		if ((titre == "/fr/services-boutiques" || titre == "/en/shops-and-services") && $("#menu_dynamic_4").css("display")!='none') {	
			$("#menu_dynamic_4").fadeIn("slow",function(){ });

		}
		if ((titre == "/fr/professionnels" || titre == "/en/professionals") && $("#menu_dynamic_5").css("display")!='none') {	
			$("#menu_dynamic_5").fadeIn("slow",function(){ });

		}
		if ((titre == "/fr/viatoulouse") && $("#menu_dynamic_6").css("display")!='none') {	
			$("#menu_dynamic_6").fadeIn("slow",function(){ });

		}
	});
  
  
	
  	
	$("#navbar .menu li").mousemove(function() {
	  var titre = $(this).children('a').attr('href');
	  
	    if (titre == "/fr/aeroport" || titre == "/en/airport") {	
		$("#menu_dynamic_2").css("display","none");
		$("#menu_dynamic_3").css("display","none");
		$("#menu_dynamic_4").css("display","none");
		$("#menu_dynamic_5").css("display","none");
		$("#menu_dynamic_6").css("display","none");
		$("#menu_dynamic_1").css("display","block");
		}
		if (titre == "/fr/vols/recherche" || titre == "/en/vols/recherche") {
		$("#menu_dynamic_1").css("display","none");
	    $("#menu_dynamic_3").css("display","none");
	    $("#menu_dynamic_4").css("display","none");
	    $("#menu_dynamic_5").css("display","none");	
	    $("#menu_dynamic_6").css("display","none");
		$("#menu_dynamic_2").css("display","block");
		}
		if (titre == "/fr/guide-du-voyageur" || titre == "/en/travellers-guide") {	
		$("#menu_dynamic_1").css("display","none");
	    $("#menu_dynamic_2").css("display","none");
	    $("#menu_dynamic_4").css("display","none");
	    $("#menu_dynamic_5").css("display","none");
	    $("#menu_dynamic_6").css("display","none");
		$("#menu_dynamic_3").css("display","block");
		}
		if (titre == "/fr/services-boutiques" || titre == "/en/shops-and-services") {	
		$("#menu_dynamic_1").css("display","none");
	    $("#menu_dynamic_2").css("display","none");
	    $("#menu_dynamic_3").css("display","none");
	    $("#menu_dynamic_5").css("display","none");
	    $("#menu_dynamic_6").css("display","none");
	    $("#menu_dynamic_4").css("display","block");
		}
		if (titre == "/fr/professionnels" || titre == "/en/professionals") {	
		$("#menu_dynamic_1").css("display","none");
	    $("#menu_dynamic_2").css("display","none");
	    $("#menu_dynamic_3").css("display","none");
	    $("#menu_dynamic_4").css("display","none");
	    $("#menu_dynamic_6").css("display","none");
        $("#menu_dynamic_5").css("display","block");
		}
		if (titre == "/fr/viatoulouse") {	
		$("#menu_dynamic_1").css("display","none");
	    $("#menu_dynamic_2").css("display","none");
	    $("#menu_dynamic_3").css("display","none");
	    $("#menu_dynamic_4").css("display","none");
	    $("#menu_dynamic_5").css("display","none");
        $("#menu_dynamic_6").css("display","block");
		}
	});
	
	$("#navbar").mouseout(function() {
    $('#navbar .menu li a').removeClass('menuactive');
	    $("#menu_dynamic_1").css("display","none");
	    $("#menu_dynamic_2").css("display","none");
	    $("#menu_dynamic_3").css("display","none");
	    $("#menu_dynamic_4").css("display","none");
	    $("#menu_dynamic_5").css("display","none");
        $("#menu_dynamic_6").css("display","none");
	});
	
	$("#menu_dynamic_1").mousemove(function() {
	    $("#menu_dynamic_1").css("display","block");
	    $('#navbar .menu li.mid-217 a').addClass('menuactive');
	});
	$("#menu_dynamic_2").mousemove(function() {
	    $("#menu_dynamic_2").css("display","block");
	    $('#navbar .menu li.mid-233 a').addClass('menuactive');
	});
	$("#menu_dynamic_3").mousemove(function() {
	    $("#menu_dynamic_3").css("display","block");
	    $('#navbar .menu li.mid-232 a').addClass('menuactive');
	});
	$("#menu_dynamic_4").mousemove(function() {
	    $("#menu_dynamic_4").css("display","block");
	    $('#navbar .menu li.mid-231 a').addClass('menuactive');
	});
 	$("#menu_dynamic_5").mousemove(function() {
	    $("#menu_dynamic_5").css("display","block");
	    $('#navbar .menu li.mid-216 a').addClass('menuactive');
	});
     $("#menu_dynamic_6").mousemove(function() {
	    $("#menu_dynamic_6").css("display","block");
	    $('#navbar .menu li.mid-218 a').addClass('menuactive');
	});
	
  // Set active item in menu using breadcrumb
  if ($('div.breadcrumb a').length >= 2) {
    var link = $('div.breadcrumb a:eq(1)');  // Get second element of breadcrumb
    var title = link.attr('title');
    if (title != '') {
      $('#block-i18nblocks-4 li.leaf a[title="'+  title +'"]').addClass('active');
    }
  }
}
});


;
/* AGGREGATED JS FILE: sites/all/modules/quicktabs/js/quicktabs.js */
Drupal.quicktabs = function() {
  $('div.quicktabs:first-child').show();
  $('ul.quicktabs_tabs li:first-child').addClass('active');
 
  var effect = Drupal.settings.quicktabs.effect;
  var clickFunction = function() {      
    var tabIndex = this.myTabIndex;
    //Ne change pas les panels de la page d'accueil sur click DEPART ou ARRIVEE
    //mais seulement sur l'onglet Voyage, vol, hotel, voiture
    if (this.mytabs == 'block-panels_mini-1'){
    switch(tabIndex) {
      case 0:
        show_pane('vacances-pane');
      break;
      case 1:
        show_pane('vols-pane');
      break;
      case 2:
        show_pane('hotels-pane');
      break;
      case 3:
        show_pane('voitures-pane');
      break;
    }
  }
    
    $(this).parents('div.quicktabs_wrapper').eq(0).children().children('div.quicktabs').hide();
    $(this).parents('li').eq(0).siblings().removeClass('active');
    $(this).parents('li').eq(0).addClass('active');
    switch (effect) {
      case 'none':
        $(this).parents('div.quicktabs_wrapper').eq(0).find('div.quicktabs:eq('+tabIndex+')').show();
        break;
      case 'fade':
        $(this).parents('div.quicktabs_wrapper').eq(0).find('div.quicktabs:eq('+tabIndex+')').fadeIn();        
        break;
      case 'slide':
        $(this).parents('div.quicktabs_wrapper').eq(0).find('div.quicktabs:eq('+tabIndex+')').slideDown('slow');
        break;
    }

    return false;
  };
  $('ul.quicktabs_tabs').each(function(){
    var i = 0;
    var j = $(this).parents('div.block').eq(0).attr("id");
    $(this).find('li a').each(function() {
      this.myTabIndex = i++;
      this.mytabs = j;
    });
    j++;
  });
   
  $('ul.quicktabs_tabs li a').bind('click', clickFunction);
//Evol lot 1 - NMA - 23/10/09
//Selectionne l'onglet Voyage, vol, hotel, voiture de la page d'accueil 
//en fonction de l'URL passée (#voyages, #vols, ...
// 26/05/2011 : prise en compte d'un champ hidden de sélectione d'onglet
 var new_url = window.location.href;
 var tab_hidden = $('input[name="onglet_moteur"]:hidden').val();
  if ((tab_hidden && tab_hidden == 'voyages') || new_url.indexOf("#voyages")!=-1) {
    show_pane('vacances-pane');
     $('div.block-panels_mini div.quicktabs_main').eq(0).find('div.quicktabs:eq(0)').show();
     $('div.block-panels_mini div.quicktabs_main').eq(0).find('div.quicktabs:eq(1)').hide();
     $('div.block-panels_mini div.quicktabs_main').eq(0).find('div.quicktabs:eq(2)').hide();
     $('div.block-panels_mini div.quicktabs_main').eq(0).find('div.quicktabs:eq(3)').hide();
     
     $('div.block-panels_mini ul.quicktabs_tabs').eq(0).find('li:eq(0)').addClass('active');
     $('div.block-panels_mini ul.quicktabs_tabs').eq(0).find('li:eq(1)').removeClass('active');
     $('div.block-panels_mini ul.quicktabs_tabs').eq(0).find('li:eq(2)').removeClass('active');
     $('div.block-panels_mini ul.quicktabs_tabs').eq(0).find('li:eq(3)').removeClass('active'); 
  }
  if ((tab_hidden && tab_hidden == 'vols') || new_url.indexOf("#vols")!=-1) {
    show_pane('vols-pane');
    
     $('div.block-panels_mini div.quicktabs_main').eq(0).find('div.quicktabs:eq(0)').hide();
     $('div.block-panels_mini div.quicktabs_main').eq(0).find('div.quicktabs:eq(1)').show();
     $('div.block-panels_mini div.quicktabs_main').eq(0).find('div.quicktabs:eq(2)').hide();
     $('div.block-panels_mini div.quicktabs_main').eq(0).find('div.quicktabs:eq(3)').hide();
     
     $('div.block-panels_mini ul.quicktabs_tabs').eq(0).find('li:eq(0)').removeClass('active');
     $('div.block-panels_mini ul.quicktabs_tabs').eq(0).find('li:eq(1)').addClass('active');
     $('div.block-panels_mini ul.quicktabs_tabs').eq(0).find('li:eq(2)').removeClass('active');
     $('div.block-panels_mini ul.quicktabs_tabs').eq(0).find('li:eq(3)').removeClass('active');
  }

  if ((tab_hidden && tab_hidden == 'hotels') || new_url.indexOf("#hotels")!=-1) {
    show_pane('hotels-pane');
     $('div.block-panels_mini div.quicktabs_main').eq(0).find('div.quicktabs:eq(0)').hide();
     $('div.block-panels_mini div.quicktabs_main').eq(0).find('div.quicktabs:eq(1)').hide();
     $('div.block-panels_mini div.quicktabs_main').eq(0).find('div.quicktabs:eq(2)').show();
     $('div.block-panels_mini div.quicktabs_main').eq(0).find('div.quicktabs:eq(3)').hide();
     
     $('div.block-panels_mini ul.quicktabs_tabs').eq(0).find('li:eq(0)').removeClass('active');
     $('div.block-panels_mini ul.quicktabs_tabs').eq(0).find('li:eq(1)').removeClass('active');
     $('div.block-panels_mini ul.quicktabs_tabs').eq(0).find('li:eq(2)').addClass('active');
     $('div.block-panels_mini ul.quicktabs_tabs').eq(0).find('li:eq(3)').removeClass('active');
  }

  if ((tab_hidden && tab_hidden == 'voitures') || new_url.indexOf("#voitures")!=-1) {
    show_pane('voitures-pane');
     $('div.block-panels_mini div.quicktabs_main').eq(0).find('div.quicktabs:eq(0)').hide();
     $('div.block-panels_mini div.quicktabs_main').eq(0).find('div.quicktabs:eq(1)').hide();
     $('div.block-panels_mini div.quicktabs_main').eq(0).find('div.quicktabs:eq(2)').hide();
     $('div.block-panels_mini div.quicktabs_main').eq(0).find('div.quicktabs:eq(3)').show();
     
     $('div.block-panels_mini ul.quicktabs_tabs').eq(0).find('li:eq(0)').removeClass('active');
     $('div.block-panels_mini ul.quicktabs_tabs').eq(0).find('li:eq(1)').removeClass('active');
     $('div.block-panels_mini ul.quicktabs_tabs').eq(0).find('li:eq(2)').removeClass('active');
     $('div.block-panels_mini ul.quicktabs_tabs').eq(0).find('li:eq(3)').addClass('active');
  }
  
}

if (Drupal.jsEnabled) {
  $(document).ready(Drupal.quicktabs);  
}
;
/* AGGREGATED JS FILE: sites/all/modules/atb/atb_custom.js */

// Display or hide some DOM element
function atb_voyage_afficher(info) {
  var row = document.getElementById(info);
  if (row.style.display == 'none') {
    row.style.display = 'block';
  }
  else {
    row.style.display = 'none';
  }
}

/**
 * CCS
 * Display hollidays form error 
 */
function setMsgHollidaysError(msg) {
	$('#form_vacances_result').html(msg);
    $('#form_vacances_result').slideDown();
}

/**
  * CCS
  * Action : valid_form_opodo_voiture
  * Action exécutée sur le submit de la recherche d'un séjour
  */
 function isHollidaysErrors(date_depart)
 { 
 	 form_errors_msg = ""; // init 
 	 
	 // Get date départ value
	 //date_depart = $('#edit-atb-speedresa-search-date-depart-date').value;
	 
//Evol lot 1 - NM - 05/05/09
	 if(date_depart.length != 0) {
	 //	form_errors_msg += "<li>" + 'La date de d&eacute;part est obligatoire' + "</li>";
	 	
	  // date du jour
	   today = new Date();
	   rightnow = new Date(today.getFullYear(), today.getMonth(), today.getDate(), 0,0,0,0);
		
	   if(transformToDate(date_depart).valueOf() < rightnow.valueOf() && date_depart.length > 0)
	   {
	 	 form_errors_msg += "<li>" + 'la date doit &ecirc;tre sup&eacute;rieure &agrave; la date du jour' + "</li>";
	   }
	 
 	  if(form_errors_msg.length > 0)
 	  { 
 		setMsgHollidaysError("<div class='messages error'><ul>" + form_errors_msg + "</ul></div>");
 		return false;
 	  }
    } 	
 	return true;
 }
 
 	/**
 	 *  CCS
 	 *  11-07-08
 	 *  Fonction de validation du formulaire
 	 */
	function hollidaysSearchSubmit(){
		// get hollidays forms
		date = document.getElementById('edit-atb-speedresa-search-date-depart-date').value;
		
		// Validation du formulaire
		return isHollidaysErrors(date);
	}
	
	/**
 	 *  
 	 *  19/08/09 - NMA
 	 *  Fonction pour cocher/décocher tous les checkbox d'un contrôle
 	 */
	function check_uncheck(ctrl_name,choice){
	chk=document.getElementsByName(ctrl_name).item(0).getElementsByTagName('input');
	
	  switch(choice) {
	  case 1:
	    for (var i=0;i<chk.length;i++) {
	      chk.item(i).checked = true;  
	    }	 
	    break;
	
	  case 2:
	    for (var i=0;i<chk.length;i++) {
	      chk.item(i).checked = false;  
	    }	 
	    break;
	  }
	}
	
	/**
 	 *  
 	 *  20/08/09 - NMA
 	 *  Fonction pour Afficher/cacher liste déroulante type de vol si sélection 'vol' de l'offre spéciale
 	 */
 	  
	function display_hide_div(selected_value){
	  if (selected_value==226) {
	    document.getElementById('field_type_vol').style.display = '';	    
	    document.getElementById('offres_speciale_title1').style.display = 'none';
	    document.getElementById('offres_speciale_title').style.display = '';
	    
	    document.getElementById('edit-field-nb-jours-key-wrapper').style.display = 'none';
	    document.getElementById('edit-field-nb-nuits-key-wrapper').style.display = 'none';
	    document.getElementById('edit-field-prix-origine-0-value-wrapper').style.display = 'none';
	  }
	  else {
    	document.getElementById('field_type_vol').style.display = 'none';
    	document.getElementById('offres_speciale_title1').style.display = '';
	    document.getElementById('offres_speciale_title').style.display = 'none';
	    
	    document.getElementById('edit-field-nb-jours-key-wrapper').style.display = '';
	    document.getElementById('edit-field-nb-nuits-key-wrapper').style.display = '';
	    document.getElementById('edit-field-prix-origine-0-value-wrapper').style.display = '';
	  }
	}
	
$(document).ready(function() {
 	$('#edit-title1').change(function() {
	  $('#edit-title').val($("#edit-title1 option:selected").text());
	});
	var indexsite = document.getElementById('edit-taxonomy-16') ;
	if(indexsite) {
		var choix = indexsite.selectedIndex;
	    valeur_cherchee = indexsite.options[choix].text;
		 document.getElementById('offres_speciale_title1').style.display = 'none';
		 document.getElementById('offres_speciale_title').style.display = 'none';
		 document.getElementById('edit-field-nb-jours-key-wrapper').style.display = 'none';
		 document.getElementById('edit-field-nb-nuits-key-wrapper').style.display = 'none';
		 document.getElementById('edit-field-prix-origine-0-value-wrapper').style.display = 'none';
		    
		 if(valeur_cherchee=='Vol') {
		 document.getElementById('offres_speciale_title').style.display = '';
		 }
		 if(valeur_cherchee=='Promos vacances'){
		 document.getElementById('offres_speciale_title1').style.display = '';
		 document.getElementById('edit-field-nb-jours-key-wrapper').style.display = '';
		 document.getElementById('edit-field-nb-nuits-key-wrapper').style.display = '';
		 document.getElementById('edit-field-prix-origine-0-value-wrapper').style.display = '';
		 }
	 
	}
    

	
});
;
/* AGGREGATED JS FILE: sites/all/modules/date/date_popup/lib/ui.calendar.js */
/* jQuery Calendar v2.7
   Written by Marc Grabanski (m@marcgrabanski.com) and enhanced by Keith Wood (kbwood@iprimus.com.au).

   Copyright (c) 2007 Marc Grabanski (http://marcgrabanski.com/code/jquery-calendar)
   Dual licensed under the GPL (http://www.gnu.org/licenses/gpl-3.0.txt) and
   CC (http://creativecommons.org/licenses/by/3.0/) licenses. "Share or Remix it but please Attribute the authors."
   Date: 09-03-2007  */

/* PopUp Calendar manager.
   Use the singleton instance of this class, popUpCal, to interact with the calendar.
   Settings for (groups of) calendars are maintained in an instance object
   (PopUpCalInstance), allowing multiple different settings on the same page. */
function PopUpCal() {
	this._nextId = 0; // Next ID for a calendar instance
	this._inst = []; // List of instances indexed by ID
	this._curInst = null; // The current instance in use
	this._disabledInputs = []; // List of calendar inputs that have been disabled
	this._popUpShowing = false; // True if the popup calendar is showing , false if not
	this._inDialog = false; // True if showing within a "dialog", false if not
	this.regional = []; // Available regional settings, indexed by language code
	this.regional[''] = { // Default regional settings
		clearText: 'Clear', // Display text for clear link
		closeText: 'Close', // Display text for close link
		prevText: '&lt;Prev', // Display text for previous month link
		nextText: 'Next&gt;', // Display text for next month link
		currentText: 'Today', // Display text for current month link
		dayNames: ['Su','Mo','Tu','We','Th','Fr','Sa'], // Names of days starting at Sunday
		monthNames: ['January','February','March','April','May','June',
			'July','August','September','October','November','December'], // Names of months
		dateFormat: 'DMY/' // First three are day, month, year in the required order,
			// fourth (optional) is the separator, e.g. US would be 'MDY/', ISO would be 'YMD-'
	};
	this._defaults = { // Global defaults for all the calendar instances
		autoPopUp: 'focus', // 'focus' for popup on focus,
			// 'button' for trigger button, or 'both' for either
		defaultDate: null, // Used when field is blank: actual date,
			// +/-number for offset from today, null for today
		appendText: '', // Display text following the input box, e.g. showing the format
		buttonText: '...', // Text for trigger button
		buttonImage: '', // URL for trigger button image
		buttonImageOnly: false, // True if the image appears alone, false if it appears on a button
		closeAtTop: true, // True to have the clear/close at the top,
			// false to have them at the bottom
		hideIfNoPrevNext: false, // True to hide next/previous month links
			// if not applicable, false to just disable them
		changeMonth: true, // True if month can be selected directly, false if only prev/next
		changeYear: true, // True if year can be selected directly, false if only prev/next
		yearRange: '-10:+10', // Range of years to display in drop-down,
			// either relative to current year (-nn:+nn) or absolute (nnnn:nnnn)
		firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...
		changeFirstDay: true, // True to click on day name to change, false to remain as set
		showOtherMonths: false, // True to show dates in other months, false to leave blank
		minDate: null, // The earliest selectable date, or null for no limit
		maxDate: null, // The latest selectable date, or null for no limit
		speed: 'medium', // Speed of display/closure
		customDate: null, // Function that takes a date and returns an array with
			// [0] = true if selectable, false if not,
			// [1] = custom CSS class name(s) or '', e.g. popUpCal.noWeekends
		fieldSettings: null, // Function that takes an input field and
			// returns a set of custom settings for the calendar
		onSelect: null // Define a callback function when a date is selected
	};
	$.extend(this._defaults, this.regional['']);
	this._calendarDiv = $('<div id="calendar_div"></div>');
	$(document.body).append(this._calendarDiv);
	$(document.body).mousedown(this._checkExternalClick);
}

$.extend(PopUpCal.prototype, {
	
	markerClassName: 'hasCalendar',

	
	_register: function(inst) {
		var id = this._nextId++;
		this._inst[id] = inst;
		return id;
	},

	
	_getInst: function(id) {
		return this._inst[id] || id;
	},

	/* Override the default settings for all instances of the calendar.
	   @param  settings  object - the new settings to use as defaults (anonymous object)
	   @return void */
	setDefaults: function(settings) {
		extendRemove(this._defaults, settings || {});
	},

	
	_doKeyDown: function(e) {
		var inst = popUpCal._getInst(this._calId);
		if (popUpCal._popUpShowing) {
			switch (e.keyCode) {
				case 9:  popUpCal.hideCalendar(inst, '');
						break; // hide on tab out
				case 13: popUpCal._selectDate(inst);
						break; // select the value on enter
				case 27: popUpCal.hideCalendar(inst, inst._get('speed'));
						break; // hide on escape
				case 33: popUpCal._adjustDate(inst, -1, (e.ctrlKey ? 'Y' : 'M'));
						break; // previous month/year on page up/+ ctrl
				case 34: popUpCal._adjustDate(inst, +1, (e.ctrlKey ? 'Y' : 'M'));
						break; // next month/year on page down/+ ctrl
				case 35: if (e.ctrlKey) popUpCal._clearDate(inst);
						break; // clear on ctrl+end
				case 36: if (e.ctrlKey) popUpCal._gotoToday(inst);
						break; // current on ctrl+home
				case 37: if (e.ctrlKey) popUpCal._adjustDate(inst, -1, 'D');
						break; // -1 day on ctrl+left
				case 38: if (e.ctrlKey) popUpCal._adjustDate(inst, -7, 'D');
						break; // -1 week on ctrl+up
				case 39: if (e.ctrlKey) popUpCal._adjustDate(inst, +1, 'D');
						break; // +1 day on ctrl+right
				case 40: if (e.ctrlKey) popUpCal._adjustDate(inst, +7, 'D');
						break; // +1 week on ctrl+down
			}
		}
		else if (e.keyCode == 36 && e.ctrlKey) { // display the calendar on ctrl+home
			popUpCal.showFor(this);
		}
	},

	
	_doKeyPress: function(e) {
		var inst = popUpCal._getInst(this._calId);
		var chr = String.fromCharCode(e.charCode == undefined ? e.keyCode : e.charCode);
		return (chr < ' ' || chr == inst._get('dateFormat').charAt(3) ||
			(chr >= '0' && chr <= '9')); // only allow numbers and separator
	},

	
	_connectCalendar: function(target, inst) {
		var input = $(target);
		if (this._hasClass(input, this.markerClassName)) {
			return;
		}
		var appendText = inst._get('appendText');
		if (appendText) {
			input.after('<span class="calendar_append">' + appendText + '</span>');
		}
		var autoPopUp = inst._get('autoPopUp');
		if (autoPopUp == 'focus' || autoPopUp == 'both') { // pop-up calendar when in the marked field
			input.focus(this.showFor);
		}
		if (autoPopUp == 'button' || autoPopUp == 'both') { // pop-up calendar when button clicked
			var buttonText = inst._get('buttonText');
			var buttonImage = inst._get('buttonImage');
			var buttonImageOnly = inst._get('buttonImageOnly');
			var trigger = $(buttonImageOnly ? '<img class="calendar_trigger" src="' +
				buttonImage + '" alt="' + buttonText + '" title="' + buttonText + '"/>' :
				'<button type="button" class="calendar_trigger">' + (buttonImage != '' ?
				'<img src="' + buttonImage + '" alt="' + buttonText + '" title="' + buttonText + '"/>' :
				buttonText) + '</button>');
			input.wrap('<span class="calendar_wrap"></span>').after(trigger);
			trigger.click(this.showFor);
		}
		input.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress);
		input[0]._calId = inst._id;
	},

	
	_inlineCalendar: function(target, inst) {
		var input = $(target);
		if (this._hasClass(input, this.markerClassName)) {
			return;
		}
		input.addClass(this.markerClassName).append(inst._calendarDiv);
		input[0]._calId = inst._id;
	},

	
	_hasClass: function(element, className) {
		var classes = element.attr('class');
		return (classes && classes.indexOf(className) > -1);
	},

	/* Pop-up the calendar in a "dialog" box.
	   @param  dateText  string - the initial date to display (in the current format)
	   @param  onSelect  function - the function(dateText) to call when a date is selected
	   @param  settings  object - update the dialog calendar instance's settings (anonymous object)
	   @param  pos       int[2] - coordinates for the dialog's position within the screen
			leave empty for default (screen centre)
	   @return void */
	dialogCalendar: function(dateText, onSelect, settings, pos) {
		var inst = this._dialogInst; // internal instance
		if (!inst) {
			inst = this._dialogInst = new PopUpCalInstance({}, false);
			this._dialogInput = $('<input type="text" size="1" style="position: absolute; top: -100px;"/>');
			this._dialogInput.keydown(this._doKeyDown);
			$('body').append(this._dialogInput);
			this._dialogInput[0]._calId = inst._id;
		}
		extendRemove(inst._settings, settings || {});
		this._dialogInput.val(dateText);

		
		if (self.innerHeight) { // all except Explorer
			windowWidth = self.innerWidth;
			windowHeight = self.innerHeight;
		} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
			windowWidth = document.documentElement.clientWidth;
			windowHeight = document.documentElement.clientHeight;
		} else if (document.body) { // other Explorers
			windowWidth = document.body.clientWidth;
			windowHeight = document.body.clientHeight;
		}
		this._pos = pos || // should use actual width/height below
			[(windowWidth / 2) - 100, (windowHeight / 2) - 100];

		// move input on screen for focus, but hidden behind dialog
		this._dialogInput.css('left', this._pos[0] + 'px').css('top', this._pos[1] + 'px');
		inst._settings.onSelect = onSelect;
		this._inDialog = true;
		this._calendarDiv.addClass('calendar_dialog');
		this.showFor(this._dialogInput[0]);
		if ($.blockUI) {
			$.blockUI(this._calendarDiv);
		}
	},

	/* Enable the input field(s) for entry.
	   @param  inputs  element/object - single input field or jQuery collection of input fields
	   @return void */
	enableFor: function(inputs) {
		inputs = (inputs.jquery ? inputs : $(inputs));
		inputs.each(function() {
			this.disabled = false;
			$('../button.calendar_trigger', this).each(function() { this.disabled = false; });
			$('../img.calendar_trigger', this).css({opacity:'1.0',cursor:''});
			var $this = this;
			popUpCal._disabledInputs = $.map(popUpCal._disabledInputs,
				function(value) { return (value == $this ? null : value); }); // delete entry
		});
	},

	/* Disable the input field(s) from entry.
	   @param  inputs  element/object - single input field or jQuery collection of input fields
	   @return void */
	disableFor: function(inputs) {
		inputs = (inputs.jquery ? inputs : $(inputs));
		inputs.each(function() {
			this.disabled = true;
			$('../button.calendar_trigger', this).each(function() { this.disabled = true; });
			$('../img.calendar_trigger', this).css({opacity:'0.5',cursor:'default'});
			var $this = this;
			popUpCal._disabledInputs = $.map(popUpCal._disabledInputs,
				function(value) { return (value == $this ? null : value); }); // delete entry
			popUpCal._disabledInputs[popUpCal._disabledInputs.length] = this;
		});
	},

	/* Update the settings for a calendar attached to an input field or division.
	   @param  control   element - the input field or div/span attached to the calendar or
	                     string - the ID or other jQuery selector of the input field
	   @param  settings  object - the new settings to update
	   @return void */
	reconfigureFor: function(control, settings) {
		control = (typeof control == 'string' ? $(control)[0] : control);
		var inst = this._getInst(control._calId);
		if (inst) {
			extendRemove(inst._settings, settings || {});
			this._updateCalendar(inst);
		}
	},

	/* Set the date for a calendar attached to an input field or division.
	   @param  control  element - the input field or div/span attached to the calendar
	   @param  date     Date - the new date
	   @return void */
	setDateFor: function(control, date) {
		var inst = this._getInst(control._calId);
		if (inst) {
			inst._setDate(date);
		}
	},

	/* Retrieve the date for a calendar attached to an input field or division.
	   @param  control  element - the input field or div/span attached to the calendar
	   @return Date - the current date */
	getDateFor: function(control) {
		var inst = this._getInst(control._calId);
		return (inst ? inst._getDate() : null);
	},

	/* Pop-up the calendar for a given input field.
	   @param  target  element - the input field attached to the calendar
	   @return void */
	showFor: function(target) {
		var input = (target.nodeName && target.nodeName.toLowerCase() == 'input' ? target : this);
		if (input.nodeName.toLowerCase() != 'input') { // find from button/image trigger
			input = $('input', input.parentNode)[0];
		}
		if (popUpCal._lastInput == input) { // already here
			return;
		}
		for (var i = 0; i < popUpCal._disabledInputs.length; i++) {  // check not disabled
			if (popUpCal._disabledInputs[i] == input) {
				return;
			}
		}
		var inst = popUpCal._getInst(input._calId);
		var fieldSettings = inst._get('fieldSettings');
		extendRemove(inst._settings, (fieldSettings ? fieldSettings(input) : {}));
		popUpCal.hideCalendar(inst, '');
		popUpCal._lastInput = input;
		inst._setDateFromField(input);
		if (popUpCal._inDialog) { // hide cursor
			input.value = '';
		}
		if (!popUpCal._pos) { // position below input
			popUpCal._pos = popUpCal._findPos(input);
			popUpCal._pos[1] += input.offsetHeight;
		}
		inst._calendarDiv.css('position', (popUpCal._inDialog && $.blockUI ? 'static' : 'absolute')).
			css('left', popUpCal._pos[0] + 'px').css('top', popUpCal._pos[1] + 'px');
		popUpCal._pos = null;
		popUpCal._showCalendar(inst);
	},

	
	_showCalendar: function(id) {
		var inst = this._getInst(id);
		popUpCal._updateCalendar(inst);
		if (!inst._inline) {
			var speed = inst._get('speed');
			inst._calendarDiv.show(speed, function() {
				popUpCal._popUpShowing = true;
				popUpCal._afterShow(inst);
			});
			if (speed == '') {
				popUpCal._popUpShowing = true;
				popUpCal._afterShow(inst);
			}
			if (inst._input[0].type != 'hidden') {
				inst._input[0].focus();
			}
			this._curInst = inst;
		}
	},

	
	_updateCalendar: function(inst) {
		inst._calendarDiv.empty().append(inst._generateCalendar());
		if (inst._input && inst._input[0].type != 'hidden') {
			inst._input[0].focus();
		}
	},

	
	_afterShow: function(inst) {
		if ($.browser.msie) { // fix IE < 7 select problems
			$('#calendar_cover').css({width: inst._calendarDiv[0].offsetWidth + 4,
				height: inst._calendarDiv[0].offsetHeight + 4});
		}
		// re-position on screen if necessary
		var calDiv = inst._calendarDiv[0];
		var pos = popUpCal._findPos(inst._input[0]);
		// Get browser width and X value (IE6+, FF, Safari, Opera)
		if( typeof( window.innerWidth ) == 'number' ) {
			browserWidth = window.innerWidth;
		} else {
			browserWidth = document.documentElement.clientWidth;
		}
		if ( document.documentElement && (document.documentElement.scrollLeft)) {
			browserX = document.documentElement.scrollLeft;
		} else {
			browserX = document.body.scrollLeft;
		}
		// Reposition calendar if outside the browser window.
		if ((calDiv.offsetLeft + calDiv.offsetWidth) >
				(browserWidth + browserX) ) {
			inst._calendarDiv.css('left', (pos[0] + inst._input[0].offsetWidth - calDiv.offsetWidth) + 'px');
		}
		// Get browser height and Y value (IE6+, FF, Safari, Opera)
		if( typeof( window.innerHeight ) == 'number' ) {
			browserHeight = window.innerHeight;
		} else {
			browserHeight = document.documentElement.clientHeight;
		}
		if ( document.documentElement && (document.documentElement.scrollTop)) {
			browserTopY = document.documentElement.scrollTop;
		} else {
			browserTopY = document.body.scrollTop;
		}
		// Reposition calendar if outside the browser window.
		if ((calDiv.offsetTop + calDiv.offsetHeight) >
				(browserTopY + browserHeight) ) {
			inst._calendarDiv.css('top', (pos[1] - calDiv.offsetHeight) + 'px');
		}
	},

	/* Hide the calendar from view.
	   @param  id     string/object - the ID of the current calendar instance,
			or the instance itself
	   @param  speed  string - the speed at which to close the calendar
	   @return void */
	hideCalendar: function(id, speed) {
		var inst = this._getInst(id);
		if (popUpCal._popUpShowing) {
			speed = (speed != null ? speed : inst._get('speed'));
			inst._calendarDiv.hide(speed, function() {
				popUpCal._tidyDialog(inst);
			});
			if (speed == '') {
				popUpCal._tidyDialog(inst);
			}
			popUpCal._popUpShowing = false;
			popUpCal._lastInput = null;
			inst._settings.prompt = null;
			if (popUpCal._inDialog) {
				popUpCal._dialogInput.css('position', 'absolute').
					css('left', '0px').css('top', '-100px');
				if ($.blockUI) {
					$.unblockUI();
					$('body').append(this._calendarDiv);
				}
			}
			popUpCal._inDialog = false;
		}
		popUpCal._curInst = null;
	},

	
	_tidyDialog: function(inst) {
		inst._calendarDiv.removeClass('calendar_dialog');
		$('.calendar_prompt', inst._calendarDiv).remove();
	},

	
	_checkExternalClick: function(event) {
		if (!popUpCal._curInst) {
			return;
		}
		var target = $(event.target);
		if( (target.parents("#calendar_div").length == 0)
			&& (target.attr('class') != 'calendar_trigger')
			&& popUpCal._popUpShowing
			&& !(popUpCal._inDialog && $.blockUI) )
		{
			popUpCal.hideCalendar(popUpCal._curInst, '');
		}
	},

	
	_adjustDate: function(id, offset, period) {
		var inst = this._getInst(id);
		inst._adjustDate(offset, period);
		this._updateCalendar(inst);
	},

	
	_gotoToday: function(id) {
		var date = new Date();
		var inst = this._getInst(id);
		inst._selectedDay = date.getDate();
		inst._selectedMonth = date.getMonth();
		inst._selectedYear = date.getFullYear();
		this._adjustDate(inst);
	},

	
	_selectMonthYear: function(id, select, period) {
		var inst = this._getInst(id);
		inst._selectingMonthYear = false;
		inst[period == 'M' ? '_selectedMonth' : '_selectedYear'] =
			select.options[select.selectedIndex].value - 0;
		this._adjustDate(inst);
	},

	
	_clickMonthYear: function(id) {
		var inst = this._getInst(id);
		if (inst._input && inst._selectingMonthYear && !$.browser.msie) {
			inst._input[0].focus();
		}
		inst._selectingMonthYear = !inst._selectingMonthYear;
	},

	
	_changeFirstDay: function(id, a) {
		var inst = this._getInst(id);
		var dayNames = inst._get('dayNames');
		var value = a.firstChild.nodeValue;
		for (var i = 0; i < 7; i++) {
			if (dayNames[i] == value) {
				inst._settings.firstDay = i;
				break;
			}
		}
		this._updateCalendar(inst);
	},

	
	_selectDay: function(id, td) {
		var inst = this._getInst(id);
		inst._selectedDay = $("a", td).html();
		this._selectDate(id);
	},

	
	_clearDate: function(id) {
		this._selectDate(id, '');
	},

	
	_selectDate: function(id, dateStr) {
		var inst = this._getInst(id);
		dateStr = (dateStr != null ? dateStr : inst._formatDate());
		if (inst._input) {
			inst._input.val(dateStr);
		}
		var onSelect = inst._get('onSelect');
		if (onSelect) {
			onSelect(dateStr, inst);  // trigger custom callback
		}
		else {
			inst._input.trigger('change'); // fire the change event
		}
		if (inst._inline) {
			this._updateCalendar(inst);
		}
		else {
			this.hideCalendar(inst, inst._get('speed'));
		}
	},

	/* Set as customDate function to prevent selection of weekends.
	   @param  date  Date - the date to customise
	   @return [boolean, string] - is this date selectable?, what is its CSS class? */
	noWeekends: function(date) {
		var day = date.getDay();
		return [(day > 0 && day < 6), ''];
	},

	
	_findPos: function(obj) {
		while (obj && (obj.type == 'hidden' || obj.nodeType != 1)) {
			obj = obj.nextSibling;
		}
		var curleft = curtop = 0;
		if (obj && obj.offsetParent) {
			curleft = obj.offsetLeft;
			curtop = obj.offsetTop;
			while (obj = obj.offsetParent) {
				var origcurleft = curleft;
				curleft += obj.offsetLeft;
				if (curleft < 0) {
					curleft = origcurleft;
				}
				curtop += obj.offsetTop;
			}
		}
		return [curleft,curtop];
	}
});

/* Individualised settings for calendars applied to one or more related inputs.
   Instances are managed and manipulated through the PopUpCal manager. */
function PopUpCalInstance(settings, inline) {
	this._id = popUpCal._register(this);
	this._selectedDay = 0;
	this._selectedMonth = 0; // 0-11
	this._selectedYear = 0; // 4-digit year
	this._input = null; // The attached input field
	this._inline = inline; // True if showing inline, false if used in a popup
	this._calendarDiv = (!inline ? popUpCal._calendarDiv :
		$('<div id="calendar_div_' + this._id + '" class="calendar_inline"></div>'));
	// customise the calendar object - uses manager defaults if not overridden
	this._settings = extendRemove({}, settings || {}); // clone
	if (inline) {
		this._setDate(this._getDefaultDate());
	}
}

$.extend(PopUpCalInstance.prototype, {
	
	_get: function(name) {
		return (this._settings[name] != null ? this._settings[name] : popUpCal._defaults[name]);
	},

	
	_setDateFromField: function(input) {
		this._input = $(input);
		var dateFormat = this._get('dateFormat');
		var currentDate = this._input.val().split(dateFormat.charAt(3));
		if (currentDate.length == 3) {
			this._currentDay = parseInt(currentDate[dateFormat.indexOf('D')], 10);
			this._currentMonth = parseInt(currentDate[dateFormat.indexOf('M')], 10) - 1;
			this._currentYear = parseInt(currentDate[dateFormat.indexOf('Y')], 10);
		}
		else {
			var date = this._getDefaultDate();
			this._currentDay = date.getDate();
			this._currentMonth = date.getMonth();
			this._currentYear = date.getFullYear();
		}
		this._selectedDay = this._currentDay;
		this._selectedMonth = this._currentMonth;
		this._selectedYear = this._currentYear;
		this._adjustDate();
	},

	
	_getDefaultDate: function() {
		var offsetDate = function(offset) {
			var date = new Date();
			date.setDate(date.getDate() + offset);
			return date;
		};
		var defaultDate = this._get('defaultDate');
		return (defaultDate == null ? new Date() :
			(typeof defaultDate == 'number' ? offsetDate(defaultDate) : defaultDate));
	},

	
	_setDate: function(date) {
		this._selectedDay = this._currentDay = date.getDate();
		this._selectedMonth = this._currentMonth = date.getMonth();
		this._selectedYear = this._currentYear = date.getFullYear();
		this._adjustDate();
	},

	
	_getDate: function() {
		return new Date(this._currentYear, this._currentMonth, this._currentDay);
	},

	
	_generateCalendar: function() {
		var today = new Date();
		today = new Date(today.getFullYear(), today.getMonth(), today.getDate()); // clear time
		// build the calendar HTML
		var controls = '<div class="calendar_control">' +
			'<a class="calendar_clear" onclick="popUpCal._clearDate(' + this._id + ');">' +
			this._get('clearText') + '</a>' +
			'<a class="calendar_close" onclick="popUpCal.hideCalendar(' + this._id + ');">' +
			this._get('closeText') + '</a></div>';
		var prompt = this._get('prompt');
		var closeAtTop = this._get('closeAtTop');
		var hideIfNoPrevNext = this._get('hideIfNoPrevNext');
		// controls and links
		var html = (prompt ? '<div class="calendar_prompt">' + prompt + '</div>' : '') +
			(closeAtTop && !this._inline ? controls : '') + '<div class="calendar_links">' +
			(this._canAdjustMonth(-1) ? '<a class="calendar_prev" ' +
			'onclick="popUpCal._adjustDate(' + this._id + ', -1, \'M\');">' + this._get('prevText') + '</a>' :
			(hideIfNoPrevNext ? '' : '<label class="calendar_prev">' + this._get('prevText') + '</label>')) +
			(this._isInRange(today) ? '<a class="calendar_current" ' +
			'onclick="popUpCal._gotoToday(' + this._id + ');">' + this._get('currentText') + '</a>' : '') +
			(this._canAdjustMonth(+1) ? '<a class="calendar_next" ' +
			'onclick="popUpCal._adjustDate(' + this._id + ', +1, \'M\');">' + this._get('nextText') + '</a>' :
			(hideIfNoPrevNext ? '' : '<label class="calendar_next">' + this._get('nextText') + '</label>')) +
			'</div><div class="calendar_header">';
		var minDate = this._get('minDate');
		var maxDate = this._get('maxDate');
		// month selection
		var monthNames = this._get('monthNames');
		if (!this._get('changeMonth')) {
			html += monthNames[this._selectedMonth] + '&nbsp;';
		}
		else {
			var inMinYear = (minDate && minDate.getFullYear() == this._selectedYear);
			var inMaxYear = (maxDate && maxDate.getFullYear() == this._selectedYear);
			html += '<select class="calendar_newMonth" ' +
				'onchange="popUpCal._selectMonthYear(' + this._id + ', this, \'M\');" ' +
				'onclick="popUpCal._clickMonthYear(' + this._id + ');">';
			for (var month = 0; month < 12; month++) {
				if ((!inMinYear || month >= minDate.getMonth()) &&
						(!inMaxYear || month <= maxDate.getMonth())) {
					html += '<option value="' + month + '"' +
						(month == this._selectedMonth ? ' selected="selected"' : '') +
						'>' + monthNames[month] + '</option>';
				}
			}
			html += '</select>';
		}
		// year selection
		if (!this._get('changeYear')) {
			html += this._selectedYear;
		}
		else {
			// determine range of years to display
			var years = this._get('yearRange').split(':');
			var year = 0;
			var endYear = 0;
			if (years.length != 2) {
				year = this._selectedYear - 10;
				endYear = this._selectedYear + 10;
			}
			else if (years[0].charAt(0) == '+' || years[0].charAt(0) == '-') {
				year = this._selectedYear + parseInt(years[0], 10);
				endYear = this._selectedYear + parseInt(years[1], 10);
			}
			else {
				year = parseInt(years[0], 10);
				endYear = parseInt(years[1], 10);
			}
			year = (minDate ? Math.max(year, minDate.getFullYear()) : year);
			endYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) : endYear);
			html += '<select class="calendar_newYear" onchange="popUpCal._selectMonthYear(' +
				this._id + ', this, \'Y\');" ' + 'onclick="popUpCal._clickMonthYear(' +
				this._id + ');">';
			for (; year <= endYear; year++) {
				html += '<option value="' + year + '"' +
					(year == this._selectedYear ? ' selected="selected"' : '') +
					'>' + year + '</option>';
			}
			html += '</select>';
		}
		html += '</div><table class="calendar" cellpadding="0" cellspacing="0"><thead>' +
			'<tr class="calendar_titleRow">';
		var firstDay = this._get('firstDay');
		var changeFirstDay = this._get('changeFirstDay');
		var dayNames = this._get('dayNames');
		for (var dow = 0; dow < 7; dow++) { // days of the week
			html += '<td>' + (!changeFirstDay ? '' : '<a onclick="popUpCal._changeFirstDay(' +
				this._id + ', this);">') + dayNames[(dow + firstDay) % 7] +
				(changeFirstDay ? '</a>' : '') + '</td>';
		}
		html += '</tr></thead><tbody>';
		var daysInMonth = this._getDaysInMonth(this._selectedYear, this._selectedMonth);
		this._selectedDay = Math.min(this._selectedDay, daysInMonth);
		var leadDays = (this._getFirstDayOfMonth(this._selectedYear, this._selectedMonth) - firstDay + 7) % 7;
		var currentDate = new Date(this._currentYear, this._currentMonth, this._currentDay);
		var selectedDate = new Date(this._selectedYear, this._selectedMonth, this._selectedDay);
		var printDate = new Date(this._selectedYear, this._selectedMonth, 1 - leadDays);
		var numRows = Math.ceil((leadDays + daysInMonth) / 7);
		var customDate = this._get('customDate');
		var showOtherMonths = this._get('showOtherMonths');
		for (var row = 0; row < numRows; row++) { // create calendar rows
			html += '<tr class="calendar_daysRow">';
			for (var dow = 0; dow < 7; dow++) { // create calendar days
				var customSettings = (customDate ? customDate(printDate) : [true, '']);
				var otherMonth = (printDate.getMonth() != this._selectedMonth);
				var unselectable = otherMonth || !customSettings[0] ||
					(minDate && printDate < minDate) || (maxDate && printDate > maxDate);
				html += '<td class="calendar_daysCell' +
					((dow + firstDay + 6) % 7 >= 5 ? ' calendar_weekEndCell' : '') + // highlight weekends
					(otherMonth ? ' calendar_otherMonth' : '') + // highlight days from other months
					(printDate.getTime() == selectedDate.getTime() ? ' calendar_daysCellOver' : '') + // highlight selected day
					(unselectable ? ' calendar_unselectable' : '') +  // highlight unselectable days
					(otherMonth && !showOtherMonths ? '' : ' ' + customSettings[1] + // highlight custom dates
					(printDate.getTime() == currentDate.getTime() ? ' calendar_currentDay' : // highlight current day
					(printDate.getTime() == today.getTime() ? ' calendar_today' : ''))) + '"' + // highlight today (if different)
					(unselectable ? '' : ' onmouseover="$(this).addClass(\'calendar_daysCellOver\');"' +
					' onmouseout="$(this).removeClass(\'calendar_daysCellOver\');"' +
					' onclick="popUpCal._selectDay(' + this._id + ', this);"') + '>' + // actions
					(otherMonth ? (showOtherMonths ? printDate.getDate() : '&nbsp;') : // display for other months
					(unselectable ? printDate.getDate() : '<a>' + printDate.getDate() + '</a>')) + '</td>'; // display for this month
				printDate.setDate(printDate.getDate() + 1);
			}
			html += '</tr>';
		}
		html += '</tbody></table>' + (!closeAtTop && !this._inline ? controls : '') +
			'<div style="clear: both;"></div>' + (!$.browser.msie ? '' :
			'<!--[if lte IE 6.5]><iframe src="javascript:false;" class="calendar_cover"></iframe><![endif]-->');
		return html;
	},

	
	_adjustDate: function(offset, period) {
		var date = new Date(this._selectedYear + (period == 'Y' ? offset : 0),
			this._selectedMonth + (period == 'M' ? offset : 0),
			this._selectedDay + (period == 'D' ? offset : 0));
		// ensure it is within the bounds set
		var minDate = this._get('minDate');
		var maxDate = this._get('maxDate');
		date = (minDate && date < minDate ? minDate : date);
		date = (maxDate && date > maxDate ? maxDate : date);
		this._selectedDay = date.getDate();
		this._selectedMonth = date.getMonth();
		this._selectedYear = date.getFullYear();
	},

	
	_getDaysInMonth: function(year, month) {
		return 32 - new Date(year, month, 32).getDate();
	},

	
	_getFirstDayOfMonth: function(year, month) {
		return new Date(year, month, 1).getDay();
	},

	
	_canAdjustMonth: function(offset) {
		var date = new Date(this._selectedYear, this._selectedMonth + offset, 1);
		if (offset < 0) {
			date.setDate(this._getDaysInMonth(date.getFullYear(), date.getMonth()));
		}
		return this._isInRange(date);
	},

	
	_isInRange: function(date) {
		var minDate = this._get('minDate');
		var maxDate = this._get('maxDate');
		return ((!minDate || date >= minDate) && (!maxDate || date <= maxDate));
	},

	
	_formatDate: function() {
		var day = this._currentDay = this._selectedDay;
		var month = this._currentMonth = this._selectedMonth;
		var year = this._currentYear = this._selectedYear;
		month++; // adjust javascript month
		var dateFormat = this._get('dateFormat');
		var dateString = '';
		for (var i = 0; i < 3; i++) {
			dateString += dateFormat.charAt(3) +
				(dateFormat.charAt(i) == 'D' ? (day < 10 ? '0' : '') + day :
				(dateFormat.charAt(i) == 'M' ? (month < 10 ? '0' : '') + month :
				(dateFormat.charAt(i) == 'Y' ? year : '?')));
		}
		return dateString.substring(dateFormat.charAt(3) ? 1 : 0);
	}
});


function extendRemove(target, props) {
	$.extend(target, props);
	for (var name in props) {
		if (props[name] == null) {
			target[name] = null;
		}
	}
	return target;
}

/* Attach the calendar to a jQuery selection.
   @param  settings  object - the new settings to use for this calendar instance (anonymous)
   @return jQuery object - for chaining further calls */
$.fn.calendar = function(settings) {
	return this.each(function() {
		// check for settings on the control itself - in namespace 'cal:'
		var inlineSettings = null;
		for (attrName in popUpCal._defaults) {
			var attrValue = this.getAttribute('cal:' + attrName);
			if (attrValue) {
				inlineSettings = inlineSettings || {};
				try {
					inlineSettings[attrName] = eval(attrValue);
				}
				catch (err) {
					inlineSettings[attrName] = attrValue;
				}
			}
		}
		var nodeName = this.nodeName.toLowerCase();
		if (nodeName == 'input') {
			var instSettings = (inlineSettings ? $.extend($.extend({}, settings || {}),
				inlineSettings || {}) : settings); // clone and customise
			var inst = (inst && !inlineSettings ? inst :
				new PopUpCalInstance(instSettings, false));
			popUpCal._connectCalendar(this, inst);
		}
		else if (nodeName == 'div' || nodeName == 'span') {
			var instSettings = $.extend($.extend({}, settings || {}),
				inlineSettings || {}); // clone and customise
			var inst = new PopUpCalInstance(instSettings, true);
			popUpCal._inlineCalendar(this, inst);
		}
	});
};


$(document).ready(function() {
   popUpCal = new PopUpCal(); // singleton instance
});

;
/* AGGREGATED JS FILE: sites/all/modules/date/date_popup/lib/jquery.timeentry.pack.js */
/* http://keith-wood.name/timeEntry.html
   Time entry for jQuery v1.2.4.
   Written by Keith Wood (kbwood@iprimus.com.au) June 2007.
   Dual licensed under the GPL (http://www.gnu.org/licenses/gpl-3.0.txt) and 
   CC (http://creativecommons.org/licenses/by/3.0/) licenses. 
   "Share or Remix it but please Attribute the authors." */
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('m o=t;(n($){n 1I(){7.2V=0;7.1S=[];7.H=[];7.1A=[];7.1A[\'\']={15:y,Y:\':\',1d:\'\',W:[\'41\',\'3R\'],2A:[\'3E\',\'3z 2j\',\'3s 2j\',\'3j\',\'3g\']};7.Z={2a:\'\',1l:y,1M:[1,1,1],2U:S,2N:t,2M:t,2I:\'o.3W\',1m:[20,20,8],2y:y,1R:[3C,3y],2n:t};$.13(7.Z,7.1A[\'\'])}$.13(1I.2i,{1L:\'3n\',2f:n(a){m b=7.2V++;7.1S[b]=a;r b},C:n(a){r 7.1S[a]||a},34:n(a){16(7.Z,a||{})},1P:n(a){m b=(a.1z&&a.1z.1s()==\'1w\'?a:7);p(o.J==b){r}p(o.1W(b)){r}m c=o.C(b.z);c.v=$(b);o.J=b;o.U=t;m d=c.q(\'2n\');16(c.17,(d?d(b):{}));c.1o()},2J:n(a){o.U=o.J;o.J=t},2G:n(a){m b=a.1V;m c=o.C(b.z);m d=c.q(\'Y\').x+2;c.s=0;p($.E.1T){m e=a.3J;c.s=(e>B.M(1,c.I)*d+2?c.u:B.3B(e/d))}F p($.E.1k){m f=b.1e;T(m g=0;g<=B.M(1,c.I,c.u);g++){m h=(g!=c.u?(g*d)+2:(c.u*d)+c.q(\'1d\').x+c.q(\'W\')[0].x);b.1e=f.X(0,h);m i=b.1K();p(a.3q<i.3m){c.s=g;w}}b.1e=f}F p($.E.1E||$.E.3i){m f=b.1e;T(m g=0;g<=B.M(1,c.I,c.u);g++){m j=(g!=c.u?(g*d):(c.u*d)+c.q(\'1d\').x);p(j>=b.3h){c.s=g;w}}}c.Q()},2d:n(a){p(a.1G>=48){r S}m b=o.C(7.z);2b(a.1G){A 9:r(a.33?b.1i(S):b.1c(S));A 35:p(a.23){b.1g(\'\')}F{b.s=B.M(1,b.I,b.u);b.G(0)}w;A 36:p(a.23){b.R()}F{b.s=0;b.G(0)}w;A 37:b.1i(y);w;A 38:b.G(+1);w;A 39:b.1c(y);w;A 40:b.G(-1);w;A 46:b.1g(\'\');w}r y},2E:n(a){m b=2Z.2X(a.2W==4m?a.1G:a.2W);p(b<\' \'){r S}m c=o.C(7.z);c.2S(b);r y},2R:n(a,b){b=($.E.1E?-b/B.1Y(b):b);m c=o.C(7.z);c.G(b);a.4g()},2Q:n(b,c){m d=$(b);p(7.2T(d,7.1L)){r}m e=c.q(\'2I\');m f=c.q(\'4b\');m g=c.q(\'1m\');m h=c.q(\'2a\');m i=(!e?t:$(\'<K 1q="1X" 47="\'+c.1p+\'" 45="42: 3Z-3Y; 2H: 3X(\\\'\'+e+\'\\\') 0 0 3U-3T; \'+\'3S: \'+g[0]+\'1b; 3Q: \'+g[1]+\'1b;\'+($.E.1T?\' 2D-3P: \'+g[0]+\'1b; 2D-3O: \'+(g[1]-18)+\'1b;\':\'\')+\'"></K>\'));d.3N(\'<K 1q="3M"></K>\').2B(i||\'\').2B(h?\'<K 1q="3L">\'+h+\'</K>\':\'\');d.3K(7.1L).2z(7.1P).3I(7.2J).3H(7.2G).3G(7.2d).3F(7.2E);p($.E.1T){d.2x(\'1w\',n(a){c.1o()})}p($.E.1k){d.2x(\'3D\',n(a){21(n(){c.1o()},1)})}p(c.q(\'2U\')&&$.2w.2v){d.2v(7.2R)}d[0].z=c.1p;p(i){i.3A(7.2u).2t(7.1Z).2q(7.1Z).3x(7.2p);i[0].z=c.1p}},2T:n(a,b){m c=a.3w(\'1q\');r(c&&c.1x(b)>-1)},3v:n(c){c=(c.1O?c:$(c));c.1u(n(){7.2m=y;$(\'../K.1X\',7).1N(\'2l\',\'1.0\');m b=7;o.H=$.2k(o.H,n(a){r(a==b?t:a)})})},3u:n(c){c=(c.1O?c:$(c));c.1u(n(){7.2m=S;$(\'../K.1X\',7).1N(\'2l\',\'0.5\');m b=7;o.H=$.2k(o.H,n(a){r(a==b?t:a)});o.H[o.H.x]=7})},1W:n(a){T(m i=0;i<7.H.x;i++){p(7.H[i]==a){r S}}r y},3t:n(a,b){a=(a.1O?a:$(a))[0];m c=7.C(a.z);p(c){m d=c.1h();16(c.17,b||{});p(d){c.R(L V(0,0,0,d[0],d[1],d[2]))}}},3p:n(a,b){m c=7.C(a.z);p(c){c.v=$(a);c.R(b)}},3o:n(a){m b=7.C(a.z);m c=(b?b.1h():t);r(!c?t:L V(0,0,0,c[0],c[1],c[2]))},2p:n(a){m b=o.14(a);m c=o.C(b.z);b.3l=c.q(\'2A\')[o.1F(c,a)]},2u:n(a){m b=o.14(a);m c=b.3k;p(o.1W(c)){r}p(c==o.U){o.J=c;o.U=t}m d=o.C(c.z);o.1P(c);m e=o.1F(d,a);o.1D(d,b,e);o.1B(d,e);m f=d.q(\'1R\');p(e>=3&&f[0]){o.1H=21(n(){o.1C(d,e)},f[0]);$(b).2e(\'2q\',o.1J).2e(\'2t\',o.1J)}},1B:n(a,b){2b(b){A 0:a.R();w;A 1:a.1i(y);w;A 2:a.1c(y);w;A 3:a.G(+1);w;A 4:a.G(-1);w}},1C:n(a,b){o.J=o.U;7.1B(a,b);7.1H=21(n(){o.1C(a,b)},a.q(\'1R\')[1])},1J:n(a){3f(o.1H)},1Z:n(a){m b=o.14(a);m c=o.C(b.z);o.1D(c,b,-1);p(!$.E.1E){o.J=o.U}p(o.J){c.Q()}},14:n(a){r(a.1V?a.1V:a.3e)},1F:n(a,b){m c=7.14(b);m d=7.2h(c);m e=7.2g(c);m f=a.q(\'2y\');m g=(f?2c:b.3d+e[0]-d[0]-($.E.1k?1:0));m h=b.3r+e[1]-d[1]-($.E.1k?1:0);m i=a.q(\'1m\');m j=(f?2c:i[0]-g);m k=i[1]-h;p(i[2]>0&&B.1Y(g-j)<=i[2]&&B.1Y(h-k)<=i[2]){r 0}m l=B.3c(g,h,j,k);r(l==g?1:(l==j?2:(l==h?3:4)))},1D:n(a,b,c){$(b).1N(\'2H-3b\',\'-\'+((c+1)*a.q(\'1m\')[0])+\'1b 3a\')},2h:n(a){m b=1j=0;p(a.2s){b=a.2o;1j=a.2r;32(a=a.2s){m c=b;b+=a.2o;p(b<0){b=c}1j+=a.2r}}r[b,1j]},2g:n(a){r[B.M(19.29.28,19.27.28),B.M(19.29.25,19.27.25)]}});n 1Q(a){7.1p=o.2f(7);7.D=0;7.O=0;7.N=0;7.v=t;7.17=16({},a||{})}$.13(1Q.2i,{q:n(a){r(7.17[a]!=t?7.17[a]:o.Z[a])},1o:n(){m a=7.1h();m b=7.q(\'1l\');p(a){7.D=a[0];7.O=a[1];7.N=a[2]}F{m c=7.1n();7.D=c[0];7.O=c[1];7.N=(b?c[2]:0)}7.I=(b?2:-1);7.u=(7.q(\'15\')?-1:(b?3:2));7.1a=\'\';7.s=0;p(7.v.P()!=\'\'){7.1y()}},1h:n(){m a=(7.v?7.v.P():\'\');m b=7.q(\'Y\');m c=a.31(b);p(b==\'\'&&a!=\'\'){c[0]=a.X(0,2);c[1]=a.X(2,4);c[2]=a.X(4,6)}m d=7.q(\'W\');p(c.x>=2){m e=(a.1x(d[0])>-1);m f=(a.1x(d[1])>-1);m g=1v(c[0],10);g=(1U(g)?0:g);g=((e||f)&&g==12?0:g)+(f?12:0);m h=1v(c[1],10);h=(1U(h)?0:h);m i=(c.x>=3?1v(c[2],10):0);i=(1U(i)||!7.q(\'1l\')?0:i);r[g,h,i]}r t},1n:n(a){m b=(a!=t);p(!b){m c=L V();a=[c.22(),c.2C(),c.2L()]}m d=y;m e=7.q(\'1M\');T(m i=0;i<e.x;i++){p(d){a[i]=0}F p(e[i]>1){a[i]=B.3V(a[i]/e[i])*e[i];d=!b}}r a},1y:n(){m a=7.q(\'15\');m b=7.q(\'Y\');m c=(7.1f(a?7.D:((7.D+11)%12)+1)+b+7.1f(7.O)+(7.q(\'1l\')?b+7.1f(7.N):\'\')+(a?\'\':7.q(\'1d\')+7.q(\'W\')[(7.D<12?0:1)]));7.1g(c);7.Q()},Q:n(){p(!7.v){r}m a=7.v[0];m b=7.q(\'Y\');m c=b.x+2;m d=(7.s!=7.u?(7.s*c):(7.u*c)-b.x+7.q(\'1d\').x);m e=d+(7.s!=7.u?2:7.q(\'W\')[0].x);p(a.2F){a.2F(d,e)}F p(a.1K){m f=a.1K();f.30(\'2K\',d);f.2Y(\'2K\',e-7.v.P().x);f.43()}a.2z()},1f:n(a){r(a<10?\'0\':\'\')+a},1g:n(a){7.v.P(a);7.v.44(\'4n\')},1i:n(a){m b=(7.v.P()==\'\'||7.s==0);p(!b){7.s--}7.Q();7.1a=\'\';r(b&&a)},1c:n(a){m b=(7.v.P()==\'\'||7.s==B.M(1,7.I,7.u));p(!b){7.s++}7.Q();7.1a=\'\';r(b&&a)},G:n(a){p(7.v.P()==\'\'){a=0}m b=7.q(\'1M\');7.R(L V(0,0,0,7.D+(7.s==0?a*b[0]:0)+(7.s==7.u?a*12:0),7.O+(7.s==1?a*b[1]:0),7.N+(7.s==7.I?a*b[2]:0)))},R:n(a){p(!a){m b=7.1n();a=L V(0,0,0,b[0],b[1],b[2])}m a=7.1t(a);m c=7.1t(7.q(\'2N\'));m d=7.1t(7.q(\'2M\'));a=(c&&a<c?c:(d&&a>d?d:a));7.D=a.22();7.O=a.2C();7.N=a.2L();7.1y()},1t:n(a){p(!a){r t}a.4l(4j);a.4i(1-1);a.4h(26);r a},2S:n(a){p(a==7.q(\'Y\')){7.1c(y)}F p(a>=\'0\'&&a<=\'9\'){m b=(7.1a+a)*1;m c=(7.s==0&&((7.q(\'15\')&&b<24)||(b>=1&&b<=12))?b:7.D);m d=(7.s==1&&b<2P?b:7.O);m e=(7.s==7.I&&b<2P?b:7.N);m f=7.1n([c,d,e]);7.R(L V(0,0,0,f[0],f[1],f[2]));7.1a=a}F p(!7.q(\'15\')){m g=7.q(\'W\');p((a==g[0].X(0,1).1s()&&7.D>=12)||(a==g[1].X(0,1).1s()&&7.D<12)){m h=7.s;7.s=7.u;7.G(+1);7.s=h;7.Q()}}}});n 16(a,b){$.13(a,b);T(m c 2O b){p(b[c]==t){a[c]=t}}r a}$.2w.o=n(e){r 7.1u(n(){m a=7.1z.1s();p(a==\'1w\'){m b=t;T(1r 2O o.Z){m c=7.4f(\'4e:\'+1r);p(c){b=b||{};4d{b[1r]=4c(c)}4k(4a){b[1r]=c}}}m d=(d&&!b?d:L 1Q(!b?e:$.13(b,e)));o.2Q(7,d)}})};$(19).49(n(){o=L 1I()})})(4o);',62,273,'|||||||this|||||||||||||||var|function|timeEntry|if|_get|return|_field|null|_ampmField|_input|break|length|false|_timeId|case|Math|_getInst|_selectedHour|browser|else|_adjustField|_disabledInputs|_secondField|_lastInput|span|new|max|_selectedSecond|_selectedMinute|val|_showField|_setTime|true|for|_blurredInput|Date|ampmNames|substring|separator|_defaults||||extend|_getSpinnerTarget|show24Hours|extendRemove|_settings||document|_lastChr|px|_nextField|ampmPrefix|value|_formatNumber|_setValue|_extractTime|_previousField|curTop|msie|showSeconds|spinnerSize|_constrainTime|_parseTime|_id|class|attrName|toLowerCase|_normaliseTime|each|parseInt|input|indexOf|_showTime|nodeName|regional|_actionSpinner|_repeatSpinner|_changeSpinner|opera|_getSpinnerRegion|keyCode|_timer|TimeEntry|_releaseSpinner|createTextRange|markerClassName|timeSteps|css|jquery|_doFocus|TimeEntryInstance|spinnerRepeat|_inst|mozilla|isNaN|target|isDisabled|timeEntry_control|abs|_endSpinner||setTimeout|getHours|ctrlKey||scrollTop||body|scrollLeft|documentElement|appendText|switch|99|_doKeyDown|one|_register|_findScroll|_findPos|prototype|field|map|opacity|disabled|fieldSettings|offsetLeft|_describeSpinner|mouseout|offsetTop|offsetParent|mouseup|_handleSpinner|mousewheel|fn|bind|spinnerIncDecOnly|focus|spinnerTexts|after|getMinutes|padding|_doKeyPress|setSelectionRange|_doDblClick|background|spinnerImage|_doBlur|character|getSeconds|maxTime|minTime|in|60|_connectTimeEntry|_doMouseWheel|_handleKeyPress|_hasClass|useMouseWheel|_nextId|charCode|fromCharCode|moveEnd|String|moveStart|split|while|shiftKey|setDefaults||||||0px|position|min|clientX|srcElement|clearTimeout|Decrement|selectionStart|safari|Increment|previousSibling|title|boundingWidth|hasTimeEntry|getTimeFor|setTimeFor|offsetX|clientY|Next|reconfigureFor|disableFor|enableFor|attr|mousemove|250|Previous|mousedown|floor|500|paste|Now|keypress|keydown|dblclick|blur|rangeOffset|addClass|timeEntry_append|timeEntry_wrap|wrap|top|left|height|PM|width|repeat|no|round|png|url|block|inline||AM|display|select|trigger|style||_timeid||ready|err|spinnerText|eval|try|time|getAttribute|preventDefault|setDate|setMonth|2001|catch|setFullYear|undefined|change|jQuery'.split('|'),0,{}))
;
/* AGGREGATED JS FILE: sites/all/modules/atb/opodo.js */
/**
 * CCS
 * 11-07-08
 * Transforme une date au format texte (jj/mm/aaaa) en format date
 */
/**
*	Updated on 17/05/2011
*   Ticket 395421 : Evolution du moteur Opodo
*   Author Laurent Namura <laurent.namura@capgemini.com>
**/

if(typeof(autocomplete_path) == 'undefined')
	autocomplete_path	=	'/autocomplete.php';
	
function transformToDate(date_text)
{
	tableau_date = date_text.split('/');	
	day = tableau_date[0];
	if(day.substr(0,1) == "0")
		day = parseInt(day.substr(1,1));
	month = tableau_date[1]-1;
	year = tableau_date[2];
	return new Date(year, month, day);
}

function dates_diff(champ_depart, champ_retour, num_jours) {
	//	Mise à jour du champ retour si le champ départ est plus élevé
	$(champ_depart).change(function() {
		var date_depart	=	fr_to_date($(champ_depart).val());
		var date_retour	=	fr_to_date($(champ_retour).val());
		if(date_depart > date_retour)
			$(champ_retour).val(make_date(fr_to_date($(champ_depart).val()), num_jours));
	});
	//	Mise à jour du champ départ si le champ retour est moins élevé
	$(champ_retour).change(function() {
		var date_depart	=	fr_to_date($(champ_depart).val());
		var date_retour	=	fr_to_date($(champ_retour).val());
		if(date_depart > date_retour)
			$(champ_depart).val(make_date(fr_to_date($(champ_retour).val()), -num_jours));
	});
}

function default_date(champ, date, ecart) {
	if($(champ).val() == '')
		$(champ).val(make_date(date, ecart));
	$(champ).change();
}

function make_date(date, nb_jours) {
	//	Génère une nouvelle date, en ajoutant ou soustrayant le nombre de jours passés en paramètre
	//	On prend la date du jour
	if(date == 'today')
		date		=	new Date();
	var annee		=	date.getFullYear();
	var mois		=	date.getMonth();
	var jour		=	date.getDate();
	//	On recrée la nouvelle date
	var new_date	=	new Date(annee, mois, jour+nb_jours);
	return date_to_fr(new_date);
}

function date_to_fr(date) {
	var annee		=	date.getFullYear();
	var mois		=	date.getMonth()+1;
	var jour		=	date.getDate();
	if(mois < 10)
		mois	=	'0'+mois;
	if(jour < 10)
		jour	=	'0'+jour;
	return jour+'/'+mois+'/'+annee;
}

function fr_to_date(date) {
	var tab_date	=	date.split('/');
	var date		=	new Date(tab_date[2], tab_date[1]-1, tab_date[0]);
	return date;
}

function is_date(string) {
	//	On vérifie le format de la date (JJ/MM/AAAA)
	var reg_date	=	/[0-9]{2}\/[0-9]{2}\/[0-9]{4}/;
	if(reg_date.test(string)) {
		//	On vérifie ensuite que la date n'est pas inférieure à la date du jour
		var date_today	=	new Date(today.getFullYear(), today.getMonth(), today.getDate());
		if(fr_to_date(string) < date_today)
			return false;
		return true;
	}
	return false;
}

function default_blank_value(selecteur, texte_par_defaut) {
	$(selecteur).each(function() {
		if($(this).val() == '')
			$(this).val(texte_par_defaut);
		$(this).focus(function() {
			if($(this).val() == texte_par_defaut)
				$(this).val('');
		});
		
		$(this).blur(function() {
			if($(this).val() == '')
				$(this).val(texte_par_defaut);
		});
	});
}
;
/* AGGREGATED JS FILE: sites/all/modules/atb/opodo_vol.js */
/*
 * Created on 20 juin 08
 * Author CCS <cedric.courreges@capgemini.com>
 * 
 * version 1.0
 */
 
/**
*	Updated on 17/05/2011
*   Ticket 395421 : Evolution du moteur Opodo
*   Author Laurent Namura <laurent.namura@capgemini.com>
**/


/**
 * Control submit
 */ 
if (Drupal.jsEnabled)
{
	
	/**
 	* JS Calendar
 	*/
	$(document).ready(function()
	{
		//	MOTEUR VOLS
		//	Dates par défaut (date du jour + ?)
		today	=	new Date();
		var vol_date_aller		=	7;
		var vol_date_retour		=	14;
		var vol_dates_diff		=	1;
		
		//	GESTION DES DATES
			//	Dates par défaut
			default_date('#vol_dateDepart', today, vol_date_aller);
			default_date('#vol_dateRetour', today, vol_date_retour);
			//	Mise à jour de la date de retour si la date d'aller est plus grande, et inversement
			dates_diff('#vol_dateDepart', '#vol_dateRetour', vol_dates_diff);
			//	Déclenchement du changement si on a des champs remplis par défaut
			$('#vol_dateDepart, #vol_dateRetour').change();
		
		//	GESTION DES AUTOCOMPLETES
			applyOpodoAutocomplete('input#vol_departureAirport, input#vol_arrivalAirport', 'flight', {
				suffix: 	'Code',
				proxy_path:	autocomplete_path
			});
		
		//	GESTION DU NOMBRE DE PERSONNES
			$('#vol_numberOfAdults').change(function() {
				update_vol_personnes();
			});
			update_vol_personnes();
			
				
		//	GESTION DU CLIC SUR LE RADIO "MULTIDESTINATION"
			$('#vol_tripTypeM').click(function() {
				//	On recherche éventuellement un champ caché avec le code de la compagnie aérienne
				var document_location	=	'http://billetavion.opodo.fr/opodo/flights/multistopFlights';
				var code_iata			=	$('#vol_airlineCode').val();
				if(code_iata != undefined)
					document_location	+=	'?preferredAirlines[0]='+code_iata;
				document.location		=	document_location;
			});
			
		//	Gestion des erreurs
			$('#multimoteur_vol .obligatoire').focus(function() {
			$('#multimoteur_error').remove();
			$(this).removeClass('error');
			});
	});
	
	function update_vol_personnes() 
	{
		//	On isole les nombres de personnes
		var numberOfAdults		=	$('#vol_numberOfAdults option:selected').val();
		var numberOfChildren	=	$('#vol_numberOfChildren option:selected').val();
		var numberOfInfants		=	$('#vol_numberOfInfants option:selected').val();
		//	Le nombre total de personnes (enfants + adultes) ne peux pas excéder 9
		var max	=	9-numberOfAdults;
		$('#vol_numberOfChildren option').remove();
		for(var i = 0; i <= max; i++) {
			var selected	=	(i == numberOfChildren) ? ' selected="selected"' : '';
			$('#vol_numberOfChildren').append('<option value="'+i+'"'+selected+'>'+i+'</option>');
		}
		//	Le nombre total de bébés ne peut pas excéder le nombre d'adultes
		$('#vol_numberOfInfants option').remove();
		for(var i = 0; i <= numberOfAdults; i++) {
			var selected	=	(i == numberOfInfants) ? ' selected="selected"' : '';
			$('#vol_numberOfInfants').append('<option value="'+i+'"'+selected+'>'+i+'</option>');
	}			
}
		
 
	/**
	* CCS
	* Action : valid_form_opodo_vol
	* Action exécutée sur le submit de la réservation de vol OPODO
	*/
	function displayVolErrors(ville_depart, ville_destination, date_depart, date_arrivee, code_depart, code_arrivee)
	{ 
		// date du jour
		today = new Date();
		rightnow = new Date(today.getFullYear(), today.getMonth(), today.getDate(), 0,0,0,0);

		form_errors_msg = ""; // init 

		// 211327 Evol Lot 1
		// Si ville depart ou ville destination n'est pas toulouse
		if((ville_depart.toUpperCase()!='TOULOUSE [TLS]' && ville_destination.toUpperCase()!='TOULOUSE [TLS]') || (ville_depart.toUpperCase()=='TOULOUSE [TLS]' && ville_destination.toUpperCase()=='TOULOUSE [TLS]')){
			form_errors_msg += "<li>" + 'La recherche d\'un vol n\'est permise qu\'au d&eacute;part ou &agrave; l\'arriv&eacute;e de Toulouse.' + "</li>";
		}
		if(ville_depart.length == 0){
			$('#vol_departureAirport').addClass('error');
			form_errors_msg += "<li>" + 'La ville d&eacute;part est obligatoire.' + "</li>";
		}
		if(ville_destination.length == 0 ){
			$('#vol_arrivalAirport').addClass('error');
			form_errors_msg += "<li>" + 'La ville de destination est obligatoire.' + "</li>";
		}
		if(code_depart == '' || code_arrivee == ''){
			form_errors_msg += "<li>" + 'La ville de d&eacute;part ou d\'arriv&eacute;e doit &ecirc;tre s&eacute;lectionn&eacute;e dans la liste propos&eacute;e.' + "</li>";
		}
		if(code_depart == ''){
			$('#vol_departureAirport').addClass('error');
		}
		if(code_arrivee == ''){
			$('#vol_arrivalAirport').addClass('error');
		}
		if(date_depart.length == 0){
			$('#vol_dateDepart').addClass('error');
			form_errors_msg += "<li>" + 'La date d&eacute;part est obligatoire.' + "</li>";
		}	
		if(date_arrivee.length == 0){
			$('#vol_dateRetour').addClass('error');
			form_errors_msg += "<li>" + 'La date d\'arriv&eacute;e est obligatoire.' + "</li>";
		}
		if(date_arrivee.length > 0 && date_depart.length > 0 && transformToDate(date_depart).valueOf() > transformToDate(date_arrivee).valueOf()){
			form_errors_msg += "<li>" + 'La date de d&eacute;part est plus grande que la date d\'arriv&eacute;e.' + "</li>";
		}
		if(transformToDate(date_depart).valueOf() < rightnow.valueOf() && date_depart.length > 0)
		{
			form_errors_msg += "<li>" + 'La date de d&eacute;part est ant&eacute;rieure &agrave; la date du jour.' + "</li>";
		}
		 
		if(transformToDate(date_arrivee).valueOf() < rightnow.valueOf() && date_arrivee.length > 0)
		{
			form_errors_msg += "<li>" + 'La date d\'arriv&eacute;e est ant&eacute;rieure &agrave; la date du jour.' + "</li>";
		}

		if(form_errors_msg.length > 0) {
			setMsgError("<div class='messages error'><ul style='font-weight:normal;'>" + form_errors_msg + "</ul></div>");
		}
		else {
			$('#form_flight_result').html('');
			$('#form_flight_result').slideUp();
		}
	}


	/**
	 * CCS
  	 * 11-07-08
	 * Insere le message d'erreur
	 */
 	function setMsgError(msg) 
	{
		$('#form_flight_result').html(msg);
		$('#form_flight_result').slideDown();
  	}
 
  	function setAllerRetour(value_aller_retour)
  	{
	  	// aller simple sélectionne 
		if(value_aller_retour == 'O')
		{
			document.forms.multimoteur_vol.dateRetour.disabled = true;
			document.forms.multimoteur_vol.returnTime.disabled = true;
		}
		// aller-retour sélectionne 
		else if(value_aller_retour == 'R')
		{
			document.forms.multimoteur_vol.dateRetour.disabled = false;
			document.forms.multimoteur_vol.returnTime.disabled = false;
		}
		else
		{
			// Cas impossible 
		}
  	}

  	/**
  	 *  CCS
  	 *  11-07-08
  	 *  Fonction de validation du formulaire
  	 */
	function flightSearchSubmit()
	{
		//	VÉRIFICATION DES CHAMPS
		if(!validate_form_vol())
			return false;
		
		//	PRÉPARATION DU FORMULAIRE AVANT ENVOI
		
		//	On crée les champs de date
		var date_depart	=	$('#vol_dateDepart').val();
		var date_retour	=	$('#vol_dateRetour').val();
		var tab_depart	=	date_depart.split('/');
		var tab_retour	=	date_retour.split('/');
		
		$('#departureDay').val(tab_depart[0]);
		$('#departureMonth').val(tab_depart[2]+tab_depart[1]);
		$('#returnDay').val(tab_retour[0]);
		$('#returnMonth').val(tab_retour[2]+tab_retour[1]);
	}
	
	
	function validate_form_vol()
	{
		//	Vérification des villes de départ et d'arrivée
		var code_depart		=	$('#vol_departureAirportCode').val();
		var code_arrivee	=	$('#vol_arrivalAirportCode').val();
		var ville_depart	=	$('#vol_departureAirport').val();
		var ville_arrivee	=	$('#vol_arrivalAirport').val();
		var date_aller		=	$('#vol_dateDepart').val();
		var date_retour		=	$('#vol_dateRetour').val();
		
		// AFFICHE LES ERREURS
		displayVolErrors(ville_depart, ville_arrivee, date_aller, date_retour, code_depart, code_arrivee);
		
		if(ville_depart	== '' || code_depart == '')
			return false;
		if(ville_arrivee	==	'' || code_arrivee == '')
			return false;
		if(ville_arrivee	==	ville_depart)
			return false;
		if((ville_depart.toUpperCase()!='TOULOUSE [TLS]' && ville_arrivee.toUpperCase()!='TOULOUSE [TLS]') || (ville_depart.toUpperCase()=='TOULOUSE [TLS]' && ville_arrivee.toUpperCase()=='TOULOUSE [TLS]'))
			return false;
		
		//	Vérification des dates
		if(!is_date(date_aller))
			return false;
		if(!is_date(date_retour))
			return false;
		return true;
	}
	
	/**
	 * CCS
	 * 11-07-08
	 * Remet à 0 les champs enfant bébé des que l'on modifie le champ adulte
	 */
	var Maximum = 10;
	function setOptions(chosen) 
	{
		frm = document.multimoteur_vol;
		var selbox = frm.numberOfChildren;
		selbox.options.length = 0;
		var selbox2 = frm.numberOfInfants;
		selbox2.options.length = 0;
		var box1 = frm.numberOfAdults.options[frm.numberOfAdults.selectedIndex].value;
		for(q=0;q<=box1;q++){
			selbox2.options[selbox2.options.length] = new Option(q,q);
		}
		for(i=0 ; i < Maximum ; i++){
			if (chosen == i) {
				selbox.options[selbox.options.length] = new Option(0,0);
				for(z=1;z <(Maximum-i) ; z++){
					selbox.options[selbox.options.length] = new Option(z,z);
				}
			}
		}
	}
}
;
/* AGGREGATED JS FILE: sites/all/modules/atb/opodo/opodo.autocomplete.js */
/*
 * Opodo Autocomplete Module
 *
 * REQUIRED LIBRAIRIES : 
 *	- jquery.js
 *	- jquery.autocomplete.js plugin
 *	- jquery.bgiframe.js plugin
 *
 * Authors : Mathieu Bourgeois and Marc Brillault
 */


/*
 * Function applying opodo autocomplete to specified fields
 *
 * @param fields	-	string selecting the fields we want the autocomplete to apply (in jQuery selector format - XPath)
 * @param product	-	name of the product which we are on (flight or dp)
 * @param options	-	optional object which can contain one or more of the following values :
						-	width		:	integer value of the autocomplete results list, in pixels
						-	proxy_path	:	string defining another path to the proxy file
						The following three arguments all do the same task : create a hidden form field which contains the iata code of the
						destination choosen in the main field. Only one of these arguments can be used.
						-	suffix		:	string to add at the end of the main field id to create the new hidden field's id and name
						-	prefix		:	string to add at the beginning of the main field id to create the new hidden field's id and name
						-	iata_hidden	:	when the name of the hidden field does not depend on the main field, this argument should be used.
											As it is not context-based, when using this parameter only one field should be matched by the "fields" mandatory parameter.
	Example calls of the script :
	applyOpodoAutocomplete("#departureCity,#arrivalCity", "flight");
	applyOpodoAutocomplete("#departureCity,#arrivalCity", "flight", {width: 300, suffix: 'Code'});
	applyOpodoAutocomplete("#departureCity,#arrivalCity", "flight", 300);				//	To be removed when all calls to the script are made with the object method
 */
/**
*	17/05/2011
*   Ticket 395421 : Evolution du moteur Opodo
*   Author Laurent Namura <laurent.namura@capgemini.com>
**/
function applyOpodoAutocomplete(fields, product, options) {
	//	Default values
	var width		=	370;									//	Default width
	if(product	==	'dp')
		width		=	320;									//	Default width for DP
	var proxy_path	=	'/php/autocomplete/autocomplete.php';	//	Default path to the autocomplete script
	
	//	Management of old calls of the script, with the width parameter as third argument
	//	To be removed when all calls to the script use the new object method for the optional arguments
	if(typeof options == 'number')
		width	=	options;
	
	//	Optional arguments
	if(typeof options == 'object') {
		//	Setting the path
		if(typeof options['proxy_path'] != 'undefined')
			proxy_path	=	options['proxy_path'];
		
		//	Setting the width
		if(typeof options['width'] != 'undefined')
			width	=	options['width'];
		
		//	Creation of the hidden field(s), upon selecting a destination in the main field or when the fields already contain a destination's name
		if(typeof options['suffix'] != 'undefined' || typeof options['iata_hidden'] != 'undefined' || typeof options['prefix'] != 'undefined') {
			//	Autocomplete and create a hidden field when a destination's name is already present
			jQuery(fields).each(function() {
				//	Setting the id and name of the hidden field
				if(typeof options['iata_hidden'] != 'undefined') {
					var field_name	=	options['iata_hidden'];
					var field_id	=	options['iata_hidden'];
				}
				else {
					var name			=	jQuery(this).attr('name');
					var id				=	jQuery(this).attr('id');
					if(typeof options['prefix'] != 'undefined') {
						var field_name	=	options['prefix']+name;
						var field_id	=	options['prefix']+id;
					}
					else {
						var field_name	=	name+options['suffix'];
						var field_id	=	id+options['suffix'];
					}
				}
				
				//	If the field does not exists already, create it
				if(jQuery(this).parents('form').find('input[name='+field_name+']').length == 0)
					jQuery(this).parents('form').prepend('<input type="hidden" name="'+field_name+'" id="'+field_id+'">');
				
				//	If the field isn't empty, check the XML feed to retrieve only the first element
				//	We get the value of the field
				var chaine	=	jQuery(this).val();
				var tag_name	=	jQuery(this).attr('tagName');
				var element		=	jQuery(this);
				if(chaine.length) {
					if(tag_name == 'INPUT') {
						jQuery.get(
							proxy_path,
							{
								product:	product,
								q:			chaine,
								limit:		1,
								timestamp:	Math.floor((new Date()).getTime() / 1000)
							},
							function(data) {
								if(data) {
									reg_code_iata	=	/\[([A-Z]{3})\]/;
									reg_code_iata.exec(data);
									var code_iata	=	RegExp.$1;
									element.parents('form').find('#'+field_id).val(code_iata);
								}
							}
						);
					}
				}
				
				//	Populate the hidden field when a destination is manually chosen
				jQuery(this).result(function(event, data, formatted) {
					if(typeof data != 'undefined') {
						//	Get the IATA code from the main field's selected content
						var reg_iata	=	/\[([A-Z]{3})\]/;
						reg_iata.exec(data);
						var iata		=	RegExp.$1;						
						//	Set the new value for the field
						jQuery(this).parents('form').find('#'+field_id).val(iata);
					}
				});
			});
		}
	}
	
	jQuery(fields).autocomplete(proxy_path+"?product="+product, {
		minChars: 3,
		delay: 100,
		matchContains: true,
		selectFirst: true,
		width: width,
		max: 10,
		scroll: false,
		formatResult: function(data, value) {
			return data[1];
		}
	});
}
;
/* AGGREGATED JS FILE: sites/all/modules/atb/opodo/jquery.autocomplete.js */
/*
 * Autocomplete - jQuery plugin 1.1pre
 *
 * Copyright (c) 2007 Dylan Verheul, Dan G. Switzer, Anjesh Tuladhar, Jörn Zaefferer
 *
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 *
 * Revision: $Id: jquery.autocomplete.js 5785 2008-07-12 10:37:33Z joern.zaefferer $
 *
 *
 * [m.bourgeois@opodo.fr] PATCH TO MAKE THE CACHE WORK WITH EMPTY RESULTS (see line 331)
 * [m.bourgeois@opodo.fr] COMPARE STRINGS IGNORING SPECIAL CHARS (see line 447)
 */
/**
*	17/05/2011
*   Ticket 395421 : Evolution du moteur Opodo
*   Author Laurent Namura <laurent.namura@capgemini.com>
**/
;(function($) {
	
$.fn.extend({
	autocomplete: function(urlOrData, options) {
		var isUrl = typeof urlOrData == "string";
		options = $.extend({}, $.Autocompleter.defaults, {
			url: isUrl ? urlOrData : null,
			data: isUrl ? null : urlOrData,
			delay: isUrl ? $.Autocompleter.defaults.delay : 10,
			max: options && !options.scroll ? 10 : 150
		}, options);
		
		// if highlight is set to false, replace it with a do-nothing function
		options.highlight = options.highlight || function(value) { return value; };
		
		// if the formatMatch option is not specified, then use formatItem for backwards compatibility
		options.formatMatch = options.formatMatch || options.formatItem;
		
		return this.each(function() {
			new $.Autocompleter(this, options);
		});
	},
	result: function(handler) {
		return this.bind("result", handler);
	},
	search: function(handler) {
		return this.trigger("search", [handler]);
	},
	flushCache: function() {
		return this.trigger("flushCache");
	},
	setOptions: function(options){
		return this.trigger("setOptions", [options]);
	},
	unautocomplete: function() {
		return this.trigger("unautocomplete");
	}
});

$.Autocompleter = function(input, options) {

	var KEY = {
		UP: 38,
		DOWN: 40,
		DEL: 46,
		TAB: 9,
		RETURN: 13,
		ESC: 27,
		COMMA: 188,
		PAGEUP: 33,
		PAGEDOWN: 34,
		BACKSPACE: 8
	};

	// Create $ object for input element
	var $input = $(input).attr("autocomplete", "off").addClass(options.inputClass);

	var timeout;
	var previousValue = "";
	var cache = $.Autocompleter.Cache(options);
	var hasFocus = 0;
	var lastKeyPressCode;
	var config = {
		mouseDownOnSelect: false
	};
	var select = $.Autocompleter.Select(options, input, selectCurrent, config);
	
	var blockSubmit;
	
	// prevent form submit in opera when selecting with return key
	$.browser.opera && $(input.form).bind("submit.autocomplete", function() {
		if (blockSubmit) {
			blockSubmit = false;
			return false;
		}
	});
	
	// only opera doesn't trigger keydown multiple times while pressed, others don't work with keypress at all
	$input.bind(($.browser.opera ? "keypress" : "keydown") + ".autocomplete", function(event) {
		// track last key pressed
		lastKeyPressCode = event.keyCode;
		switch(event.keyCode) {
		
			case KEY.UP:
				event.preventDefault();
				if ( select.visible() ) {
					select.prev();
				} else {
					onChange(0, true);
				}
				break;
				
			case KEY.DOWN:
				event.preventDefault();
				if ( select.visible() ) {
					select.next();
				} else {
					onChange(0, true);
				}
				break;
				
			case KEY.PAGEUP:
				event.preventDefault();
				if ( select.visible() ) {
					select.pageUp();
				} else {
					onChange(0, true);
				}
				break;
				
			case KEY.PAGEDOWN:
				event.preventDefault();
				if ( select.visible() ) {
					select.pageDown();
				} else {
					onChange(0, true);
				}
				break;
			
			// matches also semicolon
			case options.multiple && $.trim(options.multipleSeparator) == "," && KEY.COMMA:
			case KEY.TAB:
			case KEY.RETURN:
				if( selectCurrent() ) {
					// stop default to prevent a form submit, Opera needs special handling
					event.preventDefault();
					blockSubmit = true;
					return false;
				}
				break;
				
			case KEY.ESC:
				select.hide();
				break;
				
			default:
				clearTimeout(timeout);
				timeout = setTimeout(onChange, options.delay);
				break;
		}
	}).focus(function(){
		// track whether the field has focus, we shouldn't process any
		// results if the field no longer has focus
		hasFocus++;
	}).blur(function() {
		hasFocus = 0;
		if (!config.mouseDownOnSelect) {
			hideResults();
		}
	}).click(function() {
		// show select when clicking in a focused field
		if ( hasFocus++ > 1 && !select.visible() ) {
			onChange(0, true);
		}
	}).bind("search", function() {
		// TODO why not just specifying both arguments?
		var fn = (arguments.length > 1) ? arguments[1] : null;
		function findValueCallback(q, data) {
			var result;
			if( data && data.length ) {
				for (var i=0; i < data.length; i++) {
					if( data[i].result.toLowerCase() == q.toLowerCase() ) {
						result = data[i];
						break;
					}
				}
			}
			if( typeof fn == "function" ) fn(result);
			else $input.trigger("result", result && [result.data, result.value]);
		}
		$.each(trimWords($input.val()), function(i, value) {
			request(value, findValueCallback, findValueCallback);
		});
	}).bind("flushCache", function() {
		cache.flush();
	}).bind("setOptions", function() {
		$.extend(options, arguments[1]);
		// if we've updated the data, repopulate
		if ( "data" in arguments[1] )
			cache.populate();
	}).bind("unautocomplete", function() {
		select.unbind();
		$input.unbind();
		$(input.form).unbind(".autocomplete");
	});
	
	
	function selectCurrent() {
		var selected = select.selected();
		if( !selected )
			return false;
		
		var v = selected.result;
		previousValue = v;
		
		if ( options.multiple ) {
			var words = trimWords($input.val());
			if ( words.length > 1 ) {
				v = words.slice(0, words.length - 1).join( options.multipleSeparator ) + options.multipleSeparator + v;
			}
			v += options.multipleSeparator;
		}
		
		$input.val(v);
		hideResultsNow();
		$input.trigger("result", [selected.data, selected.value]);
		return true;
	}
	
	function onChange(crap, skipPrevCheck) {
		if( lastKeyPressCode == KEY.DEL ) {
			select.hide();
			return;
		}
		
		var currentValue = $input.val();
		
		if ( !skipPrevCheck && currentValue == previousValue )
			return;
		
		previousValue = currentValue;
		
		currentValue = lastWord(currentValue);
		if ( currentValue.length >= options.minChars) {
			$input.addClass(options.loadingClass);
			if (!options.matchCase)
				currentValue = currentValue.toLowerCase();
			request(currentValue, receiveData, hideResultsNow);
		} else {
			stopLoading();
			select.hide();
		}
	};
	
	function trimWords(value) {
		if ( !value ) {
			return [""];
		}
		var words = value.split( options.multipleSeparator );
		var result = [];
		$.each(words, function(i, value) {
			if ( $.trim(value) )
				result[i] = $.trim(value);
		});
		return result;
	}
	
	function lastWord(value) {
		if ( !options.multiple )
			return value;
		var words = trimWords(value);
		return words[words.length - 1];
	}
	
	// fills in the input box w/the first match (assumed to be the best match)
	// q: the term entered
	// sValue: the first matching result
	function autoFill(q, sValue){
		// autofill in the complete box w/the first match as long as the user hasn't entered in more data
		// if the last user key pressed was backspace, don't autofill
		if( options.autoFill && (lastWord($input.val()).toLowerCase() == q.toLowerCase()) && lastKeyPressCode != KEY.BACKSPACE ) {
			// fill in the value (keep the case the user has typed)
			$input.val($input.val() + sValue.substring(lastWord(previousValue).length));
			// select the portion of the value not typed by the user (so the next character will erase)
			$.Autocompleter.Selection(input, previousValue.length, previousValue.length + sValue.length);
		}
	};

	function hideResults() {
		clearTimeout(timeout);
		timeout = setTimeout(hideResultsNow, 200);
	};

	function hideResultsNow() {
		var wasVisible = select.visible();
		select.hide();
		clearTimeout(timeout);
		stopLoading();
		if (options.mustMatch) {
			// call search and run callback
			$input.search(
				function (result){
					// if no value found, clear the input box
					if( !result ) {
						if (options.multiple) {
							var words = trimWords($input.val()).slice(0, -1);
							$input.val( words.join(options.multipleSeparator) + (words.length ? options.multipleSeparator : "") );
						}
						else
							$input.val( "" );
					}
				}
			);
		}
		if (wasVisible)
			// position cursor at end of input field
			$.Autocompleter.Selection(input, input.value.length, input.value.length);
	};

	function receiveData(q, data) {
		if ( data && data.length && hasFocus ) {
			stopLoading();
			select.display(data, q);
			autoFill(q, data[0].value);
			select.show();
		} else {
			hideResultsNow();
		}
	};

	function request(term, success, failure) {
		if (!options.matchCase)
			term = term.toLowerCase();
		var data = cache.load(term);
		// recieve the cached data 
		// [m.bourgeois@opodo.fr] PATCH TO MAKE THE CACHE WORK WITH EMPTY RESULTS
		// if (data && data.length) {
		if (data) {
			success(term, data);
		// if an AJAX url has been supplied, try loading the data now
		} else if( (typeof options.url == "string") && (options.url.length > 0) ){
			
			var extraParams = {
				timestamp: +new Date()
			};
			$.each(options.extraParams, function(key, param) {
				extraParams[key] = typeof param == "function" ? param() : param;
			});					

			$.ajax({
				// try to leverage ajaxQueue plugin to abort previous requests
				mode: "abort",
				// limit abortion to this input
				port: "autocomplete" + input.name,
				dataType: options.dataType,
				url: options.url,
				data: $.extend({
					q: lastWord(term),
					limit: options.max
				}, extraParams),
				success: function(data) {
					var parsed = options.parse && options.parse(data) || parse(data);
					cache.add(term, parsed);
					success(term, parsed);
				}
			});
		} else {
			// if we have a failure, we need to empty the list -- this prevents the the [TAB] key from selecting the last successful match
			select.emptyList();
			failure(term);
		}
	};
	
	function parse(data) {
		var parsed = [];
		var rows = data.split("\n");
		for (var i=0; i < rows.length; i++) {
			var row = $.trim(rows[i]);
			if (row) {
				row = row.split("|");
				parsed[parsed.length] = {
					data: row,
					value: row[0],
					result: options.formatResult && options.formatResult(row, row[0]) || row[0]
				};
			}
		}
		return parsed;
	};

	function stopLoading() {
		$input.removeClass(options.loadingClass);
	};

};

$.Autocompleter.defaults = {
	inputClass: "ac_input",
	resultsClass: "ac_results",
	loadingClass: "ac_loading",
	minChars: 1,
	delay: 400,
	matchCase: false,
	matchSubset: true,
	matchContains: false,
	cacheLength: 10,
	max: 100,
	mustMatch: false,
	extraParams: {},
	selectFirst: true,
	formatItem: function(row) { return row[0]; },
	formatMatch: null,
	autoFill: false,
	width: 0,
	multiple: false,
	multipleSeparator: ", ",
	highlight: function(value, term) {
		return value.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + term.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi, "\\$1") + ")(?![^<>]*>)(?![^&;]+;)", "gi"), "<strong>$1</strong>");
	},
    scroll: true,
    scrollHeight: 180
};

$.Autocompleter.Cache = function(options) {

	var data = {};
	var length = 0;

	// [m.bourgeois@opodo.fr] Function replacing special chars like accents, dash and quote
	function replaceSpecialChars(strAccents){
		strAccents = strAccents.split('');
		strAccentsOut = new Array();
		strAccentsLen = strAccents.length;
		var accents = "'-ÀÁÂÃÄÅàáâãäåÒÓÔÕÕÖØòóôõöøÈÉÊËèéêëðÇçÐÌÍÎÏìíîïÙÚÛÜùúûüÑñŠšŸÿýŽž";
		var accentsOut = [' ',' ','A','A','A','A','A','A','a','a','a','a','a','a','O','O','O','O','O','O','O','o','o','o','o','o','o','E','E','E','E','e','e','e','e','e','C','c','D','I','I','I','I','i','i','i','i','U','U','U','U','u','u','u','u','N','n','S','s','Y','y','y','Z','z'];
		for (var y = 0; y < strAccentsLen; y++) {
			if (accents.indexOf(strAccents[y]) != -1) {
				strAccentsOut[y] = accentsOut[accents.indexOf(strAccents[y])];
			}
			else
				strAccentsOut[y] = strAccents[y];
		}
		strAccentsOut = strAccentsOut.join('');
		return strAccentsOut;
	}

	function matchSubset(s, sub) {
		if (!options.matchCase) 
			s = s.toLowerCase();

		// [m.bourgeois@opodo.fr] COMPARE STRINGS IGNORING SPECIAL CHARS
		s = replaceSpecialChars(s);
		sub = replaceSpecialChars(sub);

		var i = s.indexOf(sub);
		if (options.matchContains == "word"){
			i = s.toLowerCase().search("\\b" + sub.toLowerCase());
		}
		if (i == -1) return false;
		return i == 0 || options.matchContains;
	};
	
	function add(q, value) {
		if (length > options.cacheLength){
			flush();
		}
		if (!data[q]){ 
			length++;
		}
		data[q] = value;
	}
	
	function populate(){
		if( !options.data ) return false;
		// track the matches
		var stMatchSets = {},
			nullData = 0;

		// no url was specified, we need to adjust the cache length to make sure it fits the local data store
		if( !options.url ) options.cacheLength = 1;
		
		// track all options for minChars = 0
		stMatchSets[""] = [];
		
		// loop through the array and create a lookup structure
		for ( var i = 0, ol = options.data.length; i < ol; i++ ) {
			var rawValue = options.data[i];
			// if rawValue is a string, make an array otherwise just reference the array
			rawValue = (typeof rawValue == "string") ? [rawValue] : rawValue;
			
			var value = options.formatMatch(rawValue, i+1, options.data.length);
			if ( value === false )
				continue;
				
			var firstChar = value.charAt(0).toLowerCase();
			// if no lookup array for this character exists, look it up now
			if( !stMatchSets[firstChar] ) 
				stMatchSets[firstChar] = [];

			// if the match is a string
			var row = {
				value: value,
				data: rawValue,
				result: options.formatResult && options.formatResult(rawValue) || value
			};
			
			// push the current match into the set list
			stMatchSets[firstChar].push(row);

			// keep track of minChars zero items
			if ( nullData++ < options.max ) {
				stMatchSets[""].push(row);
			}
		};

		// add the data items to the cache
		$.each(stMatchSets, function(i, value) {
			// increase the cache size
			options.cacheLength++;
			// add to the cache
			add(i, value);
		});
	}
	
	// populate any existing data
	setTimeout(populate, 25);
	
	function flush(){
		data = {};
		length = 0;
	}
	
	return {
		flush: flush,
		add: add,
		populate: populate,
		load: function(q) {
			if (!options.cacheLength || !length)
				return null;
			/* 
			 * if dealing w/local data and matchContains than we must make sure
			 * to loop through all the data collections looking for matches
			 */
			if( !options.url && options.matchContains ){
				// track all matches
				var csub = [];
				// loop through all the data grids for matches
				for( var k in data ){
					// don't search through the stMatchSets[""] (minChars: 0) cache
					// this prevents duplicates
					if( k.length > 0 ){
						var c = data[k];
						$.each(c, function(i, x) {
							// if we've got a match, add it to the array
							if (matchSubset(x.value, q)) {
								csub.push(x);
							}
						});
					}
				}				
				return csub;
			} else 
			// if the exact item exists, use it
			if (data[q]){
				return data[q];
			} else
			if (options.matchSubset) {
				for (var i = q.length - 1; i >= options.minChars; i--) {
					var c = data[q.substr(0, i)];
					if (c) {
						var csub = [];
						$.each(c, function(i, x) {
							if (matchSubset(x.value, q)) {
								csub[csub.length] = x;
							}
						});
						return csub;
					}
				}
			}
			return null;
		}
	};
};

$.Autocompleter.Select = function (options, input, select, config) {
	var CLASSES = {
		ACTIVE: "ac_over"
	};
	
	var listItems,
		active = -1,
		data,
		term = "",
		needsInit = true,
		element,
		list;
	
	// Create results
	function init() {
		if (!needsInit)
			return;
		element = $("<div/>")
		.hide()
		.addClass(options.resultsClass)
		.css("position", "absolute")
		.appendTo(document.body);
	
		list = $("<ul/>").appendTo(element).mouseover( function(event) {
			if(target(event).nodeName && target(event).nodeName.toUpperCase() == 'LI') {
	            active = $("li", list).removeClass(CLASSES.ACTIVE).index(target(event));
			    $(target(event)).addClass(CLASSES.ACTIVE);            
	        }
		}).click(function(event) {
			$(target(event)).addClass(CLASSES.ACTIVE);
			select();
			// TODO provide option to avoid setting focus again after selection? useful for cleanup-on-focus
			input.focus();
			return false;
		}).mousedown(function() {
			config.mouseDownOnSelect = true;
		}).mouseup(function() {
			config.mouseDownOnSelect = false;
		});
		
		if( options.width > 0 )
			element.css("width", options.width);
			
		needsInit = false;
	} 
	
	function target(event) {
		var element = event.target;
		while(element && element.tagName != "LI")
			element = element.parentNode;
		// more fun with IE, sometimes event.target is empty, just ignore it then
		if(!element)
			return [];
		return element;
	}

	function moveSelect(step) {
		listItems.slice(active, active + 1).removeClass(CLASSES.ACTIVE);
		movePosition(step);
        var activeItem = listItems.slice(active, active + 1).addClass(CLASSES.ACTIVE);
        if(options.scroll) {
            var offset = 0;
            listItems.slice(0, active).each(function() {
				offset += this.offsetHeight;
			});
            if((offset + activeItem[0].offsetHeight - list.scrollTop()) > list[0].clientHeight) {
                list.scrollTop(offset + activeItem[0].offsetHeight - list.innerHeight());
            } else if(offset < list.scrollTop()) {
                list.scrollTop(offset);
            }
        }
	};
	
	function movePosition(step) {
		active += step;
		if (active < 0) {
			active = listItems.size() - 1;
		} else if (active >= listItems.size()) {
			active = 0;
		}
	}
	
	function limitNumberOfItems(available) {
		return options.max && options.max < available
			? options.max
			: available;
	}
	
	function fillList() {
		list.empty();
		var max = limitNumberOfItems(data.length);
		for (var i=0; i < max; i++) {
			if (!data[i])
				continue;
			var formatted = options.formatItem(data[i].data, i+1, max, data[i].value, term);
			if ( formatted === false )
				continue;
			var li = $("<li/>").html( options.highlight(formatted, term) ).addClass(i%2 == 0 ? "ac_even" : "ac_odd").appendTo(list)[0];
			$.data(li, "ac_data", data[i]);
		}
		listItems = list.find("li");
		if ( options.selectFirst ) {
			listItems.slice(0, 1).addClass(CLASSES.ACTIVE);
			active = 0;
		}
		// apply bgiframe if available
		if ( $.fn.bgiframe )
			list.bgiframe();
	}
	
	return {
		display: function(d, q) {
			init();
			data = d;
			term = q;
			fillList();
		},
		next: function() {
			moveSelect(1);
		},
		prev: function() {
			moveSelect(-1);
		},
		pageUp: function() {
			if (active != 0 && active - 8 < 0) {
				moveSelect( -active );
			} else {
				moveSelect(-8);
			}
		},
		pageDown: function() {
			if (active != listItems.size() - 1 && active + 8 > listItems.size()) {
				moveSelect( listItems.size() - 1 - active );
			} else {
				moveSelect(8);
			}
		},
		hide: function() {
			element && element.hide();
			listItems && listItems.removeClass(CLASSES.ACTIVE);
			active = -1;
		},
		visible : function() {
			return element && element.is(":visible");
		},
		current: function() {
			return this.visible() && (listItems.filter("." + CLASSES.ACTIVE)[0] || options.selectFirst && listItems[0]);
		},
		show: function() {
			var offset = $(input).offset();
			element.css({
				width: typeof options.width == "string" || options.width > 0 ? options.width : $(input).width(),
				top: offset.top + input.offsetHeight,
				left: offset.left
			}).show();
            if(options.scroll) {
                list.scrollTop(0);
                list.css({
					maxHeight: options.scrollHeight,
					overflow: 'auto'
				});
				
                if($.browser.msie && typeof document.body.style.maxHeight === "undefined") {
					var listHeight = 0;
					listItems.each(function() {
						listHeight += this.offsetHeight;
					});
					var scrollbarsVisible = listHeight > options.scrollHeight;
                    list.css('height', scrollbarsVisible ? options.scrollHeight : listHeight );
					if (!scrollbarsVisible) {
						// IE doesn't recalculate width when scrollbar disappears
						listItems.width( list.width() - parseInt(listItems.css("padding-left")) - parseInt(listItems.css("padding-right")) );
					}
                }
                
            }
		},
		selected: function() {
			var selected = listItems && listItems.filter("." + CLASSES.ACTIVE).removeClass(CLASSES.ACTIVE);
			return selected && selected.length && $.data(selected[0], "ac_data");
		},
		emptyList: function (){
			list && list.empty();
		},
		unbind: function() {
			element && element.remove();
		}
	};
};

$.Autocompleter.Selection = function(field, start, end) {
	if( field.createTextRange ){
		var selRange = field.createTextRange();
		selRange.collapse(true);
		selRange.moveStart("character", start);
		selRange.moveEnd("character", end);
		selRange.select();
	} else if( field.setSelectionRange ){
		field.setSelectionRange(start, end);
	} else {
		if( field.selectionStart ){
			field.selectionStart = start;
			field.selectionEnd = end;
		}
	}
	field.focus();
};

})(jQuery);
;
/* AGGREGATED JS FILE: sites/all/modules/atb/opodo_hotel.js */
/*
 * Created on 16/07/08
 * Author ccourreg <cedric.courreges@capgemini.com>
 * version 1.0
 */
 
/**
*	Updated on 17/05/2011
*   Ticket 395421 : Evolution du moteur Opodo
*   Author Laurent Namura <laurent.namura@capgemini.com>
**/

if (Drupal.jsEnabled) {
	
  /**
  * CCS
  * Action : valid_form_opodo_hotel
  * Action exécutée sur le submit de la réservation d'hotel OPODO
  */
	function displayHotelErrors(destination, date_arrivee, date_retour)
	{ 
		form_errors_msg = ""; // init 

		if(destination.length == 0){
			$('#hotel_destination').addClass('error');
			form_errors_msg += "<li>" + 'Veuillez choisir une destination.' + "</li>";
		}
		
		if(date_arrivee.length == 0){
			$('#hotel_dateDepart').addClass('error');
			form_errors_msg += "<li>" + 'La date d&eacute;part est obligatoire.' + "</li>";
		}	
		if(date_retour.length == 0){
			$('#hotel_dateRetour').addClass('error');
			form_errors_msg += "<li>" + 'La date d\'arriv&eacute;e est obligatoire.' + "</li>";
		}
		//	Vérification des nombres de champs à cocher
		if(!$('#multimoteur_hotel input[name="numberOfRooms"]').length){
			form_errors_msg += "<li>" + 'Veuillez modifier le nombre de personnes.' + "</li>";
		
		}
		//	Vérification du nombre de chambres bien coché
		if($('#multimoteur_hotel input[name="numberOfRooms"]:checked').length == 0){
			form_errors_msg += "<li>" + 'Veuillez choisir un nombre de chambres.' + "</li>";
		}
		
		if(date_arrivee.length > 0 && date_retour.length > 0 && transformToDate(date_arrivee).valueOf() > transformToDate(date_retour).valueOf()){
			form_errors_msg += "<li>" + 'La date d\'arriv&eacute;e est plus grande que la date de retour.' + "</li>";
		}
		// date du jour
		today = new Date();
		rightnow = new Date(today.getFullYear(), today.getMonth(), today.getDate(), 0,0,0,0);

		if(transformToDate(date_arrivee).valueOf() < rightnow.valueOf() && date_arrivee.length > 0)
		{
		form_errors_msg += "<li>" + 'La date d\'arriv&eacute;e est ant&eacute;rieure &agrave; la date du jour.' + "</li>";
		}

		if(transformToDate(date_arrivee).valueOf() == transformToDate(date_retour).valueOf() && transformToDate(date_arrivee).valueOf() > rightnow.valueOf())
		{
		form_errors_msg += "<li>" + 'La date d\'arriv&eacute;e ne peut &ecirc;tre &eacute;gale &agrave; la date de d&eacute;part.' + "</li>";
		}

		if(transformToDate(date_retour).valueOf() < rightnow.valueOf() && date_retour.length > 0)
		{
		form_errors_msg += "<li>" + 'La date de retour est ant&eacute;rieure &agrave; la date du jour.' + "</li>";
		}

		// if(form_errors_msg.length > 0){
			// setMsgHotelError("<ul>" + form_errors_msg + "</ul>");
		if(form_errors_msg.length > 0){	
			setMsgHotelError("<div class='messages error'><ul style='font-weight:normal;'>" + form_errors_msg + "</ul></div>");
		}else{
			$('#form_hotel_result').html('');
			$('#form_hotel_result').slideUp();
		}
	}
	
	function setMsgHotelError(msg) 
	{
      	$('#form_hotel_result').html(msg);
      	$('#form_hotel_result').slideDown();
  	}

		
	$(document).ready(function()
	{
		today	=	new Date();
		var hotel_date_aller	=	7;
		var hotel_date_retour	=	8;
		var hotel_dates_diff	=	1;
	
		//	GESTION DES DATES
		//	Dates par défaut
		default_date('#hotel_dateDepart', today, hotel_date_aller);
		default_date('#hotel_dateRetour', today, hotel_date_retour);
		//	Mise à jour de la date de retour si la date d'aller est plus grande, et inversement
		dates_diff('#hotel_dateDepart', '#hotel_dateRetour', hotel_dates_diff);
		//	Déclenchement du changement si on a des champs remplis par défaut
		$('#hotel_dateDepart, #hotel_dateRetour').change();

		//	GESTION DES CHAMBRES
		hotel_chambres('#hotel_adultes', '#hotel_enfants');
		$('#hotel_adultes, #hotel_enfants').change(function() {
			hotel_chambres('#hotel_adultes', '#hotel_enfants');
		});
		
		// GESTION DU NOMBRE D'ENFANTS
		$('#multimoteur_hotel_plus, input[name="numberOfRooms"]').change(function() {
			hotel_enfants();
		});
		
		//	Gestion des erreurs
		$('#OpodoQuickHotelSearch .obligatoire').focus(function() {
		$('#multimoteur_error').remove();
		$(this).removeClass('error');
		});
	});
	
	//	ENVOI DU FORMULAIRE			
	function hotelSearchFormBeanSubmit() 
	{
		var ville	=	$('#hotel_destination').val();
		var date_depart	=	$('#hotel_dateDepart').val();
		var date_retour	=	$('#hotel_dateRetour').val();
		
		//	VÉRIFICATION DES CHAMPS
		displayHotelErrors(ville, date_depart, date_retour);
		
		//	Vérification de la ville
		if(ville == '')
			return false;
		
		//	Vérification des dates		
		if(!is_date(date_depart))
			return false;
		if(!is_date(date_retour))
			return false;
		
		//	Vérification des nombres de champs à cocher
		if(!$('#multimoteur_hotel input[name="numberOfRooms"]').length)
			return false;
			
		//	Vérification du nombre de chambres bien coché
		if($('#multimoteur_hotel input[name="numberOfRooms"]:checked').length == 0)
			return false;
		
		//	PRÉPARATION DU FORMULAIRE AVANT ENVOI
		//Suppression des champs caché de traitement
		$('#5').remove();
		$('#6').remove();
		
		//	Gestion de la répartition des chambres
		//	var repartition_chambres	=	new Array();
		//	var repartition_enfants		=	new Array();
		var nb_chambres			=	$('input[name="numberOfRooms"]:checked').val();
		var nb_adultes			=	$('#hotel_adultes option:selected').val();
		var nb_enfants			=	$('#hotel_enfants option:selected').val();
		
		var adultes_par_chambre	=	Math.round(nb_adultes/nb_chambres);
		var enfants_par_chambre	=	Math.round(nb_enfants/nb_chambres);

		//	On crée les champs de nombre
		$('#multimoteur_hotel').append('<input id="5" type="hidden" name="roomOccupancies[0].numberOfAdults" value="'+adultes_par_chambre+'">');
		$('#multimoteur_hotel').append('<input id="6" type="hidden" name="roomOccupancies[0].numberOfChildren" value="'+enfants_par_chambre+'">');
		
		//	On complète les champs d'âges d'enfants manquants
		var max_enfants			=	enfants_par_chambre*nb_chambres;
		var diff_enfants		=	max_enfants-nb_enfants;
		//	On prend le dernier nom de champ d'enfants
		var last_child_field	=	$('select[name^="childAges"]:last').attr('name');
		//	On récupère les différents nombres
		var reg_name			=	/childAges([0-9]+)\[([0-9]+)\]/;
		reg_name.exec(last_child_field);
		var num_1				=	RegExp.$1;
		var num_2				=	RegExp.$2;
		while(diff_enfants > 0) {
			num_2++;
			//	Création des champs d'enfants supplémentaires, obligatoires à cause du système sur le site distant : un même nombre de personnes pour chaque chambre
			$('#multimoteur_hotel').append('<input type="hidden" name="childAges'+num_1+'['+num_2+']" value="0">');
			diff_enfants--;
		}
		
		//	On crée les champs de date
		var date_depart	=	$('#hotel_dateDepart').val();
		var date_retour	=	$('#hotel_dateRetour').val();
		var tab_depart	=	date_depart.split('/');
		var tab_retour	=	date_retour.split('/');
		
		$('#checkInDay').val(tab_depart[0]);
		$('#checkInMonthYear').val(tab_depart[2]+tab_depart[1]);
		$('#checkOutDay').val(tab_retour[0]);
		$('#checkOutMonthYear').val(+tab_retour[2]+tab_retour[1]);
		//	On masque les anciens champs de date
		//$('#hotel_dateDepart, #hotel_dateRetour').attr('disabled', 'disabled');
	}
	
	
	function hotel_chambres(champ_adultes, champ_enfants) {
	
	//	On supprime le champ
	$('#multimoteur_hotel_chambre').remove();
	$('#alert').remove();
	
	//	On commence par calculer le nombre de passagers
	var nb_adultes	=	$(champ_adultes+' option:selected').val();
	var nb_enfants	=	$(champ_enfants+' option:selected').val();
	var max_chambres				=	4;
	var max_adultes_par_chambre		=	4;
	var max_enfants_par_chambre		=	4;
	var max_enfants_par_chambre_dp	=	4;
	var max_personnes_par_chambre	=	6;
	
	var tab	=	new Array();
	
	for(var nb_chambres	=	1; nb_chambres <= Math.min(nb_adultes, max_chambres); nb_chambres++) {
		var nb_adultes_par_chambre		=	Math.ceil(nb_adultes / nb_chambres);
		var nb_enfants_par_chambre		=	Math.ceil(nb_enfants / nb_chambres);
		var nb_personnes_par_chambre	=	nb_adultes_par_chambre + nb_enfants_par_chambre;
		
		if(nb_adultes_par_chambre <= max_adultes_par_chambre && nb_enfants_par_chambre <= max_enfants_par_chambre && nb_personnes_par_chambre <= max_personnes_par_chambre) {
			var array	=	new Array(nb_chambres, nb_personnes_par_chambre);
			tab.push(array);
		}
	}

	//	Ajout des champs
	$('#multimoteur_hotel_plus').prepend('<div id="multimoteur_hotel_chambre"></div>');	//	Prepend pour être certain d'ajouter ces options en premier
	if(tab.length) {
		$('#multimoteur_hotel_chambre').append('<p>R&eacute;partition par chambre :</p>');
		for(var i = 0; i < tab.length; i++) {
			var checked				=	(i == 0) ? ' checked="checked"' : '';
			var pluriel_chambres	=	(tab[i][0] > 1) ? 's' : '';
			var pluriel_personnes	=	(tab[i][1] > 1) ? 's' : '';
			$('#multimoteur_hotel_chambre').append('<div><input type="radio" name="numberOfRooms" id="nb_chambres_'+i+'" value="'+tab[i][0]+'"'+checked+'><label for="nb_chambres_'+i+'" class="inline">'+tab[i][0]+' chambre'+pluriel_chambres+' pour '+tab[i][1]+' personne'+pluriel_personnes+'</label></div>');
		}
		hotel_enfants();
	}
	else {
		$('#multimoteur_hotel_plus').append('<p id="alert" class="alert">Aucune proposition pour les nombres d\'adultes et d\'enfants s&eacute;lectionn&eacute;s</p>');
		$('#multimoteur_hotel_enfants').remove();
	}
	
	}

	function hotel_enfants() {
		//	On commence par garder en mémoire les différents âges déjà entrés, si disponibles
		var tab_enfants	=	new Array();
		$('#multimoteur_hotel_plus select[name^="childAges"]').each(function() {
			tab_enfants.push($(this).find('option:selected').val());
		});
			
		//	On supprime un éventuel champ existant
		$('#multimoteur_hotel_enfants').remove();
		//	On recrée les champs
		var nb_enfants	=	$('#hotel_enfants option:selected').val();
		var nb_chambres	=	$('#multimoteur_hotel_plus input[name="numberOfRooms"]:checked').val();

		if(nb_enfants != 0 && nb_chambres != undefined) {
			$('#multimoteur_hotel_plus').append('<div id="multimoteur_hotel_enfants"></div>');
			$('#multimoteur_hotel_enfants').append('<p>&Acirc;ge des enfants lors du voyage :</p>');
			for(var i = 0; i < nb_enfants; i++) {
				var numero_enfant			=	i+1;
				var nb_enfants_par_chambre	=	Math.ceil(nb_enfants/nb_chambres);
				var numero_chambre			=	Math.floor(i/nb_enfants_par_chambre)+1;
				var numero_enfant_chambre	=	i % nb_enfants_par_chambre;
				$('#multimoteur_hotel_enfants').append('<div><label for="multimoteur_enfant_'+i+'" class="inline">Enfant '+numero_enfant+' :</label><select name="childAges'+numero_chambre+'['+numero_enfant_chambre+']" id="multimoteur_enfant_'+i+'"></select></div>');
			}
			//	On remplit les selects
			$('#multimoteur_hotel_enfants select').each(function() {
				var id		=	$(this).attr('id');
				var numero	=	id.replace('multimoteur_enfant_', '');
				for(var i = 0; i <= 16; i++) {
					var selected	=	(numero in tab_enfants && tab_enfants[numero] == i) ? ' selected="selected"' : '';
					var texte_i		=	(i == 0) ? '< 1' : i;
					$(this).append('<option value="'+i+'"'+selected+'>'+texte_i+'</option>');
				}
			});
		}
	}
} // EOF
;
/* AGGREGATED JS FILE: sites/all/modules/atb/opodo_voiture.js */
/*
 * Created on 20 juin 08
 * Author CCS <cedric.courreges@capgemini.com>
 * 
 * version 1.0
 */
/**
*	Updated on 17/05/2011
*   Ticket 395421 : Evolution du moteur Opodo
*   Author Laurent Namura <laurent.namura@capgemini.com>
**/

if (Drupal.jsEnabled) 
{
		
	$(document).ready(function() 
	{
		//	MOTEUR VOITURES
		//	Dates par dÃ©faut (date du jour + ?)
		today	=	new Date();
		var voiture_date_aller	=	7;
		var voiture_date_retour	=	14;
		var voiture_dates_diff	=	0;
		
		//	GESTION DES DATES
			//	Dates par dÃ©faut
			default_date('#voiture_dateDepart', today, voiture_date_aller);
			default_date('#voiture_dateRetour', today, voiture_date_retour);
			//	Mise Ã  jour de la date de retour si la date d'aller est plus grande, et inversement
			dates_diff('#voiture_dateDepart', '#voiture_dateRetour', voiture_dates_diff);
			//	DÃ©clenchement du changement si on a des champs remplis par dÃ©faut
			$('#voiture_dateDepart, #voiture_dateRetour').change();
			
		//	GESTION DES VILLES DE DÃ‰PART ET DE RETOUR
			texte_voiture_depart	=	'Ville ou aÃ©roport';
			texte_voiture_retour	=	'Identique Ã  la prise en charge';
			default_blank_value('#voiture_villedepart', texte_voiture_depart);
			default_blank_value('#voiture_villeretour', texte_voiture_retour);
			
		//	DÃ©sactivation de la ville de retour
			// $('#voiture_villeretour').attr('disabled', 'disabled');
			
		//	GESTION DE L'AUTOCOMPLETE
		autocomplete_voitures('input#voiture_villedepart, input#voiture_villeretour', {proxy_path: autocomplete_path});
		
		//	Gestion des erreurs
		$('#OpodoQuickCarSearch .obligatoire').focus(function() {
		$('#multimoteur_error').remove();
		$(this).removeClass('error');
		});
		
	});

	/**
	* CCS
	* Action : valid_form_opodo_voiture
	* Action exÃ©cutÃ©e sur le submit de la rÃ©servation de voiture OPODO
	*/
	function displayVoitureErrors(ville_depart, ville_restitution, date_depart, date_restitution, age)
	{ 
		form_errors_msg = ""; // init 

		if(age == 0){
			form_errors_msg += "<li>" + 'L\'age du conducteur est obligatoire.' + "</li>";
			$('#voiture_ageConducteur').addClass('error');
		}
		if(ville_depart.length == 0 || ville_depart == texte_voiture_depart){
			form_errors_msg += "<li>" + 'Le lieu de prise en charge est obligatoire.'+ "</li>";
			$('#voiture_villedepart').addClass('error');
		}
		if(date_depart.length == 0){
			form_errors_msg += "<li>" + 'La date de prise en charge est obligatoire.' + "</li>";
			$('#voiture_dateDepart').addClass('error');
		}
		if(date_restitution.length == 0){
			form_errors_msg += "<li>" + 'La date de restitution est obligatoire.' + "</li>";
			$('#voiture_dateRetour').addClass('error');
		}
		if(date_restitution.length > 0 && date_depart.length && transformToDate(date_depart).valueOf() > transformToDate(date_restitution).valueOf()){
			form_errors_msg += "<li>" + 'La date de prise en charge est plus grande que la date de restitution.' + "</li>";
		}
		// date du jour
		today = new Date();
		rightnow = new Date(today.getFullYear(), today.getMonth(), today.getDate(), 0,0,0,0);


		if(transformToDate(date_depart).valueOf() < rightnow.valueOf() && date_depart.length > 0)
		{
			form_errors_msg += "<li>" + 'La date de prise en charge est ant&eacute;rieure &agrave; la date du jour.' + "</li>";
		}

		if(transformToDate(date_restitution).valueOf() < rightnow.valueOf() && date_restitution.length > 0)
		{
			form_errors_msg += "<li>" + 'La date de restitution est ant&eacute;rieure &agrave; la date du jour.' + "</li>";
		}


		// if(form_errors_msg.length > 0)
		// setMsgCarError("<ul>" + form_errors_msg + "</ul>");
		
		if(form_errors_msg.length > 0){	
			setMsgCarError("<div class='messages error'><ul style='font-weight:normal;'>" + form_errors_msg + "</ul></div>");
		}else{
			$('#form_car_result').html('');
			$('#form_car_result').slideUp();
		}
	}
	
	function setMsgCarError(msg) {
		$('#form_car_result').html(msg);
		$('#form_car_result').slideDown();
	}

	/**
	 * CCS 
	 * VÃ©rification Submit
	 */
	function carSearchFormBeanSubmit()
	{
		//	VÃ‰RIFICATION DES CHAMPS
		
		var age	=	$('#voiture_ageConducteur option:selected').val();
		var lieu	=	$('#voiture_villedepart').val();
		var lieu_retour = $('#voiture_villeretour').val();
		var date_depart	=	$('#voiture_dateDepart').val();
		var date_retour	=	$('#voiture_dateRetour').val();

		displayVoitureErrors(lieu, lieu_retour, date_depart, date_retour, age);
		
		//	Ã‚ge du conducteur
		if(age == '')
			return false;
			
		//	Lieu de prise en charge (Le lieu de retour vide signifie qu'on rend le vÃ©hicule au mÃªme endroit)
		if(lieu == '' || lieu == texte_voiture_depart)
			return false;
			
		//	Dates
		if(!is_date(date_depart))
			return false;
		if(!is_date(date_retour))
			return false;
	
		//	PRÃ‰PARATION DU FORMULAIRE AVANT ENVOI
		//Suppression des champs cachÃ© de traitement
		$('#3').remove();
		
		//	On crÃ©e les champs de date
		var date_depart		=	$('#voiture_dateDepart').val();
		var date_retour		=	$('#voiture_dateRetour').val();
		var heure_depart	=	$('#voiture_pickHour').val();
		var heure_retour	=	$('#voiture_dropHour').val();
		var tab_depart		=	date_depart.split('/');
		var tab_retour		=	date_retour.split('/');
		
		$('#pickUpDateForm').val(tab_depart[2]+tab_depart[1]+tab_depart[0]+heure_depart+'00');
		$('#dropOffDateForm').val(tab_retour[2]+tab_retour[1]+tab_retour[0]+heure_retour+'00');
		
		//	On masque les anciens champs de date
		// $('#voiture_dateDepart, #voiture_dateRetour, #voiture_pickHour, #voiture_dropHour').attr('disabled', 'disabled');
		
			// Si la seconde destination est vide, on lui attribue la valeur de la premiÃ¨re
		var destination2	=	$('#voiture_villeretour');
		if(destination2.val() == '' || destination2.val() == texte_voiture_retour) {
			var disabled	=	destination2.attr('disabled');
			if(disabled)
				destination2.after('<input id="3" type="hidden" name="destination2" value="'+$('#voiture_villedepart').val()+'">');
			else
				destination2.val($('#voiture_villedepart').val());
			
		}
	}
}
;
/* AGGREGATED JS FILE: sites/all/modules/atb/opodo/autocomplete_voitures.js */
function autocomplete_voitures(fields, options) {
	//	Période de test : on n'active la fonctionnalité que sur multimoteur.opodo.fr et stg.opodo.fr
	/*
		var url			=	location.href;
		var tab_test	=	new Array('multimoteur.opodo.fr', 'stg.opodo.fr', 'localhost');
		var test		=	false;
		for(i in tab_test) {
			if(url.indexOf(tab_test[i]) != -1)
				test	=	true;
		}
		if(!test)
			return false;
	*/
	
	//	Test Zul: on change l'url d'action, sur stage uniquement
	/*
	if(url.indexOf('stg.opodo.fr') != -1 || url.indexOf('localhost') != -1) {
		$('form#multimoteur_voiture').attr('action', 'http://production.prev.fr/opodo/StrutsServlet/SearchPodCars');
	}
	*/
	
	//	Default values
	var width		=	370;									//	Default width
	var proxy_path	=	'autocomplete_voitures.php';			//	Default path to the autocomplete script
	
	if(typeof options == 'object') {
		//	Setting the proxy path
		if(typeof options['proxy_path'] != 'undefined')
			proxy_path	=	options['proxy_path'];
		//	Setting the width
		if(typeof options['width'] != 'undefined')
			width	=	options['width'];
	}
	
	jQuery(fields).each(function() {
		$(this).attr('autocomplete', 'off');
	});
	
	jQuery(fields).autocomplete(proxy_path, {
		minChars:		4,
		delay:			100,
		matchContains:	true,
		selectFirst:	true,
		width:			width,
		max:			10,
		scroll:			false,
		cacheLength:	0,
		extraParams:	{
			voiture:		'true',
			locationType:	'Z',
			type:			'city',
			age:			25
		},
		formatResult: function(data, value) {
			return data[0];
		}
	});
	
	//	Si on quitte le champ sans choisir de valeur, on le remplit automatiquement
	// jQuery(fields).blur(function() {
		// var contenu	=	jQuery('.ac_results li:first').text();
		// if(contenu)
			// $(this).val(contenu);
	// });
}
;
/* AGGREGATED JS FILE: sites/all/modules/dhtml_menu/dhtml_menu.js */
// $Id: dhtml_menu.js,v 1.9.2.10 2008/06/23 09:58:41 arancaytar Exp $

Drupal.dhtmlMenu = {};

/**
 * Attaches the online users autoupdate behaviour to the block content.
 */
Drupal.dhtmlMenu.autoAttach = function() {
  var cookievalue = Drupal.dhtmlMenu.getCookie('dhtml_menu');
  if (cookievalue != '') {
    var cookieList = cookievalue.split(',');
    for (var i = 0; i < cookieList.length; i++) {
      $('#'+ cookieList[i]).show();
      $('#'+ cookieList[i]).removeClass('sub-collapsed').addClass('sub-expanded');
      $('#menu-' + cookieList[i]).removeClass('collapsed').addClass('expanded');
    }
  }

  $('ul.menu li[@class!="leaf"] > a').each(function() {
    if ($(this).parent().children('div.submenu').length > 0) {
      $(this)
      .css({display: 'block', zIndex: 2})
      .click(function(e) {
        id = $(this).parents()[0].id.replace('menu-', '');
        Drupal.dhtmlMenu.switchMenu($('#'+ id)[0], $(this).parents()[0]);
          
        return false;
      })
      .dblclick(function(e) {
        window.location = this.href;
      });
    }
  });

  $(window).unload(Drupal.dhtmlMenu.saveMenuState);
};

/**
 *  Changes the state of a submenu from open to close.
 */
Drupal.dhtmlMenu.switchMenu = function(submenu, parent) {
  if($(parent).is('.expanded')) {
    if (Drupal.settings.dhtmlMenu.useEffects) {
      $(submenu).animate({height: 'hide', opacity: 'hide'}, '500');
    } else {
      $(submenu).css('display', 'none');
    }
    $(parent).removeClass('expanded').addClass('collapsed');
    $(submenu).removeClass('sub-expanded').addClass('sub-collapsed');
  } else {
    if (Drupal.settings.dhtmlMenu.useEffects) {
      $(submenu).animate({height: 'show', opacity: 'show'}, '500');
    } else {
      $(submenu).css('display', 'block');
    }
    $(parent).removeClass('collapsed').addClass('expanded');
    $(submenu).removeClass('sub-collapsed').addClass('sub-expanded');
  }
  Drupal.dhtmlMenu.saveMenuState();
}

/**
 * Grabs the cookie data.
 */
Drupal.dhtmlMenu.getCookie = function(name) {
  var search = name + '=';
  var returnvalue = '';
  
  if (document.cookie.length > 0) {
    offset = document.cookie.indexOf(search);
    if (offset != -1) {
      offset += search.length;
      var end = document.cookie.indexOf(';', offset);
      if (end == -1) {
        end = document.cookie.length;
      }
      returnvalue = unescape(document.cookie.substring(offset, end));
    }
  }

  return returnvalue;
}

/**
 * Saves the states of the menus.
 */
Drupal.dhtmlMenu.saveMenuState = function() {
  var blocks = '';
  $('div.submenu').each(function(i) {
    if ($(this).is('.sub-expanded')) {
      if (blocks != '') {
        blocks += ',';
      }
      blocks += this.id;
    }
  });

  document.cookie = 'dhtml_menu=' + blocks + ';path=/';
}

if (Drupal.jsEnabled) {
  $(document).ready(Drupal.dhtmlMenu.autoAttach);
}

;
/* AGGREGATED JS FILE: sites/all/modules/jquery_update/collapse-fix.js */
// $Id: collapse-fix.js,v 1.1 2007/04/26 15:14:38 jjeff Exp $
// redefining toggleFieldset for compatibility with later versions of JQuery
Drupal.toggleFieldset = function(fieldset) {
  if ($(fieldset).is('.collapsed')) {
    var content = $('> div', fieldset).hide();
    $(fieldset).removeClass('collapsed');
    content.slideDown( {
    duration: 300, // THE FIX
      complete: function() {
        // Make sure we open to height auto
        $(this).css('height', 'auto');
        Drupal.collapseScrollIntoView(this.parentNode);
        this.parentNode.animating = false;
      },
      step: function() {
         // Scroll the fieldset into view
        Drupal.collapseScrollIntoView(this.parentNode);
      }
    });
    if (typeof Drupal.textareaAttach != 'undefined') {
      // Initialize resizable textareas that are now revealed
      Drupal.textareaAttach(null, fieldset);
    }
  }
  else {
    var content = $('> div', fieldset).slideUp('medium', function() {
      $(this.parentNode).addClass('collapsed');
      this.parentNode.animating = false;
    });
  }
}
;
/* AGGREGATED JS FILE: sites/all/modules/panels/layouts/panel_five_row.js */
function show_pane(pane_name) {
if (pane_name=="") {
pane_name="vacances-pane";
}

if (document.getElementById("vacances-pane")) {
  document.getElementById("vacances-pane").style.display="none";
  document.getElementById("vols-pane").style.display="none";
  document.getElementById("hotels-pane").style.display="none";
  document.getElementById("voitures-pane").style.display="none";
  document.getElementById(pane_name).style.display="";
}
}

