var activeSub=0;
var SubNum=0;
var browser=navigator.appName;
var version=parseInt(navigator.appVersion);
var speed=1;
var iens6=document.all||document.getElementById;
var ns4=document.layers;

function reDo(){
    window.location.reload();
    winResize();
}


//Define global variables
var timerID = null;
var timerOn = false;
var timecount = 500;
var what = null;
var newbrowser = true;
var check = false;
var preloadFlag = 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='Active Giving';
    check = true;
}

function Is() {
  agent = navigator.userAgent.toLowerCase();
  this.major = parseInt(navigator.appVersion);
  this.minor = parseFloat(navigator.appVersion);
  this.ns = ((agent.indexOf('mozilla') != -1) && ((agent.indexOf('spoofer')
  == -1)
     && (agent.indexOf('compatible') ==  -1)));
  this.ns2 = (this.ns && (this.major == 3));
  this.ns3 = (this.ns && (this.major == 3));
  this.ns4b = (this.ns && (this.major == 4) && (this.minor <= 4.03));
  this.ns4 = (this.ns && (this.major == 4));
  this.ns6 = (this.ns && (this.major >= 5));
  this.ie = (agent.indexOf("msie") != -1);
  this.ie3 = (this.ie && (this.major < 4));
  this.ie4 = (this.ie && (this.major == 4) && (agent.indexOf("msie 5.0")
   == -1));
  this.ie5 = (this.ie && (this.major == 4) && (agent.indexOf("msie 5.0")
   != -1));
  this.ie55 = (this.ie && (this.major == 4) && (agent.indexOf("msie 5.5")
   != -1));
  this.ie6 = (this.ie && (agent.indexOf("msie 6.0")!=-1) );
  this.aol = (agent.indexOf("aol") != -1);
  this.aol3 = (this.aol && this.ie3);
  this.aol4 = (this.aol && this.ie4);
  this.aol5 = (this.aol && this.ie5);
}

var is = new Is();

function winResize() {
  if(is.ns4 ||is.ns6||is.ie4||is.ie5||is.ie55||is.ie6) {
    history.go(0);
  }
}



function newImage(arg) {
  if (document.images) {
    rslt = new Image();
    rslt.src = arg;
    return rslt;
  }
}

function changeImages() {
  if (document.images && (preloadFlag == true)) {
    for (var i=0; i<changeImages.arguments.length; i+=2) {
        document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
    }
  }
}


function preloadImages() {
  if (document.images) {
    menu_over = newImage("/images/menu-over.gif");
    preloadFlag = true;
  }
}


// Turns the layers on and off
function showLayer(layerName){
    
    //alert (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(){
    hideLayer('event-menu');
    hideLayer('travel-menu');
    hideLayer('course-menu');
    hideLayer('story-menu');
    hideLayer('train-menu');
    hideLayer('merchandise-menu');
}


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


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

//specify speed of scroll (greater=faster)
   							
							function movedown()
							{
							//if (iens6)
								//{
									//if (parseInt(crossobj.style.top)>=(contentheight*(-1)+100))
									//{
                    					//crossobj.style.top=parseInt(crossobj.style.top)-speed+"px";
									//}
									//else
									//{
										//crossobj.style.top='0px';
									//}
				     			//}
								
                  				//else if (ns4&&crossobj.top>=(contentheight*(-1)+100))
								//{
                    				//crossobj.top-=speed;
								//}
	                   			//movedownvar=setTimeout("movedown()",50);
								
              				}
							
							function getcontent_height()
			  				{
              					//if(iens6)
								//{
                 					//contentheight=crossobj.offsetHeight;
								//}
                				//else if(ns4)
								//{
                 					//document.nscontainer.document.nscontent.visibility="show";
								//}
								
								//if(iens6)
								//{
                 				//	contentheight5=crossobj5.offsetHeight;
								//}
                				//else if(ns4)
								//{
                 					//document.nscontainer5.document.nscontent5.visibility="show";
								//}
             				} 
							
		
