﻿// Javascript Fehler unterdruecken
onerror = stopError;
function stopError()
{
return true;
}


// overwrites the same method in script.js

SiteExplorer.expandSubtree = function(linkNode) {
	linkNode.addClassName("expanded");
	linkNode.up().removeClassName("collapsed");
	linkNode.up().addClassName("expanded");
	SiteExplorer.layer.afterOpen();
}

SiteExplorer.collapseSubtree = function(linkNode) {
	linkNode.removeClassName("expanded");
	linkNode.up().addClassName("collapsed");
	linkNode.up().removeClassName("expanded");
	SiteExplorer.layer.afterOpen();
}

SiteExplorer.followLink = function(linkNode) {
	if (linkNode.innerHTML != "Home") {
		//alert("clicked link: " + linkNode.innerHTML + "\nThe Site Explorer will be closed.");
		//Layer.closeCurrent();
	}
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MM_jumpMenu2(targ,selObj,restore){ //v3.0
  
  window.open(selObj.options[selObj.selectedIndex].value,"SiemensSectorArea")
  //eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
 

function searchcheck()
{
	elem = document.getElementById("searchform");
	if (elem.q.value=='')
	{
		alert("Please submit a search text.");
		elem.q.focus();
		return false;
	}	
}

function sprache()
{
	document.location.href=document.auswahl.sprachauswahl.value;
}
	
function contactcheck()
{
	if (document.contact.name.value=='')
	{
		alert("Please insert your name!");
		document.contact.name.focus();
		return false;
	}
	
	if (document.contact.vorname.value=='')
	{
		alert("Please insert your first name!");
		document.contact.vorname.focus();
		return false;
	}
	
	if (document.contact.firma.value=='')
	{
		alert("Please insert your company's name!");
		document.contact.firma.focus();
		return false;
	}
	
	if (document.contact.absender.value=='')
	{
		alert("Please insert your email address!");
		document.contact.absender.focus();
		return false;
	}
	if (document.contact.absender.value.indexOf('@') == -1 || document.contact.absender.value.indexOf('.') == -1)
	{
		alert(unescape("Please check your inserted email address."));
		document.contact.absender.focus();
		return false;
	}
		
	if (document.contact.telefon.value=='')
	{
		alert("Please insert your phone number!");
		document.contact.telefon.focus();
		return false;
	}
	
	if (document.contact.frage.value=='')
	{
		alert("Please insert your statement, your question or your feedback!");
		document.contact.frage.focus();
		return false;
	}
}		
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
		
function ni(id,imgid,imgpath,lay,show,color){
	// Navigation Information Script to control additional Infofiels and Rollover Images
	
	if(!imgid==""){
		if(!imgpath==""){
			MM_swapImage(imgid,'',imgpath,1);
		}else{
			MM_swapImgRestore();
		}
	}else{
		if(!imgpath==""){
			MM_swapImage("Image1",'',imgpath,1);
		}else{
			MM_swapImgRestore();
		}
	}
	
	if(!lay==""){
		if(show==1){s="show";}else{s="hide";}
		showHideLayers(lay,'',s);
	}
	
	if(document.getElementById(id)){
		if(!id=="")	{
			if(!color==""){
				change_color(id,color);
			}else{
				change_color(id,"#333333");
			}
		}
	}
}
function Xgoto(wohin) {
   window.location.href=wohin;
}
function toggleDisplay(item){
	obj=document.getElementById(item);
	visible=(obj.style.display!="none");
	   
	if (visible){
		obj.style.display="none";
	} else {
		obj.style.display="block";
	}	
}
function showDisplay(item){
	obj=document.getElementById(item);
	obj.style.display="block";
}
function hideDisplay(item){
	obj=document.getElementById(item);
	obj.style.display="none";
}
function getChoice(theform) {
	for (var i = 0; i < theform.length; i++) {
		if (theform.options[i].selected == true){
			return theform.options[i].value
		}
	}
	return null
}
function selectCategory	(sprache, branche, theform) {
	document.myForm.kat.length=0;
	NeuerEintrag = new Option("", "", false, true);
	theform.kat.options[theform.kat.length] = NeuerEintrag;
	var i;
	if (document.myForm.page_branche.selectedIndex > 0) {
		var sucheSprache="S"+sprache;
		var sucheBranche=branche+"-";
		for (var i = 0; i < document.zwei.dieKats.length; i++) 	{
			str=document.zwei.dieKats.options[i].value;
			treffer=str.indexOf(sucheSprache);
			if (treffer != -1) {
				treffer2=str.indexOf(sucheBranche);
				if (treffer2 != -1) {
					NeuerEintrag = new Option(document.zwei.dieKats.options[i].text, document.zwei.dieKats.options[i].value, false, true);
	  				theform.kat.options[theform.kat.length] = NeuerEintrag;
	
					//theform.kat.options[theform.kat.length].value=document.zwei.dieKats.options[i].value;
					//theform.kat.options[theform.kat.length].text=document.zwei.dieKats.options[i].text;
				}
			}
		}
	}
}
function restoreKat() {
	document.myForm.kat.length=document.zwei.dieKats.length;
	for (var i = 0; i < document.zwei.dieKats.length; i++) 	{
		//document.myForm.kat.options[i].value=document.zwei.dieKats.options[i].value;
		//document.myForm.kat.options[i].text=document.zwei.dieKats.options[i].text;
	}
}
function showKategorie() {
	if (document.myForm.page_sprache.value == '') {
		hideDisplay(300);
	} else {
		showDisplay(300);
	}
}
function showLang(id,anz){
	for(var i = 0; i < anz+1; i++){
		hideDisplay(i);
	}
}
function confirmmail(name){
	alert("Thank you for your Message to "+name);
	if (window.opener){
	self.close();
	}
	
}

function openpostboxform(insite,w,h){
	var xsize   =   screen.width;
	var ysize   =   screen.height;
	var breite  =   w;
	var hoehe   =   h;
	var xpos    =   (xsize-breite)/2;
	var ypos    =   (ysize-hoehe)/2;
	
    var settings = "scrollbars=auto,status=no,toolbar=no,location=no,directories=no,resizable=yes,menubar=no,width="+breite+",height="+hoehe+",screenX="+xpos+",screenY="+ypos+",top="+ypos+",left="+xpos;

    remotewin = window.open(insite,"CONTACT",settings);
}

