var activeSub=0;
var SubNum=0;

function reDo(){ window.location.reload() }
    window.onresize = reDo;

    //Define global variables

	    var timerID = null;
		var timerOn = false;
		var timecount = 1000;
		var what = null;
		var newbrowser = true;
		var check = false;

    	function init(){
    	
    	//  alert ("Running Init");
          if (document.layers) {
                      //  alert ("Running Netscape 4");
                        layerRef="document.layers";
                        styleSwitch="";
                        visibleVar="show";
			screenSize = window.innerWidth;
			what ="ns4";


          }else if(document.all){
                      //  alert ("Running IE");
                        layerRef="document.all";
                        styleSwitch=".style";
                        visibleVar="visible";
			screenSize = document.body.clientWidth + 18;
			what ="ie";

		  }else if(document.getElementById){
                      //  alert ("Running Netscape 6");
                        layerRef="document.getElementByID";
                        styleSwitch=".style";
                        visibleVar="visible";
			what="moz";
		  
		  }else{
		  	//alert("Older than 4.0 browser.");
			what="none";
			newbrowser = false;
		  }
		  
 
		//window.status='status bar text to go here';
		check = true;
			if(document.getElementsByTagName){ 
	          matchColumns();		 
	     	} 

  	 	}

/* 
	// Finds the top position of an Element
      	// need to pass id of element conatining <a href> 
	function getElementTop(Elem) {
		
		if(document.getElementById) {	
			var elem = document.getElementById(Elem);
		} else if (document.all) {
			var elem = document.all[Elem];
		}
		
		var yPos = elem.offsetTop;
		tempEl = elem.offsetParent;
		alert('yPos: ' + yPos + ' - tempEl: ' + tempEl);		
		while (tempEl != null) {
  			yPos += tempEl.offsetTop;
	  		tempEl = tempEl.offsetParent;
  		}
		return yPos + 'px';
		alert(yPos)
	
	}
*/	

	// Turns the layers on and off
        function showLayer(layerName){
        	if(check){
        		if (what =="none"){
        			return;
        			}
	        	else if (what == "moz"){
        			document.getElementById(layerName).style.visibility="visible";
        			}
        		else{
                  		eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="visible"');
                  		}
		 		}
        	else {// alert ("Please wait for the page to finish loading.");
        		return;}
		}

        function hideLayer(layerName){
        	if(check){
        		if (what =="none"){
        			return;
        			}
        		else if (what == "moz"){
        			document.getElementById(layerName).style.visibility="hidden";
        			}
        		else{
                  eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="hidden"');
				}
        
        	}
        	else {// alert ("Please wait for the page to finish loading.");
        		return;}
        }

		// function hideAll adapted by Chris Hellings to pick up all layers
		function hideAll() {
    			var divNum = 1;
    			while (divEl = document.getElementById('layer' + divNum)) {
        			hideLayer(divEl.id);
        			divNum++;
    				}
			}


		function startTime() {
	        if (timerOn == false) {
                timerID=setTimeout( "hideAll()" , timecount);
                timerOn = true;

	        }

		}


		function stopTime() {
	        if (timerOn) {
    	        clearTimeout(timerID);
                timerID = null;
                timerOn = false;
	        }
		}

matchColumns=function(){ 

     var divs,contDivs,maxHeight,divHeight,d; 
	
     // get all <div> elements in the document 
     divs=document.getElementsByTagName('div'); 

     contDivs=[]; 

     // initialize maximum height value 
     maxHeight=0; 

     // iterate over all <div> elements in the document 
     for(var i=0;i<divs.length;i++){ 

          // make collection with <div> elements with class attribute 'container' (column?) 
          if(/\bcolumn\b/.test(divs[i].className)){ 

                d=divs[i]; 

                contDivs[contDivs.length]=d; 

                // determine height for <div> element 
                if(d.offsetHeight){ 

                     divHeight=d.offsetHeight; 					

                } 

                else if(d.style.pixelHeight){ 

                     divHeight=d.style.pixelHeight;					 

                } 

                // calculate maximum height 
                maxHeight=Math.max(maxHeight,divHeight); 

          } 

     } 

     // assign maximum height value to all of container (column?) <div> elements 
     for(var i=0;i<contDivs.length;i++){ 

          contDivs[i].style.height=maxHeight + "px"; 

     } 

} 		
			
function hideScriptWarning() {
		if(check){
        		if (what =="none"){
        			return;
        			}
        		else if (what == "moz"){
        			document.getElementById('ScriptWarning').style.visibility="hidden";
        			init();
        			}
        		else{
                  eval(layerRef+'["'+ScriptWarning+'"]'+styleSwitch+'.visibility="hidden"');
                  init();
				}
        
        	}
        	else {// alert ("Please wait for the page to finish loading.");
        		return;}
        }
			
function DisplayImage(picURL,picWidth,picHeight,picTitle){
				newWindow=window.open(picURL,'newWin','toolbar=no,width='+picWidth+',height='+picHeight)
				newWindow.document.write('<html><head><title>'+picTitle+'<\/title><\/head><body background="'+picURL+'"><\/body><\/html>')
				newWindow.resizeBy(picWidth-newWindow.document.body.clientWidth,picHeight-newWindow.document.body.clientHeight)
				newWindow.focus()
				}