function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  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 && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

var lastClicked = '';
   
function toggleRow(strID)
{
	var strRow = 'tr'+strID;
	var objRow = document.getElementById([strRow]);
	objRow.style.display = ((objRow.style.display == '') ? 'none' : '');
	
	if (lastClicked != '')
	{
		var objRowLC = document.getElementById([lastClicked]);
	
		objRowLC.style.display = ((objRow.style.display == '') ? 'none' : '');
		//alert(lastClicked);
	}
	
	lastClicked = strRow;

}

function goToURL() 
{ window.location = "../spec_finder/colorcoat_HPS200.html"; }

function goToVMURL() 
{ window.location = "../spec_finder_vm_zinc/vm_zinc.html"; }


  /*
    Adds CSS class names to the LI elements of a nested UL list.
    leafes get the menu_leaf_class
    open nodes get the menu_open_class
    closed nodes get the menu_closed_class
    the current node gets the menu_active_class
    
    written 2004 by Ortwin Glueck
  */

  //config
  var menu_active_class = "active";
  var menu_leaf_class = "leaf";
  var menu_open_class = "open";
  var menu_closed_class = "closed";
  
  //the default page that is displayed if URL ends in /
  var menu_default_page = "index.php";
  var menu_url;
  
  //main function
  //menu_id : id of the element containing the navigation
  function menu_main(menu_id) {
     var url = location.href;
     if (url.lastIndexOf("/") == (url.length-1)) {
       url = url+menu_default_page;
     }
     if (url.lastIndexOf("?") >= 0) {
       url = url.substring(0, url.lastIndexOf("?"));
     }
     if (url.lastIndexOf("#") >= 0) {
       url = url.substring(0, url.lastIndexOf("#"));
     }
     menu_url = url;
     
     var main = document.getElementById(menu_id);
     if (!main) alert("No element with id '"+ menu_id +"' found");
     menu_traverse(main);
  }
  
  /* Walks down the subtree and on the way back
     sets properties.
     returns bit set
             1: set = element is a node, unset = element is a leaf
             2: set = element contains the active node
             4: set = element is the active A node
  */
  function menu_traverse(element) {
    var props  = 0;
    
    // walk down
    for (var i=0; i<element.childNodes.length; i++) {
      var child = element.childNodes[i];
      props |= menu_traverse(child); // aggregate bits
    }
    
    // on the way back now
    switch (element.tagName) {
      case "UL":
        props |= 1;
        break;
        
      case "LI":
        var c1 = (props & 1) ? 
                   ((props & (2|4)) ? menu_open_class : menu_closed_class)
                 : menu_leaf_class; 
        element.className = element.className ? element.className+" "+c1 : c1;
        if (props & 4) {
          if (!(props & 2)) element.className += " "+menu_active_class;
          props |= 2;
          props &= 1 | 2; // reset bit 4
        }
        break;
        
      case "A":
        if (props & 2) break; // once is enough
        var href = element.getAttribute("href");
        if (menu_isSameUrl(menu_url, href)) props |= 4;
        break;
    }
    
    return props;
  }
  
  //matches two URIs when href is the last part of url
  //.. and . are correctly resolved
  function menu_isSameUrl(url, href) {
    var a = url.split(/[?\/]/i);
    var b = href.split(/[?\/]/i);
    var i = a.length - 1;
    var j = b.length - 1;
    while ((i >= 0) && (j >= 0)) {
      if (b[j] == "..") { j-=2; continue; }
      if (a[i] == "..") { i-=2; continue; }
      if ((b[j] == ".") || (b[j] == "")) { j--; continue; }
      if ((a[i] == ".") || (a[i] == "")) { i--; continue; }
      if (! (a[i] == b[j])) return false;
      i--;
      j--;
    }
    return true;
  }

function popNewsletter(strURL)
{
	window.open(strURL,'centenary_video','width=512,height=288,location=no,meneubar=no,resizable=no,left=50,top=50,toolbar=no,scrollbars=no');
}
