var rootitem = null;

var overcache = Array();
var outcache = Array();
var buttonTeller = 0;
var currentMenu = 0;

function getObj(objName) {return document.all ? eval("document.all."+objName) : document.getElementById(objName);}

function flash (url, vars, width, height, id) {
	document.write (genflash(url, vars, width, height, id));
}

function genflash (url, vars, width, height, id) {
	flashvar = '';
	flashvar += '<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" WIDTH="'+width+'" HEIGHT="'+height+'" id="flashmovie">';
	flashvar += '<PARAM NAME=movie VALUE="'+url+'" />';
	flashvar += '<PARAM NAME=quality VALUE=autohigh />';
	flashvar += '<PARAM NAME=FlashVars VALUE="'+vars+'" />';
	flashvar += '<PARAM NAME=SAlign VALUE=L />';
	flashvar += '<PARAM NAME=menu value=false />';
	flashvar += '<PARAM NAME=scale VALUE=noscale />';
	//if (vars.indexOf("isstatic=1")!= -1)
	flashvar += '<PARAM NAME=wmode VALUE=transparent />';
	flashvar += '<embed type="application/x-shockwave-flash" src="'+url+'" name="'+id+'" id="'+id+'" menu="false" quality="autohigh" scale="noscale" align="middle" menu=false salign="l" allowScriptAccess="sameDomain" bgcolor="#ffffff" flashvars="'+vars+'" width="'+width+'" height="'+height+'" pluginspage="http://www.macromedia.com/go/getflashplayer"';
	//if (vars.indexOf("isstatic=1")!= -1)
	flashvar += ' wmode="transparent"';
	flashvar += ' />';
	flashvar += '</OBJECT>';

	return flashvar;
}

function removeLink (objectId, linkObject)
{
	document.getElementById(objectId).innerHTML = '';
	
	linkObject.style.visibility = 'hidden';
	
	contentchanged = true;
	parent.ShowSpecialButtons(true, 'all');
}

function createLink (objectId, url, target)
{
	document.getElementById('URL'+objectId).innerHTML = url;
	document.getElementById('target'+objectId).innerHTML = target;
	
	if(url != '')
		document.getElementById('removeURL'+objectId).style.visibility = "visible";
	else
		document.getElementById('removeURL'+objectId).style.visibility = "hidden";
	
	contentchanged = true;
	parent.ShowSpecialButtons(true, 'all');
}

function openSubMenu(nr){
 
  getObj("submenu"+currentMenu).style.display="none";

 if (nr==0) 
 {
 		OpenPageByID(CatTree[0].childs[0].ID);
 }
 else if (nr==1) 
 {
 		OpenPageByID(CatTree[0].childs[1].ID);
 }
 else if (nr==6) 
 {
 		OpenPageByID(CatTree[0].childs[6].ID);
 }
 else 
 {
  	getObj("submenu"+nr).style.display="block";
  	currentMenu=nr;
 }
}
function sluitSubMenu(nr){
   getObj("submenu"+currentMenu).style.display="none";
   currentMenu=nr;
}

function genMenu(){
  rootitem = CatTree[0];
	 document.write("<img src=\"/cms/images/img-3d1d8ee74f14cea2fa481da9491d6404.gif\" width=\"21\" height=\"1\">");
  for (i=0; i < rootitem.childs.length; i++) {
     overcache[buttonTeller]=new Image();
	 overcache[buttonTeller].src="http://www.indg.nl/scripts/text.php?text="+rootitem.childs[i].label+"&color=000063&size=9&bg=9C9A9C&font=Arial&quality=100";
     outcache[buttonTeller]=new Image();
	 outcache[buttonTeller].src="http://www.indg.nl/scripts/text.php?text="+rootitem.childs[i].label+"&color=ffffff&size=9&bg=9C9A9C&font=Arial&quality=100";
	 document.write("<div style=\"position:absolute;\"><div id=\"submenu"+i+"\" class=\"subMenu\" style=\"position: relative; top:0px; left:-11px; display: none; height:105px; width: 200px; padding: 10px 2px 2px 5px;z-index: 2;\">");
  	 document.write("<div style=\"position:absolute; z-index:10 \"><div style=\"position: relative; top: 75px; left:160px; display: block; z-index: 11; width: 20px; height: 15px;\" class=\"sluitButton\"><a href=\"javascript:sluitSubMenu("+i+")\">sluiten</a></div></div>");
	 document.write("<img src=\"http://www.indg.nl/scripts/text.php?text="+rootitem.childs[i].label+"&color=ffffff&size=9&bg=00309C&font=Arial&quality=100\" border=\"0\"><br><img src=\"/cms/images/img-3d1d8ee74f14cea2fa481da9491d6404.gif\" width=\"1\" height=\"2\"><br><img src=\"/cms/images/img-51f498bc9e9a9ea3c4caa66adf9ab4cb.gif\" width=\"200\" height=\"1\"><img src=\"/cms/images/img-3d1d8ee74f14cea2fa481da9491d6404.gif\" width=\"1\" height=\"1\"><br>");
	  for (x=0; x < rootitem.childs[i].childs.length; x++){
	   if(rootitem.childs[i].childs[x].ID == 1926)
		   document.write("<a href=\"http://www.bmw.nl/\" target=\"_blank\" >"+rootitem.childs[i].childs[x].label+"</a><br>");
		 else if(rootitem.childs[i].childs[x].ID == 6138)
		   document.write("<a href=\"http://www.oolbekkink-webshop.nl/\" target=\"_blank\">"+rootitem.childs[i].childs[x].label+"</a><br>");	 
		 else
		   document.write("<a href=\"javascript:void(0);\" onclick=\"javascript:OpenPageByID("+rootitem.childs[i].childs[x].ID+");return false;\">"+rootitem.childs[i].childs[x].label+"</a><br>");
	  }
	 document.write("</div></div>");
	 document.write("<a href=\"javascript: void(0);\" onclick=\"javascript:openSubMenu("+i+"); return false;\" onmouseover=\"i"+buttonTeller+".src=overcache["+buttonTeller+"].src;\" onmouseout=\"i"+buttonTeller+".src=outcache["+buttonTeller+"].src;\">");
	 document.write("<img id=\"i"+buttonTeller+"\" name=\"i"+buttonTeller+"\" src=\"http://www.indg.nl/scripts/text.php?text="+rootitem.childs[i].label+"&color=ffffff&size=9&bg=9C9A9C&font=Arial&quality=100\" border=\"0\">");
	 document.write("</a><img src=\"/cms/images/img-2d760c15c0fd17561efb1c734d45721d.gif\" width=\"21\" height=\"20\">");
	 buttonTeller=buttonTeller+1;
  }
}






function openLink(nr){
 if (nr==1) window.open('');
 if (nr==2) OpenPageByID(1984);
 if (nr==6) OpenPageByID(3959);
 if (nr==3) window.open('http://www.mini-shop.com/mini/index'+'.html');
 if (nr==4) window.open('http://www.mini.nl/nl/nl/owners_entrance/index.'+'jsp?refType=teaserStandard');
 if (nr==5) window.open('http://www.mini.nl/nl/nl/john_cooper_works/index.'+'jsp?refType=teaserStandard');

 return false;
}

function genereerSubsOpPagina(){
 
 depositie=GetLocationList(thischild);
 if (depositie.length==2){
    if (HasChilds(thischild) > 0){
  	var rootitem = thischild;
	  for (i=0; i < rootitem.childs.length; i++) {
	   if (HasChilds(rootitem.childs[i])){
	   document.write("<span class=\"kopTekst\">"+rootitem.childs[i].label+"</span><br>");
	   document.write("<img src=\"/cms/images/img-a6de1ccd05d621957b0a84ecf6d017d8.gif\"><br>");
		for (p=0; p < rootitem.childs[i].childs.length; p++) {
	     overcache[buttonTeller]=new Image();
	     overcache[buttonTeller].src="http://www.indg.nl/scripts/text.php?text="+rootitem.childs[i].childs[p].label+"&color=00309C&size=9&bg=ffffff&font=Arial&quality=100";
         outcache[buttonTeller]=new Image();
	     outcache[buttonTeller].src="http://www.indg.nl/scripts/text.php?text="+rootitem.childs[i].childs[p].label+"&color=575757&size=9&bg=ffffff&font=Arial&quality=100";
	     document.write("<a href=\"javascript:void(0);\" onclick=\"javascript:OpenPageByID("+rootitem.childs[i].childs[p].ID+"); return false;\" onmouseover=\"i"+buttonTeller+".src=overcache["+buttonTeller+"].src;\" onmouseout=\"i"+buttonTeller+".src=outcache["+buttonTeller+"].src;\">");
		 document.write("<img id=\"i"+buttonTeller+"\" name=\"i"+buttonTeller+"\" src=\"http://www.indg.nl/scripts/text.php?text="+rootitem.childs[i].childs[p].label+"&color=575757&size=9&bg=ffffff&font=Arial\" border=\"0\"></a><br>");
		 buttonTeller=buttonTeller+1;
	    }
	   }
	   else{
	   document.write("<img src=\"/cms/images/img-a6de1ccd05d621957b0a84ecf6d017d8.gif\"><br>");
	     overcache[buttonTeller]=new Image();
	     overcache[buttonTeller].src="http://www.indg.nl/scripts/text.php?text="+rootitem.childs[i].label+"&color=00309C&size=9&bg=ffffff&font=Arial&quality=100";
         outcache[buttonTeller]=new Image();
	     outcache[buttonTeller].src="http://www.indg.nl/scripts/text.php?text="+rootitem.childs[i].label+"&color=575757&size=9&bg=ffffff&font=Arial&quality=100";
	     document.write("<a href=\"javascript:void(0);\" onclick=\"javascript:OpenPageByID("+rootitem.childs[i].ID+"); return false;\" onmouseover=\"i"+buttonTeller+".src=overcache["+buttonTeller+"].src;\" onmouseout=\"i"+buttonTeller+".src=outcache["+buttonTeller+"].src;\">");
		 document.write("<img id=\"i"+buttonTeller+"\" name=\"i"+buttonTeller+"\" src=\"http://www.indg.nl/scripts/text.php?text="+rootitem.childs[i].label+"&color=575757&size=9&bg=ffffff&font=Arial\" border=\"0\"></a>");
		 buttonTeller=buttonTeller+1;
	   }
  	   document.write("<br><img src=\"/cms/images/img-4c556a673f1567fa681d56428d0efd6c.gif\" width=\"1\" height=\"3\"><br>");
	  }
     }
  }

 if (depositie.length==3){
  	var rootitem = thischild.parentRef;
	  if (rootitem.childs.length>0) document.write("<img src=\"/cms/images/img-a6de1ccd05d621957b0a84ecf6d017d8.gif\"><br><img src=\"/cms/images/img-4c556a673f1567fa681d56428d0efd6c.gif\" width=\"1\" height=\"3\"><br>");
	  for (i=0; i < rootitem.childs.length; i++) {
	     overcache[buttonTeller]=new Image();
	     overcache[buttonTeller].src="http://www.indg.nl/scripts/text.php?text="+rootitem.childs[i].label+"&color=00309C&size=9&bg=ffffff&font=Arial&quality=100";
         outcache[buttonTeller]=new Image();
	     outcache[buttonTeller].src="http://www.indg.nl/scripts/text.php?text="+rootitem.childs[i].label+"&color=575757&size=9&bg=ffffff&font=Arial&quality=100";
	     document.write("<a href=\"javascript:void(0);\" onclick=\"javascript:OpenPageByID("+rootitem.childs[i].ID+"); return false;\" onmouseover=\"i"+buttonTeller+".src=overcache["+buttonTeller+"].src;\" onmouseout=\"i"+buttonTeller+".src=outcache["+buttonTeller+"].src;\">");
		 document.write("<img id=\"i"+buttonTeller+"\" name=\"i"+buttonTeller+"\" src=\"http://www.indg.nl/scripts/text.php?text="+rootitem.childs[i].label+"&color=575757&size=9&bg=ffffff&font=Arial\" border=\"0\"></a>");
		 buttonTeller=buttonTeller+1;
  	  document.write("<br><img src=\"/cms/images/img-4c556a673f1567fa681d56428d0efd6c.gif\" width=\"1\" height=\"3\"><br>");
	  }
 }

 if (depositie.length==4){
  	var rootitem = thischild.parentRef.parentRef;
	  for (i=0; i < rootitem.childs.length; i++) {
	  document.write("<span class=\"kopTekst\">"+rootitem.childs[i].label+"</span><br>");
	    for (p=0; p < rootitem.childs[i].childs.length; p++) {
	     overcache[buttonTeller]=new Image();
	     overcache[buttonTeller].src="http://www.indg.nl/scripts/text.php?text="+rootitem.childs[i].childs[p].label+"&color=00309C&size=9&bg=ffffff&font=Arial&quality=100";
         outcache[buttonTeller]=new Image();
	     outcache[buttonTeller].src="http://www.indg.nl/scripts/text.php?text="+rootitem.childs[i].childs[p].label+"&color=575757&size=9&bg=ffffff&font=Arial&quality=100";
	     document.write("<a href=\"javascript:void(0);\" onclick=\"javascript:OpenPageByID("+rootitem.childs[i].childs[p].ID+"); return false;\" onmouseover=\"i"+buttonTeller+".src=overcache["+buttonTeller+"].src;\" onmouseout=\"i"+buttonTeller+".src=outcache["+buttonTeller+"].src;\">");
		 document.write("<img id=\"i"+buttonTeller+"\" name=\"i"+buttonTeller+"\" src=\"http://www.indg.nl/scripts/text.php?text="+rootitem.childs[i].childs[p].label+"&color=575757&size=9&bg=ffffff&font=Arial\" border=\"0\"></a><br>");
		 buttonTeller=buttonTeller+1;
	    }
  	  document.write("<br>");
	  }
 } 

}



// HIERONDER STAAN ALLE SCRIPTS VAN DE MINI-SITE //


function genMenuMini(){
  var dikte=1;
  rootitem = CatTree[1];
	 document.write("<img src=\"/cms/images/img-3d1d8ee74f14cea2fa481da9491d6404.gif\" width=\"21\" height=\"1\">");
  for (i=0; i < rootitem.childs.length; i++) {
     overcache[buttonTeller]=new Image();
	 overcache[buttonTeller].src="http://www.indg.nl/scripts/text.php?text="+rootitem.childs[i].label.toUpperCase()+"&color=ffffff&size=8&bg=000000&font=Arialbold&quality=100";
     outcache[buttonTeller]=new Image();
	 outcache[buttonTeller].src="http://www.indg.nl/scripts/text.php?text="+rootitem.childs[i].label.toUpperCase()+"&color=ADAAAD&size=8&bg=000000&font=Arialbold&quality=100";
	 /*document.write("<div style=\"position:absolute;\"><div id=\"submenu"+i+"\" class=\"subMenu\" style=\"position: relative; top:0px; left:-11px; display: none; height:105px; width: 200px; padding: 10px 2px 2px 5px;z-index: 2;\">");
  	 document.write("<div style=\"position:absolute; z-index:10 \"><div style=\"position: relative; top: 75px; left:160px; display: block; z-index: 11; width: 20px; height: 15px;\" class=\"sluitButton\"><a href=\"javascript:sluitSubMenu("+i+")\">sluiten</a></div></div>");
	 document.write("<img src=\"http://www.indg.nl/scripts/text.php?text="+rootitem.childs[i].label+"&color=ffffff&size=9&bg=00309C&font=Arial&quality=100\" border=\"0\"><br><img src=\"/cms/images/img-3d1d8ee74f14cea2fa481da9491d6404.gif\" width=\"1\" height=\"2\"><br><img src=\"/cms/images/img-51f498bc9e9a9ea3c4caa66adf9ab4cb.gif\" width=\"200\" height=\"1\"><img src=\"/cms/images/img-3d1d8ee74f14cea2fa481da9491d6404.gif\" width=\"1\" height=\"1\"><br>");
	  for (x=0; x < rootitem.childs[i].childs.length; x++){
	   document.write("<a href=\"javascript:void(0);\" onclick=\"javascript:OpenPageByID("+rootitem.childs[i].childs[x].ID+");return false;\">"+rootitem.childs[i].childs[x].label+"</a><br>");
	  }
	 document.write("</div></div>");*/
	 document.write("<span style=\"border-width: 0px 1px 1px "+dikte+"px; border-color: #ffffff; border-style: solid; padding: 4px 10px 4px 10px;\">");
	 document.write("<a href=\"javascript: void(0);\" onclick=\"javascript:OpenPageByID("+rootitem.childs[i].ID+"); return false;\" onmouseover=\"i"+buttonTeller+".src=overcache["+buttonTeller+"].src;\" onmouseout=\"i"+buttonTeller+".src=outcache["+buttonTeller+"].src;\">");
	 document.write("<img id=\"i"+buttonTeller+"\" name=\"i"+buttonTeller+"\" src=\"http://www.indg.nl/scripts/text.php?text="+rootitem.childs[i].label.toUpperCase()+"&color=ADAAAD&size=8&bg=000000&font=Arialbold&quality=100\" border=\"0\">");
	 document.write("</a></span>");
	 buttonTeller=buttonTeller+1;
	 if (dikte==1) dikte=0;
  }  
}



function PopUpWindow(URL, w, h)
{
	day = new Date();
	id = day.getTime();
	window.open(URL, id , 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=' + w + ',height=' + h);
}

