var gOLastMark = '';// enthält zuletzt markierten Eintrag der Liste
var gs_lastButton = ''; // enthälst zuletzt markierten Button in der Service-Leiste
var gSId = ""; // enthält ID des zu markierenten Eintrags der Liste
var gSSeite = ""; // enthält URL der gesuchten Navi Seite
var goMark = false; // Boolen zur kontrolle im Navi
var goMark2 = false; // Boolen zur kontrolle im Navi
//Funktion, um Zustände im TOC zu erzeugen, wie z.B. Markieren des Ausgewählten, Demarkieren des zuletzt ausgewählten

var gSSubDir = '/RSWeb';		// enthält Pfad zum Internet-Auftrit auf den Entwicklungsrechnern

if(oIsInternet(window.location.host))
	gSSubDir = '';

if(top.document.location.href.indexOf("en/") >= 0)
	gSLangDir = '/en';
	
if(top.document.location.href.indexOf("de/") >= 0)
	gSLangDir = '/de';

//if(oIsInternet(window.location.host))
//	gSLangDir = '';											// getrennte Domains für englisch und deutsch statt Verzeichnisse

//  Schliessen aller Menüs etc.
//---------------------------------------------------
// findet ein Objekt in einem HTML-Dokument (funktioniert für verschiedene Browser)
// durchsucht das Dokument, alle Formulare, alle Layer, alle IDs
// SElem:	die ID des gesuchten Objekts
// ODoc:	das Dokument (für rekursiven Aufruf für die Layer)


function OFindElem(SElem, ODoc)
{
  	var i,
  		OElem;

  	if(!ODoc)
  		ODoc = document;

	if(!(OElem = ODoc[SElem]) && ODoc.all) 					// IE
		OElem = ODoc.all[SElem];

	for(i = 0; !OElem && i < ODoc.forms.length; i++) 			// solange noch kein Element gefunden wurde, alle Formulare durchlaufen
		OElem = ODoc.forms[i][SElem];

	for(i = 0; !OElem && ODoc.layers && i < ODoc.layers.length; i++) 	// solange noch kein Element gefunden wurde, alle Layer durchlaufen
		OElem = OFindElem(SElem, ODoc.layers[i].document);

	if(!OElem && ODoc.getElementById)
		OElem = ODoc.getElementById(SElem);

	return OElem;
}

// Ausführung im TOC
function MenuRemote(SImg)
// Funktionaltät des Bildertauschs ist hier z.Zt. deaktiviert, um Konformität mit CI München zu gewährleisten.

{
	if (gOLastMark)
	{
		gOLastMark.src = '/Common/images/ar_level2.gif';
	}
	gOLastMark = null;

	OImg = OFindElem(SImg);
	if(OImg)
	{
		OImg.src = '/Common/images/ar_level2.gif';
		gOLastMark = OImg;
	}
}

// Aufruf von der einzelnen Seite
function UpdateToc(SImg)
{

	if(top.Links1 && top.Links1.MenuRemote)
		top.Links1.MenuRemote(SImg);

}

// öffnet die Anmeldeseite und füllt die übergebenen Werte in die passenden Felder
function startBooking(STitle, SDays, SShortCut, SDate, SPrice, SComment)
{
	if (gSLangDir == '/de')
	{
		var ODoc = window.open("AnmeldungSeminar14.asp?mailto=Werner.Huhse@rsdc.rohde-schwarz.com&Title=" + STitle + "&Days=" + SDays +
		"&ShortCut=" + SShortCut + "&Date=" + SDate + "&Price=" + SPrice + "&Comment=" + SComment,
		"Booking", "left=20,top=20,toolbar=1,location=0,directories=0,status=0,menubar=1,scrollbars=1,resizable=1,width=700,height=550");
	}
	if (gSLangDir == '/en')
	{
		var ODoc = window.open("RegistrationSeminar14.asp?mailto=Werner.Huhse@rsdc.rohde-schwarz.com&Title=" + STitle + "&Days=" + SDays +
			"&ShortCut=" + SShortCut + "&Date=" + SDate + "&Price=" + SPrice + "&Comment=" + SComment,
			"Booking", "left=20,top=20,toolbar=1,location=0,directories=0,status=0,menubar=1,scrollbars=1,resizable=1,width=700,height=550");
	
	}
	ODoc.focus();
}

function emailToInfo(SMailTarget)
{
	if (SMailTarget == "ewert")
	{
		document.URL =  "mailto:rainer.ewert@rs" +
				    "dc.rohde-schwarz.com?subject=Anfrage Dokumentation";
	}
//	else if (SMailTarget == "huhse")
//	{
//		document.URL =  "mailto:werner.huhse@rs" +
//				    "dc.rohde-schwarz.com?subject=Anfrage Schulung";
//	}
//	else if (SMailTarget == "zorenboehmer")
//	{
//		document.URL =  "mailto:joerg.zorenboehmer@rs" +
//				    "dc.rohde-schwarz.com?subject=Anfrage Dokumentation";
//	}
	else if (SMailTarget == "wiese")
	{
		document.URL =  "mailto:stefan.wiese@rs" +
				    "dc.rohde-schwarz.com?subject=Anfrage Software";
	}
	else if (SMailTarget == "fischer")
	{
		document.URL =  "mailto:martin.fischer@rs" +
				    "dc.rohde-schwarz.com?subject=Anfrage Logistik";
	}
	else if (SMailTarget == "otting")
	{
		document.URL =  "mailto:klaus.otting@rs" +
				    "dc.rohde-schwarz.com?subject=Anfrage, allgemein";
	}
	else if (SMailTarget == "kroon")
	{
		document.URL =  "mailto:gerd.kroon@rs" +
				    "dc.rohde-schwarz.com?subject=Anfrage, allgemein";
	}
	else if (SMailTarget == "krause")
	{
		document.URL =  "mailto:axel.krause@rs" +
				    "dc.rohde-schwarz.com?subject=Anfrage, allgemein";
	}
	else if (SMailTarget == "rssys")
	{
		document.URL =  "mailto:info.rssys@ro" +
				    "hde-schwarz.com?subject=Anfrage, allgemein";
	}
	else
	{
		document.URL =  "mailto:info@rs" +
				    "dc.rohde-schwarz.com?subject=Anfrage";
	}
}

function DocName(Sfilename)
{
	if (Sfilename == "")
		return ("index.htm");
	else
		return ("index.htm?" + Sfilename.pathname.substring(Sfilename.pathname.lastIndexOf('/')+1));
}

function oIsInternet(OSite)
{
	var SSite = OSite.toString();
	if(SSite == "" || SSite.indexOf("localhost") >= 0 || SSite.indexOf("127.0.0.1") >= 0 || SSite.indexOf("172.17.32.15") >= 0)
	{
		return(false);
	}
	else
	{
		return(true);
	}
}

function Redirect(SSite)
{
	if(!oIsInternet(window.location.host))
	{
		if(window.location.host != "")
		{
			if(window.location.pathname.indexOf(SSite) < 0)
				window.location.replace('http://' + window.location.host + gSSubDir + gSLangDir + '/' + SSite + '/index.htm' + window.location.search);
		}
		else
		{
			top.location.replace('http://localhost:8181' + gSSubDir + gSLangDir + '/' + SSite + '/index.htm' + window.location.search);
		}
	}
	else if(window.location.toString().indexOf(SSite) < 0)
	{
		var SLangDomain = 'www.rskoeln.de'
		if(window.location.toString().indexOf(".com") >= 0)
			SLangDomain = 'www.rscologne.com';

		top.location.replace('http://' + SLangDomain + "/" + SSite + '/index.htm' + window.location.search);
	}
}

// Überprüft ob der Navieframe und die Funktion ChangeBgColor vorhanden ist,
// ob die ausgewählte Seite und der Navi (Frame: Links1) Bereich zusammenpassen
// falls nicht aktualisiert sie den Navi (Frame: Links1) Bereich
// und den Top (Frame: Menu) Bereich
function UpdateNavi(SSeite, SId)
{
	if(!SSeite)
		return;

	if(SSeite.indexOf("/") != 0)		// wenn die Seite nicht mit / beginnt, wird eins vorne dran gefügt
		SSeite = "/" + SSeite;

	if(oIsInternet(window.location.host) == false && SSeite.indexOf(gSSubDir) <0)	// Überprüfung auf RSWeb wegen RemoteUpdateNavi() da da schon an SSeite drann
	{
		SSeite = gSSubDir + gSLangDir + SSeite;             // auf Entwicklungsrechnern der Unterordner, im Internet kein Unterordner
	}
	var STop = SSeite.replace(/_Navi.htm/, "_Top.htm");

	if(top.Links1 && top.Links1.ChangeBgColor)
	{
		//alert(top.Links1.document.location.pathname + " versus " + SSeite);
		if(top.Links1.document.location.pathname == SSeite)
		{
			top.Links1.ChangeBgColor(SId);
		}
		else
		{
			gSId	= SId;
			gSSeite = SSeite;
			goMark	= true;
			top.Links1.document.location.replace('http://' + window.location.host + "/" + SSeite);
		}
	}
	else
	{
		gSId	= SId;
		gSSeite = SSeite;
		goMark2 = true;
	}

	if(top.Menu)
	{
		top.Menu.document.location.replace('http://' + window.location.host + STop);
	}
}

// Setzt den Navi(Links1) und Top(Menu) Bereich wieder auf Standard zurück wenn Suchen Seite geöffnet wird
function SuchenNavi()
{
	var SSubDir = gSSubDir;
	if(oIsInternet(window.location.host) == true)
	{
//		SSubDir = '/';
	}

//	alte Version:
//	top.Links1.document.location.replace('http://' + window.location.host + SSubDir + gSLangDir + '/root/10_Navi.htm');
//	top.Menu.document.location.replace('http://'   + window.location.host + SSubDir + gSLangDir + '/root/10_Top.htm');

	top.Links1.document.location.replace('http://' + window.location.host + '/root/10_Navi.htm');
	top.Menu.document.location.replace('http://'   + window.location.host + '/root/10_Top.htm');
}