// JavaScript Document
//image overs
var image1On = new Image()
image1On.src ="images/buttons/bt_about2.gif"

var image2On = new Image()
image2On.src ="images/buttons/sub/bt_guides2.gif"

var image3On = new Image()
image3On.src ="images/buttons/bt_trips2.gif"

var image4On = new Image()
image4On.src ="images/buttons/bt_adven2.gif"

var image5On = new Image()
image5On.src ="images/buttons/bt_blog2.gif"

var image6On = new Image()
image6On.src ="images/buttons/bt_test2.gif"

var image7On = new Image()
image7On.src ="images/buttons/bt_gallery2.gif"

var image8On = new Image()
image8On.src ="images/buttons/bt_prep2.gif"

var image9On = new Image()
image9On.src ="images/buttons/bt_faq2.gif"

var image10On = new Image()
image10On.src ="images/buttons/bt_contact2.gif"

//sub buttons

var image11On = new Image()
image11On.src ="images/buttons/sub/bt_gear2.gif"

var image12On = new Image()
image12On.src ="images/buttons/sub/bt_safety2.gif"

var image13On = new Image()
image13On.src ="images/buttons/sub/bt_registration2.gif"

var image14On = new Image()
image14On.src ="images/buttons/sub/bt_legal2.gif"

var image15On = new Image()
image15On.src ="images/buttons/sub/bt_travel2.gif"

var image16On = new Image()
image16On.src ="images/buttons/sub/bt_links2.gif"

var image17On = new Image()
image17On.src ="images/buttons/sub/bt_friends2.gif"

var image18On = new Image()
image18On.src ="images/buttons/sub/bt_guided2.gif"

var image19On = new Image()
image19On.src ="images/buttons/sub/bt_resort2.gif"

var image20On = new Image()
image20On.src ="images/buttons/bt_home2.gif"
// replaces an images with the specified image preloaded above 
function Roll(theImage, theObject)
 {
document.images[theImage].src=theObject.src
}
function RollOut(theImage, imageName)
{
document.images[theImage].src=imageName
}

// Admin form change

function Changesubsection() {
	sectionIndex= document.forms[0].section.selectedIndex;
	if (sectionIndex == null) return;
	var subsection = new Array();
	subsection["Europe"] = new Array("Austria", "Northern Italy", "Switzerland");
	subsection["Argentina"] = new Array("The Andes - Ski Resorts", "Buenos Aires", "Iguazu Falls", "Patagonia", "Cordoba \ Mendoza");
	subsection["South America"] = new Array("Brazil", "Chile", "Uruguay");
	subsection["Utah"] = new Array("Ski Resorts", "Backcountry Adventures", "National Parks \ Canyons");
	
	
	var subsectionSelect, thissection;
	
	if(sectionIndex == 0)
	{ 
		subsectionSelect = subsection["all"];
		}
		else {
			thissection = document.forms[0].section.options[sectionIndex].value;
			subsectionSelect = subsection[thissection];
		}
		//empty default options
		for (i=document.forms[0].subsection.length-1; i>0; i--)
		{
			document.forms[0].subsection.options[i] = null;
			
		}
			//create new options
			for (i = 1; i < subsectionSelect.length +1; i++)
			{
				document.forms[0].subsection.options[i] = new 
				Option(subsectionSelect[i-1]);
				document.forms[0].subsection.options[i].value = subsectionSelect[i-1];
			}
		}
		

//menu dropdown
var timer
var currentMenu
function CloseMenus(){
	clearTimeout(timer)
	document.getElementById("mone").style.top="-150px"
	document.getElementById("mtwo").style.top="-61px"
	document.getElementById("mthree").style.top="-150px"
	//document.getElementById("mfour").style.top="-120px"
}

function StartTimer(){
	timer=setTimeout("CloseMenus()",500)
}

function MaintainMenu(){
	clearTimeout(timer)
}

function OpenMenu(which){
	clearTimeout(timer)
	currentMenu=document.getElementById(which).style
	if(parseInt(currentMenu.top) < -1)
	{
		CloseMenus()
		DropMenuDOM()
	}
	
}

function DropMenuDOM(){
	if(parseInt(currentMenu.top)< -8)
	{
		currentMenu.top=parseInt(currentMenu.top)+5+"px"
		setTimeout("DropMenuDOM()",10)
	} else {
		currentMenu.top="0px"
	}
}


var  current=1
var next=2
function MoveLayers(){
	x=document.getElementById("message"+current).style
	y=document.getElementById("message"+next).style
	x.top = parseInt(x.top) - 5 + "px"
	y.top = parseInt(y.top) - 5 + "px"
	if (parseInt(x.top) > -30)
	{
		setTimeout ("MoveLayers()",50)
	}
	else
	{
	y.top="5px"
	x.top="35px"
	current=next
	next++
	if(next>3)
	{
			next=1
	}
	setTimeout("MoveLayers()",2000)
	}
}