





/** es **/

/** jQuery ui date picker **/
/** > /scripts-v66/lib/jplugins/ui-1.8.14/jquery.ui.core.min.js **/
/*!
 * jQuery UI 1.8.14
 *
 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI
 */
(function(c,j){function k(a,b){var d=a.nodeName.toLowerCase();if("area"===d){b=a.parentNode;d=b.name;if(!a.href||!d||b.nodeName.toLowerCase()!=="map")return false;a=c("img[usemap=#"+d+"]")[0];return!!a&&l(a)}return(/input|select|textarea|button|object/.test(d)?!a.disabled:"a"==d?a.href||b:b)&&l(a)}function l(a){return!c(a).parents().andSelf().filter(function(){return c.curCSS(this,"visibility")==="hidden"||c.expr.filters.hidden(this)}).length}c.ui=c.ui||{};if(!c.ui.version){c.extend(c.ui,{version:"1.8.14",
keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}});c.fn.extend({_focus:c.fn.focus,focus:function(a,b){return typeof a==="number"?this.each(function(){var d=this;setTimeout(function(){c(d).focus();
b&&b.call(d)},a)}):this._focus.apply(this,arguments)},scrollParent:function(){var a;a=c.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(c.curCSS(this,"position",1))&&/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,
"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0);return/fixed/.test(this.css("position"))||!a.length?c(document):a},zIndex:function(a){if(a!==j)return this.css("zIndex",a);if(this.length){a=c(this[0]);for(var b;a.length&&a[0]!==document;){b=a.css("position");if(b==="absolute"||b==="relative"||b==="fixed"){b=parseInt(a.css("zIndex"),10);if(!isNaN(b)&&b!==0)return b}a=a.parent()}}return 0},disableSelection:function(){return this.bind((c.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",
function(a){a.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}});c.each(["Width","Height"],function(a,b){function d(f,g,m,n){c.each(e,function(){g-=parseFloat(c.curCSS(f,"padding"+this,true))||0;if(m)g-=parseFloat(c.curCSS(f,"border"+this+"Width",true))||0;if(n)g-=parseFloat(c.curCSS(f,"margin"+this,true))||0});return g}var e=b==="Width"?["Left","Right"]:["Top","Bottom"],h=b.toLowerCase(),i={innerWidth:c.fn.innerWidth,innerHeight:c.fn.innerHeight,outerWidth:c.fn.outerWidth,
outerHeight:c.fn.outerHeight};c.fn["inner"+b]=function(f){if(f===j)return i["inner"+b].call(this);return this.each(function(){c(this).css(h,d(this,f)+"px")})};c.fn["outer"+b]=function(f,g){if(typeof f!=="number")return i["outer"+b].call(this,f);return this.each(function(){c(this).css(h,d(this,f,true,g)+"px")})}});c.extend(c.expr[":"],{data:function(a,b,d){return!!c.data(a,d[3])},focusable:function(a){return k(a,!isNaN(c.attr(a,"tabindex")))},tabbable:function(a){var b=c.attr(a,"tabindex"),d=isNaN(b);
return(d||b>=0)&&k(a,!d)}});c(function(){var a=document.body,b=a.appendChild(b=document.createElement("div"));c.extend(b.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0});c.support.minHeight=b.offsetHeight===100;c.support.selectstart="onselectstart"in b;a.removeChild(b).style.display="none"});c.extend(c.ui,{plugin:{add:function(a,b,d){a=c.ui[a].prototype;for(var e in d){a.plugins[e]=a.plugins[e]||[];a.plugins[e].push([b,d[e]])}},call:function(a,b,d){if((b=a.plugins[b])&&a.element[0].parentNode)for(var e=
0;e<b.length;e++)a.options[b[e][0]]&&b[e][1].apply(a.element,d)}},contains:function(a,b){return document.compareDocumentPosition?a.compareDocumentPosition(b)&16:a!==b&&a.contains(b)},hasScroll:function(a,b){if(c(a).css("overflow")==="hidden")return false;b=b&&b==="left"?"scrollLeft":"scrollTop";var d=false;if(a[b]>0)return true;a[b]=1;d=a[b]>0;a[b]=0;return d},isOverAxis:function(a,b,d){return a>b&&a<b+d},isOver:function(a,b,d,e,h,i){return c.ui.isOverAxis(a,d,h)&&c.ui.isOverAxis(b,e,i)}})}})(jQuery);

/** < /scripts-v66/lib/jplugins/ui-1.8.14/jquery.ui.core.min.js **/
/** > /scripts-v66/lib/jplugins/ui-1.8.14/jquery.ui.widget.min.js **/
/*!
 * jQuery UI Widget 1.8.14
 *
 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Widget
 */
(function(b,j){if(b.cleanData){var k=b.cleanData;b.cleanData=function(a){for(var c=0,d;(d=a[c])!=null;c++)b(d).triggerHandler("remove");k(a)}}else{var l=b.fn.remove;b.fn.remove=function(a,c){return this.each(function(){if(!c)if(!a||b.filter(a,[this]).length)b("*",this).add([this]).each(function(){b(this).triggerHandler("remove")});return l.call(b(this),a,c)})}}b.widget=function(a,c,d){var e=a.split(".")[0],f;a=a.split(".")[1];f=e+"-"+a;if(!d){d=c;c=b.Widget}b.expr[":"][f]=function(h){return!!b.data(h,
a)};b[e]=b[e]||{};b[e][a]=function(h,g){arguments.length&&this._createWidget(h,g)};c=new c;c.options=b.extend(true,{},c.options);b[e][a].prototype=b.extend(true,c,{namespace:e,widgetName:a,widgetEventPrefix:b[e][a].prototype.widgetEventPrefix||a,widgetBaseClass:f},d);b.widget.bridge(a,b[e][a])};b.widget.bridge=function(a,c){b.fn[a]=function(d){var e=typeof d==="string",f=Array.prototype.slice.call(arguments,1),h=this;d=!e&&f.length?b.extend.apply(null,[true,d].concat(f)):d;if(e&&d.charAt(0)==="_")return h;
e?this.each(function(){var g=b.data(this,a),i=g&&b.isFunction(g[d])?g[d].apply(g,f):g;if(i!==g&&i!==j){h=i;return false}}):this.each(function(){var g=b.data(this,a);g?g.option(d||{})._init():b.data(this,a,new c(d,this))});return h}};b.Widget=function(a,c){arguments.length&&this._createWidget(a,c)};b.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:false},_createWidget:function(a,c){b.data(c,this.widgetName,this);this.element=b(c);this.options=b.extend(true,{},this.options,
this._getCreateOptions(),a);var d=this;this.element.bind("remove."+this.widgetName,function(){d.destroy()});this._create();this._trigger("create");this._init()},_getCreateOptions:function(){return b.metadata&&b.metadata.get(this.element[0])[this.widgetName]},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName);this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+"-disabled ui-state-disabled")},
widget:function(){return this.element},option:function(a,c){var d=a;if(arguments.length===0)return b.extend({},this.options);if(typeof a==="string"){if(c===j)return this.options[a];d={};d[a]=c}this._setOptions(d);return this},_setOptions:function(a){var c=this;b.each(a,function(d,e){c._setOption(d,e)});return this},_setOption:function(a,c){this.options[a]=c;if(a==="disabled")this.widget()[c?"addClass":"removeClass"](this.widgetBaseClass+"-disabled ui-state-disabled").attr("aria-disabled",c);return this},
enable:function(){return this._setOption("disabled",false)},disable:function(){return this._setOption("disabled",true)},_trigger:function(a,c,d){var e=this.options[a];c=b.Event(c);c.type=(a===this.widgetEventPrefix?a:this.widgetEventPrefix+a).toLowerCase();d=d||{};if(c.originalEvent){a=b.event.props.length;for(var f;a;){f=b.event.props[--a];c[f]=c.originalEvent[f]}}this.element.trigger(c,d);return!(b.isFunction(e)&&e.call(this.element[0],c,d)===false||c.isDefaultPrevented())}}})(jQuery);

/** > /scripts-v66/lib/jplugins/ui-1.8.14/jquery.ui.widget.min.js **/
/** > /scripts-v66/lib/jplugins/ui-1.8.14/jquery.ui.datepicker.min.js **/
/*
 * jQuery UI Datepicker 1.8.14
 *
 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Datepicker
 *
 * Depends:
 *	jquery.ui.core.js
 */
(function(d,C){function M(){this.debug=false;this._curInst=null;this._keyEvent=false;this._disabledInputs=[];this._inDialog=this._datepickerShowing=false;this._mainDivId="ui-datepicker-div";this._inlineClass="ui-datepicker-inline";this._appendClass="ui-datepicker-append";this._triggerClass="ui-datepicker-trigger";this._dialogClass="ui-datepicker-dialog";this._disableClass="ui-datepicker-disabled";this._unselectableClass="ui-datepicker-unselectable";this._currentClass="ui-datepicker-current-day";this._dayOverClass=
"ui-datepicker-days-cell-over";this.regional=[];this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su",
"Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:false,showMonthAfterYear:false,yearSuffix:""};this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:false,hideIfNoPrevNext:false,navigationAsDateFormat:false,gotoCurrent:false,changeMonth:false,changeYear:false,yearRange:"c-10:c+10",showOtherMonths:false,selectOtherMonths:false,showWeek:false,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",
minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:true,showButtonPanel:false,autoSize:false};d.extend(this._defaults,this.regional[""]);this.dpDiv=N(d('<div id="'+this._mainDivId+'" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>'))}function N(a){return a.bind("mouseout",function(b){b=
d(b.target).closest("button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a");b.length&&b.removeClass("ui-state-hover ui-datepicker-prev-hover ui-datepicker-next-hover")}).bind("mouseover",function(b){b=d(b.target).closest("button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a");if(!(d.datepicker._isDisabledDatepicker(J.inline?a.parent()[0]:J.input[0])||!b.length)){b.parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover");b.addClass("ui-state-hover");
b.hasClass("ui-datepicker-prev")&&b.addClass("ui-datepicker-prev-hover");b.hasClass("ui-datepicker-next")&&b.addClass("ui-datepicker-next-hover")}})}function H(a,b){d.extend(a,b);for(var c in b)if(b[c]==null||b[c]==C)a[c]=b[c];return a}d.extend(d.ui,{datepicker:{version:"1.8.14"}});var A=(new Date).getTime(),J;d.extend(M.prototype,{markerClassName:"hasDatepicker",maxRows:4,log:function(){this.debug&&console.log.apply("",arguments)},_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(a){H(this._defaults,
a||{});return this},_attachDatepicker:function(a,b){var c=null;for(var e in this._defaults){var f=a.getAttribute("date:"+e);if(f){c=c||{};try{c[e]=eval(f)}catch(h){c[e]=f}}}e=a.nodeName.toLowerCase();f=e=="div"||e=="span";if(!a.id){this.uuid+=1;a.id="dp"+this.uuid}var i=this._newInst(d(a),f);i.settings=d.extend({},b||{},c||{});if(e=="input")this._connectDatepicker(a,i);else f&&this._inlineDatepicker(a,i)},_newInst:function(a,b){return{id:a[0].id.replace(/([^A-Za-z0-9_-])/g,"\\\\$1"),input:a,selectedDay:0,
selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:b,dpDiv:!b?this.dpDiv:N(d('<div class="'+this._inlineClass+' ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>'))}},_connectDatepicker:function(a,b){var c=d(a);b.append=d([]);b.trigger=d([]);if(!c.hasClass(this.markerClassName)){this._attachments(c,b);c.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp).bind("setData.datepicker",function(e,f,h){b.settings[f]=
h}).bind("getData.datepicker",function(e,f){return this._get(b,f)});this._autoSize(b);d.data(a,"datepicker",b)}},_attachments:function(a,b){var c=this._get(b,"appendText"),e=this._get(b,"isRTL");b.append&&b.append.remove();if(c){b.append=d('<span class="'+this._appendClass+'">'+c+"</span>");a[e?"before":"after"](b.append)}a.unbind("focus",this._showDatepicker);b.trigger&&b.trigger.remove();c=this._get(b,"showOn");if(c=="focus"||c=="both")a.focus(this._showDatepicker);if(c=="button"||c=="both"){c=
this._get(b,"buttonText");var f=this._get(b,"buttonImage");b.trigger=d(this._get(b,"buttonImageOnly")?d("<img/>").addClass(this._triggerClass).attr({src:f,alt:c,title:c}):d('<button type="button"></button>').addClass(this._triggerClass).html(f==""?c:d("<img/>").attr({src:f,alt:c,title:c})));a[e?"before":"after"](b.trigger);b.trigger.click(function(){d.datepicker._datepickerShowing&&d.datepicker._lastInput==a[0]?d.datepicker._hideDatepicker():d.datepicker._showDatepicker(a[0]);return false})}},_autoSize:function(a){if(this._get(a,
"autoSize")&&!a.inline){var b=new Date(2009,11,20),c=this._get(a,"dateFormat");if(c.match(/[DM]/)){var e=function(f){for(var h=0,i=0,g=0;g<f.length;g++)if(f[g].length>h){h=f[g].length;i=g}return i};b.setMonth(e(this._get(a,c.match(/MM/)?"monthNames":"monthNamesShort")));b.setDate(e(this._get(a,c.match(/DD/)?"dayNames":"dayNamesShort"))+20-b.getDay())}a.input.attr("size",this._formatDate(a,b).length)}},_inlineDatepicker:function(a,b){var c=d(a);if(!c.hasClass(this.markerClassName)){c.addClass(this.markerClassName).append(b.dpDiv).bind("setData.datepicker",
function(e,f,h){b.settings[f]=h}).bind("getData.datepicker",function(e,f){return this._get(b,f)});d.data(a,"datepicker",b);this._setDate(b,this._getDefaultDate(b),true);this._updateDatepicker(b);this._updateAlternate(b);b.dpDiv.show()}},_dialogDatepicker:function(a,b,c,e,f){a=this._dialogInst;if(!a){this.uuid+=1;this._dialogInput=d('<input type="text" id="'+("dp"+this.uuid)+'" style="position: absolute; top: -100px; width: 0px; z-index: -10;"/>');this._dialogInput.keydown(this._doKeyDown);d("body").append(this._dialogInput);
a=this._dialogInst=this._newInst(this._dialogInput,false);a.settings={};d.data(this._dialogInput[0],"datepicker",a)}H(a.settings,e||{});b=b&&b.constructor==Date?this._formatDate(a,b):b;this._dialogInput.val(b);this._pos=f?f.length?f:[f.pageX,f.pageY]:null;if(!this._pos)this._pos=[document.documentElement.clientWidth/2-100+(document.documentElement.scrollLeft||document.body.scrollLeft),document.documentElement.clientHeight/2-150+(document.documentElement.scrollTop||document.body.scrollTop)];this._dialogInput.css("left",
this._pos[0]+20+"px").css("top",this._pos[1]+"px");a.settings.onSelect=c;this._inDialog=true;this.dpDiv.addClass(this._dialogClass);this._showDatepicker(this._dialogInput[0]);d.blockUI&&d.blockUI(this.dpDiv);d.data(this._dialogInput[0],"datepicker",a);return this},_destroyDatepicker:function(a){var b=d(a),c=d.data(a,"datepicker");if(b.hasClass(this.markerClassName)){var e=a.nodeName.toLowerCase();d.removeData(a,"datepicker");if(e=="input"){c.append.remove();c.trigger.remove();b.removeClass(this.markerClassName).unbind("focus",
this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp)}else if(e=="div"||e=="span")b.removeClass(this.markerClassName).empty()}},_enableDatepicker:function(a){var b=d(a),c=d.data(a,"datepicker");if(b.hasClass(this.markerClassName)){var e=a.nodeName.toLowerCase();if(e=="input"){a.disabled=false;c.trigger.filter("button").each(function(){this.disabled=false}).end().filter("img").css({opacity:"1.0",cursor:""})}else if(e=="div"||e=="span"){b=
b.children("."+this._inlineClass);b.children().removeClass("ui-state-disabled");b.find("select.ui-datepicker-month, select.ui-datepicker-year").removeAttr("disabled")}this._disabledInputs=d.map(this._disabledInputs,function(f){return f==a?null:f})}},_disableDatepicker:function(a){var b=d(a),c=d.data(a,"datepicker");if(b.hasClass(this.markerClassName)){var e=a.nodeName.toLowerCase();if(e=="input"){a.disabled=true;c.trigger.filter("button").each(function(){this.disabled=true}).end().filter("img").css({opacity:"0.5",
cursor:"default"})}else if(e=="div"||e=="span"){b=b.children("."+this._inlineClass);b.children().addClass("ui-state-disabled");b.find("select.ui-datepicker-month, select.ui-datepicker-year").attr("disabled","disabled")}this._disabledInputs=d.map(this._disabledInputs,function(f){return f==a?null:f});this._disabledInputs[this._disabledInputs.length]=a}},_isDisabledDatepicker:function(a){if(!a)return false;for(var b=0;b<this._disabledInputs.length;b++)if(this._disabledInputs[b]==a)return true;return false},
_getInst:function(a){try{return d.data(a,"datepicker")}catch(b){throw"Missing instance data for this datepicker";}},_optionDatepicker:function(a,b,c){var e=this._getInst(a);if(arguments.length==2&&typeof b=="string")return b=="defaults"?d.extend({},d.datepicker._defaults):e?b=="all"?d.extend({},e.settings):this._get(e,b):null;var f=b||{};if(typeof b=="string"){f={};f[b]=c}if(e){this._curInst==e&&this._hideDatepicker();var h=this._getDateDatepicker(a,true),i=this._getMinMaxDate(e,"min"),g=this._getMinMaxDate(e,
"max");H(e.settings,f);if(i!==null&&f.dateFormat!==C&&f.minDate===C)e.settings.minDate=this._formatDate(e,i);if(g!==null&&f.dateFormat!==C&&f.maxDate===C)e.settings.maxDate=this._formatDate(e,g);this._attachments(d(a),e);this._autoSize(e);this._setDate(e,h);this._updateAlternate(e);this._updateDatepicker(e)}},_changeDatepicker:function(a,b,c){this._optionDatepicker(a,b,c)},_refreshDatepicker:function(a){(a=this._getInst(a))&&this._updateDatepicker(a)},_setDateDatepicker:function(a,b){if(a=this._getInst(a)){this._setDate(a,
b);this._updateDatepicker(a);this._updateAlternate(a)}},_getDateDatepicker:function(a,b){(a=this._getInst(a))&&!a.inline&&this._setDateFromField(a,b);return a?this._getDate(a):null},_doKeyDown:function(a){var b=d.datepicker._getInst(a.target),c=true,e=b.dpDiv.is(".ui-datepicker-rtl");b._keyEvent=true;if(d.datepicker._datepickerShowing)switch(a.keyCode){case 9:d.datepicker._hideDatepicker();c=false;break;case 13:c=d("td."+d.datepicker._dayOverClass+":not(."+d.datepicker._currentClass+")",b.dpDiv);
c[0]?d.datepicker._selectDay(a.target,b.selectedMonth,b.selectedYear,c[0]):d.datepicker._hideDatepicker();return false;case 27:d.datepicker._hideDatepicker();break;case 33:d.datepicker._adjustDate(a.target,a.ctrlKey?-d.datepicker._get(b,"stepBigMonths"):-d.datepicker._get(b,"stepMonths"),"M");break;case 34:d.datepicker._adjustDate(a.target,a.ctrlKey?+d.datepicker._get(b,"stepBigMonths"):+d.datepicker._get(b,"stepMonths"),"M");break;case 35:if(a.ctrlKey||a.metaKey)d.datepicker._clearDate(a.target);
c=a.ctrlKey||a.metaKey;break;case 36:if(a.ctrlKey||a.metaKey)d.datepicker._gotoToday(a.target);c=a.ctrlKey||a.metaKey;break;case 37:if(a.ctrlKey||a.metaKey)d.datepicker._adjustDate(a.target,e?+1:-1,"D");c=a.ctrlKey||a.metaKey;if(a.originalEvent.altKey)d.datepicker._adjustDate(a.target,a.ctrlKey?-d.datepicker._get(b,"stepBigMonths"):-d.datepicker._get(b,"stepMonths"),"M");break;case 38:if(a.ctrlKey||a.metaKey)d.datepicker._adjustDate(a.target,-7,"D");c=a.ctrlKey||a.metaKey;break;case 39:if(a.ctrlKey||
a.metaKey)d.datepicker._adjustDate(a.target,e?-1:+1,"D");c=a.ctrlKey||a.metaKey;if(a.originalEvent.altKey)d.datepicker._adjustDate(a.target,a.ctrlKey?+d.datepicker._get(b,"stepBigMonths"):+d.datepicker._get(b,"stepMonths"),"M");break;case 40:if(a.ctrlKey||a.metaKey)d.datepicker._adjustDate(a.target,+7,"D");c=a.ctrlKey||a.metaKey;break;default:c=false}else if(a.keyCode==36&&a.ctrlKey)d.datepicker._showDatepicker(this);else c=false;if(c){a.preventDefault();a.stopPropagation()}},_doKeyPress:function(a){var b=
d.datepicker._getInst(a.target);if(d.datepicker._get(b,"constrainInput")){b=d.datepicker._possibleChars(d.datepicker._get(b,"dateFormat"));var c=String.fromCharCode(a.charCode==C?a.keyCode:a.charCode);return a.ctrlKey||a.metaKey||c<" "||!b||b.indexOf(c)>-1}},_doKeyUp:function(a){a=d.datepicker._getInst(a.target);if(a.input.val()!=a.lastVal)try{if(d.datepicker.parseDate(d.datepicker._get(a,"dateFormat"),a.input?a.input.val():null,d.datepicker._getFormatConfig(a))){d.datepicker._setDateFromField(a);
d.datepicker._updateAlternate(a);d.datepicker._updateDatepicker(a)}}catch(b){d.datepicker.log(b)}return true},_showDatepicker:function(a){a=a.target||a;if(a.nodeName.toLowerCase()!="input")a=d("input",a.parentNode)[0];if(!(d.datepicker._isDisabledDatepicker(a)||d.datepicker._lastInput==a)){var b=d.datepicker._getInst(a);if(d.datepicker._curInst&&d.datepicker._curInst!=b){d.datepicker._datepickerShowing&&d.datepicker._triggerOnClose(d.datepicker._curInst);d.datepicker._curInst.dpDiv.stop(true,true)}var c=
d.datepicker._get(b,"beforeShow");H(b.settings,c?c.apply(a,[a,b]):{});b.lastVal=null;d.datepicker._lastInput=a;d.datepicker._setDateFromField(b);if(d.datepicker._inDialog)a.value="";if(!d.datepicker._pos){d.datepicker._pos=d.datepicker._findPos(a);d.datepicker._pos[1]+=a.offsetHeight}var e=false;d(a).parents().each(function(){e|=d(this).css("position")=="fixed";return!e});if(e&&d.browser.opera){d.datepicker._pos[0]-=document.documentElement.scrollLeft;d.datepicker._pos[1]-=document.documentElement.scrollTop}c=
{left:d.datepicker._pos[0],top:d.datepicker._pos[1]};d.datepicker._pos=null;b.dpDiv.empty();b.dpDiv.css({position:"absolute",display:"block",top:"-1000px"});d.datepicker._updateDatepicker(b);c=d.datepicker._checkOffset(b,c,e);b.dpDiv.css({position:d.datepicker._inDialog&&d.blockUI?"static":e?"fixed":"absolute",display:"none",left:c.left+"px",top:c.top+"px"});if(!b.inline){c=d.datepicker._get(b,"showAnim");var f=d.datepicker._get(b,"duration"),h=function(){var i=b.dpDiv.find("iframe.ui-datepicker-cover");
if(i.length){var g=d.datepicker._getBorders(b.dpDiv);i.css({left:-g[0],top:-g[1],width:b.dpDiv.outerWidth(),height:b.dpDiv.outerHeight()})}};b.dpDiv.zIndex(d(a).zIndex()+1);d.datepicker._datepickerShowing=true;d.effects&&d.effects[c]?b.dpDiv.show(c,d.datepicker._get(b,"showOptions"),f,h):b.dpDiv[c||"show"](c?f:null,h);if(!c||!f)h();b.input.is(":visible")&&!b.input.is(":disabled")&&b.input.focus();d.datepicker._curInst=b}}},_updateDatepicker:function(a){this.maxRows=4;var b=d.datepicker._getBorders(a.dpDiv);
J=a;a.dpDiv.empty().append(this._generateHTML(a));var c=a.dpDiv.find("iframe.ui-datepicker-cover");c.length&&c.css({left:-b[0],top:-b[1],width:a.dpDiv.outerWidth(),height:a.dpDiv.outerHeight()});a.dpDiv.find("."+this._dayOverClass+" a").mouseover();b=this._getNumberOfMonths(a);c=b[1];a.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width("");c>1&&a.dpDiv.addClass("ui-datepicker-multi-"+c).css("width",17*c+"em");a.dpDiv[(b[0]!=1||b[1]!=1?"add":"remove")+"Class"]("ui-datepicker-multi");
a.dpDiv[(this._get(a,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl");a==d.datepicker._curInst&&d.datepicker._datepickerShowing&&a.input&&a.input.is(":visible")&&!a.input.is(":disabled")&&a.input[0]!=document.activeElement&&a.input.focus();if(a.yearshtml){var e=a.yearshtml;setTimeout(function(){e===a.yearshtml&&a.yearshtml&&a.dpDiv.find("select.ui-datepicker-year:first").replaceWith(a.yearshtml);e=a.yearshtml=null},0)}},_getBorders:function(a){var b=function(c){return{thin:1,medium:2,thick:3}[c]||
c};return[parseFloat(b(a.css("border-left-width"))),parseFloat(b(a.css("border-top-width")))]},_checkOffset:function(a,b,c){var e=a.dpDiv.outerWidth(),f=a.dpDiv.outerHeight(),h=a.input?a.input.outerWidth():0,i=a.input?a.input.outerHeight():0,g=document.documentElement.clientWidth+d(document).scrollLeft(),j=document.documentElement.clientHeight+d(document).scrollTop();b.left-=this._get(a,"isRTL")?e-h:0;b.left-=c&&b.left==a.input.offset().left?d(document).scrollLeft():0;b.top-=c&&b.top==a.input.offset().top+
i?d(document).scrollTop():0;b.left-=Math.min(b.left,b.left+e>g&&g>e?Math.abs(b.left+e-g):0);b.top-=Math.min(b.top,b.top+f>j&&j>f?Math.abs(f+i):0);return b},_findPos:function(a){for(var b=this._get(this._getInst(a),"isRTL");a&&(a.type=="hidden"||a.nodeType!=1||d.expr.filters.hidden(a));)a=a[b?"previousSibling":"nextSibling"];a=d(a).offset();return[a.left,a.top]},_triggerOnClose:function(a){var b=this._get(a,"onClose");if(b)b.apply(a.input?a.input[0]:null,[a.input?a.input.val():"",a])},_hideDatepicker:function(a){var b=
this._curInst;if(!(!b||a&&b!=d.data(a,"datepicker")))if(this._datepickerShowing){a=this._get(b,"showAnim");var c=this._get(b,"duration"),e=function(){d.datepicker._tidyDialog(b);this._curInst=null};d.effects&&d.effects[a]?b.dpDiv.hide(a,d.datepicker._get(b,"showOptions"),c,e):b.dpDiv[a=="slideDown"?"slideUp":a=="fadeIn"?"fadeOut":"hide"](a?c:null,e);a||e();d.datepicker._triggerOnClose(b);this._datepickerShowing=false;this._lastInput=null;if(this._inDialog){this._dialogInput.css({position:"absolute",
left:"0",top:"-100px"});if(d.blockUI){d.unblockUI();d("body").append(this.dpDiv)}}this._inDialog=false}},_tidyDialog:function(a){a.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},_checkExternalClick:function(a){if(d.datepicker._curInst){a=d(a.target);a[0].id!=d.datepicker._mainDivId&&a.parents("#"+d.datepicker._mainDivId).length==0&&!a.hasClass(d.datepicker.markerClassName)&&!a.hasClass(d.datepicker._triggerClass)&&d.datepicker._datepickerShowing&&!(d.datepicker._inDialog&&
d.blockUI)&&d.datepicker._hideDatepicker()}},_adjustDate:function(a,b,c){a=d(a);var e=this._getInst(a[0]);if(!this._isDisabledDatepicker(a[0])){this._adjustInstDate(e,b+(c=="M"?this._get(e,"showCurrentAtPos"):0),c);this._updateDatepicker(e)}},_gotoToday:function(a){a=d(a);var b=this._getInst(a[0]);if(this._get(b,"gotoCurrent")&&b.currentDay){b.selectedDay=b.currentDay;b.drawMonth=b.selectedMonth=b.currentMonth;b.drawYear=b.selectedYear=b.currentYear}else{var c=new Date;b.selectedDay=c.getDate();b.drawMonth=
b.selectedMonth=c.getMonth();b.drawYear=b.selectedYear=c.getFullYear()}this._notifyChange(b);this._adjustDate(a)},_selectMonthYear:function(a,b,c){a=d(a);var e=this._getInst(a[0]);e._selectingMonthYear=false;e["selected"+(c=="M"?"Month":"Year")]=e["draw"+(c=="M"?"Month":"Year")]=parseInt(b.options[b.selectedIndex].value,10);this._notifyChange(e);this._adjustDate(a)},_clickMonthYear:function(a){var b=this._getInst(d(a)[0]);b.input&&b._selectingMonthYear&&setTimeout(function(){b.input.focus()},0);b._selectingMonthYear=
!b._selectingMonthYear},_selectDay:function(a,b,c,e){var f=d(a);if(!(d(e).hasClass(this._unselectableClass)||this._isDisabledDatepicker(f[0]))){f=this._getInst(f[0]);f.selectedDay=f.currentDay=d("a",e).html();f.selectedMonth=f.currentMonth=b;f.selectedYear=f.currentYear=c;this._selectDate(a,this._formatDate(f,f.currentDay,f.currentMonth,f.currentYear))}},_clearDate:function(a){a=d(a);this._getInst(a[0]);this._selectDate(a,"")},_selectDate:function(a,b){a=this._getInst(d(a)[0]);b=b!=null?b:this._formatDate(a);
a.input&&a.input.val(b);this._updateAlternate(a);var c=this._get(a,"onSelect");if(c)c.apply(a.input?a.input[0]:null,[b,a]);else a.input&&a.input.trigger("change");if(a.inline)this._updateDatepicker(a);else{this._hideDatepicker();this._lastInput=a.input[0];typeof a.input[0]!="object"&&a.input.focus();this._lastInput=null}},_updateAlternate:function(a){var b=this._get(a,"altField");if(b){var c=this._get(a,"altFormat")||this._get(a,"dateFormat"),e=this._getDate(a),f=this.formatDate(c,e,this._getFormatConfig(a));
d(b).each(function(){d(this).val(f)})}},noWeekends:function(a){a=a.getDay();return[a>0&&a<6,""]},iso8601Week:function(a){a=new Date(a.getTime());a.setDate(a.getDate()+4-(a.getDay()||7));var b=a.getTime();a.setMonth(0);a.setDate(1);return Math.floor(Math.round((b-a)/864E5)/7)+1},parseDate:function(a,b,c){if(a==null||b==null)throw"Invalid arguments";b=typeof b=="object"?b.toString():b+"";if(b=="")return null;var e=(c?c.shortYearCutoff:null)||this._defaults.shortYearCutoff;e=typeof e!="string"?e:(new Date).getFullYear()%
100+parseInt(e,10);for(var f=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,h=(c?c.dayNames:null)||this._defaults.dayNames,i=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort,g=(c?c.monthNames:null)||this._defaults.monthNames,j=c=-1,l=-1,u=-1,k=false,o=function(p){(p=B+1<a.length&&a.charAt(B+1)==p)&&B++;return p},m=function(p){var D=o(p);p=new RegExp("^\\d{1,"+(p=="@"?14:p=="!"?20:p=="y"&&D?4:p=="o"?3:2)+"}");p=b.substring(q).match(p);if(!p)throw"Missing number at position "+q;q+=
p[0].length;return parseInt(p[0],10)},n=function(p,D,K){p=d.map(o(p)?K:D,function(w,x){return[[x,w]]}).sort(function(w,x){return-(w[1].length-x[1].length)});var E=-1;d.each(p,function(w,x){w=x[1];if(b.substr(q,w.length).toLowerCase()==w.toLowerCase()){E=x[0];q+=w.length;return false}});if(E!=-1)return E+1;else throw"Unknown name at position "+q;},s=function(){if(b.charAt(q)!=a.charAt(B))throw"Unexpected literal at position "+q;q++},q=0,B=0;B<a.length;B++)if(k)if(a.charAt(B)=="'"&&!o("'"))k=false;
else s();else switch(a.charAt(B)){case "d":l=m("d");break;case "D":n("D",f,h);break;case "o":u=m("o");break;case "m":j=m("m");break;case "M":j=n("M",i,g);break;case "y":c=m("y");break;case "@":var v=new Date(m("@"));c=v.getFullYear();j=v.getMonth()+1;l=v.getDate();break;case "!":v=new Date((m("!")-this._ticksTo1970)/1E4);c=v.getFullYear();j=v.getMonth()+1;l=v.getDate();break;case "'":if(o("'"))s();else k=true;break;default:s()}if(q<b.length)throw"Extra/unparsed characters found in date: "+b.substring(q);
if(c==-1)c=(new Date).getFullYear();else if(c<100)c+=(new Date).getFullYear()-(new Date).getFullYear()%100+(c<=e?0:-100);if(u>-1){j=1;l=u;do{e=this._getDaysInMonth(c,j-1);if(l<=e)break;j++;l-=e}while(1)}v=this._daylightSavingAdjust(new Date(c,j-1,l));if(v.getFullYear()!=c||v.getMonth()+1!=j||v.getDate()!=l)throw"Invalid date";return v},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",
TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925))*24*60*60*1E7,formatDate:function(a,b,c){if(!b)return"";var e=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,f=(c?c.dayNames:null)||this._defaults.dayNames,h=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort;c=(c?c.monthNames:null)||this._defaults.monthNames;var i=function(o){(o=k+1<a.length&&a.charAt(k+1)==o)&&k++;return o},g=function(o,m,n){m=""+m;if(i(o))for(;m.length<
n;)m="0"+m;return m},j=function(o,m,n,s){return i(o)?s[m]:n[m]},l="",u=false;if(b)for(var k=0;k<a.length;k++)if(u)if(a.charAt(k)=="'"&&!i("'"))u=false;else l+=a.charAt(k);else switch(a.charAt(k)){case "d":l+=g("d",b.getDate(),2);break;case "D":l+=j("D",b.getDay(),e,f);break;case "o":l+=g("o",Math.round(((new Date(b.getFullYear(),b.getMonth(),b.getDate())).getTime()-(new Date(b.getFullYear(),0,0)).getTime())/864E5),3);break;case "m":l+=g("m",b.getMonth()+1,2);break;case "M":l+=j("M",b.getMonth(),h,
c);break;case "y":l+=i("y")?b.getFullYear():(b.getYear()%100<10?"0":"")+b.getYear()%100;break;case "@":l+=b.getTime();break;case "!":l+=b.getTime()*1E4+this._ticksTo1970;break;case "'":if(i("'"))l+="'";else u=true;break;default:l+=a.charAt(k)}return l},_possibleChars:function(a){for(var b="",c=false,e=function(h){(h=f+1<a.length&&a.charAt(f+1)==h)&&f++;return h},f=0;f<a.length;f++)if(c)if(a.charAt(f)=="'"&&!e("'"))c=false;else b+=a.charAt(f);else switch(a.charAt(f)){case "d":case "m":case "y":case "@":b+=
"0123456789";break;case "D":case "M":return null;case "'":if(e("'"))b+="'";else c=true;break;default:b+=a.charAt(f)}return b},_get:function(a,b){return a.settings[b]!==C?a.settings[b]:this._defaults[b]},_setDateFromField:function(a,b){if(a.input.val()!=a.lastVal){var c=this._get(a,"dateFormat"),e=a.lastVal=a.input?a.input.val():null,f,h;f=h=this._getDefaultDate(a);var i=this._getFormatConfig(a);try{f=this.parseDate(c,e,i)||h}catch(g){this.log(g);e=b?"":e}a.selectedDay=f.getDate();a.drawMonth=a.selectedMonth=
f.getMonth();a.drawYear=a.selectedYear=f.getFullYear();a.currentDay=e?f.getDate():0;a.currentMonth=e?f.getMonth():0;a.currentYear=e?f.getFullYear():0;this._adjustInstDate(a)}},_getDefaultDate:function(a){return this._restrictMinMax(a,this._determineDate(a,this._get(a,"defaultDate"),new Date))},_determineDate:function(a,b,c){var e=function(h){var i=new Date;i.setDate(i.getDate()+h);return i},f=function(h){try{return d.datepicker.parseDate(d.datepicker._get(a,"dateFormat"),h,d.datepicker._getFormatConfig(a))}catch(i){}var g=
(h.toLowerCase().match(/^c/)?d.datepicker._getDate(a):null)||new Date,j=g.getFullYear(),l=g.getMonth();g=g.getDate();for(var u=/([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,k=u.exec(h);k;){switch(k[2]||"d"){case "d":case "D":g+=parseInt(k[1],10);break;case "w":case "W":g+=parseInt(k[1],10)*7;break;case "m":case "M":l+=parseInt(k[1],10);g=Math.min(g,d.datepicker._getDaysInMonth(j,l));break;case "y":case "Y":j+=parseInt(k[1],10);g=Math.min(g,d.datepicker._getDaysInMonth(j,l));break}k=u.exec(h)}return new Date(j,
l,g)};if(b=(b=b==null||b===""?c:typeof b=="string"?f(b):typeof b=="number"?isNaN(b)?c:e(b):new Date(b.getTime()))&&b.toString()=="Invalid Date"?c:b){b.setHours(0);b.setMinutes(0);b.setSeconds(0);b.setMilliseconds(0)}return this._daylightSavingAdjust(b)},_daylightSavingAdjust:function(a){if(!a)return null;a.setHours(a.getHours()>12?a.getHours()+2:0);return a},_setDate:function(a,b,c){var e=!b,f=a.selectedMonth,h=a.selectedYear;b=this._restrictMinMax(a,this._determineDate(a,b,new Date));a.selectedDay=
a.currentDay=b.getDate();a.drawMonth=a.selectedMonth=a.currentMonth=b.getMonth();a.drawYear=a.selectedYear=a.currentYear=b.getFullYear();if((f!=a.selectedMonth||h!=a.selectedYear)&&!c)this._notifyChange(a);this._adjustInstDate(a);if(a.input)a.input.val(e?"":this._formatDate(a))},_getDate:function(a){return!a.currentYear||a.input&&a.input.val()==""?null:this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay))},_generateHTML:function(a){var b=new Date;b=this._daylightSavingAdjust(new Date(b.getFullYear(),
b.getMonth(),b.getDate()));var c=this._get(a,"isRTL"),e=this._get(a,"showButtonPanel"),f=this._get(a,"hideIfNoPrevNext"),h=this._get(a,"navigationAsDateFormat"),i=this._getNumberOfMonths(a),g=this._get(a,"showCurrentAtPos"),j=this._get(a,"stepMonths"),l=i[0]!=1||i[1]!=1,u=this._daylightSavingAdjust(!a.currentDay?new Date(9999,9,9):new Date(a.currentYear,a.currentMonth,a.currentDay)),k=this._getMinMaxDate(a,"min"),o=this._getMinMaxDate(a,"max");g=a.drawMonth-g;var m=a.drawYear;if(g<0){g+=12;m--}if(o){var n=
this._daylightSavingAdjust(new Date(o.getFullYear(),o.getMonth()-i[0]*i[1]+1,o.getDate()));for(n=k&&n<k?k:n;this._daylightSavingAdjust(new Date(m,g,1))>n;){g--;if(g<0){g=11;m--}}}a.drawMonth=g;a.drawYear=m;n=this._get(a,"prevText");n=!h?n:this.formatDate(n,this._daylightSavingAdjust(new Date(m,g-j,1)),this._getFormatConfig(a));n=this._canAdjustMonth(a,-1,m,g)?'<a class="ui-datepicker-prev ui-corner-all" onclick="DP_jQuery_'+A+".datepicker._adjustDate('#"+a.id+"', -"+j+", 'M');\" title=\""+n+'"><span class="ui-icon ui-icon-circle-triangle-'+
(c?"e":"w")+'">'+n+"</span></a>":f?"":'<a class="ui-datepicker-prev ui-corner-all ui-state-disabled" title="'+n+'"><span class="ui-icon ui-icon-circle-triangle-'+(c?"e":"w")+'">'+n+"</span></a>";var s=this._get(a,"nextText");s=!h?s:this.formatDate(s,this._daylightSavingAdjust(new Date(m,g+j,1)),this._getFormatConfig(a));f=this._canAdjustMonth(a,+1,m,g)?'<a class="ui-datepicker-next ui-corner-all" onclick="DP_jQuery_'+A+".datepicker._adjustDate('#"+a.id+"', +"+j+", 'M');\" title=\""+s+'"><span class="ui-icon ui-icon-circle-triangle-'+
(c?"w":"e")+'">'+s+"</span></a>":f?"":'<a class="ui-datepicker-next ui-corner-all ui-state-disabled" title="'+s+'"><span class="ui-icon ui-icon-circle-triangle-'+(c?"w":"e")+'">'+s+"</span></a>";j=this._get(a,"currentText");s=this._get(a,"gotoCurrent")&&a.currentDay?u:b;j=!h?j:this.formatDate(j,s,this._getFormatConfig(a));h=!a.inline?'<button type="button" class="ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all" onclick="DP_jQuery_'+A+'.datepicker._hideDatepicker();">'+this._get(a,
"closeText")+"</button>":"";e=e?'<div class="ui-datepicker-buttonpane ui-widget-content">'+(c?h:"")+(this._isInRange(a,s)?'<button type="button" class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" onclick="DP_jQuery_'+A+".datepicker._gotoToday('#"+a.id+"');\">"+j+"</button>":"")+(c?"":h)+"</div>":"";h=parseInt(this._get(a,"firstDay"),10);h=isNaN(h)?0:h;j=this._get(a,"showWeek");s=this._get(a,"dayNames");this._get(a,"dayNamesShort");var q=this._get(a,"dayNamesMin"),B=
this._get(a,"monthNames"),v=this._get(a,"monthNamesShort"),p=this._get(a,"beforeShowDay"),D=this._get(a,"showOtherMonths"),K=this._get(a,"selectOtherMonths");this._get(a,"calculateWeek");for(var E=this._getDefaultDate(a),w="",x=0;x<i[0];x++){var O="";this.maxRows=4;for(var G=0;G<i[1];G++){var P=this._daylightSavingAdjust(new Date(m,g,a.selectedDay)),t=" ui-corner-all",y="";if(l){y+='<div class="ui-datepicker-group';if(i[1]>1)switch(G){case 0:y+=" ui-datepicker-group-first";t=" ui-corner-"+(c?"right":
"left");break;case i[1]-1:y+=" ui-datepicker-group-last";t=" ui-corner-"+(c?"left":"right");break;default:y+=" ui-datepicker-group-middle";t="";break}y+='">'}y+='<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix'+t+'">'+(/all|left/.test(t)&&x==0?c?f:n:"")+(/all|right/.test(t)&&x==0?c?n:f:"")+this._generateMonthYearHeader(a,g,m,k,o,x>0||G>0,B,v)+'</div><table class="ui-datepicker-calendar"><thead><tr>';var z=j?'<th class="ui-datepicker-week-col">'+this._get(a,"weekHeader")+"</th>":
"";for(t=0;t<7;t++){var r=(t+h)%7;z+="<th"+((t+h+6)%7>=5?' class="ui-datepicker-week-end"':"")+'><span title="'+s[r]+'">'+q[r]+"</span></th>"}y+=z+"</tr></thead><tbody>";z=this._getDaysInMonth(m,g);if(m==a.selectedYear&&g==a.selectedMonth)a.selectedDay=Math.min(a.selectedDay,z);t=(this._getFirstDayOfMonth(m,g)-h+7)%7;z=Math.ceil((t+z)/7);this.maxRows=z=l?this.maxRows>z?this.maxRows:z:z;r=this._daylightSavingAdjust(new Date(m,g,1-t));for(var Q=0;Q<z;Q++){y+="<tr>";var R=!j?"":'<td class="ui-datepicker-week-col">'+
this._get(a,"calculateWeek")(r)+"</td>";for(t=0;t<7;t++){var I=p?p.apply(a.input?a.input[0]:null,[r]):[true,""],F=r.getMonth()!=g,L=F&&!K||!I[0]||k&&r<k||o&&r>o;R+='<td class="'+((t+h+6)%7>=5?" ui-datepicker-week-end":"")+(F?" ui-datepicker-other-month":"")+(r.getTime()==P.getTime()&&g==a.selectedMonth&&a._keyEvent||E.getTime()==r.getTime()&&E.getTime()==P.getTime()?" "+this._dayOverClass:"")+(L?" "+this._unselectableClass+" ui-state-disabled":"")+(F&&!D?"":" "+I[1]+(r.getTime()==u.getTime()?" "+
this._currentClass:"")+(r.getTime()==b.getTime()?" ui-datepicker-today":""))+'"'+((!F||D)&&I[2]?' title="'+I[2]+'"':"")+(L?"":' onclick="DP_jQuery_'+A+".datepicker._selectDay('#"+a.id+"',"+r.getMonth()+","+r.getFullYear()+', this);return false;"')+">"+(F&&!D?"&#xa0;":L?'<span class="ui-state-default">'+r.getDate()+"</span>":'<a class="ui-state-default'+(r.getTime()==b.getTime()?" ui-state-highlight":"")+(r.getTime()==u.getTime()?" ui-state-active":"")+(F?" ui-priority-secondary":"")+'" href="#">'+
r.getDate()+"</a>")+"</td>";r.setDate(r.getDate()+1);r=this._daylightSavingAdjust(r)}y+=R+"</tr>"}g++;if(g>11){g=0;m++}y+="</tbody></table>"+(l?"</div>"+(i[0]>0&&G==i[1]-1?'<div class="ui-datepicker-row-break"></div>':""):"");O+=y}w+=O}w+=e+(d.browser.msie&&parseInt(d.browser.version,10)<7&&!a.inline?'<iframe src="javascript:false;" class="ui-datepicker-cover" frameborder="0"></iframe>':"");a._keyEvent=false;return w},_generateMonthYearHeader:function(a,b,c,e,f,h,i,g){var j=this._get(a,"changeMonth"),
l=this._get(a,"changeYear"),u=this._get(a,"showMonthAfterYear"),k='<div class="ui-datepicker-title">',o="";if(h||!j)o+='<span class="ui-datepicker-month">'+i[b]+"</span>";else{i=e&&e.getFullYear()==c;var m=f&&f.getFullYear()==c;o+='<select class="ui-datepicker-month" onchange="DP_jQuery_'+A+".datepicker._selectMonthYear('#"+a.id+"', this, 'M');\" onclick=\"DP_jQuery_"+A+".datepicker._clickMonthYear('#"+a.id+"');\">";for(var n=0;n<12;n++)if((!i||n>=e.getMonth())&&(!m||n<=f.getMonth()))o+='<option value="'+
n+'"'+(n==b?' selected="selected"':"")+">"+g[n]+"</option>";o+="</select>"}u||(k+=o+(h||!(j&&l)?"&#xa0;":""));if(!a.yearshtml){a.yearshtml="";if(h||!l)k+='<span class="ui-datepicker-year">'+c+"</span>";else{g=this._get(a,"yearRange").split(":");var s=(new Date).getFullYear();i=function(q){q=q.match(/c[+-].*/)?c+parseInt(q.substring(1),10):q.match(/[+-].*/)?s+parseInt(q,10):parseInt(q,10);return isNaN(q)?s:q};b=i(g[0]);g=Math.max(b,i(g[1]||""));b=e?Math.max(b,e.getFullYear()):b;g=f?Math.min(g,f.getFullYear()):
g;for(a.yearshtml+='<select class="ui-datepicker-year" onchange="DP_jQuery_'+A+".datepicker._selectMonthYear('#"+a.id+"', this, 'Y');\" onclick=\"DP_jQuery_"+A+".datepicker._clickMonthYear('#"+a.id+"');\">";b<=g;b++)a.yearshtml+='<option value="'+b+'"'+(b==c?' selected="selected"':"")+">"+b+"</option>";a.yearshtml+="</select>";k+=a.yearshtml;a.yearshtml=null}}k+=this._get(a,"yearSuffix");if(u)k+=(h||!(j&&l)?"&#xa0;":"")+o;k+="</div>";return k},_adjustInstDate:function(a,b,c){var e=a.drawYear+(c==
"Y"?b:0),f=a.drawMonth+(c=="M"?b:0);b=Math.min(a.selectedDay,this._getDaysInMonth(e,f))+(c=="D"?b:0);e=this._restrictMinMax(a,this._daylightSavingAdjust(new Date(e,f,b)));a.selectedDay=e.getDate();a.drawMonth=a.selectedMonth=e.getMonth();a.drawYear=a.selectedYear=e.getFullYear();if(c=="M"||c=="Y")this._notifyChange(a)},_restrictMinMax:function(a,b){var c=this._getMinMaxDate(a,"min");a=this._getMinMaxDate(a,"max");b=c&&b<c?c:b;return b=a&&b>a?a:b},_notifyChange:function(a){var b=this._get(a,"onChangeMonthYear");
if(b)b.apply(a.input?a.input[0]:null,[a.selectedYear,a.selectedMonth+1,a])},_getNumberOfMonths:function(a){a=this._get(a,"numberOfMonths");return a==null?[1,1]:typeof a=="number"?[1,a]:a},_getMinMaxDate:function(a,b){return this._determineDate(a,this._get(a,b+"Date"),null)},_getDaysInMonth:function(a,b){return 32-this._daylightSavingAdjust(new Date(a,b,32)).getDate()},_getFirstDayOfMonth:function(a,b){return(new Date(a,b,1)).getDay()},_canAdjustMonth:function(a,b,c,e){var f=this._getNumberOfMonths(a);
c=this._daylightSavingAdjust(new Date(c,e+(b<0?b:f[0]*f[1]),1));b<0&&c.setDate(this._getDaysInMonth(c.getFullYear(),c.getMonth()));return this._isInRange(a,c)},_isInRange:function(a,b){var c=this._getMinMaxDate(a,"min");a=this._getMinMaxDate(a,"max");return(!c||b.getTime()>=c.getTime())&&(!a||b.getTime()<=a.getTime())},_getFormatConfig:function(a){var b=this._get(a,"shortYearCutoff");b=typeof b!="string"?b:(new Date).getFullYear()%100+parseInt(b,10);return{shortYearCutoff:b,dayNamesShort:this._get(a,
"dayNamesShort"),dayNames:this._get(a,"dayNames"),monthNamesShort:this._get(a,"monthNamesShort"),monthNames:this._get(a,"monthNames")}},_formatDate:function(a,b,c,e){if(!b){a.currentDay=a.selectedDay;a.currentMonth=a.selectedMonth;a.currentYear=a.selectedYear}b=b?typeof b=="object"?b:this._daylightSavingAdjust(new Date(e,c,b)):this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay));return this.formatDate(this._get(a,"dateFormat"),b,this._getFormatConfig(a))}});d.fn.datepicker=
function(a){if(!this.length)return this;if(!d.datepicker.initialized){d(document).mousedown(d.datepicker._checkExternalClick).find("body").append(d.datepicker.dpDiv);d.datepicker.initialized=true}var b=Array.prototype.slice.call(arguments,1);if(typeof a=="string"&&(a=="isDisabled"||a=="getDate"||a=="widget"))return d.datepicker["_"+a+"Datepicker"].apply(d.datepicker,[this[0]].concat(b));if(a=="option"&&arguments.length==2&&typeof arguments[1]=="string")return d.datepicker["_"+a+"Datepicker"].apply(d.datepicker,
[this[0]].concat(b));return this.each(function(){typeof a=="string"?d.datepicker["_"+a+"Datepicker"].apply(d.datepicker,[this].concat(b)):d.datepicker._attachDatepicker(this,a)})};d.datepicker=new M;d.datepicker.initialized=false;d.datepicker.uuid=(new Date).getTime();d.datepicker.version="1.8.14";window["DP_jQuery_"+A]=d})(jQuery);

/** < /scripts-v66/lib/jplugins/ui-1.8.14/jquery.ui.datepicker.min.js **/

/** > /scripts-v66/lib/jplugins/ui-1.8.14/i18n/jquery.ui.datepicker-es.js **/
/* Inicialización en español para la extensión 'UI date picker' para jQuery. */
/* Traducido por Vester (xvester@gmail.com). */
jQuery(function($){
	$.datepicker.regional['es'] = {
		closeText: 'Cerrar',
		prevText: '&#x3c;Ant',
		nextText: 'Sig&#x3e;',
		currentText: 'Hoy',
		monthNames: ['Enero','Febrero','Marzo','Abril','Mayo','Junio',
		'Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre'],
		monthNamesShort: ['Ene','Feb','Mar','Abr','May','Jun',
		'Jul','Ago','Sep','Oct','Nov','Dic'],
		dayNames: ['Domingo','Lunes','Martes','Mi&eacute;rcoles','Jueves','Viernes','S&aacute;bado'],
		dayNamesShort: ['Dom','Lun','Mar','Mi&eacute;','Juv','Vie','S&aacute;b'],
		dayNamesMin: ['Do','Lu','Ma','Mi','Ju','Vi','S&aacute;'],
		weekHeader: 'Sm',
		dateFormat: 'dd/mm/yy',
		firstDay: 1,
		isRTL: false,
		showMonthAfterYear: false,
		yearSuffix: ''};
	$.datepicker.setDefaults($.datepicker.regional['es']);
});
/** < /scripts-v66/lib/jplugins/ui-1.8.14/i18n/jquery.ui.datepicker-es.js **/

/** json local text **/
/** > /scripts-v66/booking/common/i18n/booking-es.js **/
var i18n = {
    calendar: {
        error:"Indique las fechas en formato dd/mm/aaaa o, si lo prefiere, selecciónelas en los calendarios",
        errorDate: "Por favor entra una fecha posterior a la fecha del día de hoy",
        arrivalAlt:"Calendario para la fecha de llegada",
        departureAlt:"Calendario para la fecha de salida",
        dateFormat:"^[0-9]{2}[/]{1}[0-9]{2}[/]{1}[0-9]{4}$",
        closePopin:"Cerrar",
        monthNames: ['Enero','Febrero','Marzo','Abril','Mayo','Junio','Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre'],
        displayDateFormat : "%d/%m/%Y"
    },
    destination: {
        error :"Indica tu destino"
    },
    b2b: {
        error :"Los campos marcados en color rojo son incorrectos u obligatorios",
        errorCal : "Seleccione una fecha de llegada y una fecha de salida"
    },
    maporama: {
        errorCity :"Seleccione una ciudad o un código postal",
        errorCountry :"Seleccione un país"
    },
    access : {
        "APT1" : "Aeropuerto",
        "BUS" : "Autobús",
        "GARE" : "Estación",
        "METR" : "Metro",
        "TRAM" : "Tranvía"
    },
    amenities : {
        free : "Gratis",
        notfree : "de pago"
    },
    tax :{
        since : "a partir de %x",
        from : "de %x a %y",
        cattering : "Impuesto de restauración (si procede) :",
        lodging : "Impuesto de alojamiento :"
    },
    package : {
        fromLabel : 'Desde',
        defaultTexteListing : 'Todos los packages',
        noResults : "Lo sentimos, para los criterios de búsqueda que has elegido  no existen packages  que podamos ofrecerte. ¡Efectúa otra búsqueda por favor!",
        moreInfo  : "Saber +",
        condition: "(*) Precio a partir de. Ofertas sujetas a condiciones y a disponibilidades. Véase las condiciones de venta de la tarifa. ",
        btnEditCriteria: "Modifica tus criterios de búsqueda",
        seeCities : "Ver las %x ciudades"
    },
	freenight : {
		paperNeeded : "Certificado impreso necesario"
	},
    buttons : {
        "more" : "Saber más"
    },
    travel :{
        footerMl : "* Las comisiones indicadas son las vigentes en el momento de hacer la reserva para el tipo de habitación elegido (sin prestaciones extras); pueden hacerse cambios hasta el momento de la estancia."
    }
}
/** < /scripts-v66/booking/common/i18n/booking-es.js **/

/** Calendar js for manage datepiker **/
/** > /scripts-v66/booking/common/calendar.js **/
var Calendar = function(formulaire, nightNb, daysNb,option){ this.initialize(formulaire, nightNb, daysNb,option);}
		
		Calendar.prototype = {
			initialize : function(formulaire, nightNb, daysNb,option){
				this.formulaireId = formulaire;
				this.nightNb = nightNb;
				this.daysNb = daysNb-1;
				this.option = option;
				this.$formulaire = jQuery('#'+formulaire);
				this.$errorMessage = this.$formulaire.find('.tErrorMessage');
				this.$iptDateIn = this.$formulaire.find(".tArrivalDate");
				this.$iptDayIn = this.$formulaire.find('input[name="search.dayIn"]');
				this.$iptMonthIn = this.$formulaire.find('input[name="search.monthIn"]');
				this.$iptYearIn = this.$formulaire.find('input[name="search.yearIn"]');
				
				this.$iptDateOut = this.$formulaire.find(".tDepartureDate");
				this.$iptDayOut = this.$formulaire.find('input[name="search.dayOut"]');
				this.$iptMonthOut = this.$formulaire.find('input[name="search.monthOut"]');
				this.$iptYearOut = this.$formulaire.find('input[name="search.yearOut"]');
				
				this.$NightContent = this.$formulaire.find('.tNights');
				this.$NightTxt = this.$formulaire.find('span.tDuree');
				this.$iptNightNb = this.$formulaire.find('input[name="search.nightNb"]');

				
				this.dateIn = null;
				this.dateOut = null;
				this.test = null;
				this.currentDate = new Date();
				this.currentDate = new Date(this.currentDate.getFullYear(),this.currentDate.getMonth(),this.currentDate.getDate(),12,0,0);
				var maxDateFromCurrent = new Date();
				maxDateFromCurrent.setTime(this.currentDate.getTime() + 3600*24*1000*(this.daysNb-1));
				this.saveDate = new Date();//sauvegarde la date initiale pour le cas d'option dayStart
				this.saveDate = new Date(this.saveDate.getFullYear(),this.saveDate.getMonth(),this.saveDate.getDate(),12,0,0);
				this.startDateOut = new Date();
				this.startDateOut = this.currentDate;
				this.defaultDate = null;
				this.dayOutSup = true;				
				
				if(this.option){//objet de parametres optionnels
					this.option = option;
					/****** clean date if session v6.4****/
					
						this.resetDateIn();
						this.resetDateOut();

					/****** ****/
					if(this.option.pgeCal) {//nombre de mois affich�s
						if (this.option.pgeCal>3) this.option.pgeCal = 3;
						this.nbrMonth = option.pgeCal;
						}
					if(this.option.defaultDate) {//date par defaut
						this.defaultDate = this.option.defaultDate;
					}
					if(this.option.firstArrivalDate) {//date d'initialisation du calendrier
						if(this.option.firstArrivalDate.getTime() > this.currentDate.getTime()){
							this.currentDate = this.option.firstArrivalDate;
							//maxDateFromCurrent.setTime(this.currentDate.getTime() + 3600*24*1000*(this.daysNb));
						}else this.currentDate = new Date(this.currentDate.getFullYear(),this.currentDate.getMonth(),this.currentDate.getDate(),12,0,0);
					}
					
					if(this.option.lastArrivalDate){ //date de fin de promo
						if(this.option.lastArrivalDate.getTime() < maxDateFromCurrent.getTime()){
							maxDateFromCurrent.setTime(this.option.lastArrivalDate.getTime())					
						}
					}
					/*if(this.option.earlyBookingCondition){
						this.currentDate.setTime(this.currentDate.getTime()+3600*24*1000*(this.option.earlyBookingCondition));
						if(this.currentDate.getTime() >= maxDateFromCurrent.getTime()){
							maxDateFromCurrent.setTime(this.currentDate.getTime());
							}
					}*/
						
					if(this.option.minStay){
						this.startDateOut.setTime(this.startDateOut.getTime() + 3600*24*1000*(this.option.minStay)); 
						this.nightNb = this.nightNb - this.option.minStay+1;
						if(!this.option.firstArrivalDate ){
							this.currentDate = new Date();
							this.currentDate = new Date(this.currentDate.getFullYear(),this.currentDate.getMonth(),this.currentDate.getDate(),12,0,0);
						}
					}
					if(this.option.maxStay){
						if (this.option.maxStay>this.nightNb) this.option.maxStay = this.nightNb;
						this.nightNb = this.option.maxStay
					}
					if(this.option.earlyBookingCondition){
						this.currentDate.setTime(this.currentDate.getTime()+3600*24*1000*(this.option.earlyBookingCondition));
						if(this.currentDate.getTime() >= maxDateFromCurrent.getTime()){
							maxDateFromCurrent.setTime(this.currentDate.getTime());
							}
					}
					if(this.option.lastDepartureDate){
						if(this.option.lastDepartureDate.getTime()<maxDateFromCurrent.getTime())
							maxDateFromCurrent.setTime(this.option.lastDepartureDate.getTime()-(3600*24*1000))
						}				
				}
				
							var _this = this;
				//hors promo


				//init arrival field
				this.$iptDateIn.datepicker({
					duration: "fast",
					showOn: 'both', 
					buttonImage: '/imagerie/booking/booking-engine/picto-calendrier.gif',
					buttonImageOnly: true, 
					altField: this,
					numberOfMonths: this.nbrMonth,
					buttonText:i18n.calendar.arrivalAlt,
					minDate: this.currentDate,
					maxDate: maxDateFromCurrent,
					defaultDate: this.defaultDate,
					//launch all control after datepicker close
					onClose: function(stringDate, inst) { _this.$iptDateIn.trigger('closeDateIn'); _this.checkFieldStatus('arrival', inst, stringDate); }
				});
				//init departure field
				this.$iptDateOut.datepicker({
					duration: "fast",
					showOn: 'both', 
					buttonImage: '/imagerie/booking/booking-engine/picto-calendrier.gif',
					buttonImageOnly: true, 
					altField: this,
					numberOfMonths: this.nbrMonth,
					buttonText:i18n.calendar.departureAlt,
					minDate: _this.startDateOut,
					maxDate: maxDateFromCurrent,		
					//launch all control after datepicker close
					onClose: function(stringDate, inst) { _this.$iptDateOut.trigger('closeDateOut'); _this.checkFieldStatus('departure', inst, stringDate); }
				});

				//bind trigger "closeDateIn"
				this.$iptDateIn.bind('closeDateIn',function(){
					var date = 	_this.$iptDateIn.datepicker('getDate');	
					var date2 = null;
					
					if(date!=null){
						date.setHours(12,0,0,0);
							if(_this.option!=null){
								if(_this.option.minStay) {
									date2 = new Date();
									date2.setTime(date.getTime() + 3600*24*1000*(_this.option.minStay-1));
									if(_this.option.maxStay) {
										_this.nightNb = _this.option.maxStay - _this.option.minStay+1 ;
									}
									if(date2.getTime()>=maxDateFromCurrent.getTime()){
										var maxDate = new Date();
										maxDate.setTime(date2.getTime()+ 3600*24*1000*_this.nightNb)
										if(_this.option.maxStay) {
											maxDate.setTime(Math.min(date.getTime()+ (3600*24*1000*_this.option.maxStay),maxDateFromCurrent.getTime()+ (3600*24*1000*_this.option.minStay)));}
										if(_this.option.lastDepartureDate) maxDate.setTime(Math.max(date2.getTime()+ 3600*24*1000, _this.option.lastDepartureDate.getTime()));
										
										_this.$iptDateOut.datepicker('option', 'maxDate', maxDate);

										_this.dayOutSup = false;
									}
									
									var instOut = {
										selectedYear:date2.getFullYear(),
										selectedMonth:date2.getMonth(),
										selectedDay:date2.getDate()
										}
									}
							}
							
						var inst = {
							selectedYear:date.getFullYear(),
							selectedMonth:date.getMonth(),
							selectedDay:date.getDate()
						}	
						
						_this.setArrivalDate(_this.$iptDateIn.val(), inst, instOut);
					}
				});
				
				//bind trigger "closeDateOut"
				this.$iptDateOut.bind('closeDateOut',function(){
					var date = 	_this.$iptDateOut.datepicker('getDate');
					if(date!=null){
						date.setHours(12,0,0,0);
						var inst = {
							selectedYear:date.getFullYear(),
							selectedMonth:date.getMonth(),
							selectedDay:date.getDate()
						}	
						_this.setDepartureDate(_this.$iptDateOut.val(), inst);
					}
				});

				//wrapping for css datepicker
				jQuery('#ui-datepicker-div').wrap('<div class="ui-datepicker-wrapper"></div>');
				
				if(this.$iptDateIn.val() != ""){
					var maxDateOutFromCurrent = new Date();
					maxDateOutFromCurrent.setTime(this.currentDate.getTime() + 3600*24*1000*this.daysNb);
					maxDateOutFromCurrent.setHours(12,0,0,0);
					this.dateIn = new Date(this.$iptYearIn.val(), this.$iptMonthIn.val()-1, this.$iptDayIn.val(), 12, 0, 0);
					// minDateOut = dateIn selectionne + 1
					var minDate = new Date();
					minDate.setTime(this.dateIn.getTime() + 3600*24*1000);
					//maxDateOut = date la plus  proche entre J + maxLeadTime et dateIn selectionne + nbNuit
					var maxDate = new Date();
					maxDate.setTime(Math.min(minDate.getTime() + 3600*24*1000*(this.nightNb-1),maxDateOutFromCurrent));

					this.$iptDateOut.datepicker('option', 'minDate', minDate);
					this.$iptDateOut.datepicker('option', 'maxDate', maxDate);
					
					//bug datepicker, correct hours that are not at 12
					this.currentDate.setHours(12,0,0,0);
				}
				
				if(this.$iptDateOut.val() == ""){
					this.setDisabled(this.$iptDateOut, true);
				}
				else{ 
					this.dateOut = new Date(this.$iptYearOut.val(), this.$iptMonthOut.val()-1, this.$iptDayOut.val(), 12, 0, 0);
					//transform in number of days from today
					var day = Math.round((this.dateOut.getTime() - this.saveDate.getTime())/(3600*24*1000));
					
					this.$iptDateOut.datepicker('setDate', day);
				}
				
				if(this.$iptDateIn.val() != "" && this.$iptDateOut.val() != "") this.writeNumberNight();
			},
			
			//set disabled departure
			setDisabled : function(input, state){
				if(state == true) input.datepicker('disable');
				else if(state == false)input.datepicker('enable');
			},
			
			setArrivalDate : function(stringDate, instance,instanceModif){
				if(instance != null){
					this.$iptDayIn.val(instance.selectedDay);
					this.$iptMonthIn.val(Number(instance.selectedMonth+1));
					this.$iptYearIn.val(instance.selectedYear);
					var tmpDate = new Date(instance.selectedYear, instance.selectedMonth, instance.selectedDay, 12, 0, 0); 
					if(instanceModif){tmpDate = new Date(instanceModif.selectedYear, instanceModif.selectedMonth,instanceModif.selectedDay, 12, 0, 0);}
					if(this.dateIn == null){
						this.dateIn = tmpDate;
						this.updateDateOutOption();
					}
					else{
						if(tmpDate.getTime() != this.dateIn.getTime()){
							this.dateIn = tmpDate;
							this.updateDateOutOption();
						}
					}
				}
			},
			
			setDepartureDate : function(stringDate, instance){
				if(instance != null){
					this.$iptDayOut.val(instance.selectedDay);
					this.$iptMonthOut.val(Number(instance.selectedMonth+1));
					this.$iptYearOut.val(instance.selectedYear);
					this.dateOut = new Date(instance.selectedYear, instance.selectedMonth, instance.selectedDay, 12, 0, 0);
				}
			},
			
			//init config max & min date of departure field
			updateDateOutOption : function(){
				var maxDateOutFromCurrent = new Date();
				maxDateOutFromCurrent.setTime(this.currentDate.getTime() + 3600*24*1000*this.daysNb + parseInt("3600000"));

				if (this.option){
					if(this.option.lastDepartureDate ){maxDateOutFromCurrent.setTime(this.option.lastDepartureDate.getTime());
					}//pour eviter le depassement de dates de promo
					
				}

				// minDateOut = dateIn selectionne + 1
				var minDate = new Date();
				minDate.setTime(this.dateIn.getTime() + 3600*24*1000);
				//maxDateOut = date la plus  proche entre J + maxLeadTime et dateIn selectionne + nbNuit
				var maxDate = new Date();
				maxDate.setTime(Math.min(minDate.getTime() + 3600*24*1000*(this.nightNb-1),maxDateOutFromCurrent));
				
				if(maxDate.getTime() == maxDateOutFromCurrent.getTime() && (this.option && !this.option.minStay)){// corrige le bug 0 nuit � 405 jours
					//maxDate.setTime(maxDate.getTime()+3600*24*1000);
					if(this.option.maxStay ){
						maxDate = new Date();
						maxDate.setTime(Math.min(minDate.getTime()+(3600*24*1000)*(this.option.maxStay),maxDateOutFromCurrent));
						
						if(this.option.lastDepartureDate){
							maxDate.setTime(Math.min(maxDateOutFromCurrent.getTime()+(3600*24*1000)*(this.option.maxStay),this.option.lastDepartureDate));
						}
					}
					this.$iptDateOut.datepicker('option', 'maxDate', maxDate);
					this.dayOutSup = false;
				}

				this.$iptDateOut.datepicker('option', 'minDate', minDate);
				if(this.dayOutSup){// permet le depassement de dateOut pour la duree de la promo
					this.$iptDateOut.datepicker('option', 'maxDate', maxDate);
				};
				
				this.$iptDateOut.datepicker('setDate', minDate);
				this.$iptDateOut.trigger('closeDateOut');	
				this.writeNumberNight();
			},
			
			//check if date is in min & max date frame
			checkDate:function(dateType,instance){

				var thisDate = new Date();
					thisDate = new Date(instance.currentYear, instance.currentMonth, instance.currentDay, 12, 0, 0);
					if(dateType == 'arrival'){
						var maxDayIn = this.$iptDateIn.datepicker('option', 'maxDate');
						
						if(this.currentDate.getTime() > thisDate.getTime() || (maxDayIn+86400000) < thisDate.getTime()){
							return false;	
						}
					} else {
						var maxDayOut = this.$iptDateOut.datepicker('option', 'maxDate');
						var minDayOut = this.$iptDateOut.datepicker('option', 'minDate');
					
						if( minDayOut > thisDate.getTime() || thisDate.getTime() > (maxDayOut.getTime()+86400000)){
							return false;	
						}	
					}
					return true;				 
			},
			
			//check if date if in good local format
			checkFormatDate: function(date){
				var reg = new RegExp(i18n.calendar.dateFormat,"g");
				if (reg.test(date)) {
					var reg = new RegExp("%([dmY])(.)%([dmY]).%([dmY])","g");
					var tabRes = reg.exec(i18n.calendar.displayDateFormat);
					var typePos1 = tabRes[1];
					var typePos2 = tabRes[3];
					var typePos3 = tabRes[4];
					var dateSeparator = tabRes[2];
					
					var tabRes = date.split(dateSeparator);
					var tabDate = new Array();
					tabDate[typePos1] = tabRes[0];
					tabDate[typePos2] = tabRes[1];
					tabDate[typePos3] = tabRes[2];
					
					var today = new Date();
					if (tabDate["d"] >= 1 && tabDate["d"] <= 31 && tabDate["m"] >= 1 && tabDate["m"] <= 12 && tabDate["Y"] >= today.getFullYear() && tabDate["Y"] <= today.getFullYear() + 2) {
						return true;
					}
				}
				return false;					
			},
			
			//check content fields
			checkFieldStatus : function(dateType, instance, stringDate){
				switch(dateType){
								

					case "arrival":					
						if(stringDate == ""){
							this.resetDateIn();
							this.setDisabled(this.$iptDateOut, true);
							this.resetDateOut();
							this.$iptDateIn.parent().removeClass('validatorInvalidState');
							this.eraseNumberNight();
						} else {
							if(!this.checkFormatDate(stringDate)){	

								this.setDisabled(this.$iptDateOut, true);
								this.$iptDateIn.parent().addClass('validatorInvalidState');
								this.$errorMessage.show().text(i18n.calendar.error);
								this.eraseNumberNight();
								
							} else if(!this.checkDate(dateType,instance)){
								this.resetDateIn();
								this.setDisabled(this.$iptDateOut, true);
								this.resetDateOut();
							} else {
								this.$iptDateIn.parent().removeClass('validatorInvalidState');
								this.$iptDateOut.parent().removeClass('validatorInvalidState');
								this.$errorMessage.hide();
								this.setDisabled(this.$iptDateOut, false);}
						}
					break;
					
					case "departure":
						if(stringDate == ""){
							this.resetDateOut();
							this.$iptDateIn.parent().removeClass('validatorInvalidState');
							this.eraseNumberNight();
						} else {
							if(!this.checkFormatDate(stringDate)){
								this.$iptDateOut.parent().addClass('validatorInvalidState');
								this.$errorMessage.show().text(i18n.calendar.error);
								this.eraseNumberNight();
							} else if(!this.checkDate(dateType,instance)){
								this.resetDateOut();
								this.eraseNumberNight();
							} else {
								this.$iptDateOut.parent().removeClass('validatorInvalidState');
								this.$errorMessage.hide();
								this.writeNumberNight();
							}	
						}
					break;	
				}
			},
			
			writeNumberNight:function(){

				var nbN = this.getNbDays(this.dateIn,this.dateOut);
				this.$NightTxt.text(nbN);
				this.$NightContent.removeClass('off');
				this.$iptNightNb.val(nbN);
			},
			
			eraseNumberNight:function(){
				this.$NightTxt.text('');
				this.$NightContent.addClass('off');
				this.$iptNightNb.val('');
			},
			
			//reset arrival date
			resetDateIn : function(){
				this.$iptDateIn.val("");
				this.$iptDayIn.val("");
				this.$iptMonthIn.val("");
				this.$iptYearIn.val("");
				this.dateIn = null;
			},
			
			//reste departure date
			resetDateOut : function(){
				this.$iptDateOut.val("");
				this.$iptDayOut.val("");
				this.$iptMonthOut.val("");
				this.$iptYearOut.val("");
				this.dateOut = null;
			},
			
			//find nb of days between 2 dates
			getNbDays:function(d1,d2){
				
				d1 = new Date(this.$iptYearIn.val(), this.$iptMonthIn.val()-1, this.$iptDayIn.val(), 12, 0, 0);
				this.dayOutSup = true;
				var nb = (d2.getTime() - d1.getTime()) / 86400000;
				return Math.round(nb);				
			}
		}
/** < /scripts-v66/booking/common/calendar.js **/

/** jQuery template **/
/** > /scripts-v66/lib/jplugins/jquery-jtemplates.0.7.8.js **/
/* jTemplates 0.7.8 (http://jtemplates.tpython.com) Copyright (c) 2009 Tomasz Gloc */
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}('a(37.b&&!37.b.38){(9(b){6 m=9(s,A,f){5.1M=[];5.1u={};5.2p=E;5.1N={};5.1c={};5.f=b.1m({1Z:1f,3a:1O,2q:1f,2r:1f,3b:1O,3c:1O},f);5.1v=(5.f.1v!==F)?(5.f.1v):(13.20);5.Y=(5.f.Y!==F)?(5.f.Y):(13.3d);5.3e(s,A);a(s){5.1w(5.1c[\'21\'],A,5.f)}5.1c=E};m.y.2s=\'0.7.8\';m.R=1O;m.y.3e=9(s,A){6 2t=/\\{#14 *(\\w*?)( .*)*\\}/g;6 22,1x,M;6 1y=E;6 2u=[];2v((22=2t.3N(s))!=E){1y=2t.1y;1x=22[1];M=s.2w(\'{#/14 \'+1x+\'}\',1y);a(M==-1){C j Z(\'15: m "\'+1x+\'" 2x 23 3O.\');}5.1c[1x]=s.2y(1y,M);2u[1x]=13.2z(22[2])}a(1y===E){5.1c[\'21\']=s;c}N(6 i 24 5.1c){a(i!=\'21\'){5.1N[i]=j m()}}N(6 i 24 5.1c){a(i!=\'21\'){5.1N[i].1w(5.1c[i],b.1m({},A||{},5.1N||{}),b.1m({},5.f,2u[i]));5.1c[i]=E}}};m.y.1w=9(s,A,f){a(s==F){5.1M.B(j 1g(\'\',1,5));c}s=s.U(/[\\n\\r]/g,\'\');s=s.U(/\\{\\*.*?\\*\\}/g,\'\');5.2p=b.1m({},5.1N||{},A||{});5.f=j 2A(f);6 p=5.1M;6 1P=s.1h(/\\{#.*?\\}/g);6 16=0,M=0;6 e;6 1i=0;6 25=0;N(6 i=0,l=(1P)?(1P.V):(0);i<l;++i){6 17=1P[i];a(1i){M=s.2w(\'{#/1z}\');a(M==-1){C j Z("15: 3P 1Q 3f 1z.");}a(M>16){p.B(j 1g(s.2y(16,M),1,5))}16=M+11;1i=0;i=b.3Q(\'{#/1z}\',1P);1R}M=s.2w(17,16);a(M>16){p.B(j 1g(s.2y(16,M),1i,5))}6 3R=17.1h(/\\{#([\\w\\/]+).*?\\}/);6 26=I.$1;2B(26){q\'3S\':++25;p.27();q\'a\':e=j 1A(17,p);p.B(e);p=e;D;q\'J\':p.27();D;q\'/a\':2v(25){p=p.28();--25}q\'/N\':q\'/29\':p=p.28();D;q\'29\':e=j 1n(17,p,5);p.B(e);p=e;D;q\'N\':e=2a(17,p,5);p.B(e);p=e;D;q\'1R\':q\'D\':p.B(j 18(26));D;q\'2C\':p.B(j 2D(17,5.2p));D;q\'h\':p.B(j 2E(17));D;q\'2F\':p.B(j 2G(17));D;q\'3T\':p.B(j 1g(\'{\',1,5));D;q\'3U\':p.B(j 1g(\'}\',1,5));D;q\'1z\':1i=1;D;q\'/1z\':a(m.R){C j Z("15: 3V 2H 3f 1z.");}D;2I:a(m.R){C j Z(\'15: 3W 3X: \'+26+\'.\');}}16=M+17.V}a(s.V>16){p.B(j 1g(s.3Y(16),1i,5))}};m.y.K=9(d,h,z,H){++H;6 $T=d,2b,2c;a(5.f.3b){$T=5.1v(d,{2d:(5.f.3a&&H==1),1S:5.f.1Z},5.Y)}a(!5.f.3c){2b=5.1u;2c=h}J{2b=5.1v(5.1u,{2d:(5.f.2q),1S:1f},5.Y);2c=5.1v(h,{2d:(5.f.2q&&H==1),1S:1f},5.Y)}6 $P=b.1m({},2b,2c);6 $Q=(z!=F)?(z):({});$Q.2s=5.2s;6 19=\'\';N(6 i=0,l=5.1M.V;i<l;++i){19+=5.1M[i].K($T,$P,$Q,H)}--H;c 19};m.y.2J=9(1T,1o){5.1u[1T]=1o};13=9(){};13.3d=9(3g){c 3g.U(/&/g,\'&3Z;\').U(/>/g,\'&3h;\').U(/</g,\'&3i;\').U(/"/g,\'&40;\').U(/\'/g,\'&#39;\')};13.20=9(d,1B,Y){a(d==E){c d}2B(d.2K){q 2A:6 o={};N(6 i 24 d){o[i]=13.20(d[i],1B,Y)}a(!1B.1S){a(d.41("2L"))o.2L=d.2L}c o;q 42:6 o=[];N(6 i=0,l=d.V;i<l;++i){o[i]=13.20(d[i],1B,Y)}c o;q 2M:c(1B.2d)?(Y(d)):(d);q 43:a(1B.1S){a(m.R)C j Z("15: 44 45 23 46.");J c F}2I:c d}};13.2z=9(2e){a(2e===E||2e===F){c{}}6 o=2e.47(/[= ]/);a(o[0]===\'\'){o.48()}6 2N={};N(6 i=0,l=o.V;i<l;i+=2){2N[o[i]]=o[i+1]}c 2N};6 1g=9(2O,1i,14){5.2f=2O;5.3j=1i;5.1d=14};1g.y.K=9(d,h,z,H){6 2g=5.2f;a(!5.3j){6 2P=5.1d;6 $T=d;6 $P=h;6 $Q=z;2g=2g.U(/\\{(.*?)\\}/g,9(49,3k){1C{6 1D=10(3k);a(1E 1D==\'9\'){a(2P.f.1Z||!2P.f.2r){c\'\'}J{1D=1D($T,$P,$Q)}}c(1D===F)?(""):(2M(1D))}1F(e){a(m.R){a(e 1G 18)e.1j="4a";C e;}c""}})}c 2g};6 1A=9(L,1H){5.2h=1H;L.1h(/\\{#(?:J)*a (.*?)\\}/);5.3l=I.$1;5.1p=[];5.1q=[];5.1I=5.1p};1A.y.B=9(e){5.1I.B(e)};1A.y.28=9(){c 5.2h};1A.y.27=9(){5.1I=5.1q};1A.y.K=9(d,h,z,H){6 $T=d;6 $P=h;6 $Q=z;6 19=\'\';1C{6 2Q=(10(5.3l))?(5.1p):(5.1q);N(6 i=0,l=2Q.V;i<l;++i){19+=2Q[i].K(d,h,z,H)}}1F(e){a(m.R||(e 1G 18))C e;}c 19};2a=9(L,1H,14){a(L.1h(/\\{#N (\\w+?) *= *(\\S+?) +4b +(\\S+?) *(?:12=(\\S+?))*\\}/)){L=\'{#29 2a.3m 3n \'+I.$1+\' 2H=\'+(I.$2||0)+\' 1Q=\'+(I.$3||-1)+\' 12=\'+(I.$4||1)+\' u=$T}\';c j 1n(L,1H,14)}J{C j Z(\'15: 4c 4d "3o": \'+L);}};2a.3m=9(i){c i};6 1n=9(L,1H,14){5.2h=1H;5.1d=14;L.1h(/\\{#29 (.+?) 3n (\\w+?)( .+)*\\}/);5.3p=I.$1;5.x=I.$2;5.W=I.$3||E;5.W=13.2z(5.W);5.1p=[];5.1q=[];5.1I=5.1p};1n.y.B=9(e){5.1I.B(e)};1n.y.28=9(){c 5.2h};1n.y.27=9(){5.1I=5.1q};1n.y.K=9(d,h,z,H){1C{6 $T=d;6 $P=h;6 $Q=z;6 1r=10(5.3p);6 1U=[];6 1J=1E 1r;a(1J==\'3q\'){6 2R=[];b.1e(1r,9(k,v){1U.B(k);2R.B(v)});1r=2R}6 u=(5.W.u!==F)?(10(5.W.u)):(($T!=E)?($T):({}));6 s=1V(10(5.W.2H)||0),e;6 12=1V(10(5.W.12)||1);a(1J!=\'9\'){e=1r.V}J{a(5.W.1Q===F||5.W.1Q===E){e=1V.4e}J{e=1V(10(5.W.1Q))+((12>0)?(1):(-1))}}6 19=\'\';6 i,l;a(5.W.1W){6 2S=s+1V(10(5.W.1W));e=(2S>e)?(e):(2S)}a((e>s&&12>0)||(e<s&&12<0)){6 1K=0;6 3r=(1J!=\'9\')?(4f.4g((e-s)/12)):F;6 1s,1k;N(;((12>0)?(s<e):(s>e));s+=12,++1K){1s=1U[s];a(1J!=\'9\'){1k=1r[s]}J{1k=1r(s);a(1k===F||1k===E){D}}a((1E 1k==\'9\')&&(5.1d.f.1Z||!5.1d.f.2r)){1R}a((1J==\'3q\')&&(1s 24 2A)){1R}6 3s=u[5.x];u[5.x]=1k;u[5.x+\'$3t\']=s;u[5.x+\'$1K\']=1K;u[5.x+\'$3u\']=(1K==0);u[5.x+\'$3v\']=(s+12>=e);u[5.x+\'$3w\']=3r;u[5.x+\'$1U\']=(1s!==F&&1s.2K==2M)?(5.1d.Y(1s)):(1s);u[5.x+\'$1E\']=1E 1k;N(i=0,l=5.1p.V;i<l;++i){1C{19+=5.1p[i].K(u,h,z,H)}1F(2T){a(2T 1G 18){2B(2T.1j){q\'1R\':i=l;D;q\'D\':i=l;s=e;D;2I:C e;}}J{C e;}}}1l u[5.x+\'$3t\'];1l u[5.x+\'$1K\'];1l u[5.x+\'$3u\'];1l u[5.x+\'$3v\'];1l u[5.x+\'$3w\'];1l u[5.x+\'$1U\'];1l u[5.x+\'$1E\'];1l u[5.x];u[5.x]=3s}}J{N(i=0,l=5.1q.V;i<l;++i){19+=5.1q[i].K($T,h,z,H)}}c 19}1F(e){a(m.R||(e 1G 18))C e;c""}};6 18=9(1j){5.1j=1j};18.y=Z;18.y.K=9(d){C 5;};6 2D=9(L,A){L.1h(/\\{#2C (.*?)(?: 4h=(.*?))?\\}/);5.1d=A[I.$1];a(5.1d==F){a(m.R)C j Z(\'15: 4i 3o 2C: \'+I.$1);}5.3x=I.$2};2D.y.K=9(d,h,z,H){6 $T=d;6 $P=h;1C{c 5.1d.K(10(5.3x),h,z,H)}1F(e){a(m.R||(e 1G 18))C e;}c\'\'};6 2E=9(L){L.1h(/\\{#h 1T=(\\w*?) 1o=(.*?)\\}/);5.x=I.$1;5.2f=I.$2};2E.y.K=9(d,h,z,H){6 $T=d;6 $P=h;6 $Q=z;1C{h[5.x]=10(5.2f)}1F(e){a(m.R||(e 1G 18))C e;h[5.x]=F}c\'\'};6 2G=9(L){L.1h(/\\{#2F 4j=(.*?)\\}/);5.2U=10(I.$1);5.2V=5.2U.V;a(5.2V<=0){C j Z(\'15: 2F 4k 4l 4m\');}5.2W=0;5.2X=-1};2G.y.K=9(d,h,z,H){6 2Y=b.O(z,\'1X\');a(2Y!=5.2X){5.2X=2Y;5.2W=0}6 i=5.2W++%5.2V;c 5.2U[i]};b.1a.1w=9(s,A,f){a(s.2K===m){c b(5).1e(9(){b.O(5,\'2i\',s);b.O(5,\'1X\',0)})}J{c b(5).1e(9(){b.O(5,\'2i\',j m(s,A,f));b.O(5,\'1X\',0)})}};b.1a.4n=9(1L,A,f){6 s=b.2Z({1t:1L,1Y:1f}).3y;c b(5).1w(s,A,f)};b.1a.4o=9(30,A,f){6 s=b(\'#\'+30).2O();a(s==E){s=b(\'#\'+30).3z();s=s.U(/&3i;/g,"<").U(/&3h;/g,">")}s=b.4p(s);s=s.U(/^<\\!\\[4q\\[([\\s\\S]*)\\]\\]>$/3A,\'$1\');s=s.U(/^<\\!--([\\s\\S]*)-->$/3A,\'$1\');c b(5).1w(s,A,f)};b.1a.4r=9(){6 1W=0;b(5).1e(9(){a(b.2j(5)){++1W}});c 1W};b.1a.4s=9(){b(5).3B();c b(5).1e(9(){b.3C(5,\'2i\')})};b.1a.2J=9(1T,1o){c b(5).1e(9(){6 t=b.2j(5);a(t===F){a(m.R)C j Z(\'15: m 2x 23 3D.\');J c}t.2J(1T,1o)})};b.1a.31=9(d,h){c b(5).1e(9(){6 t=b.2j(5);a(t===F){a(m.R)C j Z(\'15: m 2x 23 3D.\');J c}b.O(5,\'1X\',b.O(5,\'1X\')+1);b(5).3z(t.K(d,h,5,0))})};b.1a.4t=9(1L,h,G){6 X=5;G=b.1m({1j:\'4u\',1Y:1O,32:1f},G);b.2Z({1t:1L,1j:G.1j,O:G.O,3E:G.3E,1Y:G.1Y,32:G.32,3F:G.3F,4v:\'4w\',4x:9(d){6 r=b(X).31(d,h);a(G.2k){G.2k(r)}},4y:G.4z,4A:G.4B});c 5};6 2l=9(1t,h,2m,2n,1b,G){5.3G=1t;5.1u=h;5.3H=2m;5.3I=2n;5.1b=1b;5.3J=E;5.33=G||{};6 X=5;b(1b).1e(9(){b.O(5,\'34\',X)});5.35()};2l.y.35=9(){5.3K();a(5.1b.V==0){c}6 X=5;b.4C(5.3G,5.3I,9(d){6 r=b(X.1b).31(d,X.1u);a(X.33.2k){X.33.2k(r)}});5.3J=4D(9(){X.35()},5.3H)};2l.y.3K=9(){5.1b=b.3L(5.1b,9(o){a(b.4E.4F){6 n=o.36;2v(n&&n!=4G){n=n.36}c n!=E}J{c o.36!=E}})};b.1a.4H=9(1t,h,2m,2n,G){c j 2l(1t,h,2m,2n,5,G)};b.1a.3B=9(){c b(5).1e(9(){6 2o=b.O(5,\'34\');a(2o==E){c}6 X=5;2o.1b=b.3L(2o.1b,9(o){c o!=X});b.3C(5,\'34\')})};b.1m({38:9(s,A,f){c j m(s,A,f)},4I:9(1L,A,f){6 s=b.2Z({1t:1L,1Y:1f}).3y;c j m(s,A,f)},2j:9(z){c b.O(z,\'2i\')},4J:9(14,O,3M){c 14.K(O,3M,F,0)},4K:9(1o){m.R=1o}})})(b)}',62,295,'|||||this|var|||function|if|jQuery|return|||settings||param||new|||Template|||node|case||||extData|||_name|prototype|element|includes|push|throw|break|null|undefined|options|deep|RegExp|else|get|oper|se|for|data|||DEBUG_MODE|||replace|length|_option|that|f_escapeString|Error|eval||step|TemplateUtils|template|jTemplates|ss|this_op|JTException|ret|fn|objs|_templates_code|_template|each|false|TextNode|match|literalMode|type|cval|delete|extend|opFOREACH|value|_onTrue|_onFalse|fcount|ckey|url|_param|f_cloneData|setTemplate|tname|lastIndex|literal|opIF|filter|try|__tmp|typeof|catch|instanceof|par|_currentState|mode|iteration|url_|_tree|_templates|true|op|end|continue|noFunc|name|key|Number|count|jTemplateSID|async|disallow_functions|cloneData|MAIN|iter|not|in|elseif_level|op_|switchToElse|getParent|foreach|opFORFactory|_param1|_param2|escapeData|optionText|_value|__t|_parent|jTemplate|getTemplate|on_success|Updater|interval|args|updater|_includes|filter_params|runnable_functions|version|reg|_template_settings|while|indexOf|is|substring|optionToObject|Object|switch|include|Include|UserParam|cycle|Cycle|begin|default|setParam|constructor|toString|String|obj|val|__template|tab|arr|tmp|ex|_values|_length|_index|_lastSessionID|sid|ajax|elementName|processTemplate|cache|_options|jTemplateUpdater|run|parentNode|window|createTemplate||filter_data|clone_data|clone_params|escapeHTML|splitTemplates|of|txt|gt|lt|_literalMode|__1|_cond|funcIterator|as|find|_arg|object|_total|prevValue|index|first|last|total|_root|responseText|html|im|processTemplateStop|removeData|defined|dataFilter|timeout|_url|_interval|_args|timer|detectDeletedNodes|grep|parameter|exec|closed|No|inArray|ppp|elseif|ldelim|rdelim|Missing|unknown|tag|substr|amp|quot|hasOwnProperty|Array|Function|Functions|are|allowed|split|shift|__0|subtemplate|to|Operator|failed|MAX_VALUE|Math|ceil|root|Cannot|values|has|no|elements|setTemplateURL|setTemplateElement|trim|CDATA|hasTemplate|removeTemplate|processTemplateURL|GET|dataType|json|success|error|on_error|complete|on_complete|getJSON|setTimeout|browser|msie|document|processTemplateStart|createTemplateURL|processTemplateToText|jTemplatesDebugMode'.split('|'),0,{}))
/** < /scripts-v66/lib/jplugins/jquery-jtemplates.0.7.8.js **/

/** > /scripts-v66/lib/jplugins/jquery.tools.min.js **/
/*
 * jquery.tools 1.1.2 - The missing UI library for the Web
 * 
 * [tools.tooltip-1.1.2, tools.tooltip.dynamic-1.0.1]
 * 
 * Copyright (c) 2009 Tero Piirainen
 * http://flowplayer.org/tools/
 *
 * Dual licensed under MIT and GPL 2+ licenses
 * http://www.opensource.org/licenses
 * 
 * -----
 * 
 * File generated: Wed Oct 07 14:12:20 GMT+00:00 2009
 */
 jQuery.noConflict();
(function(c){var d=[];c.tools=c.tools||{};c.tools.tooltip={version:"1.1.2",conf:{effect:"toggle",fadeOutSpeed:"fast",tip:null,predelay:0,delay:30,opacity:1,lazy:undefined,position:["top","center"],offset:[0,0],cancelDefault:true,relative:false,oneInstance:true,events:{def:"mouseover,mouseout",input:"focus,blur",widget:"focus mouseover,blur mouseout",tooltip:"mouseover,mouseout"},api:false},addEffect:function(e,g,f){b[e]=[g,f]}};var b={toggle:[function(e){var f=this.getConf(),g=this.getTip(),h=f.opacity;if(h<1){g.css({opacity:h})}g.show();e.call()},function(e){this.getTip().hide();e.call()}],fade:[function(e){this.getTip().fadeIn(this.getConf().fadeInSpeed,e)},function(e){this.getTip().fadeOut(this.getConf().fadeOutSpeed,e)}]};function a(f,g){var p=this,k=c(this);f.data("tooltip",p);var l=f.next();if(g.tip){l=c(g.tip);if(l.length>1){l=f.nextAll(g.tip).eq(0);if(!l.length){l=f.parent().nextAll(g.tip).eq(0)}}}function o(u){var t=g.relative?f.position().top:f.offset().top,s=g.relative?f.position().left:f.offset().left,v=g.position[0];t-=l.outerHeight()-g.offset[0];s+=f.outerWidth()+g.offset[1];var q=l.outerHeight()+f.outerHeight();if(v=="center"){t+=q/2}if(v=="bottom"){t+=q}v=g.position[1];var r=l.outerWidth()+f.outerWidth();if(v=="center"){s-=r/2}if(v=="left"){s-=r}return{top:t,left:s}}var i=f.is(":input"),e=i&&f.is(":checkbox, :radio, select, :button"),h=f.attr("type"),n=g.events[h]||g.events[i?(e?"widget":"input"):"def"];n=n.split(/,\s*/);if(n.length!=2){throw"Tooltip: bad events configuration for "+h}f.bind(n[0],function(r){if(g.oneInstance){c.each(d,function(){this.hide()})}var q=l.data("trigger");if(q&&q[0]!=this){l.hide().stop(true,true)}r.target=this;p.show(r);n=g.events.tooltip.split(/,\s*/);l.bind(n[0],function(){p.show(r)});if(n[1]){l.bind(n[1],function(){p.hide(r)})}});f.bind(n[1],function(q){p.hide(q)});if(!c.browser.msie&&!i&&!g.predelay){f.mousemove(function(){if(!p.isShown()){f.triggerHandler("mouseover")}})}if(g.opacity<1){l.css("opacity",g.opacity)}var m=0,j=f.attr("title");if(j&&g.cancelDefault){f.removeAttr("title");f.data("title",j)}c.extend(p,{show:function(r){if(r){f=c(r.target)}clearTimeout(l.data("timer"));if(l.is(":animated")||l.is(":visible")){return p}function q(){l.data("trigger",f);var t=o(r);if(g.tip&&j){l.html(f.data("title"))}r=r||c.Event();r.type="onBeforeShow";k.trigger(r,[t]);if(r.isDefaultPrevented()){return p}t=o(r);l.css({position:"absolute",top:t.top,left:t.left});var s=b[g.effect];if(!s){throw'Nonexistent effect "'+g.effect+'"'}s[0].call(p,function(){r.type="onShow";k.trigger(r)})}if(g.predelay){clearTimeout(m);m=setTimeout(q,g.predelay)}else{q()}return p},hide:function(r){clearTimeout(l.data("timer"));clearTimeout(m);if(!l.is(":visible")){return}function q(){r=r||c.Event();r.type="onBeforeHide";k.trigger(r);if(r.isDefaultPrevented()){return}b[g.effect][1].call(p,function(){r.type="onHide";k.trigger(r)})}if(g.delay&&r){l.data("timer",setTimeout(q,g.delay))}else{q()}return p},isShown:function(){return l.is(":visible, :animated")},getConf:function(){return g},getTip:function(){return l},getTrigger:function(){return f},bind:function(q,r){k.bind(q,r);return p},onHide:function(q){return this.bind("onHide",q)},onBeforeShow:function(q){return this.bind("onBeforeShow",q)},onShow:function(q){return this.bind("onShow",q)},onBeforeHide:function(q){return this.bind("onBeforeHide",q)},unbind:function(q){k.unbind(q);return p}});c.each(g,function(q,r){if(c.isFunction(r)){p.bind(q,r)}})}c.prototype.tooltip=function(e){var f=this.eq(typeof e=="number"?e:0).data("tooltip");if(f){return f}var g=c.extend(true,{},c.tools.tooltip.conf);if(c.isFunction(e)){e={onBeforeShow:e}}else{if(typeof e=="string"){e={tip:e}}}e=c.extend(true,g,e);if(typeof e.position=="string"){e.position=e.position.split(/,?\s/)}if(e.lazy!==false&&(e.lazy===true||this.length>20)){this.one("mouseover",function(h){f=new a(c(this),e);f.show(h);d.push(f)})}else{this.each(function(){f=new a(c(this),e);d.push(f)})}return e.api?f:this}})(jQuery);
(function(d){var c=d.tools.tooltip;c.plugins=c.plugins||{};c.plugins.dynamic={version:"1.0.1",conf:{api:false,classNames:"top right bottom left"}};function b(h){var e=d(window);var g=e.width()+e.scrollLeft();var f=e.height()+e.scrollTop();return[h.offset().top<=e.scrollTop(),g<=h.offset().left+h.width(),f<=h.offset().top+h.height(),e.scrollLeft()>=h.offset().left]}function a(f){var e=f.length;while(e--){if(f[e]){return false}}return true}d.fn.dynamic=function(g){var h=d.extend({},c.plugins.dynamic.conf),f;if(typeof g=="number"){g={speed:g}}g=d.extend(h,g);var e=g.classNames.split(/\s/),i;this.each(function(){if(d(this).tooltip().jquery){throw"Lazy feature not supported by dynamic plugin. set lazy: false for tooltip"}var j=d(this).tooltip().onBeforeShow(function(n,o){var m=this.getTip(),l=this.getConf();if(!i){i=[l.position[0],l.position[1],l.offset[0],l.offset[1],d.extend({},l)]}d.extend(l,i[4]);l.position=[i[0],i[1]];l.offset=[i[2],i[3]];m.css({visibility:"hidden",position:"absolute",top:o.top,left:o.left}).show();var k=b(m);if(!a(k)){if(k[2]){d.extend(l,g.top);l.position[0]="top";m.addClass(e[0])}if(k[3]){d.extend(l,g.right);l.position[1]="right";m.addClass(e[1])}if(k[0]){d.extend(l,g.bottom);l.position[0]="bottom";m.addClass(e[2])}if(k[1]){d.extend(l,g.left);l.position[1]="left";m.addClass(e[3])}if(k[0]||k[2]){l.offset[0]*=-1}if(k[1]||k[3]){l.offset[1]*=-1}}m.css({visibility:"visible"}).hide()});j.onShow(function(){var l=this.getConf(),k=this.getTip();l.position=[i[0],i[1]];l.offset=[i[2],i[3]]});j.onHide(function(){var k=this.getTip();k.removeClass(g.classNames)});f=j});return g.api?f:this}})(jQuery);

/** < /scripts-v66/lib/jplugins/jquery.tools.min.js **/

/** > /scripts-v66/booking/common/currencies.js **/
Currencies = {
    ratesTab : null,

    _init : function(viewBean, select){
        if (viewBean){
            Currencies.ratesTab = viewBean;
            basketCurrency=Currencies.ratesTab.basketCurrency;
            if(basketCurrency){
                Currencies._fillCurrencySelectBasket(jQuery("#"+select),basketCurrency);
            }else{
                Currencies._fillCurrencySelect(jQuery("#"+select));
            }
				
        }
    },
	
    //*************************************************************************//
    // _initDetailsLinks
    // Autre Init pour permettre de renvoyer une valeur par défaut
    // ex : Currencies._initExtend(jsonCurrencies, "selectCurrency", jsonCancellationLinks.cancellationCurrency);
    // viewBean 		: --> viewBean contenant toutes les infos pour la conversion
    // select  		: --> ID de la liste déroulante pour la conversion de devise
    // basketCurrency    	: --> devise de départ
    //*************************************************************************//
    _initExtend : function(viewBean, select, basketCurrency){
        if (viewBean){
            Currencies.ratesTab = viewBean;
            if(basketCurrency){
                Currencies._fillCurrencySelectBasket(jQuery("#"+select),basketCurrency);
            }else{
                Currencies._fillCurrencySelect(jQuery("#"+select));
            }
        }
    },
	
    _save : function(prices){
        (prices || jQuery(".price")).each(
            function(){
                var cur = jQuery(this).find(".tCurrency");
                var amo = jQuery(this).find(".tAmount");
                jQuery(this).empty().append(amo).append("&nbsp;").append(cur)
                .append(amo.clone().removeClass('tAmount').addClass('tOrigAmount').hide())
                .append(cur.clone().removeClass('tCurrency').addClass('tOrigCurrency').hide());
            }
            );
    },
	
    _convert : function(rates,currency,prices){

        prices = prices || jQuery(".tPrice");
        prices.each(
            function(){
                var cur = jQuery(this).find(".tCurrency");
                var amo = jQuery(this).find(".tAmount");
                var origCur = jQuery(this).find(".tOrigCurrency").html();
                var origAmo = jQuery(this).find(".tOrigAmount").html();
                if (origCur!='---' && rates[currency] && rates[origCur] && rates[origCur]!=0 ) {
                    cur.html(currency);
                    amo.html((origAmo/ (rates[currency] / rates[origCur])).toFixed(2));
                } else {
                    Currencies._revert(jQuery(this));
                }
                if (origCur==currency) {
                    Currencies._revert(jQuery(this));
                }
            }
            );
    },
	
    _revert : function(prices){
        prices = prices || jQuery(".price");
        prices.each(
            function(){
					
                jQuery(this).find(".tCurrency").html(jQuery(this).find(".tOrigCurrency").html());
                jQuery(this).find(".tAmount").html(jQuery(this).find(".tOrigAmount").html());
            }
            );
    },
	
    _fillCurrencySelect : function(select){
	
        if(select && Currencies.ratesTab.currencies){
            jQuery.each(Currencies.ratesTab.currencies, function(index){
                var oOption = document.createElement('option');
                oOption.value = index;
                oOption.innerHTML = index;
				
                if(Currencies.ratesTab.defaultCurrency == index) oOption.selected = true;
                select.append(oOption);
            });
            select.hide().show();
        }
    },
	
    _fillCurrencySelectBasket : function(select, basket){
	
        if(select && Currencies.ratesTab.currencies){
            jQuery.each(Currencies.ratesTab.currencies, function(index){
                var oOption = document.createElement('option');
                oOption.value = index;
                oOption.innerHTML = index;
				
                if(basket == index) oOption.selected = true;
                select.append(oOption);
            });
            select.hide().show();
        }
    }
	
}
/** < /scripts-v66/booking/common/currencies.js **/

/** js form engine **/
/** > /scripts-v66/lib/ajax-request.js **/
var ajaxRequest = {
	
    retry : "",
    lang : "",
	
    getSessionId : function() {
        var sessionCookieName = "JSESSIONID";
        var cookies = document.cookie.split(';');
        for (var i = 0; i < cookies.length; i++) {
            var cookie = cookies[i];
            while (cookie.charAt(0) == ' ') cookie = cookie.substring(1, cookie.length);
            if (cookie.indexOf(sessionCookieName + "=") == 0) {
                return cookie.substring(sessionCookieName.length + 1, cookie.length);
            }
        }
        return "";
    },
  
    getTimeStamp : function(){
        var currentDate = new Date();
        return currentDate.getTime();
    },
  
    getCodeLang : function(){
        return jQuery("html").attr("lang");
    },
  
    /****
  /* formId : String : ID du formulaire lié à l'action
  /* @classErrorDisplayer : String : class CSS de l'element Html devant afficher les messages d'erreur
  /* callback : String : fonction JS executee au retour de l'appel, doit contenir les eventuels parametres necessaires a la fonction
  /***/
    _executeByForm : function(formId, classErrorDisplayer, classError, callback){

        var form = jQuery("#"+formId);
        if(this.retry != form.attr("action")){
            this.retry = form.attr("action");
            var myMethod="GET";
            if(form.attr("method")){
                myMethod = form.attr("method").toUpperCase();
            }

		
		
            jQuery.ajax({
                type:myMethod ,
                url: "/ajax" + form.attr("action"),
                data: form.serialize() + "&httpSessionId=" + this.getSessionId() + "&t=" + this.getTimeStamp() + "&lang=" + ajaxRequest.getCodeLang(),
                dataType:'json',
                success:function(response, status){
                    var errors = ajaxRequest.getErrors(response, status);
                    if(classError && classError != "" )ajaxRequest.clearErrorFiels(formId, classError);
                    ajaxRequest.clearErrorDisplayer(classErrorDisplayer, formId);
                    ajaxRequest.retry = "";
	  			
                    if(response.waitingRoom && response.waitingRoom != false){
                        ajaxRequest.setWaitingRoom(formId, classErrorDisplayer, classError, callback);
                    }
                    else{
                        if(typeof popins != "undefined" && popins.opened && popins.opened['div.waitingRoom'] && ajaxRequest.popinContent != null){
                            ajaxRequest.popinContent.dialog("close");
                        }
	  				
                        if(response.location)
                            if(response.targetWindow =="_top" || form.attr("target") == "_top") top.location.href = response.location;
                            else if (response.targetWindow =="_parent" || form.attr("target") == "_parent") parent.location.href = response.location;
                            else document.location.href = response.location;
                        else
                            eval(callback);

                    }
                },
                error:function(response, status){
                    ajaxRequest.redirectPageError(form.attr("target"));
                }
            });
        }
        return false;
    },
  
    /****
  /* @ajaxUrl : String : URL de l'action a appeler
  /* @classErrorDisplayer : String : class CSS de l'element Html devant afficher les messages d'erreur
  /* @callback : String : fonction JS executee au retour de l'appel, doit contenir les eventuels parametres necessaires a la fonction
  /***/
    _executeByUrl : function(ajaxUrl, classErrorDisplayer, callback){
        //console.log(ajaxUrl);
        if(this.retry != ajaxUrl){
            this.retry = ajaxUrl;
            jQuery.ajax({
                url: ajaxUrl,
                data: "httpSessionId=" + this.getSessionId() + "&t=" + this.getTimeStamp() + "&lang=" + ajaxRequest.getCodeLang(),
                dataType:'json',
                success:function(response, status){
				
                    var errors = ajaxRequest.getErrors(response, status);
                    ajaxRequest.clearErrorDisplayer(classErrorDisplayer);
                    ajaxRequest.retry = "";
	  			
                    if(response.location)
                        if(response.targetWindow =="_top") top.location.href = response.location;
                        else if(response.targetWindow =="_parent") parent.location.href = response.location;
                        else document.location.href = response.location;
                    else
                        eval(callback);
                },
                error:function(response, status){
                    ajaxRequest.redirectPageError();
                }
            });
        }
        return false;
    },
  
    redirectPageError : function(target){
        this.lang = this.getCodeLang();
        if (this.lang == 'en') {
            this.lang = 'gb';
        }
        var url = '/' + this.lang + '/error/error.shtml';
		
        if(target =="_top") top.location.href = url;
        else if(target =="_parent") parent.location.href = url;
        else document.location.href = url;

        return true;
    },
  
    setWaitingRoom : function(formId, classErrorDisplayer, classError, callback){
        var datas = {
            modal: true,
            drag: false,
            redim: false,
            iframe: false,
            ajax: true,
            width: 680,
            height: null,
            type: "alert",
            ref: "waitingRoom"
        };
    
        this.timerID = null;
        this.waitingTime = 31;
        this.requestParams = {
            form : formId,
            classErrorDisplayer : classErrorDisplayer,
            classError : classError,
            callback : callback
        };
		
        if(this.popinContent == "undefined") this.popinContent = null;
    
        if(popins && !popins.opened) popins.opened = {};
    
        if(popins && popins.opened && !popins.opened['div.waitingRoom']){
            jQuery.get("/commun/waiting-room.html", function(response) {
                ajaxRequest.popinContent = jQuery('<div class="popin' + datas.ref + '">'+ response + '</div>').appendTo(document.body);
                popins.openPopin(ajaxRequest.popinContent, datas);
                ajaxRequest.countDown();
            });
        }
        else{
            jQuery("#countdown").fadeTo("fast", 1.0);
            ajaxRequest.countDown();
        }
    },
  
    countDown : function(){
        if(this.waitingTime > 0) this.waitingTime -= 1;
        if (this.waitingTime <= 1)
            var wordingTime = " second";
        else
            var wordingTime = " seconds";
		
        document.getElementById('timer').innerHTML = this.waitingTime + wordingTime;
        if (this.waitingTime == 0){
            clearTimeout(ajaxRequest.timerID);
            jQuery("#countdown").fadeTo("slow",0.1, function(){
                ajaxRequest._executeByForm(ajaxRequest.requestParams.form, ajaxRequest.requestParams.classErrorDisplayer, ajaxRequest.requestParams.classError, ajaxRequest.requestParams.callback);
            });
        }
        else{
            clearTimeout(this.timerID);
            this.timerID = setTimeout("ajaxRequest.countDown()",1000);
        }
    },
  
    getErrors : function(ajaxResponse, requestStatus){
        var errorKeys = new Array();
      
        if(ajaxResponse && requestStatus == "success") {
            // Functional errors on Actions (actionErrors)
            if(ajaxResponse.actionErrors && ajaxResponse.actionErrors.length > 0)
                errorKeys = errorKeys.concat(ajaxResponse.actionErrors);

            // Errors on fields (not validated fields/keys OR fields which caused action error)
            if(ajaxResponse.fieldErrors && this.isNotEmpty(ajaxResponse.fieldErrors)){
                if (errorKeys.length==0) // si on a pas d'actionErrors, alors il s'agit d'erreur de validation
                    errorKeys.push("generic.error.validation"); // on fixe un message generique
            }
 
            // Technical error (textual message from application server "OOoops + stack")
            if (ajaxResponse.technicalErrors && ajaxResponse.technicalErrors.length > 0) {
                if (ajaxResponse.technicalErrors[0].indexOf("9000-") >= 0) {
                    var lg = jQuery("html").attr("lang");
                    if(lg == "en") lg = "gb";
                    var redirect = "/"+lg+"/session/expired.html";
                } else
                if (ajaxResponse.technicalErrors[0].indexOf("2101") >= 0 || ajaxResponse.technicalErrors[0].indexOf("2100-3") >= 0 || ajaxResponse.technicalErrors[0].indexOf("2200-3") >= 0){
                    errorKeys.push("generic.error.service.down");
                    errorKeys = errorKeys.concat(response.technicalErrors);
                }
                else if (ajaxResponse.technicalErrors.length > 0) { // "[xxx:xxxx] "
                    errorKeys.push("generic.error.technical");
                    errorKeys = errorKeys.concat(ajaxResponse.technicalErrors);
                }
            }
        } else {
            errorKeys.push("generic.error.server");
        }
    
        if(redirect && redirect != "") document.location.href = redirect;
        else return errorKeys;
    },
  
    isNotEmpty : function(object) {
        for(var i in object) {
            return true;
        }
        return false;
    },
	
    // formId is optional
    showErrorFields : function(fieldsObj, classError, formId){
        jQuery.each(fieldsObj, function(i, val) {
            if(formId){
                jQuery("#"+formId).find("input[name='"+i+"'], select[name='"+i+"']").not("input[type='radio']").addClass(classError);

                jQuery("#"+formId).find("input[name='"+i+"']").each( function(i){
                    jQuery("#"+formId).find("label[for='"+jQuery(this).attr("id")+"']").addClass(classError);
                })
            }
            else{
                jQuery("body").find("input[name='"+i+"'], select[name='"+i+"']").addClass(classError).prev("label").addClass(classError);
            }
        });
    },
	
    /**
	 /* @errorsArr : Array : tableau des erreurs recupere par la methode getErrors.
	 /* @classErrorDisplayer : String : class CSS de l'element Html devant afficher les messages d'erreur
	 /* @formId : ID du formulaire de reference pour cette action (optionnel)
	 **/
    showErrors : function(errorsArr, classErrorDisplayer, formId){
        if(formId) var errorDisplayer = jQuery("#"+formId+" ."+classErrorDisplayer);
        else var errorDisplayer = jQuery(" ."+classErrorDisplayer);
        if(errorsArr.length > 0) {
            errorDisplayer.html(errorsArr.join("<br />")).show();
        }
    },
	

    /**
	/* formId est optionnel (cas de l'appel via une URL)
	**/
    clearErrorDisplayer : function(classErrorDisplayer, formId){
        if(formId) jQuery("#"+formId+" ."+classErrorDisplayer).empty();
        else jQuery(" ."+classErrorDisplayer).empty();
    },
	
    clearErrorFiels : function(formId, classError){
        jQuery("#"+formId).find("."+classError).removeClass(classError);
    }
}
/** < /scripts-v66/lib/ajax-request.js **/

/** js utils / init tooltip / clearInput **/
/** > /scripts-v66/booking/common/utils.js **/
if(!utils) {
    var utils = {};
}
//init tooltips
utils.tooltips = {
    init: function(tooltips){

        tooltips = tooltips || jQuery(".tooltip");
        if(tooltips.size()){
            //create tooltip div content
            if(!jQuery('#divToolTip').size()){
                jQuery('<div id="divToolTip"> </div>').appendTo('body');
            }

            tooltips.each(function(){
                jQuery(this).tooltip({
                    tip: '#divToolTip',
                    lazy: false,
                    onBeforeShow:function(){
                        //config tooltip in offset, position and width
                        var offsetArray = new Array(0, 0),
                        positionArray = new Array("top", "center");
                        var elm = this;
                        var trigger = elm.getTrigger();
                        jQuery((trigger)[0].className.split(/\s+/)).each(function(i, cls) {
                            if(cls.indexOf('cfgtt-') === 0) {
                                cls += '-';

                                //get Offset x & y
                                offsetArray[0] = /offy:\d+/.test(cls) ? parseInt(cls.match(/offy:(\d+)/)[1], 10) : 0;
                                offsetArray[1] = /offx:\d+/.test(cls) ? parseInt(cls.match(/offx:(\d+)/)[1], 10) : 0;

                                //get Position x & y
                                positionArray[0] = cls.match(/ypos:([^\s-]+)/)[1];
                                positionArray[1] = cls.match(/xpos:([^\s-]+)/)[1];

                                //get width option tooltip
                                var width = /width:\d+/.test(cls) ? parseInt(cls.match(/width:(\d+)/)[1], 10) : 'auto';

                                //set offset tooltip
                                elm.getConf().offset = offsetArray;
                                //set position tooltip
                                elm.getConf().position = positionArray;
                                //set width tooltip
                                elm.getTip().css('width',width);
                            }
                        });

                        //Conversion devise
                        if(typeof Currencies != "undefined"){
                            if(Currencies.ratesTab != null){
                                Currencies._save(jQuery("#divToolTip .tPrice"));
                                Currencies._convert(Currencies.ratesTab.currencies, jQuery("#selectCurrency").val(), jQuery("#divToolTip .tPrice"));
                            }
                        }
                    }
                });
            });
            jQuery('.tooltip').click(function(){
                return false;
            });
        }
    }
};

utils.getUrlParameter = function(name, encode){
    name = name.replace(/[\[]/g,"\\\[").replace(/[\]]/g,"\\\]");

    var regexS = "[\\?&#]"+name+"=([^&#]*)";
    var regex = new RegExp(regexS);
    if (encode == true) {
        var results = regex.exec( unescape(encodeURIComponent(window.location.href) ));   
    } else {
        var results = regex.exec( unescape(window.location.href) );   
    }

    if (results == null) {
        return "";
    } else {
        return results[1].replace(/[+]/g, " ");
    }
};

utils.getMultipleUrlParameter = function( name ){
    name = name.replace(/[\[0-9\]]/g,"");
    var regexS = "[\\?&#]"+name+"\\[[0-9]*\\]=([^&#]*)";
    var regex = new RegExp(regexS, 'g');
    var results = regex.exec(unescape(window.location.href));
    var hrefS = unescape(window.location.href);
    var results = hrefS.match(regex);
    var values = new Array();
    if(results != null){
        for(var i=0; i<results.length; i++){
            values.push(results[i].split("=")[1]);
        }
    }
    return values;
};

//clear default text in field
utils.OLDclearInput  = {
    init: function(el){
        utils.clearInput.setField(el);
    },
    setField:function (el){
        //focus listener
        el.focus( function(){
            var el = jQuery(this);
            var val = el.val();
            //if no data in the key "placeholder" set key width value of the field
            if (!el.data('placeholder')) {
                el.data('placeholder', val);
            }
            //then remove text in the field
            if(val === el.data('placeholder')) {
                el.val('');
            }
        });
        //blur listener
        el.blur( function () {
            //in blur event if field still empty write data in key "placeholder" or nothing
            var el = jQuery(this);
            if (el.val() === '') {
                console.log('c');
                el.val(el.data('placeholder') || '');
            }
        });
    }
};

utils.clearInput  = {
    init: function(el){
        utils.clearInput.setField(el);
    },
    setField:function (el){
        //focus listener
        el.focus( function(){
            var el = jQuery(this);
            var val = el.val();
            //If focus then remove text in the field
            if(val == el[0].title) {
                el.val('');
            }
        });
        //blur listener
        el.blur( function () {
            //in blur event if field still empty write title or nothing
            var el = jQuery(this);
            if (el.val() == '') {
                el.val(el[0].title || '');
                //APAC & Subamerica local case
                if (jQuery("body.home") && typeof homeBookingEngine != "undefined"){
                    homeBookingEngine.localLink.removeClass('hidden');
                    homeBookingEngine.country.addClass('hidden');
                    homeBookingEngine.city.addClass('hidden');
                }
            }
        });
        el.blur();
    }
};

utils.printDate = function (dateObj, dateFormat) {
    var m = dateObj.getMonth();
    var d = dateObj.getDate();
    var y = dateObj.getFullYear();
    var s = {};
    s["%d"] = (d < 10) ? ("0" + d) : d;
    s["%m"] = (m < 9) ? ("0" + (1+m)) : (1+m);
    s["%Y"] = y;
    s["%%"] = "%";
    var re = /%./g;
    /*if (!Calendar.is_ie5 && !Calendar.is_khtml)
		return str.replace(re, function (par) { return s[par] || par; });*/
    var a = dateFormat.match(re);
    for (var i = 0; i < a.length; i++) {
        var tmp = s[a[i]];
        if (tmp) {
            re = new RegExp(a[i], 'g');
            dateFormat = dateFormat.replace(re, tmp);
        }
    }

    return dateFormat;
};

utils.convertDistance = function(distance, unit){
    if (unit == null) {
        unit = "km";
    }
    if(distance != null){
        if(unit != "km"){
            return ((distance/1.609)/1000).toFixed(2);
        }
        else{
            return (distance/1000).toFixed(2);
        }
    }
    else return;
};

utils.shortenDescription = function(text){
    var description = text.substr(0, text.lastIndexOf(" ",130));
    return description + "...";
};

utils.isEmpty = function(ob){
    for(var i in ob){
        return false;
    }
    return true;
}

utils.rewriteTitle = function(){
    var domName = document.domain.replace(/www\.|secure\.|s\-/, "");
    document.title = domName.charAt(0).toUpperCase() + domName.substr(1).toLowerCase();
}

utils.addCurrencyParamToBookLinks = function(links, selectId){
    if(jQuery("#"+selectId).length > 0){
        links.click(function(){
            this.href = this.href + "&currencyCode="+ jQuery("#"+selectId).val();
        });
    }
}

utils.initComplementaryBrandHotelAlert = function(links, isModal){
    var datas = {
        modal: isModal,
        drag: false,
        redim: false,
        iframe: false,
        ajax: false,
        width: 500,
        height: null,
        type: "alert",
        ref: "search"
    };

    var lang = (jQuery("html").attr("lang")=="en") ? "gb" : jQuery("html").attr("lang");

    jQuery.get('/'+lang+'/booking/popins.htm', function(data) {
        if(jQuery("div.popin").size==0){
            jQuery("body").append(data);
        }
        jQuery("div.search p, div.search div.btn").hide();
        links.click(function(){

            popins.openPopin(jQuery('div.' + datas.ref), datas);
            if(jQuery(this).hasClass("tChangeDates")){
                //renvoyer vers une url sur AH, a vir ac Damien
                //jQuery("#compBrandHotelPopinButtons .submit").attr("href", this.href + "&forward=true");
                bookUrl = jQuery(this).parents(".calendar").find(".tBookLink").attr("href");
                jQuery("#compBrandHotelPopinButtons .submit").attr("href", bookUrl + "&forward=true");
            }
            else
                jQuery("#compBrandHotelPopinButtons .submit").attr("href", this.href + "&forward=true");
            jQuery("#compBrandHotelPopinButtons, #tCompBrandHotelMsg").show();
            return false;

        });
    });
}

utils.initExternalHotelAlert = function(links, isModal){
    var datas = {
        modal: isModal,
        drag: false,
        redim: false,
        iframe: false,
        ajax: false,
        width: 500,
        height: null,
        type: "alert",
        ref: "search"
    };

    var lang = (jQuery("html").attr("lang")=="en") ? "gb" : jQuery("html").attr("lang");
    jQuery.get('/'+lang+'/booking/popins.htm', function(data) {
        if(jQuery("div.popin").length==0){
            jQuery("body").append(data);
        }
        jQuery("div.search p, div.search div.btn").hide();
        links.click(function(){
            popins.openPopin(jQuery('div.' + datas.ref), datas);
            jQuery("#compBrandHotelPopinButtons .submit").attr("href", this.href);
            jQuery("#compBrandHotelPopinButtons, #tExternalHotelMsg").show();
            return false;
        });
    });
}

utils.initExternalHotelAlertHome = function(div, form, linkForm){
    var datas = {
        modal: true,
        drag: false,
        redim: false,
        iframe: false,
        ajax: false,
        width: 500,
        height: null,
        type: "alert",
        ref: "search",
        show : div
    };


    jQuery.get('/'+form.lang+'/booking/popins.htm', function(data) {
        if(jQuery("div.popin").length==0){
            jQuery("body").append(data);
        }
        if(popins.opened != null){//si popins deja instancié
            popins.openPopin(jQuery('div.' + datas.ref), datas);
        }
        else{
            popins.init();
            popins.openPopin(jQuery('div.' + datas.ref), datas);
        }
        jQuery("div.search p, div.search div.btn").hide();
        jQuery(datas.show).show();

        //form.stopSubmitInProgressEffect();
        jQuery(".btn a.submit").bind("click", {
            _this : form
        }, function(e){
            var _this = e.data._this;
            _this.$currentForm.attr("action", linkForm);
            _this.defaultPostSubmit = true;
            _this.$currentForm.submit();

            return false;
        });
    });
}

utils.initGenericPopin = function(popinSrc, popinContentSrc, modal, drag, redim, iframe, ajax, width, height, type, ref, show){
    console.log('initGenericPopin');
    var datas = {
        modal: modal ? modal : true,
        drag: drag ? drag : false,
        redim: redim ? redim : false,
        iframe: iframe ? iframe : false,
        ajax: ajax ? ajax : false,
        width: width ? width : 500,
        height: height ? height : null,
        type: type ? type : "alert",
        ref: ref ? ref : "search",
        show : show ? show : div
    };

    var lang = (jQuery("html").attr("lang")=="en") ? "gb" : jQuery("html").attr("lang");

    jQuery.get('/'+lang+popinSrc, function(data) {
        if(jQuery("div.popin").length==0){
            jQuery("body").append(data);
        }
        if(popins.opened != null){//si popins deja instancié
            popins.openPopin(jQuery('div.' + datas.ref), datas);
        }

        else{
            popins.init();
            popins.openPopin(jQuery('div.' + datas.ref), datas);
        }
        jQuery("div.search p, div.search div.btn").hide();
        jQuery(datas.show).show();

        //form.stopSubmitInProgressEffect();
        jQuery(".btn a.submit").bind("click", {
            _this : form
        }, function(e){
            var _this = e.data._this;
            _this.$currentForm.attr("action", linkForm);
            _this.defaultPostSubmit = true;
            _this.$currentForm.submit();

            return false;
        });
    });
}

utils.initConfirmPopin = function(tpl,div,target){
    var datas = {
        modal: true,
        drag: false,
        redim: false,
        iframe: false,
        ajax: false,
        width: 500,
        height: null,
        type: "alert",
        ref: "search",
        show : div
    };


    jQuery.get(tpl, function(data) {
        if(jQuery("div.popin").length==0){
            jQuery("body").append(data);
        }
        if(popins.opened != null){//si popins deja instancié
            popins.openPopin(jQuery('div.' + datas.ref), datas);
        }

        else{
            popins.init();
            popins.openPopin(jQuery('div.' + datas.ref), datas);
        }
        jQuery("div.search p, div.search div.btn").hide();
        jQuery(datas.show).show();

        //form.stopSubmitInProgressEffect();
        jQuery(".search .btn a.submit").attr("href",target);
    });
}

utils.formatDateElement = function(str){
    if(Number(str) < 10) return "0"+str;
    else return str;
}

utils.manageCallcenterDatas = function(isDisplayed){
    if(isDisplayed == true){
        var zone = utils.getCookieContent("userBrowsingZoneLocalization") == undefined ? "home" : utils.getCookieContent("userBrowsingZoneLocalization");
        var lang = (jQuery("html").attr("lang")=="en") ? "gb" : jQuery("html").attr("lang");
        var datasUrl = "/hotel-cms/"+lang+"/booking/call-center-"+zone+".js";
        jQuery.getJSON(
            datasUrl,
            function(datas){
                var $callCenterTemplate = jQuery(".insetSupportWrapper");
                $callCenterTemplate.setTemplateURL("/"+lang+"/templates-v66/booking/callcenter.tpl");
                $callCenterTemplate.setParam("lang", getCodeLangue(lang));
                $callCenterTemplate.processTemplate(datas);
                utils.tooltips.init(jQuery(".insetSupportWrapper .tooltip"));
                jQuery(".insetSupport").show();
            }
            );
    }
}

utils.getCookie = function(name) {
    var nameEQ = name + "=";
    var ca = document.cookie.split(';');
    for(var i=0;i < ca.length;i++) {
        var c = ca[i];
        while (c.charAt(0)==' ') c = c.substring(1,c.length);
        if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
    }
    return null;
}

utils.getCookieContent = function(name){
    var cookieContent = utils.getCookie(name);
    if(cookieContent && cookieContent != ''){
        cookieContent = decodeURIComponent(cookieContent);
        return cookieContent.split('|');
    }
}

utils._utf8_decode = function(utftext) {
    var string = "";
    var i = 0;
    var c = c1 = c2 = 0;

    while ( i < utftext.length ) {

        c = utftext.charCodeAt(i);

        if (c < 128) {
            string += String.fromCharCode(c);
            i++;
        }
        else if((c > 191) && (c < 224)) {
            c2 = utftext.charCodeAt(i+1);
            string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
            i += 2;
        }
        else {
            c2 = utftext.charCodeAt(i+1);
            c3 = utftext.charCodeAt(i+2);
            string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
            i += 3;
        }

    }
    return string;
}

utils.decode = function (string) {
    return this._utf8_decode(unescape(string));
}

utils.getAmenitieLabel = function(amenitieObject, amenitiesLabels){
    if(amenitiesLabels && amenitiesLabels[amenitieObject.code]){
        if(amenitieObject.subAmenities != null && amenitieObject.subAmenities.length > 0){
            var sLabel = new String();
            for(var i=0; i < amenitieObject.subAmenities.length; i++){
                sLabel += amenitiesLabels[amenitieObject.subAmenities[i].code];
                if(amenitieObject.subAmenities[i].free != null){
                    if(amenitieObject.subAmenities[i].free == "true") sLabel += " (" + i18n.amenities.free +")";
                    else sLabel += " (" + i18n.amenities.notfree +")";
                }
                sLabel += "<br />";
            }
            sLabel = sLabel.replace(/[\"]/g, '&quot;');
            return sLabel;
        }
        else{
            var sLabel = new String();
            sLabel = amenitiesLabels[amenitieObject.code];
            if(amenitieObject.free != null){
                if(amenitieObject.free == "true") sLabel += " (" + i18n.amenities.free +")";
                else sLabel += " (" + i18n.amenities.notfree +")";
            }
            sLabel = sLabel.replace(/[\"]/g, '&quot;');
            return sLabel;
        }
    }
    else return "";
}

utils.printTaxDateLabel = function(str, dateIn, dateOut){
    var s = {};
    s["%x"] = dateIn;
    if(dateOut) s["%y"] = dateOut;

    var re = /%./g;

    var a = str.match(re);
    for (var i = 0; i < a.length; i++) {
        var tmp = s[a[i]];
        if (tmp) {
            re = new RegExp(a[i], 'g');
            str = str.replace(re, tmp);
        }
    }

    return str;
}

utils.getTaxDateLabel = function(taxObject){
    var str = "";
    if(taxObject.taxPeriodLimited != true){
        var taxDate = new Date(taxObject.period.yearIn, taxObject.period.monthIn-1, taxObject.period.dayIn, 12, 0, 0);
        str += " (<i>"+ utils.printTaxDateLabel(i18n.tax.since, utils.printDate(taxDate, i18n.calendar.displayDateFormat)) + "</i>)<br />";
    }
    else{
        var taxDateIn = new Date(taxObject.period.yearIn, taxObject.period.monthIn-1, taxObject.period.dayIn, 12, 0, 0);
        var taxDateOut = new Date(taxObject.period.yearOut, taxObject.period.monthOut-1, taxObject.period.dayOut, 12, 0, 0);
        str += " (<i>"+ utils.printTaxDateLabel(i18n.tax.from, utils.printDate(taxDateIn, i18n.calendar.displayDateFormat), utils.printDate(taxDateOut, i18n.calendar.displayDateFormat)) + "</i>)<br />";
    }
    return str;
}

utils.getTaxLabels = function(taxesArray, type){
    var str = "";
    str += "<strong>" + i18n.tax[type] + "</strong><br />";
    for(var j=0; j < taxesArray.length; j++){
        if(taxesArray[j] != null){
            str += taxesArray[j].taxLabel;
            if(taxesArray[j].taxExtraInfo != null && taxesArray[j].taxExtraInfo != "") str += " (<i>" + taxesArray[j].taxExtraInfo +"</i>)";

            if(taxesArray[j].percent == null){
                str += " :  <span class=\"tPrice\"><span class=\"tAmount\">" + taxesArray[j].amount+"</span>&nbsp;<span class=\"tCurrency\">"+ taxesArray[j].currencyCode +"</span></span>";
            }
            else
                str += " : " + taxesArray[j].percent + "%";

            str += utils.getTaxDateLabel(taxesArray[j]);
        }
    }
    return str;
}

utils.initCommissionBox = function(show, lang){
    if(show == true){
        var commissionBox = jQuery(".tCommissionBox");
        commissionBox.setTemplateURL("/"+lang+"/templates-v66/booking/commissions.tpl");
        commissionBox.processTemplate();
        commissionBox.show();
    }
}

utils.writeIdBox = function(datas, lang){
    var idProTpl = jQuery("#identificationProTemplate");

    if(jQuery(".logo").find("a").attr("title")!="businesstravel.accorhotels.com"){
        idProTpl.setTemplateURL("/"+lang+"/templates-v66/booking/identification-pro.tpl");
    }else{// si bus
        if(jQuery("#rates").attr("id")=="rates" || jQuery("#options").attr("id")=="options" || jQuery("#summary").attr("id")=="summary" || jQuery("#confirm").attr("id")=="confirm" || jQuery("#room-dates").attr("id")=="room-dates"){
            idProTpl.setTemplateURL("/"+lang+"/templates-v66/booking/identification-pro-bus.tpl");
        }else{
            idProTpl.setTemplateURL("/"+lang+"/templates-v66/booking/identification-pro.tpl");
        }

    }
    idProTpl.processTemplate(datas);
}
utils.getRateIe6 = function (elem,name){
    elem.value = name;
//return utils.decode(utils.getUrlParameter(name));
}

utils.startSubmitInProgressEffect = function(btnSubmit) {
    var offset = btnSubmit.offset();
    //btnSubmit.parent().prepend('<div style="position:absolute; z-index:2000; width:'+btnSubmit.parent().width()+'px; height:'+btnSubmit.parent().height()+'px;" />');
    btnSubmit.wrap('<div class="submitInProgress" />');
    var btnSubmitWidth = btnSubmit.width();
    var loaderWidth = 16;
    var loaderMarginLeft = (btnSubmitWidth / 2) - (loaderWidth / 2);
    btnSubmit.prepend('<div class="loader" style="margin-left:'+loaderMarginLeft+'px"></div>');
}

//Arr�t de l'effet "loader" lors du retour Ajax
utils.stopSubmitInProgressEffect = function() {
    jQuery(".tBookLink").find('.loader').remove();
    jQuery(".tBookLink").parent().replaceWith(this.btnSubmit);

}

utils._setReservationCenter = function(UrlCenterPopup, ClassCenterPopup){
    if (UrlCenterPopup != null) {
        // Ajout du lien avec l'URL
        jQuery(".central-reservation").wrap(function() {
            //jQuery(this).text()
            return '<a class="' + ClassCenterPopup + '" href="' + UrlCenterPopup + '"></a>';
        });
    }
}

/** < /scripts-v66/booking/common/utils.js **/

/** Loading  /scripts-v66/booking/targetTopper.js **/
/*
 *	targetTopper
 *	@version: 1.0
 *	@date 10/12/2010
 *	/!\ Files to be included to the HTML :
<script type="text/javascript" src="/scripts-v66/lib/jquery.min.js"></script>
 */



var targetTopper = {

     init : function(){
		 
           topWindow = window,
				jQuery(function(){ 
                         jQuery("#bandeau_n a, .footerContainer a, #header_fh a, #footer_fh a, #footer-main a").not("#languages-top a, a.ml").click(function() {	
									
									this.target = "_top";	

                      })
              })
       }
};


/** Done /scripts-v66/booking/targetTopper.js **/

/** Loading  /scripts-v66/criteo.js **/
var Criteo = {
	campainId : 0,
	subDomain : '',
	widgetId : 0, 
	segmentId : 1,
	hotelCode : null,
	hotelsList : null,
	dateIn : null,
	dateOut : null,
	transactionDetails : {
		confirmationCode : '',
		isCriteoSale : 0,
		totalAmount : 1
	},
	
	// Déclenche un tag de homepage
	triggerHomePageHit : function() {
		this._triggerHit('home');
	},
	
	// Déclenche un tag de landing page promo (ex : crazyprices)
	triggerPromoPageHit : function(segmentId) {
		var pattern = new RegExp("[0-9]+","g");
		if (pattern.test(segmentId)) {
			this.segmentId = segmentId;
		}
		this._triggerHit('promo');
	},
	
	// Déclenche un tag de fiche hôtel
	triggerProductPageHit : function(hotelCode, dateIn, dateOut) {
		this.hotelCode = hotelCode;
		this.dateIn = dateIn;
		this.dateOut = dateOut;
		this._triggerHit('product');
	},
	
	// Déclenche un tag de liste hôtel
	triggerProductListHit : function(hotelsList, dateIn, dateOut) {
		this.hotelsList = hotelsList;
		this.dateIn = dateIn;
		this.dateOut = dateOut;
		this._triggerHit('product-list');
	},
	
	// Déclenche un tag de page de conf resa
	triggerSaleHit : function(hotelCode, confirmationCode, isCriteoSale, totalAmount) {
		this.hotelCode = hotelCode;
		this.transactionDetails.confirmationCode = confirmationCode;
		this.transactionDetails.isCriteoSale = isCriteoSale;
		this.transactionDetails.totalAmount = totalAmount;
		this._triggerHit('sale');
	},
 
	// Générateur de tags Criteo
	_triggerHit : function(tagType) {
		// Vérification du tag type
		if (tagType != 'home' && tagType != 'product' && tagType != 'product-list' && tagType != 'sale' && tagType != 'promo') return;
		
		// Vérification du marché de provenance de l'internaute
		var userBrowsingZone = this._getCookieContent("userBrowsingZoneLocalization") == undefined ? "home" : this._getCookieContent("userBrowsingZoneLocalization")+'';
		if (userBrowsingZone != 'france' && userBrowsingZone != 'deutschland' && userBrowsingZone != 'united-kingdom' && userBrowsingZone != 'usa' && userBrowsingZone != 'brasil' && userBrowsingZone != 'nederland' && userBrowsingZone != 'italia') return;
		
		// Initialisation des variables criteo, en fonction du tag et du marché
		switch (userBrowsingZone){
			case 'france' : 
				this.campainId = 2172;
				this.subDomain = 'accorfr';
				this.widgetId = (tagType=='sale')?7711877:7711876;
				break;
			case 'united-kingdom' : 
				this.campainId = 2173;
				this.subDomain = 'accoruk';
				this.widgetId = (tagType=='sale')?7711879:7711878;
				break;
			case 'deutschland' : 
				this.campainId = 2176;
				this.subDomain = 'accorde';
				this.widgetId = (tagType=='sale')?7711887:7711886;
				break;
			case 'usa' : 
				this.campainId = 4096;
				this.subDomain = 'accorus';
				this.widgetId = (tagType=='sale')?7715968:7715967;
				break;
			case 'brasil' : 
				this.campainId = 4095;
				this.subDomain = 'accorbr';
				this.widgetId = (tagType=='sale')?7715966:7715965;
				break;
			case 'nederland' : 
				this.campainId = 4056;
				this.subDomain = 'accorhotelsnl';
				this.widgetId = (tagType=='sale')?7715873:7715872;
				break;
			case 'italia' : 
				this.campainId = 4093;
				this.subDomain = 'accorit';
				this.widgetId = (tagType=='sale')?7715962:7715961;
				break;
		}
		
		// Génération du tag
		if (document.createElement) { 
			var body_doc=document.getElementsByTagName('body')[0]; 
			
			// Création d'un div vide avec id=pcto_dis_div (sera utilisé après la réponse du 1°hit, lors de l'appel à la fonction pcto_dis)
			if (tagType != 'sale') {
				var cto_dis_div=document.createElement('div');
				if (cto_dis_div) { 
					cto_dis_div.id = 'pcto_dis_div'; 
					cto_dis_div.style.display='none'; 
				}
				if (body_doc!==null && body_doc.appendChild) { 
					body_doc.appendChild(cto_dis_div);
				}
			}
			
			// Création d'un div caché contenant une image qui réalise le 1° hit chez Criteo
			var cto_div=document.createElement('div');
			if (cto_div) { 
				cto_div.id = 'pcto_div';
				cto_div.style.display='none'; 
			}
			if (body_doc!==null && body_doc.appendChild) { 
				body_doc.appendChild(cto_div);
			}
			
			// Création du hit image
			var cto_im=document.createElement('img');
			if (cto_im) { 
				cto_im.width = '1px'; 
				cto_im.height = '1px'; 
				switch (tagType){
					case 'home' : 
						cto_im.onload = this.pcto_dis;
						cto_im.src='http://'+this.subDomain+'.widget.criteo.com/pac/display.js?p1='+escape('v=2&wi='+this.widgetId+'&pt1=0&pt2=1')+'&t1=sendEvent&resptype=gif&cb='+Math.floor(Math.random()*99999999999); 
						break;
					case 'promo' : 
						cto_im.onload = this.pcto_dis;
						cto_im.src='http://'+this.subDomain+'.widget.criteo.com/pac/display.js?p1='+escape('v=2&wi='+this.widgetId+'&pt1=0&pt2=1&si='+this.segmentId)+'&t1=sendEvent&resptype=gif&cb='+Math.floor(Math.random()*99999999999); 
						break;
					case 'product' : 
						cto_im.onload = this.pcto_dis;
						var datesParam = ''; 
						if (this.dateIn && this.dateOut) {
							datesParam = '&din='+this._formatDate(this.dateIn)+'&dout='+this._formatDate(this.dateOut);
						}
						cto_im.src='http://'+this.subDomain+'.widget.criteo.com/pac/display.js?p1='+escape('v=2&wi='+this.widgetId+'&pt1=2'+datesParam+'&i='+this.hotelCode)+'&t1=sendEvent&resptype=gif&cb='+Math.floor(Math.random()*99999999999); 
						break;
					case 'product-list' : 
						cto_im.onload = this.pcto_dis;
						var hotelCodes = '';
						for(i=0; i<3; i++){
							if(this.hotelsList[i]) hotelCodes += '&i'+(i+1)+'='+this.hotelsList[i];
						}
						var datesParam = ''; 
						if (this.dateIn && this.dateOut) {
							datesParam = '&din='+this._formatDate(this.dateIn)+'&dout='+this._formatDate(this.dateOut);
						}
						cto_im.src='http://'+this.subDomain+'.widget.criteo.com/pac/display.js?p1='+escape('v=2&wi='+this.widgetId+'&pt1=3'+datesParam+hotelCodes)+'&t1=sendEvent&resptype=gif&cb='+Math.floor(Math.random()*99999999999)
						break;
					case 'sale' : 
						cto_im.src='https://sslwidget.criteo.com/pac/display.js?p1='+escape('v=2&wi='+this.widgetId+'&t='+this.transactionDetails.confirmationCode+'&s=1&dd='+this.transactionDetails.isCriteoSale+'&i1='+this.hotelCode+'&p1='+this.transactionDetails.totalAmount+'&q1=1')+'&t1=transaction&resptype=gif&cb='+Math.floor(Math.random()*99999999999)
						break;
				}
				var cto_doc=document.getElementById('pcto_div'); 
				if (cto_doc!==null && cto_doc.appendChild) { 
					cto_doc.appendChild(cto_im);
				}
			}
			
		}
	},

	// Fonction pcto_dis, appelée sur le onload du pixel Criteo
	pcto_dis : function(){
		if (document.createElement) { 
			var cto_dis_im=document.createElement('iframe');
			if (cto_dis_im) { 
				cto_dis_im.width = '1px'; 
				cto_dis_im.height = '1px'; 
				cto_dis_im.style.display='none'; 
				cto_dis_im.src='http://dis.criteo.com/dis/dis.aspx?p='+Criteo.campainId+'&c=2&cb='+Math.floor(Math.random()*99999999999); 
				var cto_dis_doc=document.getElementById('pcto_dis_div'); 
				if (cto_dis_doc!==null && cto_dis_doc.appendChild) { 
					cto_dis_doc.appendChild(cto_dis_im);
				}
			}
		}
	},
	
	// Utils : récupération de la valeur d'un cookie
	_getCookie : function(name) {
		var nameEQ = name + "=";
		var ca = document.cookie.split(';');
		for(var i=0;i < ca.length;i++) {
			var c = ca[i];
			while (c.charAt(0)==' ') c = c.substring(1,c.length);
			if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
		}
		return null;
	},

	// Utils : récupération de la valeur d'un cookie
	_getCookieContent : function(name){
		var cookieContent = Criteo._getCookie(name);
		if(cookieContent && cookieContent != ''){
			cookieContent = decodeURIComponent(cookieContent);
			return cookieContent.split('|');
		}
	},
	
	// Utils : mise en forme d'une date au format imposé par Criteo
	_formatDate : function(date){
		return date.getFullYear()+'-'+((date.getMonth()<9)?'0':'')+(date.getMonth()+1)+'-'+((date.getDate()<10)?'0':'')+date.getDate();
	}
};
/** Done /scripts-v66/criteo.js **/

/** Loading  /scripts-v66/adexchange.js **/
var AdExchange = {
	
	// Déclenche un tag de homepage
	triggerHomePageHit : function() {
		// Vérification du marché de provenance de l'internaute
		var userBrowsingZone = this._getCookieContent("userBrowsingZoneLocalization") == undefined ? "home" : this._getCookieContent("userBrowsingZoneLocalization")+'';
		if (userBrowsingZone != 'france' && userBrowsingZone != 'united-kingdom') return;

		var pixelId = '';
		switch (userBrowsingZone) {
			case 'france' : pixelId =  '53767'; break;
			case 'united-kingdom': pixelId =  '53768'; break;
			default : return;
		}
		this._triggerHit(pixelId);
	},
	
	// Déclenche un tag de liste hôtel
	triggerProductListHit : function(pixelId) {
		// Vérification du marché de provenance de l'internaute faite côté dynamique --> si cette fonction est appelée, il faut faire le hit
		this._triggerHit(pixelId);
	},
	
	// Générateur de tags AdExchange
	_triggerHit : function(pixelId) {
		if (document.createElement) { 
			var body_doc = document.getElementsByTagName('body')[0]; 
			var inv_im = document.createElement('img');
			if (inv_im) { 
				inv_im.width = '1px'; 
				inv_im.height = '1px'; 
				inv_im.src='http://segment-pixel.invitemedia.com/pixel?pixelID='+pixelId+'&partnerID=230&clientID=4840&key=segment'; 
			}
			body_doc.appendChild(inv_im);
		}
	},

	// Utils : récupération de la valeur d'un cookie
	_getCookie : function(name) {
		var nameEQ = name + "=";
		var ca = document.cookie.split(';');
		for(var i=0;i < ca.length;i++) {
			var c = ca[i];
			while (c.charAt(0)==' ') c = c.substring(1,c.length);
			if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
		}
		return null;
	},

	// Utils : récupération de la valeur d'un cookie
	_getCookieContent : function(name){
		var cookieContent = this._getCookie(name);
		if(cookieContent && cookieContent != ''){
			cookieContent = decodeURIComponent(cookieContent);
			return cookieContent.split('|');
		}
	}
};
/** Done /scripts-v66/adexchange.js **/

/** Loading  /scripts-v66/click2call.js **/
var v1 = '';
var v2 = '';
var v3 = ''; 
var v4 = '';

var click2Call = {
	instanceId : '',
	clientId : '7348489rqh130805',
	userBrowsingZone : '',
	currentLanguage : '',
	
	
	// Déclenche l'affichage du bouton C2C (element = bloc html après lequel on insère le bloc bouton)
	init : function(isAccorhotels, page, element, rid) {
		// Gestion des cas où on n'affiche pas le bouton
		if (!isAccorhotels) return false;
		if (page!='rates' && page!='options' && page!='summary') return false;
		this.instanceId = this._getInstanceId(page);
		if (this.instanceId == '') return false;
		
		// Cas où on affiche le bouton
		try
		{
			// Création du div qui contiendra le bouton
			element.after('<div id="buttonC2cId"></div>');
			
			v1 = page;
			v2 = this.currentLanguage;
			v3 = this.userBrowsingZone; 
			v4 = rid;
			
			// Chargement asynchrone du JS fourni par OBS
			var c2c = document.createElement('script'); 
			c2c.type = 'text/javascript';   
			c2c.async = true;    
			c2c.src= 'https://c2cu.internetpluspro.orange-business.com/c2call-frontend//button/button.html?s='+this.instanceId+'&c='+this.clientId; 
			(document.getElementsByTagName('head')[0]||document.getElementsByTagName('body')[0]||document.getElementsByTagName('script')[0].parentNode).insertBefore(c2c,null);   
		}
		catch(err)
		{
		}
	},
	
	// Utils : récupération de la valeur d'un cookie
	_getCookie : function(name) {
		var nameEQ = name + "=";
		var ca = document.cookie.split(';');
		for(var i=0;i < ca.length;i++) {
			var c = ca[i];
			while (c.charAt(0)==' ') c = c.substring(1,c.length);
			if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
		}
		return null;
	},

	// Utils : récupération de la valeur d'un cookie
	_getCookieContent : function(name){
		var cookieContent = this._getCookie(name);
		if(cookieContent && cookieContent != ''){
			cookieContent = decodeURIComponent(cookieContent);
			return cookieContent.split('|');
		}
	},
	
	// Utils : récupération de l'ID d'instance en fonction de la version d'accorhotels
	_getInstanceId : function(page) {
	
		this.userBrowsingZone = this._getCookieContent("userBrowsingZoneLocalization") == undefined ? "home" : this._getCookieContent("userBrowsingZoneLocalization")+'';
		this.currentLanguage = (jQuery("html").attr("lang")=="en") ? "gb" : jQuery("html").attr("lang");
		var currentVersion = this.currentLanguage.toLowerCase()+'-'+this.userBrowsingZone.toLowerCase()+'-'+page.toLowerCase();
		
		switch (currentVersion){
			case 'fr-france-rates' : 
			case 'fr-france-options' : 
				return '7348511zqm1308051';
				break;
			case 'fr-france-summary' : 
				return '7348522oaj1308052';
				break;
			case 'pt-br-brasil-rates' :
			case 'pt-br-brasil-options' :
				return '7348533uym1308053';
				break;
			case 'pt-br-brasil-summary' : 
				return '7348544tvb1308054';
				break;
			case 'gb-usa-rates' : 
			case 'gb-usa-options' : 
				return '7348556aak1308055';
				break;
			case 'gb-usa-summary' : 
				return '7348567zkm1308056';
				break;
			case 'zh-china-rates' : 
			case 'zh-china-options' : 
				return '7348582ndv1308057';
				break;
			case 'zh-china-summary' : 	
				return '7348593izr1308058';
				break;
			case 'gb-china-rates' : 
			case 'gb-china-options' : 
				return '7348603pso1308059';
				break;
			case 'gb-china-summary' : 
				return '7348614iuy13080510';
				break;
			case 'gb-united-kingdom-rates' :
			case 'gb-united-kingdom-options' :
				return '9917744npp13080511';
				break;
			case 'gb-united-kingdom-summary' :
				return '9917784qni13080512';
				break;
			case 'es-espana-rates' :
			case 'es-espana-options' :
				return '9917894tgi13080513';
				break;
			case 'es-espana-summary' :
				return '9917965vir13080514';
				break;
			case 'gb-australia-rates' : 
			case 'gb-australia-options' : 
				return '9917994srh13080515';
				break;
			case 'gb-australia-summary' : 
				return '9918021hyw13080516';
				break;
			case 'de-deutschland-rates' : 
			case 'de-deutschland-options' : 
				return '9918049sfu13080517';
				break;
			case 'de-deutschland-summary' : 
				return '9918076pro13080518';
				break;
			default :
				return '';
				break;
		}
	
	}
};	
/** Done /scripts-v66/click2call.js **/

