/**------------ 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."/materials/Rubinstein/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) { 
writeHeader();
   document.write('<table width="100%"  border="0" cellspacing="0" cellpadding="0">'); 
    document.write('<tr><td width="147" align="left" valign="top">'); 
	 document.write('<table width="147" border="0" cellspacing="0" cellpadding="0">'); 
	  document.write('<tr><td><img src="/materials/Rubinstein/images/spacer.gif" width="147" height="45">');
   document.write('</td></tr>'); 
  	  var k;
      //document.write(this.navLen);
	  barArray[categoryNum].setLive();
	  for (k=1 ; k <= this.navLen  ; k++)
	  {
	   document.write('<tr>');
	   document.write('<td>');
	   //document.write("<br>");
	   //barPtr=k;
	   barArray[k].display();
	   document.write('</tr>');
	 
	   
	 }
  document.write('</table>');
  document.write('</td>');
  document.write('<td align="left">');
  
  
}

//Closes the table for the navigation bar
function closeAll() {
  document.write('</td>');
  document.write('</tr></table>');
  
}	

//Function to open a popup window
function openPopWin(winDocFile) {
     var alen,blen;
     var winInst=null;
     var agt=navigator.userAgent.toLowerCase();            
     var is_ie=(agt.indexOf("msie") != -1);
     if((!winInst)||(winInst.closed==true)) {
        features = 'toolbar,location,menubar=yes,scrollbars,resizable,status=no,directories=no';
        features += ',width=' + xlen + ',height=' + ylen ; 
	features += ',top=' + y + ',left=' + x ; 
	winInst = window.open(winDocFile,"name1",features);
        if (is_ie) { 
             alen = xlen * 1.05;
             blen = ylen * 1.5;    
             winInst.moveTo(x,y);
             winInst.resizeTo(alen,blen);  }
        winInst.focus();
    }	 
     else  {
	if(winInst.document!=winDocFile) {
           winInst = window.open(winDocFile,"name1")
           winInst.focus();
	 }
    }
 // cover all remaining cases
    winInst.focus();
}

//Function to open a popup window without location and toolbar
function openPlainWin(winDocFile) {
     var alen,blen;
     var winInst=null;
     var agt=navigator.userAgent.toLowerCase();            
     var is_ie=(agt.indexOf("msie") != -1);
     if((!winInst)||(winInst.closed==true)) {
        features = 'menubar=yes,scrollbars,resizable,status=no,directories=no';
        features += ',width=' + xlen + ',height=' + ylen ; 
	features += ',top=' + y + ',left=' + x ; 
	winInst = window.open(winDocFile,"name1",features);
        if (is_ie) { 
             alen = xlen * 1.05;
             blen = ylen * 1.5;    
             winInst.moveTo(x,y);
             winInst.resizeTo(alen,blen);  }
        winInst.focus();
    }	 
     else  {
	if(winInst.document!=winDocFile) {
           winInst = window.open(winDocFile,"name1")
           winInst.focus();
	 }
    }
 // cover all remaining cases
    winInst.focus();
}


 function change()  {
     if (current==max)
     current=0;
     document.photo.src=pic[current];
     setTimeout("change()",3*1000);
     current++;
      }



















