ns4=document.layers?1:0
ie4=document.all?1:0
ns6=document.getElementById&&!document.all?1:0
calculateWidth=null;
function openWindow(url)
{
  var values = url.split("#target=");
  if(values[1])
    window.open(values[0], values[1]);
  else
    window.open(values[0], "KISTERS_MAIN");
}
function openPopup(url)
{
  var name = "KisPopup";
  var width = 800;
  var height = 600;
  if(self.name != name)
    w = window.open(url, name, "resizable=yes,dependent=yes,scrollbars=yes, height=" + height + ",width=" + width);
  else
    w = window.open(url, name, "resizable=yes,dependent=yes,scrollbars=yes");
   
  if(w.outerHeight)
  {
    w.outerHeight = height;
    w.outerWidth = width;
  }
  w.focus();
}
function openSimpleWindow(url, width, height, name)
{
   w = window.open(url, name, "resizable=yes,dependent=yes,scrollbars=yes, height=" + height + ",width=" + width);
   
   if(w.outerHeight)
   {
      w.outerHeight = height;
      w.outerWidth = width;
   }
}
function openSimpleWindowNoScroll(url, width, height, name)
{
   w = window.open(url, name, "resizable=yes,dependent=yes,scrollbars=no, height=" + height + ",width=" + width);
   
   if(w.outerHeight)
   {
      w.outerHeight = height;
      w.outerWidth = width;
   }
   w.focus();
}
function adjustTopNavigation(division)
{
	try
	{
		var t=top.frames['KISTERS_TOP'];
		if(t)
		{
			if(t.webName)
			{
				division=(!t.CompanyDivision&&division==""?"HOME":division);
				t.adjustEnvironment(division);
				if(division&&division!=""&&division!=t.CompanyDivision)
				{
					t.adjustNavigation(division);
					t.CompanyDivision=division;
				}
			}
			else
				if((topNaviTimeout--) > 0)
					setTimeout('adjustTopNavigation("'+division+'")',10);
		}
	}
	catch(e)
	{
		if((topNaviTimeout--) > 0)
			setTimeout('adjustTopNavigation("'+division+'")',10);
	}
}
function showTopMenu(division)
{
	if(this==top)
	{
		return;
	}
	if(top.frames[0])
	{
		var t=top.frames['KISTERS_TOP'];
		if(t.Go && t.MenuTopLoaded)
		{
			if(self.name=="KISTERS_CENTER")
				t.HorCorrect=-195;
			else
				t.HorCorrect=0;
			t.SecLineFrame=window;
			t.Go();
		}
		else
			if((topMenuTimeout--) > 0)
				setTimeout("showTopMenu('" + division + "')", 10);
	}
	else
		if((topMenuTimeout--) > 0)
			setTimeout("showTopMenu()", 10);
}
function adjustCellHeight()
{
	var div;
	var absHeight=0;
	for(var i=0; i < 10;i++)
	{
		div = document.getElementById("cell"+i);
		if(div)
		{
			var p = div.parentNode;
			if(p && p.nodeName == "TD")
			{
				absHeight = p.offsetHeight;
				if(ie4)
				{
					var mt = getCurrentStyle(div,'marginTop');
					var mb = getCurrentStyle(div,'marginBottom');
					div.style.height = (absHeight - parseInt(mt) - parseInt(mb))+"px";
				}
				else
				{
					var pt = getCurrentStyle(div,'paddingTop');
					var pb = getCurrentStyle(div,'paddingBottom');
					var mt = getCurrentStyle(div,'marginTop');
					var mb = getCurrentStyle(div,'marginBottom');
					var bt = getCurrentStyle(div,'borderTopWidth');
					var bb = getCurrentStyle(div,'borderBottomWidth');
					div.style.height = (absHeight - parseInt(pt) - parseInt(pb)- parseInt(mt) - parseInt(mb) - parseInt(bt) - parseInt(bb))+"px";
				}
			}
			div.style.visibility = "visible";
		}
	}
}
function getValue(pad)
{
	try
	{
		return(parseInt(pad));
	}
	catch(e)
	{
		return(0);
	}
}
function getCurrentStyle (element, cssPropertyName)
{
	if (window.getComputedStyle)
	{
		return window.getComputedStyle(element, '').getPropertyValue(cssPropertyName.replace(/([A-Z])/g, "-$1").toLowerCase());
	}
	else if (element.currentStyle) 
	{
//		return element.runtimeStyle[cssPropertyName];
		return IE_computedStyle.get(element, cssPropertyName);
	}
	else
	{
		return '';
	}
}
/* 
    Extra string functions
*/   
function replace(text,from,to)             // replace strings in strings
{
   while (( ti=text.indexOf(from) ) >= 0)
   {
       text = text.substr(0,ti)+to+text.substr(ti+1);
   }    
   return text;
} 
    
function x_escape(text)                   // extended escape function
{
   var x_chars = "*2A+2B-2D.2E/2F_5F";
   
   text = escape(text);
   for (ci=0; ci<x_chars.length; ci+=3)
   {
       text = replace(text,x_chars.substr(ci,1),"%"+x_chars.substr(ci+1,2));
   }
   return text;
}   

function store_url(url)
{
   var storevar = "STORED_URL="+url+" ORIG_NAME="+top.window.name;
   top.window.name = replace(x_escape(storevar),"%","_");
}

function retrieve_url()
{
   var url = "";
   var storevar = unescape(replace(top.window.name,"_","%"));
   if (storevar.indexOf("STORED_URL=")==0 && ( ni=storevar.indexOf("ORIG_NAME=") ) > 0) {
       url = storevar.substr(11,ni-11);
       top.window.name = storevar.substr(ni+10);
   }    
   return url;
}

/*
    Control border/navigation frames
*/
function checkFrames(frameset_url,frame_name)
{
  if (top.frames[frame_name] && top.frames[frame_name].document == document) {
    if(( stored_url=retrieve_url() ) > "") {
       document.location.replace(stored_url);
    }
  }
  else {
    store_url(document.location.href);
    top.location.replace(frameset_url);
  }
}

/////////////////////////////////////////////////////////////////
// JS Object: IE_computedStyle
// Returns the computed style, expressed in pixels or as auto, for the given element
// 
// Usage:
// IE_computedStyle.get(elementNode, CSS-Style);
//
// Examples:
// IE_computedStyle.get(el, "width");
// IE_computedStyle.get(el, "margin-top");
/////////////////////////////////////////////////////////////////
var IE_computedStyle = function () {
	var isIE = /*@cc_on!@*/0;
	var borderRegex = /thin|medium|thick/i; /* Regex for css border width keywords */
	var styleEl;
	
	/* GET POS */
	var getPos = function (which) {
		var curStyle = styleEl.currentStyle[which];
		return (/auto/i.test(curStyle)) ? "auto" : grabLength(curStyle) + "px";
	};
	
	/* GET MARGIN */
	var getMargin = function (which) {
		var curStyle = styleEl.currentStyle["margin" + which];
		return (/auto/i.test(curStyle)) ? "0px" : grabLength(curStyle) + "px";
	};
	
	/* GET BORDER WIDTH */
	var getBorderWidth = function (which) {
		var borderWidth = styleEl.currentStyle["border" + which + "Width"];
		if (styleEl.currentStyle["border" + which + "Style"] !== "none" && 
				((/Top|Bottom/i.test(which) && styleEl.offsetHeight > styleEl.clientHeight) || 
				(/Right|Left/i.test(which) && styleEl.offsetWidth > styleEl.clientWidth))) {
			if (!borderRegex.test(borderWidth)) {
				return grabLength(borderWidth) + "px";
			} else if (borderRegex.test(borderWidth)) {
				var temp = document.createElement("DIV");
				temp.style.width = "10px";
				temp.style.border = borderWidth + " " + styleEl.currentStyle["border" + which + "Style"] + " #000000";
				styleEl.parentNode.appendChild(temp);
				borderWidth = Math.round((temp.offsetWidth-10)/2);
				styleEl.parentNode.removeChild(temp);
				return borderWidth + "px";
			}
		} else {
			return "0px";
		}
	};
	
	/* GET PADDING */
	var getPadding = function (which) {
		return grabLength(styleEl.currentStyle["padding" + which]) + "px";
	};
	
	/* GET WIDTH */
	var getWidth = function () {
		var width = styleEl.offsetWidth; /* Currently the width including padding + border */
		width -= parseInt(getPadding("Right"));
		width -= parseInt(getPadding("Left"));
		width -= parseInt(getBorderWidth("Right"));
		width -= parseInt(getBorderWidth("Left"));
		return width + "px";
	};
	
	/* GET HEIGHT */    
	var getHeight = function () {
		var height = styleEl.offsetHeight; /* Currently the height including padding + border */
		height -= parseInt(getPadding("Top"));
		height -= parseInt(getPadding("Bottom"));
		height -= parseInt(getBorderWidth("Top"));
		height -= parseInt(getBorderWidth("Bottom"));
		return height + "px";
	};
	
	/* GRAB LENGTH */
	var grabLength = function (length) {
		var temp = document.createElement("DIV");
		temp.style.width = length;
		styleEl.parentNode.appendChild(temp);
		length = Math.round(temp.offsetWidth);
		styleEl.parentNode.removeChild(temp);
		return length;
	};
	
	return {
		/* GET */
		get : function (el, styleProp) {   
			var rValue;
			styleEl = (typeof(el) === "string") ? document.getElementById(el) : el;	
			var styleProp = (typeof(styleProp) === "string") ? styleProp.toLowerCase() : "";
			styleProp = styleProp.replace(/\-/g, "");
			
			if (!isIE || !/block/i.test(styleEl.currentStyle["display"]))
				return;
			
			switch (styleProp) { /* Run through the valid css properties, return undefined if none match */
				case "top": rValue = getPos("top"); break;
				case "right": rValue = getPos("right"); break;
				case "bottom": rValue = getPos("bottom"); break;
				case "left": rValue = getPos("left"); break;
				case "margintop": rValue = getMargin("Top"); break;
				case "marginright": rValue = getMargin("Right"); break;
				case "marginbottom": rValue = getMargin("Bottom"); break;
				case "marginleft": rValue = getMargin("Left"); break;
				case "bordertopwidth": rValue = getBorderWidth("Top"); break;
				case "borderrightwidth": rValue = getBorderWidth("Right"); break;
				case "borderbottomwidth": rValue = getBorderWidth("Bottom"); break;
				case "borderleftwidth": rValue = getBorderWidth("Left"); break;
				case "paddingtop": rValue = getPadding("Top"); break;
				case "paddingright": rValue = getPadding("Right"); break;
				case "paddingbottom": rValue = getPadding("Bottom"); break;
				case "paddingleft": rValue = getPadding("Left"); break;
				case "width": rValue = getWidth(); break;
				case "height": rValue = getHeight(); break;
			}
			
			return rValue;
		}
	};
}();

function statistic()
{
	if(top.KISTERS_TOP)
	{
		window.status="top";
	}
}
var topMenuTimeout=200;
var topNaviTimeout=200;
function windowOnLoad()
{
	topMenuTimeout=topNaviTimeout=200;
	try
	{
	top.document.title = this.document.title;
	if(pageType)
	{
		switch(pageType)
		{
			case "AIR":
        case "AIR_NA":
        case "AIR_AU":
			case "CT":
        case "CT_NA":
			case "EHS":
			case "ENERGY":
			case "ENERGY_AU":
			case "ENERGY_NA":
			case "HC":
			case "IT":
			case "ReECM":
			case "RePDFCAD":
			case "ReRV":
			case "ReTD":
			case "ReVI":
			case "RMS":
        case "RMS_AU":
        case "RMS_NA":
			case "UC":
        case "EUS":
				if(ie4&&calculateWidth) calculateWidth();
				showTopMenu(pageType);
				adjustCellHeight();
				startNewsScroll();
				break;
			case "HOME":
        case "HOME_NA":
        case "HOME_AU":
				if(ie4&&calculateWidth) calculateWidth();
				showTopMenu('HOME');
				//adjustCellHeight("col1", "col2");
				adjustCellHeight();
				startNewsScroll();
				var flash=document.getElementById("startFlash");
				if(flash)
					flash.style.visibility="visible";
				break;
			case "login":
				if(ie4&&calculateWidth) calculateWidth();
				showTopMenu("");
				setFormFocus();
				break;
			case "profile":
				if(ie4&&calculateWidth) calculateWidth();
				showTopMenu("");
				checkLogout();
				break;
			case "registration":
				showTopMenu("");
				document.forms[0].RegLogin.focus();
				document.forms[0].RegLogin.select();
				up = down = false;
				break;
			case "download":
				showTopMenu("");
			default:
				if(ie4&&calculateWidth) calculateWidth();
				showTopMenu(parent.CompanyDivision);
				break;
		}
		}
		isLoaded=true;
	}
	catch(e)
	{
//		alert("no pageType");
	}
	try
	{
		if(statistic)
		{
			
		}
	}
	catch(e)
	{
	}
}
window.onload=windowOnLoad;
