// ***********************
// IN THIS INCLUDE FILE:
// ***********************
// changeSRC(name,URL) 	- function to change the source of an element (i.e. iframe, title, etc)
// getParam()		- gets the required parameters from the querystring

// ***********************
// VARIABLES:
// ***********************

var objWindow;

// Values set by mouseOver/Exit to control iframe scrolling
var okscroll = false;
var godown = false;



// ***********************
// FUNCTIONS:
// ***********************


function changeSRC(name,URL) {
	// Store browser specific javascript in vars
	if (document.all) {
		var obj = document.all[name];
	} else if (document.getElementById) {
		var obj = document.getElementById(name);
	}		


	if (obj != null) {
		obj.src = URL;
	}
}


function getParam() {
// ****
// returns the query string value for the supplied key
// e.g.		page.htm?key=value
//			getParam("key") = "value"
// ****

	var param = location.search.substring(1).indexOf("page=");

	// check if there is the specified parameter has been 
	// passed into the page and a valid key was supplied
	if (param != -1) {
		var paramStart = param + 6;
		var paramEnd = location.search.substring(0).indexOf("&", paramStart);
		if (paramEnd == -1) {
			paramEnd = location.search.substring(0).length;
		}
		var result = location.search.substring(0).substring(paramStart, paramEnd);
		result = unescape(result);

		while (result.indexOf("+") >= 0) {
			result = result.replace("+"," ");
		}
		var query = true;
	} else {
		var query = false;
	}


	if (query == true) {
		var title = './siteimgs/ttl' + result + '.gif';
		var content = './pages/pg' + result + '.htm'; 
		var images = './pages/img' + result + '.htm'; 

		changeSRC('title', title);
		changeSRC('content', content);
		changeSRC('images', images);
	} else {
		parent.document.location = './index.htm'
	}
}


function scrollpage() {
	// Find and store browser specific iFrame object
	if (objWindow == null) {	
		if (document.all) {
			objWindow = document.all['images'];
		} else if (document.getElementById) {
			objWindow = document.getElementById('images');
		}
	}


	if (okscroll && (objWindow != null)) {
		if (godown) {
			objWindow.contentWindow.scrollBy(0, 4);
		} else {
			objWindow.contentWindow.scrollBy(0, -4);
		}
	}
	setTimeout('scrollpage()', 40);
}



scrollpage();


