function highlightImg(topicName) {
	var imgSrc = document.images[topicName].src;
	if(imgSrc.indexOf("_high.png") == -1) {
		document.images[topicName].src = imgSrc.substring(0,imgSrc.indexOf(".png")) + "_high.png";
	}
}

function resetImg(topicName) {
	var imgSrc = document.images[topicName].src;
	if(imgSrc.indexOf("_high.png") != -1) {
		document.images[topicName].src = imgSrc.substring(0,imgSrc.indexOf("_high.png")) + ".png";
	}
}

function openMenue(topic1, topic2) {

	if(document.getElementById) {
		document.getElementById(topic1).style.visibility="visible";
		document.getElementById(topic2).style.visibility="hidden";
	}
	else if(document.all && !document.getElementById) {
		document.all[topic1].style.visibility="visible";
		document.all[topic2].style.visibility="hidden";
	}
}

function closeMenue(topic1, topic2) {
	if(document.getElementById) {
		document.getElementById(topic1).style.visibility="hidden";
		document.getElementById(topic2).style.visibility="visible";
	}
	else if(document.all && !document.getElementById) {
		document.all[topic1].style.visibility="hidden";
		document.all[topic2].style.visibility="visible";
	}
}

// - - - //


var bg_img_faktor = false;

function resizeBgImg() {
	var vp = getViewportSize();
	
	if( (vp.width/vp.height) < bg_img_faktor) {
		var new_w = Math.round(vp.height*bg_img_faktor);
		var new_h = Math.round(vp.height);
	} else {
		var new_w = Math.round(vp.width);
		var new_h = Math.round(vp.width/bg_img_faktor);
	}
	if(isFinite(new_w) && isFinite(new_h) ) {		
		document.getElementById('bg_img').style.width = new_w +"px";
		document.getElementById('bg_img').style.height = new_h +"px";
	}
}


function getViewportSize() {
	var x,y;
	if (self.innerHeight) // all except Explorer
	{
		x = self.innerWidth;
		y = self.innerHeight;
	}
	else if (document.documentElement && document.documentElement.clientHeight)
		// Explorer 6 Strict Mode
	{
		x = document.documentElement.clientWidth;
		y = document.documentElement.clientHeight;
	}
	else if (document.body) // other Explorers
	{
		x = document.body.clientWidth;
		y = document.body.clientHeight;
	}
	return {width:x,height:y};
}


function getImageFactor(url) {
	var img = document.createElement("img");
	img.src = url;
	document.getElementsByTagName('body')[0].appendChild(img);
	
	bg_img_faktor =  img.width / img.height; 
	img.parentNode.removeChild(img);
	
	return true;
}


function start() {
	if( resizeBgImg && document.getElementById('bg_img') && navigator.userAgent.search(/MSIE 7/) == -1 && navigator.userAgent.search(/Firefox/) == -1) {
		getImageFactor( document.getElementById('bg_img').src );
		Event.observe(window, 'resize', resizeBgImg);
		resizeBgImg();
	}
}