//submit from booking console
//function toBookPage(url) {
//	var popup = window.open(url,'popup','height=600,width=800,menubar=yes,scrollbars=yes,status=yes,toolbar=no,screenX=0,screenY=50,left=0,top=50,resizable=yes');
//}

//go to booking pages with specialID
function bookSpecial(iSpecialID) {
	var popup = window.open('https://secure3.ozhosting.com/kims/ssl/check_availability.asp?fromSpecial=yes&specialChoice='+iSpecialID,'popup','height=600,width=800,menubar=yes,scrollbars=yes,status=yes,toolbar=yes,screenX=0,screenY=50,left=0,top=50,resizable=yes');
}

//popup booking page
function bookNow() {
	var popup = window.open('https://secure3.ozhosting.com/kims/ssl/check_availability.asp','popup','height=600,width=800,menubar=yes,scrollbars=yes,status=yes,toolbar=yes,screenX=0,screenY=50,left=0,top=50,resizable=yes');
}

//popup gift vouchers page
function goShopping() {
	var popup = window.open('https://secure3.ozhosting.com/kims/ssl/gift_voucher/gift_category.asp','popup','height=600,width=800,menubar=yes,scrollbars=yes,status=yes,toolbar=yes,screenX=0,screenY=50,left=0,top=50,resizable=yes');
}

//popup bungalow photos
function viewBungalow(iAccomID) {
		var popup = window.open('bungalow_more.asp?ID='+iAccomID,'popup','height=500,width=700,menubar=yes,scrollbars=yes,status=yes,toolbar=no,screenX=0,screenY=50,left=0,top=50,resizable=yes');
}

//popup attraction details
function veiwAttractionDetails(iAttractionID) {
		var popup = window.open('attraction_details.asp?aID='+iAttractionID,'popup','height=500,width=500,menubar=no,scrollbars=yes,status=yes,toolbar=no,screenX=0,screenY=50,left=0,top=50,resizable=yes');
}

//popup sample menus 
function veiwSampleMenu(ipID) {
		var popup = window.open('sample_menu.asp?pID='+ipID,'popup','height=500,width=700,menubar=no,scrollbars=yes,status=yes,toolbar=no,screenX=0,screenY=50,left=0,top=50,resizable=yes');
}


//submit from booking console
function toBookPage() {
	var checkin = document.bookingConsole.check_in_date.value;
	var nights = document.bookingConsole.no_nights.value;
	var adults = document.bookingConsole.no_adults.value;
	
	if (isDate(checkin)== true){
		var pos1=checkin.indexOf(dtCh)
		var pos2=checkin.indexOf(dtCh,pos1+1)
		var strDay=checkin.substring(0,pos1)
		var strMonth=checkin.substring(pos1+1,pos2)
		var strYear=checkin.substring(pos2+1)
		strYr=strYear
		if (strDay.charAt(0)=="0" && strDay.length>1) 
			strDay=strDay.substring(1)
		if (strMonth.charAt(0)=="0" && strMonth.length>1) 
			strMonth=strMonth.substring(1)
		for (var i = 1; i <= 3; i++) {
			if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1)
		}
		month=parseInt(strMonth)
		day=parseInt(strDay)
		year=parseInt(strYr)
		
		var d = new Date()
		d.setDate(day); 
		d.setMonth(month-1); 
		d.setFullYear(year);
		today = new Date();
		
		if (d > today) {
			url = "https://secure3.ozhosting.com/kims/ssl/transfer_data.asp?action=transfer&from=console&check_in_date=" +  checkin + "&no_nights=" + nights + "&no_adults=" + adults;
			var popup = window.open(url,'popup','height=600,width=800,menubar=yes,scrollbars=yes,status=yes,toolbar=yes,screenX=0,screenY=50,left=0,top=50,resizable=yes');
		}
			
	}
	
}




/**************************************************************************************************************************/

/**
 * DHTML date validation script for dd/mm/yyyy. Courtesy of SmartWebby.com (http://www.smartwebby.com/dhtml/)
 */
// Declaring valid date character, minimum year and maximum year
var dtCh= "/";
var minYear=1900;
var maxYear=2100;

function isInteger(s){
	var i;
    for (i = 0; i < s.length; i++){   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}

function stripCharsInBag(s, bag){
	var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++){   
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}

function daysInFebruary (year){
	// February has 29 days in any year evenly divisible by four,
    // EXCEPT for centurial years which are not also divisible by 400.
    return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
}
function DaysArray(n) {
	for (var i = 1; i <= n; i++) {
		this[i] = 31
		if (i==4 || i==6 || i==9 || i==11) {this[i] = 30}
		if (i==2) {this[i] = 29}
   } 
   return this
}

function isDate(dtStr){
	var daysInMonth = DaysArray(12)
	var pos1=dtStr.indexOf(dtCh)
	var pos2=dtStr.indexOf(dtCh,pos1+1)
	var strDay=dtStr.substring(0,pos1)
	var strMonth=dtStr.substring(pos1+1,pos2)
	var strYear=dtStr.substring(pos2+1)
	strYr=strYear
	if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1)
	if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1)
	for (var i = 1; i <= 3; i++) {
		if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1)
	}
	month=parseInt(strMonth)
	day=parseInt(strDay)
	year=parseInt(strYr)
	if (pos1==-1 || pos2==-1){
		//alert("The date format should be : dd/mm/yyyy")
		return false
	}
	if (strMonth.length<1 || month<1 || month>12){
		//alert("Please enter a valid month")
		return false
	}
	if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){
		//alert("Please enter a valid day")
		return false
	}
	if (strYear.length != 4 || year==0 || year<minYear || year>maxYear){
		//alert("Please enter a valid 4 digit year between "+minYear+" and "+maxYear)
		return false
	}
	if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){
		//alert("Please enter a valid date")
		return false
	}
return true
}


// Script Source: CodeLifter.com
// Copyright 2003
// Do not remove this notice.

// SETUPS:
// ===============================

// Set the horizontal and vertical position for the popup

PositionX = 100;
PositionY = 100;

// Set these value approximately 20 pixels greater than the
// size of the largest image to be used (needed for Netscape)

defaultWidth  = 450;
defaultHeight = 600;

// Set autoclose true to have the window close automatically
// Set autoclose false to allow multiple popup windows

var AutoClose = true;

// Do not edit below this line...
// ================================
if (parseInt(navigator.appVersion.charAt(0))>=4){
var isNN=(navigator.appName=="Netscape")?1:0;
var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}
var optNN='scrollbars=no,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;
var optIE='scrollbars=no,width=150,height=100,left='+PositionX+',top='+PositionY;
function popImage(imageURL,imageTitle){
if (isNN){imgWin=window.open('about:blank','',optNN);}
if (isIE){imgWin=window.open('about:blank','',optIE);}
with (imgWin.document){
writeln('<html><head><title>Loading...</title><style>body{margin:0px;}</style>');writeln('<sc'+'ript>');
writeln('var isNN,isIE;');writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
writeln('isNN=(navigator.appName=="Netscape")?1:0;');writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
writeln('function reSizeToImage(){');writeln('if (isIE){');writeln('window.resizeTo(100,100);');
writeln('width=100-(document.body.clientWidth-document.images[0].width);');
writeln('height=100-(document.body.clientHeight-document.images[0].height);');
writeln('window.resizeTo(width,height);}');writeln('if (isNN){');       
writeln('window.innerWidth=document.images["George"].width;');writeln('window.innerHeight=document.images["George"].height;}}');
writeln('function doTitle(){document.title="'+imageTitle+'";}');writeln('</sc'+'ript>');
if (!AutoClose) writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()">')
else writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close()">');
writeln('<img name="George" src='+imageURL+' style="display:block"></body></html>');
close();		
}}



function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}









