function checkRoomSelect() {
    is_checked=0;
    
    if (document.res2.rt_id[0]) {
    	for (i=0;i<document.res2.rt_id.length;i++) {
       		if (document.res2.rt_id[i].checked) {
          		is_checked=1;
       		}
    	}
    } else {
    	if (document.res2.rt_id.checked) {
    	   is_checked=1;
    	}
    }
    if (is_checked==0) {
       var agree=confirm('You have not selected any of the room types! Would you like to go on with the online booking process?\n\nClick OK to go back and continue online booking or click Cancel to quit booking and go to our main page!');
       if (agree) {
         return false;
       } else {
         return true;
       }
    }
}

function checkSpecRoomSelect() {
    is_checked=0;
    
    if (document.booking.rt_id[0]) {
    	for (i=0;i<document.booking.rt_id.length;i++) {
       		if (document.booking.rt_id[i].checked) {
          		is_checked=1;
       		}
    	}
    } else {
    	if (document.booking.rt_id.checked) {
    	   is_checked=1;
    	}
    }
    if (is_checked==0) {
       var agree=alert('You have not selected any of the room types!\n');
       return false;             
    } else {
      return true;
    }
}

function checkRoomNumber() 
  {    
    is_fill=0;
    for (i=5;i<document.resg2.length;i++) {       
       if (document.resg2[i].value!="") {   
          is_fill=1;
       }
    }
    if (is_fill==0) {
       var agree=confirm('You have not filled any amount of the room types! Would you like to go on with the online inquiry process?\n\nClick OK to go back and continue online booking or click Cancel to quit booking and go to our main page!');
       if (agree) {         
         return false;
       } else {
         document.resg2.not_roomtype.value='1';
         return true;
       }
    }
  }

function checkInputGroup()  
 {	
	var errorm = new Array(
	"",
	"Please fill the First name field!",
	"Please fill the Last name field!",
	"",
	"",
	"Please fill the Address field!",
	"",
	"Please fill the City field!",
	"",
	"Please fill the Zip/Postal code field!",
	"Please fill the Country field!",
	"Please fill the Phone number field!",
	"Please fill the E-mail field!",
	"Please re-enter the e-mail address!"
	)	
	
	var darab = errorm.length;
	for (y=0 ; y<darab ; y++) {
	   if((document.res3.elements[y].value == "") && (errorm[y] != "")) {alert(errorm[y]); document.res3.elements[y].focus(); return false;} 	  
	}
	
	if (document.res3.b_email.value!=document.res3.b_email2.value) {alert("E-mail and the re-entered e-mail doesn't match!");document.res3.b_email.focus();return false;}
	
	var email = document.res3.b_email.value;
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (!filter.test(email)) {alert('The e-mail is incorrect!');document.res3.b_email.focus();return false;};
	
 } 
 
function checkInput()  
 {	
	var errorm = new Array(
	"",
	"Please fill the First name field!",
	"Please fill the Last name field!",
	"",
	"Please fill the Address field!",
	"",
	"Please fill the City field!",
	"",	
	"Please fill the Zip/Postal code field!",
	"Please fill the Country field!",
	"Please fill the Phone number field!",
	"Please fill the E-mail field!",
	"Please re-enter the e-mail address!"
	)	
	
	var darab = errorm.length;
	for (y=0 ; y<darab ; y++) {
	   if((document.res3.elements[y].value == "") && (errorm[y] != "")) {alert(errorm[y]); document.res3.elements[y].focus(); return false;} 	  
	}
	
	if (document.res3.b_email.value!=document.res3.b_email2.value) {alert("E-mail and the re-entered e-mail doesn't match!");document.res3.b_email.focus();return false;}
	
	var email = document.res3.b_email.value;
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (!filter.test(email)) {alert('The e-mail is incorrect!');document.res3.b_email.focus();return false;};
 }
 
function CheckCreditCardDatas() 
 {
    if (document.res4.cardtype.selectedIndex==0) {
      alert('Please select card type!');
      document.res4.cardtype.focus();
      return false;
    }
    if (document.res4.cardno1.value=='' || document.res4.cardno2.value=='') {
      alert('Please fill the credit card number!');
      document.res4.cardno1.focus();
      return false;
    }
    if (document.res4.accept.checked==false) {
      alert('Please read and accept the Rules & Restrictions for Online Booking!');
      document.res4.accept.focus();
      return false;
    }
    
 }

function CheckNonSecuredDatas() 
{
    if (document.res4.accept2.checked==false) {
      alert('Please read and accept the Rules & Restrictions for Online Booking!');
      return false;
    }
    document.res4.action='inquiry-ok-2.php';
}
 
function CheckCancel() 
 {
    if (!document.resc.cancel_declare.checked) {
      alert('Checking the box You declare that You would like to cancel Your reservation!');
      document.resc.cancel_declare.focus();
      return false;
    }
 }
 
function CheckArrDate() 
 {
 	var arr_date = document.booking.arr_date.value;
 	var local_time = document.booking.local_time.value;
    
 	ArrDate=new Date(arr_date.substr(6,4),(arr_date.substr(3,2)-1),arr_date.substr(0,2));
    
    LocalTime=new Date;
    LocalTime.setTime(local_time*1000);
    
    if (LocalTime.getHours()>=12 && ArrDate.getFullYear()<=LocalTime.getFullYear() && ArrDate.getMonth()<=LocalTime.getMonth() && ArrDate.getDate()<=LocalTime.getDate()) {
       alert('After 12.00 am, you can not proceed online booking for the same day!\n\nPlease contact our reservation department!');
       return false;
    }
    
    return true;
 }
 
function ChangeCardType() { 
    document.res4.submit();
}