var Stil = "800";
var Keks = "Layout";
var Tage = 30;

if(screen.width>=800)
{
	var Stil = "800";
	if(screen.width>=1024)
	{
		var Stil = "1024";
		if(screen.width>=1280)
		{
			var Stil = "1280";
			if(screen.width>=1600)
			{
				var Stil = "1600";
			}
		}
	}
}

if(isIE())
{
	coords_menu="102,75,50";
	coords_history_forward="174,22,185,39,193,66,191,93,182,116,172,131,152,114,164,101,167,77,165,54,153,37";
	coords_history_back="32,19,49,37,43,53,36,74,42,97,52,113,32,130,17,111,11,85,11,55,20,34";
	coords_shoutbox="23,156,17";
	coords_red="84,150,5";
	coords_yellow="110,152,5";
	coords_blue="97,152,5";
	coords_green="123,150,5";
}
else
{
	coords_menu="102,101,50";
	coords_history_forward="174,48,185,65,193,92,191,119,182,142,172,157,152,140,164,127,167,103,165,80,153,63";
	coords_history_back="32,45,49,63,43,79,36,100,42,123,52,139,32,156,17,137,11,111,11,81,20,60";
	coords_shoutbox="23,182,17";
	coords_red="84,176,5";
	coords_yellow="110,178,5";
	coords_blue="97,178,5";
	coords_green="123,176,5";
}

function isIE()
{
	var browser = navigator.appName;	
	if ( browser.indexOf("icrosoft")>=0 ) return true;
	if ( browser.indexOf("xplorer")>=0 ) return true;
	return false;
}

function printStyles(standardstyle)
{
	if( (standardstyle=="") || (standardstyle=="blue") )
	{
		document.write("<link type='text/css' href='css/"+Stil+"blue.css' title='cssblue' rel='stylesheet'>"+
		"<link type='text/css' href='css/"+Stil+"red.css' title='cssred' rel='stylesheet'>"+
		"<link type='text/css' href='css/"+Stil+"yellow.css' title='cssyellow' rel='stylesheet'>"+
		"<link type='text/css' href='css/"+Stil+"green.css' title='cssgreen' rel='stylesheet'>");
	}
	
	if(standardstyle=="green")
	{
		document.write("<link type='text/css' href='css/"+Stil+"green.css' title='cssgreen' rel='stylesheet'>"+
		"<link type='text/css' href='css/"+Stil+"red.css' title='cssred' rel='stylesheet'>"+
		"<link type='text/css' href='css/"+Stil+"yellow.css' title='cssyellow' rel='stylesheet'>"+
		"<link type='text/css' href='css/"+Stil+"blue.css' title='cssblue' rel='stylesheet'>");
	}
	
	if(standardstyle=="red")
	{
		document.write("<link type='text/css' href='css/"+Stil+"red.css' title='cssred' rel='stylesheet'>"+
		"<link type='text/css' href='css/"+Stil+"green.css' title='cssgreen' rel='stylesheet'>"+
		"<link type='text/css' href='css/"+Stil+"yellow.css' title='cssyellow' rel='stylesheet'>"+
		"<link type='text/css' href='css/"+Stil+"blue.css' title='cssblue' rel='stylesheet'>");
	}
	
	if(standardstyle=="yellow")
	{
		document.write("<link type='text/css' href='css/"+Stil+"yellow.css' title='cssyellow' rel='stylesheet'>"+
		"<link type='text/css' href='css/"+Stil+"red.css' title='cssred' rel='stylesheet'>"+
		"<link type='text/css' href='css/"+Stil+"green.css' title='cssgreen' rel='stylesheet'>"+
		"<link type='text/css' href='css/"+Stil+"blue.css' title='cssblue' rel='stylesheet'>");
	}
}

function switchStyle(s) 
{
	if (!document.getElementsByTagName) return;
	
	var el = document.getElementsByTagName("link");
	
	for (var i = 0; i < el.length; i++ ) 
	{
		if (el[i].getAttribute("rel").indexOf("style") != -1 && el[i].getAttribute("title")) 
		{
			el[i].disabled = true;
			if (el[i].getAttribute("title") == s) el[i].disabled = false;
		}
	}
}

function loadStyle() 
{
	var c = getStyleCookie();
	if (c && c != Stil) 
	{
		switchStyle(c);
		Stil = c;
	}
}

function setStyle(s) 
{
	if (s != Stil) 
	{
		switchStyle(s);
		Stil = s;
	}
}

setStyleCookie();
window.onload = loadStyle;

function setCookie(name, value, expdays) 
{
	// gültig expdays Tage
	var now = new Date();
	var exp = new Date(now.getTime() + (1000*60*60*24*expdays));
	
	document.cookie = name + "=" + escape(value) + ";" +"expires=" + exp.toGMTString() + ";" +"path=/";
}

function delCookie(name) 
{   
	// expires ist abgelaufen
	var now = new Date();
	var exp = new Date(now.getTime() - 1);
	
	document.cookie = name + "=;" +"expires=" + exp.toGMTString() + ";" + "path=/";
}

function getCookie(name) 
{
	var cname = name + "=";
	var dc = document.cookie;
	
	if (dc.length > 0) 
	{
		var start = dc.indexOf(cname);
		
		if (start != -1) 
		{
			start += cname.length;
			var stop = dc.indexOf(";", start);
			
			if (stop == -1) stop = dc.length;
			
			return unescape(dc.substring(start,stop));
		}
	}
	
	return null;
}

function setStyleCookie() 
{
	setCookie(Keks, Stil, Tage);
}

function getStyleCookie() 
{
	return getCookie(Keks);
}

function delStyleCookie() 
{
	delCookie(Keks);
}












function signup()
{
	tos=document.getElementById('cb_tos');
	email=document.getElementById('txt_email').value;
	nick=document.getElementById('txt_nick').value;
	pass=document.getElementById('txt_pass').value;
	pass2=document.getElementById('txt_pass2').value;
	
	if(tos.checked)
	{
		x_get('signup.php?e='+email+'&n='+nick+'&p1='+pass+'&p2='+pass2,'div_display'); 
	}
	else
	{
		alert('Please read and accept the terms of service! :o)');
	}
}

function addField(str)
{
	fields=document.getElementById('select_fields_user');
	
	exists=false;
	for(x=0;x<fields.length;x++)
	{
		if(fields.options[x].value==str)
		{
			exists=true;
			break;
		}
	}
	
	if(!exists)
	{
		NeuerEintrag=new Option(str,str,false,true);
		fields.options[fields.length]=NeuerEintrag;
	}
}

function deleteField(str)
{
	fields=document.getElementById('select_fields_user');
	
	for(x=0;x<fields.length;x++)
	{
		if(fields.options[x].value==str)
		{
			fields.options[x]=null;
			break;
		}
	}
}

function showDiv(id)
{
	document.getElementById(id).style.display="block";
}

function hideDiv(id)
{
	document.getElementById(id).style.display="none";
}

function hideRatings()
{
	//
}

function switchSection(input)
{
	section=document.getElementById(input);
	if(section.style.display=="none")
	{
		section.style.display="block";
	}
	else
	{
		section.style.display="none";
	}
}

function checkcurrency()
{
	var str=document.form.amount.value;
	
	if(str.search(",")>=0)
	{
		document.form.amount.value=str.replace(",",".");
		alert("Please use a dot (.) to sepearate euro and cent!");
		document.form.amount.focus();
	}
	
	if(str<2.00)
	{
		document.form.amount.value="2.00";
		alert("Please enter at least 2.00 €!");
		document.form.amount.focus();
	}
}

p=777;
WMTT=null;
document.onmousemove=updateToolTip;

function updateToolTip(e) 
{
	x=(document.all)?window.event.x+document.body.scrollLeft:e.pageX;
	y=(document.all)?window.event.y+document.body.scrollTop:e.pageY;
	
	if (WMTT!=null) 
	{		
		versetzungX=-160;
		versetzungY=-55;
		
		var WMTTID = WMTT.id;
		var ersterTeilDerID = WMTTID.substr(0,6);
		
		WMTT.style.left=(x+versetzungX)+"px";
		WMTT.style.top=(y+versetzungY)+"px";
	}
}

function showToolTip(id,inputposition) 
{
	updateToolTip;
	position=inputposition;
	WMTT=document.getElementById(id);
	WMTT.style.display="block"
}

function hideToolTip() 
{
	if (WMTT!=null)	WMTT.style.display="none";
}

function setDownloadLink(html,div)
{
	document.getElementById(div).innerHTML=html;
}

function hideMessage()
{
	document.getElementById('messagebox').style.display="none";
}