
function lightup(imgName)
	{
	if (document.images)
	{
		//alert("lightup")
		imgOn=eval(imgName + "on.src");
		//alert("lightup2")
		document[imgName].src= imgOn;
		//alert("lightup3")
	}
	}

function turnoff(imgName)
	{
	if (document.images)
	{
		imgOff=eval(imgName + "off.src");
		document[imgName].src= imgOff;
	}
	}
	
function popup(w,h,site) {
	x = screen.availWidth/2-w/2;
	y = screen.availHeight/2-h/2;
	var popupWindow = window.open(
		'','','width='+w+',height='+h+',left='+x+',top='+y+',screenX='+x+',screenY='+y+',scrollbars=yes');
	popupWindow.document.write(site);
}

function getObject(id){
	if(document.getElementById){
		layer_obj = document.getElementById(id).style;
	}
	if(document.all){
		layer_obj = document.all[id].style;
	}
	return(layer_obj);
}

function showLayer(id){
	getObject(id).visibility = "visible";
}

function hideLayer(id){
	getObject(id).visibility = "hidden";
}

function showLayerDisplay(id){
	getObject(id).display = "block";
}

function hideLayerDisplay(id){
	getObject(id).display = "none";
}

function getElem(id){
	if(document.getElementById){
		_obj = document.getElementById(id);
	}
	else{
		_obj = document.all[id];
	}
	return(_obj);
}

function checkResult(res)
{
	if(res.error != null)
	{
		if(res.error.Type == 'ConnectFailure')
		{
			window.self.location.reload();
		}
		return false;
	}
	return true;
}

function GetSucheInfo(sSuchbegriff, sID) {
	CMS_Template.DGIService.GetSucheInfo(sSuchbegriff, sID, GetSucheInfo_callback);
}

function GetSucheInfo_callback(res) {
	if(checkResult(res) == true)
	{
		var myInfo = res;
		if (myInfo.sSucheHtml != '')
			showLayer('sucheIndex');
		else
			hideLayer('sucheIndex');
			
		getElem('sucheIndex').innerHTML = myInfo.sSucheHtml;
		if (getElem(myInfo.sSuchindexID) != null)
		{
			getElem('sucheIndex').style.left = getElem(myInfo.sSuchindexID).offsetLeft - 5;
			getElem('sucheIndex').style.top = getElem(myInfo.sSuchindexID).offsetTop + 21;
		}
	}
	res = null;
}

function SetSuchbegriff(sSuchbegriff, sID) {
	CMS_Template.DGIService.SetSuchbegriff(sSuchbegriff);
	hideLayer('sucheIndex');
	getElem(sID).value = sSuchbegriff;
}

function hideSuche() {
	setTimeout("hideLayer('sucheIndex');", 200);
}

function showWeitere(BereichID, WeitereID)
{
	showLayerDisplay(WeitereID);
	hideLayerDisplay(BereichID);
}

var lct = 0;
var lct2 = 0;
function startCloseTimer(BereichID, WeitereID){
	var sFunction = "showLayerDisplay('" + BereichID + "');"
	lct = setTimeout(sFunction, 10);
	sFunction = "hideLayerDisplay('" + WeitereID + "');"
	lct2 = setTimeout(sFunction, 10);
}

function stopCloseTimer(){
	clearTimeout(lct);
	clearTimeout(lct2);
}

function GetMLogoL() {
	/*
	if (getElem('headerMLogoL') != null)
	{
		getElem('headerMLogoL').innerHTML = "";
	}
	setTimeout("CMS_Template.DGIService.GetMLogoL(GetMLogoL_callback);",20);
	*/
	/*CMS_Template.DGIService.GetMLogoL(GetMLogoL_callback);*/
}

function GetMLogoL_callback(res) {
	if(checkResult(res) == true)
	{
		var sHtml = res;
		if (getElem('headerMLogoL') != null)
		{
			getElem('headerMLogoL').innerHTML = sHtml;
		}
		setTimeout("GetMLogoL();",3000);
	}
	res = null;
}
function GetMLogoR() {
	CMS_Template.DGIService.GetMLogoR(GetMLogoR_callback);
}

function GetMLogoR_callback(res) {
	if(checkResult(res) == true)
	{
		var sHtml = res;
		if (getElem('headerMLogoR') != null)
		{
			getElem('headerMLogoR').innerHTML = sHtml;
		}
		setTimeout("GetMLogoR();",3000);
	}
	res = null;
}

function SetRechnungShow(nid) {
	CMS_Template.MitgliedEdit.SetRechnungShow( nid, GetRechnungHtml_callback);
}

function GetRechnungHtml_callback(res) {
	if(checkResult(res) == true)
	{
		var myInfo = res;
		if (getElem(myInfo.sDivID) != null)
			getElem(myInfo.sDivID).innerHTML = myInfo.sHtml;
	}
	res = null;
}

function SetSuchListe(nListe, myInfo)
{
	if (getElem(myInfo.arInfoSet[nListe].sDiv) != null && myInfo.arInfoSet[nListe].bReload == true)
	{
		getElem(myInfo.arInfoSet[nListe].sDiv).innerHTML = myInfo.arInfoSet[nListe].sHTML;
	}
	
	if (getElem(myInfo.arInfoSet[nListe].sKriterienDiv) != null)
	{
		getElem(myInfo.arInfoSet[nListe].sKriterienDiv).innerHTML = myInfo.arInfoSet[nListe].sKriterienHTML;
	}
	
	if (getElem(myInfo.arInfoSet[nListe].sLIID) != null && myInfo.arInfoSet[nListe].bReload == false)
	{
		getElem(myInfo.arInfoSet[nListe].sLIID).className = myInfo.arInfoSet[nListe].sLIClass;
	}
	
	if (getElem(myInfo.arInfoSet[nListe].sUlID) != null)
	{
		getElem(myInfo.arInfoSet[nListe].sUlID).scrollTop = myInfo.arInfoSet[nListe].nTop;
	}
}

function SetDienstleistung(nID) {
	CMS_Template.DGIService.SetDienstleistung(nID, getElem('ulDienstleistungen').scrollTop, SetDienstleistung_callback);
}

function SetDienstleistungM(nID) {
	CMS_Template.DGIService.SetDienstleistungM(nID, getElem('ulDienstleistungen').scrollTop, SetDienstleistung_callback);
}

function SetDienstleistung_callback(res) {
	if(checkResult(res) == true)
	{
		var myInfo = res;
		// Dienstleistung
		SetSuchListe(0, myInfo);
	}
	res = null;
}

function SetFachgebiet(nID) {
    CMS_Template.DGIService.SetFachgebiet(nID, getElem('ulFachgebiete').scrollTop, SetFachgebiet_callback);
}

function SetFachgebietM(nID) {
    CMS_Template.DGIService.SetFachgebietM(nID, getElem('ulFachgebiete').scrollTop, SetFachgebiet_callback);
}

function SetFachgebiet_callback(res) {
	if(checkResult(res) == true)
	{
		var myInfo = res;
		// Fachgebiet
		SetSuchListe(1, myInfo);
	}
	res = null;
}

var lctIB = 0;
function startCloseTimerIB(id){
	lctIB = setTimeout("hideLayerDisplay('" + id + "');",100);
}
function stopCloseTimerIB(){
	clearTimeout(lctIB);
}
function startShowTimerIB(id){
	setTimeout("showLayerDisplay('" + id + "');",100);
}

function GetIBHilfe(nID) {
	CMS_Template.InfobrokerSuche.GetIBHilfe(nID, GetIBHilfe_callback);
}

function GetIBHilfe_callback(res) {
	if(checkResult(res) == true)
	{
		var myInfo = res;
		if (getElem('ibhilfe') != null)
		{
			getElem('ibhilfe').innerHTML = myInfo.sHtml;
			if (document.getElementById)
			{
				document.getElementById('ibhilfe').style.left = document.getElementById(myInfo.sHilfeClientID).offsetLeft;
				document.getElementById('ibhilfe').style.top = document.getElementById(myInfo.sHilfeClientID).offsetTop + 20;
			}
			else if (document.all)
			{
				document.all['ibhilfe'].style.left = document.all[myInfo.sHilfeClientID].offsetLeft;
				document.all['ibhilfe'].style.top = document.all[myInfo.sHilfeClientID].offsetTop + 20;
			}
			showLayerDisplay('ibhilfe');
		}
	}
	res = null;
}

function HideIBHilfe()
{
	hideLayerDisplay('ibhilfe');
}

function ScrollSelected(sID, nTop)
{
	if (getElem(sID) != null)
	{
		getElem(sID).scrollTop = nTop;
	}
}

function showMeldung(DivID) {
	//new Effect.Puff(DivID);
	new Effect.Opacity(DivID,{duration:2, from:0, to:1, transition: Effect.Transitions.linear});
	setTimeout("showMeldung('" + DivID + "');",4000);
}

function GetMeldungL() {
	//new Effect.Puff(DivID);
	CMS_Template.DGIService.GetMeldungL(GetMeldungL_callback);
}

function GetMeldungL_callback(res) {
	if(checkResult(res) == true)
	{
		if (getElem('headerMeldungL') != null)
		{
			getElem('headerMeldungL').innerHTML = res;
			new Effect.Opacity('headerMeldungL',{duration:2, from:0, to:1, transition: Effect.Transitions.linear});
			setTimeout("GetMeldungL();",4000);
		}
	}
	res = null;
}

function moveIWP()
{
	new Effect.Move('IWPInner',{ x: 0, y: -313, mode: "relative", duration: 5.0});
	new Effect.Move('IWPInner',{ x: 0, y: 0, mode: "absolute", queue: "end", duration: 5.0});
	setTimeout("moveIWP();",10000);
}

function SessionAbandon() {
	CMS_Template.DGIService.SessionAbandon();
}



