// (c) 2006 Leon Kwikkers

function setHeight() {
	
	var heightContent	= document.getElementById('center').clientHeight + 335;
	var heightWrapper	= document.getElementById('wrapper').clientHeight;
	var noPx			= document.childNodes ? 'px' : 0;
	var spacerdiv		= document.getElementById('spacer');

	if (navigator.userAgent.indexOf('MSIE') > -1 & navigator.userAgent.indexOf('Opera') == -1) {
		
		//alert('IE:\nwrapper: ' + heightWrapper + '\ncontent: ' + heightContent);
		
		if (heightWrapper < document.documentElement.clientHeight) { 

			spacerdiv.style.height = document.documentElement.clientHeight - heightContent - 3;
			
		}
		
	} else {
		 
		//alert('FF:\nwrapper: ' + heightWrapper + '\ncontent: ' + heightContent);
		
		if (heightWrapper < window.self.innerHeight) { 
			
			spacerdiv.style.height = (window.self.innerHeight - heightContent) + noPx; 
			
		}
		
	}
		
}

function AerodromeInfoRedirect(sInfoType, sIcaoCode) {
	
	if (sInfoType == 'INFO') {
		sWindowURL = 'http://www.worldaerodata.com/wad.cgi?airport=' + sIcaoCode;
	} else {
		sWindowURL = 'http://www.meteowvl.be/weather-2.0.0/index.php?icao=' + sIcaoCode + '&language=en';
	}
	
	window.open(sWindowURL, 'AerodromeInfo', '');
	
	//alert("Type: " + sInfoType + "\nICAO: " + sIcaoCode);
	return false;
	
}

function popupform(myform, windowname) {
	
	if (!window.focus)return true;
	window.open('', windowname, 'height=550,width=675,scrollbars=yes,menubar=yes');
	myform.target=windowname;
	return true;
	
}

function insertAtCursor(myField, myValue) {
	//IE support
	if (document.selection) {
		myField.focus();
		sel = document.selection.createRange();
		sel.text = myValue;
	}
	//MOZILLA/NETSCAPE support
	else if (myField.selectionStart || myField.selectionStart == '0') {
		var startPos = myField.selectionStart;
		var endPos = myField.selectionEnd;
		myField.value = myField.value.substring(0, startPos)
		+ myValue
		+ myField.value.substring(endPos, myField.value.length);
	} else {
		myField.value += myValue;
	}
}
