/*
         ___                         _____       __
        /  /\        ________       /    /\     / /\
(-----//  /  \//----/_____/__\\--) /____/  \___/_/ //--------------------------)
      /  /   /      \     | //     \    \  /    /\/    this code was created by
     /__/   /        \    |///-----\\____\/____/  \                       sigea
(---\\  \  /   (-----\\___|/        /    /\    \  /       
      \__\/                        /____/ /\____\/            __       sigea.ch
                                   \____\/  \  /             /\_\--------------)
                                         \___\//-------------\/_/  

*/
var loginpage;
function Loginpage(){
	this.prepare=function(){
		checkJS();
		if(document.getElementById('serverstatus')){
			var statusList=document.getElementById('serverstatus');
			var links=statusList.getElementsByTagName('a');
			for(var i=0; i< links.length; i++) {
				links[i].onclick = function(){
					return !loginpage.open(this,true);
				}
			}
			links=null;
			statusList=null;
		}
		if(document.getElementById('about')){
			var aboutList=document.getElementById('about');
			var links=aboutList.getElementsByTagName('a');
			for(var i=0; i< links.length; i++) {
				if(links[i].className){
					links[i].onclick = function(){
						return !loginpage.open(this,false);
					}
				}
			}
			links=null;
			aboutList=null;
		}
	}
	this.open=function(element,status){
		var windowname='';
		var options='scrollbars=1,resizable=1,';
		if(status){
			windowname='Techinfo';
			options+='toolbar=0,location=0,status=0,menubar=0,width=460,height=550';
		}else{
			if(element.className.indexOf('news') != -1){
				windowname='news';
				options+='width=800,height=670';
			}else if(element.className.indexOf('impressum') != -1){
				windowname='Impressum';
				options+='width=800,height=670';
			}else if(element.className.indexOf('foo') != -1){
				windowname='Werbung';
				//options+='width=450,height=450';
				options+='width=800,height=670';
			}else if(element.className.indexOf('rechtliches') != -1){
				windowname='Rechtliches';
				options+='width=800,height=670';
			}else if(element.className.indexOf('support') != -1){
				windowname='Support';
				options+='width=800,height=670';
			}else if(element.className.indexOf('help') != -1){
				windowname='Help';
				options+='width=800,height=670';
			}		
		}
		var newWin=window.open(element.href,windowname,options);
		newWin.focus();
		return true;
	}
	var checkJS=function(){
		var formID='loginform';
		if(!document.getElementById(formID)) return false;
		var xmlhttp = false;
		if(window.XMLHttpRequest){
			xmlhttp = new XMLHttpRequest();
		}else if(window.ActiveXObject){
			try{
				xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
			}catch(e){
				try{
					xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
				}catch(e){
					xmlhttp=false;
				}
			}
		}
		if(xmlhttp){
			var hiddenInput=document.createElement('input');
//			hiddenInput.name='js';
//			hiddenInput.value='1';
			hiddenInput.setAttribute('name','js');
			hiddenInput.setAttribute('value','1');
			hiddenInput.setAttribute('type','hidden');
			document.getElementById(formID).appendChild(hiddenInput);
		}
		return true;
	}
}

function prepareLoginpage(){
	loginpage=new Loginpage();
	loginpage.prepare();
}
loadEvent.add(function(){loginpage=new Loginpage();loginpage.prepare();});
