// navbar.js.
// Included in every .html include file throughout the site.
// function output menubar takes one argument, which is a number relating 
// to which navbar element is the one specific to the area which the navbar
// is appearing in.  ie. for home is the first element in the navbar, so
// we will call output_navbar(1) to create the 'for home' navbar area.

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_callJS(jsStr) { //v2.0
  return eval(jsStr)
}

function output_menubar(Site_Area_Number, BusinessPage) {

var image_path = "http://www.possums.net.au/images/navbar/";
var number_nav_elements = 14;
var standard_button_array = new Array(14);
var links_array = new Array(14);
var alt_array = new Array(14);
var navbutton;
var navbuttonOVER;
var total_images_path = image_path;
var navbar_spacer = image_path;

navbar_spacer += 'spacer.gif';

// if(Site_Area_Number == 1) { total_images_path += 'for_business/'; } 
// else if(Site_Area_Number == 2) { total_images_path += 'partner/'; } 
// else if(BusinessPage) {total_images_path += 'for_business/';}
// else {total_images_path += 'neutral/';}



// Standard buttons can be found at 'name'+'.gif'.
// Mouseover buttons can be found at 'name'+'OVER.gif'.
// Pointer navbar buttons can be found at 'name'+'POINT.gif'.

standard_button_array[0] = "1home";
standard_button_array[1] = "2signup";
standard_button_array[2] = "3support";
standard_button_array[3] = "4webmail";
standard_button_array[4] = "spacer";
standard_button_array[5] = "6dialup";
standard_button_array[6] = "7adsl";
standard_button_array[7] = "8isdn";
standard_button_array[8] = "9hosting";
standard_button_array[9] = "spacer";
standard_button_array[10] = "11about";
standard_button_array[11] = "12contact";
standard_button_array[12] = "13itsupport";
standard_button_array[13] = "14status";

links_array[0] = "http://www.possums.net.au/";
links_array[1] = "http://www.possums.net.au/onlineapp.html";
links_array[2] = "http://support.possums.net.au/";
links_array[3] = "http://webmail.possums.net.au/";
links_array[4] = "";
links_array[5] = "http://www.possums.net.au/dialup.html";
links_array[6] = "http://www.possums.net.au/adsl.html";
links_array[7] = "http://www.possums.net.au/isdn.html";
links_array[8] = "http://www.possums.net.au/hosting.html";
links_array[9] = "";
links_array[10] = "http://www.possums.net.au/aboutus.html";
links_array[11] = "http://www.possums.net.au/contactus.html";
links_array[12] = "http://www.possums.net.au/itsupport.html";
links_array[13] = "http://cuscus.possums.net.au/bb/bb.html";

alt_array[0] = "home";
alt_array[1] = "signup";
alt_array[2] = "support";
alt_array[3] = "webmail";
alt_array[4] = "spacer";
alt_array[5] = "Dialup Access Plans";
alt_array[6] = "ADSL Access Plans";
alt_array[7] = "ISDN Access Plans";
alt_array[8] = "Web Hosting";
alt_array[9] = "spacer";
alt_array[10] = "about possums";
alt_array[11] = "contact us";
alt_array[12] = "IT support Services";
alt_array[13] = "System Status";

var this_link;
var row_output;

document.write('<table width="10">');

	for(i=0;i<number_nav_elements;i++) {

	document.write('<tr><td>');

		if(standard_button_array[i] !=  'spacer') {

			// Append the path information to the front of the image name
			// so that we can output it to the web page and the correct
			// url path to the image is present.
	
			navbutton = total_images_path;
			navbuttonOVER = total_images_path;

			navbutton += standard_button_array[i];
			navbutton += ".gif";

			navbuttonOVER += standard_button_array[i];
			navbuttonOVER += "OVER.gif";

			image_number = i+100;   // Excuse magic number - ensures there is no conflict with other images in page.
			this_alt = alt_array[i];
			this_link = links_array[i];
			row_output = '';

			// If we are about to output the button which represents the current area we are in,
			// output the button with the light blue arrow as the main and mouseover images, so
			// that it signifies what area of the site we are actually in.

			if(i == Site_Area_Number) {

				navbutton = total_images_path;
				navbuttonOVER = total_images_path;

				navbutton += standard_button_array[i];
				navbutton += "POINT.gif";

				navbuttonOVER += standard_button_array[i];
				navbuttonOVER += "POINT.gif";

			}
		
			document.write('<a href="');
			document.write(this_link);
			document.write('" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'Image');
			document.write(image_number);
			document.write('\',\'\',\'');
			document.write(navbuttonOVER);
			document.write('\',1)">');
	
			document.write('<img name="Image');
			document.write(image_number);
			document.write('" border="0" src="');
			document.write(navbutton);
			document.write('" alt="');
			document.write(this_alt);
			document.write('">');

			document.write('</a>');

		// If there is no image name specified for a row of the navbar table,
		// then it is just a break in the sequence of elements, so we output the
		// dedicated spacer image.

		} else {
		
			document.write('<img src="');
			document.write(navbar_spacer);
			document.write('">');
		}
		document.write('</td></tr>');

	}
	document.write('</table>');

}

