//Edit
//HauptMenu
var mainLinks=new Array("Company","Range","Retailer Index", "Retail Section","B2B-Webshop" );
var mainLinksUrl=new Array("/english/unternehmen/ueberuns.htm","/english/kollektionen/uebersicht.htm","/english/bezugsquellen/default.htm","/english/haendler/default.htm","http://www.maryanbeachwear-webshop.de");
var mainColors=new Array("009900","3366cc","99cccc","cc0066","f38f35");
var mainLinksWidth=new Array("85","67","109","107","110");

var subMenu=new Array();
var subLinks=new Array();

//Unterpunkte
subMenu[0]=new Array("About us","News","Career","Contact us", "Credits");
subMenu[1]=new Array("At a Glance","MARYAN MEHLHORN","Lidea","Charmline","Charmline Bodycontrol","Watercult","Watercult Men");


//,"Qualitäts-Merkmale","Bezugsquellen"

//URLs der Unterpunkte
subLinks[0]=new Array("/english/unternehmen/ueberuns.htm","/english/unternehmen/aktuelles.htm","/english/unternehmen/stellenangebote.htm","/english/kontakt/kontakt.htm","/english/unternehmen/impressum.htm");
subLinks[1]=new Array("/english/kollektionen/uebersicht.htm","/english/kollektionen/aquaart.htm","/english/kollektionen/lidea.htm","/english/kollektionen/charmline.htm","/english/kollektionen/bodycontrol.htm","/english/kollektionen/watercult.htm","/english/kollektionen/watercult_men.htm","#","#");

//,"/kollektionen/qm.htm","/kollektionen/bezugsquellen.htm"

//Declare
var mainX=new Array();
var naviY;
var subsHeight=new Array();
var subsWidth=new Array();
var currHigh;
var anyOn=false;
var currentSub=-1;
var subsCoords=new Array();

//aktive-Grafiken
var whiteQuad=new Image();
whiteQuad.src="/images/nav_aktiv.gif";
var transQuad=new Image();
transQuad.src="/images/trans.gif";

//write
document.write('<style type="text/css">');

for(i=0;i<mainLinks.length;i++){

        document.write('#main'+i+'{position: absolute; left: 1px; top: 1px; width: '+mainLinksWidth[i]+'px; height: 16px; visibility: hidden; background-color: #'+mainColors[i]+'; z-index: 5}');
        document.write('#subs'+i+'{position: absolute; left: 1px; top: 1px; width: 100px; height: 16px; visibility: hidden; z-index: 6}');
}

document.write('</style>');

//init
function init(){
//alert("inside init(), msie: "+msie+", NN: "+net+", FF:"+FF);
        //get Positions
        //Startbedingungen
        if(msie){

                rahmenX=document.all.outerIE.offsetLeft;
                rahmenY=document.all.outerIE.offsetTop;
                
				mainTableX=document.all.mainTable.offsetLeft;
                naviY=rahmenY+532;

				//alert("IE: rahmenX"+rahmenX+", rahmenY"+rahmenY+", mainTableX: "+mainTableX+", naviY: "+naviY);

                for(i=0;i<mainLinks.length+1;i++){
						
						//alert(parseInt(getLayerWidth("main"+i+"IE")));
						
                        posRef=eval("document.all.main"+i+"IE");
                        mainX[i]=rahmenX+mainTableX+posRef.offsetLeft+1;
                        if(i<mainLinks.length) {
							pushTo("main"+i,mainX[i],rahmenY+532);
						}
                        if(i==loadMain)show("main"+i);
                }
			        //Unterpunkte positionieren
			for(i=0;i<2;i++){
				subsHeight[i]=parseInt(getLayerHeight("subs"+i));
				//alert("subsHeight["+i+"]: "+subsHeight[i]);
				subsWidth[i]=getLayerWidth("subs"+i);
				nY=naviY-subsHeight[i];
				
				//alert("subsHeight["+i+"]: "+subsHeight[i]+"subsWidth["+i+"]: "+subsWidth[i]+"nY: "+nY);
				
				pushTo("subs"+i,mainX[i]-1,nY);
				subsCoords[i]=new Array(mainX[i],mainX[i]+subsWidth[i],naviY-subsHeight[i],naviY);
			}
        }
        if(net){
			rahmenX=document.outerNN.x;
			rahmenY=document.outerNN.y;
			naviY=rahmenY+532;

			for(i=0;i<mainLinks.length+1;i++){

					posRef=eval("document.main"+i+"NN");
					mainX[i]=rahmenX+posRef.x+1;
					if(i<mainLinks.length)pushTo("main"+i,mainX[i],rahmenY+532);
					if(i==loadMain)show("main"+i);
			}
			//Unterpunkte positionieren
			for(i=0;i<2;i++){
	
					subsHeight[i]=parseInt(getLayerHeight("subs"+i));
					subsWidth[i]=getLayerWidth("subs"+i);
					nY=naviY-subsHeight[i];
					
					//alert("subsHeight["+i+"]: "+subsHeight[i]+"subsWidth["+i+"]: "+subsWidth[i]+"nY: "+nY);
					
					pushTo("subs"+i,mainX[i]-1,nY);
					subsCoords[i]=new Array(mainX[i],mainX[i]+subsWidth[i],naviY-subsHeight[i],naviY);
			}
        }
		
		
		if(FF) {
			//rahmenX = document.getElementById("outerIE").left;
			//rahmenY = document.getElementById("outerIE").top;
			rahmenX=document.getElementById("outerIE").offsetLeft;
			//rahmenX=document.all.outerIE.offsetLeft;
			rahmenY=document.getElementById("outerIE").offsetTop;
			//rahmenY=document.all.outerIE.offsetTop;
		
			naviY=rahmenY+532;
			mainTableX=document.getElementById("mainTable").offsetLeft;
			//mainTableX=document.all.mainTable.offsetLeft;
			
			//alert("FF: rahmenX"+rahmenX+", rahmenY"+rahmenY+", mainTableX: "+mainTableX+", naviY: "+naviY);
			
			for(i=0;i<mainLinks.length+1;i++){
				//posRef=eval("document.all.main"+i+"IE");
				//mainX[i]=rahmenX+mainTableX+posRef.offsetLeft+1;
				
				mainX[i]=rahmenX+mainTableX+document.getElementById("main"+i+"IE").offsetLeft+1;
				
				//alert("mainX["+i+"]: "+mainX[i]);
				
				if(i<mainLinks.length) {
					pushTo("main"+i,mainX[i],rahmenY+532);
				}
				if(i==loadMain) {
					show("main"+i);
				}
			}
			
			//Unterpunkte positionieren
			for(i=0;i<2;i++){
					//subsHeight[i]=parseInt(getLayerHeight("subs"+i));
					subsHeight[i]=subMenu[i].length*16-5-i;
					//alert("subMenu.length: "+subMenu[i].length+", subsHeight["+i+"]: "+subsHeight[i]);
					subsWidth[i]=getLayerWidth("subs"+i);
					nY=naviY-subsHeight[i];
					
					//alert("subsHeight["+i+"]: "+subsHeight[i]+"subsWidth["+i+"]: "+subsWidth[i]+"nY: "+nY);
					
					pushTo("subs"+i,mainX[i]-1,nY);
					subsCoords[i]=new Array(mainX[i],mainX[i]+subsWidth[i],naviY-subsHeight[i],naviY);
			}
		}

		if(OP) {
			//rahmenX = document.getElementById("outerIE").left;
			//rahmenY = document.getElementById("outerIE").top;
			rahmenX=document.getElementById("outerIE").offsetLeft;
			//rahmenX=document.all.outerIE.offsetLeft;
			rahmenY=document.getElementById("outerIE").offsetTop;
			//rahmenY=document.all.outerIE.offsetTop;
		
			naviY=rahmenY+532;
			mainTableX=document.getElementById("mainTable").offsetLeft;
			//mainTableX=document.all.mainTable.offsetLeft;
			
			//alert("FF: rahmenX"+rahmenX+", rahmenY"+rahmenY+", mainTableX: "+mainTableX+", naviY: "+naviY);
			
			for(i=0;i<mainLinks.length+1;i++){
				//posRef=eval("document.all.main"+i+"IE");
				//mainX[i]=rahmenX+mainTableX+posRef.offsetLeft+1;
				
				mainX[i]=rahmenX+mainTableX+document.getElementById("main"+i+"IE").offsetLeft+1;
				
				//alert("mainX["+i+"]: "+mainX[i]);
				
				if(i<mainLinks.length) {
					pushTo("main"+i,mainX[i],rahmenY+532);
				}
				if(i==loadMain) {
					show("main"+i);
				}
			}
			
			//Unterpunkte positionieren
			for(i=0;i<2;i++){
					//subsHeight[i]=parseInt(getLayerHeight("subs"+i));
					subsHeight[i]=subMenu[i].length*16-5-(i*2);
					//alert("subMenu.length: "+subMenu[i].length+", subsHeight["+i+"]: "+subsHeight[i]);
					subsWidth[i]=getLayerWidth("subs"+i);
					nY=naviY-subsHeight[i];
					
					//alert("subsHeight["+i+"]: "+subsHeight[i]+"subsWidth["+i+"]: "+subsWidth[i]+"nY: "+nY);
					
					pushTo("subs"+i,mainX[i]-1,nY+6);
					subsCoords[i]=new Array(mainX[i],mainX[i]+subsWidth[i],naviY-subsHeight[i],naviY);
			}
		}
		
		//Mousemove ab jetzt
        MMReady();

}

//Navigation durch Mousemovekoordinaten steuern
function menu(e){

        if(msie){

                xW=window.event.clientX;
                yW=window.event.clientY;
        }

        if(net){

                xW=e.pageX;
                yW=e.pageY;
        }

		if(FF){
			xW=e.clientX;
			yW=e.clientY;
        }
		
		if(OP){
			xW=e.clientX;
			yW=e.clientY;
        }

        if(xW>mainX[0]&&xW<mainX[1]&&yW>naviY&&yW<naviY+16){
                show("main0");
                show("subs0");
                hide("subs1");
                if(loadMain!=1)hide("main1");
        }
        if(xW<subsCoords[0][0]||xW>subsCoords[0][1]||yW<subsCoords[0][2]||yW>subsCoords[0][3]+16){
                if(loadMain!=0)hide("main0");
                hide("subs0");
        }
        if(xW>mainX[1]&&xW<mainX[2]&&yW>naviY&&yW<naviY+16){
                show("main1");
                show("subs1");
                hide("subs0");
                if(loadMain!=0)hide("main0");
        }
        if(xW<subsCoords[1][0]||xW>subsCoords[1][1]||yW<subsCoords[1][2]||yW>subsCoords[1][3]+16){
                if(loadMain!=1)hide("main1");
                hide("subs1");
        }
        if(xW>mainX[2]&&xW<mainX[3]&&yW>naviY&&yW<naviY+16){
                show("main2");
                hide("subs1");
                if(loadMain!=1)hide("main1");
        }
        else if(loadMain!=2)hide("main2");

        if(xW>mainX[3]&&xW<mainX[4]&&yW>naviY&&yW<naviY+16){
                show("main3");
        }
        else if(loadMain!=3)hide("main3");
		
		if(xW>mainX[4]&&xW<mainX[5]&&yW>naviY&&yW<naviY+16){
                show("main4");
        }
        else if(loadMain!=4)hide("main4");
}

//Mousemove-Events einfangen
function MMReady(){

        if(net){

                window.captureEvents(Event.MOUSEMOVE);
                window.onmousemove=menu;

        }
        document.onmousemove=menu;
}


function highlightActive(im){

        if(msie){
			if(!anyOn){
				highRef=eval("document.all.active"+im.substr(2,2));
				highRef.src=whiteQuad.src;
				currHigh=im.substr(2,2);
				anyOn=true;
			}
			else highlightPassive();
        }
        if(net){
			if(!anyOn){
				highRef=eval('document.active'+im.substr(2,2));
				//teststr="document.layers['subs"+im.substr(2,1)+"'].document.active"+im.substr(2,2);
				highRef.src=whiteQuad.src;
				currHigh=im.substr(2,2);
				anyOn=true;
			}
			else highlightPassive();
        }
		if(FF){
			if(!anyOn){
				currHigh=im.substr(2,2);
				document.getElementById("active"+currHigh).src = whiteQuad.src;
				anyOn=true;
			}
			else highlightPassive();
        }
		if(OP){
			if(!anyOn){
				currHigh=im.substr(2,2);
				document.getElementById("active"+currHigh).src = whiteQuad.src;
				anyOn=true;
			}
			else highlightPassive();
        }
}

function highlightPassive(){

        if(msie){
                highRef=eval("document.all.active"+currHigh);
                highRef.src="/images/trans.gif";
                anyOn=false;
        }
        if(net){
                highRef=eval("document.active"+currHigh);
                highRef.src="/images/trans.gif";
                anyOn=false;
        }
		if(FF){
                highRef=eval("document.active"+currHigh);
                highRef.src="/images/trans.gif";
                anyOn=false;
        }
		if(OP){
                highRef=eval("document.active"+currHigh);
                highRef.src="/images/trans.gif";
                anyOn=false;
        }
}

if(net){
	window.captureEvents(Event.RESIZE);
}
window.onresize=handleRESIZE;

function handleRESIZE(){

        if(msie){
                init();
                clipLeft=0;
                clipRight=307;
                if(koll)initKoll();
                if(contentScroll){

                        clipBottom=contentHeight;
                        oben=false;
                        unten=false;
                        dY;
                        clipTop=0;
                        initScroll();
                }
                if(self.location.href.indexOf("kontakt/kontakt.htm")!=-1)initForm();
                if(self.location.href.indexOf("bezugsquellen/default.htm")!=-1)initScroll();
                if(self.location.href.indexOf("/isapi/bezugsquellen/suche.asp")!=-1)initScroll();
        }
        if(net){
                self.location.reload();
        }
		if(FF){
                init();
                clipLeft=0;
                clipRight=307;
                if(koll)initKoll();
                if(contentScroll){
                        clipBottom=contentHeight;
                        oben=false;
                        unten=false;
                        dY;
                        clipTop=0;
                        initScroll();
                }
                if(self.location.href.indexOf("kontakt/kontakt.htm")!=-1)initForm();
                if(self.location.href.indexOf("bezugsquellen/default.htm")!=-1)initScroll();
                if(self.location.href.indexOf("/isapi/bezugsquellen/suche.asp")!=-1)initScroll();
        }
		if(OP){
                init();
                clipLeft=0;
                clipRight=307;
                if(koll)initKoll();
                if(contentScroll){
                        clipBottom=contentHeight;
                        oben=false;
                        unten=false;
                        dY;
                        clipTop=0;
                        initScroll();
                }
                if(self.location.href.indexOf("kontakt/kontakt.htm")!=-1)initForm();
                if(self.location.href.indexOf("bezugsquellen/default.htm")!=-1)initScroll();
                if(self.location.href.indexOf("/isapi/bezugsquellen/suche.asp")!=-1)initScroll();
        }
}