var ids = new Array('info1','info2','submenu20','submenu25','submenu10','submenu15','submenu30','submenu30en','submenu40','submenu55','submenu70','card1','card2','card3','card4');
var cards = new Array('card1','card2','card3','card4','card5','card6','card7','card8');
var activeSubmenu="";
var mainMenu = null;
var flash="<OBJECT classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0' WIDTH=200 HEIGHT=180><param name='movie' value='/Image/flash/200x180_gif_schriftpsd.swf' width='200' height='180'/><EMBED src='/Image/flash/200x180_gif_schriftpsd.swf' quality=high bgcolor=#FFFFFF  WIDTH=200 HEIGHT=180 TYPE='application/x-shockwave-flash' PLUGINSPAGE='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash'></EMBED></object>"
function show(id)
{
  activeSubmenu=id;
  mainMenu = document.getElementById("mainMenu")
  hideAll();
  var ele = document.getElementById(id)
  if(ele)
  {
    ele.style.display = "inline";
  }
  switch(id)
  {
    case "submenu20":
      mainMenu.src = "/image/home/Pioneer-WATER.gif"
      break;
    case "submenu25":
      mainMenu.src = "/image/home/Pioneer-AIR.gif"
      break;
    case "submenu10":
      mainMenu.src = "/image/home/Pioneer-EMS.gif"
      break;
    case "submenu15":
      mainMenu.src = "/image/home/Pioneer-CT.gif"
      break;
    case "submenu30":
      mainMenu.src = "/image/home/Pioneer-EHS.gif"
      break;
    case "submenu30en":
      mainMenu.src = "/image/home_en/Pioneer-EHS.gif"
      ele.innerHTML = flash
      break;
    case "submenu40":
      mainMenu.src = "/image/home/Pioneer-UC.gif"
      break;
    case "submenu55":
      mainMenu.src = "/image/home/Pioneer-IT.gif"
      break;
  }
}
/*
function showCard(id)
{
	var activeCard=id;
	var activeHead="";
	for(var i=0; i<cards.length; i++)
	{
		if(cards[i] != activeCard)
		{
			var headid="card" + (i+1) + "h";
			var element = document.getElementById(cards[i]);
			if(element)
				element.style.display = "none";
			var head = document.getElementById(headid);
			if(head)
			{
				head.style.border = "1px solid #b0b0bf";
				head.style.borderBottom = "1px solid #909090";
			}
		}
		else
			activeHead = "card" + (i+1) + "h";
	}
	var ele = document.getElementById(id);
	if(ele)
	{
		ele.style.display = "inline";		
		ele.parentNode.style.border = "1px solid #909090";
		ele.parentNode.style.borderLeft = "1px solid #909089"; 
		ele.parentNode.style.borderRight = "1px solid #909090";
	}
	var head = document.getElementById(activeHead);
	if(head)
	{
		head.style.backgroundColor = "#dfdfdf";
		head.style.border = "1px solid #909090";
		head.style.borderBottomColor = "#ffffff";
	}
	for(var i=0; i<cards.length; i++)
	{
		var headid="card" + (i+1) + "h";
		if(headid != activeHead)
		{
			var head = document.getElementById(headid);
			head.style.borderBottomColor = "#909089";		 
			head.style.backgroundColor = "";	 
		}
	}
}
*/
function showCard(id)
{
	var activeCard=id;
	var activeHead="";
	for(var i=0; i<cards.length; i++)
	{
		var headid="card" + (i+1) + "h";
		var card = document.getElementById(cards[i]);
		var head = document.getElementById(headid);
		if(cards[i] == activeCard)
		{
			if(card)
			{
				card.style.display = "inline";		
				card.parentNode.style.border = "1px solid #909090";
				card.parentNode.style.borderLeft = "1px solid #909089"; 
				card.parentNode.style.borderRight = "1px solid #909090";
			}
			if(head)
			{
				head.style.backgroundColor = "#dfdfdf";
				head.style.border = "1px solid #909090";
				head.style.borderBottomColor = "#ffffff";
			}
		}
		else
		{
			if(card)
				card.style.display = "none";
			if(head)
			{
				head.style.border = "1px solid #b0b0bf";
				head.style.borderBottom = "1px solid #909090";
				head.style.borderBottomColor = "#909089";		 
				head.style.backgroundColor = "";	
				var div = getChildByTag(head,"div");
				if(div)
				{
					div.style.opacity = 0.3;
					var h = getChildByTag(div, "h2");
					if(h)
						h.style.opacity = 1;
				}
			}
		}
	}
}
function showCardEvent(id)
{
	var activeCard=id;
	var activeHead="";
	for(var i=0; i<cards.length; i++)
	{
		var headid="card" + (i+1) + "h";
		var card = document.getElementById(cards[i]);
		var head = document.getElementById(headid);
		if(cards[i] == activeCard)
		{
			if(card)
			{
				card.style.display = "inline";	
			}
			if(head)
			{
//				head.style.backgroundColor = "#dfdfdf";
           head.style.color = "#000000";
           head.style.fontWeight = "bold";
//			   head.style.zIndex = "20";
			}
		}
		else
		{
			if(card)
				card.style.display = "none";
			if(head)
			{
           head.style.color = "#777777";
           head.style.fontWeight = "normal";
				var div = getChildByTag(head,"div");
				if(div)
				{
					div.style.opacity = 0.3;
					var h = getChildByTag(div, "h2");
					if(h)
						h.style.opacity = 1;
				}
			}
		}
	}
}
function showCardVertical(id)
{
	var activeCard=id;
	var activeHead="";
	for(var i=0; i<cards.length; i++)
	{
		var headid="card" + (i+1) + "h";
		var card = document.getElementById(cards[i]);
		var head = document.getElementById(headid);
		if(cards[i] == activeCard)
		{
			if(card)
			{
				card.style.display = "inline";	
//				card.parentNode.style.border = "1px solid #909090";
//				card.parentNode.style.borderLeft = "1px solid #dfdfdf"; 
//				card.parentNode.style.borderTop = "1px solid #909090";
			}
			if(head)
			{
				head.style.backgroundColor = "#dfdfdf";
				head.style.border = "1px solid #909090";
				head.style.borderRightColor = "#dfdfdf";
           head.style.zIndex = "20";
			}
		}
		else
		{
			if(card)
				card.style.display = "none";
			if(head)
			{
				head.style.border = "1px solid #b0b0bf";
				head.style.borderRight = "1px solid #909090";
				head.style.borderRightColor = "#909089";		 
				head.style.backgroundColor = "";	
           head.style.zIndex = "0";
				var div = getChildByTag(head,"div");
				if(div)
				{
					div.style.opacity = 0.3;
					var h = getChildByTag(div, "h2");
					if(h)
						h.style.opacity = 1;
				}
			}
		}
	}
}
function getChildByTag(obj, tag)
{
	if(obj.hasChildNodes())
	{
		var childs = obj.childNodes;
		for(var i=0; i<childs.length;i++)
		{
			if(tag.toLowerCase() == childs[i].nodeName.toLowerCase())
				return(childs[i]);
		}
	}
	return(null);
}
function hide()
{
  setTimeout("hideAll()", 2000);
  activeSubmenu="";
}
function hideAll()
{
  if(activeSubmenu=="")
		if(mainMenu)
			mainMenu.src = "/icons/ecblank.gif";
  for(var i=0; i<ids.length;i++)
  {
    if(ids[i] != activeSubmenu)
    {
      var element = document.getElementById(ids[i]);
      if(element)
        element.style.display = "none";
    }
  }
}
var scrollSpeed=0;
var lstPos=-1;
var isTop = true;
var scrollTimer=null;
function showTop()
{
	return;
  if(!isTop)
  {
    lstPos=0;
    scrollSpeed=-10;
    if(scrollTimer) clearTimeout(scrollTimer);
    scroll();
    isTop=true;
  }
}
function showBottom()
{
	return;
  if(isTop)
  {
    lstPos=300;
    scrollSpeed=10;
    if(scrollTimer) clearTimeout(scrollTimer);
    scroll();
    isTop=false;
  }
}
function scroll()
{
  var curPos=0;
  if(window.pageYOffset)
  {
    curPos=window.pageYOffset;
  }
  else if(document.body && document.body.scrollTop)
  {
    curPos=document.body.scrollTop;
  }
  if(curPos!=lstPos && ((curPos<300 && scrollSpeed>0)||(curPos>0 && scrollSpeed<0)))
  {
    lstPos=curPos;
    window.scrollBy(0, scrollSpeed);
    scrollTimer=setTimeout("scroll()", 10);
  }
}
function fadeInOut(fadeInID,fadeOutID)
{
	if (fadeInID == fadeOutID)
	{
		alert ('Sie muessen die IDs zweier unterschiedlicher HTML-Elemente angeben!');
		return;
	}
	var fadeIn = document.getElementById (fadeInID);
	var fadeOut = document.getElementById (fadeOutID);
	if(fadeIn.style.display="none")
	{
		if(!fadeIn.filters)			// Not IE
		{
			fadeIn.style.opacity=0;
			fadeOut.style.opacity=1;
			fadeIn.style.display="inline";
			fadeOut.style.display="inline";
		}
		else
		{
			fadeIn.style.filter="Alpha(opacity=0)";
			fadeOut.style.filter="Alpha(opacity=100)";
			fadeIn.style.display="inline";
			fadeOut.style.display="inline";
		}
	}
	fade(fadeInID, fadeOutID);
}
function fade(fadeInID, fadeOutID)
{
	if(fadeInID == fadeOutID)
		return;
	var fadeIn = document.getElementById (fadeInID);
	var fadeOut = document.getElementById (fadeOutID);
	if(!fadeIn.filters)
	{
		opacity1 = parseFloat (fadeOut.style.opacity);
		opacity2 = parseFloat (fadeIn.style.opacity);
		opacity1 -= 0.05;
		opacity2 += 0.05;
		fadeOut.style.opacity = opacity1;
		fadeIn.style.opacity = opacity2;
	}
	else
	{
		opacity1 = parseFloat (fadeOut.filters.alpha.opacity);
		opacity2 = parseFloat (fadeIn.filters.alpha.opacity);
		opacity1 -= 5;
		opacity2 += 5;
		fadeOut.filters.alpha.opacity = opacity1;
		fadeIn.filters.alpha.opacity = opacity2;
	}
	if(opacity1 > 0)
		setTimeout("fade('"+fadeInID+"','"+fadeOutID+"')", 10);
}
// IntToHex: konvertiere integer zwischen 0-255 in 2 stellige hex strings.
function IntToHex(n)
{
	var result = n.toString(16);
	if (result.length==1) result = "0"+result;
	return result;
}
// HexToInt: konvertiere 2 stellige hex strings in integer.
function HexToInt(hex)
{
	return parseInt(hex, 16);
}

