
function insert_calendar() {
	
url = window.location.href.split("/");
page = url.length-1;

	if(url[page]=="PBSCShippingForm.asp" || url[page]=="PBSCShippingForm.asp?WZD=-1") { 
		
		// Ajout du calendrier + vérification de saisi
		var font = document.getElementsByTagName("FONT");
		for (var i=0; i<font.length; i++) {
			if(font[i].innerHTML == "Informations complémentaires pour la livraison :") { 
			font[i].innerHTML='<br />Veuillez choisir la date et l\'heure de livraison :</font><br /><br /><table width="500" border="0" cellpadding="0" cellspacing="0"><tr><td valign="top"><input type="hidden" name="calendar" id="calendar" /><br /></td><td valign="top" style="padding-top:10px;font-size:10pt;font-style:normal;font-weight:bold;"><div><input type="radio" name="heure_livraison" value="7h45-8h45" /> 07h45 - 08h45</div><div><input type="radio" name="heure_livraison" value="8h45-9h45" /> 08h45 - 09h45</div><div><input type="radio" name="heure_livraison" value="9h45-10h45" /> 09h45 - 10h45</div><div><input type="radio" name="heure_livraison" value="10h45-11h45" /> 10h45 - 11h45</div><div><input type="radio" name="heure_livraison" value="11h45-12h45" /> 11h45 - 12h45</div><div><input type="radio" name="heure_livraison" value="12h45-13h45" /> 12h45 - 13h45</div><div><input type="radio" name="heure_livraison" value="13h45-14h45" /> 13h45 - 14h45</div><div><input type="radio" name="heure_livraison" value="14h45-15h45" /> 14h45 - 15h45</div><div><input type="radio" name="heure_livraison" value="15h45-16h45" /> 15h45 - 16h45</div><div><input type="radio" name="heure_livraison" value="16h45-17h45" /> 16h45 - 17h45</div><div><input type="radio" name="heure_livraison" value="17h45-18h45" /> 17h45 - 18h45</div><div><input type="radio" name="heure_livraison" value="18h45-19h45" /> 18h45 - 19h45</div></td></tr><tr><td width="100%" valign="top" colspan="2"><input type="text" name="input" id="input" size="30" readonly="readonly" style="margin-left:28px;" /></td></tr><tr><td width="100%" valign="top" colspan="2"><div style="margin-top:20px;font-size:11pt;font-style:normal;font-weight:bold;">Pour une livraison express en 2h, appelez nous au : 0 848 12 12 00</div></td></tr></table>'; 
			}
		}
	
		// on cache le champ formulaire d'instruction spéciales
		var textarea = document.getElementsByName('ShipInstruction');
		for(var j=0; j<textarea.length; j++) {
		textarea[j].style.display = "none"; 
		}
		
		function checkDateLivraison() { 
			if (document.MForm["input"].value == false) {
				alert("Veuillez choisir une date de livraison");
				return false;
			}

			var heureValide = "";
			var heureChecked = document.MForm["heure_livraison"];
			
			if((heureChecked[0].checked == false) && (heureChecked[1].checked == false) && (heureChecked[2].checked == false) && (heureChecked[3].checked == false) && (heureChecked[4].checked == false) && (heureChecked[5].checked == false) && (heureChecked[6].checked == false) && (heureChecked[7].checked == false) && (heureChecked[8].checked == false) && (heureChecked[9].checked == false) && (heureChecked[10].checked == false) && (heureChecked[11].checked == false)) {
				alert("Veuillez choisir une heure de livraison");
				return false;
			}

			if(heureChecked[0].checked == true) { heureValide = heureChecked[0].value; }
			if(heureChecked[1].checked == true) { heureValide = heureChecked[1].value; }
			if(heureChecked[2].checked == true) { heureValide = heureChecked[2].value; }
			if(heureChecked[3].checked == true) { heureValide = heureChecked[3].value; }
			if(heureChecked[4].checked == true) { heureValide = heureChecked[4].value; }
			if(heureChecked[5].checked == true) { heureValide = heureChecked[5].value; }
			if(heureChecked[6].checked == true) { heureValide = heureChecked[6].value; }
			if(heureChecked[7].checked == true) { heureValide = heureChecked[7].value; }
			if(heureChecked[8].checked == true) { heureValide = heureChecked[8].value; }
			if(heureChecked[9].checked == true) { heureValide = heureChecked[9].value; }
			if(heureChecked[10].checked == true) { heureValide = heureChecked[10].value; }
			if(heureChecked[11].checked == true) { heureValide = heureChecked[11].value; }
			
			document.MForm["ShipInstruction"].value = '<b>Date et heure de livraison : </b>' + document.MForm["input"].value + ' / ' + heureValide;
		}
		
		var btnContinue = document.getElementsByTagName('a');
		for(var t=0; t<btnContinue.length; t++) {
			if(btnContinue[t].href == "javascript:SubmitAction(2,null,1,null,1);") {
				//alert(btnContinue[t].href);
				btnContinue[t].onclick = checkDateLivraison;
			}
		}		
	}
	
	if(url[page]=="PBSCOrderForm.asp") { 
		
		document.getElementsByName("BillingCountryItem")[0].style.display = "none";
		var tagFont = document.getElementsByTagName("FONT");
		tagFont[19].innerHTML = 'Pays<span class="PBRequired">&nbsp;*</span><br /><SELECT class="PB"><OPTION VALUE="177]|[Suisse" Selected>Suisse</OPTION></SELECT>';
			document.MForm["BillingCountryItem"].value = "177]|[Suisse";

		if(document.MForm["DISPLAYSHIPPINGADDR"].checked == true) {
			document.getElementsByName("ShippingCountryItem")[0].style.display = "none";
			var tagFont = document.getElementsByTagName("FONT");
			tagFont[34].innerHTML = 'Pays<span class="PBRequired">&nbsp;*</span><br /><SELECT class="PB"><OPTION VALUE="177]|[Suisse" Selected>Suisse</OPTION></SELECT>';
			document.MForm["BillingCountryItem"].value = "177]|[Suisse";
		}
		
	}
	
	if (url[page]=='PBUserAccount.asp') {
		document.getElementsByName("BillingCountryItem")[0].style.display = "none";
		document.getElementsByTagName("FONT")[20].innerHTML = 'Pays<span class="PBRequired">&nbsp;*</span><br /><SELECT class="PB"><OPTION VALUE="177]|[Suisse" Selected>Suisse</OPTION></SELECT>';
		document.MForm["BillingCountryItem"].value = "177]|[Suisse";

		if(document.MForm["DISPLAYSHIPPINGADDR"].checked == true) {
			document.getElementsByName("ShippingCountryItem")[0].style.display = "none";
			document.getElementsByTagName("FONT")[35].innerHTML = 'Pays<span class="PBRequired">&nbsp;*</span><br /><SELECT class="PB"><OPTION VALUE="177]|[Suisse" Selected>Suisse</OPTION></SELECT>';
			document.MForm["BillingCountryItem"].value = "177]|[Suisse";
		}
		
	}
}

insert_calendar();
