// =================================================================================
//
// 
// =================================================================================

// FÜR DIE STATUSZEILE DAMIT DIE LINKS NICHT ANGEZEIGT WERDEN

function hideStatus() {
	window.status = "Relexa Cooking";
	setTimeout("hideStatus()", 100); 
}

function setWindowStatus() {
		window.status = 'RELEXA';	
}

// if (event.onmouseover) setWindowStatus();
// if (event.onmouseout) setWindowStatus();

// document.onmouseover = setWindowStatus();
// document.onmouseout = setWindowStatus();


/*

document.onkeydown = TasteGedrueckt;
document.onkeyup = TasteLosgelassen;


<script EVENT="onMouseOver()" for="document" language="JavaScript">
	//	if (event.keyCode==13) { 
		window.status = 'RELEXA';
</script>

<script EVENT="onMouseOut()" for="document" language="JavaScript">
	//	if (event.keyCode==13) { 
		window.status = 'RELEXA';
</script>
*/

// ---------------------------------------------------------------------------------
//
//
// ---------------------------------------------------------------------------------

// TOGGLE FUNKTION (Aufklappen von weiteren Textinformationen)

function toggleDisplay (obj) {
	if (obj.style.display == 'block')
		obj.style.display = 'none';
	else
		obj.style.display = 'block';
	return false;
}

// ---------------------------------------------------------------------------------
// Funktion zum zählen der zeichen

function textCounter(field, countfield, maxlimit) {

	if (field.value.length > maxlimit) // if too long...trim it!
		field.value = field.value.substring(0, maxlimit);
		// otherwise, update 'characters left' counter
	else
		countfield.value = maxlimit - field.value.length;
}
//
// ---------------------------------------------------------------------------------

// =======================================================================================
//
// =======================================================================================
// Aufruf aus:




function showSite(docid){

	var parastring="width=1024, height=655, top=-3, left=-3, resizable=yes, scrollbars=yes, statusbar=yes, toolbar=yes";

 	// docid = getDocumentId();
	// alert(docid);
 	var windowstring = 'dispatcher.php?PMD_AKTION=FrShowSite&PMD_CURKONT='+ docid + '&PMD_CURELEM='+ docid +'';

	freshwindow=window.open(windowstring,"SITE",parastring);
	freshwindow.focus(); 

	return;

}

// ---------------------------------------------------------------------------------
//
//
// ---------------------------------------------------------------------------------


function showAdminSite(docid){

	var parastring="width=1024, height=655, top=-3, left=-3, resizable=yes, scrollbars=yes, statusbar=yes, toolbar=yes";
 	var windowstring = 'dispatcher.php?PMD_AKTION=FrAdminShowSite&PMD_CURKONT='+ docid + '&PMD_CURELEM='+ docid +'';

	freshwindow=window.open(windowstring,"SITE",parastring);
	freshwindow.focus(); 

	return;

}


// ---------------------------------------------------------------------------------
//
//
// ---------------------------------------------------------------------------------


function showSuchSite(docid, varname, subdocid) {
	
	var parastring="width=1024, height=655, top=-3, left=-3, resizable=yes, scrollbars=yes, statusbar=yes, toolbar=yes";

	// alert(docid);

 	if ( varname == 'SITE') {
		// alert("SITE");
 		var windowstring = 'dispatcher.php?PMD_AKTION=FrShowSite&PMD_CURKONT='+ docid +'&PMD_CURELEM='+ subdocid +'';
		// alert(windowstring);
		freshwindow=window.open(windowstring,"SITE",parastring);
		freshwindow.focus(); 
	}
	else if ( varname = 'LOKAL') {	
		// alert("LOKAL");
 		var windowstring = 'dispatcher.php?PMD_AKTION=rdetailansicht&PMD_CURKONT='+ subdocid +'&PMD_CURELEM='+ subdocid +'';
		freshwindow=window.open(windowstring,'_self');
		freshwindow.focus(); 

	}
	else {	
		// alert("PORTAL");
 		var windowstring = 'dispatcher.php?PMD_AKTION=rdetailansicht&PMD_CURKONT='+ subdocid +'&PMD_CURELEM='+ subdocid +'';
		freshwindow=window.open(windowstring,"SITE",parastring);
		freshwindow.focus(); 

	}
	
	return;

}

// ---------------------------------------------------------------------------------
//
//
// ---------------------------------------------------------------------------------


function showDocument(docid, varname, subdocid) {
	
	var parastring="width=600, height=655, top=-3, left=-3, resizable=yes, scrollbars=yes, statusbar=yes, toolbar=yes";

	// alert(''+docid+''+varname+''+subdocid+'');

 	if ( varname == 'WINDOW') {
		// alert("SITE");
 		var windowstring = 'dispatcher.php?&PMD_AKTION=DetailAnsicht&PMD_CURKONT='+ subdocid +'&PMD_CURELEM='+ subdocid +'';
 		// var windowstring = 'dispatcher.php?&PMD_AKTION=ShowExample&PMD_CURKONT='+ subdocid +'&PMD_CURELEM='+ subdocid +'';
		// alert(windowstring);
		freshwindow=window.open(windowstring,"SITE",parastring);
		freshwindow.focus(); 
	}
	else if ( varname == 'LOKAL') {	
		// alert("LOKAL");
 		// var windowstring = 'dispatcher.php?&PMD_AKTION=DetailAnsicht&PMD_CURKONT='+ subdocid +'&PMD_CURELEM='+ subdocid +'';
 		var windowstring = 'dispatcher.php?PMD_AKTION=DetailAnsicht&PMD_CURKONT='+ docid +'&PMD_CURELEM='+ subdocid +'';
		freshwindow=window.open(windowstring,'_self');
		freshwindow.focus(); 

	}
	else if ( varname == 'LOCAL') {	
		// alert("LOKAL");
 		var windowstring = 'dispatcher.php?PMD_AKTION=ShowDateView&PMD_CURKONT='+ subdocid +'&PMD_CURELEM='+ subdocid +'';
		// alert(windowstring);
		freshwindow=window.open(windowstring,'_self');
		freshwindow.focus(); 

	}
	else {	
		// alert("PORTAL");
 		var windowstring = 'dispatcher.php?PMD_AKTION=DetailAnsicht&PMD_CURKONT='+ subdocid +'&PMD_CURELEM='+ subdocid +'';
		freshwindow=window.open(windowstring,"SITE",parastring);
		freshwindow.focus(); 

	}
	
	return;

}



// ---------------------------------------------------------------------------------
//
//
// ---------------------------------------------------------------------------------


//(Fern)Auslöser für das Speichern, wird von anderen Frames aufgerufen erlaubt ein Abschicken erst nach vollständigem Seitenaufbau
function speichern (button_name, target){

   document.all.button.name=button_name;
   document.all.eingabe.target = target;
   document.all.button.click();
	return;
}


function date_speichern (button_name, varsession, indaten){


	if (indaten) {
		alert ('in editjs:date_speichern');
		alert (indaten); 
		iddocument = getDocumentId();
		globalaction = 'dispatcher.php?PMD_CURKONT='+iddocument+'&sid='+varsession+'&PMD_NEWDATE='+indaten+'&PMD_USERID=admin&'+button_name+'=DoIt';
		alert (globalaction); 
		top.inner.maininner.location.href = globalaction;
	}
	
	return;
}


// wird aus Edit Image aufgerufen. Platziert Namen des Bildes in den Dokumentname und die Headline

// function putname(iname){
// document.all.docuname.value = iname;
// document.all.headline.value = iname;
// }

// ---------------------------------------------------------------------------------
//
//
// ---------------------------------------------------------------------------------


//ruft alle Validierungen für All Edit auf, bevor ein Pop-Up Fenster geöffnet wird
function popallopen(urlstring,namestring,parameterstring){
         if(parent.maininner.valid()) {
            return window.open(urlstring,namestring,parameterstring);
         }
}

// ---------------------------------------------------------------------------------
//
//
// ---------------------------------------------------------------------------------

// ----------------------------------------------------------------------------------------------------
// generiert Confirm Box, um ein ungewolltes Löschen zu verhindern
// ----------------------------------------------------------------------------------------------------

function checkloeschen(ziel,ele){
	confirmed = confirm("Wollen Sie "+ele+" wirklich löschen?");
	if(confirmed) {
		ziel.click();
	}		
	else {
		return;
	}
}


// ----------------------------------------------------------------------------------------------------
// generiert Confirm Box, um ein ungewolltes duplizieren zu verhindern
// ----------------------------------------------------------------------------------------------------

function checkdupli(weg,ele){
		confi = confirm("Wollen Sie "+ele+" wirklich duplizieren?");
			if(confi) {
					weg.click();
					submitFlag = true;
				}
			else return;
}


// --------------------------------------------------------------------------------------
// fenster bereits geöffnet?? Wenn ja wird es geschlossen und erneut ge&ouml;ffnet, 
// um zu gewaerleisten, dass
// Window mit Sicherheit zum aktuellen Dokument gehoert
// --------------------------------------------------------------------------------------

function checkopen(windowstring,nameParameter){
var parastring;

// alert(windowstring);
var windowname=window.open(windowstring);
if(windowname.closed != true) {
     windowname.close();
}
if(nameParameter == 'userdaten') {
	// alert (nameParameter);
   var parastring="width=500, height=500, top=100, left=100, resizable=yes, scrollbars=yes";
}	
else if(nameParameter == 'sysrelation') {
   var parastring="width=750, height=700, top=10, left=0, resizable=yes, scrollbars=yes";
}
else if(nameParameter == 'fullscreen') {
   var parastring="width=800, height=800, top=10, left=0, resizable=yes, scrollbars=yes";
}
else if(nameParameter == 'image') {
   var parastring="width=600, height=450, top=100, left=100, resizable=yes, scrollbars=yes";
}
else if(nameParameter == 'imageupload') {
   var parastring="width=600, height=800, top=10, left=10, resizable=yes, scrollbars=yes";
}
else if(nameParameter == 'imagepopup') {
   var parastring="width=600, height=500, top=10, left=10, resizable=yes, scrollbars=yes";
}
else if(nameParameter == 'H600B450') {
   var parastring="width=600, height=450, top=100, left=100, resizable=yes, scrollbars=yes";
}
else if(nameParameter == 'urlfenster') {
   var parastring="width=700, height=250, top=100, left=100, resizable=yes";
}
else if(nameParameter == 'sysbearbeiten') {
   var parastring="width=700, height=250, top=100, left=100, resizable=yes";
}
else if(nameParameter == 'urlbearbeiten') {
   var parastring="width=700, height=250, top=100, left=100, resizable=yes";
}
else if(nameParameter == 'file') {
   var parastring="width=700, height=250, top=0, left=0, resizable=yes";
}
else if(nameParameter == 'MesseEvents') {
   var parastring="width=600, height=500, top=10, left=10, resizable=yes, scrollbars=yes";
}
else if(nameParameter == 'adresslist') {
   var parastring="width=600, height=500, top=10, left=10, resizable=yes, scrollbars=yes";
}

// alert("hallo");
freshwindow=window.open(windowstring,nameParameter,parastring);
freshwindow.focus(); 

return;

}

// ---------------------------------------------------------------------------------
//
//
// ---------------------------------------------------------------------------------

//wird von den pop-up fenstern aufgerufen initialisiert aktualisieren von all edit
function initate(){
   // workareaPage = parent.workarea.whoAreYou();
   workareaPage = parent.maininner.whoAreYou();
   if (workareaPage == "AllEdit") {
  // if (workareaPage == "NONONO")
      // alert('INITATE');
      parent.maininner.refreshAll();
    }
}


//wird von den pop-up fenstern aufgerufen initialisiert aktualisieren von all edit
function initate_ses(){
   // workareaPage = parent.workarea.whoAreYou();
   workareaPage = parent.maininner.whoAreYou();
   if (workareaPage == "AllEdit") {
  // if (workareaPage == "NONONO")
      // alert('INITATE');
   		window.setTimeout("klickSes()",600);
    }

}


 function klickSes(){	
	document.all.button3.name='fkt_SaveAndEditSesDocument';
	// document.all.eingabe.target="mainwork";
	document.all.eingabe.target="maininner";
	document.all.button3.click();

  }



// ---------------------------------------------------------------------------------
//
//
// ---------------------------------------------------------------------------------

//wird über die Toolbar aus Pop-Up Fenstern aufgerufen(z.B Image bearbeiten) All Edit wird aktualisiert      
function refreshAll(){
   window.setTimeout("klick()",600);
}

// ---------------------------------------------------------------------------------
//
//
// ---------------------------------------------------------------------------------


 function klick(){	
	document.all.button3.name='fkt_raktuellalledit';
	// document.all.eingabe.target="mainwork";
	document.all.eingabe.target="maininner";
	document.all.button3.click();

  }

// ---------------------------------------------------------------------------------
//
//
// ---------------------------------------------------------------------------------

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

// =================================================================================
