// JavaScript Document
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
function LoginCheck() {
	if(document.getElementById('usernameCK').value.length == 7){
		var IDInput=document.getElementById('usernameCK');
		if(IDInput != null) IDInput.disabled = "";
		document.forms["mainform"].action="../_system/_login.php";
		document.forms["mainform"].submit();
	}
}
function InitForm(){
	var IDInput=document.getElementById('usernameCK');
	if(IDInput != null) IDInput.disabled = "";
	IDInput=document.getElementById('SubmitButton');
	if(IDInput != null) IDInput.disabled = "";
}

function LostID(){
	document.getElementById("IDFContainer").style.display = "block";
}

function checkemail(str){
	var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i 
	if (filter.test(str)) return(true);
	return(false);
}

function LostIDSubmit(){
	if(!checkemail(document.forms["mainform"].EmailAdresse.value)){
		document.getElementById("IDFContainerError").style.display = "block";
		return false;
	}
	document.getElementById("IDFContainer").style.display = "none";
	document.getElementById("IDFContainerBefore").style.display = "none";
	document.getElementById("LoadingButton2").style.display = "block";
	getContentFromServer("./ajax-lostID.php","IDFContainerAfter",function() { getLostID4Page(); });
}

function getLostID4Page() {
    if (http_request.readyState == 4) {
		if (http_request.status == 200) {
			var xmldoc = http_request.responseText;
			document.getElementById("IDFContainerAfter").innerHTML=http_request.responseText;
			document.getElementById("LoadingButton2").style.display = "none";
			document.getElementById("IDFContainerAfter").style.display = "block";
			return false;
        }
    } 
}

function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

function changeLangImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeLangImages.arguments.length; i+=2) {
			document.getElementById(changeLangImages.arguments[i]).src = changeLangImages.arguments[i+1];
		}
	}
}

function changeLang(id) {
	document.forms["sel_lang"].action="";
	document.forms["sel_lang"].dlang.value=id;
	document.forms["sel_lang"].submit();
}

function CenterTo(ObjToMove,CenterTo){
	tom=$(ObjToMove);
	cntTo=$(CenterTo);
	cntToOff=cntTo.offset();
	cntToOff.left+=cntTo.width()/2;
	cntToOff.top+=cntTo.height()/2;
	cntToOff.left-=tom.width()/2;
	cntToOff.top-=tom.height()/2;
	tom.css(cntToOff);
}

