mouse_on_tip = 0;
mouse_on_bild = 0;

function showTipAtMouse(elem, tipID)
{
	mouse_on_bild = 1;
	if(document.getElementById("tiptext"+tipID)) {
		document.getElementById("tipContent").innerHTML = document.getElementById("tiptext"+tipID).innerHTML;
		pos = findPos(elem);
		x = pos[0] - 75;
		y = pos[1] + 25;
		document.getElementById("tipContainer").style.left = x;
		document.getElementById("tipContainer").style.top = y;
		document.getElementById("tipContainer").style.display = "block";
	}
}


function showTip(elem, tipID)
{
	mouse_on_bild = 1;
	if(document.getElementById("tiptext"+tipID)) {
		document.getElementById("tipContent").innerHTML = document.getElementById("tiptext"+tipID).innerHTML;
		pos = findPos(elem);
		x = pos[0] - 85 + 39;
		y = pos[1] + 70;
		document.getElementById("tipContainer").style.left = x;
		document.getElementById("tipContainer").style.top = y;
		document.getElementById("tipContainer").style.display = "block";
	}
}
function showTip2()
{
	mouse_on_tip = 1;
}
function hideTip()
{
	mouse_on_bild = 0;
	var t=setTimeout("hideTip_go()",300);
}
function hideTip2()
{
	mouse_on_tip = 0;
	var t=setTimeout("hideTip_go()",300);
}
function hideTip_go()
{
	if (mouse_on_tip == 0 && mouse_on_bild == 0) {
		document.getElementById("tipContainer").style.display = "none";
	}
}

function valueToFormElement(objId,val)
{
	if(document.getElementById(objId))
	{
		if(document.getElementById(objId).type=="select-one")
		{
			for (var i = 0; i < document.getElementById(objId).length; ++i)
			{
				if(document.getElementById(objId).options[i].value == val)
				{
					document.getElementById(objId).selectedIndex = i;
				}
			}
		}
		else
		{
			document.getElementById(objId).value = val;
		}
	}
}

function showOrHideElement(objId,showOrHide)
{
	if(document.getElementById(objId))
	{
		document.getElementById(objId).style.display = showOrHide;
	}
}

function hideSelectPopup() {
	x = document.getElementsByTagName('div');
	for(i=0;i<x.length;i++){
		if (document.getElementsByTagName('div')[i].className == 'jsSelect_popup') {
			myid = document.getElementsByTagName('div')[i].id;
			showOrHideElement(myid, 'none');
		}
	}
}


function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
	do {
			curleft += obj.offsetLeft;
			curtop += obj.offsetTop;
		} while (obj = obj.offsetParent);
	return [curleft,curtop];
	}
}

function checkBrowser(){
	this.ver=navigator.appVersion
	this.dom=document.getElementById?1:0
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;
	this.ie4=(document.all && !this.dom)?1:0;
	this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0;
	this.ns4=(document.layers && !this.dom)?1:0;
	this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5)
	return this
}

function showBlock(div,nest){
	bw=new checkBrowser()
	obj=bw.dom?document.getElementById(div).style:bw.ie4?document.all[div].style:bw.ns4?nest?document[nest].document[div]:document[div]:0;
	obj.display='block'
}

//Hides the div
function hideBlock(div,nest){
	bw=new checkBrowser()
	obj=bw.dom?document.getElementById(div).style:bw.ie4?document.all[div].style:bw.ns4?nest?document[nest].document[div]:document[div]:0;
	obj.display='none'
}

function nextCarouselImage(){
	var r = document.getElementById('r-m-content');
	rr = parseInt(r.title);
	if(rr==3){
		var n = 1;
	}else{
		var n = rr+1;
	}
	p = document.getElementById('r-im-'+n);
	
	r.innerHTML = '<img src="'+p.src+'" width="272px" height="204px" />';
	r.title = n;
	
	carouselToggle(n);
}

function carouselToggle(n){
	var i = 0;
	for(i=1;i<4;i++){
		if(i!=n){
			hideBlock('r-con-'+i);
			hideBlock('r-head-'+i);
		}
	}
	
	showBlock('r-con-'+n);
	showBlock('r-head-'+n);
}

function prevCarouselImage(){
	var r = document.getElementById('r-m-content');
	rr = parseInt(r.title);
	if(rr==1){
		var n = 3;
	}else{
		var n = rr-1;
	}
	p = document.getElementById('r-im-'+n);
	
	r.innerHTML = '<img src="'+p.src+'" width="272px" height="204px" />';
	r.title = n;
	
	carouselToggle(n);
}

function showCarousel(n){
	var r = document.getElementById('r-m-content');
	
	p = document.getElementById('r-im-'+n);
	
	r.innerHTML = '<img src="'+p.src+'" width="272px" height="204px" />';
	r.title = n;
	
	carouselToggle(n);
}

function carouselAlways(){
	setTimeout('carouselAlways();', 5000);		
	nextCarouselImage();	
}

function submitPublicationsForm(mode)
{
	if(mode=="jahre" || mode=="themen")
	{
		document.getElementById(mode+"_hidden_submit").value = 1;
		document.getElementById("publications_form").submit();
	}
	
}