
//umfrage = true;

var loginMthd = {
    usernameValue:"Benutzername",
    passwordValue:"Passwort",
    focusClassName:"grau",
    blurClassName:"grau",

    clearLogin:function(e) {
    	el = e.element();
	if(el.id) {
		if(el.id == 'loginUsername' && el.value == loginMthd.usernameValue) {
			el.value = '';
			el.className = loginMthd.focusClassName;
        	}
        	else if(el.id == 'loginPassword' && el.value == loginMthd.passwordValue) {
			el.value = '';
			el.className = loginMthd.focusClassName;				
        	}
        	else {
        		el.select();
        	}
        }
    },
    
    checkLogin:function(e) {
    	el = e.element();
	if(el.id) {
		if(el.id == 'loginUsername' && el.value == '') {
       			el.value = loginMthd.usernameValue;
       			el.className = loginMthd.blurClassName;
        	}
        	else if(el.id == 'loginPassword' && el.value == '') {
       			el.value = loginMthd.passwordValue;
       			el.className = loginMthd.blurClassName;        			
        	}
        }
    }
}

Event.observe(window, 'load', function() {
	inp = document.getElementById("input_suche");
	if(inp.className=="inline_focus") {
		inp.onclick=function() {
			this.className="";this.value="";
		}
	}
});

function getCookie(name){
	var n = new RegExp(name+"="), _val="";
	if(n.test(document.cookie)){ _val=document.cookie.split(name+"=")[1].substring(0, document.cookie.split(name+"=")[1].indexOf(";")); }
	return unescape(_val);
}

function setCookie(name, value){
	document.cookie=name+"="+value;
}

function media_flash(){
	// default Parameter
	var width="100%", height="100%", version="8", background="#ffffff", _id="", _n=new Array(), params=null, alt="", _aP=new Array();
	for(i=0;i<12;i++){	_id+=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","-","1","2","3"][Math.ceil(Math.random()*30)];	}

	args=media_flash.arguments;
	switch(args.length){
		case 5:
			params=args[4];
		case 4:
			height=args[3];
		case 3:
			width=args[2];
		case 2:
			alt=(args[1].indexOf("HTML:")==0)?decodeURIComponent(args[1].substr(5)):args[1];
		default:
			name=(args[0].toLowerCase().lastIndexOf(".swf")+1)?args[0].substring(0,args[0].toLowerCase().lastIndexOf(".swf")):args[0];
			break;
	}
	if(params!=null){
		_p=params.split(",");
		for(var i=0;i<_p.length;i++){
			_split=_p[i].replace(/[\s]/g, "").split(":");
			if(_split[0]=="background"){	background=_split[1];	}
			//if(_split[0]=="wmode"){	_aP[_aP.length]=new Array(_split[0],_split[1]);	}
			if(_split[0]=="version"){ version=_split[1]; }
			else{	_n[_n.length]=_split[0]+", "+_split[1];_aP[_aP.length]=new Array(_split[0],_split[1]);	}
		}
	}
	document.write('<div id="'+_id+'">'+alt+'</div>');
	if(typeof(SWFObject)!="function"){return;} //ab hier abhaengig von SWFObject.js!!!

	var so = new SWFObject(name+".swf",_id,width,height,version,background);
	for(var i=0;i<_n.length;i++){	so.addVariable(_n[i]);		}
	for(var i=0;i<_aP.length;i++){	so.addParam(_aP[i][0],_aP[i][1]);	}
	so.write(_id);
}

function tabbox(arg1,arg2) {
	if($(arg1))$(arg1).className = "active";
	if($(arg1+"_link"))$(arg1+"_link").className = "active";
	if($(arg2))$(arg2).className = "";
	if($(arg2+"_link"))$(arg2+"_link").className = "";
}

function MM_swapImage() { //v3.0
	var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
	if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_swapImgRestore() { //v3.0
	var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
	var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  	if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  	for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  	if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function popup(ort,x,y) {
	win = window.open(ort, 'Fenster','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width='+x+',height='+y);
	win.focus();
}

function popupNoScroll(ort,x,y) {
	win = window.open(ort, 'Fenster','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width='+x+',height='+y);
	win.focus();
}

function winopen(url, w, h) {
	if (typeof w=="undefined"){w=640;}
	if (typeof h=="undefined"){h=480;}
 	if (navigator.userAgent.indexOf("Mac") != -1) {
  		newwindow = window.open(url,'viewer_win','directories=0,location=1,menubar=1,scrollbars=1,status=0,toolbar=1,resizable=1,width='+w+',height='+h+',screenx=0,screeny=0');
  		if(navigator.appName == "Netscape" && parseInt(navigator.appVersion.substring(0,1)) >= 3) {
  			newwindow.focus()
  		}
 	} else {
  		newurl = url;
  		newwindow = window.open(newurl,'viewer_win','directories=0,location=1,menubar=1,scrollbars=1,status=0,toolbar=1,resizable=1,width='+w+',height='+h+',screenx=0,screeny=0');
  		newwindow.focus();
 	}
}

function openTab(tab) {
	if (tab < 1 || tab > 3) {
		tab = 1;
	}
	for (i=1; i<4; i++) {
		if (i == tab) {
			if (document.getElementById("start_tab_" + i)) {
				document.getElementById("start_tab_" + i).style.display = "block";
			}
		} else {
			if (document.getElementById("start_tab_" + i)) {
				document.getElementById("start_tab_" + i).style.display = "none";
			}
		}
	}
}

function openFilm() {
	if (document.getElementById("antik")) {
		document.getElementById("antik").style.display = "inline";
	}
}
function closeFilm() {
	if (document.getElementById("antik")) {
		document.getElementById("antik").style.display = "none";
		window.location.reload();
	}
}

function openRaffle() {
	if (document.getElementById) {
		document.getElementById("raffle").style.display = "inline";
	}
}
function closeRaffle() {
	if (document.getElementById) {
		document.getElementById("raffle").style.display = "none";
	}
}

function insert(inhalt) {
	if (inhalt == "") {
		document.auswahl.reset();
		return;
	} else {
		location.href = inhalt;
		document.auswahl.reset();
	}
}

function go() {
	box = document.lex.navi;
	destination = box.options[box.selectedIndex].value;
	if (destination) {
		location.href = destination;
	}
}

// Start Variablen und Funktionen fuer Startseiten- und Favoriten-Knopf //
var agt = navigator.userAgent.toLowerCase();
var is_major = parseInt(navigator.appVersion);
var is_minor = parseFloat(navigator.appVersion);
var is_nav = ((agt.indexOf("mozilla") != -1) && (agt.indexOf("spoofer") == -1) && (agt.indexOf("compatible") == -1) && (agt.indexOf("opera") == -1) && (agt.indexOf("webtv") == -1) && (agt.indexOf("hotjava") == -1));
var is_ie = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
var is_ie3 = (is_ie && (is_major < 4));
var is_ie4 = (is_ie && (is_major == 4) && (agt.indexOf("msie 5") == -1));
var is_ie4 = (is_ie && (is_major == 4) && (agt.indexOf("msie 5") == -1) && (agt.indexOf("msie 6") == -1));
var is_ie5up = (is_ie && !is_ie3 && !is_ie4);
var is_win = ((agt.indexOf("win") != -1) || (agt.indexOf("16bit") != -1));
function setHomePage(homepage, la_url_es) {
	if (is_win && is_ie5up) {
		document.body.style.behavior = "url(#default#homepage)";
		document.body.setHomePage(homepage);
	}
}
function addToFavorite(favTitle) {
	if ((navigator.appVersion.indexOf("MSIE") > 0) && (parseInt(navigator.appVersion) >= 4)) {
		window.external.AddFavorite(location.href, unescape(favTitle));
	}
}
// Ende Variablen und Funktionen fuer Startseiten- und Favoriten-Knopf //
