// *************************************************
// *-----------------------------------------------*
// | Module für www.brenet.ch                      |
// | V 1.0					   |
// | c by Fachhochschule Solothurn NWS, Olten	   |
// | Autor: Thekla Müller-Schenker		   |
// *-----------------------------------------------*
// *************************************************

//-------------------------------------------------------------------------------------------------
// Menu
//-------------------------------------------------------------------------------------------------
document.onmouseover = doDocumentOnMouseOver ;
document.onmouseout = doDocumentOnMouseOut ;

  function doDocumentOnMouseOver() {
    var eSrc = window.event.srcElement ;
    if (eSrc.className == "item") {
      window.event.srcElement.className = "highlight";
    }
  }

  function doDocumentOnMouseOut() {
    var eSrc = window.event.srcElement ;
    if (eSrc.className == "highlight") {
      window.event.srcElement.className = "item";
    }
  }


var bV=parseInt(navigator.appVersion);
NS4=(document.layers) ? true : false;
IE4=((document.all)&&(bV>=4)) ? true : false;
DOM=(!document.layers && !document.all && bV>=4) ? true : false;
capable = (NS4 || IE4 || DOM) ? true : false;

function expandIt(){return}
function expandAll(){return}

isExpanded = false;

function getIndex(el) {
  ind = null;
  for (i=0; i<document.layers.length; i++) {
    whichEl = document.layers[i];
    if (whichEl.id == el) {
      ind = i;
      break;
    }
  }
  return ind;
}

function arrange() {
  nextY = document.layers[firstInd].pageY + document.layers[firstInd].document.height;
  for (i=firstInd+1; i<document.layers.length; i++) {
    whichEl = document.layers[i];
    if (whichEl.visibility != "hide") {
      whichEl.pageY = nextY;
      nextY += whichEl.document.height;
    }
  }
}


function initIt(){

  if (NS4) {
    for (i=0; i<document.layers.length; i++) {
      whichEl = document.layers[i];
      if (whichEl.id.indexOf("Child") != -1) whichEl.visibility = "hide";
    }
    arrange();
  } else if(IE4) {
    tempColl = document.all.tags("DIV");
    for (i=0; i<tempColl.length; i++) {
      if (tempColl(i).className == "child") tempColl(i).style.display = "none";
    }
  } else if(DOM) {
    tempColl = document.getElementsByTagName("DIV");
    for (i=0; i<tempColl.length; i++) {
      if (tempColl(i).className == "child") tempColl(i).style.visibility = "hidden";
    }
  }

}

function expandIt(el) {
  if (!capable) return;
  if (IE4) {
    expandIE(el);
  } else if(NS4) {
    expandNS(el);
  } else if(DOM) {
    expandDOM(el);
  }
}


function expandIE(el) {
  whichEl = eval(el + "Child");

  //whichIm = event.srcElement;
	whichIm = eval(el+"Img");

  if (whichEl.style.display == "none") {
    whichEl.style.display = "block";
    whichIm.src = (vpath + "pics/minus.gif");
  }
  else {
    whichEl.style.display = "none";
    whichIm.src = (vpath + "pics/plus.gif");
  }
    window.event.cancelBubble = true ;
}

function expandNS(el) {
  whichEl = eval("document." + el + "Child");
  whichIm = eval("document." + el + "Parent.document.images['imEx']");
  if (whichEl.visibility == "hide") {
    whichEl.visibility = "show";
    whichIm.src = (vpath + "pics/minus.gif");
  }
  else {
    whichEl.visibility = "hide";
    whichIm.src = (vpath + "pics/plus.gif");
  }
  arrange();
}

function expandDOM(el) {

  whichEl = document.getElementById(el + "Child");
    whichIm = document.getElementById(el + "Img");

  if (whichEl.style.visibility != "visible") {
    whichEl.style.visibility = "visible";
    whichIm.src = (vpath + "pics/minus.gif");
  } else {
    whichEl.style.visibility = "hidden";
    whichIm.src = (vpath + "pics/plus.gif");
  }

}

function showAll() {
  for (i=firstInd; i<document.layers.length; i++) {
    whichEl = document.layers[i];
    whichEl.visibility = "show";
  }
}

function expandAll(isBot) {

  newSrc = (isExpanded) ? (vpath+"pics/plus.gif") : (vpath + "pics/minus.gif");

  if (NS4) {
	// TR-02-01-99: Don't need that
	// document.images["imEx"].src = newSrc;
    for (i=firstInd; i<document.layers.length; i++) {
      whichEl = document.layers[i];
      if (whichEl.id.indexOf("Parent") != -1) {
	whichEl.document.images["imEx"].src = newSrc;
      }
      if (whichEl.id.indexOf("Child") != -1) {
	whichEl.visibility = (isExpanded) ? "hide" : "show";
      }
    }

    arrange();
   if (isBot && isExpanded) scrollTo(0,document.layers[firstInd].pageY);
  } else if(IE4) {
    divColl = document.all.tags("DIV");
    for (i=0; i<divColl.length; i++) {
      if (divColl(i).className == "child") {
	divColl(i).style.display = (isExpanded) ? "none" : "block";
      }
    }
    imColl = document.images.item("imEx");
    for (i=0; i<imColl.length; i++) {
      imColl(i).src = newSrc;
    }
  } else if(DOM) {
    divColl = document.getElementsByTagName("DIV");
    for (i=0; i<divColl.length; i++) {
      if (divColl(i).className == "child") {
	divColl(i).style.visibility = (isExpanded) ? "hidden" : "visible";
      }
    }
    imColl = document.getElementsByName("imEx");
    for (i=0; i<imColl.length; i++) {
      imColl(i).src = newSrc;
    }
  }

  isExpanded = !isExpanded;
}

with (document) {
  if(DOM) {
    var lstyle = "<style type='text/css'>";
    lstyle += ".child {font-family: Verdana, Arial, Helvetica, sans-serif; color: #000000; text-decoration:none; visibility:hidden}";
    lstyle += ".parent {font-family: Verdana, Arial, Helvetica, sans-serif; color: #000000; text-decoration:none;}";
    lstyle += ".item { color: darkblue; text-decoration:none; font-size: 8pt;}";
    lstyle += ".highlight { color: red; font-size: 8pt;}";
    lstyle += ".heada { font: 12px/13px; Times}";
    lstyle += "DIV { color:black; }";
    lstyle += "</style>";
    write(lstyle);
  } else {
    write("<style type='text/css'>");
    if (NS4) {
	    write(".parent {font-family: Verdana, Arial, Helvetica, sans-serif; color: #000000; text-decoration:none; position:absolute; visibility:hidden; color: black;}");
	    write(".child {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 8pt;color: #000000; position:absolute; visibility:hidden}");
	    write(".item { color: darkblue; text-decoration:none;}");
	    write(".regular {font-family: Arial,Helvetica,sans-serif; position:absolute; visibility:hidden}");
	    write("DIV { color:black; }");
    } else if(IE4) {
	    write(".child {font-family: Verdana, Arial, Helvetica, sans-serif; color: #000000; text-decoration:none; display:none}");
	    write(".parent {font-family: Verdana, Arial, Helvetica, sans-serif; color: #000000; text-decoration:none;}");
	    write(".item { color: darkblue; text-decoration:none; font-size: 8pt;}");
	    write(".highlight { color: red; font-size: 8pt;}");
	    write(".heada { font: 12px/13px; Times}");
	    write("DIV { color:black; }");
    }
    write("</style>");
  }
}

onload = initIt;

if (NS4)
{
      firstEl = "el1Parent";
      firstInd = getIndex(firstEl);
      showAll();
      arrange();
}
//-------------------------------------------------------------------------------------------------
// End Menu
//-------------------------------------------------------------------------------------------------

//-------------------------------------------------------------------------------------------------
// var window
//-------------------------------------------------------------------------------------------------
function openIT(u,W,H,X,Y,n) {
	var cD	='pics/close_dwn.gif'
	var cU	='pics/close_up.gif'
	var cO	='pics/close_ovr.gif'
	var cL	='pics/clock.gif'
	var tH	='<font face=verdana size=1 >&nbsp;<img src=pics/cms.gif>&nbsp;CMS 1.0 Fachhochschule Solothurn Nordwest Schweiz</font>'
	var tW	='CMS 1.0 FHSO'
	var wB	='#000000'
	var wBs ='#31309C'
	var wBG ='#0066CC'
	var wBGs='#0000FF'
	var wNS ='toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1'
	var fSO ='scrolling=no'
	return chromeless(u,n,W,H,X,Y,cD,cU,cO,cL,tH,tW,wB,wBs,wBG,wBGs,wNS,fSO)
}

//-------------------------------------------------------------------------------------------------
// End var window
//-------------------------------------------------------------------------------------------------


//-------------------------------------------------------------------------------------------------
// Chromeless
//-------------------------------------------------------------------------------------------------
function chromeless(u,n,W,H,X,Y,cD,cU,cO,cL,tH,tW,wB,wBs,wBG,wBGs,wNS,fSO){
	var c=(document.all&&navigator.userAgent.indexOf("Win")!=-1)?1:0
	var w=window.screen.width; var h=window.screen.height
	var W=W||w; W=(typeof(W)=='string'?Math.ceil(parseInt(W)*w/100):W); W+=2*c
	var H=H||h; H=(typeof(H)=='string'?Math.ceil(parseInt(H)*h/100):H); H+=23*c
	var X=X||Math.ceil((w-W)/2)
	var Y=Y||Math.ceil((h-H)/2)
	var s=",width="+W+",height="+H

	if(c){
		var cTIT='\n'+
		'<html><head><META HTTP-EQUIV="imagetoolbar" CONTENT="no">\n'+
		'<script>\n'+
		'var iclod=new Image();iclod.src="'+cD+'";var iclou=new Image();iclou.src="'+cU+'";var icloo=new Image();icloo.src="'+cO+'";var iload=new Image();iload.src="'+cL+'";\n'+
		'document.onselectstart=new Function("return false;");document.ondragstart=new Function("mWIN();return false;");document.oncontextmenu=new Function("return false;");document.onmousemove=mWIN\n'+
		'b=-1;\n'+
		'function wLoa(){if(top.loaded){bloa.style.visibility="hidden";sRes()}else setTimeout("wLoa()",500)}\n'+
		'function sRes(){bclo.style.pixelLeft=document.body.clientWidth-18;bloa.style.pixelLeft=document.body.clientWidth-38}\n'+
		'function mWIN(){\n'+
		'if(b==0){document.body.bgColor="'+wBG+'";parent.bM.document.body.bgColor="'+wB+'";parent.bT.document.body.bgColor="'+wB+'";parent.bB.document.body.bgColor="'+wB+'";parent.bL.document.body.bgColor="'+wB+'";parent.bR.document.body.bgColor="'+wB+'";b=-1}\n'+
		'if(b==2){px=event.screenX-ofx-1;py=event.screenY-ofy-1;top.window.moveTo(px,py);}\n'+
		'if(b==1){document.body.bgColor="'+wBGs+'";parent.bM.document.body.bgColor="'+wBs+'";parent.bT.document.body.bgColor="'+wBs+'";parent.bB.document.body.bgColor="'+wBs+'";parent.bL.document.body.bgColor="'+wBs+'";parent.bR.document.body.bgColor="'+wBs+'";ofx=event.x;ofy=event.y;b=2}\n'+
		'}</script></head>\n'+
		'<body onresize="sRes()" bgcolor='+wBG+'>\n'+
		'<div style="position:absolute;left:0px;top:4px">'+tH+'</div>\n'+
		'<img id=bmov style="position:absolute;left:-50px;top:-50px" onmousedown="b=1;mWIN()" onmouseup="b=0;mWIN()" border=0 src="" width=150% height=500>\n'+
		'<img id=bclo style="position:absolute;top:4px;left:'+(W-20)+'px;" src="'+cU+'" border=0 width=11 height=11 onmouseover="this.src=icloo.src" onmouseout="this.src=iclou.src" onmouseup="this.src=iclou.src" onmousedown="this.src=iclod.src" onclick="top.window.close()">\n'+
		'<img id=bloa style="position:absolute;top:4px;left:'+(W-40)+'px;" src="'+cL+'" border=0 width=11 height=11>\n'+
		'<script>wLoa()</script>\n'+
		'</body>\n'+
		'</html>'
		
		cTIT=cTIT.replace(/\//g,"\\\/").replace(/\"/g,"\\\"").replace(/\n/g,"\\n")
		
		var cFRM='<TITLE>'+tW+'</TITLE>\n'+
		'<script>\n'+
		'top.loaded=false\n'+
		'function mTIT(){\n'+
		'	if(frames.length>6){\n'+
		'		fT.document.bgColor="'+wBG+'";fT.document.write("'+cTIT+'");fT.document.close()\n'+
		'		bM.document.bgColor="'+wB+'";bL.document.bgColor="'+wB+'";bR.document.bgColor="'+wB+'";bB.document.bgColor="'+wB+'";bT.document.bgColor="'+wB+'"\n'+
		'	} else setTimeout("mTIT()",20)\n'+
		'}\n'+
		'mTIT()\n'+
		'</script>\n'+
		'<frameset onselectstart="return false" onload="top.loaded=true" border=0 framespacing=0 frameborder=0 cols="1,100%,1">\n'+
		'	<frame name=bL src="about:blank" scrolling=no noresize>\n'+
		'	<frameset border=0 framespacing=0 frameborder=0 rows="1,20,1,100%,1">\n'+
		'		<frame name=bT src="about:blank" scrolling=no noresize>\n'+
		'		<frame name=fT src="about:blank" scrolling=no noresize>\n'+
		'		<frame name=bM src="about:blank" scrolling=no noresize>\n'+
		'		<frame name=main src="'+u+'" '+fSO+'>\n'+
		'		<frame name=bB src="about:blank" scrolling=no noresize>\n'+
		'	</frameset>\n'+
		'<frame name=bR src="about:blank" scrolling=no noresize>\n'+
		'</frameset>\n'+
		'</HTML>'
	
		var CWIN=window.open("",n,"fullscreen=1"+s)
		CWIN.moveTo(5000,0)
		CWIN.resizeTo(W,H)
		CWIN.document.write(cFRM)
		CWIN.document.close()
		CWIN.moveTo(X,Y)
	} else {
		var CWIN=window.open(u,n,wNS+s,true)
		CWIN.moveTo(X,Y)
	}
	CWIN.focus()
	CWIN.setURL=function(u) { if (this && !this.closed) { if (this.frames.main) this.frames.main.location.href=u; else this.location.href=u } }
	CWIN.closeIT=function() { if (this && !this.closed) this.close() }
	return CWIN
}										
//-------------------------------------------------------------------------------------------------
// End Chromeless
//-------------------------------------------------------------------------------------------------

