// JavaScript Document
$(function() {
$("#datepicker").datepicker({
showOn: 'button',
buttonImage: 'images/calendar-2.gif',
buttonImageOnly: true
});
$("#datepicker2").datepicker({
showOn: 'button',
buttonImage: 'images/calendar-2.gif',
buttonImageOnly: true
});
});
function room_fx(rooms){
html = "";
sel = "";
if(rooms > 1){
document.getElementById('roomno_1').innerHTML = '1.';
}else{
document.getElementById('roomno_1').innerHTML = ' ';
}
for(i=2; i<=rooms; i++){
html += "
";
html += "";
html += ""+ i +". | ";
html += "";
html += "";
html += " | ";
html += "";
html += " ";
html += " | ";
html += "
";
html += "
";
}
document.getElementById("roomfx").innerHTML = html;
}
function chkres(){
var x = 0;
today = new Date('2012','02','23');
checkin = document.getElementById('datepicker').value;
checkout = document.getElementById('datepicker2').value;
if(checkin == false){
alert("Check-in");
return false;
}else if(checkout == false){
alert("Check-out");
return false;
}
var mm1 = parseInt(checkin.substring(0, 2),10);
var dd1 = parseInt(checkin.substring(3, 5),10);
var yy1 = parseInt(checkin.substring(6, 10),10);
var mm2 = parseInt(checkout.substring(0, 2),10);
var dd2 = parseInt(checkout.substring(3, 5),10);
var yy2 = parseInt(checkout.substring(6, 10),10);
var date1 = new Date(yy1, mm1, dd1);
var date2 = new Date(yy2, mm2, dd2);
if(date1 < today){
alert("Check in date cannot be lower than today");
return false;
}
if(date2 <= today){
alert("Check in date cannot be lower than today");
}
if(date1 >= date2 ){
alert("Check in date cannot be greater than check out");
return false;
}
}
var win=null;
function popup(mypage,myname,w,h,scroll,pos){
if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes';
win=window.open(mypage,myname,settings);}
function echeck(str) {
var at="@"
var dot="."
var lat=str.indexOf(at)
var lstr=str.length
var ldot=str.indexOf(dot)
if (str.indexOf(at)==-1){
alert("Invalid E-mail ID")
return false
}
if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
alert("Invalid E-mail ID")
return false
}
if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
alert("Invalid E-mail ID")
return false
}
if (str.indexOf(at,(lat+1))!=-1){
alert("Invalid E-mail ID")
return false
}
if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
alert("Invalid E-mail ID")
return false
}
if (str.indexOf(dot,(lat+2))==-1){
alert("Invalid E-mail ID")
return false
}
if (str.indexOf(" ")!=-1){
alert("Invalid E-mail ID")
return false
}
return true
}