//-- -------------------------------------------
//-- FUNCTION TO ADD ALL ONLOAD EVENTS TO PAGE
//-- -------------------------------------------
function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	}
	else {
		window.onload = function() {
			if (oldonload) {
				oldonload();
			}
		func();
		}
	}
}




//-- -------------------------------------------
//-- FUNCTION TO CLEAR THE SEARCH BOX TEXT
//-- -------------------------------------------
function clearField(Field,fieldValue) {
	if (Field.value	== fieldValue) {
		Field.value = '';
	}
}




//-- -------------------------------------------
//-- FUNCTION TO RESET THE SEARCH BOX TEXT
//-- -------------------------------------------
function resetField(Field,fieldValue) {
	if (Field.value	== '') {
		Field.value = fieldValue;
	}
}




//-- -------------------------------------------
//-- GENERIC ACCESSIBLE POPUP SCRIPT
//-- -------------------------------------------
var _POPUP_FEATURES = 'width=400,height=525,scrollbars=no,location=no';

function raw_popup(url, target, features) {
	if (isUndefined(features)) features = _POPUP_FEATURES;
	if (isUndefined(target)) target   = '_blank';
	var theWindow = window.open(url, target, features);
	theWindow.focus();
	return theWindow;
}

function link_popup(src, features) {
	return raw_popup(src.getAttribute('href'), src.getAttribute('target') || '_blank', features);
}


function isUndefined(v) {
	var undef;
	return v===undef;
}




//-- -------------------------------------------
//-- FUNCTION TO PRINT PAGE
//-- -------------------------------------------
function printpage() {
	if (window.print) { window.print(); }
	else {
		alert ("To print this page please select the 'Print' option from your browser's 'File' menu.")
	}
	return;
}




//-- -------------------------------------------
//-- FUNCTION TO CREATE INTERACTIVE MAP
//-- -------------------------------------------
function createMap() {
	if(document.getElementById("mapContainer")) {
		var mapContainer = document.getElementById("mapContainer");
		var mapIframe = document.createElement("iframe");
		mapIframe.setAttribute("src", "map.asp");
		mapIframe.setAttribute("id", "mapIframe");
		mapIframe.setAttribute("width", "514");
		mapIframe.setAttribute("height", "395");
		mapIframe.setAttribute("scrolling", "no");
		mapIframe.setAttribute("frameBorder", "0");
		mapContainer.appendChild(mapIframe);
		return true;
	}
	else {
		return false;
	}
}




//-- -------------------------------------------
//-- ADD ONLOAD EVENTS TO PAGE
//-- -------------------------------------------
addLoadEvent(createMap);












