// bilder austauschen
function changeImg(id)
{
	who   = document.getElementById(id);
	where = document.getElementById("i"+id);
	imgs  = document.getElementById(id).imgs;
	if(who.nowi < who.maxi)
	{
		who.nowi += 1;
	}
	else
	{
		who.nowi = 0;
	}
	html            = imgs[who.nowi]; //+"<img id='pfeil' src='images/pfeil.gif' width='20' height='20' border='0'>";
	where.innerHTML = html;
}

// aufklappen von projes ----------------------------------------------
whichPro = "none";
function changeDisplay(id)
{
	if(BrowserDetect.browser == "explöder") { changeDisplay1(id); }
	else                                    { changeDisplay2(id); }
}

// internetexplorer ist ein arschloch
function changeDisplay1(id)
{
	who = document.getElementById("c"+id);
	if(who.style.display =="none")
	{
		who.style.display = "block";		
		if(whichPro != "none") 	{ whichPro.style.display = "none"; }
		whichPro = who;
	}
	else
	{
		who.style.display = "none";
		whichPro = "none";
	}
}

// und für die restlichen browser
function changeDisplay2(id)
{
	who = document.getElementById("c"+id);
	if(who.style.display =="none")
	{
		$("#c"+id).slideDown("slow");
		if(whichPro != "none") { $("#"+whichPro.id).slideUp("slow"); }
		whichPro = who;
	}
	else
	{
		$("#c"+id).slideUp("slow");
		whichPro = "none";
	}
}
// --------------------------------------------------------------------

// ab- und anstellen ------------------------------
function imgon(who){
	document.getElementById(who).style.visibility = "visible";
}
function imgof(who){
	document.getElementById(who).style.visibility = "hidden";
}

/* safemail func */
function safemail(name, domain, display, linkclass) {
	displayed=(display.length)<1 ? name+"@"+domain : display;
	document.write('<a class="'+linkclass+'" href="mailto:' + name + '@' + domain + '">' + displayed + '</a>');
}

/* very nice function from die-gestalten.de. thx */
function popup(url, w, h, f, x, y){
	if(navigator.userAgent.indexOf("Safari") != -1){
		w = w - 2;
	}
	var day = new Date();
	var id = day.getTime();
	var name = "ilovefu" + id;
	
	if(x == null){
		x = Math.round((screen.availWidth-w)/2);
	}
	if(y == null){
		y = Math.round((screen.availHeight-h)/2);
	}
	var features = "width="+w+",height="+h+",left="+x+",top="+y+",screenX="+x+",screenY="+y+",toolbar=no,location=no,status=no,menubar=no,history=no,titlebar=no,alwaysRaised";

	if(f != null){
		features += "," + f;
	}

	eval("var win"+id+" = window.open('"+url+"', '"+name+"', '"+features+"');");
	eval("win"+id+".moveTo("+x+","+y+");");
	eval("win"+id+".focus();");
}

function open_example_win(url, width, height) {
	popup(url,width,height, 'resizable=no,scrollbars=no')
}

function redirect_to (url) {
	location.href=url;
	return true;
}

Cufon.replace('h1')('h2');
jQuery(function($)
{
	// schrifften
	Cufon.now();
});