// browser detect

browser_version = parseInt(navigator.appVersion);
browser_type = navigator.appName;
browser_platform =  navigator.platform.substring(0, 5);

if (browser_type == "Microsoft Internet Explorer" && (browser_version >= 4)) {
   document.write("<link REL='stylesheet' HREF='/style-ie.css' TYPE='text/css'>");
}
if (browser_platform="Linux" && browser_type == "Netscape" && (browser_version >= 5)) {
   document.write("<link REL='stylesheet' HREF='/style-ff.css' TYPE='text/css'>");
}
else {	
   document.write("<link REL='stylesheet' HREF='/style-mnn.css' TYPE='text/css'>");
}

// WinControl
function ctrlWinSize() {
  if ( navigator.platform.substring(0, 5)== "Linux" ) {
      fenster.resizeTo(367,410);    
  }
  if ( navigator.appName == "Microsoft Internet Explorer" ) {
     fenster.resizeTo(367,460);   
  }
  else {
     if ( navigator.platform.substring(0, 5)!= "Linux" )
        fenster.resizeTo(367,435);    
     }
}


// browse control

if (self == top) {
 top.location.href='/index.html?' + location.pathname;
}

// navi control

function ctrlNav(no) {
  var pth = top.frames[1].location.href;
  var items = pth.split("/");
  var fn = items[items.length-1];

  switch(no) {
  case 0:
    if(fn != "navi_top_empty.htm")
      top.frames[1].location.replace("/navi_top_empty.htm");
    break;
  case 1:
    if(fn != "navi_top.htm")
      top.frames[1].location.replace("/navi_top.htm");
    break;
  case 3:
    if(fn != "navi_top.htm")
      top.frames[1].location.replace("/navi_top_se.htm");
    break;
  }
}


function ctrlNavPan() {
 alert(top.frames[0].location.href);
}

// menu control

function get2url(fname) {
  var fn = fname;
  var lb = top.location.href;
  var filePos = lb.lastIndexOf("?");
  //alert(filePos);

  //alert(parent.frames[1].location.href);
  if (filePos>0) {
    var newfilename = lb.substring(0,filePos+1);
    //alert(newfilename);
    top.location.href = newfilename + fn;
  }
  else {
    top.loadFrame('nav', 'navi_top_empty.htm', 'data', fn);
    //alert(fn);
    return false;
  }
}

// menu highlighting

doc=document;

function hiliteM(clss,mhil) {
  var hiFnt = "#354a80";
  var hiBdr = "1px solid #0000a6";
  var hiBg  = "#ffffcc";

  var hiBdr_t_na = "2px solid #737373";
  var hiBdr_l_na = "2px solid #737373";
  var hiBdr_b_na = "2px solid #eeeeee";
  var hiBdr_r_na = "2px solid #eeeeee";

  if (clss=='mm') {
    doc.getElementById(mhil).style.color=hiFnt;
    doc.getElementById(mhil).style.border=hiBdr;
    doc.getElementById(mhil).style.background=hiBg;
  }
  else {
    doc.getElementById(mhil).style.color=hiFnt;
    doc.getElementById(mhil).style.borderTop=hiBdr_t_na;
    doc.getElementById(mhil).style.borderLeft=hiBdr_l_na;
    doc.getElementById(mhil).style.borderBottom=hiBdr_b_na;
    doc.getElementById(mhil).style.borderRight=hiBdr_r_na;
    doc.getElementById(mhil).style.background=hiBg;
  }
}

function unhiliteM(clss,mhil) {
  var loFnt = "#737373";
  var loBdr = "1px solid #b3b3b3";
  var loBg  = "#f5f5f5";

  var loBdr_t_na = "2px solid #eeeeee";
  var loBdr_l_na = "2px solid #eeeeee";
  var loBdr_b_na = "2px solid #737373";
  var loBdr_r_na = "2px solid #737373";

  var loBg_na  = "#cedeed"; 

  if (clss=='mm') {
    doc.getElementById(mhil).style.color=loFnt;
    doc.getElementById(mhil).style.background=loBg;
    doc.getElementById(mhil).style.border=loBdr;
  }
  else {
    doc.getElementById(mhil).style.color=loFnt;
    doc.getElementById(mhil).style.borderTop=loBdr_t_na;
    doc.getElementById(mhil).style.borderLeft=loBdr_l_na;
    doc.getElementById(mhil).style.borderBottom=loBdr_b_na;
    doc.getElementById(mhil).style.borderRight=loBdr_r_na;
    doc.getElementById(mhil).style.background=loBg_na;
  }
}

function chg2fr(uri1,fr1,uri2,fr2) {
  window.parent.frames[fr1].location.replace(uri1);
  window.parent.frames[fr2].location.replace(uri2);
  top.location.href = uri2;
}

// open/close additional window

function show( src, target ){
  var height=477;
  var width=796;
  if(document.layers || window.opera){
    x=y=-8;
  } else{
    x=y=-0;
  }
  var html='<HTML><HEAD><title>Tutor</title>' +
           ' <style type="text/css"> ' +
           '   body {margin-left:'+x+'px; margin-top:'+y+'px; ' +
           '         margin-right:0px; margin-bottom:0px; ' +
           '         text-align : center;} ' +
           ' </style> ' +
           '</HEAD>' +
           '<body>' +
           '  <img src="' + src + '" border="0">' +
           '</body></html>';
  child=window.open("",target,"width="+width+",height="+height+",top=100, left=400, resizable=no");
  child.document.open();
  child.document.write(html);
  child.document.close();
  child.focus();
}

