var NS=(navigator.appName=="Netscape")? true:false;
function setCurrentDate(){
        today = new Date();
        themonth = today.getMonth()+1;
        theday = today.getDate();
        
  var tmpY = ""+today.getYear();
 var tmpYNS = parseInt("20"+tmpY.substr(1,tmpY.length));
 var tmpYIE = parseInt(tmpY);
 document.Form1.year.length = 0;
 if(NS){
  for(i=0; i<2; i++){
    document.Form1.year.options[document.Form1.year.length] = new Option(tmpYNS+i,tmpYNS+i);
  }
 }else{
  for(i=0; i<2; i++){
    document.Form1.year.options[document.Form1.year.length] = new Option(tmpYIE+i,tmpYIE+i);
  }
 }
  document.Form1.month.selectedIndex = Number(themonth-1);
 
  setDays();  
  document.Form1.day.selectedIndex = Number(theday-1);
}

function setDays() {
  var y = document.Form1.year.options[document.Form1.year.selectedIndex].text;
  var m = document.Form1.month.selectedIndex;
  var d;
  if ( (m == 3) || (m == 5) || (m == 8) || (m == 10) ) {
    days = 30;
  }
  else if (m == 1) {
    if ( (Math.floor(y/4) == (y/4)) && ((Math.floor(y/100) != (y/100)) || (Math.floor(y/400) == (y/400))) )
      days = 29
    else
      days = 28
  }
  else {
    days = 31;
  }
  if (days > document.Form1.day.length) {
    for (i = document.Form1.day.length; i < days; i++) {
      document.Form1.day.length = days;
      document.Form1.day.options[i].text = i + 1;
      document.Form1.day.options[i].value = i + 1;
    }
  }
  if (days < document.Form1.day.length) {
    document.Form1.day.length = days;
    if (document.Form1.day.selectedIndex == -1) 
      document.Form1.day.selectedIndex = days - 1;
  }

}

function hotelList(x){
        var sel_date;
        var dep_date;
        var dep_mont;
        var dep_year;
        
        
        if(parseInt(document.Form1.day.options[document.Form1.day.selectedIndex].value)<=9){
                sel_date = "0"+document.Form1.day.options[document.Form1.day.selectedIndex].value;
        }else{
                sel_date = document.Form1.day.options[document.Form1.day.selectedIndex].value;
        }
        
        dep_date = parseInt(document.Form1.day.options[document.Form1.day.selectedIndex].value) + parseInt(document.Form1.noNights.options[document.Form1.noNights.selectedIndex].text);
        dep_mont = parseInt(document.Form1.month.selectedIndex)+1;
        dep_year = parseInt(document.Form1.year.options[document.Form1.year.selectedIndex].value);
        
        if (dep_date > calcDays(dep_mont)){
                dep_date = dep_date - parseInt(calcDays(dep_mont));
                dep_mont = dep_mont+1;
        }
        
        if (dep_mont > 12){
                dep_mont = 1;
                dep_year = dep_year+1;
        }
        
        if(dep_date < 10){
                dep_date = "0"+dep_date+"";
        }
        if(dep_mont < 10){
                dep_mont = "0"+dep_mont+"";
        }
        
        var dep_day = dep_date+"/"+dep_mont+"/"+dep_year+"-00:00";
        var sel_day = sel_date+"/"+document.Form1.month.options[document.Form1.month.selectedIndex].value+"/"+document.Form1.year.options[document.Form1.year.selectedIndex].value+"-00:00";
				top.location='http://www1.roomsnet.com/servlets/DUBLINHF_Res_Search_Servlet2_New?Sql_in=&Start_in=1&End_in=10&City=-&State=-&Price_range=0-9999&Country=-&Hotel=All&Date_S='+sel_day+'&Date_O=0&G_Type=1&Rooms='+document.Form1.noRooms.options[document.Form1.noRooms.selectedIndex].text+'&Persones=-&Adults=0&Children=0&Duration='+document.Form1.noNights.options[document.Form1.noNights.selectedIndex].text+'&Room_Type_Code=0&Room_Cat_Code=0&Hotel_Type=All&Hotel_Cat_Code=0&Uesr_Type=IU1&Industry_Code=-&Username=DemoIu1&stat=1&Logo=-&Step_Bar=-&Hot_Info=-&Fo_Icon=-&Vi_Icon=-&Step_Bar_font=-&Hot_Info_font=-&Fo_Icon_font=-&Vi_Icon_font=-&affiliate_code=-&Hot_stat=B&Search_Engine=D'
}
function getCallender(){
        window.open('http://www1.roomsnet.com/servlets/DUBLINHF_Callender_All_1?Value=0&Property_Name=Acenet','ID','width=235,height=350,statusbar=no,toolbar=no,addressbar=no,top=200,left=580');
}

function calcDays(month){
var m = parseInt(month)-1;
var days;
var y = document.Form1.year.options[document.Form1.year.selectedIndex].text;
if ( (m == 3) || (m == 5) || (m == 8) || (m == 10) ) {
    days = 30;
  }
  else if (m == 1) {
    if ( (Math.floor(y/4) == (y/4)) && ((Math.floor(y/100) != (y/100)) || (Math.floor(y/400) == (y/400))) )
      days = 29
    else
      days = 28
  }
  else {
    days = 31;
  }
return days;
}

