/*
 * 21 April 2004
 * Justin Hewitt
 * Justin.Hewitt@Monarch-Airlines.com
 *
 * This file includes a variety of scripts which are commonly used throughout the flyMonarch.com and
 * bookFlyMonarch.com sites
 */

/* 	
	Set main site host variable. This is used by parts of the site that require form POST or GET
   	functionality. This type of functionality is not available using the IIS virtual directory which
	sends a 302 redirect header meaning form data is not reposted.
*/ 
var flyHost = "http://ltnawebtest";
var flyHostSec = "https://ltnawebtest";
var bokHost = "http://skylights/skylights";
 
// Open PopUp Window 
function NewPopUp(page,name,width,height) {
	GetScreenSize();	
	// Check that width and height not greater than scrW and scrH
	if (width > scrW) {
		width = scrW - 30;
	}
	if (height > scrH) {
		height = scrH - 30;
	}	
	// Center popUp on the page
	var winleft = (screen.width - width) / 2;
	var winUp = (screen.height - height) / 2;
	// Name parent window
	self.name = opener;	
	// Name and open child window
	remote = open( page,name,'left=' + winleft + ',top=' + winUp + ',width=' + width + ',height=' + height + ',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,copyhistory=no,resizable=yes');
}

// Get Screen Size
var scrW = 640; // Set to this in case screen size detection fails
var scrH = 480; // Set to this in case screen size detection fails

function GetScreenSize() {
	if (parseInt(navigator.appVersion)>3) {
		scrW = screen.width;
 		scrH = screen.height;
	} else {
	if (navigator.appName == "Netscape" && parseInt(navigator.appVersion)==3 && navigator.javaEnabled()) {
 		var jToolkit = java.awt.Toolkit.getDefaultToolkit();
 		var jScreenSize = jToolkit.getScreenSize();
 		scrW = jScreenSize.width;
 		scrH = jScreenSize.height;
		}
	}
}

// Pause for x number of milliseconds
function SetPauseLength(x) {
	d = new Date() //today's date
	while (1) {
		mill=new Date() // Date Now
		diff = mill-d //difference in milliseconds
		if( diff > x ) {
			break;
		}
	}
}
