/**------------ FILE NavGen.js  ------------------- 
------------ THE NAVIGATION BAR  ----------------**/

// Create global barArray to store  bar instances (for images-value and etc.) of BarClass 
// NavClass  access this bar-array as an array and BarClass methods as single bar in the array
//        - bar Array  is used and  is initialized for VERTICAL  bar  images  from location 0 up-to  30
//        - bar Array  is used and  is initialized for HORIZONTAL  bar images from location 31 up-to  60
//         bar images are initialized  for VERTICAL        in NavSetVert.js    -  USE : NavSetVertTmplt.js 
//         bar images are initialized for HORIZONTAL   in NavSetHoriz.js    -  USE : NavSetHorizTmplt.js 
  var horPtr = 30 ;       // the location and the allocation  of the Horizontal bars starts in barArray at location 31
                                   //    therefore we set the horPtr as 30     
 barArray = new Array(horPtr +30);  // create global barArray to store images for verical and horizontal bars
                                                          //  this is equal to say BarArray = new Array(60 ); 

// these general functiions get anum to approach instance of barClass by  barArray   and set /modify its value
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,nicName,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.barName= nicName;
  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;  
  //this.displayHorBar= displayHorBar;  
}
//-----------------------------------------------------------------
//---------------------setLive  method ----------------------
//-----------------------------------------------------------------
function setLive()  { // Method of BarClass 
    // set img-src for the entered categoryNum
  this.offImgSrc= this.liveImgSrc;
  this.onImgSrc=this.liveImgSrc;
}
//-----------------------------------------------------------------
//---------------  setLive  method --------------------------
//-----------------------------------------------------------------
function setNormal() { //Method of BarClass (not in use!) opposite of set live 
  this.offImgSrc= this.srcBaseName + "1" + imgExt;
  this.onImgSrc = this.srcBaseName + "2" + imgExt; 
}

/* -----------------------------------------------------------------
---------------   display  method
 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."/bogmeeting/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, visualtop, visualbot) { // NavClass Class declaration
	 this.navLen=len;
                 this.topVisual = visualtop;
                 this.botVisual = visualbot;
	 //methods:
	 this.displayNavVert=displayNavVert;   //puts the navagation table frame 
	 this.displayNavHor=displayNavHor;   //puts the navagation table frame 
	 this.displayNavVertCss=displayNavVertCss;   //uses css for layout
	 this.displayNavHorCss=displayNavHorCss;   //uses css for layout
		 		    //and loops over all bar display each
}
//-----------------------------------------------------------------
// NavClass  displayNavVert Method 
//-----------------------------------------------------------------
function displayNavVert(barname) {   //**replaced categoryNum with barname
//  display Vertical navigator in a table 
// activate display method for each bar
  
		//tohen table
}
//-----------------------------------------------------------------
// displayNavHor Method 
//-----------------------------------------------------------------
function displayNavHor(barname) {   //**replaced categoryNum with barname
// NavClass Method - display horizontal navigator in a table
// activate display method for each bar
   document.write(this.topVisual);
    var k;
    //document.write(this.navLen);
	  //horBarArray[categoryNum].setLive(); 	**replaced to refer via barname
	  for (k=horPtr +1 ; k <= this.navLen  ; k++)
	  {
                	   document.write('<td>');
                	   if 	(   barArray[k].barName == barname ){
                                        barArray[k].setLive(); 
                                    }
                	   //horBarArray[k].displayHorBar();
                	   barArray[k].display();
                	   document.write('</td>');
					  if 	(   k < this.navLen ){ 
					   document.write('<td width="1" align="center"><img src="images/ver.gif" width="1" height="9" alt="" border="0"></td>');
	 } 
	 }
	 
  document.write(this.botVisual);
	 		
		//tohen table
}
//-----------------------------------------------------------------
// NavClass displayNavHorCss Method 
//-----------------------------------------------------------------
function displayNavHorCss(barname) {  
// NavClass Method - display horizontal navigator in css-html based code  
// activate display method for each bar
   
}
//-----------------------------------------------------------------
// NavClass Method 
//-----------------------------------------------------------------
function displayNavVertCss(barname) {   //**replaced categoryNum with barname
// NavClass Method - display vertical navigator in css-html based code  
// activate display method for each bar
   

}


