/**************************** Glossar anlegen/pflegen START ******************************/

// Neues Array-Objekt erzeugen
var MenuItemList = new Array(); 

// Setzen der Objekt Attribute
function MenuItem(Category, Position, Title){
	this.Category = Category;
	this.Position = Position;
	this.Title = Title;
	this.HighlightStyle = "#899FB5";
	this.LowlightStyle = "#D2DAE3";
	this.Clicked = false;
	MenuItemList[MenuItemList.length]=this;
} 

// Anlegen neuer Listenpunkte
var objMenuItem = new MenuItem("ABC", 1, "ABS");  
	objMenuItem = new MenuItem("ABC", 2, "Airbags");
	objMenuItem = new MenuItem("ABC", 3, "Air conditioning");
	objMenuItem = new MenuItem("ABC", 4, "All-wheel drive");
	objMenuItem = new MenuItem("ABC", 5, "ASR");
	objMenuItem = new MenuItem("ABC", 6, "BAS");
	objMenuItem = new MenuItem("ABC", 7, "Body");
	objMenuItem = new MenuItem("ABC", 8, "CARGO");
	objMenuItem = new MenuItem("ABC", 9, "COMAND");

	objMenuItem = new MenuItem("DEF", 1, "Disc brakes");
	objMenuItem = new MenuItem("DEF", 2, "Driving safety systems");
	objMenuItem = new MenuItem("DEF", 3, "EBD");
	objMenuItem = new MenuItem("DEF", 4, "Equipment packages");
	objMenuItem = new MenuItem("DEF", 5, "Ergonomics"); 
	objMenuItem = new MenuItem("DEF", 6, "ESP");	
	objMenuItem = new MenuItem("DEF", 7, "Exterior mirrors");
		
	objMenuItem = new MenuItem("GHI", 1, "Headlamp Assist");
	
	objMenuItem = new MenuItem("JKL", 1, "Lighting");
	objMenuItem = new MenuItem("JKL", 2, "Load restraint");
		
	objMenuItem = new MenuItem("MNO", 1, "Multifunction steering wheel");
	
	objMenuItem = new MenuItem("PQR", 1, "PARKTRONIC");
	objMenuItem = new MenuItem("PQR", 2, "Partitions");
	objMenuItem = new MenuItem("PQR", 3, "Restraining aids");
	
	objMenuItem = new MenuItem("STU", 1, "Safety grilles");
	objMenuItem = new MenuItem("STU", 2, "Safety steering column");
	objMenuItem = new MenuItem("STU", 3, "Safety systems");
	objMenuItem = new MenuItem("STU", 4, "Seat belts");
	objMenuItem = new MenuItem("STU", 5, "Seats");
	objMenuItem = new MenuItem("STU", 6, "Sidebags");
	objMenuItem = new MenuItem("STU", 7, "Tie-down systems");
	objMenuItem = new MenuItem("STU", 8, "Thorax-Sidebags");
	objMenuItem = new MenuItem("STU", 9, "TOP LOAD");
	objMenuItem = new MenuItem("STU", 10, "Trade solutions");
		
	objMenuItem = new MenuItem("VWXYZ", 1, "Windowbags");


// Ausgabe der Glossar Liste/n
function PrintGlossarList(Category){

var Counter = 1;

	for(i=0;i<MenuItemList.length;i++)
	{	
		if (Category == MenuItemList[i].Category)
		{
			document.write('<tr bgcolor="#D2DAE3" id="nav' + MenuItemList[i].Position + '">');
			document.write('<td class="ContentBlack">&nbsp;<a id="anav' + MenuItemList[i].Position + '" href="#" onClick="ItemClicked(this,\'nav' + MenuItemList[i].Position + '\', '+ i +');changeContainer(\'PKT' + MenuItemList[i].Position + '\');" onMouseOver="chgSt(this,1,\'nav' + MenuItemList[i].Position + '\', '+ i +');" onMouseOut="chgSt(this,0,\'nav' + MenuItemList[i].Position + '\', '+ i +');" class="GlossarList">' + MenuItemList[i].Title + '</a></td>');
			document.write('</tr>');
			
			if (Counter == 1){
				MenuItemList[i].Clicked = true;
				chgSt(document.getElementById("anav" + MenuItemList[i].Position), 1, 'nav' + MenuItemList[i].Position, i);
			}
			
			Counter++;
			
		}
	}

}

// Prüfen ob ein Listenpunkt geklickt ist
function ItemClicked(lnk,elem, k){
	for(i=0;i<MenuItemList.length;i++)
	{	
		if (i==k)
		{
		    MenuItemList[i].Clicked = true;
			chgSt(lnk, 1, elem, i);
		}
		else
		{
			MenuItemList[i].Clicked = false;
			chgSt(lnk, 0, elem, i);
		}
	}
}

// Hintergrundfarbe ändern bei OnMouseOver und fixieren bei OnClick
function chgSt(lnk, mode, elem, i) {

	if (!MenuItemList[i].Clicked)
	{
		if (document.getElementById) {
			if (mode == 0) {
				document.getElementById(elem).style.backgroundColor = "#D2DAE3";
			} 
			else if (mode == 1) {
				document.getElementById(elem).style.backgroundColor = "#E0E5EB";
			}		
		}
	}
	else
	{
		for(i=0;i<MenuItemList.length;i++)
		{
			if(document.getElementById('nav' + i) != null)
			{
				document.getElementById('nav' + i).style.backgroundColor = "#D2DAE3";
			}
		}
		
		document.getElementById(elem).style.backgroundColor = "#E0E5EB";
	}
}

/******************** Glossar anlegen/pflegen ENDE ***************************/


/******************** Scrollfunktion START ***************************/
var dom = document.getElementById;
var iex = document.all;
var ns4 = document.layers;

container = "ContentPKT1";
present = "TextPKT1";

//Tempo festlegen fuer Scrollfunktion
if (dom) speed = 1
if (iex) speed = 1
if (ns4) speed = 1

onResize = loadAgain;

function loadAgain() {
	if (ns4) 
		self.location.reload();
}

// Initialisieren der Scrollcontainer und -inhalte
function getElement(name,nest){
	nest = nest ? "document."+nest+"." : "";
	var el = dom ? document.getElementById(name) : iex ? document.all[name] : ns4 ? eval(nest+"document."+name) : false;
	el.css = ns4 ? el : el.style;
	el.hideVis = function(){el.css.visibility="hidden"};
	el.showVis = function(){el.css.visibility="visible"};
	el.getTop = function(){return parseInt(el.css.top) || 0};
	el.setTop = function(y){el.css.top = ns4 ? y: y+"px"};
	el.getHeight = function(){return ns4 ? el.document.height : el.offsetHeight};
	el.getClipHeight = function(){return ns4 ? el.clip.height : el.offsetHeight};
	return el;
}

var layer = "";

function scrollInit() {
	if(dom) { 
		 layer = document.getElementById("ContentPKT1").getElementsByTagName("div");
		 layer["TextPKT1"].style.visibility = "visible";
		 layer["TextPKT1"].style.top = 0;
	 }
 	 else if(iex) {
		 document.all["TextPKT1"].style.visibility = "visible";
		 document.all["TextPKT1"].style.top = 0;
	 }
	 else if(ns4) {
		 layer = "document['ContentPKT1'].document";
		 eval(layer + "['TextPKT1']" + '.visibility = "visible"');
		 eval(layer + "['TextPKT1']" + '.top = 0');
	 }
	 
	 upObj = getElement("up"); // Reference to the up arrow div
	 downObj = getElement("down"); // Reference to the down arrow div
	 	 
	 contentObj = getElement("TextPKT1","ContentPKT1");
	 contentHeight = contentObj.getHeight(); // Height of the content div
	 ContentPKT1Obj = getElement("ContentPKT1"); // Reference to the content mask div
 	 ContentPKT1Height = ContentPKT1Obj.getClipHeight();// Height of the div that masks the content div
	 
	 if(contentHeight<=ContentPKT1Height){
		upObj.hideVis();
		downObj.hideVis();
	}else{
		upObj.showVis();
		downObj.showVis();
	} 
}

// Wechsel des Scrollbereiches
function changeContainer(contbox) {
	if(dom) { 
		 layer[present].style.visibility = "hidden";
		 layer = document.getElementById("Content"+contbox).getElementsByTagName("div");
		 layer["Text"+contbox].style.visibility = "visible";
	 }
 	 else if(iex) {
	 	 document.all[container].style.visibility = "hidden";
		 document.all[present].style.visibility = "hidden";
		 document.all["Content"+contbox].style.visibility = "visible";
		 document.all["Text"+contbox].style.visibility = "visible";
	 }
	 else if(ns4) {
	 	 layer = "document[container].document";
		 eval(layer + "[present]" + '.visibility = "hidden"');
				 
		 layer = "document['Content'+contbox].document";
		 newPresent = "Text"+contbox;
		 eval(layer + "[newPresent]" + '.visibility = "visible"');
	 } 
	 
	 upObj = getElement("up"); // Reference to the up arrow div
	 downObj = getElement("down"); // Reference to the down arrow div
	 	 
	 contentObj = getElement("Text"+contbox,"Content"+contbox);
	 contentHeight = contentObj.getHeight(); // Height of the content div
	 ContentNEWObj = getElement("Content"+contbox); // Reference to the content mask div
 	 ContentNEWHeight = ContentNEWObj.getClipHeight();// Height of the div that masks the content div
	 
	if(contentHeight<=ContentNEWHeight){
		upObj.hideVis();
		downObj.hideVis();
	}else{
		upObj.showVis();
		downObj.showVis();
	}
	 
	 container = "Content"+ contbox;
	 present = "Text"+ contbox;
}

// Die eigentliche Scrollfunktion 
function scroll(direction, speed) {
    var layertop;
    var scrollheight;
    
	if (dom) {
		 layertop = parseInt(layer[present].style.top);
		 scrollheight = (document.getElementById(container).offsetHeight - layer[present].offsetHeight);
	 }
	 else if (iex) {
		 layertop = parseInt(document.all[present].style.top);
		 scrollheight = (document.all(container).offsetHeight - document.all[present].offsetHeight);
	 }
	 else if (ns4) {
		 layertop = parseInt(document[container].document[present].top);
		 scrollheight = (document[container].clip.height - document[container].document[present].clip.height);
	 }

	 if(isNaN(layertop))
	 	layertop = -1;

	 if (direction == "down" && layertop - 1 > scrollheight) {
        if (dom)
			  layer[present].style.top = (layertop - speed) + "px";
	    else if(iex)
			  document.all[present].style.top = (layertop - speed) + "px";
	    else if(ns4) 
			  document[container].document[present].top = (layertop - speed);
	 }
	 else if (direction == "up" && layertop < -1 ) {
		if(dom)
			  layer[present].style.top = (layertop + speed) + "px";
		else if(iex)
			  document.all[present].style.top = (layertop + speed) + "px";
		else if(ns4)
			  document[container].document[present].top = (layertop + speed);
	 }

	timer = setTimeout("scroll('" + direction + "', " + speed + ")", 10);
}

function hideScrollbars(){
	if(document.getElementsByTagName){
		document.getElementsByTagName("body")[0].style.overflow = "hidden";
	}
}

function fixNetscape4(){
	if(ns4origWidth != window.innerWidth || ns4origHeight != window.innerHeight){
		window.location.reload();
	}	
}
if(document.layers){
	ns4origWidth = window.innerWidth;
	ns4origHeight = window.innerHeight;
	window.onresize = fixNetscape4;
}

// Auf MouseOut die Funktion stoppen 
function stop() {
    clearTimeout(timer);
}

window.onload = scrollInit;

/******************************************* Scrollfunktion ENDE ***********************************/