﻿// 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 regFunction() {
	var evt = document.createEventObject();
	$('contactLink').fireEvent('onclick', evt); 
	

	if ($("toolbar-nav")) {
		$A($("toolbar-nav").getElementsByTagName("a")).each(
			function(trigger) {
				trigger = $(trigger);

				var node = $('generic-content-contact');
				node.addClassName("active-layer");
				this.trigger.up().addClassName("active");
				trigger.addClassName("clicked"); // avoids hover effect (only for the first time)
				trigger.observe("mouseout",
					function(e) {
						var elm = Event.findElement(e, "a");
						elm.removeClassName("clicked");
						elm.stopObserving("mouseout");
					}
				);

				if (LINK_REL_REGEX.test(trigger.rel)) { // layer link
					var id = trigger.rel.replace(LINK_REL_REGEX, "$1");
					var node = $("toolbar-layer-" + id);
					alert(trigger);
					new ContentLayer(node, trigger);
				} else { // standard link, probably external
					trigger.observe("click", function() {
						HeaderAnimation.animate = false;
						Layer.closeCurrent();
						HeaderAnimation.animate = true;
					}.bindAsEventListener(this));
				}
			}.bind(this)
		);
	}

}

//-----------------------------------------------------------------------------------------------------------------------------------------
/*
	Hinweis: Der nachfolgende Code ist eine Kopie aus der Datei /pma/_resources/js/lib/core.js
	
	Die Kopie enthaellt eine Änderung in Zeile 232. Durch die Kopie wird die komplette Klassendefinition von IframeLining ueberschrieben.
	
	Sobald das Skript /pma/_resources/js/lib/core.js die notwendigen Aenderungen enthaellt, sollte der nachfolgende Quellcode
	wieder entfernt werden.

*/	
//-----------------------------------------------------------------------------------------------------------------------------------------
IframeLining.prototype = {

	initialize: function(layer) {
		this.layer = layer;
		this.active = false;
		this.correction = {
			width:  0,
			height: 0,
			left:   0,
			top:    0
		} // since cumulativeOffset doesn't include borders

		this.div = $(document.createElement("div"));
		this.div.innerHTML = '<iframe src="javascript:false" frameborder="0" style="position:absolute; left:0; top:0; width:100%; height:100%; margin:0; padding:0; background:transparent; filter:alpha(opacity=0);"></iframe>';
		this.hide();
		setTimeout("document.body.appendChild(this.div)",1);
		//document.body.appendChild(this.div);
	},

	show: function() {
		this.refresh();
		this.div.show();
		this.active = true;
	},

	refresh: function() {
		var dimension = $(this.layer).getDimensions();
		var position  = Position.cumulativeOffset(this.layer);
		this.div.setStyle(
			{
				height: (dimension.height + this.correction.height) + "px",
				left:   (position[0] + this.correction.left)        + "px",
				top:    (position[1] + this.correction.top)         + "px",
				width:  (dimension.width + this.correction.width)   + "px",
				position: "absolute",
				zIndex:   "1"
			}
		);
	},

	setOffset: function(offset) {
		this.div.style.top = offset + "px";
	},

	hide: function() {
		this.div.hide();
		this.active = false;
	}
}