
function SPN_confirm(int_messageId,str_queryString)
{var strEndQuerystring=RecupAllArguments(str_queryString);window.open("alert.php?SPN_int_messageId="+int_messageId+"&"+strEndQuerystring,"","width=350,height=200");}
function SPN_ecom_client_copie_infos()
{document.getElementById('cli_nom').value=document.getElementById('cli_nomfac').value;document.getElementById('cli_adr').value=document.getElementById('cli_adrfac').value;document.getElementById('cli_cp').value=document.getElementById('cli_cpfac').value;document.getElementById('cli_ville').value=document.getElementById('cli_villefac').value;document.getElementById('cli_pays').value=document.getElementById('cli_paysfac').value;}
function SPN_ecom_payer_commande(ctx_action,action_exec)
{if(confirm("Vous allez être redirigé vers le formulaire de paiement en ligne, merci de confirmer votre commande.")){location.replace("action.php?ctxid="+ctx_action+"&action="+action_exec);}}
function SPN_ecom_valider_commande()
{document.form_content.payer_commande.value="payercde";document.form_content.submit();}
function SPN_ecom_panier_vider(ctx_action)
{if(confirm("Tous les articles du panier vont être supprimé. Merci de confirmer l'opération.")){location.replace("action.php?ctxid="+ctx_action+"&action=panier_vider");}}
function SPN_popup(str_page,str_largeur,str_hauteur,str_options)
{var top=(screen.height-str_hauteur)/2;var left=(screen.width-str_largeur)/2;window.open("index.php?SPN_isPopup=yes&"+str_page,"","top="+top+",left="+left+",width="+str_largeur+",height="+str_hauteur+","+str_options);}
function SPN_zoom_image(img,imgwidth,imgheight)
{var zoomobj=document.getElementById("zoomimage");zoomobj.style.top="300px";zoomobj.style.left="50%";zoomobj.style.width=imgwidth;zoomobj.style.height=imgheight;zoomobj.innerHTML='<div align="left" style="background:#ffffff;border:1px solid #000000;width:'+imgwidth+'px;"><a href="" onclick="SPN_ferme_zoom()"><img src="'+img+'" width="'+imgwidth+'" height="'+imgheight+'" alt="Cliquer pour fermer le zoom"></a></div>';zoomobj.style.display="block";zoomobj.style.visibility="visible";return false;}
function SPN_ferme_zoom()
{var zoomobj=document.getElementById("zoomimage");zoomobj.style.display='none';}
function clic_btn_annuler()
{history.back();}
function clic_btn_fermer()
{window.close();}
function photo_clic_voir(itemid)
{SPN_popup("ctxid=photo_voir&itemid="+itemid,450,450,"menubar=no,scrollbars=yes,statusbar=no");}
function clic_chercher_commune()
{SPN_popup("ctxid=commune_search",450,550,"menubar=no,scrollbars=yes,statusbar=no");}
function addLoadEvent(func){var oldonload=window.onload;if(typeof window.onload!='function'){window.onload=func;}else{window.onload=function(){oldonload();func();}}}
function prepareInputsForHints(){var inputs=document.getElementsByTagName("input");for(var i=0;i<inputs.length;i++){if(inputs[i].parentNode.getElementsByTagName("span")[0]){inputs[i].onfocus=function(){this.parentNode.getElementsByTagName("span")[0].style.display="inline";}
inputs[i].onblur=function(){this.parentNode.getElementsByTagName("span")[0].style.display="none";}}}
var selects=document.getElementsByTagName("select");for(var k=0;k<selects.length;k++){if(selects[k].parentNode.getElementsByTagName("span")[0]){selects[k].onfocus=function(){this.parentNode.getElementsByTagName("span")[0].style.display="inline";}
selects[k].onblur=function(){this.parentNode.getElementsByTagName("span")[0].style.display="none";}}}}
var gNow=new Date();var ggWinCal;function getNextMonth(iMonth,iYear){if(iMonth==11)return 0;else return parseInt(iMonth)+1;}
function getNextYear(iMonth,iYear){if(iMonth==11)return parseInt(iYear)+1;else return iYear;}
function getPrevMonth(iMonth,iYear){if(iMonth==0)return 11;else return parseInt(iMonth)-1;}
function getPrevYear(iMonth,iYear){if(iMonth==0)return parseInt(iYear)-1;else return iYear;}
function Calendar(iTextBox,iWinCal,iMonth,iYear,iLanguage,iSubmit){if((iMonth==null)&&(iYear==null))return;if(iWinCal==null)this.gWinCal=ggWinCal;else this.gWinCal=iWinCal;this.gWeekendDays=[5,6];this.gBorderWidth=1;this.gGoGo=">>";this.gGo=">";this.gBack="<";this.gBackBack="<<";this.gShim="";var vStyle="";vStyle+="<STYLE type=\"text/css\">";vStyle+="A{text-decoration:none;color:#808000}\n";vStyle+="BODY{color:#800000;font-family:Arial,Helvetica,sans-serif; font-size:14px}\n";vStyle+="TD{color:#808000;font-size:12px; text-align:center; background-color:#FFFFFF}\n";vStyle+=".Today{color:#660066; font-weight:bold}\n";vStyle+=".Weekend{color:#000000; background-color:#EEEEEE}\n";vStyle+=".Header{color:#800000; font-weight:bold; background-color:#FFFFDD}\n";vStyle+=".InactiveDate{color:#999999}\n";vStyle+=".Border{background-color:#808000}\n";vStyle+="</STYLE>";this.gStyle=vStyle;this.gYear=iYear;this.gLanguage=iLanguage;this.gMonthName=this.getMonth(iMonth);this.gMonth=new Number(iMonth);this.gTextBox=iTextBox;this.gSubmit=iSubmit;this.gTitle=eval('Calendar.'+this.gLanguage+'Title;');}
new Calendar();Calendar.fMonths=["Janvier","Février","Mars","Avril","Mai","Juin","Juillet","Août","Septembre","Octobre","Novembre","Décembre"];Calendar.eMonths=["January","February","March","April","May","June","July","August","September","October","November","December"];Calendar.fDays=["lun","mar","mer","jeu","ven","sam","dim"];Calendar.eDays=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"];Calendar.Mois=[31,28,31,30,31,30,31,31,30,31,30,31];Calendar.eTitle="Calendar";Calendar.fTitle="Calendrier";Calendar.prototype.getMonth=function(iMonthNo){var vMonth=eval('Calendar.'+this.gLanguage+'Months['+iMonthNo+'];');return vMonth;}
Calendar.prototype.wwrite=function(wtext){this.gWinCal.document.writeln(wtext);}
Calendar.prototype.show=function(){var vCode="";this.gWinCal.document.open();this.wwrite(this.getHTMLStartPage());this.wwrite(this.getHTMLNavigation());this.wwrite(this.getHTMLCalendar());this.wwrite(this.getHTMLEndPage());this.gWinCal.document.close();}
Calendar.prototype.getHTMLStartPage=function(){var vHTML="";vHTML+="<html>";vHTML+="<head><title>"+this.gTitle+"</title>";vHTML+="</head>";vHTML+=this.gStyle;vHTML+="<body>";vHTML+="<B>";vHTML+=this.gMonthName+" "+this.gYear;vHTML+="</B>";vHTML+="<table cellspacing='0' cellpadding='0' height='3'><tr><td></td></tr></table>";return vHTML;}
Calendar.prototype.getHTMLNavButtons=function(iMonth,iYear,iImage){return"<TD class='Header' width='25%'><A HREF=\""+"javascript:window.opener.Build("+"'"+this.gTextBox+"', '"+iMonth+"', '"+iYear+"', '"+this.gLanguage+"', "+this.gSubmit+");"+"\">"+iImage+"<\/A></TD>";}
Calendar.prototype.getHTMLNavigation=function(){var vHTML="";vHTML+="<TABLE WIDTH='220' BORDER=0 CELLSPACING="+this.gBorderWidth+" CELLPADDING=0 class='Border'><TR><TD>";vHTML+="<TABLE WIDTH='220' BORDER=0 CELLSPACING=0 CELLPADDING=1><TR>";vHTML+=this.getHTMLNavButtons(this.gMonth,(parseInt(this.gYear)-1),this.gBackBack);vHTML+=this.getHTMLNavButtons(getPrevMonth(this.gMonth,this.gYear),getPrevYear(this.gMonth,this.gYear),this.gBack);vHTML+=this.getHTMLNavButtons(getNextMonth(this.gMonth,this.gYear),getNextYear(this.gMonth,this.gYear),this.gGo);vHTML+=this.getHTMLNavButtons(this.gMonth,(parseInt(this.gYear)+1),this.gGoGo);vHTML+="</TR></TABLE>";vHTML+="</tr></td></TABLE>";vHTML+="<table cellspacing='0' cellpadding='0' height='9'><tr><td></td></tr></table>";return vHTML;}
Calendar.prototype.getDay=function(iDayNo){var vDay=eval('Calendar.'+this.gLanguage+'Days['+iDayNo+'];');return vDay;}
Calendar.prototype.getHTMLDayHeader=function(iDay,iWeekend){var vDay=this.getDay(iDay);if(iWeekend){return("<TD Width='15%' class='Header'>"+vDay+"</TD>");}else{return("<TD Width='14%' class='Header'>"+vDay+"</TD>");}}
Calendar.prototype.getHTMLCalHeader=function(){var vCode="";vCode+="<TR>";vCode+=this.getHTMLDayHeader(0)+this.getHTMLDayHeader(1)+this.getHTMLDayHeader(2)+this.getHTMLDayHeader(3);vCode+=this.getHTMLDayHeader(4)+this.getHTMLDayHeader(5,1)+this.getHTMLDayHeader(6,1);vCode+="</TR>";vCode+="<TR><TD colspan='7' class='Border' height='"+this.gBorderWidth+"' class='Header'></TD></TR>";return vCode;}
Calendar.prototype.getHTMLDay=function(iDay){if(iDay==gNow.getDate()&&this.gMonth==gNow.getMonth()&&this.gYear==gNow.getFullYear())
return("<div class='Today'>"+iDay+"</div>");else
return(iDay);}
Calendar.prototype.getHTMLWeekend=function(iDay){var i;for(i=0;i<this.gWeekendDays.length;i++){if(iDay==this.gWeekendDays[i])
return(" class='Weekend'");}
return"";}
Calendar.prototype.getDaysInMonth=function(iMonthNo,iYear){if(((iYear%4==0&&iYear%100!=0)||(iYear%400==0))&&iMonthNo==1){return 29;}else{return Calendar.Mois[iMonthNo];}}
Calendar.prototype.getDateFormat=function(iDay){var vData;var vMonth=1+this.gMonth;vMonth=(vMonth.toString().length<2)?"0"+vMonth:vMonth;var vY4=new String(this.gYear);var vDD=(iDay.toString().length<2)?"0"+iDay:iDay;vData=vDD+"\/"+vMonth+"\/"+vY4;return vData;}
Calendar.prototype.getHTMLDateCell=function(iDay){var strSubmit="";if(this.gSubmit==1){strSubmit="self.opener.document."+this.gTextBox+".form.submit();"}
return"<TD"+this.getHTMLWeekend(j)+">"+"<A HREF='#' "+"onClick=\"self.opener.document."+this.gTextBox+".value='"+
this.getDateFormat(iDay)+"';window.close();"+strSubmit+"\">"+
this.getHTMLDay(iDay)+"</A>"+"</TD>";}
Calendar.prototype.getHTMLCalWeeks=function(){var vDate=new Date();vDate.setDate(1);vDate.setMonth(this.gMonth);vDate.setFullYear(this.gYear);var vFirstDay=vDate.getDay()-1;if(vFirstDay==-1)vFirstDay=6;var vDay=1;var vLastDay=this.getDaysInMonth(this.gMonth,this.gYear);var vOnLastDay=0;var vCode="";vCode=vCode+"<TR>";for(i=0;i<vFirstDay;i++){vCode=vCode+"<TD"+this.getHTMLWeekend(i)+">&nbsp;</TD>";}
for(j=vFirstDay;j<7;j++){vCode+=this.getHTMLDateCell(vDay)
vDay=vDay+1;}
vCode=vCode+"</TR>";for(k=2;k<7;k++){vCode=vCode+"<TR>";for(j=0;j<7;j++){vCode+=this.getHTMLDateCell(vDay)
vDay=vDay+1;if(vDay>vLastDay){vOnLastDay=1;break;}}
if(j==6)
vCode=vCode+"</TR>";if(vOnLastDay==1)
break;}
for(m=1;m<(7-j);m++){if(this.gYearly)
vCode=vCode+"<TD WIDTH='14%'"+this.getHTMLWeekend(j+m)+"></TD>";else
vCode=vCode+"<TD WIDTH='14%'"+this.getHTMLWeekend(j+m)+"><div class='InactiveDate'>"+m+"</div></TD>";}
return vCode;}
Calendar.prototype.getHTMLCalendar=function(){var vBeginTable="<TABLE width=220 BORDER=0 cellspacing=0 cellpadding="+this.gBorderWidth+"><tr><td class='Border'><TABLE width=220 cellspacing=0 cellpadding=0 BORDER=0>";var vHeader_Code=this.getHTMLCalHeader();var vData_Code=this.getHTMLCalWeeks();var vEndTable="</TABLE></td></tr></TABLE>";return vBeginTable+vHeader_Code+vData_Code+vEndTable;}
Calendar.prototype.getHTMLEndPage=function(){return"</body></html>";}
function Build(iTextBox,iMonth,iYear,iLanguage,iSubmit){gCal=new Calendar(iTextBox,ggWinCal,iMonth,iYear,iLanguage,iSubmit);gCal.show();}
function SPN_affiche_calendrier(){p_item=arguments[0];p_language=arguments[1];if(arguments[2]!=1)p_submit=0;else p_submit=1;if(arguments[3]==null)p_month=new String(gNow.getMonth());else p_month=arguments[3];if(arguments[4]==""||arguments[4]==null)p_year=new String(gNow.getFullYear().toString());else p_year=arguments[4];ggWinCal=window.open("","Calendar","width=240,height=188,status=no,resizable=no,top=200,left=200");ggWinCal.opener=self;Build(p_item,p_month,p_year,p_language,p_submit);}