// ***********************
// 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


// ***********************
// 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'; 

		changeSRC('title', title);
		changeSRC('content', content);
	} else {
		changeSRC('title', './siteimgs/ttlhome.gif')
		changeSRC('content', './pages/pghome.htm')
	}
}


