function preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.p) d.p=new Array();
    var i,j=d.p.length,a=preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.p[j]=new Image; d.p[j++].src=a[i];}}
}

function swapImgRestore() { //v3.0
  var i,x,a=document.sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function 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=findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function swapImage() { //v3.0
  var i,j=0,x,a=swapImage.arguments; document.sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=findObj(a[i]))!=null){document.sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function openWindow(theURL,winName,features) {
	window.open(theURL,winName,features);
}



function openBrWindow(theURL,winName,features) { 
  window.open(theURL,winName,features);
}



function doNav (URL) {
	window.open(URL,'preferred_website');
	window.close();
}

function writeText(textToWrite) {
	window.whiteboard.innerHTML = textToWrite;
}

function writeComments(textToWrite) {
	window.whiteboard2.innerHTML = textToWrite;
}

function jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}


function jumpMenuGo(selName,targ,restore){ //v3.0
  var selObj = findObj(selName); if (selObj) jumpMenu(targ,selObj,restore);
}



document.mas = new Object();
document.mas.hirelist = new Object();
document.mas.hirelist.expandos = new Array();
document.mas.hirelist.heights = new Array();
document.mas.hirelist.names = new Array();

function mas_toggle(id) {
  if (document.all){
    if(document.all[id].style.display == 'none'){
      document.all[id].style.display = '';
    } else {
      document.all[id].style.display = 'none';
    }
  } else if (document.getElementById){
    if(document.getElementById(id).style.display == 'none'){
      document.getElementById(id).style.display = 'block';
    } else {
      document.getElementById(id).style.display = 'none';
    }
  } else if(document.layers) {
      if(parseInt(id + 1)){
	  ditem = id + 1;
      } else {
	  ditem = document.mas.hirelist.names[id];
      }
      if(document.mas.hirelist.expandos[ditem].clip.bottom == 0) {
	     document.mas.hirelist.expandos[ditem].clip.bottom = document.mas.hirelist.heights[ditem];
      } else {
	  document.mas.hirelist.expandos[ditem].clip.bottom = 0;
      }
      mas_align();
  }
}

function mas_align() {
    var i,j,stupid_netscape_array_infinate_loop_error;
    stupid_netscape_array_infinate_loop_error = document.mas.hirelist.expandos.length;
    for(i=0; i<stupid_netscape_array_infinate_loop_error; i++) {
		j = i + 1;
		if(document.mas.hirelist.expandos[j]){
	    	if(document.layers) {
				document.mas.hirelist.expandos[j].top = document.mas.hirelist.expandos[i].top + document.mas.hirelist.expandos[i].clip.bottom;
	   		}
		}
    }
}

function mas_initialize_toolbar(){
    if(document.layers) {
		for(i=0; i<document.layers['container'].document.layers.length; i++){
	    	document.mas.hirelist.expandos[i] = document.layers['container'].document.layers[i];
	    	document.mas.hirelist.names[document.layers['container'].document.layers[i].name] = i;
	    	document.mas.hirelist.heights[i] = document.mas.hirelist.expandos[i].clip.bottom;
		}
		for (p=0;p<document.mas.hirelist.expandos.length;p=p+2){
	    	mas_toggle(p);
		}
		document.layers['container'].visibility = 'visible';
    } else if (document.all){
		for(i = 0; i < document.all('container').all.length; i++){
		    document.all('container').all[i].style.position = 'relative';
		    if(document.all('container').all[i].className == 'menu'){
			document.all('container').all[i].style.display = 'none';
		    }
		}
		document.all('container').style.visibility = 'visible';
    } else if (document.getElementsByTagName && document.getElementById){
		var contained = document.getElementById('container').getElementsByTagName('div');
		for(i = 0; i < contained.length; i++){
		    contained[i].style.position = 'relative';
		    if(contained[i].getAttribute('class') == 'menu'){
			contained[i].style.display = 'none';
		    }
		}
		document.getElementById('container').style.visibility = 'visible';
    }
}

function mas_imageToggle(daImage, src1, src2, netscape_container){
  var objStr,obj;
  // Check to make sure that images are supported in the DOM.
	  myImage = document.images[daImage];
  if(document.layers){
      myImage = document.layers['container'].document.layers[netscape_container].document.images[daImage];
  }
  if(document.images){
    // Check to see whether you are using a name, number, or object
      if(myImage.src == src1){
	  	myImage.src = src2;
      } else {
	  	myImage.src = src1;
      }
  }
}
