// JavaScript Document
function repaint(o) {
	r = document.getElementById("MenuRow");
	cells = r.getElementsByTagName("td");
	for (var i = 0; i < cells.length; i++)  {
		if (cells[i].innerHTML == selected_type) {
			cells[i].style.color = "#F93";
			if (o == true) {
				reftext = cells[i].innerHTML + "/" + cells[i].innerHTML + ".html";
				window.open(reftext, "mainFrame");
			}
		} else {
			cells[i].style.color = "#DDD";
		}
	}
}

function repaintWithPath(o, p) {
	r = document.getElementById("MenuRow");
	cells = r.getElementsByTagName("td");
	for (var i = 0; i < cells.length; i++)  {
		if (cells[i].innerHTML == selected_type) {
			cells[i].style.color = "#F93";
			if (o == true) {
				window.open(p, "mainFrame");
			}
		} else {
			cells[i].style.color = "#DDD";
		}
	}
}

function ondown (d) {
	d.style.backgroundColor = "#036";
	selected_type = d.innerHTML;
	repaint(true);
}

function onover(d) {
	d.style.backgroundColor = "#036";
	repaint(false);
	d.style.color = "#F93";
}

function onout(d) {
	d.style.backgroundColor = "transparent";
	repaint(false);
}

function setVar() {
	loaded_type = "";
}

function initMenu(d) {
	selected_type = d;
	repaint(true);
}

function resizeFrame(id, offset) {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
	myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  var f1 = document.getElementById(id);
  
  if( typeof( window.innerWidth ) == 'number' ) {
	  f1.style.height = "100%";
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
	  f1.style.height = (myHeight + document.body.offsetHeight - offset) + "px";
	  //f1.style.height = (myHeight) + "px";
	  //echo("height: " + (myHeight - offset) + "px");
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
	  f1.style.height = (myHeight - offset) + "px";
  }
}

function init(page) {
		document.getElementById("detailFrameID").focus();	
		window.open(page, "detailFrame");
	//	resizeFrame("detailFrame", 20);
		
}

function calcHeight()
{
	//find the height of the internal page
	var the_height=
	document.getElementById('detailFrame').contentWindow.document.body.scrollHeight;

	//change the height of the iframe
	document.getElementById('detailFrame').height=the_height;
}

function detect(path)
{
	if (top.location.href.indexOf("index.html") == -1)
	{
		top.location.href = path;
	}
}
