var newwin;
function popup(winurl,winname,winfeatures) {              
	newwin = window.open(winurl,winname,winfeatures);      
	newwin.focus();             
}

function checkBrowser(){
        this.ver = navigator.appVersion;

        this.dom = document.getElementById?1:0;

        this.ie7 = (this.ver.indexOf("MSIE 7")>-1 && this.dom)?1:0;
		this.ie6 = (this.ver.indexOf("MSIE 6")>-1 && this.dom)?1:0;
        this.ie55 = (this.ver.indexOf("MSIE 5.5")>-1 && this.dom)?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) ? 1:0;
        this.bw  = (this.ie5 || this.ie4 || this.ns4 || this.ns5 || this.ie55 || this.ie6);
        this.os  = (this.ver.indexOf("Macintosh")>-1)? "mac":"pc";
        this.ie  = (this.ie5 || this.ie4 || this.ie55 || this.ie6);
        this.ns  = (this.ns4 || this.ns5);
        this.client = (this.ie) ? "ie" : "ns";
		this.ok  =  (this.dom)
		return this;
}

function chkRegForm() {
	meldung = varfillinyour+"\n" 
	theForm = document.formular;
		if (theForm.Nickname.value == "" || theForm.Nickname.value.length < 6)
			{ meldung += "   - "+varUsername+"\n"}
		if (theForm.Email.value == "" || theForm.Email.value.indexOf("@") == -1 || theForm.Email.value.indexOf(".") == -1)
			{ meldung += "   - "+varEmail+"\n"}
		if (theForm.Password.value == "" || theForm.Password.value.length < 6)
			{ meldung += "   - "+varPassword+"\n"}
		if (theForm.PasswordConfirm.value == "" || theForm.PasswordConfirm.value != theForm.Password.value)
			{ meldung += "   - "+varConfirmPassword+"\n"}
		if (!theForm.TermsAccept.checked)
			{ meldung += "   - "+varTermsAccept+"\n"}
		if (theForm.Captcha.value == "")
			{ meldung += "   - "+varCaptcha+"\n"}
				
	if (meldung.length > varfillinyour.length+2)
		{alert(meldung)}
	else {theForm.Password.value = MD5(theForm.Password.value); theForm.submit()}
}

var donotCheckPw = false;
function chkSettForm(Kat) {
	meldung = varfillinyour+"\n" 
	theForm = document.formular;
		//fuer premium user
		if (Kat == "prem") {
			if (theForm.Vorname.value == "")
			{ meldung += "   - "+varVorname+"\n"}
			if (theForm.Nachname.value == "")
			{ meldung += "   - "+varNachname+"\n"}
			
		}
		
		else if (theForm.Email.value == "" || theForm.Email.value.indexOf("@") == -1 || theForm.Email.value.indexOf(".") == -1) { 
			meldung += "   - "+varEmail+"\n"
		}
			
		if (theForm.Password.value == "******") {
			donotCheckPw = true;
		} 
		else if (theForm.Password.value == "" || theForm.Password.value.length < 6)	{ 
			meldung += "   - "+varPassword+"\n"
		}
		if (donotCheckPw == false) {
			if (theForm.PasswordConfirm.value == "" || theForm.PasswordConfirm.value != theForm.Password.value)
				{ meldung += "   - "+varConfirmPassword+"\n"}
		}
		if (theForm.NewsletterCheck.checked) {
			theForm.Newsletter.value = 1;
		}
		else {
			theForm.Newsletter.value = 0;
		}
		
		if (Kat == "prem") {
			if (theForm.Country.value == "")
			{ meldung += "   - "+varCountry+"\n"}
			if (theForm.Address.value == "")
			{ meldung += "   - "+varAddress+"\n"}
			if (theForm.Citytown.value == "")
			{ meldung += "   - "+varCity+"\n"}
			if (theForm.Zip.value == "")
			{ meldung += "   - "+varZip+"\n"}
			if (theForm.Birthmonth.value == "" || theForm.Birthday.value == "" || theForm.Birthyear.value == "")
			{ meldung += "   - "+varBirthday+"\n"}
		}
		
	if (meldung.length > varfillinyour.length+2) {
		alert(meldung)
	}
	else { 
		if (theForm.Email.value == theForm.Emailalt.value) {
			theForm.Email.value = "";
		}
		if (theForm.Password.value == "******") {
			theForm.Password.value = "";
		} 
		if (donotCheckPw == false) { 
			theForm.Password.value = MD5(theForm.Password.value); 
		}  
		theForm.submit()}
}

function chkLoginForm() {
	meldung = varfillinyour+"\n" 
	theForm = document.formular;
		if (theForm.Username.value == "")
			{ meldung += "   - "+varUsername+"\n"}
		if (theForm.PasswordCheck.value == "")
			{ meldung += "   - "+varPassword+"\n"}
				
	if (meldung.length > varfillinyour.length+2)
		{alert(meldung)}
	else {theForm.Password.value = MD5(theForm.PasswordCheck.value); theForm.PasswordCheck.value = ""; theForm.submit()}
}
function chkTafForm() {
	meldung = varfillinyour+"\n" 
	theForm = document.formular;
		if (theForm.Name.value == "")
			{ meldung += "   - "+varName+"\n"}
		if (theForm.Email.value == "" || theForm.Email.value.indexOf("@") == -1 || theForm.Email.value.indexOf(".") == -1)
			{ meldung += "   - "+varEmail+"\n"}
		if (theForm.EmpfaengerName.value == "")
			{ meldung += "   - "+varEmpfaengerName+"\n"}
		if (theForm.EmpfaengerEmail.value == "" || theForm.EmpfaengerEmail.value.indexOf("@") == -1 || theForm.EmpfaengerEmail.value.indexOf(".") == -1)
			{ meldung += "   - "+varEmpfaengerEmail+"\n"}
		if (theForm.Nachricht.value == "")
			{ meldung += "   - "+varNachricht+"\n"}
		if (theForm.Captcha.value == "")
			{ meldung += "   - "+varCaptcha+"\n"}
			
	if (meldung.length > varfillinyour.length+2)
		{alert(meldung)}
	else {theForm.submit()}
}
function chkContactForm() {
	meldung = varfillinyour+"\n" 
	theForm = document.formular;
		if (theForm.Name.value == "")
			{ meldung += "   - "+varName+"\n"}
		if (theForm.Email.value == "" || theForm.Email.value.indexOf("@") == -1 || theForm.Email.value.indexOf(".") == -1)
			{ meldung += "   - "+varEmail+"\n"}
		if (theForm.Nachricht.value == "")
			{ meldung += "   - "+varNachricht+"\n"}
		if (theForm.Captcha.value == "")
			{ meldung += "   - "+varCaptcha+"\n"}
			
	if (meldung.length > varfillinyour.length+2)
		{alert(meldung)}
	else {theForm.submit()}
}

function chkForgotForm() {
	meldung = varfillinyour+"\n" 
	theForm = document.formular;
		if (theForm.Email.value == "" || theForm.Email.value.indexOf("@") == -1 || theForm.Email.value.indexOf(".") == -1)
			{ meldung += "   - "+varEmail+"\n"}
		if (theForm.PasswordNew.value == "")
			{ meldung += "   - "+varNewPassword+"\n"}
		if (theForm.PasswordConfirm.value == "" || theForm.PasswordConfirm.value != theForm.PasswordNew.value)
			{ meldung += "   - "+varConfirmPassword+"\n"}
				
	if (meldung.length > varfillinyour.length+2)
		{alert(meldung)}
	else {theForm.PasswordNew.value = MD5(theForm.PasswordNew.value); theForm.submit()}
}
function chkNlForm() {
	meldung = varfillinyour+"\n" 
	theForm = document.formular;
		if (theForm.Email.value == "" || theForm.Email.value.indexOf("@") == -1 || theForm.Email.value.indexOf(".") == -1)
			{ meldung += "   - "+varEmail+"\n"}
				
	if (meldung.length > varfillinyour.length+2)
		{alert(meldung)}
	else { theForm.submit()}
}

function chkRegAgain() {
	meldung = varfillinyour+"\n" 
	theForm = document.formular2;
		if (theForm.Email.value == "" || theForm.Email.value.indexOf("@") == -1 || theForm.Email.value.indexOf(".") == -1)
			{ meldung += "   - "+varEmail+"\n"}
				
	if (meldung.length > varfillinyour.length+2)
		{alert(meldung)}
	else { theForm.submit()}
}

function switchImg(imgName, imgtype, xmlName) {
		oImg = findObj('switchB')
		if (imgtype == 'flv') {
		
			oImg.innerHTML = '<div id="flashContent"><a href="http://www.adobe.com/go/getflashplayer"><img src="images/get_flash_player.gif" alt="Get Adobe Flash player" border="0"></a></div>';
			var flashvars = false;
			var videofile = imgName;
			var xmlfile = xmlName;
			var params = {
			  menu: "false",
			  allowscriptaccess: "always",
			  allowfullscreen: "true",
			  flashvars: "file="+videofile+"&backcolor=666666&frontcolor=EEEEEE&lightcolor=FFFFFF&plugins=drelated-1&"+escape("drelated.dxmlpath")+"="+xmlfile+"&"+escape("drelated.dposition")+"=center&"+escape("drelated.dskin")+"=3d_sport/skins/grayskin.swf&"+escape("drelated.dtarget")+"=_self"
			};
			var attributes = {
			  id: "myDynamicContent",
			  name: "myDynamicContent"
			};
			swfobject.embedSWF("player.swf", "flashContent", "320", "260", "10.0.0","expressInstall.swf", flashvars, params, attributes);
		}
		else {
			oImg.innerHTML = '<img src="'+imgName+'" width="320" height="240" border="0" class="rahmen2">';
		}
		
}

function showRegTxt(id)	{
	divAkt = findObj("regagb");
	divAkt2 = findObj("regtxt");
	if (id == 'agb') {
		divAkt.style.display = "block";
		divAkt2.style.display = "none";
	}
	else
	{
		divAkt2.style.display = "block";
		divAkt.style.display = "none";
	}		
}

function showNews(id) {
	for (k=0;k<nLayer.length;k++) {
	     
		divAkt = findObj('newsblock'+nLayer[k]);
		divAkt.style.display = "none";
		divAkt = findObj('newstable'+nLayer[k]);
		//divAkt.className = 'textnewshead ' + farbe;
		divAkt1 = findObj('newsLink1'+nLayer[k]);
		divAkt2 = findObj('newsLink2'+nLayer[k]);
        /*if (divAkt1.className == 'rot' || divAkt1.className == 'rot weiss') {
    		divAkt1.className = 'rot';
    		divAkt2.className = 'rot';
        }
        else {
    		divAkt1.className = 'gruen';
    		divAkt2.className = 'gruen';
        }*/
	}
		divAkt = findObj('newsblock'+id);
		divAkt.style.display = "block";
		divAkt = findObj('newstable'+id);
		//divAkt.className = 'textnewshead';
		divAkt1 = findObj('newsLink1'+id);
		divAkt2 = findObj('newsLink2'+id);
        /*if (divAkt1.className == 'rot' || divAkt1.className == 'rot weiss') {
    		divAkt1.className = 'rot weiss';
    		divAkt2.className = 'rot weiss';
        }
        else {
    		divAkt1.className = 'gruen weiss';
    		divAkt2.className = 'gruen weiss';
        }*/
}
var timer = "";
function hideFlagTimeout(id) {
	//if (timer == "") {
		//zeit = (document.all) ? 3000 : 3500;
		zeit = 2500;
		timer = setTimeout(function(){hideFlag(id)},zeit)
	//}
	
}

function hideFlag(id) {
		divAkt = findObj('flag'+id);
		divAkt.style.display = "none";
		timer = "";
}

function showFlag(id,KoordX,KoordY) {
	//clearTimeout(timer);
	for (k=0;k<nLayer.length;k++) {
		divAkt = findObj('flag'+nLayer[k]);
		divAkt.style.display = "none";
	}
		divAkt = findObj('flag'+id);
		//divAkt.style.top = KoordX+"px";
		//divAkt.style.left = KoordY+"px";
		divAkt.style.display = "block";
}

function hideThis(id) {
		divAkt = findObj(id);
		divAkt.style.display = "none";
}

function showThis(id) {
		divAkt = findObj(id);
		divAkt.style.display = "block";
}

function setXYShow(id,e) {
		mPos = getMousePos(e);
		divAkt = findObj(id);
		divAkt.style.display = "block";
		divAkt.style.top = (mPos[1] + 0) + "px";
		divAkt.style.left = (mPos[0] + 0) + "px";
}

function setXY(id,KoordX,KoordY) {
		divAkt = findObj(id);
		divAkt.style.top = KoordX+"px";
		divAkt.style.left = KoordY+"px";
}
function getMousePos(e) {
	var posx = 0;
	var posy = 0;
	if (!e) var e = window.event;
	if (e.pageX || e.pageY) 	{
		posx = e.pageX;
		posy = e.pageY;
	}
	else if (e.clientX || e.clientY) 	{
		posx = e.clientX + document.body.scrollLeft
			+ document.documentElement.scrollLeft;
		posy = e.clientY + document.body.scrollTop
			+ document.documentElement.scrollTop;
	}
	// posx and posy contain the mouse position relative to the document
	// Do something with this information
	coord = new Array(posx,posy)
	return coord;
}
function chngColor(id) {
	divAkt = findObj(id);
	classAlt = divAkt.className;
	divAkt.className = classAlt + ' orange';	
}