

var hmenu=new Array();
var smenu=new Array();

var totop =  h;
var toleft = w;

var AnzahlSubMenues = 4;

new hauptmenue("1", "Limousinen Service", "javascript:menu_start_s(1)", 160, 0);
new hauptmenue("2", "Events", 		  "javascript:menu_start_s(2)", 192, 0);
new hauptmenue("3", "Booking",            "javascript:menu_start_s(3)", 225, 0);
new hauptmenue("4", "Special",            "javascript:menu_start_s(4)", 256, 0);
new hauptmenue("5", "Contact",            "kontakt.php", 288, 0);

function hauptmenue(id, hname, link, pos, mode)
{	this.id  = id;
        this.hname=hname;
	this.link=link;
        this.pos = pos + totop;
        this.mode = mode;
        hdazu(this);
}



new untermenue("1",  185, 50, "Angebot", 	   "stretch_limousine.php?mid=1");
new untermenue("1",  185, 50, "Team",       "team_star_limousine.php?mid=1");
new untermenue("1",  185, 50, "Preis",          "limousinen_vermietung.php?mid=1");


new untermenue("2",  217, 30, "Nightlife Tour", "nightlife_tour.php?mid=2");
new untermenue("2",  217, 30, "Special Events",  "special_events.php?mid=2");

new untermenue("3",  249, 30, "Limousine only", "star_limousine_mieten.php?mid=3;bid=1");
new untermenue("3",  249, 30, "Complete Event", "star_limousine_mieten.php?mid=3;bid=2");


new untermenue("4",  281, 30, "Sonderfahrzeuge",      "oldtimer_limousine.php?mid=4");
new untermenue("4",  281, 30, "Partner",        "starlimousine_partner.php?mid=4");




function untermenue(id,  top, space, uname, urlm)
{  	this.id = id;
	this.top = top + totop;
	this.space = space;
   	this.uname=uname;
   	this.jumpto=urlm;
   	sdazu(this);
}

function hdazu(objekt) {  hmenu[hmenu.length]=objekt; }
function sdazu(objekt) {  smenu[smenu.length]=objekt; }



var menu_click = -1;
var menu_busy  = 0;
var menu_div   = new Array();

var menu_activ = -1;

for (var i=0; i < 20; i++){ menu_div[i] = 0;}

function div_start()	{ }

function menu_move_p(m)
{	toppos = parseInt(document.getElementById("m"+hmenu[m-1].id).style.top);
	toppos+= 5;
  
 	document.getElementById("m"+hmenu[m-1].id).style.top=toppos+"px";
  
	if (m == hmenu.length) 
	{
 		toppos = parseInt(document.getElementById('b').style.height);
 		toppos += 5;
 		document.getElementById('b').style.height = toppos+"px";
	}
  
}

function menu_move_n(m)
{	toppos = parseInt(document.getElementById("m"+hmenu[m-1].id).style.top);
	toppos+= -5;
 	document.getElementById("m"+hmenu[m-1].id).style.top=toppos+"px";
  
	if (m == hmenu.length) 
	{
 		toppos = parseInt(document.getElementById('b').style.height);
 		toppos += -5;
 		document.getElementById('b').style.height = toppos+"px";
	}
}

function menu_busy_div_test()
{	menu_busy=0;
	for (var m=2; m<=hmenu.length; m++) 
	{
		if (menu_div[m]>3)  { menu_busy=1 }
		if (menu_div[m]<-3) { menu_busy=1 }
	}
}

function menu_move_div()
{  	menu_busy_div_test();
  	if (menu_busy>0)
	{	for (var m=2; m<=hmenu.length; m++) 
		{	if (menu_div[m]<-3)
			{ 
				menu_move_n(m); 
				menu_div[m]+=+5; 
			}
    			if (menu_div[m]>3) 
			{
				menu_move_p(m); 
				menu_div[m]+=-5; 
			}
		}
		setTimeout("menu_move_div()",25);
	}
}

function menu_start_s(nr)
{	var x
	for (var i=0; i<smenu.length; i++)
		if (smenu[i].id == nr) { x = smenu[i].space; }
		 
	
	menu_start(nr,x)
	
}

function menu_start(menu_click,sub_hight)
{	menu_busy_div_test();

  	if (menu_busy<1)
  	{	menu_activ=menu_click;
		for (var i=0; i<hmenu.length; i++)
		{	menu_div[i+1] = hmenu[i].pos - parseInt(document.getElementById("m"+hmenu[i].id).style.top) ;
		}
		for (var i=0; i<smenu.length; i++)
		{	document.getElementById("s"+smenu[i].id).style.visibility="hidden";
 		} 
		for (var i=0; i<hmenu.length; i++)
		{	if (menu_click<(i+1)) { menu_div[i+1]+=sub_hight }	
		}
		menu_move_div();
		for (var i=0; i<smenu.length; i++)
		{	if (menu_click==(smenu[i].id)) document.getElementById("s"+smenu[i].id).style.visibility="visible";
		} 
  	}
}

function MainLoad(ref)
{   	parent.frames[3].location.href = ref;
}

for (var i=0; i<hmenu.length; i++)
{	document.write("<div id=\"m"+hmenu[i].id+"\" class=\"mpt\"  style=\"position:absolute; z-index:2; left:"+(48+toleft)+"px; top:"+hmenu[i].pos);
	document.write("px;\"  >");
	if (hmenu[i].mode == 0) document.write("<a class=\"MnMain\" href=\""+hmenu[i].link+"\" >");
        if (hmenu[i].mode == 1) document.write("<a class=\"MnMain\" href=\""+hmenu[i].link+"\" target=\"_blank\" >");
	document.write("&nbsp&nbsp;"+hmenu[i].hname+"</a></div>");
}
	

var c	= 0;
var i 	= 0;
while (i<(smenu.length-1))
{	c = parseInt(smenu[i].id);		
	document.write("<div id=\"s"+smenu[i].id+"\" style=\"position:absolute; z-index:1; left:"+(50+toleft)+"px; top:"+smenu[i].top+"px;\"  >");		
	while (smenu[i].id == c)
	{	document.write("<a class=\"SnMain\" href=\""+smenu[i].jumpto+"\" >");
		document.write("&nbsp;&nbsp;<img src=\"img/dingarrow.gif\" border=\"0\">&nbsp;");
		document.write(smenu[i].uname);
		document.write("</a>");
	
		if (i<(smenu.length-1)) 
		{  i++; } else { break; }
	}
	document.write("</div>");
}



 
  
 

