/* -----------------------------------------------------------------------
//////////////////////////////////////////////////////////////////////////

dhtml submenue

autor		:	wendenburgj@sixt.de
firma		:	e-Sixt
erstellt	:	20.07.2001 / Basis sub.js 02.2001

benoetigt lib_neu.js

geaendert
wann		:	24.07
was			:	Css und Div per Php in subnavi.php3 schreiben, entsprechendes js auskommentiert
wer			:	JW

wann		:	19.09
was			:	Abfrage typeof subNavi in init
wer			:	JW

/////////////////////////////////////////////////////////////////////////
----------------------------------------------------------------------- */

var bgN     	=   "#ffffff";  									// Link Hintergrundfarbe normal
var bgH     	=   "#ff6600";  									// Link Hintergrundfarbe high
// bga und txtClass zusaetzlich in subnavi.php3 stzen
var bgA     	=   "#ffffff";  									// Link Rahmenfarbe 
var txtClass	=	"bcmini";										// Link Textklasse

var step    	=   40;         									// Bewegungsintervall Animation
var posCnt		=	0;												// counter Position
var subCnt		=	0;												// counter subLinks
var animPos		=	new Array();									// positionen speicher fuer glattere Animation		

var bgC 		= 	nc? 'bgColor' : 'backgroundColor';
var isLoad 		=   false;


//var styleBg		=	' \{position:absolute;top:-14px;left:0px;width:137px;height:14px;layer-background-color:' + bgA + ';background-color:' + bgA + ';border:none;font-size:8pt;clip:rect(0 137 14 0);\}';
//var styleTxt		=	' \{position:absolute;top:-14px;left:0px;width:126px;height:12px;font-size:8pt;clip:rect(0 126 12 0);\}';


function makeSub(){
	this.id							=	new Array();
	this.nam						=	new Array();	
	this.url						=	new Array();	
	// this.target					=	new Array();
	this.pos						=	new Array();		
	this.cntPos						=	refPos;
	this.addLink					=	addLink;
	// this.makeCss					=	makeCss;
	// this.makeDiv					=	makeDiv;	
	this.setCol						=	setCol;
	this.subAnim					=	subAnim;
}

// links hinzufuegen
function addLink(id, nam, url,target) {
	this.id[this.id.length]			=	id;
	this.url[id]					=	url;
	this.nam[id]					=	nam;
	// this.target[id]				=	(target != "")? target : "content";	
	this.pos[id]					=	this.cntPos;
	this.cntPos						+=	distN;
	for(var i in space) this.cntPos	+=	(space[i] == (this.id.length - 1))? distS : 0;
}

/*
// css schreiben
function makeCss() {
	var cssBg	=	"";
	var cssTxt	=	"";
	for(var i in this.id){
		cssBg	+=	"#" + this.id[i] + "Bg"		+ ((i < (this.id.length - 1))? "," : "");
		cssTxt	+=	"#" + this.id[i] + "Txt"	+ ((i < (this.id.length - 1))? "," : "");	
	}		
	cssBg	+=	styleBg;
	cssTxt	+=	styleTxt;
	return (cssBg + cssTxt);
}

// alle divlayer schreiben
function makeDiv(){
	var divBg	=	"";
	var divTxt	=	"";
	for(var i in this.id){
		var mOver	=	"onmouseover=\"subNavi.setCol('" + this.id[i] + "', 1, 'akt')\" onmouseout=\"subNavi.setCol('" + this.id[i] + "', 0, 'akt')\"";   
		var aTag	=	"<a " + mOver + " class='" + txtClass + "' href='" + this.url[this.id[i]] + "' target='" + this.target[this.id[i]] + "'>";		
		divBg		+=	"<div id='" + this.id[i] + "Bg'></div>\n";
		divTxt		+=	"<div id='" + this.id[i] + "Txt'>" + aTag + "&nbsp;&nbsp;" + this.nam[this.id[i]] + "</a></div>\n";	
	}	
	return (divBg + divTxt);
}
*/

// Animation
function subAnim()
{
	if (animPos[posCnt] < this.pos[this.id[subCnt]])
	{
		dRefS(this.id[subCnt] + "Bg").top	=	animPos[posCnt];
		dRefS(this.id[subCnt] + "Txt").top	=	animPos[posCnt] + 1;
		posCnt++;
	}
	else 
	{
		dRefS(this.id[subCnt] + "Bg").top	=	this.pos[this.id[subCnt]];
		dRefS(this.id[subCnt] + "Txt").top	=	this.pos[this.id[subCnt]] + 1; // +1 position der buttons in rahmen
		posCnt	=	0;	
		subCnt++;
	}	
	if(subCnt < (this.id.length)) animRun	=	setTimeout('subNavi.subAnim()',10);
	// statussetzen kann erfolgen
	else isLoad = true;
}


function setCol(id, lev, stat) {
	if(lev == 1) dRefS(stat + "Stat").top		=	this.pos[id] + 1;	
    dRefS(stat + "Stat").visibility    			=	(lev == 1)? "visible" : "hidden";
	if(stat	== "set" || id != subAreaState) {
		dRefS(id + "Txt")[bgC]					=	(lev == 1)? bgH : bgN;
	}
}

// Status setzen, wird nur gerufen, falls isLoad = true
function setState(stat){
    // Linien?
//    var isLine = !!(top.content && typeof top.content.line != "undefined");
    if(subAreaState != "default")	subNavi.setCol(subAreaState, 0,"set");
   	if(stat != "default")			subNavi.setCol(stat, 1,"set");

//    dRefS('linie').visibility = isLine? "visible" : "hidden";
    subAreaState = stat;
}

function init()
{
	// besitzt diese Seite Links?
	if(typeof subNavi != "undefined")
	{
		// speichert positionen der animation in animPos
		for(var j = -14; j < subNavi.cntPos + step; j += step)	animPos[animPos.length]				=	j;
		// setzt Hintergrundfarbe der Links auf Norm
		for(var i in subNavi.id)								dRefS(subNavi.id[i] + "Txt")[bgC]	=	bgN;
		subNavi.id.reverse();
		subNavi.subAnim();
	}
	// sonst gleich statussetzen
	else isLoad	=	true;
}

/* ------------------------------------------------------------------------
/////////////////// Schriftgroesse fuer IEs am Mac ////////////////////////
------------------------------------------------------------------------ */
function ie_mac(){
    if(mac && !(nc || nc6)){
        for(var i = 0; i < document.links.length; i++) {
            if(document.links[i].style) document.links[i].style.fontSize = ie4? "9pt" : "7pt";
        }
    }
}