function setCookie(name, value, expires, path, domain, secure)
{
    document.cookie= name + "=" + escape(value) +
        ((expires) ? "; expires=" + expires.toGMTString() : "") +
        ((path) ? "; path=" + path : "") +
        ((domain) ? "; domain=" + domain : "") +
        ((secure) ? "; secure" : "");
}

function getCookie(name)
{
    var dc = document.cookie;
    var prefix = name + "=";
    var begin = dc.indexOf("; " + prefix);
    if (begin == -1)
    {
        begin = dc.indexOf(prefix);
        if (begin != 0) return null;
    }
    else
    {
        begin += 2;
    }
    var end = document.cookie.indexOf(";", begin);
    if (end == -1)
    {
        end = dc.length;
    }
    return unescape(dc.substring(begin + prefix.length, end));
}

//function sendform(){
//document.idForm.DateIn.value=document.idForm.frommonth.value+'/'+document.idForm.fromday.value+'/'+document.idForm.fromyear.value;
//clickimage=new Image();
//	clickimage.src="./bztrack.gif"+"?D"+document.idForm.fromday.value+"&M"+document.idForm.frommonth.value+"&Y"+document.idForm.fromyear.value+"&A"+document.idForm.Adults.value+"&C"+document.idForm.Children.value+"&N"+document.idForm.Length.value;
//// window.open('','dispoprice', 'toolbar=no,width=800,height=550,menubar=no,scrollbars=yes,resizable=yes');
//	document.idForm.submit();
	
//}

function sendform(){
document.idForm.DateIn.value=document.idForm.frommonth.value+'/'+document.idForm.fromday.value+'/'+document.idForm.fromyear.value;
clickimage=new Image();
	clickimage.src="http://tracking.technicks.net/ritz/ihotelier.asp"+"?D="+document.idForm.fromday.value+"&M="+document.idForm.frommonth.value+"&Y="+document.idForm.fromyear.value+"&A="+document.idForm.Adults.value+"&N="+document.idForm.Length.value+"&R="+getCookie('ref');
// window.open('','dispoprice', 'toolbar=no,width=800,height=550,menubar=no,scrollbars=yes,resizable=yes');
	//alert(getCookie('ref'))
	document.idForm.submit();
	
}

function start()
{

var nbm = [ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ];

jour = 7;

MD=new Date();

nday=MD.getDate();
aday=MD.getDay();
amois=MD.getMonth();
ayear=MD.getYear();


nday += jour;

if(nday > nbm[amois])
{   		
	nday -= nbm[amois]; 
	amois++;  
	if(amois > 11) { ayear++; amois = 0; } }
	
document.idForm.fromday.selectedIndex = nday-1;
document.idForm.frommonth.selectedIndex = amois; 
document.idForm.fromyear.selectedIndex = ayear-2006;

}

function countdown_clock(year, month, day, hour, minute, format)
         {
         
         html_code = '<div id="countdown"></div>';
         
         document.write(html_code);
         
         countdown(year, month, day, hour, minute, format);                
         }
         
function countdown(year, month, day, hour, minute, format)
         {
         Today = new Date();
         Todays_Year = Today.getYear() - 2000;
         Todays_Month = Today.getMonth() + 1;                  
         
                                 
         Todays_Date = (new Date(Todays_Year, Todays_Month, Today.getDate(), 
                                 Today.getHours(), Today.getMinutes(), Today.getSeconds())).getTime();                                 
         Target_Date = (new Date(year, month, day, hour, minute, 00)).getTime();                  
         
                     
         Time_Left = Math.round((Target_Date - Todays_Date) / 1000);
         
         if(Time_Left < 0)
            Time_Left = 0;
         
         switch(format)
               {
               case 0:
                    
                    document.all.countdown.innerHTML = Time_Left + ' seconds';
                    break;
               case 1:
                   
                    days = Math.floor(Time_Left / (60 * 60 * 24));
                    Time_Left %= (60 * 60 * 24);
                    hours = Math.floor(Time_Left / (60 * 60));
                    Time_Left %= (60 * 60);
                    minutes = Math.floor(Time_Left / 60);
                    Time_Left %= 60;
                    seconds = Time_Left;
                    
                    dps = 's'; hps = 's'; mps = 's'; sps = 's';
                    
                    if(days == 1) dps ='';
                    if(hours == 1) hps ='';
                    if(minutes == 1) mps ='';
                    if(seconds == 1) sps ='';
                    
                    document.all.countdown.innerHTML = '<font color="#0080FF"><b>'+days + '</b></font> day' + dps + ' ';
                    document.all.countdown.innerHTML += '<font color="#0080FF"><b>'+hours + '</b></font> hour' + hps + ' ';
                    document.all.countdown.innerHTML += '<font color="#0080FF"><b>'+minutes + '</b></font> minute' + mps + ' and ';
                    document.all.countdown.innerHTML += '<font color="#0080FF"><b>'+seconds + '</b></font> second' + sps+' to ';
                    break;
               default: 
                    document.all.countdown.innerHTML = Time_Left + ' seconds';
               }
               
        
         setTimeout('countdown(' + year + ',' + month + ',' + day + ',' + hour + ',' + minute + ',' + format + ');', 1000);
         }



