
function size(elName, heightOccupied, NNdiff, elToHide){
	var w, h
	if(window.innerHeight){
		// uncomment this if discrepancy only occurs in netscape browser:
		//if(navigator.appName == "Netscape")
		heightOccupied += NNdiff
		w = window.innerWidth - 5
		h = window.innerHeight
	}else{
		w = document.documentElement.offsetWidth
		h = document.documentElement.offsetHeight
	}
	// didn't feel like upating the calls in all pages so, quick and dirty:
	h++
	
	var el = document.getElementById?document.getElementById(elName):document.all[elName]
	var height = h - heightOccupied
	if(height > 0)
		el.style.height = height + "px"
	if(elToHide){
		if(w < 986){
			el = document.getElementById?document.getElementById(elToHide):document.all[elToHide]
			el.style.backgroundImage = "url(/pics/nix.gif)"
		}
	}
}

// (not use anymore:)
function checkTitle(txtBold, txtPlain){
	// this prints an HTML-title instead of a flash title for netscape versions lower than 7:
	if(navigator.appName == "Netscape"){
		if (!(document.body && typeof(document.body.clientWidth) == 'number')){
			document.getElementById("contact_header").innerHTML = "<div class=\"print_title\"><strong>" + txtBold + "</strong> " + txtPlain + "</div>"
		}
	}
}

function replaceTitle(txtBold, txtPlain, txtBold2, txtPlain2){
	// this prints an HTML-title instead of a flash title for netscape flash plugin versions lower than 6:
	var txtBold = arguments[0]?arguments[0]:""
	var txtPlain = arguments[1]?arguments[1]:""
	var txtBold2 = arguments[2]?arguments[2]:""
	var txtPlain2 = arguments[3]?arguments[3]:""
	if(!checkNonIEplayerVersion(6)){
		if(txtBold2)
			document.getElementById("page_header").innerHTML = "<div class=\"print_title\"><div style=\"float:left; width:198px; font-weight:bold;\">" + txtBold + "</div><span><strong>" + txtBold2 + "</strong></span> " + txtPlain2 + "</div>"
		else
			document.getElementById("page_header").innerHTML = "<div class=\"print_title\"><strong>" + txtBold + "</strong> " + txtPlain + "</div>"
	}
}

function checkNonIEplayerVersion(targetVersion){
	var version=0
	if(navigator.plugins.length){ 
		for (var i=0; i < navigator.plugins.length; i++){
			if(navigator.plugins[i].name.indexOf("Shockwave Flash") > -1){
				version = parseInt(navigator.plugins[i].description.split(" ")[2].charAt(0))
				break
			}
		} 
		if(version < targetVersion)
			return false
	}
	return true
}

function changeClass(elObj, cName){
	elObj.style.className = cName
	document.getElementById(elObj.id).className = cName
}

function gotoPage(pageName){
	alert("going to the " + pageName + " page...")
}

function hi(cid){
	document.images["mapImg"].src = "/pics/map" + cid + ".gif"
}
function low(){
	document.images["mapImg"].src = "/pics/mapWorld.gif"
}

function loadMap(){
	loadImage("/pics/mapAF.gif")
	loadImage("/pics/mapAS.gif")
	loadImage("/pics/mapEU.gif")
	loadImage("/pics/mapME.gif")
	loadImage("/pics/mapOC.gif")
	loadImage("/pics/mapUS.gif")
	loadImage("/pics/mapSA.gif")
}

function loadImage(imgPath){
	if(!document.imgArr){
		document.imgArr = new Array()
		imgCount = 0
	}
	document.imgArr[imgCount] = new Image()
	document.imgArr[imgCount++].src = imgPath
}

function alertDHTMLprops(){
	alert(
		"window.innerHeight = " + window.innerHeight + "\n" +
		"window.offsetHeight = " + window.offsetHeight + "\n" +
		"window.clientHeight = " + window.clientHeight + "\n" +
		"window.scrollHeight = " + window.scrollHeight + "\n" +
		"window.pageYOffset = " + window.pageYOffset + "\n" +
		"window.scrollTop = " + window.scrollTop + "\n" +
		"window.innerWidth = " + window.innerWidth  + "\n" +
		"window.offsetWidth = " + window.offsetWidth + "\n" +
		"window.clientWidth = " + window.clientWidth + "\n" +
		"window.scrollWidth = " + window.scrollWidth + "\n" +
		"window.pageXOffset = " + window.pageXOffset + "\n" +
		"window.scrollLeft = " + window.scrollLeft + "\n" +
		"document.body.innerHeight = " + document.body.innerHeight + "\n" +
		"document.body.offsetHeight = " + document.body.offsetHeight + "\n" +
		"document.body.clientHeight = " + document.body.clientHeight + "\n" +
		"document.body.scrollHeight = " + document.body.scrollHeight + "\n" +
		"document.body.pageYOffset = " + document.body.pageYOffset + "\n" +
		"document.body.scrollTop = " + document.body.scrollTop + "\n" +
		"document.body.innerWidth = " + document.body.innerWidth + "\n" +
		"document.body.offsetWidth = " + document.body.offsetWidth + "\n" +
		"document.body.clientWidth = " + document.body.clientWidth + "\n" +
		"document.body.scrollWidth = " + document.body.scrollWidth + "\n" +
		"document.body.pageXOffset = " + document.body.pageXOffset + "\n" +
		"document.body.scrollLeft = " + document.body.scrollLeft + "\n" +
		"document.documentElement.innerHeight = " + document.documentElement.innerHeight + "\n" +
		"document.documentElement.offsetHeight = " + document.documentElement.offsetHeight + "\n" +
		"document.documentElement.clientHeight = " + document.documentElement.clientHeight + "\n" +
		"document.documentElement.scrollHeight = " + document.documentElement.scrollHeight + "\n" +
		"document.documentElement.pageYOffset = " + document.documentElement.pageYOffset + "\n" +
		"document.documentElement.scrollTop = " + document.documentElement.scrollTop + "\n" +
		"document.documentElement.innerWidth = " + document.documentElement.innerWidth + "\n" +
		"document.documentElement.offsetWidth = " + document.documentElement.offsetWidth + "\n" +
		"document.documentElement.clientWidth = " + document.documentElement.clientWidth + "\n" +
		"document.documentElement.scrollWidth = " + document.documentElement.scrollWidth + "\n" +
		"document.documentElement.pageXOffset = " + document.documentElement.pageXOffset + "\n" +
		"document.documentElement.scrollLeft = " + document.documentElement.scrollLeft
	)
}

// Navigation vars and functions ---------------------------------------------------------------
var menu = {box1: 'menu1', box2: 'menu2', box3: 'menu3', box4: 'menu4', box5: 'menu5', box6: 'menu6', box7: 'menu7', box8: 'menu8', box9: 'menu9'};
var last = [];
var timeID;
var current;
var currentTimerID;

function showMenu(aRef) {

	var lvl1;
	var lvl2;	
	
	if(menu[aRef.id] == null) {
		
	
		for(var n in menu) {
			if(menu[n] == aRef.parentNode.id) {
				lvl1 = getObj(n);
				lvl2 = getObj(menu[n]);
				aRef.className = 'over';
			}
		}
		
		if(lvl1 == null) lvl1 = getObj(aRef.id);
				
	} else {
		lvl1 = getObj(aRef.id);
		lvl2 = getObj(menu[aRef.id]);
	}
	
	clearAll((last[0] == lvl1));
	
	if(lvl2 != null) {
		lvl1.className = 'navilayersubLink';		
		lvl2.style.display = getObj('subNav').style.display = 'block';
	} else {
		lvl1.className += ' navilayer_over';
	}	
	last = [lvl1,lvl2,aRef];
}

function clearAll(keepBG) {
	if(timeID != null) {
		clearTimeout(timeID);
		timeID = null;
	}
	
	if(last[0] != null) last[0].className = String(last[0].className).indexOf('navilayer_over') > -1 ? 'navilayer' : 'navilayersub';
	if(last[1] != null && !keepBG) last[1].style.display = getObj('subNav').style.display = 'none';
	if(last[2] != null && last[2].className == 'over') last[2].className = '';
	
	
	last = [];	
}

function timeOut() {	
	timeID = setTimeout((current != null) ? 'showMenu(current)' : 'clearAll()',800);
}

function getObj(name)
{
  if (document.getElementById)
  {
    return document.getElementById(name);
  }
  else if (document.all)
  {
    return document.all[name];
  }
  
  else return false;
}

function toggleVis(id,type)
{
	if(type == null) type = 'block';

	el = document.getElementById(id);
	if (el.style.display == 'none')
	{
		el.style.display = type;
		
		
	} else {
		el.style.display = 'none';
		
	}
}