/**------------ FILE WiccJS.js  ------------------- 
------------ THE NAVIGATION BAR  ----------------**/
function barActOn( bar_num) {
   document [barArray[bar_num].imgBarName].src = barArray[bar_num].onImgSrc;
}

function barActOff(num) {
   var bar_num=num;
   document [barArray[bar_num].imgBarName].src = barArray[bar_num].offImgSrc;
}	
//----------------  Bar Class -------------------------------------	

function BarClass(num,offSrc,onSrc,liveSrc,refFile,altTag) {
  // parameters:
  // following lines are of use - if we would want to build ourselves  x3 image source file names 
  this.barNum=num; 
  this.offImgSrc= offSrc;
  this.onImgSrc=onSrc;
  this.liveImgSrc=liveSrc; 
  this.ref= refFile; 
  this.alt = altTag;			  	   	   		  
  this.imgBarName="bar"+ num; 	//e.g. "bar2"	  
 //methods:
  this.setLive = setLive;						  
  this.display= display;  
}

function setLive()  { // Method of BarClass 
    // set img-src for the entered categoryNum
  this.offImgSrc= this.liveImgSrc;
  this.onImgSrc=this.liveImgSrc;
}

function setNormal() { //Method of BarClass (not in use!) opposite of set live 
  this.offImgSrc= this.srcBaseName + "1" + imgExt;
  this.onImgSrc = this.srcBaseName + "2" + imgExt; 
}

/** Method of BarClass - display the bar with all its features  
 the bar-instance  is displayed with it's according link and according 
 ActOn/Off function (e.g. mouse on/out) in the future may extend 
 to support alt-status. assumes being displayed within table-td already
**/
function display() {
 // have to create act On/off call with the actual barNum
 var actOnCall="barActOn("+ this.barNum + ")" ;   // = barActOn(j)
 var actOffCall="barActOff("+ this.barNum + ")" ; // = barActOff(j)
	  document.write('<a href='); 
	  document.write(this.ref); 
	  document.write(' OnMouseOver=');
 	  document.write(actOnCall); 
	  document.write(' OnMouseOut=');
 	  document.write(actOffCall);  
	  document.write(' >');
  	  document.write(' <img src="');
	  document.write(this.offImgSrc);        //e.g."images/contact1.jpg" ;
	  document.write('" border="0" name= ');
	  document.write(this.imgBarName);
	  document.write(' alt="');
      document.write(this.alt);
      document.write('">');
	  document.write("</a>");
}

//--------------- Nav Class ---------------------------------------

function NavClass(len) { // NavClass Class declaration
	 this.navLen=len;
	 //methods:
	 this.setBarArray=setBarArray; // bar: barArray[j]=new BarClass(); 
	 this.displayNav=displayNav;   //puts the navagation table frame 
		 		    //and loops over all bar display each
}

function displayNav(categoryNum) { 
// NavClass Method - display navigator in a table
// activate display method for each bar
document.write('<table width="100%"  border="0" cellpadding="0" cellspacing="0">');  
document.write('<tr><td width="15" height="100%" rowspan="3" align="left" valign="top" background="images/bc_bordo.gif">'); 
document.write('<img src="images/teva_vert.jpg" width="15" height="591"></td>'); 
document.write('<td height="12" width="192" align="left"><img src="images/teva_hor.jpg" width="192" height="12"></td>');
 document.write('<td align="left" valign="bottom"><img src="images/top2.gif" width="89" height="12"></td>');
document.write('</tr><tr>');
document.write('<td width="192" align="left" valign="top" background="images/bc_tab_vert.gif">');
document.write('<table width="192" border="0" cellspacing="0" cellpadding="0" background="images/bc_tab_vert.gif">');
document.write('<tr>'); 
document.write('<td><img src="images/top_bar.gif" width="192" height="35"></td>');
document.write('</tr><tr>');
document.write('<td><img src="images/nav_top.gif" width="192" height="4"></td>');
document.write('</tr>');
	  var k;
      //document.write(this.navLen);
	  barArray[categoryNum].setLive();
	  for (k=1 ; k <= this.navLen  ; k++)
	  {
	   document.write('<tr>');
	   document.write('<td align="left" valign="top">');
	  	   //document.write("<br>");
	   //barPtr=k;
	   barArray[k].display();
	   document.write('</td>');
	   document.write('</tr>');
	 }
	 document.write('<tr><td background="images/bc_tab_vert.gif"><img src="images/nav_bot.gif" width="192" height="60"></td>');
  document.write('</tr>');
  document.write('<tr><td><img src="images/spacer.gif" width="1" height="12"><br><br></td></tr>');  
	document.write('</table><br></td>');
	
    document.write('<td align="left" valign="top">'); 	
	
}

//Header -title
function writeHeader() {
document.write('<table width="100%"  border="0" cellpadding="0" cellspacing="0">');
document.write('<tr><td  rowspan="2" align="left" valign="top" width="89" height="101" background="images/bc_hor.gif">');
document.write('<img src="images/unmbrr.gif" width="89" height="101"></td>');
document.write('<td align="left" valign="top" width="430" height="56" background="images/bc_hor.gif">');
document.write('<img src="images/title.gif" width="423" height="56"></td>');
document.write('<td align="center" valign="top" background="images/bc_hor.gif" height="56"><img src="images/wis.gif" width="191" height="56" hspace="7"></td>');
document.write('<td background="images/bc_hor.gif" height="56"></td>');
document.write('</tr><tr><td colspan="3" height="45"></td></tr></table>');

}
//Closes the table for teh navigation bar
function closeAll() {
  //document.write('</td>');
 // document.write('</tr>');
//document.write('</table>');
document.write('</td></tr>');
document.write('<tr>');
 document.write('<td background="images/bc_tab_vert.gif" valign="bottom"><img src="images/pas_bot.gif"></td>');
document.write('<td>');
writeFooter();
document.write('</td></tr>');
document.write('</table>');
}	

//Closes the table for teh navigation bar
function writeFooter() {
document.write('<center>');
document.write('<hr>');
  document.write('<font size="-1">Safety and Environment Unit</font>');
document.write('<br>');
 document.write('<font size="-1"><a href="/">Weizmann Institute of Science</a></font>');
document.write('<br>');
 document.write('<a href="contact.html"><font size="-1">Contact Us</font></a>');
document.write('</center>');

}	



















