function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}


function wordCounter(field, countfield, maxlimit) {
wordcounter=0;
for (x=0;x<field.value.length;x++) {
      if (field.value.charAt(x) == " " && field.value.charAt(x-1) != " ")  {wordcounter++}  // Counts the spaces while ignoring double spaces, usually one in between each word.
      if (wordcounter > 250) {field.value = field.value.substring(0, x);}
      else {countfield.value = maxlimit - wordcounter;}
      }
   }

function textCounter(field, countfield, maxlimit) {
  if (field.value.length > maxlimit)
      {field.value = field.value.substring(0, maxlimit);}
      else
      {countfield.value = maxlimit - field.value.length;}
  }
  
var Fenster = null;
function popup_zentriert(meineSeite,meinName,w,h,toolbar,location,status,menubar,scroll,resize){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',toolbar='+toolbar+',location='+location+',status='+status+',menubar='+menubar+',scrollbars='+scroll+',resizable='+resize+''
Fenster = window.open(meineSeite,meinName,settings)
}

function popup_linksoben(meineSeite,meinName,w,h,toolbar,location,status,menubar,scroll,resize){
LeftPosition = (screen.width) ? +20 : 0;
TopPosition = (screen.height) ? +20: 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',toolbar='+toolbar+',location='+location+',status='+status+',menubar='+menubar+',scrollbars='+scroll+',resizable='+resize+''
Fenster = window.open(meineSeite,meinName,settings)
}

function popup_rechtsoben(meineSeite,meinName,w,h,toolbar,location,status,menubar,scroll,resize){
LeftPosition = (screen.width) ? (screen.width-w-50): 0;
TopPosition = (screen.height) ? +20: 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',toolbar='+toolbar+',location='+location+',status='+status+',menubar='+menubar+',scrollbars='+scroll+',resizable='+resize+''
Fenster = window.open(meineSeite,meinName,settings)
}

function popup_rechtsunten(meineSeite,meinName,w,h,toolbar,location,status,menubar,scroll,resize){
LeftPosition = (screen.width) ? (screen.width-w-50): 0;
TopPosition = (screen.height) ? (screen.height-h-100): 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',toolbar='+toolbar+',location='+location+',status='+status+',menubar='+menubar+',scrollbars='+scroll+',resizable='+resize+''
Fenster = window.open(meineSeite,meinName,settings)
}

function popup_linksunten(meineSeite,meinName,w,h,toolbar,location,status,menubar,scroll,resize){
LeftPosition = (screen.width) ? +20 : 0;
TopPosition = (screen.height) ? (screen.height-h-100): 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',toolbar='+toolbar+',location='+location+',status='+status+',menubar='+menubar+',scrollbars='+scroll+',resizable='+resize+''
Fenster = window.open(meineSeite,meinName,settings)
}

function fullsize(meineSeite,meinName,w,h,toolbar,location,status,menubar,scroll,resize){
LeftPosition = 50;
TopPosition = 50;
h=screen.height-150;
w=screen.width-100;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',toolbar='+toolbar+',location='+location+',status='+status+',menubar='+menubar+',scrollbars='+scroll+',resizable='+resize+''
Fenster = window.open(meineSeite,meinName,settings)
}

function download_zentriert(meineSeite,meinName,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings ='height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
Fenster = window.open(meineSeite,meinName,settings)
}

function download_fullsize(meineSeite,meinName,w,h,toolbar,location,status,menubar,scroll,resize){
LeftPosition = 50;
TopPosition = 50;
h=screen.height-150;
w=screen.width-100;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',toolbar='+toolbar+',location='+location+',status='+status+',menubar='+menubar+',scrollbars='+scroll+',resizable='+resize+''
Fenster = window.open(meineSeite,meinName,settings)
}



var xmlHttp;

function showResult(str){
	//alert(str);
if (str.length==0)
 { 
 document.getElementById("user_usr_info").
 innerHTML="";
 document.getElementById("user_usr_info").
 style.border="0px";
 return
 }

xmlHttp=GetXmlHttpObject()

if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 } 

var url="get_user_info.php"
url=url+"?q="+str
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
} 

function stateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 
 //alert(xmlHttp.responseText);
 
 //User bereits vorhanden
 if (xmlHttp.responseText=='-1')
 { 
 document.getElementById("user_usr_info").
 innerHTML='Dieser Benutzername ist bereits vorhanden!';
 document.getElementById("user_usr_info").
 style.border="1px solid #A5ACB2";
 
 document.getElementById("user_usr").value='';
 
 }
 
 //Der gleiche User
 if(xmlHttp.responseText=='-2'){
 document.getElementById("user_usr_info").
  innerHTML='';
 document.getElementById("user_usr_info").
 style.border="0px";
 

 }
 
 //Der selbe User
 if(xmlHttp.responseText!='-1' && xmlHttp.responseText!=-'2'){
 document.getElementById("user_usr_info").
 innerHTML='';
 document.getElementById("user_usr_info").
 style.border="0px";
 
 document.getElementById("user_usr").value=xmlHttp.responseText;
 }
 
 
 } 
}

function GetXmlHttpObject()
{
var xmlHttp=null;
try
 {
 // Firefox, Opera 8.0+, Safari
 xmlHttp=new XMLHttpRequest();
 }
catch (e)
 {
 // Internet Explorer
 try
  {
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e)
  {
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }
return xmlHttp;
}






var keylist="abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
var temp=''

function generatepass(plength){
temp=''
for (i=0;i<plength;i++)
temp+=keylist.charAt(Math.floor(Math.random()*keylist.length))
return temp
}

function populateform(enterlength){
document.forms[0].user_pwd.value=generatepass(enterlength)
}

function populateform_kunde(enterlength){
document.forms[0].kunde_pwd.value=generatepass(enterlength)
}


function toggledisplay (id, indicator){ 
	if (document.getElementById) { 
		var obj = document.getElementById(id);
		var pic = document.getElementsByName(indicator);
		obj.style.display = (obj.style.display=='block'?'none':'block');
		pic[0].src = (obj.style.display=='block'?'/webedit/img/icon/show.gif':'/webedit/img/icon/hide.gif');
	} else if(document.all) { // IE
		id.style.display = (id.style.display=='block'?'none':'block');
		indicator.src = (id.style.display=='block'?'/webedit/img/icon/show.gif':'/webedit/img/icon/hide.gif');
	} else if (document.layers) { // Netscape 4.x
		document.id.style.display = (document.id.style.display=='block'?'none':'block');
		document.indicator.src = (document.id.style.display=='block'?'/webedit/img/icon/show.gif':'/webedit/img/icon/hide.gif');
	}
}