// #####################################################################
// defines the browser DOM
// #####################################################################

userAgent = navigator.userAgent;
var NN=0;
var IE=0;
var DOM=0;
if (userAgent.search('MSIE')>=0) {
	IE=1;
} else {
	NN = 1; 
	if (parseInt(navigator.appVersion)>4) {
  		NN=0;IE=1;DOM=1;
	};
};


// #######################################################################################
// STANDARD FUNCTION FOR POPUP WINDOW
// #######################################################################################
function thisPopup(URL, left, top, width, height, scrollbars) {
	var standardSetting = 'toolbar=0, location=0, directories=0, status=0, scrollbars=' + scrollbars;
	var customSetting = 'menubar=0, resizable=1, width=' + width + ', height=' + height;
	var positioning = 'left=' + left + ', top =' + top;
	// create window
	closePopup();
	oxl_win = window.open(URL, 'oxl', + '\'' + standardSetting + ', ' + customSetting + ', ' + positioning + '\'');
	oxl_win.focus();
}

// #######################################################################################
// CLOSES POPUP WINDOW IF ALREADY OPEN
// #######################################################################################
function closePopup() {
	if (window.oxl_win) {
		window.oxl_win.close();
	}
}

// #######################################################################################
// REFRESHES OPENER
// #######################################################################################
function refreshOpener(URL) {
	window.opener.location.href = URL;
}


// #######################################################################################
//VARIOUS POPUP WINDOW CALLERS
// #######################################################################################
function popupForm(URL, width, height) {
	thisPopup(URL, 100, 120, width, height, 1);
}

// #######################################################################################
// CHANGES BACKGROUND COLOUR OF A TABLE ROW FOR MOUSEOVER
// #######################################################################################
function clrRow(src, newColor) {
	src.bgColor = newColor;
}
// #######################################################################################
// CHANGES BACKGROUND COLOUR OF NAVIGATION TABS FOR MOUSEOVER
// #######################################################################################
function borderCell(src, flag) {
	if (flag) {
		src.style.backgroundColor = "#4B4B4B";
	} else {
		src.style.backgroundColor = "#666666";
	}
}

// #######################################################################################
// RESIZES WINDOW
// #######################################################################################
function resizeWindow(width, height) {
	window.resizeTo(width, height);
}


function zoomImage(URL, width, height, scrollbars) {
	var left = 100;
	var top = 50;
	thisPopup(URL, left, top, width, height, scrollbars);
}




// #####################################################################
// makes a hidden div layer visible
// #####################################################################

var openDiv = '';

function showMe(div) {
	if (openDiv) {
		hideMe(openDiv);
	}
	openDiv = div;
	if (DOM) {
		document.getElementById(div).style.visibility = 'visible';
		document.getElementById(div).style.display = 'block';
	} else if (IE) {
		document.all[div].style.visibility = 'visible';
		document.all[div].style.display = 'block';
	} else if (NN) {
	    document.div.visibility = 'show';
		document.div.display = 'block';
	}
} // end function
	
// #####################################################################
// hides a visible div layer
// ####################################################################
function hideMe(div) {
	if (DOM) {
		document.getElementById(div).style.visibility = 'hidden';
		document.getElementById(div).style.display = 'none';
	} else if (IE) {
		document.all[div].style.visibility = 'hidden';
		document.all[div].style.display = 'none';
	} else if (NN) {
		document.div.visibility = 'hide';
		document.div.display = 'none';
	}
} // end function

function hideSessionMessage() {
	setTimeout ("hideMe('sessionMessage');", 3000);
}


// #####################################################################
// checks if changes have been made to form values
// ####################################################################
var changesMade = false;
function checkFormChanges(text) {
	if (changesMade) {
		return confirm(text);
	}
}

function formChanged() {
	changesMade = true;
}












