
//	if (!top.openwindow || window.top != window)
//		location.replace("/?File=" + location.href + "&" + location.search)
		
	function openwindow(page, width, height, top, left) {
		if (typeof newwindow == 'object' ){
			if (newwindow && newwindow.open && !newwindow.closed){
				newwindow.close()
			}
		}
		if (!width) { width=600; }
		if (!height) { height=400; }
		if (!top) { top=0; }
		if (!left) { left=150; }
		newwindow = window.open(page,"","width="+width+",height="+height+",top="+top+",left="+left+",location=no,toolbar=no,directories=no,status=no,scrollbars=yes,resizable=yes,copyhistory=no,menubar=no");
		if (newwindow.focus)  {newwindow.focus();}
	}

	var currentImage = null;
	var swapImage;
	var editedParam;
	function setImage(a,b) {
//	    alert ( "A = " + a + " current = " + currentImage );
//		if (currentImage != a) {
			if (currentImage != null  )
			{
				clearImage();
			}
			currentImage = a;
			swapImage = document[currentImage].src;
//		    alert ( "2 A = " + a + " current = " + currentImage );
			changeImages(a,b);
//		swapImage = b +".gif";
//		editedParam = b+"_mo.gif";	
//		changeImages(a,editedParam);
//		}
	}
	
	function resetNavigation(layer){
		MM_showHideLayers(layer,'','hide');
		clearImage(); 
	}
	
	function clearImage () {
		if (currentImage != null ) {
			changeImages(currentImage,swapImage);
			currentImage = null;
		}
	}

	//Preload images
	function newImage(arg) {
		if (document.images) {
			rslt = new Image();
			rslt.src = arg;
			return rslt;
		}
	}

	//Swap images
	function changeImages() {
		if (document.images && (preloadFlag == true)) {
			for (var i=0; i<changeImages.arguments.length; i+=2) {
			   // alert ( changeImages.arguments[i+1] );
				document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
			}
		}
	}

var timeID;

menu0 = new Array(['home','/']);

menu1 = new Array(['Stapsgewijs zoeken','/occasions/stap1.asp'],
                  ['Uitgebreid zoeken','/occasions/main.asp'],
                  ['Zo goed als nieuw','/occasions/zgan.asp']);
                  

/*
menu2 = new Array(
				  ['Merk zoeken','/nieuweauto/main.asp'],
				  ['Uitgebreid zoeken','/nieuweauto/main.asp'],
                  ['Nieuw uit voorraad','/occasions/Main.asp?nieuw=1'],
				  ['Vergelijken','/nieuweauto/vergelijken.asp']);
*/
menu2 = new Array(
				  ['Merk zoeken','/nieuweauto/main.asp'],
				  ['Nieuw uit voorraad','/occasions/Voorraad.asp']);
                  

menu3 = new Array(/*['Zoekopdrachten','/default.asp?newpage=/MyGarage/mg_search_home.asp&currentmenu=Keuzehulp'],
			      ['---', ''],*/
			      ['Merkgarantie','/keuzehulp/Merkgaranties.asp'],
			      ['---', ''],
			      ['Verzekering','/keuzehulp/verzekering.asp'],
			      ['Financiering','/keuzehulp/financiering.asp'],
		      ['Maandlasten','javascript:openwindow("http://www.financieringsofferte.nl",600,580);'],
			      ['Omslagpunt LPG','javascript:openwindow("/keuzehulp/LPGOmslag.asp?", 600, 630);'],
			      ['Omslagpunt Diesel','javascript:openwindow("/keuzehulp/DieselOmslag.asp?", 600, 630);'],
			      ['Wegenbelasting','javascript:openwindow("/keuzehulp/wegenbelasting.asp?", 470, 450);'],
			      ['---', ''],
			      ['Nieuw of gebruikt?','/keuzehulp/NieuwOfGebruikt.asp'],
			      ['Kooptips nieuw','/keuzehulp/kooptipsnieuw.asp'],
			      ['Kooptips gebruikt','/keuzehulp/kooptipsgebruikt.asp'] /*,
			      ['---', ''],
			      ['Autonieuws','javascript:openwindow("/docs/subpage/mobilesearch.asp?currentmenu=Keuzehulp",600,530);']*/);

menu4 = new Array(['Berijder','/nieuweauto/lease.asp'],
				  ['Wagenparkbeheerder','javascript:openwindow("http://www.leaseofferte.nl/", 600, 530);']);
/*				  
menu5 = new Array(['Advertentie invoeren','/default.asp?newpage=/docs/sell/addvehicle.asp&currentmenu=Verkopen'],
			      ['---', ''],
                  ['Zoek mijn advertentie','/default.asp?newpage=/docs/usedcars/abtnumbersearch.asp&currentmenu=Verkopen'],
			      ['---', ''],
                  ['Verkooptips','/default.asp?newpage=/docs/sell/Sell_Page1.asp&currentmenu=Verkopen'],
                  ['---',''],
                  ['Zelf uw auto verkopen','/default.asp?newpage=/docs/sell/Sell_Page3.asp&currentmenu=Verkopen']);
*/

positions = new Array(255, 370, 536, 473, 600);
imageWidth = new Array(116, 104, 92, 64, 100);
tableWidth = new Array(150, 150, 140, 150, 10);


var activePixel = "";
var activeColor = "";
var hidedrop = "";


function writeMenus(){
//	for(i=0;i<5;i++){
	for(i=0;i<4;i++){
		if(i==0){activePixel="yellowpixel";activeColor="#ffffff";}
		if(i==1){activePixel="orangepixel";activeColor="#ffffff";}
		if(i==2){activePixel="greenpixel";activeColor="#ffffff";hidedrop="HideA()";}
		if(i==3){activePixel="purplepixel";activeColor="#ffffff";}
		if(i==4){activePixel="bluepixel";activeColor="#ffffff";hidedrop="HideA()";}
		writeMenu(i+1);
	}
}

function ShowA() {
//	alert(MM_findObj("TheQuickSearchFormTable"))
	MM_showHideLayers("TheQuickSearchFormTable", "", "show")
}
function HideA() {
	MM_showHideLayers("TheQuickSearchFormTable", "", "hide")
}

function writeMenu(subMenu){
	if(bw.ns4){
		document.write("<LAYER NAME='Layer" + subMenu + "' LEFT='" + positions[subMenu-1] + "' z-index='300' TOP='97' WIDTH='129' HEIGHT='20' VISIBILITY='hide' onMouseOver=\"hideLayer('cancel')\" onMouseOut=\"hideLayer('Layer" + subMenu + "')\">"); 
	}
	else {
		document.write("<DIV ID='Layer" + subMenu + "' STYLE='position:absolute; width:190px; height:0px; z-index:99; border: 1px none #000000; left: " + positions[subMenu-1] + "px; top: 24px; visibility: hidden' onMouseOver=\"hideLayer('cancel')\" onMouseOut=\"hideLayer('Layer" + subMenu + "')\">"); 
	}
	document.write("<table width='"+ tableWidth[subMenu-1] +"' border='0' cellspacing='0' cellpadding='0' onmouseOver=\""+ hidedrop +"\" onMouseOut=\"ShowA()\">");
		document.write("<tr>");
    document.write("<td><img src='images/pixeltop.gif' width='1' height='1' border='0'></td>");
		    document.write("<td align='right'><img src='images/pixeltop.gif' width='"+ (tableWidth[subMenu-1] - imageWidth[subMenu-1]) +"' height='1' border='0'></td>");
		    document.write("<td><img src='images/pixeltop.gif' width='1' height='1' border='0'></td>		");
		document.write("</tr>");
		document.write("<tr>");
		    document.write("<td bgcolor='"+ activeColor +"'><img src='images/pixeltop.gif' width='1' height='1' border='0'></td>");
		    document.write("<td bgcolor='#082d74'>");
					document.write("<table border='0' cellspacing='0' cellpadding='0'>");
					
			  for( n=0 ; n< eval("menu" + subMenu + ".length") ; n++){
			  		if (eval('menu' + subMenu + '[n][0]') == "---") {
						document.write ("<tr>");
						document.write ("<td colspan=3 width=\"100%\"><hr></hr></td>");
						document.write ("</tr>");
					} else {

			   document.write ("<tr style='cursor=hand'>");
			   document.write ("<td width='9' height='16'><img src='/images/spacer.gif' width='9' height='1' border='0'></td>");
			   document.write ("<td width='"+ (tableWidth[subMenu-1] - 11) +"' style='padding-left:7px;'><A CLASS='wit' HREF='" + eval('menu' + subMenu + '[n][1]') + "' >"  + eval('menu' + subMenu + '[n][0]') + "</A></td>");
			   document.write ("</tr>");
			   }
				}
		document.write("<tr><td colspan='2'><img src='images/spacer.gif' height='3' width='1' border='0'></td></tr>")		 
					document.write("</table>");
				document.write("</td>");
		    document.write("<td rowspan='2' bgcolor='"+ activeColor +"'><img src='images/"+ activePixel +".gif' width='1' height='1' border='0'></td>");
		document.write("</tr>");
		document.write("<tr>");
		document.write("<td colspan='2' bgcolor='"+ activeColor +"'><img src='images/"+ activePixel +".gif' width='1' height='1' border='0'></td>");
		document.write("</tr>");
		document.write("</table>");

	 document.write ("</TABLE>");
	if(bw.ns4){
	document.write("</LAYER>");
	}else{
	document.write("</DIV>");
	}
}
	
//Default browsercheck
function checkBrowser(){
	this.ver=navigator.appVersion
	this.dom=document.getElementById?1:0
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;
	this.ie4=(document.all && !this.dom)?1:0;
	this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0;
	this.ns4=(document.layers && !this.dom)?1:0;
	//added
	this.ie4mac=this.ie4 && navigator.userAgent.indexOf("Mac")>-1
	this.ie5mac=this.ie5 && navigator.userAgent.indexOf("Mac")>-1
	this.ie55=(this.ver.indexOf("MSIE 5.5")>-1 && this.dom)?1:0; 
	this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5 || this.ie5mac)
	return this
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}
	
function MM_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}
	
function showHideLayers(subMenu, menuMax){
	for(i=1;i<=menuMax;i++){
		if(i == subMenu){
			MM_showHideLayers(("Layer" + i),'','show');
		}else{
			MM_showHideLayers(("Layer" + i),'','hide');
		}
	}
}
	
function hideLayer(layer){
	if(layer != 'cancel'){
		timeID = setTimeout("resetNavigation('"+layer+"')",500);
		//timeID = setTimeout("MM_showHideLayers('" + layer + "','','hide')",500);
		//timeID = setTimeout("clearImage()",500);		
	}else{
		clearTimeout(timeID);
	}
}
	

function reDirect(URL) {
	location = URL;
}

	//Browsercheck
	var isMinNS4 = (document.layers) ? 1 : 0;								
	var isMinIE4 = (document.all) ? 1 : 0;								
	var isGecko  = (navigator.userAgent.substring(0,11) == 'Mozilla/5.0') ? 1 : 0;
	var isMac    = (navigator.appVersion.indexOf("Macintosh")>=0) ? 1 : 0;
	
		function toggle (c) 
		{
			if (!isMinNS4) {
				if (c.style.display == "none" || c.style.display == "") {
					c.style.display = "block";
				}
				else {
					c.style.display = "none";
				}	
		
			}
		}

		function layerDisplay (c) 
		{
			if (!isMinNS4) {
				c.style.display = "block";
				
			}
		}
		
		function layerHide (c) 
		{
			if (!isMinNS4) {
				c.style.display = "none";
				
			}
		}
		
function printit(){  
	if (isMac) {
			confirm('Klik op de Print button in de menubalk om deze pagina uit te printen.');
	}
	else {
			window.print();
	}
}			

function SetCurPage(p) {
	switch (p) {
		case "home":
			setImage('nav_home','/images/home_mo.gif')
			break
		case "occasions":
			setImage('nav_gebruikte','/images/gebruikte_mo.gif');
			break
	}
}
