var popup_panier_is_ouvert=false;var minuteur;var verifpersodisplayed=false;function showZoneRouge(zone){new Ajax.Updater('pop_login','/calendrier/showZoneRouge',{asynchronous:false,evalScripts:true,method:'get',parameters:'id='+zone});$('pop_login').style.display='block';}
function showAssuranceVol(){new Ajax.Updater('pop_login','/choix_libre/showAssuranceVol',{asynchronous:false,evalScripts:true,method:'get'});$('pop_login').style.display='block';}
function cardnumber(cf,nf)
{if(cf.value.length==cf.getAttribute('maxlength')){cf.form.elements[nf].focus();}}
function position_panier(){if($('bloc_id')&&$('nb_item_panier')){if($('nb_item_panier').value>0){var panier=$('bloc_id');var iebody=(document.compatMode&&document.compatMode!="BackCompat")?document.documentElement:document.body;var dsoctop=document.all?iebody.scrollTop:pageYOffset;var position=dsoctop;$('icone_panier').setStyle({display:'block'});if(document.all||document.getElementById){if(position>145)
{panier.setStyle({top:position+'px'});$('panier_content').removeClassName('higherPanier');if(navigator.appName=='Microsoft Internet Explorer'&&navigator.appVersion.indexOf('MSIE 9.0')==-1&&navigator.appVersion.indexOf('MSIE 7.0')==-1)
{$('resa').setStyle({background:'url(../images/bg-panier-top-gris.png) no-repeat center 0'});}}
else
{if(navigator.appName=='Microsoft Internet Explorer'&&navigator.appVersion.indexOf('MSIE 9.0')==-1&&navigator.appVersion.indexOf('MSIE 7.0')==-1)
{panier.setStyle({top:'144px'});$('resa').setStyle({background:'url(../images/bg-panier-top-gris-higher.png) no-repeat center 0'});}
else
{panier.setStyle({top:'144px'});}
$('panier_content').addClassName('higherPanier');}}}}}
function position_pop_login_and_pop_devis(){if($('pop_login')&&$('bg_pop_login')){placementpopup('bg_pop_login');}
if($('content_pop_devis')&&$('form_devis')){placementpopup('content_pop_devis');}}
var isIE=document.all;var mouseX=0;var mouseY=0;Event.observe(window,'load',function(){Event.observe(document,'mousemove',getMouseXY);if($('resa'))
{$('global').addClassName('navigation_panier');}});function getMouseXY(e){mouseY=Event.pointerY(e);}
function placementpopup(qui){if(document.documentElement&&document.documentElement.clientWidth){window.TsDocRef=document.documentElement;}else{window.TsDocRef=document.body;}
var TsScrollTop=parseInt(window.TsDocRef.scrollTop);var is_chrome=navigator.userAgent.toLowerCase().indexOf('chrome')>-1;if(is_chrome)
TsScrollTop=pageYOffset;var TsScrollLeft=parseInt(window.TsDocRef.scrollLeft);var TsClientHeight=parseInt(window.TsDocRef.clientHeight);var TsClientWidth=parseInt(window.TsDocRef.clientWidth);var TsElementHeight=parseInt($(qui).getHeight());var TsElementWidth=parseInt($(qui).getWidth());var TsBlockTop=Math.round(TsScrollTop+(TsClientHeight-TsElementHeight)/2)+'px';var TsBlockLeft=Math.round(TsScrollLeft+(TsClientWidth-TsElementWidth)/2)+'px';$(qui).style.top=TsBlockTop;$(qui).style.left=TsBlockLeft;}
function placementpopupLightWindow(qui){var lightwindow=$(qui);var iebody=(document.compatMode&&document.compatMode!="BackCompat")?document.documentElement:document.body;var dsoctop=document.all?iebody.scrollTop:pageYOffset;var position=dsoctop+22;if(document.all||document.getElementById){if(position>60){lightwindow.setStyle({top:position+'px'});}
else{lightwindow.setStyle({top:'120px'});}}}
function toujoursBasListPackPanier(){if($('list_pack_panier')){var list_pack_panier_height=$('list_pack_panier').getHeight();}else{var list_pack_panier_height=0;}
var limit=list_pack_panier_height-$('list_pack_panier_scroll').getHeight();$('list_pack_panier_scroll').setStyle({top:limit+'px'});}
function monteListPackPanier(){var list_pack_panier_height=$('list_pack_panier').getHeight();var limit=list_pack_panier_height-$('list_pack_panier_scroll').getHeight();var new_top=$('list_pack_panier_scroll').offsetTop-20;if(new_top>limit){$('list_pack_panier_scroll').setStyle({top:new_top+'px'});}else{$('list_pack_panier_scroll').setStyle({top:limit+'px'});}}
function descendListPackPanier(){var new_top=$('list_pack_panier_scroll').offsetTop+20;if(new_top<0){$('list_pack_panier_scroll').setStyle({top:new_top+'px'});}else{$('list_pack_panier_scroll').setStyle({top:'0px'});}}
function showHidePanier()
{if($('detail_panier'))
{new Effect.toggle('panier_deplie','blind');changeClassShowHidePanier();if(!($('panier_deplie').visible()))
{$('confirmReserv').hide();if(navigator.appName=='Microsoft Internet Explorer')
{$('panier_content').setStyle({height:$('panier_deplie').getHeight()+76+'px'});}
Event.stopObserving('resa','mouseover',showHidePanier);window.setTimeout("showHidePanier();",10000);}
else
{if(navigator.appName=='Microsoft Internet Explorer')
{$('panier_content').setStyle({height:76+'px'});}
Event.observe($('resa'),'mouseover',showHidePanier);new Effect.toggle('confirmReserv','blind');}}}
function showPanier()
{$('icone_panier').addClassName('icone_panier_deplie');$('icone_panier').removeClassName('icone_panier_replie');window.clearTimeout(minuteur);var iebouton=false;Event.observe($("confirmReserv"),'mouseover',function(event){Event.stop(event);iebouton=true;});Event.observe($("confirmReserv"),'mouseout',function(event){Event.stop(event);iebouton=true;});if($('detail_panier')&&!iebouton)
{if(!($('panier_deplie').visible()))
{$('panier_deplie').show();changeClassShowHidePanier();$('confirmReserv').hide();if(navigator.appName=='Microsoft Internet Explorer')
{$('panier_content').setStyle({height:$('panier_deplie').getHeight()+76+'px'});}}}}
function CachePanier(){if($('detail_panier'))
{if($('detail_panier').visible())
{$('icone_panier').addClassName('icone_panier_replie');$('icone_panier').removeClassName('icone_panier_deplie');changeClassShowHidePanier();if(navigator.appName=='Microsoft Internet Explorer')
{$('panier_content').setStyle({height:76+'px'});}
$('panier_deplie').hide();$('confirmReserv').show();}}}
function LaunchTimer(){minuteur=setTimeout("CachePanier()",2000);}
function depliagedupanier(){if(this.popup_panier_is_ouvert){$('detail_panier').show();$('showHidePanier').addClassName('montrer');$('showHidePanier').innerHTML=$('showHidePanierReplier').innerHTML;}
else{$('detail_panier').hide();new Effect.toggle('detail_panier','blind',{'duration':'3.0'});changeClassShowHidePanier();this.popup_panier_is_ouvert=true;}}
function depliageDuPanierApresAjout(){if($('showHidePanier')){$('detail_panier').hide();changeClassShowHidePanier();depliagedupanier();}}
function changeClassShowHidePanier(){this.popup_panier_is_ouvert=true;if($('showHidePanier')){if($('showHidePanier').hasClassName('cacher')&&!$('detail_panier').visible()){$('showHidePanier').removeClassName('cacher');$('showHidePanier').addClassName('montrer');this.popup_panier_is_ouvert=true;$('showHidePanier').innerHTML=$('showHidePanierDeplier').innerHTML;}else{$('showHidePanier').removeClassName('montrer');$('showHidePanier').addClassName('cacher');this.popup_panier_is_ouvert=false;$('showHidePanier').innerHTML=$('showHidePanierReplier').innerHTML;}}}
function getPopupPanierIsOuvert(){return this.popup_panier_is_ouvert;}
function hidePanier(){if($('detail_panier')){$('detail_panier').hide();changeClassShowHidePanier();}}
function showPourquoi(id){hideAllPourquoi(id.substr(5,1));if($(id)){$(id).show();}}
function hideAllPourquoi(id){if($('pour_1')){$('pour_1').hide();}
if($('pour_2')){$('pour_2').hide();}
if($('pour_3')){$('pour_3').hide();}
if($('pour_4')){$('pour_4').hide();}
if($('pour_5')){$('pour_5').hide();}
for(i=1;i<4;i++){if(i!=id){$('pour_'+i+'_titre').hide();}
else
$('pour_'+i+'_titre').show();}
for(i=1;i<4;i++){if(i!=id)
$('pour_'+i+'_titre_off').show();else
$('pour_'+i+'_titre_off').hide();}}
function showlisteStations(){if($('lien_show_stations')){if($('lien_show_stations').hasClassName('show_sations_on')){$('lien_show_stations').removeClassName('show_sations_on');if($('liste_stations_b'))
{$('liste_stations_b').hide();$('liens_show_stations').hide();}}else{$('lien_show_stations').addClassName('show_sations_on');if($('liste_stations_b'))
{$('liste_stations_b').show();$('liens_show_stations').show();}}}}
function show_liste_langues(){if($('langues')){if($('langues').visible()){$('langues').hide();}else{$('langues').show();}}}
function has3Packs(aff){if(!$('message_3packs'))return;if(aff){$('message_3packs').setStyle({display:'block'});}else{$('message_3packs').setStyle({display:'none'});}}
function has14Packs(aff){if(!$('message_14packs'))return;if(aff){$('message_14packs').setStyle({display:'block'});}else{$('message_14packs').setStyle({display:'none'});}}
function getURLParam(strQueryString,strParamName){var strReturn="";var aQueryString=strQueryString.split("&");for(var iParam=0;iParam<aQueryString.length;iParam++){if(aQueryString[iParam].indexOf(strParamName.toLowerCase()+"=")>-1){var aParam=aQueryString[iParam].split("=");strReturn=aParam[1];break;}}
return unescape(strReturn);}
function verifPackJunior(form,pack_id,taille,pointure){if($('quantite_'+pack_id).getValue()==1){var taille_perso=getURLParam(form,'taille');if(!taille_perso)taille_perso=0;var pointure_perso=getURLParam(form,'pointure');if(!pointure_perso)pointure_perso=0;if(parseInt(taille_perso)>parseInt(taille)||parseInt(pointure_perso)>parseInt(pointure)){new Ajax.Updater('pop_login','/personnalisation/getPackJuniorLimite',{asynchronous:false,evalScripts:true,method:'get',parameters:form+'&pack_id='+pack_id});$('pop_login').style.display='block';return false;}}
return true;}
function verifPackBaby(form,pack_id,taille,pointure){if($('quantite_'+pack_id).getValue()==1){var taille_perso=getURLParam(form,'taille');if(!taille_perso)taille_perso=0;var pointure_perso=getURLParam(form,'pointure');if(!pointure_perso)pointure_perso=0;if(parseInt(taille_perso)>parseInt(taille)||parseInt(pointure_perso)>parseInt(pointure)){new Ajax.Updater('pop_login','/personnalisation/getPackBabyLimite',{asynchronous:false,evalScripts:true,method:'get',parameters:form+'&pack_id='+pack_id});$('pop_login').style.display='block';return false;}}
return true;}
function showResaTardive()
{new Ajax.Updater('pop_login','/commande/showResaTardive',{asynchronous:false,evalScripts:true,method:'get'});_typeface_js.renderDocument();$('pop_login').style.display='block';return false;}
function verifPersonnalisation(form){if(verifpersodisplayed){return true;}
var form_with_results=form.split("&");var tab_result=new Array();var packs_id=new Array();var shoes=new Array();var famille=new Array();var var_return=true;var var_return_assurance_prenom=true;var display_errors=false;for(var i=0,x=form_with_results.length;i<x;i++)
{tmp=form_with_results[i].split("=");tab_result[tmp[0]]=tmp[1];}
for(x in tab_result)
{if(x.indexOf("prenom_")>-1)
{tmp=x.split("_");packs_id.push(tmp[tmp.length-1]);}
if(x.indexOf("packopt1_")>-1)
{tmp=x.split("_");shoes[tmp[tmp.length-1]]=1;}
if(x.indexOf("famille_")>-1)
{tmp=x.split("_");famille[tmp[tmp.length-1]]=tab_result[x];}}
for(var i=0,x=packs_id.length;i<x;i++)
{detail_id=packs_id[i];var assurance_actif=false;if($('packassurancevol_'+detail_id)&&document.getElementById('packassurancevol_'+detail_id).checked){assurance_actif=true;}
if($('packassurancesecours_'+detail_id)&&document.getElementById('packassurancesecours_'+detail_id).value==1){assurance_actif=true;}
if($('prenom_new_'+detail_id))
{prenom_id='prenom_new_'+detail_id;}
else
{prenom_id='prenom_'+detail_id;}
if($('taille_new_'+detail_id))
{taille_id='taille_new_'+detail_id;}
else
{taille_id='taille_'+detail_id;}
if($('poids_new_'+detail_id))
{poids_id='poids_new_'+detail_id;}
else
{poids_id='poids_'+detail_id;}
if($('pointure_new_'+detail_id))
{pointure_id='pointure_new_'+detail_id;}
else
{pointure_id='pointure_'+detail_id;}
if(assurance_actif&&$(prenom_id).value==''){var_return_assurance_prenom=false;}
if($(prenom_id).value=='')
{if(display_errors){$(prenom_id).setStyle({background:'#ff0000'});}
var_return=false;}
else
{$(prenom_id).setStyle({background:'#ffffff'});}
if($(taille_id).value==''&&famille[detail_id]!=8&&famille[detail_id]!=11&&famille[detail_id]!=7)
{if(display_errors){$(taille_id).setStyle({background:'#ff0000'});}
var_return=false;}
else
{$(taille_id).setStyle({background:'#ffffff'});}
if($(poids_id).value==''&&famille[detail_id]!=8&&famille[detail_id]!=11&&famille[detail_id]!=7)
{if(display_errors){$(poids_id).setStyle({background:'#ff0000'});}
var_return=false;}
else
{$(poids_id).setStyle({background:'#ffffff'});}
if($(pointure_id).value==''&&(shoes[detail_id]==1||famille[detail_id]==8||famille[detail_id]==11)&&famille[detail_id]!=7)
{if(display_errors){$(pointure_id).setStyle({background:'#ff0000'});}
var_return=false;}
else
{$(pointure_id).setStyle({background:'#ffffff'});}}
verifpersodisplayed=true;if(!var_return_assurance_prenom){new Ajax.Updater('pop_login','/personnalisation/getAssurancePrenom',{asynchronous:false,evalScripts:true,method:'get'});_typeface_js.renderDocument();$('pop_login').style.display='block';verifpersodisplayed=false;}
else if(!var_return){new Ajax.Updater('pop_login','/personnalisation/getPersoConseillee',{asynchronous:false,evalScripts:true,method:'get'});_typeface_js.renderDocument();$('pop_login').style.display='block';}
return var_return&&var_return_assurance_prenom;}
function verifPackJuniorPanier(form,taille,pointure)
{var form_with_results=form.split("&");var tab_result=new Array();var pack_junior_id=new Array();var var_return=true;var tmp=null;var detail_id=null;var taille_id=null;var pointure_id=null;for(var i=0,x=form_with_results.length;i<x;i++)
{tmp=form_with_results[i].split("=");tab_result[tmp[0]]=tmp[1];}
for(x in tab_result)
{if(x.indexOf("ispackjunior_")>-1&&tab_result[x]=='1')
{tmp=x.split("_");pack_junior_id.push(tmp[1]);}}
for(var i=0,x=pack_junior_id.length;i<x;i++)
{detail_id=pack_junior_id[i];if($('taille_new_'+detail_id))
{taille_id='taille_new_'+detail_id;}
else
{taille_id='taille_'+detail_id;}
if($('pointure_new_'+detail_id))
{pointure_id='pointure_new_'+detail_id;}
else
{pointure_id='pointure_'+detail_id;}
if($(taille_id).value!=''&&parseInt($(taille_id).value)>parseInt(taille))
{$(taille_id).setStyle({background:'#ff0000'});var_return=false;}
else
{$(taille_id).setStyle({background:'#ffffff'});}
if($(pointure_id).value!=''&&parseInt($(pointure_id).value)>parseInt(pointure))
{$(pointure_id).setStyle({background:'#ff0000'});var_return=false;}
else
{$(pointure_id).setStyle({background:'#ffffff'});}}
if(!var_return){new Ajax.Updater('pop_login','/personnalisation/getPackJuniorLimitePanier',{asynchronous:false,evalScripts:true,method:'get'});$('pop_login').style.display='block';}
return var_return;}
function verifPackBabyPanier(form,taille,pointure)
{var form_with_results=form.split("&");var tab_result=new Array();var pack_baby_id=new Array();var var_return=true;var tmp=null;var detail_id=null;var taille_id=null;var pointure_id=null;for(var i=0,x=form_with_results.length;i<x;i++)
{tmp=form_with_results[i].split("=");tab_result[tmp[0]]=tmp[1];}
for(x in tab_result)
{if(x.indexOf("ispackbaby_")>-1&&tab_result[x]=='1')
{tmp=x.split("_");pack_baby_id.push(tmp[1]);}}
for(var i=0,x=pack_baby_id.length;i<x;i++)
{detail_id=pack_baby_id[i];if($('taille_new_'+detail_id))
{taille_id='taille_new_'+detail_id;}
else
{taille_id='taille_'+detail_id;}
if($('pointure_new_'+detail_id))
{pointure_id='pointure_new_'+detail_id;}
else
{pointure_id='pointure_'+detail_id;}
if($(taille_id).value!=''&&parseInt($(taille_id).value)>parseInt(taille))
{$(taille_id).setStyle({background:'#ff0000'});var_return=false;}
else
{$(taille_id).setStyle({background:'#ffffff'});}
if($(pointure_id).value!=''&&parseInt($(pointure_id).value)>parseInt(pointure))
{$(pointure_id).setStyle({background:'#ff0000'});var_return=false;}
else
{$(pointure_id).setStyle({background:'#ffffff'});}}
if(!var_return){new Ajax.Updater('pop_login','/personnalisation/getPackBabyLimitePanier',{asynchronous:false,evalScripts:true,method:'get'});$('pop_login').style.display='block';}
return var_return;}
function selectSurclassement(){new Ajax.Updater('pop_login','/personnalisation/surclassement',{asynchronous:false,evalScripts:true,method:'get'});$('pop_login').style.display='block';placementpopup('bg_pop_login');}
function pasDeProduitOffert(){new Ajax.Updater('pop_login','/personnalisation/PasDeProduitOffert',{asynchronous:false,evalScripts:true,method:'get'});$('pop_login').style.display='block';}
function hideCustomField(rayonId,packId){$('form_personnalisation_'+rayonId+'_'+packId).hide();}
function showCustomField(rayonId,packId){$('form_personnalisation_'+rayonId+'_'+packId).show();}
function getQuantity(rayonId,packId){if($('quantite_'+packId).getValue()==1){showCustomField(rayonId,packId);}else{hideCustomField(rayonId,packId);}}
function getQuantityFichePack(rayonId,packId){if($('quantite_'+packId).getValue()==1){showCustomField(rayonId,packId);$('custom_personn').show();}else{hideCustomField(rayonId,packId);$('custom_personn').hide();}}
function hideSelect()
{var select=$$('select');var selectLength=select.length;var i;for(i=0;i<selectLength;i++)
{Element.hide(select[i]);}}
function showSelect()
{var select=$$('select');var selectLength=select.length;for(i=0;i<selectLength;i++)
{Element.show(select[i]);}}
function testEmail(email){var regEmail=new RegExp("^[a-z0-9_]([.-]?[a-z0-9_]+)+@[a-z0-9_]([.-]?[a-z0-9_]+)+\.([a-z]{2,4}|[a-z]{6})$","i");return regEmail.test(email);}
function videPersonnalisation(id){var divPerso=$(id);if(typeof(divPerso)!="undefined"){divPerso.getElementsBySelector('input[type="text"]').each(function(inpPerso){inpPerso.value="";});}}
