//
//	Availability Calender V2
//	Client-side scripting support
//	Steve Griffiths (steve@egsystems.co.uk)

// Define calendar server URL
//var urlCalendarServer = 'http://localhost/avcal/';
var urlCalendarServer = 'http://www.mijasgolfholidays.com/avcal/';

// Define size of new calendar window
var intCalWindowWidth = 670;
var intCalWindowHeight = 560;	//@SGG 05-05-2005 - 24 month calendar

// Open a calendar window for the property identified by a given form control's ID property
function CheckAvailByControl(strControlID) {
	dropdown = document.getElementById(strControlID);
	id = dropdown.options[dropdown.selectedIndex].value;
	if (id != 'Any') {
		CheckAvailByID(id);
	}
}

// Open a calendar window for the property identified by the 'strID' parameter
function CheckAvailByID(strID) {
	OpenNewWindow(urlCalendarServer + 'avcuser.php?id=' + strID, intCalWindowWidth, intCalWindowHeight);
}

// Open an admin calendar window for the property identified by the 'strID' parameter
function AdminAvailByID(strID) {
	OpenNewWindow(urlCalendarServer + 'avcadmin.php?id=' + strID, intCalWindowWidth, intCalWindowHeight);
}

// Open global admin calendar window
function AdminAllAvail() {
	window.open(urlCalendarServer, '');
}

// Open Reservation Request Form for a given property ID
function ReserveByID(strID) {
	document.location = 'prop_booking.php?id=' + strID;
}

// Display help page for calendar administration
function ShowAdminHelp() {
	OpenNewWindow(urlCalendarServer + 'avchelp.html', 520, 440);
}		

// Open a new window in the center of the screen for a given URL and with the given dimensions
function OpenNewWindow(strURL, intWidth, intHeight) {
	intTop = (screen.availHeight - intHeight - 50) / 2;
	intLeft = (screen.availWidth - intWidth) / 2;
	window.open(strURL, "",
		"toolbar=no," + 
		"location=no, " + 
		"directories=no," + 
		"status=yes," + 
		"menubar=no," + 
		"scrollbars=yes," + 
		"resizable=yes," + 
		"width=" + intWidth + "," +  
		"height=" + intHeight + "," + 
		"left=" + intLeft + "," + 
		"top=" + intTop
	);
}

