/* DO NOT COPY PASTE */
var path = "../images/";  //Path to the image folder

var url = "../presentations/play.php";  //Path to the tutorials page
var width = 969;
var height = 714;

function isIELessThan8() {
	if (window.navigator.appName == 'Microsoft Internet Explorer') {
		var ieVersion = window.navigator.appVersion.toLowerCase();
		if (ieVersion.search(/msie 8.0/) != -1) {
			return false;
		}
		return true;
	}
}

function changeImage(obj, newImage) {
	obj.src=path + newImage;
}

//evt1 - Event for IE and Opera
//evt2 - Event for Mozilla- and WebKit-based browsers
function addListener(obj, func, evt1, evt2) {
	if (obj.attachEvent) { //IE and Opera
		obj.attachEvent(evt1, func);
	}
	else { // Mozilla and WebKit
		obj.addEventListener(evt2, func, true);
	}
}

function transform(obj, hidden, visible) {		
	var childDiv = obj.parentNode;
	
	//Each iteration searches the parent node for a div at index 0.  If no div element is found, the next iteration will go up another node.
	while (childDiv.getElementsByTagName("div")[0] == null) {
		childDiv = childDiv.parentNode;
	}  
	childDiv = childDiv.getElementsByTagName("div")[0];
	
	switch (childDiv.style.display) {
		case "none":
		obj.firstChild.data = visible;
		childDiv.style.display = "block";
		break;
		
		case "block":
		obj.firstChild.data = hidden;
		childDiv.style.display = "none";
		break;
		
		default:  //Used on initial page load
		obj.firstChild.data = visible;
		childDiv.style.display = "block";
	}
}	

//Creates new window with specified parameters and query strings that are handled by "url"
function play(file) {
	var left = (screen.width - width) / 2;
	var top = (screen.height - height) / 2;
	window.open(url + "?File=" + file + "&Width=" + width + "&Height=" + height, "_blank", "toolbar=no, height=" + (height + 50) + ", width=" + (width + 50) + ", left=" + left + ", top=" + top + ", screenX=0, screenY=0");
}

function navigateTo(id, query) {	
	var obj = document.getElementById(id);
	var value = obj[obj.selectedIndex].value;
	if (value) {
		window.location.replace('?' + query + '=' + value);	
	}
}

function getValueAndNavigateTo(id, query) {	
	var obj = document.getElementById(id);
	var value = obj.value;
	if (value) {
		window.location.replace('?' + query + '=' + value);	
	}
	else {
		window.location.replace('?' + query + '=');	
	}
}