﻿	/******************************************************************************************************************
	*
	*		JavaScript
	*
	*		Modulname		:	js.js
	*
	*		Copyright		:	@.exe multimedia
	*		Ersteller		:	Patrice Huber
	*		Erstellt		:	28.02.2008
	*
	*		Editor			:	-
	*		Editiert		:	-
	*
	*		Beschreibung	:	JavaScript - Funktionen
	*
	********************************************************************************************************************/
 
 	/*******************************************************************************************************************/
	// Der Wert des übergebenen Objektes TF wird gelöscht
	function leer( TF, Text )
	{
		if( TF.value == Text )
		{
			TF.value = "";
		}
	}
	/*******************************************************************************************************************/

	/*******************************************************************************************************************/
	// Der Wert des übergebenen Objektes TF wird durch den übergebenen String Text ersetzt
	function voll( TF, Text )
	{
		if( TF.value == "" )
		{
			TF.value = Text;
		}
	}
	/*******************************************************************************************************************/

	/*******************************************************************************************************************/
	// Prüft, ob das übergebene Element sichtbar bzw. unsichtbar ist und ändert entsprechend den Status
	function displayElement( TagName1, TagName2 )
	{
		Tag1 = document.getElementById( TagName1 )
		Tag2 = document.getElementById( TagName2 )

		if( Tag1.style.display == 'block' )
		{
			Tag1.style.display = 'none';
			Tag2.style.borderBottom = '1px solid #C4CBDE';
		}
		else
		{
			Tag1.style.display = 'block';
			Tag2.style.borderBottom = '1px solid #FFFFFF';
		}
	}
	/*******************************************************************************************************************/

	/*******************************************************************************************************************/
	// Macht das angegebene Tag sichtbar und ändern die Breit und Hoehe. Ausgabe zentriert am bildschirm
	function ZoomPic(TagId,Breite,Hoehe)
	{
		for(i=0;i<(AnzGesBild+3);i++)
		{
			if( div = document.getElementById('bild'+i) )
			{
				if( div.id != TagId )
				{
//					div.style.visibility = "hidden";
					div.style.display	=	"none";
				}
			}
		}

		div	=	document.getElementById(TagId);
/*		div.style.visibility = "visible";*/
		div.style.display	=	"block";
		//div.style.height	=	Hoehe + "px";
		//div.style.width	=	Breite + "px";
		var x,y,Y_Distance;

		if (self.innerHeight) // all except Explorer
		{
			x = self.innerWidth;
			y = self.innerHeight;
			Y_Distance = 0;
			NewTop	=	( y + Y_Distance - Hoehe+25 ) / 2;
		}
		else if (document.documentElement && document.documentElement.clientHeight)
			// Explorer 6 Strict Mode
		{
			x = document.documentElement.clientWidth;
			y = document.documentElement.clientHeight;
			Y_Distance = document.documentElement.scrollTop;
			NewTop	=	( y + Y_Distance - Hoehe+25 - 300);
		}
		else if (document.body) // other Explorers
		{
			x = document.body.clientWidth;
			y = document.body.clientHeight;
			Y_Distance = 0;
			NewTop	=	( y + Y_Distance - Hoehe+25 ) / 2;
		}
		NewLeft	=	( 450 - Breite+25 ) / 2;

	  if (window.pageYOffset) {
		NewTop += window.pageYOffset;
	  } else if (document.body && document.body.scrollTop) {
		NewTop += document.body.scrollTop;
	  }

		div.style.left	=	NewLeft + "px";
		div.style.top	=	NewTop + "px";
	}

function CloseZoomPic(TagId)
{
	document.getElementById(TagId).style.visibility = "hidden";
}
function get( ID ) {
	return	document.getElementById( ID );	
}
function checkContaktForm( Meldung ) {
	Required	=	Array( "Firma", "Vorname", "Nachname", "Strasse", "PLZ", "Ort", "Land", "Telefon", "EMail", "Nachricht", "Sicherheitscode" );
	Err			=	false;
	for( i=0; i<Required.length; i++ ) {
		if( Feld = get( Required[ i ] ) ) {
			if( Feld.value == "" ) {
				Feld.style.backgroundColor	=	"#FCC";	
				Err							=	true;
			}
			else {
				Feld.style.backgroundColor	=	"";	
			}
		}
	}
	if( Err ) {
		alert( Meldung );
		return	false;
	}
	return	true;
}
function changeSortierung( SF ) {
	window.location.href	+=	"&sort=" + SF.options[ SF.selectedIndex ].value;	
}
function addWK(id, org, lan)
{
			var url = 'wkadd.asp?id=' + id + '&dlan=' + lan + '&dorg=' + org; 
			var height = 100
			var iLeft = 0;
			//alert(iLeft);
			var iTop  = 0 ;
			var sOptions = "toolbar=no,status=no,resizable=yes,dependent=yes,scrollbars=yes" ;
			sOptions += ",width=" + '200' ;
			sOptions += ",height=" + height ;
			sOptions += ",left=" + iLeft ;
			sOptions += ",top=" + iTop ;
			var PopUpFenster = window.open(url, 'AddWk', sOptions ) ;
			PopUpFenster.opener = self;
}

function delWK(id, org, lan)
{
			var url = 'wkdel.asp?id=' + id + '&dlan=' + lan + '&dorg=' + org; 
			var height = 100
			var iLeft = 0;
			//alert(iLeft);
			var iTop  = 0 ;
			var sOptions = "toolbar=no,status=no,resizable=yes,dependent=yes,scrollbars=yes" ;
			sOptions += ",width=" + '200' ;
			sOptions += ",height=" + height ;
			sOptions += ",left=" + iLeft ;
			sOptions += ",top=" + iTop ;
			var PopUpFenster = window.open(url, 'DelWk', sOptions ) ;
			PopUpFenster.opener = self;
}
Text_Areyousure	=	"";
function areyousure() {
	if( !Text_Areyousure ) {
		Text_Areyousure	=	"Sind Sie sicher?";
	}
	if( confirm( Text_Areyousure ) ) {
		return	true;
	}
	return	false;
}
function downloadAllSelected() {
	Checkboxen	=	document.getElementsByName( 'doccb' );
	Linklist	=	"";
	for( i=0; i<Checkboxen.length; i++ ) {
		CB	=	Checkboxen[ i ];
		if( CB.checked ) {
			if( Linklist != "" ) {
				Linklist	+=	",";	
			}
			Linklist	+=	CB.id;
		}
	}
	if( Linklist != "" ) {
		location.href	=	'/admintool4/upload/csdownload3aszip2.aspx?ssid=235845125&farr=' + Linklist;	
	}
	else {
		alert( 'Sie haben keine Daten ausgewählt.' );	
	}
}
function sendAllSelected() {
	Checkboxen	=	document.getElementsByName( 'doccb' );
	Linklist	=	"";
	for( i=0; i<Checkboxen.length; i++ ) {
		CB	=	Checkboxen[ i ];
		if( CB.checked ) {
			ArrLink	=	CB.id.split( "_" );
			if( ArrLink.length == 3 ) {
				if( Linklist != "" ) {
					Linklist	+=	",";	
				}
				Linklist	+=	ArrLink[ 0 ] + "_" + ArrLink[ 2 ] + "_" + ArrLink[ 1 ];
			}
		}
	}
	if( Linklist != "" ) {
		location.href	+=	'&send=1&sendlist=' + Linklist;	
	}
	else {
		alert( 'Sie haben keine Daten ausgewählt.' );	
	}
}
function over( Div ) {
	Div.id	=	"SEL";	
}
function out( Div ) {
	Div.id	=	"";	
}
function checkMerkzettel( Meldung ) {
	Required	=	Array( "email", "Sicherheitscode" );
	Err			=	false;
	for( i=0; i<Required.length; i++ ) {
		if( Feld = get( Required[ i ] ) ) {
			if( Feld.value == "" ) {
				Feld.style.backgroundColor	=	"#FCC";	
				Err							=	true;
			}
			else {
				Feld.style.backgroundColor	=	"";	
			}
		}
	}
	if( Err ) {
		alert( Meldung );
		return	false;
	}
	return	true;

}

function showOverlay( Inhalt ) {
	if( Ele = get( "OVERLAYINNERCONTENT" ) ) {
		Ele.innerHTML	=	Inhalt;	
	}
	if( Ele = get( "OVERLAY" ) ) {
		Ele.style.display	=	"";	
	}
	if( Ele = get( "OVERLAYCONTENT" ) ) {
		Ele.style.display	=	"";	
	}
}

function showOverlayStart( Headline, Inhalt ) {
	if( Ele = get( "OVERLAYINNERCONTENT" ) ) {
		Ele.innerHTML	 =		"<h2>" + Headline + "</h2>";
		Ele.innerHTML	+= 		Inhalt;		
	}
	if( Ele = get( "OVERLAY" ) ) {
		Ele.style.display	=	"";	
	}
	if( Ele = get( "OVERLAYCONTENT" ) ) {
		Ele.style.display	=	"";	
	}
}

function hideOverlay() {
	if( Ele = get( "OVERLAY" ) ) {
		Ele.style.display	=	"none";	
	}
	if( Ele = get( "OVERLAYCONTENT" ) ) {
		Ele.style.display	=	"none";	
	}
}

function showDiv( ID ) {
	if( Ele = get( ID ) ) {
		Ele.style.display	=	"";	
	}
}
function hideDiv( ID ) {
	if( Ele = get( ID ) ) {
		Ele.style.display	=	"none";	
	}
}
// Postback fuer Filter ueber News
function changeFilter() {
	document.newsfilter.submit();
}
// Wechsel zwischen den Newseintraegen im Overlaybereich
function changeNews( NewsIndex, Aenderung, Anzahl ) {
	hideDiv( "NEWSBIG" + NewsIndex );
	NeuerIndex	=	NewsIndex + Aenderung;
	if( NeuerIndex < 0 ) {
		NeuerIndex	=	Anzahl - 1;
	}
	if( NeuerIndex > Anzahl - 1 ) {
		NeuerIndex	=	0;	
	}
	showDiv( "NEWSBIG" + NeuerIndex );
}
// Wechsel zwischen den Messeeintraegen im Overlaybereich auf der Startseite
function changeMesse( NewsIndex, Aenderung, Anzahl ) {
	hideDiv( "MESSEBIG" + NewsIndex );
	NeuerIndex	=	NewsIndex + Aenderung;
	if( NeuerIndex < 0 ) {
		NeuerIndex	=	Anzahl - 1;
	}
	if( NeuerIndex > Anzahl - 1 ) {
		NeuerIndex	=	0;	
	}
	showDiv( "MESSEBIG" + NeuerIndex );
}
// Prueft die Hoehe der H1 Tags - wenn zu Hoch, wird die Schriftgroesse kleiner gemacht
function checkH1Tags() {
	MaxHeight	=	60;
	if( H1Tag = get( "h1overflow" ) ) {
		FontPx		=	30;
		PaddingTop	=	14;
		PaddingBot	=	18;
		Height	=	H1Tag.offsetHeight;
		while( Height + PaddingTop + PaddingBot > MaxHeight ) {
			if( FontPx < 6 ) break;
			if( FontPx % 5 == 0 ) {
				PaddingTop--;
				PaddingBot--;
			}
			FontPx--;
			H1Tag.style.fontSize					=	FontPx + "px";
			H1Tag.parentNode.style.paddingTop		=	PaddingTop + "px";
			H1Tag.parentNode.style.paddingBottom	=	PaddingBot + "px";
			Height									=	H1Tag.offsetHeight;
		}
	}
}
function checkParentZIndex( Ele ) {
	zIndex	=	Ele.style.zIndex;
	if( zIndex >= 280 ) {
		return	true;
	}
	return	false;
}
