
var url = window.location.href.split("/");
var page = url.length-1;

if(url[page]=="PBSCShippingForm.asp" || url[page]=="PBSCShippingForm.asp?WZD=-1") { 

	var today = new Date();
	
	var heure = today.getHours();
	if (heure < 10) { heure = "0" + heure; }
	
	var minute = today.getMinutes();
	if (minute < 10) { minute = "0" + minute; }
	
	var now = heure+':'+minute;
	//alert(today.getDay()+' '+now);
	if(today.getDay() == 5 && now >= '16:00'){
		if(today.getDate() < 6){
			jour = '0'+(today.getDate()+4);
		} else {
			jour = today.getDate()+4;
		}
	} else if(today.getDay() == 6){
		if(today.getDate() < 7){
			jour = '0'+(today.getDate()+3);
		} else {
			jour = today.getDate()+3;
		} 
	} else if(today.getDay() == 0){
		if(today.getDate() < 8){
			jour = '0'+(today.getDate()+2);
		} else {
			jour = today.getDate()+2;
		}
	} else if(now >= '16:00') {
		if(today.getDate() < 8){
			jour = '0'+(today.getDate()+2);
		} else {
			jour = today.getDate()+2;
		}
	} else {
		if(today.getDate() < 9){
			jour = '0'+(today.getDate()+1);
		} else {
			jour = today.getDate()+1;
		}
	}
	
	if(today.getMonth() < 9){
		mois = '0'+(today.getMonth()+1);
	} else {
		mois = today.getMonth()+1;
	}
	
	var holidays = ["02/01", "02/04", "05/04", "13/05", "24/05", "13/06", "01/08", "09/09", "26/12", "27/12", "28/12", "29/12", "30/12", "31/12"];
	
	$(document).ready(function(){
			$('#calendar').jdPicker({
			date_format:"dd/mm/YYYY", 
			date_min:jour+'/'+mois+'/'+today.getFullYear(), 
			selectable_days:[1, 2, 3, 4, 5],
			rec_non_selectable:holidays
			});
	});

}
