
// Cache IPIX Header Images
hdr1 = new  Image();
hdr1.src = "/scenic-route/images/arr_scenic_ipix_hdr_01.gif";

hdr2 = new  Image();
hdr2.src = "/scenic-route/images/arr_scenic_ipix_hdr_02.gif";

hdr3 = new  Image();
hdr3.src = "/scenic-route/images/arr_scenic_ipix_hdr_03.gif";

hdr4 = new  Image();
hdr4.src = "/scenic-route/images/arr_scenic_ipix_hdr_04.gif";

hdr5 = new  Image();
hdr5.src = "/scenic-route/images/arr_scenic_ipix_hdr_05.gif";

hdr6 = new  Image();
hdr6.src = "/scenic-route/images/arr_scenic_ipix_hdr_06.gif";

hdr7 = new  Image();
hdr7.src = "/scenic-route/images/arr_scenic_ipix_hdr_07.gif";

hdr8 = new  Image();
hdr8.src = "/scenic-route/images/arr_scenic_ipix_hdr_08.gif";


// CACHE NAV IMAGES
images_array = new Array(7);
images_array_r = new Array(7);
for (i=1; i<7; i++)
{
   images_array[i] = new Image();
   images_array[i].src="/scenic-route/images/arr_scenic_nav0" + i + "a.gif";
   
   images_array_r[i] = new Image();
   images_array_r[i].src="/scenic-route/images/arr_scenic_nav0" + i + "b.gif";
}


function hiLite(name, source)
{
	if(document.images[name].src != source)
      document.images[name].src = eval(source + ".src");
}

// MAIN FUNCTION
function ChangeState(inputID)
{
	var map_name;
	for (i=1; i<7; i++) // LOOP THROUGH MAP OVERLAYS (if number changes change the loop count)
	{
		map_name = "map" + i;
		document.getElementById(map_name).style.visibility = "hidden";
		//else if(document.images) document.images[image_name].src = images_array[i].src;
	}

	document.getElementById("map" + inputID).style.visibility = "visible";//Show map route
	
	//hiLite(nava, source)
	swapOut(inputID);// Change nav image
	ChangePhotoGroup(inputID);// Change right side photo's
	window.if2.location.href = 'ipix-text.asp?id=' + inputID;
}

//CHANGE NAV IMAGES
function swapOut(num)
{
var image_name;
	for (i=1; i<7; i++)
	{
		image_name = "image" + i;
			document.getElementById(image_name).src = images_array[i].src;
			//else if(document.images) document.images[image_name].src = images_array[i].src;
	}
	return swap(num);
}

function swap(num)
{
    image_name = "image" + num;
	    document.getElementById(image_name).src = images_array_r[num].src;
	    //else if(document.images) document.images[image_name].src = images_array_r[num].src;
		 return true;
}

//CHANGE IPIX FUNCTION
function ChangeIpix(inputID){
	window.if1.location.href = 'ipix.asp?id=' + inputID;
	hiLite('hdr','hdr' + inputID);
	//ChangePhotoGroup(inputID);
}


// Change right hand photo group 
function ChangePhotoGroup(inputID)
{
	for (i=1; i<7; i++) // LOOP THROUGH Photo Groups (if number changes change the loop count)
		{
		group_name = "photo" + i;
			if(document.getElementById) document.getElementById(group_name).style.visibility = "hidden";
			//else if(document.images) document.images[image_name].src = images_array[i].src;
	}

//alert(document.getElementById("photo" + inputID));
	document.getElementById("photo" + inputID).style.visibility = "visible";
}


//CHANGE INDIVIDUAL PHOTO WITHIN GROUP
function ChangePhoto(inputID,photo,captionText){
		document.getElementById("photocaption" + inputID).innerHTML = captionText;
		cap = new  Image();
		cap.src = "/scenic-route/images/photos/" + photo;
      document.images['photoGroup' + inputID].src = cap.src;
}

function ShowLayer(divID) {	
	if (document.getElementById) document.getElementById(divID).style.visibility = 'visible';			
	else if (document.layers) document.layers[divID].visibility = 'show';
	else document.all(divID).style.visibility = 'visible';		
}

function ShowLayer(divID) {
	if (document.getElementById) document.getElementById(divID).style.visibility = 'hidden';			
	else if (document.layers) document.layers[divID].visibility = 'hide';
	else document.all(divID).style.visibility = 'hidden';		
}
var alternateContent;