// JavaScript Document
var time = 3000;
var adresse;
var domain;
var suffix;

//menu constructor
function menu(thisitem,startstate){ 
  callname= "gl"+thisitem;
  divname="subdmenueid"+thisitem;  
  this.numberofmenuitems = numofitems;
  this.caller = document.getElementById(callname);
  this.thediv = document.getElementById(divname);
  this.thediv.style.visibility = startstate;
}

//menu methods
function menueschalter(event,theobj){
  for (var i=1; i<= theobj.numberofmenuitems; i++){
    var shutdiv =eval( "menueleiste"+i+".thediv");
    shutdiv.style.visibility="hidden";
  }
  theobj.thediv.style.visibility="visible";
}
				
function submenueschliessen(event){
  if ((event.clientY <170)||(event.clientY > 228)){
    for (var i=1; i<= numofitems; i++){
      var shutdiv =eval('menueleiste'+i+'.thediv');
      shutdiv.style.visibility='hidden';
    }
  }
}

function popup(url) {
	obj = new Image();
	obj.src=url;
	
	sx = (screen.availWidth - obj.width) / 2;
	sy = (screen.availHeight - obj.height) / 2;
	
	feature='width='+obj.width+', height='+obj.height+', left='+sx+',top='+sy+',screenX='+sx+',screenY='+sy+', toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no';
	   
	fenster = window.open('','_blank',feature);    
	
	fenster.document.write("<html><head></head><body topmargin=0 leftmargin=0>");
	fenster.document.write("<img src=\"");
	fenster.document.write(url);
	fenster.document.write("\"></body></html>");
	fenster.focus();
	return false;
}

function gosort() {
   document.sort.submit();
}

function goset() {
   document.fversand.submit();
}

function gozahl() {
   document.fzahlung.submit();
}

function refresh_username(selected_username)
{
	opener.document.forms['post'].username.value = selected_username;
	opener.focus();
	window.close();
}

// id = Datum, id2 = Select Status, val = Valuewert aus Status
function get_date(id, id2, val)
{
	select = document.getElementById(id);
	select.value = frmDate()
	select = document.getElementById(id2);
	for (i = 0; i < select.length; ++i)
		if (select.options[i].text == val)
			select.selectedIndex = i;
}

function frmDate() 
{ 
var d = new Date(); 
return (((d.getDate()) < '10' ) ? '0' + (d.getDate()) : (d.getDate())) + '. ' + (((d.getMonth()+1) < '10' ) ? '0' + (d.getMonth()+1) : (d.getMonth()+1)) + '. ' + d.getFullYear(); 
}

function post(adresse, domain, suffix, subject, name)
{
//	alert( 'Bin Hier');
	if (subject == "") mailstart = "<a href=\"" + "mailto:" + adresse + "@" + domain + "." + suffix + "\">"
	else mailstart = "<a href=\"" + "mailto:" + adresse + "@" + domain + "." + suffix + "?subject=" + subject + "\">"

	if (name == "")	mailname = adresse + "@" + domain + "." + suffix
	else mailname = name

	mailend = "</a>"
	
	document.write(mailstart + mailname + mailend);
}
