(function(a){a.fn.infiniteCarousel=function(b){var c=a.extend({},a.fn.infiniteCarousel.defaults,b),e=null;function d(g,f){return new Array(f+1).join(g)}return this.each(function(){var k=a("> div",this).css("overflow","hidden"),m=k.find("> ul"),l=m.find("> li"),i=l.filter(":first"),h=typeof c.actionsList=="undefined"?null:a("#"+c.actionsList),n=i.outerWidth(),g=Math.ceil(k.innerWidth()/n),j=1,f=Math.ceil(l.length/g);if((l.length%g)!=0){m.append(d('<li class="empty" />',g-(l.length%g)));l=m.find("> li")}l.filter(":first").before(l.slice(-g).clone().addClass("cloned"));l.filter(":last").after(l.slice(0,g).clone().addClass("cloned"));l=m.find("> li");k.scrollLeft(n*g);function o(q){var p=q<j?-1:1,s=Math.abs(j-q),r=n*p*g*s;clearTimeout(e);k.filter(":not(:animated)").animate({scrollLeft:"+="+r},500,function(){if(q==0){k.scrollLeft(n*g*f);q=f}else{if(q>f){k.scrollLeft(n*g);q=1}}j=q});if(c.auto){e=setTimeout(function(){a("a.forward").trigger("click")},c.dispTimeout)}return false}k.after('<a class="control arrow back" href="javascript:void(0)">&lt;</a>&nbsp;<a class="control arrow forward" href="javascript:void(0)">&gt;</a>&nbsp;<a class="control start" href="javascript:void(0)">S</a>&nbsp;<a class="control stop" href="javascript:void(0)">X</a>');if(h&&h.length>0){a("li",h).wrapInner('<a href="javascript:void(0)"></a>').click(function(){a("a.stop").trigger("click");return o(a(this).index()+2)})}a("a.back",this).click(function(){return o(j-1)});a("a.forward",this).click(function(){return o(j+1)});a("a.start",this).click(function(){c.auto=true;a("a.forward").trigger("click")});a("a.stop",this).click(function(){clearTimeout(e);c.auto=false});a(this).bind("goto",function(p,q){o(q)});if(c.auto){setTimeout(function(){a("a.forward").trigger("click")},c.dispTimeout)}})};a.fn.infiniteCarousel.defaults={auto:true,dispTimeout:3000,actionsList:null}})(jQuery);(function(a){a.fn.inputdynvalue=function(b){var c=a.extend({},a.fn.inputdynvalue.defaults,b);return this.each(function(){var d=c.htext;switch(c.htext){case"title":d=a(this).attr("title");break;case"value":d=a(this).attr("value");break;case"label":d=a(this).prev().text();break}a(this).attr("value",d).addClass(c.hclass).unbind("focus.dynvalue blur.dynvalue").bind("focus.dynvalue",function(){if(this.value===d){this.value="";a(this).removeClass(c.hclass)}}).bind("blur.dynvalue",function(){if(this.value===""){this.value=d;a(this).addClass(c.hclass)}})})};a.fn.inputdynvalue.defaults={htext:"label",hclass:"hint"}})(jQuery);(function(a){a.fn.resetInputs=function(){return this.each(function(){if(a(this).attr("value")!=a(this).prev().text()&&a(this).attr("value")!=""){if(a(this).parent().find(".reset").length>0){return}var b=a('<img class="reset" src="./images/close.gif" alt="Reset"/>').bind("click",function(){a(this).closest("fieldset").find(".ac_input").each(function(){if(typeof a(this).flushCache=="function"){a(this).flushCache()}if(a(this).hasClass("ville")){a(this).closest("fieldset").find(".lieu").unautocomplete().inputdynvalue({htext:"value"})}});a(this).siblings(".ac_location").val("");a(this).prev().inputdynvalue({htext:"label"});a(this).remove()});a(this).after(b)}})}})(jQuery);function onLoadFunctions(){jQuery("input.dynvalue").each(function(){jQuery(this).resetInputs()}).inputdynvalue({htext:"value"}).live("focusout",function(){jQuery(this).resetInputs()});jQuery("table not(.nozebra) tr").hover(function(){jQuery(this).addClass("rowover")},function(){jQuery(this).removeClass("rowover")});jQuery("table not(.nozebra) tr:even").addClass("rowimp");jQuery("table not(.nozebra) tr:odd").addClass("rowpai");moviLib.newWindowsForLink("newwindow","withMenu",650,400);moviLib.newWindowsForLink("externe");jQuery(".iCarousel").infiniteCarousel({auto:false,actionsList:"rub_iphone"});if(typeof jQuery.datepicker!="undefined"){jQuery.datepicker.setDefaults(jQuery.extend({defaultDate:null,showOn:"button",minDate:new Date,maxDate:new Date(2012,6-1,30),buttonImage:(window.client)?"./images/"+window.client+"/calendar.gif":"./images/calendar.gif",buttonImageOnly:true},jQuery.datepicker.regional.fr));jQuery("#dateField").datepicker(jQuery.datepicker.regional[moviLib.getLanguageFromUrl()])}if(typeof jQuery.iPhone=="undefined"){var b={delay:300,minLength:2,html:true,source:function(d,c){jQuery.ajax({url:"./gen_include/commune.php",dataType:"jsonp",data:{nb_res:10,q:d.term,mode:function(){return jQuery("#mode").val()||""},client:(window.client)?window.client:"default"},complete:function(){jQuery("input.ville").removeClass("ac_loading")},success:function(e){if(e.length==0){return}c(jQuery.map(e,function(f){var g=new RegExp("(?![^&;]+;)(?!<[^<>]*)("+jQuery.ui.autocomplete.escapeRegex(d.term)+")(?![^<>]*>)(?![^&;]+;)","gi");return{label:f.poi?f.poi.replace(g,"<strong>$1</strong>"):f.city.replace(g,"<strong>$1</strong>")+" ("+f.zipcode+")",value:f.poi?f.poi:f.city+" ("+f.zipcode+")",requestValue:f.poi?f.poi:f.city+","+f.zipcode,type:f.poi?"poi":"city",country:f.country,location:f.location}}))}})},search:function(c,d){jQuery(this).addClass("ac_loading")},focus:function(c,d){},select:function(c,d){var e=jQuery(this).parents("fieldset").find("input.lieu");jQuery(this).parents("fieldset").find(".ac_flag").val("yes");if(jQuery("#ac_location_"+this.id).length==0){jQuery('<input type="hidden" id="ac_location_'+this.id+'" name="ac_location_'+jQuery(this).attr("name")+'" class="ac_location" />').val(d.item.location).appendTo(jQuery(this).parent())}else{jQuery("#ac_location_"+this.id).val(d.item.location)}if(e.length===0){return}e.siblings(".ac_location").val("");if(jQuery("#ac_country_"+this.id).length==0){jQuery('<input type="hidden" id="ac_country_'+this.id+'" name="ac_country_'+jQuery(this).attr("name")+'" class="ac_country" />').val(d.item.country).appendTo(jQuery(this).parent())}else{jQuery("#ac_country_"+this.id).val(d.item.country)}if(e.prop("value")!=e.prev().text()){e.prop("value",e.prev().text());e.inputdynvalue({htext:"value"})}e.get(0).disabled=(d.item.type==="poi")?true:false;if(!e.get(0).disabled){a=jQuery.extend({},a,{lang:moviLib.getLanguageFromUrl(),city:d.item.requestValue,country:d.item.country});e.autocomplete(a).data("autocomplete")._renderItem=function(f,g){return jQuery("<li></li>").data("item.autocomplete",g).append("<a>"+g.label+"</a>").appendTo(f)}}},change:function(){},open:function(){},close:function(){}},a={delay:300,minLength:2,html:true,source:function(d,c){if(a.city.length==0){return false}jQuery.ajax({url:"./gen_include/lieu.php",dataType:"jsonp",data:{nb_res:10,q:d.term,city:this.options.city,country:this.options.country},complete:function(){jQuery("input.lieu").removeClass("ac_loading")},success:function(e){if(e.length==0){return}c(jQuery.map(e,function(f){var g=new RegExp("(?![^&;]+;)(?!<[^<>]*)("+jQuery.ui.autocomplete.escapeRegex(d.term)+")(?![^<>]*>)(?![^&;]+;)","gi");return{label:f.poi?f.poi.replace(g,"<strong>$1</strong>"):f.hnbr?f.hnbr+" "+f.street.replace(g,"<strong>$1</strong>")+" ("+f.zipcode+")":f.street.replace(g,"<strong>$1</strong>")+" ("+f.zipcode+")",value:f.poi?f.poi:f.hnbr?f.hnbr+" "+f.street:f.street,location:f.location}}))}})},search:function(c,d){jQuery(this).addClass("ac_loading")},select:function(c,d){jQuery(this).parents("fieldset").find("input.ac_location").val("");if(jQuery("#ac_location_"+this.id).length==0){jQuery('<input type="hidden" id="ac_location_'+this.id+'" name="ac_location_'+jQuery(this).attr("name")+'" class="ac_location" />').val(d.item.location).appendTo(jQuery(this).parent())}else{jQuery("#ac_location_"+this.id).val(d.item.location)}jQuery(this).parents("fieldset").find(".ac_flag").val("yes")},open:function(){},close:function(){}};jQuery("input.ville").autocomplete(b);jQuery("input.lieu").each(function(){var d=jQuery(this).parents("fieldset").find("input.ville"),e,c=/^(.+)\s\((\d+)\)$/;if(d.prop("value")!==""&&d.prop("value")!=d.prev().text()){e=jQuery(this);a=jQuery.extend({},a,{lang:moviLib.getLanguageFromUrl(),city:(c.test(e.parents("fieldset").find("input.ville").val()))?e.parents("fieldset").find("input.ville").val().replace(c,"$1,$2"):e.parents("fieldset").find("input.ville").val()});e.autocomplete(a)}});jQuery.ui.autocomplete.prototype._renderMenu=function(e,d){var c=this,f="";jQuery.each(d,function(g,h){if(h.country&&h.country!=f){e.append("<li class='country'>"+h.country+"</li>");f=h.country}c._renderItem(e,h)})};jQuery(".results ul").live("click",function(d){if(((!jQuery.browser.msie||(jQuery.browser.msie&&parseInt(jQuery.browser.version,10)>=8))&&d.button==0)||(jQuery.browser.msie&&d.button==1)){var c=jQuery(d.target).closest("a");if(c.parent().not(".selected")){c.parents(".results").find("li.selected").removeClass("selected");c.parents().addClass("selected")}}})}}jQuery(function(){onLoadFunctions()});
