// general.js

function getform(formname)
{
	return document.forms[formname];
}

function Submit(formName, actionPfad){
		
		document.forms[formName].action = actionPfad;
		//alert(actionPfad);
		document.forms[formName].submit();
	}


function SetStatus(url)
    {
        window.status=url;
    }

function DelStatus()
    {
        window.status="";
    }


function APG_Submit_nameUndValue(action, name, value) {

	var form = getform("main");
	
	form.elements[name].value = value;
	form.action = action;

	form.submit();
}

/*
function APG_Submit_nameUndValue(formname, formnr, name, value) {
	alert("Anfang Submit");
	var form = getform(formname, formnr);
	form.elements[name].value = value;
	form.submit();
}
*/

function APG_Submit_2nameUnd2Value(action, name1, value1, name2, value2) {
	
	var form = getform("main");
	form.elements[name1].value = value1;
	form.elements[name2].value = value2;
	
	form.action = action;
	
	form.submit();
}

function APG_Submit_4nameUnd4Value(action, name1, value1, name2, value2, name3, value3, name4, value4) {
	
	var form = getform("main");
	form.elements[name1].value = value1;
	form.elements[name2].value = value2;
	form.elements[name3].value = value3;
	form.elements[name4].value = value4;
	
	
	form.action = action;
	
	form.submit();
}

function APG_2nameUnd2Value(action, name1, value1, name2, value2) {
	var form = getform("main");
	
	form.elements[name1].value = value1;
	form.elements[name2].value = value2;
	
	form.action = action;
}

function setfocus(name) {
	var form = getform("main");

	if (form.elements[name]!=null) {
		form.elements[name].focus();
	}
}

function openCustomWindow(index, linkort) {

  var newWin;
  var winName="WeiterWin";
  newWin = window.open( "", "newWin", "width=450,height=300,resizable,screenX=175,screenY=150,left=175,top=150");

// wrote content to window
  newWin.document.write('<html><head>');
//  newWin.document.write('<script language="JavaScript1.1" src="JavaScript/general.js">');
//  newWin.document.write('</script>');
  newWin.document.write('</head>');	
  newWin.document.write('<BODY>');
 newWin.document.write('<form name="main2" method="post" enctype="multipart/form-data"> ');
  newWin.document.write(' <input name="execute"  type="hidden" value=""> ');
  newWin.document.write(' <input name="id"       type="hidden" value=""> ');
  newWin.document.write('<script type=text/javascript> '); 
  
  newWin.document.write(' function getform(formname) { return document.forms[formname]; } ');
  
  newWin.document.write(' function APG_Submit_nameUndValue(action, name, value) { ');
  newWin.document.write(' var form = getform("main2"); form.elements[name].value = value; form.action = action; form.submit(); }');
 
  newWin.document.write('function closeThis(){ window.close(); } ');
  
  newWin.document.write('</script>');
  newWin.document.write('<center>');
  newWin.document.write(topTexte[index]);
  newWin.document.write('<br><P>');

  if ((topBildPfad[index]!=null) && (topBildPfad[index]!="")) {
	  newWin.document.write('<img src="'+topBildPfad[index]+'" align="center" hspace="20" alt="Bild" width="'+topBildBreite[index]+'" height="'+topBildHoehe[index]+'">');
  }
  newWin.document.write('<br><p>');  
  if (linkort == "Home") {
      var ahlaAckbar='javascript:opener.document.location="'+topLinks[index]+'"; closeThis();';
	  //var ahlaAckbar='javascript:opener.document.location="'+topLinks[index]+'"; javascript: self.close();';
	  
	  newWin.document.write("<a href='"+ahlaAckbar+"'");
  }
  else if (linkort == "Internet") {
	  var ahlaInternet='window.open("';
	  ahlaInternet+=topLinks[index];
	  ahlaInternet+='"); '; 
	  ahlaInternet+=' closeThis();';
	 // ahlaInternet+=' javascript: self.close();';
	  newWin.document.write("<a href='#' onclick='"+ahlaInternet+"'");
  }  
  
  newWin.document.write(' Style="Cursor:hand;">Weiter</a>');
  newWin.document.write('</form>');
  newWin.document.write('</body></html>');
  newWin.document.close();	
}

// *** Fügt eine E-Mail-Adresse ein ***
function InsertMail(mailnam,mailsvr,maildom,text)
{
  if(text=="")
    document.write('<a href="mailto:'+mailnam+'@'+mailsvr+'.'+maildom+'">'+mailnam+'@'+mailsvr+'.'+maildom+'</a>');
  else
    document.write('<a href="mailto:'+mailnam+'@'+mailsvr+'.'+maildom+'">'+text+'</a>');
}


