function spgiDateHeureToString(b){var c=new Array("Dimanche","Lundi","Mardi","Mercredi","Jeudi","Vendredi","Samedi"),a=new Array("janvier","février","mars","avril","mai","juin","juillet","août","septembre","octobre","novembre","décembre");return c[b.getDay()]+" "+b.getDate()+" "+a[b.getMonth()]+" "+((b.getYear()<999)?(b.getYear()+1900):b.getYear())+" à "+b.getHours()+"h"+((b.getMinutes()<10)?"0"+b.getMinutes():b.getMinutes())}function spgiDateSeuleToString(b){var c=new Array("Dimanche","Lundi","Mardi","Mercredi","Jeudi","Vendredi","Samedi"),a=new Array("janvier","février","mars","avril","mai","juin","juillet","août","septembre","octobre","novembre","décembre");return c[b.getDay()]+" "+b.getDate()+" "+a[b.getMonth()]+" "+((b.getYear()<999)?(b.getYear()+1900):b.getYear())}function spgiMiniDateHeureToString(c,a){var e=new Array("Dimanche","Lundi","Mardi","Mercredi","Jeudi","Vendredi","Samedi");return((c.getDate()<10)?"0"+c.getDate():c.getDate())+"/"+((c.getMonth()+1<10)?"0"+(c.getMonth()+1):c.getMonth()+1)+"/"+((c.getYear()<999)?(c.getYear()+1900):c.getYear())+" à "+((c.getHours()<10)?"0"+c.getHours():c.getHours())+"h"+((c.getMinutes()<10)?"0"+c.getMinutes():c.getMinutes())+(a?" ("+e[c.getDay()]+")":"")}function listeEvenements(j){var d,a=1,h,c=[],e=window.parent.spgi,b=[],f=e.venteSeance.maxSeancesPage;majDispoSeances();if(f){if(!j||j<0){j=0}if(e.listS.tri=="chrono"){a=Math.ceil(e.venteSeance.seances.length/f)}else{a=Math.ceil(e.venteSeance.spectacles.length/f)}h=(j+f)/f;if(h==0){h=1}if(a>1){c.push("<div class='seancesPageNav' align='center'>");if(h>1){c.push("<a class='previous' href='javascript:listeEvenements("+(j-f)+")'>Page Précédente</a> -  ")}c.push(h+" sur "+a);if(h<a){c.push(" -  <a class='next' href='javascript:listeEvenements("+(j+f)+")'>Page Suivante</a>")}c.push("</div>");b.push(c.join("\n"))}}if(e.listS.tri=="chrono"||e.venteSeance.spectacles.length==1){for(d=j||0;d<e.venteSeance.seances.length;d++){if(f&&((d-j>f-1))){break}b.push(spgiPresentationSpectacle(e.venteSeance.seances[d]))}}else{for(d=j||0;d<e.venteSeance.spectacles.length;d++){if(f&&(d-j>f-1)){break}b.push(spgiPresentationSpectacle(e.venteSeance.spectacles[d]))}}if(e.venteSeance.seances.length==0||e.venteSeance.spectacles.length==0){b.push('<div class="title">Aucun évènement disponible</div>')}if(f&&a>1){b.push(c.join("\n"))}$("#listeSeances").fadeOut("normal",function(){$("#listeSeances").empty().append(b.join("\n")).fadeIn("normal");pimg()});if(e.linkOpen){e.linkOpen=false}}function spgiAnimSlide(a){$("#"+a).slideToggle("normal")}function spgiPresentationSpectacle(w,o,m,r){var v=["<div class='presentationSpectacle"+((o)?"Abo":"")+"'>"],d=['<div class="actionsSpectacle">'],p=['<div class="zoneImageSpectacle">'],a=['<div class="infosSpectacle">'],b,f,h,t,y,k,e,u=window.parent.spgi,x,q,l,j,c=o?"chrono":u.listS.tri;if(u.venteSeance.seances.length==1&&!o){initCrtListS();seanceEnCommande(w);return}if(c=="chrono"||u.venteSeance.spectacles.length==1){y=w;k=u.seances[w];q=u.spectacles[k.spectacle];b=q.t;j=1}else{x=w;b=u.spectacles[x].tL;q=u.spectacles[x];j=b.length;k=u.seances[b[0]];y=(j==1)?b[0]:null}l=(u.topMenu.width==762?"":"small/")+(q.f1||u.defaultSpectacleImg);switch(j){case 0:f="Pas de représentation";h="";break;case 1:f=(k.noDate||k.hideDate?"Du "+k.txt2+" au "+k.txt3:spgiDateHeureToString(k.date).toUpperCase());h=(u.villeTxt1?"<B>Ville</B> : "+k.txt1+"  |  ":"")+"<B>Lieu</B> : "+u.sites[k.site].s;if(k.reste>0){if(o){d.push('<b><a class="button" href="#" onClick="spgiDoValideChoixSeanceAb(\''+m+"', '"+y+"');\">Ajouter cette séance</a></b><br/>"+(r?toMoneyChar(u.lTarifs[r].prix+u.optionsInternet.filiere.fraisPlace):""))}else{d.push('<b><a class="button" href="#" onClick="seanceEnCommande('+y+');">Commander >></a></b><br />')}}else{d.push('<span class="lblComplet">'+u.lblComplet+"</span><br />")}break;default:h="<B>Lieu</B> : "+u.sites[k.site].s;for(t=1;t<j;t++){if(k.site!=u.seances[b[t]].site){h="<B>Lieu</B> : en fonction de la séance";break}}f=k.noDate||k.hideDate?"Du "+k.txt2+" au "+k.txt3:"Du "+spgiDateSeuleToString(k.date).toUpperCase()+" au "+spgiDateSeuleToString(u.seances[b[j-1]].date).toUpperCase();d.push('<a class="button" href="javascript:;" onClick="spgiAnimSlide(\'datesSpect'+w+"');\">Choisir une date</a><br/>");break}if(u.venteSeance.lblPlacesDispo&&j==1&&k.reste>0){d.push("<br/>"+u.venteSeance.lblPlacesDispo+" : <b>"+k.reste+"</b><br/>")}else{d.push("<br/> <br/>")}if(!o){if(q.txt){d.push('<br/><b><a class="button" href="javascript:;" onClick="spgiAnimSlide(\'txtSpect'+w+'\');">+ d\'infos <img class="lienImage" src="/img/miniLoupe.gif" style="position:relative;top:4px;" alt="loupe"></a></b></div>');p.push('<img id="img'+y+'" src="img/'+l+'" alt="Image du spectacle" class="pimg imgSpectacle"'+(j<2?'onClick="seanceEnCommande('+y+')"':"onClick=\"spgiAnimSlide('datesSpect"+w+"');\"")+"></div>");a.push("<a "+(j<2?'href="javascript:seanceEnCommande('+y+')"':"href=\"javascript:spgiAnimSlide('datesSpect"+w+"');\"")+'"><span class="littleTitle">'+(u.venteSeance.seanceMode?k.libelle+"</span></a>"+(q.compagnie?"<I> ("+q.compagnie+")</I>":"")+'<br /><span class="secondTitre">'+q.s+"</span>":q.s+"</span></a>"+(q.compagnie?"<I> ("+q.compagnie+")</I>":"")+"<br/>")+"<br/><div><b>"+f+"</b><br><B>Thème</B> : "+u.themes[k.theme].s+"<br/>"+h+"</div>");a.push('<div id="txtSpect'+w+'" class="textePresentationSpectacle" style="display:none"><hr><b>Présentation : </b>'+q.txt+"</div>")}else{d.push("</div>");p.push('<img id="img'+y+'" src="img/'+l+'" alt="Image du spectacle" class="pimg imgSpectacle"'+(j<2?'onClick="seanceEnCommande('+y+')"':"onClick=\"spgiAnimSlide('datesSpect"+w+"');\"")+"></div>");a.push("<a "+(j<2?'href="javascript:seanceEnCommande('+y+')"':"href=\"javascript:spgiAnimSlide('datesSpect"+w+"');\"")+'"><span class="littleTitle">'+(u.venteSeance.seanceMode?k.libelle+"</span></a>"+(q.compagnie?"<I> ("+q.compagnie+")</I>":"")+'<br /><span class="secondTitre">'+q.s+"</span>":q.s+"</span></a>"+(q.compagnie?"<I> ("+q.compagnie+")</I>":"")+"<br/>")+"<br/><div><b>"+f+"</b><br><B>Thème</B> : "+u.themes[k.theme].s+"<br/>"+h+"</div>")}}else{d.push('<b><a class="button" href="javascript:;" onClick="spgiAnimSlide(\'txtSpect'+w+'\');">+ d\'infos <img class="lienImage" src="/img/miniLoupe.gif" style="position:relative;top:4px;" alt="loupe"></a></b></div>');p.push('<img src="img/'+l+'" alt="Image du spectacle" class="pimg imgSpectacleAbo"></div>');a.push('<span class="littleTitle">'+(u.venteSeance.seanceMode?k.libelle+"</span>":q.s+"</span>")+(q.compagnie?"<I> ("+q.compagnie+")</I>":"")+"<br/>"+f+"<br><B>Thème</B> : "+u.themes[k.theme].s+"<br/>"+h);a.push('<div id="txtSpect'+w+'" class="textePresentationSpectacle" style="display:none"><hr><b>Présentation : </b>'+q.txt+"</div>")}if(j>1){a.push('<div id="datesSpect'+w+'" class="datesSpectacle" style="display:none"><hr><table width="100%"><tr><th>Date</th><th>Lieu</th><th>Places</th><th></th></tr>');for(t=0;t<j;t++){e=u.seances[b[t]];a.push("<tr><td>"+spgiMiniDateHeureToString(e.date,true)+"</td><td>"+u.sites[e.site].s+"</td><td>"+(e.reste>0?e.reste:'<span class="lblComplet">0</span>')+'</td><th align="right">'+(e.reste>0?'<a class="button" href="#" onClick="javascript:seanceEnCommande('+b[t]+');">Commander >></a>':'<span class="lblComplet">'+u.lblComplet+"</span>")+"</th></tr>")}a.push("</table></div></div>")}else{a.push("</div>")}v=v.concat(d);v=v.concat(p);v=v.concat(a);v.push("</div>");return(v.join("\n"))}function presenteSpectacleAbo(a){$("div#seanceEnCommande").empty();spgiPresentationSeance(a);$("div#seanceEnCommande").dialog({autoOpen:false,bgiframe:true,close:function(b,c){$("div#seanceEnCommande").dialog("destroy")},modal:true,dialogClass:"choixSeanceAb",title:"Présentation...",width:$("body").width()}).dialog("open")}function seanceEnCommande(a){majDispoSeances();window.parent.spgi.seanceAct=a;setTimeout('window.parent.frames[0].location.href = "seance.html"',0)}spgiBarreOutilsListeSeances={listComboSTS:function(m){var e,b,a,f,h=window.parent.spgi,d=[],k={site:h.listS.site,theme:h.listS.theme,spectacle:h.listS.spectacle,srv:h.listS.srv,ville:h.listS.ville,idPeriode:h.listS.idPeriode};switch(m){case 1:k.site="a";a=h.sites;break;case 2:k.theme="a";a=h.themes;break;case 3:k.spectacle="a";a=h.spectacles;break;case 4:k.srv="a";a=h.serveurs;break;case 5:k.ville="a";a=h.villes;break;case 6:k.idPeriode="a";a=h.periodes;break;default:return null}for(e=0;e<a.length;e++){if(m==6){f=a[e].tL}else{f=a[e].t}for(b=0;b<f.length;b++){if(goodSeanceL(f[b],k)||(m==6&&e==a.length-1)){d.push(e);break}}}return d},onChgtSTS:function(d,b){if(!d){return false}var c=window.parent.spgi,a=d.substr(1);switch(d.charAt(0)){case"1":c.listS.site=a;break;case"2":c.listS.theme=a;break;case"3":c.listS.spectacle=a;break;case"4":c.listS.srv=a;break;case"5":c.listS.ville=a;break;case"6":c.listS.idPeriode=a;break;default:return false}c.listS.fait=false;computeCrtListS();if(window.parent.frames[0]&&window.parent.frames[0].location.href.search("spectacles.html")>-1){spgiBarreOutilsListeSeances.handler();listeEvenements()}else{setTimeout('window.parent.frames[0].location.href = "spectacles.html"',0)}},makeHTML:function(y,p){var k=window.parent.spgi,o,e,h,f,s,r,w,q,m,n=!k.venteSeance.affType||k.venteSeance.affType=="listeMini";for(h=0;h<p.length;h++){o=p[h];if(o.capts){y.push('<div id="outilsTri" class="button"><div class="spgiSelect"><a class="button ui-state-default ui-corner-all ui-button" onClick="spgiSwitchOrdreListeSeances();" name="tri" title="'+o.title+'">'+(k.listS.tri?o.capts[0]:o.capts[1])+'<span class="ui-icon ui-icon-circle-triangle-s button"/></a></div><div id="periodeChoix" style="display:none">Début: <div id="dPeriode"/><br/>Fin : <div id="fPeriode"/></div>')}else{switch(o.name){case"lieu":e=k.sites;r=k.listS.site;s=1;break;case"theme":e=k.themes;r=k.listS.theme;s=2;break;case"spectacle":e=k.spectacles;r=k.listS.spectacle;s=3;break;case"serveur":e=k.serveurs;r=k.listS.srv;s=4;break;case"ville":e=k.villes;r=k.listS.ville;s=5;break;case"période":e=k.periodes;r=k.listS.idPeriode;s=6;break;default:return}m=this.listComboSTS(s)||[];if(n){y.push('<select name="c_'+o.name+'" onchange="spgiBarreOutilsListeSeances.onChgtSTS(this.value)" title="'+(o.title?o.title:"Choissez un "+o.name+"dans cette liste")+'">');y.push('<option value="'+s+'a">Choisir un '+o.name+"</option>");w=m.length==1;for(f=0;f<m.length;f++){y.push('<option value="'+s+""+(q=m[f])+'"'+(w||q==r?" selected>":">")+e[q].s+"</option>")}y.push("</select></div></div>")}else{y.push(spgiSelect("menu"+o.name,s,"Choix de "+o.name.toUpperCase(),m,e,r))}}}},handler:function(d){var c=[],a=window.parent.spgi.barreOutilsListeSeances;this.makeHTML(c,a);$("div#outilsTri").replaceWith(c.join("\n"))}};function goodSeanceL(a,d){var b=window.parent.spgi;if(!isNaN(a)){a=b.seances[a]}return a.dispoS&&(a.reste>0||b.lblComplet)&&(d.site=="a"||a.site==d.site)&&(d.theme=="a"||a.theme==d.theme)&&(d.spectacle=="a"||a.spectacle==d.spectacle)&&(d.srv=="a"||a.serveur==d.srv)&&(d.ville=="a"||b.sites[a.site].ville==d.ville)&&(d.idPeriode=="a"||(a.date>b.periodes[d.idPeriode].dPeriode&&a.date<b.periodes[d.idPeriode].fPeriode))}function spgiSwitchOrdreListeSeances(){var a=window.parent.spgi;a.listS.tri=(a.listS.tri?"":"chrono");listeEvenements();spgiBarreOutilsListeSeances.handler()}function computeCrtListS(){var c,b=function(g,f){if(!(g||g===0)){g="a"}if(g=="a"||!isNaN(g)){return g}if(f){for(c=0;c<f.length;c++){if(g==f[c].nom){return c}}}return"a"},e=window.parent.spgi,a,d;if(!e.listS){e.listS={fait:false,affType:e.venteSeance.affType||"listeMini",tri:e.venteSeance.tri}}if(e.listS.fait){return}e.listS.site=b(e.listS.site,e.sites);e.listS.theme=b(e.listS.theme,e.themes);e.listS.spectacle=b(e.listS.spectacle,e.spectacles);e.listS.srv=b(e.listS.srv,e.serveurs);e.listS.ville=b(e.listS.ville,e.villes);e.venteSeance.seances=[];e.venteSeance.spectacles=[];e.listS.idPeriode=(e.listS.idPeriode==null)?"a":e.listS.idPeriode;for(c=0;c<e.sites.length;c++){e.sites[c].tL=[]}for(c=0;c<e.themes.length;c++){e.themes[c].tL=[]}for(c=0;c<e.spectacles.length;c++){e.spectacles[c].tL=[]}if(e.serveurs){for(c=0;c<e.serveurs.length;c++){e.serveurs[c].tL=[]}}if(e.villes){for(c=0;c<e.villes.length;c++){e.villes[c].tL=[]}}for(c=0;c<e.periodes.length;c++){e.periodes[c].tL=[]}for(c=0;c<e.seances.length;c++){d=e.seances[c];d.okL=false;if(goodSeanceL(d,e.listS)){d.okL=true;e.venteSeance.seances.push(c);e.sites[d.site].tL.push(c);e.themes[d.theme].tL.push(c);e.spectacles[d.spectacle].tL.push(c);if(e.serveurs){e.serveurs[d.serveur].tL.push(c)}if(e.villes){e.villes[e.sites[d.site].ville].tL.push(c)}for(a=0;a<e.periodes.length;a++){if(e.periodes[a].dPeriode<d.date&&d.date<e.periodes[a].fPeriode){e.periodes[a].tL.push(c)}}}}for(c=0;c<e.spectacles.length;c++){for(a=0;a<e.spectacles[c].t.length;a++){if(e.seances[e.spectacles[c].t[a]].okL){e.venteSeance.spectacles.push(c);break}}}e.listS.fait=true}function spgiSelect(a,g,e,b,c,k){var d,l=[],f,j,h;if(b.length<2){return}if(!k){k=window.parent.spgi.listS[e]}if(k=="a"){f="menuSelectTitle";j=e}else{f="menuSelectTitleSelected";j=c[k].s}if(g==6&&c.length-1!=b[b.length-1]){b.push(c.length-1)}l.push('<div class="spgiSelect"><a class="button ui-state-default ui-corner-all ui-button" href="javascript:spgiAnimSlide(\''+a+"');\">"+(k=="a"?j:"<b>"+j+"</b>")+'<span class="ui-icon ui-icon-circle-triangle-s button"></span></a><div id="'+a+'" class="subMenuOpen" style="display:none"><ul>');l.push('<li class="subMenu" style="font-style:italic" onMouseOver="javascript:this.className=\'subMenuOver\';" onMouseOut="javascript:this.className=\'subMenu\';" onClick="javascript:spgiBarreOutilsListeSeances.onChgtSTS(\''+g+"a');\">Aucune sélection</li>");for(d=0;d<b.length;d++){if(g==6&&c[b[d]].s=="Autre..."){h="javascript:dPeriodeChoix();"}else{h="javascript:spgiBarreOutilsListeSeances.onChgtSTS('"+g+b[d]+"');"}if(b[d]==k){l.push('<li class="subMenuSelected" onMouseOver="javascript:this.className=\'subMenuOver\';" onMouseOut="javascript:this.className=\'subMenuSelected\';" onClick='+h+">"+c[b[d]].s+"</li>")}else{l.push('<li class="subMenu" onMouseOver="javascript:this.className=\'subMenuOver\';" onMouseOut="javascript:this.className=\'subMenu\';" onClick='+h+">"+c[b[d]].s+"</li>")}}l.push("</ul></div></div>");return l.join("\n")}function spgiPresentationSeance(o){var j=window.parent.spgi,q=o>-1?true:false,b,a,u=null,r=q?j.seances[j.spectacles[o].t[0]]:j.seances[j.seanceAct],m=j.spectacles[o||r.spectacle],h,d=j.sites[r.site],p=j.themes[r.theme],k=(j.topMenu.width==762?"":"small/")+(m.f1||j.defaultSpectacleImg),c=[],n=false;if(q){if(j.spectacles[o].tL.length>1){b=spgiDateSeuleToString(j.seances[j.spectacles[o].tL[0]].date);a=spgiDateSeuleToString(j.seances[j.spectacles[o].tL[j.spectacles[o].tL.length-1]].date);u="Du "+b+" au "+a}else{u=spgiDateHeureToString(j.seances[j.spectacles[o].t[0]].date)}}else{for(h=0;h<r.zones.length;h++){if(r.zones[h].typeZone==1){n=true;break}}}c=['<div class="seanceEnCommande"><div class="zoneImageSeance"><img class="imgSeance" class="imgSeance" src="img/'+k+'" alt="Image du spectacle ('+m.f1+')"/></div>','<div class="actionsSeance button">','</div><div class="infosSeance"><span class="title">'+(j.venteSeance.seanceMode?r.libelle+'</span><br /><span class="secondTitre">'+m.s:m.s)+"</span><br/><br/>"+(r.noDate||r.hideDate?"Du "+r.txt2+" au "+r.txt3:("<b>"+(u||"<big>"+spgiDateHeureToString(r.date).toUpperCase()+"</big>")))+"</b>"+(m.tL.length<2||q?"":"<i><a href=\"javascript:spgiBarreOutilsListeSeances.onChgtSTS('3"+r.spectacle+"');\"> (Autres Dates...)</a></i>")+"<br/><b>Thème : </b>"+p.s+"<br/>"+(j.villeTxt1?"<b>Ville :</b> "+r.txt1+"<br/>":"")+"<b>Lieu : </b>"+d.s+(!j.venteSeance.visuPlan||r.notNum>0?"":' <i><a target="_blank" href="/SenousritPGI/dossierOperationJs?op=VisuPlacesResa&societe='+j.societe.id+"&seance="+r.ref+'">(Voir le plan)</i></a>')+"<br/>"+(m.txt?"":"<br/><br/>")];if(m.txt){c.push('<div class="presentationSeance"><b>Présentation : </b>'+m.txt+"</div>")}c.push('<p style="clear:left; padding: 0"></p></div></div>');$("div#seanceEnCommande").append(c.join("\n"))}function spgiMakeFormTarifsSeance(){var E=window.parent.spgi,D=E.seanceAct,r=E.seances[D],A,l,o,h,f,b,q,y,e,G,C=E.seances.length,v=null,B=0,H=0,w=0,c=0,d=1,m=E.venteSeance.zoneCol,a,u=E.venteSeance.fraisCol,x=E.venteSeance.lblPlacesDispo,F=[];for(C=0;C<E.panier.length;C++){if(!E.key&&E.panier[C].seance==D){v=E.panier[C]}}if(E.spectacles[r.spectacle].f2){$("#formTarifsSeance").append('<div id="planZone">'+(!E.venteSeance.visuPlan||r.notNum>0?"":'<a href="/SenousritPGI/dossierOperationJs?op=VisuPlacesResa&societe='+E.societe.id+"&seance="+r.ref+'" target="_blank">')+'<img src="img/'+(E.repImgSpectacles||"")+E.spectacles[r.spectacle].f2+'" alt="Zones de tarifs" style="width:100%"/>'+(!E.venteSeance.visuPlan||r.notNum>0?"":"</a>")+"</div>")}if(E.texteTarifs){$("#formTarifsSeance").append('<div id="planZone" style="background:white none;text-align:left;font-weight:normal;padding-left:5px">'+E.texteTarifs+"</div>")}if(r.reste>0&&r.okL){F=['<form id="CmdSeanceForm" name="CmdSeanceForm" action="javascript:;"><table id="CmdSeanceFormTable" class="ui-widget ui-widget-content"'+(E.spectacles[r.spectacle].f2==""&&(!E.texteTarifs||E.texteTarifs=="")?' style="width:100%"':"")+">"];for(D=0;D<r.zones.length;D++){l=r.zones[D];l.sais=[];if(l.reste>0&&l.tarifs.length>0&&!m){F.push("<tr "+(E.venteSeance.zoneColor&&l.color?' style="background-image:none;background-color:#'+l.color+'"':'class="ui-widget-header"')+'><th colspan="'+(u?5:4)+'">Zone tarifaire : '+l.nom);if(x){F.push("("+l.reste+" "+x+")")}F.push("</th>");a=!m;for(C=0;C<l.tarifs.length;C++){e=l.tarifs[C];o=E.lTarifs[e];h=D+"_"+C;f="";b=0;q=0;if(v){for(A=0;A<v.c.length;A++){if(v.c[A].zt==h){f=v.c[A].v;q=toMoney((y=fraisForTarif(o,r))*f);b=toMoney(f*(parseFloat(o.prix)+(E.fraisCompris?y:0)));H=parseFloat(H)+parseFloat(q);B=parseFloat(B)+parseFloat(b);w=parseInt(w)+parseInt(f);break}}}l.sais.push(f);if(f||(o.groupe&E.optionsInternet.operateur.groupe)){if(a){a=false}G=E.fraisCompris?parseFloat(o.prix)+fraisForTarif(o):o.prix;F.push('<tr><td align="left">'+o.libelle+'</td><td align="center">'+toMoneyChar(G)+'</td><td align="right">x <input type="number" name="qtt_'+h+'" id="qtt_'+h+'" title="Quantité" value="'+(f||0)+'" size="5" maxlength="2" tabindex="'+d+'" onchange="qttChange(this)" onkeyup="qttChange(this)" onFocus="select()" style="text-align: right" lTarif="'+e+'"></td><td align="right"><input type="text"  name="stotal_'+h+'" value="'+toMoneyChar(b)+'" readonly style="text-align: right"></td>'+(u?'<td><input type="text" name="sfrais_'+h+'" value="'+toMoneyChar(q)+'" readonly style="text-align: right"></td>':"")+"</tr>");d++;c++}}}}F.push('<tr class="ui-widget-header"><th colspan="2">Total :</th><th align="right">Qté : <input type="text" name="nbtotal" value="'+w+'" size="5" readonly style="text-align: right"></th><th align="right"><input type="text" name="totalplaces" value="'+toMoneyChar(B)+'" readonly style="text-align: right"></th>'+(u?'<th><input type="text" name="totalfrais" value="'+toMoneyChar(H)+'" size="9" readonly style="text-align: right"></th>':""));F.push('</tr>\n</table></form><div style="clear:both"/>')}else{F.push('<div class="seanceEnCommande"><img src="/img/attention.png" style="float:left;margin-right:10px;"/><b>Attention !</b> Il n\'y a plus de place disponible pour la vente en ligne.<br />'+(E.venteSeance.txtPlusPlaces?E.venteSeance.txtPlusPlaces:"<br /><br /><br />")+"</div>")}$("div#formTarifsSeance").append(F.join("\n"));$("#content").append('<div class="action"><span class="button"><a href="javascript:addSeanceToPanier();" class="button ui-button ui-state-default ui-corner-all" tabindex="'+d+'"><span class="ui-icon ui-icon-cart button"></span>Ajouter au panier</a></span></div>');$(".ui-button").hover(function(){$(this).addClass("ui-state-hover")},function(){$(this).removeClass("ui-state-hover")})}function fraisForTarif(b,a){var e=window.parent.spgi,d=(isNaN(b)?b:e.lTarifs[b]),c=((e.optionsInternet.filiere.options&64)?0:d.frais);if((parseFloat(d.prix)!=0)||!(e.optionsInternet.filiere.options&16)){c=parseFloat(c)+parseFloat(e.optionsInternet.filiere.fraisPlace)}if(e.optionsInternet.filiere.options&32){if(!a){a=e.seances[e.seanceAct]}c=parseFloat(c)+parseFloat(a.fraisPlace)}return c}function toMoneyChar(a){if(isNaN(a)){a=a.substring(0,a.length-1)}return toMoney(a)+window.parent.spgi.moneyChar}function toMoney(d){var b,a,c=(parseFloat(d)<0?"-":"");if(c){d=-d}a=String(parseFloat(d)*100+0.5);b=a.indexOf(".");if(b>0){a=a.substr(0,b)}b=a.length;if(b<=1){a="0.0"+a}else{if(b==2){a="0."+a}else{a=a.substr(0,b-2)+"."+a.substr(b-2)}}return c+a}function qttChange(k){var d,b,m,n,q,a,f=window.parent.spgi,e=k.name.slice(4),l=k.form,o=l.elements["stotal_"+e],h=l.elements["sfrais_"+e];o.value="";if(h){h.value=""}if(k.value.length>0){for(d=0;d<k.value.length;d++){m=k.value.charAt(d);if(m<"0"||m>"9"){alert("La quantité doit être un nombre entier");k.value=""}}}if(isNaN(b=k.value)){b=0}a=e.split("_");n=f.seances[f.seanceAct].zones[a[0]];q=f.lTarifs[n.tarifs[d=a[1]]];n.sais[d]=parseInt(b);o.value=toMoneyChar(b*(f.fraisCompris?parseFloat(q.prix)+fraisForTarif(q):q.prix));if(h){h.value=toMoneyChar(b*fraisForTarif(q))}doTotalSeance(l)}function doTotalSeance(a){nbPlaces(a);doTotalPlaces(a);doTotalFrais(a)}function doTotalFrais(c){var b,d,a=0;for(b=0;b<c.elements.length;b++){d=c.elements[b];if(d.name.slice(0,3)=="qtt"&&!isNaN(d.value)){a=parseFloat(a)+parseFloat(d.value*fraisForTarif(lTarifOfInput(d.name.slice(4))))}}if(c.totalfrais){c.totalfrais.value=toMoneyChar(a)}return a}function doTotalPlaces(b){var a,d,c=0;for(a=0;a<b.elements.length;a++){d=b.elements[a];if(d.name.slice(0,6)=="stotal"&&d.value!=""){c=parseFloat(d.value.substring(0,d.value.length-1))+parseFloat(c)}}if(b.totalplaces){b.totalplaces.value=toMoneyChar(c)}return c}function nbPlaces(c){var b,a,d=c.elements;nb=0;for(b=0;b<d.length;b++){if((d[b].name.slice(0,3)=="qtt")&&(!isNaN(a=parseInt(d[b].value)))){nb+=a}}if(c.nbtotal){c.nbtotal.value=nb}return nb}function lTarifOfInput(c){var a=window.parent.spgi,b=c.split("_");return a.lTarifs[a.seances[a.seanceAct].zones[b[0]].tarifs[b[1]]]}function addSeanceToPanier(){var k,h,p,u,b,l=window.parent.spgi,o=true,b=l.venteSeance.maxPlacesCom,d=[],q=document.forms.CmdSeanceForm,w=q.totalplaces.value.substring(0,q.totalplaces.value.length-2)||0,a=q.nbtotal.value||0,v=q.totalfrais?q.totalfrais.value:doTotalFrais(q),x=l.seances[l.seanceAct];if(b&&a>b){alert("Vous ne pouvez pas commander plus de "+b+" places pour cette manifestation");return}for(k=0;k<q.elements.length;k++){p=q.elements[k];if(p.name.slice(0,4)=="qtt_"){qttChange(document.getElementById(p.id));if(!isNaN(h=parseInt(p.value))&&p.value>0){d.push({zt:p.name.slice(4),v:h})}}}for(k=0;k<x.zones.length;k++){u=x.zones[k];b=0;for(h=0;h<u.sais.length;h++){b+=parseInt(u.sais[h]||0)}if(b>u.reste){alert("Attention !\nVotre demande ne pourra pas être satisfaite puisque vous demandez à réserver "+b+' places en "'+u.nom+'" où il ne reste que '+u.reste+" places disponibles");return}}spgiTestClearPanier();var r={deroule:1,seance:l.seanceAct,nbPlaces:a,total:w,frais:v,c:d};for(k=0;k<l.panier.length;k++){if(l.panier[k].seance==l.seanceAct){if(d.length>0){l.panier[k]=r;o=false;l.panierAct=k}else{if(!l.oldPanier){l.panier.splice(k,1);o=false}}break}}if(o&&d.length>0){l.panier.push(r);l.panierAct=l.panier.length-1}if(a>0){setTimeout('window.parent.frames[0].location.href = "panier.html"',0)}else{alert("Votre commande est vide")}}function testCommandesPlacees(d){var c,e=window.parent.spgi,b,f=e.panier[d].seance,a=false;for(c=0;c<e.panier[d].c.length;c++){b=e.panier[d].c[c].zt.substring(0,e.panier[d].c[c].zt.indexOf("_",0));if(e.seances[f].zones[b]){a=true;break}}return a}function spgiClearPanier(a){var b=window.parent.spgi;b.panier=[];b.p={nbPlaces:0,total:0,frais:0,port:[]};b.aPayer=0;b.totalPanier=0;b.fraisPanier=0;b.key=null;b.oldPanier=false;if(a){setTimeout('window.parent.frames[0].location.href = "accueil.html"',0)}}function spgiTestClearPanier(){var a=window.parent.spgi;if(a.oldPanier||a.key){spgiClearPanier()}}spgiShowPanier={delCmdClick:function(a,c){var b=window.parent.spgi;b.panier.splice(a,1);if(b.panier.length==0){handleDestructor();setTimeout('window.parent.frames[0].location.href = "accueil.html"',0)}else{spgiShowPanier.handler()}},derouleClick:function(a,b){window.parent.spgi.panier[a].deroule=!window.parent.spgi.panier[a].deroule;spgiShowPanier.handler()},handler:function(){var O=window.parent.spgi,L,J,H,q,Q,G,F,D,w,z,M,C,n,u,S,V,A,R,E=[],d=[],h=true,B=[],b="",a=0,K=0,f=[],e=[],o=0,I=0,U=0,y=O.venteSeance.fraisCol,N=0,T=null,P=['<div class="ui-widget"><form name="panierForm"><table class="ui-widget ui-widget-content panier" style="width:100%"><tr class="ui-widget-header"><th colspan="4" align="center">Actions</th><th colspan="2" align="center">Produit</th><th align="center">Réf.</th><th align="center">Qté.</th><th align="center">Montant</th>'+(y?'<th align="center">'+y+"</th>":"")+"</tr>"];O.aPayer="";if(!O.p){O.p={}}for(L=0;L<O.panier.length;L++){Q=O.panier[L];o+=Q.formule>-1?parseInt(Q.nbPlacesTotal):parseInt(Q.nbPlaces);I=parseFloat(I)+parseFloat(Q.total);U=parseFloat(U)+parseFloat(Q.frais);if(Q.deroule){C="En";n="Cach"}else{C="De";n="Montr"}A=!isNaN(Q.ref)&&(Q.ref>=0);if(!A){N++}u='<tr class="seancePanier"><td'+(A?">":' align="center"><a class="lienImage" title="Annuler la commande de ce produit" href="javascript:;" onClick="spgiShowPanier.delCmdClick(\''+L+'\');"><img src="/img/miniAnnule.png"></a>')+"</td><td"+(A?">":' align="center"><a class="lienImage" title="Modifier cette commande" href="javascript:;" onClick="spgiDoModifPanierAct('+L+');"><img src="/img/miniModif.png"></a>')+'</td><td align="center"><a class="lienImage" title="'+n+'er le détail de cette commande" href="javascript:;" onClick="spgiShowPanier.derouleClick(\''+L+'\');"><img src="/img/mini'+C+'roule.png"></a></td>';if(!isNaN(Q.seance)&&Q.seance>-1&&Q.ref&&O.venteSeance.visuPlan){u+='<td align="left"><a class="lienImage" title="Visualiser vos places" href="'+O.serveurAppURL+"dossierOperationJs?op=VisuPlacesResa&societe="+O.societe.id+"&ref="+Q.ref+'" target="_blank"><img src="/img/miniLoupeCli.gif"></a></td>'}else{u+="<td></td>"}u+='<td colspan="2" class="seancePanier" style="padding: 10px 0px">';S='</td><td align="center"><b>'+(A?Q.ref:"")+'</b></td><td align="center"><b>'+Q.nbPlaces+'</b></td><td align="right"><b>'+toMoneyChar(Q.total)+"</b></td>"+(y?'<td align="right"><b>'+toMoneyChar(Q.frais)+"</b></td>":"")+"</tr>";if(!isNaN(q=Q.seance)){if(q==-1){P.push(u+'<big><b><img src="img/boutique/'+O.boutique.produits[Q.iProduit].img+'" class="pimg" style="float:left; height: 35px; margin-right: 10px">'+O.boutique.produits[Q.iProduit].nomLong+"</span></b></big><br />Type : "+O.boutique.produits[Q.iProduit].type+"<br />"+S)}else{z=O.seances[q];M=O.spectacles[z.spectacle]||O.defaultSpectacleImg;J=z.date.getTime();if(!T||T>J){T=J}E=[];for(H=0;H<Q.c.length;H++){f=Q.c[H].zt.split("_");e=Q.c[H+1]?Q.c[H+1].zt.split("_"):[];if(!e[0]||e[0]!=f[0]){d.push(H);E[f[0]]=d;d=[]}else{d.push(H)}}P.push(u+"<big><b>"+(O.venteSeance.seanceMode?z.libelle+"</b></big><br />"+M.s+"<br />":M.s+"</b></big><br>")+"<span>"+(z.noDate||z.hideDate?"Du "+z.txt2+" au "+z.txt3:spgiDateHeureToString(z.date))+" ("+O.sites[z.site].s+") </span>"+S);if(Q.deroule){h=true;for(J=0;J<Q.c.length;J++){f=Q.c[J].zt.split("_");e=Q.c[J-1]?Q.c[J-1].zt.split("_"):[];R=z.zones[f[0]].typeZone;w=O.lTarifs[z.zones[f[0]].tarifs[f[1]]];V=y?'<td align="right">'+totalProduit(Q.c[J].v,fraisForTarif(w,z))+O.moneyChar+"</td>":"";if(!e[0]||(z.zones[e[0]].numero!=z.zones[f[0]].numero)){h=!h;P.push("<tr "+(h?'class="zoneClaire"':'class="zoneFoncee"')+'><td colspan="4" align="center"'+(E[f[0]]?' rowspan="'+E[f[0]].length+'">':">"));if(O.venteSeance.choixPlaces&&R&&!Q.ref&&z.notNum<1){P.push('<button type="button" onClick="window.parent.frames[0].location.href=\''+O.serveurAppURL+"dossierOperationJs?op=VisuPlacesResa&societe="+O.societe.id+"&seance="+z.ref+"&nSeance="+q+"&selection=true&panier="+L+"&zone="+z.zones[f[0]].numero+"&nbZones="+E.length+"'\">Choisir<br/>vos places</button></td><td"+(E[f[0]]?' rowspan="'+E[f[0]].length+'"':"")+">- Zone : <B>"+z.zones[f[0]].nom+"</B>"+((R&&Q.c.places&&Q.c.places[f[0]]&&Q.c.places[f[0]].numPlaces.length>0)?'<br/><span class="pSel">- Places choisies: '+(Q.c.places[f[0]].numPlaces.length>1?Array.prototype.join.call(Q.c.places[f[0]].numPlaces,", "):Q.c.places[f[0]].numPlaces[0])+"</span>":'</br><span class="pSel">Aucune place sélectionnée</span>')+"</td><td>Tarif : <b>"+w.libelle+'</b></td><td> </td><td align="center">'+Q.c[J].v+'</td><td align="right">'+totalProduit(Q.c[J].v,w.prix,(O.fraisCompris?fraisForTarif(w,z):0))+O.moneyChar+"</td>"+V+"</tr>")}else{P.push("<td"+(E[f[0]]?' rowspan="'+E[f[0]].length+'"':"")+">- Zone : <B>"+z.zones[f[0]].nom+"</B></td><td>Tarif : <b>"+w.libelle+'</b></td><td> </td><td align="center">'+Q.c[J].v+'</td><td align="right">'+totalProduit(Q.c[J].v,w.prix,(O.fraisCompris?fraisForTarif(w,z):0))+O.moneyChar+"</td>"+V+"</tr>")}}else{P.push("<tr "+(h?'class="zoneClaire"':'class="zoneFoncee"')+"><td>Tarif : <b>"+w.libelle+'</b></td><td> </td><td align="center">'+Q.c[J].v+'</td><td align="right">'+totalProduit(Q.c[J].v,w.prix,(O.fraisCompris?fraisForTarif(w,z):0))+O.moneyChar+"</td>"+V+"</tr>")}}}}}else{if(!isNaN(q=Q.formule)){P.push(u+"<big><b>Abonnement : "+(O.formulesAb[q].nomLong||O.formulesAb[q].nom)+"</b></big>"+S);for(J=0;J<Q.c.length;J++){G=Q.c[J];if((G.iSeance>=0)&&G.zone&&G.tarif&&(G.qtt&1)){z=O.seances[G.iSeance];F=z.date.getTime();R=0;for(H=0;H<z.zones.length;H++){if(G.zone==majuscule(z.zones[H].nom)){f[0]=H;R=z.zones[H].typeZone;break}}if(!T||T>F){T=F}if(Q.deroule){F=G.v?G.v:0;V=y?'<td align="right">'+toMoneyChar(G.f?G.f:0)+"</td>":"";P.push('<tr><td colspan="4" align="center">');if(O.venteSeance.choixPlaces&&R&&!Q.ref&&(z.notNum<1)&&(J==0||!O.formulesAb[q].memesPlaces)){P.push('<button type="button" title="'+((Q.c.places&&Q.c.places[J]&&Q.c.places[J].numPlaces)?(Q.c.places[J].numPlaces.length>1?Q.c.places[J].numPlaces.join(" + "):Q.c.places[J].numPlaces[0]):"Aucune places sélectionnée")+'" onClick="window.parent.frames[0].location.href=\''+O.serveurAppURL+"dossierOperationJs?op=VisuPlacesResa&societe="+O.societe.id+"&seance="+z.ref+"&nSeance="+G.iSeance+"&ligneAbo="+J+"&selection=true&panier="+L+"&zone="+z.zones[f[0]].numero+"&nbZones="+E.length+(G.res&&G.res>-1?"&reservoir="+G.res:"")+"'\">Choisir<br/>vos Places</button>")}else{P.push("")}P.push('</td><td colspan="3">'+spgiTitreSeance(z));if(O.venteSeance.choixPlaces&&R&&!Q.ref&&(z.notNum<1)){P.push('<br/><span class="pSel">- Places : ');if(!O.formulesAb[q].memesPlaces){if(Q.c.places&&Q.c.places[J]&&Q.c.places[J].numPlaces){P.push((Q.c.places[J].numPlaces.length>1?Q.c.places[J].numPlaces.join(", "):Q.c.places[J].numPlaces[0])+"</span>")}else{P.push("Aucune place sélectionnée</span>")}}else{if(Q.c.places&&Q.c.places[0]&&Q.c.places[0].numPlaces){P.push((Q.c.places[0].numPlaces>1?Q.c.places[0].numPlaces.join(", "):Q.c.places[0].numPlaces[0])+"</span>")}else{P.push("Aucune place sélectionnée</span>")}}}P.push('</td><td align="center">'+Q.nbPlaces+'</td><td align="right">'+toMoneyChar(F)+"</td>"+V+"</tr>")}}}}}}O.p.firstDate=T;O.p.nbPlaces=o;if(O.panier.length>0){if(!O.oldPanier&&(G=O.optionsInternet.port)){if(!O.p.port||O.p.port.length==0){O.p.port=clone(G.t)}w=new Date();w=w.getTime();for(L=0;L<O.p.port.length;L++){u=O.p.port[L];u.enabled=!u.delai||(T&&(w+u.delai*3600000)<T);if(!u.enabled){u.checked=false}else{if(u.checked&&isNaN(O.p.checked)){O.p.checked=L}}}if((isNaN(O.p.checked)||!O.p.port[O.p.checked].enabled)&&O.optionsInternet.port.force&&!isNaN(O.optionsInternet.port.defaut)){if(O.p.port[O.optionsInternet.port.defaut].enabled){O.p.checked=O.optionsInternet.port.defaut;O.p.port[O.optionsInternet.port.defaut].checked=true}else{for(L=0;L<O.p.port.length;L++){if(O.p.port[L].enabled){O.p.port[L].checked=true;O.p.checked=L;break}else{O.p.port[L].checked=false;O.p.checked=null}}}}}if(O.p.port&&O.p.port.length>0){P.push('<tr height="21px"><td colspan="9"></td></tr>');for(L=0;L<O.p.port.length;L++){u=O.p.port[L];if(u.checked){for(J=0;J<O.optionsInternet.port.t.length;J++){if(O.optionsInternet.port.t[J].code==u.code){break}}switch(u.multiFrais||O.optionsInternet.port.t[J].multiFrais||0){case 0:I=parseFloat(I)+parseFloat(u.prix);u.qtt=1;break;case 1:u.prix=parseFloat(O.optionsInternet.port.t[J].prix)*O.panier.length;I=parseFloat(I)+parseFloat(u.prix);u.qtt=O.panier.length;break;case 2:u.prix=parseFloat(O.optionsInternet.port.t[J].prix)*O.p.nbPlaces;I=parseFloat(I)+parseFloat(u.prix);u.qtt=O.p.nbPlaces;break}}P.push('<tr><td align="center" colspan="4"><input type="'+(O.optionsInternet.port.force||u.force?"radio":"checkbox")+'" onClick="'+(O.optionsInternet.port.force||u.force?"selectRadio(window.parent.spgi.p.port, "+L+");":"window.parent.spgi.p.port["+L+"].checked=this.checked;")+' spgiShowPanier.handler();" name="cp" '+(u.checked?'checked="checked"':"")+(u.enabled&&!O.key?"":" disabled")+' value="'+u.lbl+'"/></td><td colspan="2" class="modeEnvoi" style="padding: 4px 0px">'+(u.enabled?u.txt:u.txtDelay)+"</td>"+(u.checked?'<td/><td align="center">'+u.qtt+'</td><td align="right">'+(O.optionsInternet.port.t[J].prix!=0?toMoneyChar(u.qtt*O.optionsInternet.port.t[J].prix):"Gratuit"):"<td></td><td>")+"</td>"+(y?"<td></td>":"")+"</tr>")}}if(O.client.idx<0){O.etape=1}else{if(N>0){O.etape=2}else{O.etape=3;O.aPayer=toMoney(parseFloat(I)+(O.fraisCompris?0:parseFloat(U))-(O.dejaPaye?parseFloat(O.dejaPaye):0));if(O.aPayer=="0.00"){O.aPayer=null}}}}else{O.etape=0}O.totalPanier=I;O.fraisPanier=U;O.p.total=I;O.p.frais=U;P.push('<tr class="ui-widget-header"><th colspan="4"></th><th colspan="2" align="center">Total'+(O.fraisCompris&&O.fraisComprisTexte?O.fraisComprisTexte:"")+(U&&!O.fraisCompris?" : <strong>"+toMoneyChar(parseFloat(I)+parseFloat(U))+"</strong>":"")+'</th><th></th><th align="center">'+o+'</th><th align="right">'+toMoneyChar(I)+"</th>"+(y?'<th align="right">'+toMoneyChar(U)+"</th>":"")+"</tr></table>");if(0<O.etape&&O.etape<3){if(O.venteSeance.valideCgv||O.venteSeance.coordToPart){P.push('<div class="seanceEnCommande" style="margin: 20px 0px">');if(O.venteSeance.valideCgv){P.push('<input type="checkbox" name="valideCgv" onclick="javascript:switchChk(\'valideCgv\')"'+(O.venteSeance.valideCgv.v?" checked=checked":"")+"/> "+O.venteSeance.valideCgv.txt+"<br>")}if(O.venteSeance.coordToPart){P.push('<input type="checkbox" name="coordToPart" onclick="javascript:switchChk(\'coordToPart\')"'+(O.venteSeance.coordToPart.v?" checked=checked":"")+"/> "+O.venteSeance.coordToPart.txt)}P.push("</div>")}}if((O.etape<=3||O.aPayer)&&O.panier){P.push('<table class="action"><tr><td></td></tr><tr>');if(!O.dejaPaye&&O.panier.length){P.push('<td><p class="button"><a class="button ui-state-default ui-corner-all ui-button" href="#" onClick="spgiAnnulePanier()" title="Annuler toutes les réservations de ce panier" name="annulerp" tabindex="7">Annuler ce panier<span class="ui-icon ui-icon-trash"></span></a></p></td>')}if(!O.key){P.push('<td><p class="button"><a class="button ui-state-default ui-corner-all ui-button" href="#" onClick="spgiBarreOutilsListeSeances.onChgtSTS(\'3a\');" title="Voir la liste des spectacles" tabindex="8">Continuer vos achats<span class="ui-icon ui-icon-circle-plus"></span></a></p></td>')}if(O.etape<3){P.push('<td><p class="button"><a class="button ui-state-default ui-corner-all ui-button" href="#" title="Valider ces réservations et passer à l\'étape paiement" onClick="spgiValidePanier()">Valider votre panier<span class="ui-icon ui-icon-circle-check"></span></a></p></td>')}else{if(O.aPayer){P.push('<td id="infoPaiement">');if(O.modeTest){P.push('<a href="'+O.serveurAppURL+"ktoPayBox_mzfr?montant="+spgiCentimesAPayer()+"&ref="+O.societe.id+"-"+O.key+'&auto=XXXXX&trans=XXXXX&err=00000">Cliquez ici pour simuler le paiement de '+toMoneyChar(O.aPayer)+" sur PayBox</a><br/>");P.push('<a href="'+O.serveurAppURL+"PayBox_Ok?montant="+spgiCentimesAPayer()+"&ref="+O.societe.id+"-"+O.key+'&auto=XXXXX&trans=XXXXX&err=00000">Cliquez ici pour simuler le retour PayBox *OK*</a><br/>');P.push('<a href="'+O.serveurAppURL+"PayBox_Refuse?montant="+spgiCentimesAPayer()+"&ref="+O.societe.id+"-"+O.key+'&trans=XXXXX&err=00000">Cliquez ici pour simuler le retour PayBox *Refusé*</a><br/>');P.push('<a href="'+O.serveurAppURL+"PayBox_Annule?montant="+spgiCentimesAPayer()+"&ref="+O.societe.id+"-"+O.key+'&trans=XXXXX&err=00000">Cliquez ici pour simuler le retour PayBox *Annulé*</a><br/>');P.push('<a href="'+O.serveurAppURL+"AnnuleUnPanier?op=xpaybox&montant="+spgiCentimesAPayer()+"&ref="+O.societe.id+"%2D"+O.key+'">Cliquez ici pour effectuer le paiement de '+toMoneyChar(O.aPayer)+" sur PayBox *local*</a>")}else{if(O.typePaiements.length>1){P.push("Choisissez votre mode de paiement ("+O.aPayer+O.moneyChar+"):<br/><br/>")}else{P.push("Payer ("+O.aPayer+O.moneyChar+") par:<br/><br/>")}for(L=0;L<O.typePaiements.length;L++){P.push('<a class="logoPaiement" href="#" title="Effectuer le paiement de votre panier" onClick="lienPaiement('+L+')"><img class="logoPaiement" alt="logoPaiement" src="/img/'+O.typePaiements[L].libelle+'.png"></a>')}}P.push("</td>")}}P.push("</tr></table>")}if(O.etape==3&&!O.aPayer&&O.panier&&O.optionsInternet.controleAcces){infoBillets()}P.push("</form></div>");$("div#panier").empty().append(P.join("\n"));$(".ui-button").hover(function(){$(this).addClass("ui-state-hover")},function(){$(this).removeClass("ui-state-hover")});B.push('<div id="progressBar"><table style="width:100%"><tr>');if(O.optionsInternet.controleAcces){b="width=25%";if(O.panier&&O.client.resas){for(L=0;L<O.panier.length;L++){for(J=0;J<O.client.resas.length;J++){if(O.client.resas[J].ref==O.panier[L].ref&&O.client.resas[J].attr&4){K++}else{if(O.client.resas[J].ref==O.panier[L].ref&&(O.client.resas[J].attr&2)){a++}}}}}}else{b="width=33%"}switch(O.etape){case 2:B.push("<td "+b+'><div class="progress1"/>Etape 1<br/><b>Identification</b><br/>'+O.client.nom+" "+O.client.prenom.substr(0,1)+".</td><td "+b+'><div class="progress2_g"/>Etape 2<br/><b>Validation</b><br/>-</td><td '+b+'><div class="progress3_g"  />Etape 3<br/><b>Paiement</b><br/>-</td>');break;case 3:if(O.aPayer>0){B.push("<td "+b+'><div class="progress1"/>Etape 1<br/><b>Identification</b><br/>'+O.client.nom+" "+O.client.prenom.substr(0,1)+".</td><td "+b+'><div class="progress2"/>Etape 2<br/><b>Validation</b><br/>N°'+O.key+"</td><td "+b+'><div class="progress3_g"/>Etape 3<br/><b>Paiement</b><br/>-</td>')}else{B.push("<td "+b+'><div class="progress1"/>Etape 1<br/><b>Identification</b><br/>'+O.client.nom+" "+O.client.prenom.substr(0,1)+".</td><td "+b+'><div class="progress2"/>Etape 2<br/><b>Validation</b><br/>N°'+O.key+"</td><td "+b+'><div class="progress3"/>Etape 3<br/><b>Paiement</b><br/>'+O.p.total+O.moneyChar+"</td>")}break;default:if(O.client.idx>-1){B.push("<td "+b+'><div class="progress1"/>Etape 1<br/><b>Identification</b><br/>'+O.client.nom+" "+O.client.prenom.substr(0,1)+".</td><td "+b+'><div class="progress2_g"/>Etape 2<br/><b>Validation</b><br/>-</td><td '+b+'><div class="progress3_g"/>Etape 3<br/><b>Paiement</b><br/>-</td>')}else{B.push("<td "+b+'><div class="progress1_g"/>Etape 1<br/><b>Identification</b><br/>-</td><td '+b+'><div class="progress2_g"/>Etape 2<br/><b>Validation</b><br/>-</td><td '+b+'><div class="progress3_g"/>Etape 3<br/><b>Paiement</b><br/>-</td>')}break}if(O.optionsInternet.controleAcces){if(O.panier&&K!=O.panier.length&&a==(O.panier.length-K)){B.push("<td "+b+'><div class="progress4"/>Etape 4<br/><b>Impression</b><br/>OK</div></td>')}else{B.push("<td "+b+'><div class="progress4_g"/>Etape 4<br/><b>Impression</b><br/>-</div></td>')}}B.push("</tr></table></div>");$("#progressBar").replaceWith(B.join("\n"));$(".logoPaiement").effect("pulsate",{times:3},"normal");$(".pSel").effect("pulsate",{times:10},1000)}};function switchChk(a){var c=window.parent.spgi.venteSeance;switch(a){case"valideCgv":c.valideCgv.v=!c.valideCgv.v;break;case"coordToPart":c.coordToPart.v=(c.coordToPart.v==0?1:0);break}}function totalProduit(a,b,d,c){if(!a||isNaN(a)){a=1}if(c&&!isNaN(c)){b=parseFloat(b)-(parseFloat(b)*parseFloat(c)/100)}if(d&&!isNaN(d)){b=parseFloat(b)+parseFloat(d)}return toMoney(a*parseFloat(b))}function spgiDoModifPanierAct(d){var b=window.parent.spgi,e,a=null;if(isNaN(d)&&this.varN){d=this.v1}if(isNaN(d)||(d>=b.panier.length)){return false}b.panierAct=d;e=b.panier[d];if(!isNaN(e.seance)){if(e.seance==-1){b.articleAct=e.iProduit;setTimeout('window.parent.frames[0].location.href = "article.html"',0)}else{b.seanceAct=e.seance;a=b.TNSeanceCmd;setTimeout('window.parent.frames[0].location.href = "seance.html"',0)}}else{if(!isNaN(e.formule)){b.formuleAct=e.formule;a=b.TNFormuleAbVente;setTimeout('window.parent.frames[0].location.href = "formule.html"',0)}}}function spgiAnnulePanier(){if(!confirm("Etes-vous sur de vouloir annuler toutes les réservations de ce panier ?")){return}var a,d,b=window.parent.spgi;for(a=b.panier.length-1;a>=0;a--){d=b.panier[a];if(!d.ref||isNaN(d.ref)||(parseFloat(d.ref)<0)){b.panier.splice(a,1)}}if(b.panier.length>0){d=spgiAjax.sendRequest("GET",b.serveurAppURL+"AnnuleUnPanier?"+spgiAjax.encodeArray([{n:"ref",v:(b.societe.id?b.societe.id+"-":"")+b.key}]));if(d&&(d.status==200||d.status===0)){a=spgiFindPanierInHisto(window.parent.spgi.key);if(a){a.etat=3}alert("Votre panier a été annulé.");setTimeout('window.parent.frames[0].location.href = "spectacles.html"',0)}else{alert("Le serveur a refusé d'annuler votre panier !")}b.panier=[]}else{setTimeout('window.parent.frames[0].location.href = "spectacles.html"',0)}b.panierRes=null;b.panierAct=-1;b.p.port=[];b.key="";handleDestructor();spgiShowPanier.handler()}function spgiValidePanier(){var g=window.parent.spgi;if(g.key){alert("Votre panier est déjà en enregistré (Panier n°"+g.key+")");return}if(g.panier.length<=0){alert("Votre panier est vide, il n'y a rien à valider.");return}if(g.client.idx<0){setTimeout('window.parent.frames[0].location.href = "dossier.html"',0);alert("Vous devez d'abord saisir vos coordonnées.\nVous pourrez ensuite valider votre panier.");return}else{if(g.venteSeance.valideCgv&&!g.venteSeance.valideCgv.v){alert("Merci de valider les conditions générales de vente.");return}var i,j,k,x,s,c,l,m,p,v,r,a=[{}],e=0,ti=[],buf=["SPGI 1.0","ValidePanier(window.parent.spgi.panierRes=)","K\t"+g.key,"H\t"+(g.rPreResa?g.rPreResa.h:-1)];if(g.p.port){for(i=0;i<g.p.port.length;i++){c=g.p.port[i];if(c.checked&&c.code!="NULL"){buf.push("P\t"+c.code+"\t"+c.qtt)}}}for(i=0;i<g.panier.length;i++){c=g.panier[i];if(!c.ref||isNaN(c.ref)||(parseFloat(c.ref)<0)){if(!isNaN(x=c.seance)&&c.seance>-1){s=g.seances[x];buf.push("S\t"+s.serveur+"\t"+s.ref);for(j=0;j<c.c.length;j++){ti=c.c[j].zt.split("_");buf.push("\t"+g.seances[x].zones[ti[0]].nom+"\t"+g.lTarifs[g.seances[x].zones[ti[0]].tarifs[ti[1]]].libelle+"\t"+c.c[j].v)}if(c.c.places&&c.c.places.length>0){for(k=0;k<c.c.places.length;k++){if(c.c.places[k]){if(c.c.places[k].iPlaces.length>1){buf.push("X\t"+Array.prototype.join.call(c.c.places[k].iPlaces,","))}else{buf.push("X\t"+c.c.places[k].iPlaces[0])}}}}}else{if(!isNaN(x=c.formule)){buf.push("A\t"+g.formulesAb[x].nom+"\t"+c.nbPlaces);for(j=0;j<c.c.length;j++){l=c.c[j];if((l.iSeance>=0)&&l.zone&&l.tarif&&(l.qtt&1)){s=g.seances[l.iSeance];m=l.v?l.v:0;buf.push("\t"+j+"\t"+s.serveur+"\t"+s.ref+"\t"+l.zone+"\t"+l.tarif+"\t"+c.nbPlaces+(c.c.places&&c.c.places[j]?"\t"+(c.c.places[j].iPlaces.length>1?Array.prototype.join.call(c.c.places[j].iPlaces,","):c.c.places[j].iPlaces[0]):""))}}}else{if(c.seance==-1&&c.iProduit>=0){buf.push("B\t"+g.boutique.produits[c.iProduit].code+"\t"+c.nbPlaces)}}}}}g.panierRes=null;x=spgiAjax.postData([{n:"reqData",v:Array.prototype.join.call(buf,"\n")}],g.serveurAppURL+g.cmdOpDossier+"?"+spgiAjax.encodeArray([{n:"societe",v:g.societe.id},{n:"numeroClient",v:g.client.idx},{n:"mdpClient",v:g.client.mdp},{n:"coordToPart",v:(g.venteSeance.coordToPart?g.venteSeance.coordToPart.v:0)}]));if(x&&(x.status==200||x.status===0)){if(x.txt.substr(0,29)=="window.parent.spgi.panierRes="){eval(x.txt);g.oldPanier=true;if(g.panierRes&&g.panierRes.key){g.p.port=[];for(i=0;i<g.panierRes.resas.length;i++){r=g.panierRes.resas[i];if(r.code){v=false;if((m=g.optionsInternet.port)){for(j=0;j<m.t.length;j++){if(r.code==m.t[j].code){v=m.t[j];g.p.port.push({force:true,checked:true,enabled:true,delai:v.delai,txt:v.txt,txtDelay:v.txtDelay,code:v.code,prix:r.total,tva:v.tva});break}}}if(!v){g.p.port.push({force:true,checked:true,enabled:true,txt:"Frais d'envoi en recommandé",code:r.code,prix:r.total})}}}j=0;g.key=g.panierRes.key;v=spgiFindPanierInHisto(g.key);if(!v){g.client.paniers=a.concat(g.client.paniers);v=g.client.paniers[0]}v.date=new Date();v.kId=g.key;v.etat=0;v.panier={};v.panier.total=g.panierRes.total;v.panier.frais=g.panierRes.frais;v.panier.Paye=g.panierRes.Paye||0;for(i=0;i<g.panier.length;i++){p=g.panier[i];if(!p.ref||isNaN(p.ref)||parseFloat(p.ref)<0){p.ref=-1;while(j<g.panierRes.resas.length){r=g.panierRes.resas[j];j++;if(!r.code){p.ref=r.ref;if((r.ref>=0)&&(toMoney(r.total)!=toMoney(g.fraisCompris?p.total:toMoney(parseFloat(p.total)+parseFloat(p.frais))))){alert("Le montant de la ligne "+(i+1)+" de votre panier ("+toMoneyChar(p.total)+") est différent du montant calculé par le serveur ("+toMoneyChar(r.total)+") !");p.total=r.total}break}}if(parseFloat(p.ref)<0){e++}}}if(e>0){alert(e+" lignes de votre panier ont été refusées par le serveur !")}else{alert("Votre panier est enregistré (Panier n°"+g.key+")")}spgiShowPanier.handler();if(g.rPreResa){g.rPreResa.h=-1}}else{alert("Votre panier n'a pas été validé !")}}else{alert(x.txt)}}}}function majDispoSeances(){var h=window.parent.spgi,e=new Date(),d,c,a,f;e=e.getTime();if(!h.majDispoSeancesDate){h.majDispoSeancesDate=e}else{if(h.majDispoSeancesDate+240000>e){return}}communication.getSaisonDispo(h.societe.id,"window.spgi.majDispoSeances.");var b=h.majDispoSeances.seances;for(d=0;d<b.length;d++){for(c=0;c<h.seances.length;c++){f=h.seances[c];if(b[d].idxFiche==f.idxFiche){f.reste=b[d].reste;f.dispoA=b[d].dispoA;f.dispoS=b[d].dispoS;for(a=0;a<f.zones.length;a++){if(b[d].zones[a].numero==f.zones[a].n){f.zones[a].reste=b[d].zones[a].r}}break}}}b=[]}function spgiDoGetDossierClient(n,nom,email,mp,ref){var g=window.parent.spgi,c=spgiAjax.postData([{n:"reqData",v:"SPGI 1.0\nGetDossierClient(window.parent.spgi.client=)"}],g.serveurAppURL+g.cmdOpDossier+"?"+spgiAjax.encodeArray([{n:"societe",v:g.societe.id},{n:"nomClient",v:(nom||"")},{n:"emailClient",v:(email||"")},{n:"numeroClient",v:(n||"")},{n:"mdpClient",v:mp},{n:"ref",v:(ref||"")}]),null,"",true);if(c&&(c.status==200||c.status===0||c.status==401)){if(c.status!=401&&c.txt.substr(0,26)=="window.parent.spgi.client="){eval(c.txt);spgiSeancesClient()}else{alert("Votre dossier client est introuvable")}}else{alert("Erreur de communication : "+c.status+" "+c.stxt)}}function spgiRequestClient(){var f=window.document.forms.IdClientForm.elements,h=f.numeroClient?f.numeroClient.value:null,a=f.nomClient?f.nomClient.value:null,b=f.emailClient?f.emailClient.value:null,e=window.parent.spgi,c=e.client.idx;if(!(h||(a&&b))){alert("Vous devez vous identifier, suivant l'une des deux méthodes, avant de valider.");return}var d=f.mdpClient?f.mdpClient.value:null;if(!d&&f.mdpClient2){d=f.mdpClient2.value}if(!d){alert("Vous devez saisir votre mot de passe secret avant de valider.");return}$("#rechercheIdClient").dialog("close");spgiDoGetDossierClient(h,a,b,d);if(c>=0&&c!=e.client.idx){spgiClearPanier()}if(e.client.idx>-1&&e.panier.length>0){setTimeout('window.parent.frames[0].location.href = "panier.html"',0)}else{if(e.client.idx>-1&&window.parent.frames[0].location.href.indexOf("accueil")>-1){e.formuleAct=0;setTimeout('window.parent.frames[0].location.href = "abonnements.html"',100);return}else{actualiseDossierClient()}}}function spgiValideFicheClient(){var form=window.document.forms.FicheClientForm,form2=window.document.forms.FicheClientForm2,adrLivraison=window.document.getElementById("adrLivraison"),g=window.parent.spgi,mail,f,i,j,n,t;for(i=0;i<form.elements.length;i++){f=form.elements[i];if(f.name=="eMail"){mail=f.value}if(!(f.value&&f.value.trim())&&(f.name=="civilite"||f.name=="nom"||f.name=="prenom"||f.name=="adr11"||f.name=="cdp"||f.name=="ville"||f.name=="eMail"||f.name=="ceMail"||f.name=="mdp"||f.name=="civilite"||f.name=="cleCE")){f.focus();$('[name="'+f.name+'"]').css({"background-color":"red",color:"white"});alert("Merci de renseigner le champ "+f.title);return}else{$('[name="'+f.name+'"]').css({"background-color":"white",color:"black"})}}if(adrLivraison&&!adrLivraison.checked){for(i=0;i<form2.elements.length;i++){f=form2.elements[i];if(!(f.value&&f.value.trim())&&(f.name=="nom2"||f.name=="prenom2"||f.name=="adr21"||f.name=="cdp2"||f.name=="ville2")){f.focus();alert("Merci de renseigner le champ "+f.title+" des coordonnées de livraison");return}}}f=form.elements.mdp;n=form.elements.cmdp;if(f&&(!n||(f.value!=n.value))){alert("Le mot de passe et son contrôle sont différents !");n.focus();return}if((g.client.idx<0)&&!f){alert("Vous devez choisir un mot de passe pour protéger votre dossier !");f.focus();return}if(g.client.idx==-1&&mailExiste(mail)==true){alert("Un compte utilisant l'adresse email "+mail+" existe déjà.");return}t=["SPGI 1.0","PutDossierClient(window.parent.spgi.client=)","idx\t"+g.client.idx,"oldMdp\t"+(g.client.mdp||"")];for(i=0;i<form.elements.length;i++){f=form.elements[i];switch(f.type.toLowerCase()){case"text":case"password":case"hidden":case"select-one":t.push(f.name+"\t"+f.value);break;case"checkbox":case"radio":if(f.checked){t.push(f.name+"\t"+f.value)}break;case"select-multiple":for(j=0;j<f.options.length;j++){if(f.options[j].selected){t.push(f.name+"\t"+f.options[j].value)}}break}}if(adrLivraison&&!adrLivraison.checked){for(i=0;i<form2.elements.length;i++){f=form2.elements[i];switch(f.type.toLowerCase()){case"text":case"password":case"hidden":case"select-one":t.push(f.name+"\t"+f.value);break;case"checkbox":case"radio":if(f.checked){t.push(f.name+"\t"+f.value)}break;case"select-multiple":for(j=0;j<f.options.length;j++){if(f.options[j].selected){t.push(f.name+"\t"+f.options[j].value)}}break}}}else{t.push("nom2\t"+form.elements[2].value+"\nprenom2\t"+form.elements[4].value+"\nadr21\t"+form.elements[6].value+"\nadr22\t"+form.elements[7].value+"\ncdp2\t"+form.elements[8].value+"\nville2\t"+form.elements[10].value+"\npays2\t"+form.elements[12].value+"\ntel2\t"+form.elements[3].value+"\n")}t=spgiAjax.postData([{n:"reqData",v:t.join("\n")}],g.serveurAppURL+g.cmdOpDossier+"?societe="+g.societe.id);if(t&&(t.status==200||t.status===0)){if(t.txt.substr(0,26)=="window.parent.spgi.client="){eval(t.txt);if(g.etape==1){setTimeout('window.parent.frames[0].location.href = "panier.html"',0)}else{alert("Votre dossier est enregistré");setTimeout('window.parent.frames[0].location.href = "dossier.html"',0)}}else{alert("Votre fiche client n'a pu être créée")}}}spgiAjax={sendRequest:function(a,b,d,f,j,h,i){var c;try{c=new XMLHttpRequest()}catch(g){try{c=new ActiveXObject("Msxml2.XMLHTTP")}catch(g){try{c=new ActiveXObject("Microsoft.XMLHTTP")}catch(g){alert(g.description?g.description:g.toString())}}}if(!c){alert("Votre navigateur ne supporte pas la technologie AJAX. Veuillez le mettre à jour ou utiliser un navigateur comme Firefox (libre, gratuit, puissant, ...) par exemple !");return}if(window.netscape){try{if(document.location.protocol.indexOf("http")==-1){netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead")}}catch(g){alert(g.description?g.description:g.toString())}}try{c.open(a,b,false);if(a.toLowerCase()=="post"){c.setRequestHeader("Content-Type",(i?i:"application/x-www-form-urlencoded"));c.send(d)}else{c.send(null)}if(c.readyState==4){if(f){if(h){f(c,c.responseText,j)}else{if(c.status==200||c.status===0){f(c.responseText,j)}else{alert(c.status+" "+c.statusText+":\n"+c.responseText)}}}else{if(!h&&c.status!=200&&c.status!==0){c.responseText="";alert("Erreur de communication : "+c.status+" "+c.statusText)}}return{status:c.status,stxt:c.statusText,txt:c.responseText}}}catch(g){alert(b+"Echec : "+g.toString())}return null},encode:function(c,a,b){return(b?"&":"")+encodeURIComponent(c)+"="+encodeURIComponent(a)},encodeArray:function(b){var d,c=[];for(d=0;d<b.length;d++){c.push(encodeURIComponent(b[d].n)+"="+encodeURIComponent(b[d].v))}return c.join("&")},postForm:function(b,a,c,l,h){var f,d,g,k=[];for(f=0;f<b.elements.length;f++){g=b.elements[f];switch(g.type.toLowerCase()){case"text":case"password":case"textarea":case"select-one":case"hidden":case"button":case"submit":k.push(this.encode(g.name,g.value,f));break;case"reset":break;case"checkbox":case"radio":if(g.checked){k.push(this.encode(g.name,g.value,f))}break;case"select-multiple":for(d=0;d<g.options.length;d++){if(g.options[d].selected){k.push(this.encode(g.name,g.options[d].value,f))}}break;default:displayMessage("Ajax.postForm: "+g.type+" élément de forme non supporté.");return}}return this.sendRequest("POST",a,k.join("&"),c,l,h)},rnd:function(a){return(Math.floor(a*Math.random()))},makeBoundary:function(){return(this.rnd(4294967296).toString(16)+this.rnd(4294967296).toString(16))},postData:function(d,a,c,k,h){var b=this.makeBoundary(),j=[],f,g,l;for(f=0;f<d.length;f++){g=d[f];j.push("--"+b);l='Content-Disposition: form-data; name="'+g.n+'"';if(g.f){l+='; filename="'+g.f+'"'}j.push(l);if(g.t){j.push("Content-Type: "+g.t)}j.push("");j.push(g.v)}j.push("--"+b+"--");return this.sendRequest("POST",a,j.join("\n"),c,k,h,"multipart/form-data, boundary="+b)}};function mailExiste(b){var a;$.ajax({type:"POST",async:false,data:{societe:window.parent.spgi.societe.id,eMail:b,op:"mailExiste"},dataType:"text",success:function(c){if(c=="true"){a=true}else{a=false}},url:window.location.protocol+"//"+window.location.host+"/SenousritPGI/infosClient"});return a}function spgiSeancesClient(){var m=window.parent.spgi,e,d,b,n,a,h,f;for(b=0;b<m.client.resas.length;b++){h=m.client.resas[b];f=h.iSeance;if(isNaN(f)){f=-1}if(f>=0){for(d=0;d<m.seances.length;d++){if(f==m.seances[d].idxFiche){f=d;h.iSeance=d;break}}}if(h.cmd){for(e=0;e<h.cmd.length;e++){n=h.cmd[e];if(f>=0){n.iSeance=f}else{a=n.iSeance;if(a>=0){for(d=0;d<m.seances.length;d++){if(a==m.seances[d].idxFiche){n.iSeance=d;break}}}}}}if(h.plc){for(e=0;e<h.plc.length;e++){n=h.plc[e];if(f>=0){n.iSeance=f}else{a=n.iSeance;if(a>=0){for(d=0;d<m.seances.length;d++){if(a==m.seances[d].idxFiche){n.iSeance=d;break}}}}}}}}function spgiFillForm(k,a){var e=window.document.forms[k],d=window.parent.spgi,c,b,h,l;if(!e){return}a.ceMail=d.client.eMail;for(c=0;c<e.elements.length;c++){h=e.elements[c];l=a[h.name];if(l){if(h.type.toLowerCase()=="text"||h.type.toLowerCase()=="password"){h.value=l}if(h.options){l=l.toUpperCase();for(b=0;b<h.options.length;b++){if(l==h.options[b].value.toUpperCase()||l==h.options[b].text.toUpperCase()){h.options.selectedIndex=b;break}}}}}if(k=="FicheClientForm"){e.cmdp.value=a.mdp}}spgiHistoPaniersClient={reopenPanier:function(a){var f,d,e,b=window.parent.spgi;if(b.panier&&b.panier.length>0){for(d=0;d<b.panier.length;d++){f=b.panier[d];if(!f.ref||isNaN(f.ref)||(parseFloat(f.ref)<0)){f=null;break}}if(!f&&!confirm("Attention !\nVotre panier comporte des commandes non validées.\nSi vous poursuivez votre action vous allez abandonner votre panier en cours.\n\nEtes-vous sur de vouloir annuler toutes les commandes de votre panier en cours ?")){return}}if(b.client.paniers[a].kId==b.key){setTimeout('window.parent.frames[0].location.href = "panier.html"',0);return}b.refP={};d=b.refP;e=b.client.paniers[a];b.panierAct=a;d.t=e.panier.resas;d.key=e.kId;d.p=e.panier.Paye||0;restaurePanier();b.oldPanier=true;spgiHistoPaniersClient.handler();setTimeout('window.parent.frames[0].location.href = "panier.html"',0)},derouleClick:function(a,b){a=window.parent.spgi.client.paniers[a];a.deroule=!a.deroule;spgiHistoPaniersClient.handler()},derouleResa:function(a,b){a=window.parent.spgi.client.resas[a];a.deroule=!a.deroule;spgiHistoPaniersClient.handler()},handler:function(){var u=window.parent.spgi,q,m,l,b,z,w,A,y,f,v,s=u.TNDossier,o=0,h=0,e=(u.client.paniers)?u.client.paniers.length:0,d=['<div class="ui-widget"><p style="text-align:center">Cliquez sur l\'une des références ci-dessous afin de réouvrir une ancienne commande.</p><table class="ui-widget ui-widget-content" style="width:100%"><tr class="ui-widget-header"><th></th><th align="center"></th><th align="center">Réf</th><th align="center">Date</th><th align="center">Produit</th><th align="center">Montant</th><th align="center">Solde</th></tr>'],r="ligneFoncee";for(l=0;l<e;l++){if(r=="ligneClaire"){r="ligneFoncee"}else{r="ligneClaire"}b=u.client.paniers[l];y=(b.etat>1?' style="text-decoration: line-through"':"");if(!b.panier.Paye){b.panier.Paye=0}if(!y){o=parseFloat(o)+parseFloat(b.panier.total);h=parseFloat(h)+parseFloat(b.panier.Paye)}if(b.deroule){f="En";v="Cach"}else{f="De";v="Montr"}d.push('<tr class="'+r+'"><td align="center"><a class="lienImage" title="'+v+'er le détail de cette commande" href="javascript:;" onClick="spgiHistoPaniersClient.derouleClick(\''+l+"', '"+s+'\');"><img src="/img/mini'+f+'roule.png"></a></td><td colspan="2" align="center"'+y+">"+(y?b.kId:'<a class="button" title="Réouvrir ce panier" href="javascript:;" onClick="spgiHistoPaniersClient.reopenPanier(\''+l+"');\">"+b.kId+"</a>")+'</td><td align="center"'+y+">"+spgiMiniDateHeureToString(b.date)+'</td><td></td><td align="right"'+y+">"+toMoneyChar(b.panier.total)+'</td><td align="right"'+y+">"+toMoneyChar(parseFloat(b.panier.total)-parseFloat(b.panier.Paye))+"</td></tr>");if(b.deroule&&b.panier.resas){for(q=0;q<b.panier.resas.length;q++){z=b.panier.resas[q];for(m=0;m<u.client.resas.length;m++){w=u.client.resas[m];if(z==w.ref){break}}if(m<u.client.resas.length){z=w.iSeance;z=isNaN(z)||(z<0)?null:u.seances[z];y=(w.iFacture>=0?'<span title="Facturé">F</span>':" ")+(w.attr&2?'<span title="Billets édités">E</span>':" ")+(w.attr&4?'<span title="Produit Boutique">B</span>':" ");if(w.deroule){f="En";v="Cach"}else{f="De";v="Montr"}d.push('<tr style="background-color:'+r+";"+(w.etat==3?'text-decoration: line-through"':'"')+'><td align="center"><a class="lienImage" title="'+v+'er le détail de cette commande" href="javascript:;" onClick="spgiHistoPaniersClient.derouleResa(\''+m+"', '"+s+'\');"><img src="/img/mini'+f+'roule.png"></a></td><td style="color: red">'+y+"</td><td>"+w.ref+'</td><td align="center">'+spgiMiniDateHeureToString(w.date)+"</td><td>"+(z?(u.spectacles[z.spectacle].s+"<br>"+spgiMiniDateHeureToString(z.date)):(w.formuleAb?"Abonnement : "+w.formuleAb:"Commande boutique"))+'</td><td align="right">'+toMoneyChar(w.total)+'</td><td align="right">'+toMoneyChar(w.solde)+"</td></tr>");if(w.deroule&&w.cmd){for(m=0;m<w.cmd.length;m++){A=w.cmd[m];f=(A.old?' style="text-decoration: line-through"':"");if(A.typeZone==4){y=A.tarif+(A.reduc?"avec "+toMoney(A.reduc)+"% de réduction":"")}else{if(z){y=A.tarif+" en "+A.zone}else{y=u.spectacles[u.seances[A.iSeance].spectacle].s+" du "+spgiMiniDateHeureToString(u.seances[A.iSeance].date)}}d.push('<tr style="background-color:'+r+'"><td colspan="3"></td><td'+f+">"+spgiMiniDateHeureToString(A.date)+"</td><td"+f+">"+A.qtt+" "+y+'</td><td align="right"'+f+">"+toMoneyChar(A.total)+"</td></tr>")}}}}}}d.push('<tr class="ui-widget-header"><th colspan="4" align="center">Total<th><th align="right">'+toMoneyChar(o)+'</th><th align="right">'+toMoneyChar(parseFloat(o)-parseFloat(h))+"</th></tr></tbody></table></div>");$("#tabs-2").empty().append(d.join("\n"))}};function spgiHistoPayeClient(){var h,b,l,m,o,k=window.parent.spgi.client.paiements,d=(k)?k.length:0,j=0,f=0,c=['<div class="ui-widget"><table class="ui-widget ui-widget-content" style="width:100%;"><tr class="ui-widget-header"><th colspan="3">Paiements</th><th colspan="3">Prochain Prélèvement</th></tr><tr class="ui-widget-header"><th>Mode</th><th>Montant</th><th>Date</th><th>Reste à prélever</th><th>Date</th><th>Montant</th></tr>'];for(h=0;h<d;h++){b=k[h];if(b.dateAnnul){l="style='text-decoration:line-through'"}else{j=parseFloat(j)+parseFloat(b.montant);l=""}if(!l&&b.resteAPrelever){m="<tr><td> "+toMoneyChar(b.resteAPrelever);if(b.resteAPrelever!="0.00"){m+="</td><td>"+spgiDateHeureToString(b.datePrelevement);f=parseFloat(f)+parseFloat(b.resteAPrelever);o=parseFloat(b.montant)/parseFloat(b.nbPrelevements);if((parseFloat(o)>=parseFloat(b.resteAPrelever))||((2*parseFloat(o))>parseFloat(b.resteAPrelever))){o=b.resteAPrelever}m+="</td><td>"+toMoneyChar(o)+"</td>"}else{m+="<td colspan='3'></td></tr>"}}else{m="</td><td colspan='3'></td></tr>"}c.push("<tr><td "+l+">"+b.mode+"</td><td "+l+">"+toMoney(b.devises)+b.symbole+"</td><td "+l+">"+spgiDateHeureToString(b.date)+m)}c.push("<tr class='ui-widget-header'><th colspan='3'>"+toMoneyChar(j)+"</th><th colspan='3'>"+toMoneyChar(f)+"</th></tr></table></div>");$("#tabs-3").empty().append(c.join("\n"))}function spgiHistoFacturesClient(){var d,j,k,h=window.parent.spgi.client.factures,l=(h)?h.length:0,c=0,a=0,b=["<div class='ui-widget'><table class='ui-widget ui-widget-content' style='width: 100%'><tr class='ui-widget-header'><th>Référence</th><th>Date d'émission</th><th>Date d'arrêt</th><th>Montant</th><th>Solde</th></tr>"];for(d=0;d<l;d++){j=h[d];if(j.dateAnnul){k="--"}else{c=parseFloat(c)+parseFloat(j.montant);a=parseFloat(a)+parseFloat(j.solde);k=""}b.push("<tr><td>"+k+j.ref+k+"</td><td>"+k+spgiDateHeureToString(j.date)+k+"</td><td>"+(j.dateArret?k+spgiDateHeureToString(j.dateArret)+k:"")+"</td><td>"+k+toMoneyChar(j.montant)+k+"</td><td>"+k+toMoneyChar(j.montant)+k+"</td></tr>")}b.push("<tr class='ui-widget-header'><th colspan='3'>Total</th><th>"+toMoneyChar(c)+"</th><th>"+toMoneyChar(a)+"</th></tr></table></div>");$("#tabs-4").empty().append(b.join("\n"))}function listeFormuleAb(e){var b,a=[],c=window.parent.spgi,d;if(e!=null){d=c.formulesAb[e];if(!d.image){d.image=c.defaultFormuleImg}a.push("<div id='"+d.nom+"' class='presentationFormule'>");a.push("<div class='zoneImageFormule'><img src='img/"+d.image+"' class='pimg imgFormule'></div><div class='infosFormule'><span class='littleTitle'>"+(d.nomLong||"Abonnement :"+d.nom)+"</span>"+(d.theme?" ("+d.theme+")":"")+"<br/>Du "+spgiDateSeuleToString(d.debutPeriode)+" au "+spgiDateSeuleToString(d.finPeriode)+"<br/><br/>"+(d.forfait>0?"<b>Forfait : "+toMoneyChar(d.forfait):"<b>Pas de Forfait")+"<br/>"+d.lignesMin+"</b> séances minimum | <b>"+d.lignes.length+"</b> séances maximum"+((d.txt)?"<div id='txtFormule"+e+"' class='textePresentationFormule'><hr/>"+d.txt+"</div>":"")+"</div></div>");$("div#formuleEnCommande").append(a.join("\n"));pimg();return}else{c.panierAct=-1}for(b=0;b<c.formulesAb.length;b++){d=c.formulesAb[b];if(!d.hidden){if(!d.image){d.image=c.defaultFormuleImg}a.push("<div id='"+d.nom+"' class='presentationFormule'><div class='actionsFormule'><a href='javascript:window.parent.frames[0].location.href=\"formule.html\";' class='button' onClick='window.parent.spgi.formuleAct="+b+";'>Je m'abonne</a><br/><br/><br/><br/>"+((d.txt)?"<a class='button' href='javascript:;' onClick='spgiAnimSlide(\"txtFormule"+b+"\")'>+ d'infos</a></div>":"</div>"));a.push("<div class='zoneImageFormule'><img src='img/"+d.image+"' class='pimg imgFormule' onClick='javascript:window.parent.spgi.formuleAct="+b+";window.parent.frames[0].location.href=\"formule.html\";'></div><div class='infosFormule'><span class='littleTitle'>"+(d.nomLong||"Abonnement : "+d.nom)+"</span>"+(d.theme?" ("+d.theme+")":"")+"<br/>Du "+spgiDateSeuleToString(d.debutPeriode)+" au "+spgiDateSeuleToString(d.finPeriode)+"<br/><br/>"+(d.forfait>0?"<b>Forfait : "+toMoneyChar(d.forfait):"<b>Pas de Forfait")+"<br/>"+d.lignesMin+"</b> séances minimum | <b>"+d.lignes.length+"</b> séances maximum"+((d.txt)?"<div id='txtFormule"+b+"' class='textePresentationFormule' style='display:none'><hr/>"+d.txt+"</div>":"")+"</div></div>")}}if(c.formulesAb.length==0){a.push('<div class="title">Aucune formule d\'abonnement disponible</div>')}$("#listeAb").css("display","none").append(a.join("\n")).fadeIn("normal",function(){pimg()})}function spgiLignesFormuleAbSaisie(){var I=window.parent.spgi,J=I.formuleAct,L=I.formulesAb[J],K=["",' style="bgcolor:'+I.colorForceAb+'"'],H,G,F,r,E,y,m,M,b,e,q,d,A,C,B,x,o,D,h="ligneClaire",w=['<div id="saisieDeFormuleAb"><div class="ligneClaire" style="border-right:1px solid grey;border-bottom:1px solid grey;font-size: 12px;margin-bottom: 20px;padding: 5px;text-align:right"><span style="vertical-align:top;">Merci de cocher les séances que vous souhaitez inclure dans votre abonnement </span><img style="margin:0px 3px 0px 3px" src="/img/flecheBas.png" /></div><table style="width:100%" class="ui-widget ui-widget-content"><tr class="ui-widget-header"><th></th><th align="center">Thème</th><th align="center">Lieu</th></th><th align="center">Spectacle</th><th align="center">Séance</th><th align="center">Catégorie</th><th align="center">Tarif</th><th align="center">Montant</th>'+(I.venteSeance.fraisCol?'<th align="center">'+I.venteSeance.fraisCol+"</th>":"")+"<th></th></tr>"];if(!I.abTmpV||I.abTmpV.formule!=J||I.abTmpV.iPanier!=I.panierAct){I.abTmpV={deroule:1,formule:J,iPanier:I.panierAct};if(I.abTmpV.lignes){I.abTmpV.lignes.length=0}else{I.abTmpV.lignes=[]}if(I.panierAct<0){for(H=0;H<L.lignes.length;H++){E=L.lignes[H];I.abTmpV.lignes.push({iSeance:E.iSeance,qtt:E.qtt,reduc:E.reduc,flgInit:E.flgInit,flgFixe:E.flgFixe,theme:E.theme,site:E.site,spectacle:E.spectacle,zone:E.zone,tarif:E.tarif,res:E.res||-1})}if(L.qtt){I.txtAbQtt=L.qtt}else{I.txtAbQtt=1}}else{B=I.panier[I.panierAct];for(H=0;H<B.c.length;H++){E=B.c[H];I.abTmpV.lignes.push({iSeance:E.iSeance,qtt:E.qtt,reduc:E.reduc,flgInit:E.flgInit,flgFixe:E.flgFixe,theme:E.theme,site:E.site,spectacle:E.spectacle,zone:E.zone,tarif:E.tarif,res:E.res||-1})}I.txtAbQtt=B.nbPlaces}}x=I.txtAbQtt;if(isNaN(x)){x=0}o=parseFloat(L.forfait)*(L.options&4?x:1);D=0;C=0;for(H=0;H<I.abTmpV.lignes.length;H++){if(h=="ligneClaire"){h="ligneFoncee"}else{h="ligneClaire"}E=I.abTmpV.lignes[H];J=E.flgFixe;if(J&8){J=J|7}M=E.zone;b=E.tarif;if(E.iSeance>=0){y=I.seances[E.iSeance];F=spgiMiniDateHeureToString(y.date);if(!b){b=spgiZoneTarifSelect(H,E.iSeance,b,M,"tarif");if(b.i){E.tarif=b.i}b=b.t}M=spgiZoneTarifSelect(H,E.iSeance,b,M,"zone");if(M.i){E.zone=M.i}M=M.t}else{F='<p class="button"><a class="button ui-state-default ui-corner-all ui-button" onClick="spgiDoAfficheChoixSeanceAb(\''+H+"'"+(E.zone!=""&&E.tarif!=""?",'"+E.zone+"','"+E.tarif+"'":"")+')" href="javascript:;" title="Choisir" tabindex="'+H+'">Choisir<span class="ui-icon ui-icon-circle-plus"></span></a></p>'}q='<tr class="'+h+'"><td><a class="lienImage" href="javascript:;" title="Effacer les choix sur cette ligne" onClick="spgiDoEffaceLigneAb('+H+')"><img src="/img/miniAnnule.png"></a></td><td'+K[J&1]+">"+E.theme+"</td><td"+K[(J>>1)&1]+">"+E.site+"</td><td"+K[(J>>2)&1]+'><a href="javascript:presenteSpectacleAbo('+lblSpectToId(E.spectacle)+')">'+E.spectacle+'</a></td><td align="center"'+K[(J>>3)&1]+">"+F+"</td><td"+K[(J>>4)&1]+">"+M+"</td><td"+K[(J>>5)&1]+">"+b+'</td><td align="right">';if(E.qtt>0){if(E.iSeance>=0&&E.zone&&E.tarif){e=lTarifByName(E.iSeance,E.zone,E.tarif);if(e){d=fraisForTarif(e,y);G=totalProduit(x,e.prix,(I.fraisCompris?d:0),(H<L.lignes.length&&(A=L.lignes[H]).reduc&&!isNaN(A.reduc)?A.reduc:0));d*=x}else{G=0;d=0}E.v=G;E.f=d;q+=toMoneyChar(G)+(I.venteSeance.fraisCol?'</td><td align="right">'+toMoneyChar(d):"");C+=parseInt(x);o=parseFloat(o)+parseFloat(G);D=parseFloat(D)+parseFloat(d)}else{if(I.venteSeance.fraisCol){q+="</td><td>"}}if(E.qtt&2){q+="</td><td"+K[1]+'><input type="checkbox" disabled checked />'}else{q+='</td><td><input type="checkbox" onClick="spgiDoCocheLigneAb(\''+H+'\')" title="';if(E.qtt&1){q+='Enlever cette ligne" checked />'}else{q+='Sélectionner cette ligne" />'}}}else{q+="</td>"+(I.venteSeance.fraisCol?"<td></td>":"")+'<td><input type="checkbox" title="Sélectionner cette ligne" onClick="spgiDoCocheLigneAb(\''+H+"')\" />"}w.push(q+"</td></tr>");if(E.choixS){E=(H<L.lignes.length)?L.lignes[H]:null;for(G=0;G<I.seances.length;G++){y=I.seances[G];if(y.dispoA&&y.reste>0){for(F=0;F<I.abTmpV.lignes.length;F++){if(I.abTmpV.lignes[F].iSeance==G){y=null;break}}if(y&&E){M=E.zone.toLowerCase();b=E.tarif;if(M||b){for(F=0;F<y.zones.length;F++){m=y.zones[F];if(!M||(m.reste>0&&M==m.nom.toLowerCase())){if(b){for(r=0;r<m.tarifs.length;r++){if(b==I.lTarifs[m.tarifs[r]].lblA){b="";M="";break}}if(M||!(M||b)){break}}else{M="";break}}}if(M||b){y=null}}}if(y&&(!E||((!E.theme||I.themes[y.theme].s==E.theme)&&(!E.site||I.sites[y.site].s==E.site)&&(!E.spectacle||I.spectacles[y.spectacle].s==E.spectacle)))){w.push('<tr><td colspan="9" align="center"><a href="javascript:;" onClick="spgiDoValideChoixSeanceAb(\''+H+"', '"+G+"')\">"+spgiTitreSeance(y)+"</a></td></tr>")}}}}}I.abTmpV.nbPlaces=x;I.abTmpV.nbPlacesTotal=C;I.abTmpV.total=o;I.abTmpV.frais=D;if(!(L.options&4)){y=["Nombre de places par séance : "+(L.qtt||1)]}else{y=['Saisissez le nombre de places par séance <select name="QttAb" onChange="if(!isNaN(this.value) && (window.parent.spgi.formulesAb[window.parent.spgi.formuleAct].options&4)){window.parent.spgi.txtAbQtt = this.value; window.parent.frames[0].location.reload();}">'];for(F=1;F<11;F++){y.push('<option value="'+F+'"'+(F==parseInt(I.txtAbQtt)?' selected="selected"':"")+">"+F+"</option>")}y.push("</select>")}w.push('<tr class="ui-widget-header"><th colspan="7" align="right">'+y.join("\n")+'</th><th align="right">'+toMoneyChar(o)+(I.venteSeance.fraisCol?'</th><th align="right">'+toMoneyChar(D):"")+'</th><th></th></tr>\n</table><div class="action"><p class="button"><a class="button ui-state-default ui-corner-all ui-button" onClick="spgiOnClickValideAb()" href="javascript:;" title="Ajouter au panier" tabindex="'+H+'">Ajouter au panier<span class="ui-icon ui-icon-cart"></span></a></p></div><div id="choixSeanceAb" class="ui-dialog ui-widget ui-widget-content ui-corner-all ui-draggable ui-resizable" style="display:none"></div>');$("div#formuleEnCommande").empty();listeFormuleAb(I.formuleAct);$("div#formuleEnCommande").append(w.join("\n"))}function onChgtZTS(c){if(!c){return false}var a,b;if(isNaN(c.charAt(2))){a=c.charAt(1);b=2}else{a=c.substr(1,2);b=3}a=window.parent.spgi.abTmpV.lignes[a];b=c.slice(b);if(c.charAt(0)=="z"){a.zone=b}else{a.tarif=b}spgiLignesFormuleAbSaisie()}function spgiDoAfficheChoixSeanceAb(p){var h=window.parent.spgi,a=[],f,e,q,c,i,o,m,b=(!p||isNaN(p))?this.v1:p;if(b<0||b>h.abTmpV.lignes.length){return}var d=h.abTmpV.lignes[b];majDispoSeances();for(f=0;f<h.seances.length;f++){q=h.seances[f];if(q.dispoA){for(e=0;e<h.abTmpV.lignes.length;e++){if(h.abTmpV.lignes[e].iSeance==f){q=null;break}}if(q&&d){c=majuscule(d.zone);i=majuscule(d.tarif);if(c||i){for(e=0;e<q.zones.length;e++){m=q.zones[e];if(!c||c==majuscule(m.nom)){if(i){for(o=0;o<m.tarifs.length;o++){if(i==majuscule(h.lTarifs[m.tarifs[o]].libelle)){i="";c="";break}}if(c||!(c||i)){break}}else{c="";break}}}if(c||i){q=null}}}if(q&&(!d||((!d.theme||h.themes[q.theme].s.toLowerCase()==d.theme.toLowerCase())&&(!d.site||h.sites[q.site].s.toLowerCase()==d.site.toLowerCase())&&(!d.spectacle||h.spectacles[q.spectacle].s.toLowerCase()==d.spectacle.toLowerCase())))){a.push(spgiPresentationSpectacle(f,true,b,q.zones[e].tarifs[o]))}}}$("#choixSeanceAb").empty().append(a.join("\n")).dialog({autoOpen:false,bgiframe:true,close:function(g,j){$("div#choixSeanceAb").dialog("destroy")},modal:true,dialogClass:"choixSeanceAb",title:"Choisissez une séance...",width:$("body").width()}).dialog({open:function(g,j){pimg()}}).dialog("open")}function spgiDoCocheLigneAb(c){var a,b=window.parent.spgi,d=(!c||isNaN(c))?this.v1:c;if(d<0||d>b.abTmpV.lignes.length){return}a=b.abTmpV.lignes[d];if(a.qtt&1){a.qtt-=1}else{a.qtt+=1}spgiLignesFormuleAbSaisie()}function spgiTitreSeance(a){return window.parent.spgi.spectacles[a.spectacle].s+" du "+spgiMiniDateHeureToString(a.date)+" (à : "+window.parent.spgi.sites[a.site].s+")"}function spgiDoValideChoixSeanceAb(e,b){var a,c,d=window.parent.spgi,f=(!e||isNaN(e))?this.v1:e;if(f<0||f>d.abTmpV.lignes.length){return}c=(!b||isNaN(b))?this.v2:b;if(c<0||c>d.seances.length){return}a=d.abTmpV.lignes[f];a.iSeance=c;c=d.seances[c];a.theme=d.themes[c.theme].s;a.site=d.sites[c.site].s;a.spectacle=d.spectacles[c.spectacle].s;a.qtt=a.qtt|1;a.choixS=false;spgiLignesFormuleAbSaisie();$("#choixSeanceAb").dialog("close");setTimeout('window.parent.frames[0].location.href = "formule.html"',0)}function spgiZoneTarifSelect(x,d,k,n,o){var m=window.parent.spgi,y=['<select name="'+x+'" onchange="onChgtZTS(this.value)">','<option value=""></option>'],e=x,z=m.seances[d],a=null,p,h,f,q,w,c;n=majuscule(n);k=majuscule(k);if(o=="tarif"){for(f=0;f<z.zones.length;f++){if(n==majuscule(z.zones[f].nom)){c=z.zones[f];w=c.tarifs.length==1;for(h=0;h<c.tarifs.length;h++){q=m.lTarifs[c.tarifs[h]].lblA;if(w||q==k){a=q;y.push('<option value="t'+e+q+'" selected="selected">'+q+"</option>")}else{y.push('<option value="t'+e+q+'">'+q+"</option>")}}break}}y.push("</select>")}else{if(n&&(m.abTmpV.lignes[x].flgFixe&16)||z.zones.length==1){a=n||majuscule(z.zones[0].nom);y=[""+a]}else{w=0;for(h=0;h<z.zones.length;h++){if(z.zones[h].reste>0){w+=1}}w=w==1;for(h=0;h<z.zones.length;h++){c=z.zones[h];p=false;for(f=0;f<c.tarifs.length;f++){if(m.lTarifs[c.tarifs[f]].lblA==k){p=true}}if(p&&c.reste>0){q=majuscule(c.nom);if(w||q==n||(!n&&h==0)){a=q;y.push('<option value="z'+e+q+'" selected="selected">'+q+"</option>")}else{y.push('<option value="z'+e+q+'">'+q+"</option>")}}}y.push("</select>")}}return{t:y.join("\n"),i:a}}function lTarifByName(a,g,e){var b=majuscule(g),f=majuscule(e),l=window.parent.spgi.seances[a],d,c,h,k;for(d=0;d<l.zones.length;d++){h=l.zones[d];if(majuscule(h.nom)==b){for(c=0;c<h.tarifs.length;c++){k=window.parent.spgi.lTarifs[h.tarifs[c]];if(k.lblA==f){return k}}}}return null}function spgiDoEffaceLigneAb(e){var c,b,d=window.parent.spgi;if(e<0||e>d.abTmpV.lignes.length){return}c=d.formulesAb[d.abTmpV.formule];if(e<c.lignes.length){b=c.lignes[e];d.abTmpV.lignes[e]={iSeance:b.iSeance,qtt:b.qtt,reduc:b.reduc,flgInit:b.flgInit,flgFixe:b.flgFixe,theme:b.theme,site:b.site,spectacle:b.spectacle,zone:b.zone,tarif:b.tarif,res:b.res||-1}}else{d.abTmpV.lignes.splice(e,1)}spgiLignesFormuleAbSaisie()}function spgiOnClickValideAb(){var o=window.parent.spgi,b=parseInt(o.txtAbQtt),q=o.formulesAb[o.formuleAct],m,d,r,h=0,c=0,f,p,e=[];if(!o.abTmpV){return false}if(isNaN(b)||b<1){alert("Vous devez saisir la quantité d'abonnements.");return false}if(!o.abTmpV.lignes||o.abTmpV.lignes.length<q.lignesMin){alert("Cet abonnement impose un minimum de "+q.lignesMin+" séances");return false}for(m=0;m<o.abTmpV.lignes.length;m++){d=o.abTmpV.lignes[m];r=(d.iSeance>=0)&&d.zone&&d.tarif&&(d.qtt&1);if(r){h+=1;c+=b}if(m<q.lignes.length){if((q.lignes[m].qtt&2)&&!r){alert("La formule d'abonnement vous impose de renseigner la ligne "+(m+1)+" de votre abonnement.");return false}}if(r){r=o.seances[d.iSeance];for(f=0;f<r.zones.length;f++){p=r.zones[f];if(p.nom==d.zone&&(!d.res||d.res>0)){if(p.reste<b){alert("Désolé, la séance "+d.spectacle+" (ligne "+(m+1)+") ne comporte que "+p.reste+" places en zone "+p.nom);return false}break}}}}if(h<q.lignesMin){alert("Cet abonnement impose un minimum de "+q.lignesMin+" séances");return false}if(c>(o.abTmpV.lignes.length*parseInt(o.abTmpV.nbPlaces))){alert("Cet abonnement doit comporter un maximum de "+(o.abTmpV.lignes.length*parseInt(o.abTmpV.nbPlaces))+" et vous en demandez "+c);return false}spgiTestClearPanier();for(m=0;m<o.abTmpV.lignes.length;m++){d=o.abTmpV.lignes[m];e.push({iSeance:d.iSeance,qtt:d.qtt,reduc:d.reduc,flgInit:d.flgInit,flgFixe:d.flgFixe,theme:d.theme,site:d.site,spectacle:d.spectacle,zone:d.zone,tarif:d.tarif,v:d.v,f:d.f,res:d.res||-1})}o.abTmpV.iPanier=(o.panierAct<0)?o.panier.length:o.panierAct;r={deroule:1,formule:o.formuleAct,nbPlaces:b,nbPlacesTotal:o.abTmpV.nbPlacesTotal,total:o.abTmpV.total,frais:o.abTmpV.frais,c:e};if(o.panierAct<0){o.panier.push(r)}else{o.panier[o.panierAct]=r}o.formuleAct=-1;o.panierAct=-1;setTimeout('window.parent.frames[0].location.href = "panier.html"',0)}function actualiseDossierClient(){var a=window.parent.spgi;if(a.client.idx>-1){spgiFillForm("FicheClientForm",a.client);spgiFillForm("FicheClientForm2",a.client);$("#nCli").val(a.client.idx);spgiHistoPaniersClient.handler();spgiHistoPayeClient();spgiHistoFacturesClient()}}function initPeriodes(){var e=new Date(),b,a,d=window.parent.spgi,c;for(c=0;c<d.periodes.length;c++){b=new Date();a=new Date();switch(d.periodes[c].s){case"Cette semaine":while(a.getDay()!=0){a.setTime(a.getTime()+86400000)}break;case"La semaine prochaine":while(b.getDay()!=1||b.getDate()==e.getDate()){b.setTime(b.getTime()+86400000)}a.setTime(b.getTime()+7*86400000);break;case"Ce mois-ci":while(a.getMonth()==b.getMonth()){a.setTime(a.getTime()+86400000)}a.setTime(a.getTime()-86400000);break;case"Le mois prochain":if(e.getMonth()==11){b.setDate(1);b.setMonth(1);b.setYear(e.getYear()+1);a.setTime(b.getTime());a.setDate(31)}else{b.setMonth(b.getMonth()+1);b.setDate(1);a.setDate(1);a.setMonth(b.getMonth()+1);a.setTime(a.getTime()-86400000)}break;default:a.setTime(d.seances[d.seances.length-1].date.getTime());break}a.setHours(23);a.setMinutes(59);b.setHours(0);b.setMinutes(0);d.periodes[c].fPeriode=a;d.periodes[c].dPeriode=b}}function dPeriodeChoix(){var b=window.parent.spgi,a;$("#menupériode").css({display:"none"});a={dayNamesMin:["Di","Lu","Ma","Me","Je","Ve","Sa"],monthNames:["Janvier","Février","Mars","Avril","Mai","Juin","Juillet","Aout","Septembre","Octobre","Novembre","Décembre"]};$("#dPeriode").datepicker(a);$("#fPeriode").datepicker(a);$("#periodeChoix").dialog({bgiframe:true,buttons:{Ok:function(){b.periodes[b.periodes.length-1].dPeriode=new Date($("#dPeriode").datepicker("getDate"));b.periodes[b.periodes.length-1].fPeriode=new Date($("#fPeriode").datepicker("getDate"));c();b.listS.idPeriode=b.periodes.length-1;spgiBarreOutilsListeSeances.onChgtSTS("64")}},close:function(){c()},modal:true,title:"Définir une période"});function c(){$(this).dialog("destroy");$("#dPeriode").datepicker("destroy");$("#fPeriode").datepicker("destroy");$("#ui-datepicker-div").remove();$("#periodeChoix").remove()}}function topMenuAjust(){var h,k,d,m,c=$("body").width(),f=window.parent.spgi,a=[],b="",j=window.parent.frames[0].location.href,l=f.topMenu;k=l.elements.length;l.width=c;m=(c-k+1)/k;l.elementsWidth=Math.floor(m);a.push('<div id="topMenu"><div id="topMenuContent">');for(d=0;d<l.elements.length;d++){h=l.elements[d];if(c>=762){a.push('<div id="topMenuDiv'+h.libelle+'" onClick="window.parent.frames[0].location.href=\''+h.src+'\'" style="width:'+(d==k-1?(l.elementsWidth+(l.width-(k*l.elementsWidth)-k+1)):l.elementsWidth)+"px; "+(d==0?b[0]:"")+(d==k-1?b[1]:"")+'" '+((j.search(h.src)>-1)?'class="topMenuDivOver">':'class="topMenuDiv" onMouseOver="javascript:this.className=\'topMenuDivOver\'" onMouseOut="javascript:this.className=\'topMenuDiv\'">')+' <a href="'+h.src+'">'+h.libelle+((h.libelle=="Panier"&&f.p.nbPlaces>0)?' <sub class="notification">('+f.p.nbPlaces+")</sub>":"")+"</a></div>"+(d+1<l.elements.length?'<div class="topMenuSeparate"/>':""))}else{a.push('<div id="topMenuDiv'+h.libelle+'" onClick="window.parent.frames[0].location.href=\''+h.src+'\'" style="width:'+(d==k-1?(l.elementsWidth+(l.width-(k*l.elementsWidth)-k+1)):l.elementsWidth)+"px; "+(d==0?b[0]:"")+(d==k-1?b[1]:"")+'" '+((j.search(h.src)>-1)?'class="topMenuDivOver">':'class="topMenuDiv" onMouseOver="javascript:this.className=\'topMenuDivOver\'" onMouseOut="javascript:this.className=\'topMenuDiv\'">')+' <img src="/img/menu/icones/'+(h.libelle=="Votre dossier"?"dossier":h.libelle)+'.png" title="'+h.libelle+'" />'+((h.libelle=="Panier"&&f.p.nbPlaces>0)?' <sub class="notification">('+f.p.nbPlaces+")</sub>":"")+"</a></div>"+(d+1<l.elements.length?'<div class="topMenuSeparate"/>':""))}}$("#topMenu").replaceWith(a.join("\n"))}function spgiFindPanierInHisto(a){var b,d,c=window.parent.spgi;if(!c.client.paniers){c.client.paniers=[]}for(b=0;b<c.client.paniers.length;b++){d=c.client.paniers[b];if(a==d.kId){return d}}return null}function restaurePanier(){var q=window.parent.spgi,o,l,h,b,m,d,e,a,v,y,u,x,w,f,p;if(q.client.idx<0||!q.refP){return}q.dejaPaye=q.refP.p;q.key=q.refP.key;q.panier=[];if(!q.p){q.p={}}q.p.port=[];for(o=0;o<q.refP.t.length;o++){e=q.refP.t[o];for(l=0;l<q.client.resas.length;l++){a=q.client.resas[l];if(e==a.ref){w=0;f=[];d=0;if(a.formuleAb){for(h=0;h<a.cmd.length;h++){v=a.cmd[h];y=q.seances[v.iSeance];m=parseInt(v.nbFrais)*parseFloat(v.frais);f.push({iSeance:v.iSeance,qtt:(v.qtt>0),reduc:v.reduc,flgInit:0,flgFixe:0,theme:y.theme,site:y.site,spectacle:y.spectacle,zone:v.zone,tarif:v.tarif,v:(q.fraisCompris?parseFloat(v.total)+parseFloat(m):v.total),f:m});w=parseFloat(w)+parseFloat(m)}for(m=0;m<q.formulesAb.length;m++){if(q.formulesAb[m].nom==a.formuleAb){break}}q.panier.push({deroule:1,formule:m,ref:e,nbPlaces:a.nbAb,total:(q.fraisCompris?a.total:parseFloat(a.total)-parseFloat(w)),frais:w,c:f})}else{if(!isNaN(a.iSeance)&&a.iSeance>=0){y=q.seances[a.iSeance];for(h=0;h<a.cmd.length;h++){v=a.cmd[h];p=null;for(b=0;b<y.zones.length;b++){u=y.zones[b];if(u.numero==v.iZone){for(m=0;m<u.tarifs.length;m++){x=q.lTarifs[u.tarifs[m]];if(x.libelle==v.tarif){p=b+"_"+m;break}}break}}if(p){f.push({zt:p,v:v.qtt});w=parseFloat(w)+parseInt(v.nbFrais)*parseFloat(v.frais);d=parseInt(d)+parseInt(v.qtt)}}q.panier.push({deroule:1,seance:a.iSeance,ref:e,nbPlaces:d,total:(q.fraisCompris?a.total:parseFloat(a.total)-parseFloat(w)),frais:w,c:f})}else{if(q.optionsInternet.port){x=q.optionsInternet.port.t;for(h=0;h<a.cmd.length;h++){v=a.cmd[h];if(!v.old&&v.typeZone==4&&v.qtt>0){for(d=0;d<x.length;d++){if(v.zone==(y=x[d]).code){q.p.port.push({force:true,checked:true,enabled:true,delai:y.delai,txt:y.txt,txtDelay:y.txtDelay,code:y.code,prix:v.total,tva:v.tva});break}}}}}}}break}}}}function lienPaiement(tp){var g=window.parent.spgi,somme=spgiCentimesAPayer(),t=new Date();switch(g.typePaiements[tp].type){case"cheque":if(g.p.firstDate&&g.optionsInternet.joursCheque&&(t.getTime()+g.optionsInternet.joursCheque*86400000)<g.p.firstDate){$("div#paiement").empty().append(eval(stringToScript(g.typePaiements[tp].txt))).fadeIn("slow")}break;case"atos":window.parent.location.href=""+g.serveurAppURL+"AnnuleUnPanier?op=ELYSNET&montant="+somme+"&ref="+g.societe.id+"-"+g.key+"";break;case"cmc-cic":window.parent.location.href=""+g.serveurAppURL+"AnnuleUnPanier?op=cmc-cic&montant="+somme+"&ref="+g.societe.id+"-"+g.key+"";break;case"paybox":window.parent.location.href=""+g.serveurAppURL+"AnnuleUnPanier?op=xpaybox&montant="+somme+"&ref="+g.societe.id+"-"+g.key+"";break;case"spplus":window.parent.location.href=""+g.serveurAppURL+"AnnuleUnPanier?op=SPPLUS&montant="+somme+"&ref="+g.societe.id+"-"+g.key+"";break;case"worldNetTps":window.parent.location.href=""+g.serveurAppURL+"AnnuleUnPanier?"+spgiAjax.encodeArray([{n:"op",v:"hashWNTPS"},{n:"ref",v:(g.societe.id?g.societe.id+"-":"")+g.key}]);break;default:alert("Aucun système de paiement n'est pour l'instant disponible");break}}function spgiRequestMdpClient(){var d=window.document.forms.IdClientForm,e=d.elements.numeroClient?d.elements.numeroClient.value:null,a=d.elements.nomClient?d.elements.nomClient.value:null,b=d.elements.emailClient?d.elements.emailClient.value:null,c=window.parent.spgi;if(!(e||(a&&b))){alert("Vous devez vous identifier, suivant l'une des deux méthodes, avant de valider.");return}e=spgiAjax.postData([{n:"reqData",v:"SPGI 1.0\nGetMdpClient()"}],c.serveurAppURL+c.cmdOpDossier+"?"+spgiAjax.encodeArray([{n:"societe",v:c.societe.id},{n:"nomClient",v:(a||"")},{n:"emailClient",v:(b||"")},{n:"numeroClient",v:(e||"")}]));if(e&&(e.status==200||e.status===0)){alert(e.txt)}}function stringToScript(a){a=a.replace(/\'/g,"\\'");a=a.replace(/\[\[/g,"'+");a=a.replace(/\]\]/g,"+'");a="'"+a+"'";return a}function spgiCentimesAPayer(){var b=window.parent.spgi,a=b.aPayer.length-2;return b.aPayer.substr(0,a-1)+b.aPayer.substr(a)}function cgvDialog(){$("#cgv").empty().append(window.parent.spgi.cgv).dialog({autoOpen:false,bgiframe:true,modal:true,title:"Conditions générales de vente",width:$("body").width()}).dialog("open")}function mlDialog(){$("#ml").empty().append("<b>REFERENCE DE LA SOCIETE:</b><br />Ce site est la propriété de EnkiEA-Solutions SARL dont le siège social est : 20 chemin de Terrefort 33133 GALGON<br /><b>Tél:</b> 05 57 25 73 96<br /><b>Couriel:</b> assistance [arobase] guichetnet.fr<br /><br />SARL au capital de 10000 euros immatriculée au Registre du commerce et des sociétés de LIBOURNE sous le numéro 520 474 230 RCS Libourne.<br /><b>SIRET: </b>520 474 230 00023 <br /><b>N° identifiant TVA : </b>FR 25520474230<br /><br /><b>HEBERGEUR:</b><br />ONLINE SAS BP 438 75366 PARIS CEDEX 08<br /><br /><b>PROTECTION DES DONNEES:</b><br />Les informations recueillies font l'objet d'un traitement informatique destiné au bon déroulement des commandes. (déclaré au près de la CNIL sous le numéro 1415461)<br />Les destinataires des données sont : EnkiEA-Solutions et la structure à laquelle vous passez commande via la passerelle GuichetNet.<br />Conformément à la loi « informatique et libertés » du 6 janvier 1978 modifiée en 2004, vous bénéficiez d'un droit d'accès et de rectification aux informations qui vous concernent, que vous pouvez exercer en vous adressant à EnkiEA-Solutions 20 chemin de de Terrefort 33133 GALGON.<br />Vous pouvez également, pour des motifs légitimes, vous opposer au traitement des données vous concernant.").dialog({autoOpen:false,bgiframe:true,modal:true,title:"Mentions légales",width:$("body").width()}).dialog("open")}function infoBillets(){var b,c=window.parent.spgi,a;a='<b>Vous pouvez maintenant imprimer vos billets d\'entrée pour toutes les places réservées et payées de votre panier.</b><br/>Pour ce-faire, il vous faut une imprimante (imprimante bureautique, de type laser, jet d\'encre, ...) correctement paramétrée sur votre ordinateur.<table class="action"><tr><td><a target="_blank" href="'+c.serveurAppURL+"GetBilletsVirtuels?FormatDeSortie=html&ref="+(c.societe.id?c.societe.id+"-":"")+c.key+'" title="Imprimer les billets de ce panier" name="imprime" tabindex="7"><img src="/img/ImprimerLesBillets.png"/></a></td></tr></table><br/>Si vous ne disposez pas, en ce moment, ou en ce lieu, d\'une imprimante, vous pouvez fort bien imprimer vos billets plus tard, ou ailleurs. Pour cela il vous suffit, quand vous disposerez d\'une imprimante, de revenir sur ce site et de retrouver votre panier.Voici la marche à suivre :<ul><li>Sur la page d\'accueil du site, cliquez sur le bouton "Mon dossier".</li><li>Sur la page de saisie de votre dossier client, cliquez sur le bouton "Retrouver mon dossier".</li><li>Sur la page d\'Identification, saisissez votre nom et adresse mail (ou votre numéro de client <b>'+c.client.idx+'</b>) et votre mot de passe.</li><li>Sur votre dossier client, cliquez sur l\'onglet "Paniers".</li><li>Sur la liste de vos paniers, cliquez sur la référence de ce panier : <b>'+c.key+"</b>.</li><li>Vous retrouverez alors cette page et pourrez éditer vos billets.</li></ul>";$("#billets").empty().append(a);for(b=0;b<c.client.resas.length;b++){if(!(c.client.resas[b].attr&2)){$("#dialogBillets").empty().append(a).dialog({autoOpen:false,bgiframe:true,modal:true,title:"Imprimer vos billets...",width:$("body").width()}).dialog("open");break}}}function retourPaiement(){var e=window.parent.spgi,d,b,a,c=window.parent.location.href.split("?"),f;if(c[1]){f=c[1].split("&");if(f&&e.client.idx==-1){for(d=0;d<f.length;d++){if(f[d].search("ref")>-1){a=f[d].substr(4);spgiDoGetDossierClient("","","",null,a)}if(f[d].search("result")>-1){e.etatRetourPaiement=f[d].substr(7)}}if(a){for(b=0;b<e.client.paniers.length;b++){if(a==e.client.paniers[b].kId){spgiHistoPaniersClient.reopenPanier(b);if(e.etatRetourPaiement==0){alert("Votre paiement a été validé")}if(e.etatRetourPaiement==1){alert("Votre paiement n'a pas été validé")}if(e.etatRetourPaiement==2){alert("La procédure de paiement a été annulée")}setTimeout('window.parent.frames[0].location.href = "panier.html"',0);break;return}}}}}}function linkOpen(){var e=window.spgi,d,f=$(document).getUrlParam("seance"),c=$(document).getUrlParam("formule"),a=$(document).getUrlParam("site"),h=$(document).getUrlParam("spectacle"),b=window.location.href.split("#");if(b[1]){if(b[1].search("formule")>-1){c=b[1].substring(8)}if(b[1].search("seance")>-1){f=b[1].substring(7)}if(b[1].search("spectacle")>-1){h=b[1].substring(10)}}if(f){for(d=0;d<e.seances.length;d++){if(e.seances[d].ref==f){e.seanceAct=d;seanceEnCommande(d);return}}}if(h&&!e.linkOpen){for(d=0;d<e.seances.length;d++){if(e.seances[d].ref==h){e.linkOpen=true;e.listS.tri="chrono";e.listS.spectacle=h;spgiBarreOutilsListeSeances.onChgtSTS("3"+e.seances[d].spectacle);break}}}if(c){e.formuleAct=c;setTimeout('window.parent.frames[0].location.href = "formule.html"',0);return}if(a&&!isNaN(a)){e.listS.site=a;e.listS.fait=false;computeCrtListS();return}}function spgiFoot(){$("div#foot").empty().append(window.parent.spgi.foot)}function switchEvidence(a){$("#"+a).effect("pulsate",{times:1},1000)}String.prototype.trim=function(){return this.replace(/(?:^\s+|\s+$)/g,"")};function ie6Proper(){$(".imgFormule, .imgSpectacle, .imgSeance").css({height:"78px",width:"110px"})}function makeCarousel(){var c,b=['<ul id="gCarousel" class="jcarousel-skin-tango">'],h=0,f,d=window.parent.spgi,a=d.listS;if(a.idPeriode!="a"||a.spectacle!="a"||a.srv!="a"||a.theme!="a"||a.ville!="a"){initCrtListS(true)}for(c=0;c<d.spectacles.length;c++){f=d.spectacles[c];if(f.tL.length>0&&f.f1!=""){b.push('<li><div width="24%" class="jCarousel"><img src="img/'+(d.topMenu.width==762?"":"small/")+(f.f1||d.defaultSpectacleImg)+'" class="jCarousel" alt="'+f.s+"\" onClick=\"window.parent.spgi.listS.tri='chrono';window.parent.spgi.listS.spectacle='"+c+"';spgiBarreOutilsListeSeances.onChgtSTS('3"+c+"')\"/><br />"+f.s+"</div></li>");h++}}b.push("</ul>");if(h>0){$("#carousel").empty().append(b.join("\n"));$("#gCarousel").jcarousel({animation:"slow",auto:5,scroll:4,visible:4,wrap:"last"})}}function listeImagesSpectacles(){var d=window.parent.spgi,f,c,a=d.listS,b=[];if(!d.listS||!d.listS.fait){setTimeout("listeImagesSpectacles()",1000);return}if(a.idPeriode!="a"||a.spectacle!="a"||a.srv!="a"||a.theme!="a"||a.ville!="a"){initCrtListS(true)}for(c=0;c<d.spectacles.length;c++){f=d.spectacles[c];if(f.tL.length>0&&f.f1!=""){b.push('<img src="img/'+(d.topMenu.width==762?"":"small/")+(f.f1||d.defaultSpectacleImg)+'" alt="'+f.s+"\" onClick=\"window.parent.spgi.listS.tri='chrono';window.parent.spgi.listS.spectacle='"+c+"';spgiBarreOutilsListeSeances.onChgtSTS('3"+c+'\')" class="listeImagesSpectacles">')}}$("#listeImagesSpectacles").empty().append(b.join(""))}function initCrtListS(a){var b=window.parent.spgi;b.listS.idPeriode="a";if(a){b.listS.site=$(window.parent.document).getUrlParam("site")||"a"}else{b.listS.site="a"}if(!b.linkOpen){b.listS.spectacle="a"}b.listS.srv="a";b.listS.theme="a";b.listS.ville="a";b.listS.fait=false;computeCrtListS()}function selectRadio(e,n){var i,element=eval(e);for(i=0;i<element.length;i++){if(i==n){element[i].checked=true}else{element[i].checked=false}}window.parent.spgi.p.checked=n}function cParZones(i){var h=[],a=[],f=window.parent.spgi,j=f.panier[f.panierAct],b,e,d;for(b=0;b<j.c.length;b++){e=j.c[b].zt.split("_");d=j.c[b+1]?j.c[b+1].zt.split("_"):[];if(!d[0]||d[0]!=e[0]){a.push(b);h[e[0]]=a;a=[]}else{a.push(b)}}}function clone(a){if(typeof(a)!="object"||a==null){return a}var c,b=a.constructor();for(c in a){b[c]=clone(a[c])}return b}function lblSpectToId(c){var a,b=window.parent.spgi;if(!c){return}c=c.toUpperCase();for(a=0;a<b.spectacles.length;a++){if(b.spectacles[a].s.toUpperCase()==c){break}}return a}function pimg(){$("img.pimg").hover(function(c){this.img_title=this.title;this.title="";var a=$(this).attr("img_src"),d=(this.img_title!="")?"<h3>"+this.img_title+"</h3>":"",b=(a)?a:this.src;$("body").append("<div id='pimg' style='display:none;z-index:3000;top: "+(c.pageY-120)+"px; left: "+(c.pageX+15)+"px;position: absolute'><img src='"+b+"' alt='Image preview'></div>");$("#pimg").fadeIn(1000)},function(){this.title=this.img_title;$("#pimg").fadeOut(1000).remove()})}function makeBoutique(){var d=['<div id="listeProduits">'],e,b,f=window.parent.spgi,k=f.boutique.cats[0],a=f.boutique.catEnCours,h;for(e=1;e<a.length;e++){k=k.catsEnfants[a[e]]}if(!f.boutique||!f.boutique.cats||!f.boutique.produits){$("#boutique").replaceWith("Aucun produit boutique en vente pour le moment");return}makeMenuCat();for(e=0;e<k.produits.length;e++){h=f.boutique.produits[k.produits[e]];d.push('<div id="p'+h.id+'" class="resumeProduit"><div class="actionArticle"><a href="javascript:articleEnCommande('+k.produits[e]+')">Commander cette article</a><br /><br />Stock : '+h.stock+"<br /><br />"+(h.txt!=""?"<a href=\"javascript:spgiAnimSlide('detailsP"+e+"')\">+ détails</a>":"")+'</div><div class="imgListeProduit"><img class="pimg" src="img/boutique/'+h.img+'"/></div><div class="infosProduit"><div><span class="nomProduit">'+(h.nomLong==""?h.nom:h.nomLong)+"</span><br /><b>Type :</b> "+h.type+'<br /><br /><span class="prixProduit"><b>Prix :</b> '+(f.fraisCompris?toMoneyChar(h.prix):toMoneyChar(h.prix+h.frais))+'</span></div><br /><div id="detailsP'+e+'" class="detailsProduit" style="display: none"><hr />'+h.txt+'</div></div><div style="clear:both"></div></div>')}d.push("</div>");$("#listeProduits").replaceWith(d.join("\n"));pimg()}function makeMenuCat(){var k,f=0,l=window.parent.spgi,m=l.boutique.cats[0],b,a=l.boutique.catEnCours,d=['<div id="cheminBoutique"><b>></b> '+(a.length==1?m.nomLong.toUpperCase():'<a href="javascript:changeCat([0]);">'+m.nomLong.toUpperCase()+"</a>")],e=['<div id="zoneMenuBoutique">'],h;for(k=1;k<a.length;k++){m=m.catsEnfants[a[k]];if(m.nomLong==""){h=m.nom}else{h=m.nomLong}if(k<a.length-1){d.push(' <b>></b> <a href="javascript:changeCat(['+m.chemin+']);">'+h.toUpperCase()+"</a>")}else{d.push(" <b>></b> "+h.toUpperCase())}}d.push("</div>");e.push('<div class="titreCategories">GAMMES DE PRODUITS</div><div id="menuBoutique">');if(m.catsEnfants.length==0){e.push('<div class="categorie"><i>Aucune sous catégorie</i></div>')}else{for(k=0;k<m.catsEnfants.length;k++){b=m.catsEnfants[k];e.push('<div class="categorie" onMouseOver="javascript:this.className=\'categorieOver\'" onMouseOut="javascript:this.className=\'categorie\'" onClick="changeCat(['+b.chemin+'])"'+(k<m.catsEnfants.length-1?'style="border-bottom: 1px solid #b6b6b6"':"")+'><a href="javascript:changeCat(['+b.chemin+'])">'+(b.nomLong==""?b.nom:b.nomLong.toUpperCase())+"</a></div>")}}if(a.length>1){m=l.boutique.cats[0];for(k=1;k<a.length-1;k++){m=m.catsEnfants[a[k]]}e.push('</div><br /><b><<<</b> <a href="javascript:changeCat(['+a.slice(0,a.length-1)+']);">Retour vers '+m.nomLong.toUpperCase()+"</a></div>")}$("#cheminBoutique").replaceWith(d.join("\n"));$("#zoneMenuBoutique").replaceWith(e.join("\n"));l.boutique.catPre=a}function changeCat(c){var a=window.parent.spgi.boutique;a.catEnCours=c;if(window.parent.frames[0].location.href.indexOf("boutique.html")<0){window.parent.frames[0].location.href="boutique.html"}else{if(c.length<a.catPre.length){$("#menuBoutique").hide("drop",{direction:"right"},500,function(){makeBoutique()})}else{$("#menuBoutique").hide("drop",{direction:"left"},500,function(){makeBoutique()})}}}function articleEnCommande(a){window.parent.spgi.boutique.articleAct=a;setTimeout('window.parent.frames[0].location.href = "article.html"',0)}function presenteArticle(){var d,e=window.parent.spgi,k=e.boutique.cats[0],b=e.boutique.catEnCours,a=['<div id="cheminBoutique" style="float: none; margin: 0 0 15px 0"><b>></b><a href="javascript:changeCat([0]);">'+k.nomLong.toUpperCase()+"</a>"],f="",j=0,h=e.boutique.produits[e.boutique.articleAct];for(d=1;d<b.length;d++){k=k.catsEnfants[b[d]];a.push(' <b>></b> <a href="javascript:changeCat(['+k.chemin+']);">'+k.nomLong.toUpperCase()+"</a>")}for(d=0;d<e.panier.length;d++){if(e.panier[d].seance==-1&&e.panier[d].iProduit==e.boutique.articleAct){j=e.panier[d].nbPlaces}}a.push('</div><div id="articleEnCommande"><div id="zoneImageArticle">'+(h.img!=""?'<img class="imgProduit" src="img/boutique/'+h.img+'"/>':"")+'</div><div class="actionArticle"><form id="cmdArticleForm" action="javascript:addArticleToPanier();">Quantité : <input name="qtt_'+h.id+'" size="2" type="text" value="'+j+'"/><br /><br /><span class="button"><a href="javascript:addArticleToPanier();" class="button ui-button ui-state-default ui-corner-all"><span class="ui-icon ui-icon-cart button"></span>Ajouter au panier</a></span></form></div><div id="infosArticle"><span class="nomProduit">'+h.nomLong+"</span><br /><b>Prix : </b>"+(e.fraisCompris?toMoneyChar(h.prix+h.frais):toMoneyChar(h.prix))+"<br /><b>Stock :</b> "+h.stock+"<br /><br />"+h.txt+'</div><div style="clear:left"></div></div>');$("#articleEnCommande").replaceWith(a.join("\n"))}function addArticleToPanier(){var k={},e=true,b=document.forms.cmdArticleForm,d=window.parent.spgi,a,h=d.boutique.produits[d.boutique.articleAct],j=b[0].value;if(isNaN(j)){alert("Votre commande est invalide");return}if(j>h.stock){alert("Désolé, le stock de ce produit est insufisant");return}k={deroule:1,seance:-1,iProduit:d.boutique.articleAct,nbPlaces:j,total:(h.prix+h.frais)*j,frais:h.frais*j};for(a=0;a<d.panier.length;a++){if(d.panier[a].seance==-1&&d.boutique.articleAct==d.panier[a].iProduit){if(j>0){d.panier[a]=k;e=false;d.panierAct=a}else{if(!d.oldPanier){d.panier.splice(a,1);e=false}}break}}if(e&&j>0){d.panier.push(k);d.panierAct=d.panier.length-1}if(j>0){setTimeout('window.parent.frames[0].location.href = "panier.html"',0)}else{alert("Votre commande est vide")}}function switchAdresse2(){var d=window.document.getElementById("adrLivraison"),f=window.document.forms.FicheClientForm.elements,a=window.document.forms.FicheClientForm2.elements,e=window.parent.spgi,c,b;if(!d){return}if(d.checked){for(c=0;c<a.length;c++){a[c].disabled=true}window.document.getElementById("nom2").value=f[2].value;window.document.getElementById("prenom2").value=f[4].value;window.document.getElementById("adr21").value=f[6].value;window.document.getElementById("adr22").value=f[7].value;window.document.getElementById("cdp2").value=f[8].value;window.document.getElementById("ville2").value=f[10].value;window.document.getElementById("pays2").value=f[12].value;window.document.getElementById("tel2").value=f[3].value}else{for(c=0;c<a.length;c++){a[c].disabled=false}}}function majuscule(e){var d,g,b="aàâäbcçdeéèêëfghiîïjklmnoôöpqrstuùûvwxyz",a="AAAABCCDEEEEEFGHIIIJKLMNOOOPQRSTUUUVWXYZ",f="";if(!e){return}for(d=0;d<e.length;d++){var g=e.substr(d,1);f+=(b.indexOf(g)!=-1)?a.substr(b.indexOf(g),1):g}return f}function handleDestructor(){var a=window.parent.spgi;if(!a.rPreResa||a.rPreResa.h<0){return}$.ajax({type:"POST",async:false,data:{cmd:"close",handle:a.rPreResa.h,op:"preResa(window.parent.spgi.rPreResa)",societe:a.societe.id},dataType:"text",success:function(b){a.rPreResa={h:-1,Txt:""}},url:window.location.protocol+"//"+window.location.host+"/SenousritPGI/dossierOperationJs"})}function handleSurvivor(){var a=window.parent.spgi;if(!a.rPreResa||a.rPreResa.h<0){return}$.ajax({type:"GET",async:false,data:{societe:a.societe.id,handle:a.rPreResa.h,op:"preResa(window.parent.spgi.rPreResa)"},dataType:"text",url:window.location.protocol+"//"+window.location.host+"/SenousritPGI/dossierOperationJs"});window.parent.setTimeout("handleSurvivor()",180000)};
