function setStyle(el,prop_name,value){
 getEl(el).style[prop_name] = value;
 }

function getEl(id) {
	return document.getElementById(id);
}


function getWindowHeight() {
	if (window.self && self.innerHeight) {
		return self.innerHeight;
	}
	if (document.documentElement && document.documentElement.clientHeight) {
		return document.documentElement.clientHeight;
	}
	return 0;
}


function getWindowWidth() {
	if (window.self && self.innerWidth) {
		return self.innerWidth;
	}
	if (document.documentElement && document.documentElement.clientWidth) {
		return document.documentElement.clientWidth;
	}
	return 0;
}


function getQueryObject(){
	var qry = unescape(window.location.search).substr(1);
	var arr = qry.split("&");
	var obj = new Object();
	for (var i=0; i<arr.length; i++){
		var pair = arr[i].split("=");
		obj[pair[0]] = pair[1];
	}
	return obj;
}


function setWindowTitle( str ){
	document.getElementsByTagName("title")[0].text = str;
}


function setElementHTML( el, str ){
	getEl(el).innerHTML = str;
}


function getSelectText( val ){
	var sel = getEl(val);
	var opt = sel.options[sel.selectedIndex];
	return opt.text;
}


/*
*	Event handler called whenever the browser window changes size, we need
*	to manually reposition and resize our children as the doc-type doesnt
*	allow this to happen automatically.
*/
function windowResizeHandler(){
	var window_w		= getWindowWidth();
	var window_h		= getWindowHeight();
	var header_h		= 48; // must correspond with value set in flightmaps.css
	var flightmaps_w	= window_w;
	var flightmaps_h	= window_h - header_h;
	setStyle("flightmaps", "width",  flightmaps_w + "px");
	setStyle("flightmaps", "height", flightmaps_h + "px");
}

