var ns4, ie4, ns6;
ns4 = (document.layers)? true:false
ie4 = (document.all)? true:false
ns6 = (document.getElementById)? true:false;

//showhide functions for mouseovers on teasers
function popUpWin(page, props) {
	window.open(page,'', props );
	return false;
}

function hideAll()
{
	
}


function getObj(id) {
	var theObj;
	if (ns4) {
		theObj = document.layers[id];
	}
	if (ie4)	{
		theObj = document.all[id];
	}
	if (ns6)	{
		theObj = document.getElementById(id);
	}
	return theObj;
}


function hideTeaserBaseImg()
{ 
	var isValidObject = getObj('base-img');
	if (isValidObject)
	{
		//hide('base-img');
		//hide('base-head');
		//hide just the text box
		hide('base-text');
	}
}

function showTeaser(nr) {
	var isValidObject = getObj(eval('"teaser' + nr + '-img"'));
	if (isValidObject)
	{
		//first: hide the base image
		hideTeaserBaseImg();
		
		show(eval('"teaser' + nr + '-img"'));
		show(eval('"teaser' + nr + '-frame"'));
		show(eval('"teaser' + nr + '-head"'));
		show(eval('"teaser' + nr + '-text"'));
	}
}

function hideTeaser(nr) {
	var isValidObject = getObj(eval('"teaser' + nr + '-img"'));
	//alert(isValidObject);
	if (isValidObject)
	{
		hide(eval('"teaser' + nr + '-img"'));
		hide(eval('"teaser' + nr + '-frame"'));
		hide(eval('"teaser' + nr + '-head"'));
		hide(eval('"teaser' + nr + '-text"'));
	}
}


function showPgSub(id){
	if (ns4) {
		//nothing
	}
	else if (ie4) {	
		document.all['teaser'+id+'-text'].style.display = "block";
		document.all['teaser'+id+'-img'].style.display = "block";
		document.getElementById('teaserImage').className = "topicTeaserImg"
	}
	else if (ns6) {
		document.getElementById('teaser'+id+'-text').style.display = "block";
		document.getElementById('teaser'+id+'-img').style.display = "block";
		document.getElementById('teaserImage').className = "topicTeaserImg"
	}
}

function hidePgSub(id){
	if (ns4) {
		//nothing
	}
	else if (ie4) {	
		document.all['teaser'+id+'-text'].style.display = "none";
		document.all['teaser'+id+'-img'].style.display = "none";
		document.getElementById('teaserImage').className = "white"
	}
	else if (ns6) {
		document.getElementById('teaser'+id+'-text').style.display = "none";
		document.getElementById('teaser'+id+'-img').style.display = "none";
		document.getElementById('teaserImage').className = "white"
	}
}	


//showhide functions for mouseovers on homepage
function showHome(nr) {
	var theObj = getObj(eval('"home' + nr + '-text"'));
	if ( theObj ) {
		show(eval('"home' + nr + '-text"'));
		var  theImage = eval('document.img' + nr ) ;
		theImage.src = theImage.src.replace(/_fade.jpg/, ".jpg");	
	}
}

function hideHome(nr) {
	var theObj = getObj(eval('"home' + nr + '-text"'));
	if ( theObj ) {
		hide(eval('"home' + nr + '-text"'));
		var  theImage = eval('document.img' + nr ) ;
		theImage.src = theImage.src.replace(/.jpg/, "_fade.jpg");
	}
}



// Show/Hide functions for non-pointer layer/objects
function show(id) {
	var theObj = getObj(id);
	if ( theObj ) {
		if (ns4) {
			document.layers[id].visibility = "show";
		}
		else if (ie4) {
			document.all[id].style.visibility = 'visible';
		}
		else if (ns6) {
			document.getElementById(id).style.visibility= 'visible';
		}
	}
}

function hide(id) {
	var theObj = getObj(id);
	if ( theObj ) {
		if (ns4) {
			document.layers[id].visibility = "hide";
		}
		else if (ie4) {
			document.all[id].style.visibility = "hidden";
		}
		else if (ns6) {
			document.getElementById(id).style.visibility= 'hidden';
		}
	}
}

