<!--

// Flash embed function

	function embedFlashMovie(getPath,getWidth,getHeight,getTransparency,getMode) {
		// embed flash movie
		flashString = "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http:\/\/download.macromedia.com\/pub\/shockwave\/cabs\/flash\/swflash.cab#version=6,0,29,0' width='" + getWidth + "' height='" + getHeight + "'>";
		flashString += "<param name='movie' value='" + getPath + "'><param name='quality' value='high'>";
		if(getTransparency) flashString += "<param name='wmode' value='transparent'>";
		flashString += "<embed src='" + getPath + "' ";
		if(getTransparency) flashString += "wmode='transparent' ";
		flashString += "quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='" + getWidth + "' height='" + getHeight + "' \/>";
		flashString += "<\/object>";
		// if getMode = 0 return string, else write string to document
		if(getMode == 0) return flashString
		else document.write(flashString);
	}
	
// Sound functions

	
	
	function doSoundFX() {
		// plays bell tree sound effect
		if (flash.ver[7]) {
			document.getElementById("soundFX").innerHTML = embedFlashMovie("\/flash\/sound_effect.swf?fx=1",1,1,true,0);
		}
	}
	
	function killSoundFX() {
		document.getElementById("soundFX").innerHTML = " ";
	}
	
	function initSoundFX() {
		// cache sound fx flash movie by loading it at start, but not triggering sound
		if (flash.ver[7]) document.getElementById("soundFX").innerHTML = embedFlashMovie("\/flash\/sound_effect.swf?fx=0",1,1,true,0);
	}

// Function to check if a field string is empty
	
	function isEmptyField(srcField) {
		srcText = srcField.value;
		srcText = srcText.replace(/^\s+/g, '').replace(/\s+$/g, '');
		if(srcText == "") {
			srcField.value = "";
			return true;
		} else return false;
	}
	
// Function to set object position in CSS
	
	function setPos(getObject, getX, getY) {
		if(getObject.style.posTop) {
			getObject.style.posLeft = getX;
			getObject.style.posTop = getY;
		} else {
			getObject.style.left = getX + "px";
			getObject.style.top = getY + "px";
		}
	}
	
// Log-in form

	var initPasswordText = "Password...";
	
	function checkPasswordField(fieldMode) {
		if(fieldMode) {
			// enters field
			if(document.getElementById("loginPW").value == initPasswordText) document.getElementById("loginPW").value = "";
		} else {
			// exits field
			if(isEmptyField(document.getElementById("loginPW"))) document.getElementById("loginPW").value = initPasswordText;
		}
	}

	function checkLogin() {
		getPassword = document.getElementById("loginPW").value;
		if(isEmptyField(document.getElementById("loginPW")) || getPassword == initPasswordText) {
			alert("You have not entered a password!");
			return false;
		} else {
			if(getPassword == "whisper") {
				secretLevel = 1;
				showSecretContent();
				doSoundFX();
				return false;
			} else if(getPassword == "darkness") {
				secretLevel = 2;
				showSecretContent();
				doSoundFX();
				return false;
			} else if(getPassword == "senses") {
				window.location = "kts_register.asp";
				return false;
			} else {
				alert("This is not the correct password!");
				document.getElementById("loginPW").value = "";
				return false;
			}
		}
	}
	
// Secret reveal

	var header;
	var headerHeight;
	var blankOut;
	var blankDepth;
	var secretLevel = 0;

	function showSecretContent() {
		if(secretLevel == 1) {
			document.getElementById("jsPlacebo").innerHTML = "<img src='\/includes\/kts_secret_on.asp?x=" + Math.floor(Math.random() * 9999999) + "'>";
		} else if(secretLevel == 2) {
			document.getElementById("jsPlacebo").innerHTML = "<img src='\/includes\/kts_secret2_on.asp?x=" + Math.floor(Math.random() * 9999999) + "'>";
		}
		setTimeout("hideInitialHeader()",500);
		return true;
	}
	
	function hideInitialHeader() {
		header = document.getElementById("initialHeader");
		headerHeight = header.offsetHeight;
		yStep = headerHeight / 20;
		delay = 0;
		for(i=1;i<= 20;i++) {
			setTimeout("setPos(header,0," + (0 - (i*yStep)) + ");", delay);
			delay += 30;
		}
		setTimeout("fadeInBlank()", delay);
	}
	
	function getBlankDepth() {
		blankOut = document.getElementById("blankOut");
		// set imageViewer container dimensions + offsets
		if (window.innerHeight && window.scrollMaxY) {	
			blankDepth = window.innerHeight + window.scrollMaxY;
		} else if (document.body.scrollHeight > document.body.offsetHeight) {
			blankDepth = document.body.scrollHeight;
		} else {
			blankDepth = document.body.offsetHeight;
		}
		blankOut.style.height = blankDepth + "px";
	}
	
	function fadeInBlank() {
		getBlankDepth();
		blankOut.style.display = "block";
		delay = 0;
		for(i=1;i<=100;i+=1) {
			setTimeout("blankOut.style.opacity = " + i/100 + ";", delay);
			setTimeout("blankOut.style.MozOpacity = " + i/100 + ";", delay);
			setTimeout("blankOut.style.filter = 'alpha(opacity=" + i + ")';", delay);
			delay += 20;
		}
		setTimeout("swapContent()", delay);
	}
	
	function swapContent() {
		document.getElementById("initialContent").style.display = "none";
		if(secretLevel == 1) {
			document.body.className = "secret";
			document.getElementById("secretContent").style.display = "block";
		} else if(secretLevel == 2) {
			document.body.className = "secret2";
			document.getElementById("secretContent2").style.display = "block";
		} 
		setTimeout("fadeOutBlank()", 500);
	}
	
	function fadeOutBlank() {
		delay = 0;
		for(i=99;i>=0;i-=1) {
			setTimeout("blankOut.style.opacity = " + i/100 + ";", delay);
			setTimeout("blankOut.style.MozOpacity = " + i/100 + ";", delay);
			setTimeout("blankOut.style.filter = 'alpha(opacity=" + i + ")';", delay);
			delay += 20;
		}
		setTimeout("blankOut.style.display = 'none';", delay);
	}
	
	
// pop-up code

	var popupActive = false;
	var getURL = "";
	var popUp;
	
	function openPopUp(getURL) {
		getURL = getURL.href;
		popUp = document.getElementById("popUp");
		// get scroll offset
		yOffset = 0
		if (self.pageYOffset) {
			yOffset = self.pageYOffset;
		} else if (document.documentElement && document.documentElement.scrollTop) {
			yOffset = document.documentElement.scrollTop;
		} else if (document.body) {
			yOffset = document.body.scrollTop;
		}
		// get window dimensions
		myHeight = 0;
		myWidth = 0;
		if(typeof( window.innerWidth ) == 'number' ) {
			//Non-IE
			myWidth = window.innerWidth;
			myHeight = window.innerHeight;
		} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
			//IE 6+ in 'standards compliant mode'
			myWidth = document.documentElement.clientWidth;
			myHeight = document.documentElement.clientHeight;
		} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
			//IE 4 compatible
			myWidth = document.body.clientWidth;
			myHeight = document.body.clientHeight;
		}
		// set vertical offset for panel
		if(window.XMLHttpRequest) {
			panelY = (myHeight-431)/2;
		} else {
			panelY = ((myHeight-431) /2) + yOffset;
		}
		if(popUp.style.posTop) {
			popUp.style.posTop = panelY;
		} else {
			popUp.style.top = panelY + "px";
		}
		// populate container
		popUp.style.display = "block";
		popupContent = "<div id='popupViewer'><a id='closeButton' href='javascript:closePopUp()'><span>close window<\/span><\/a>";
		popupContent += "<iframe frameborder='0'><\/iframe><\/div>";
		popUp.innerHTML = popupContent;
		// load page content
		document.getElementById("popupViewer").getElementsByTagName("IFRAME")[0].src = getURL + "?x=" + Math.floor(Math.random() * 999999);
	}

	function doPopUp(getURL) {
		// reset blank
		if(!popupActive) {
			getBlankDepth();
			blankOut.style.opacity = 0;
			blankOut.style.MozOpacity = 0;
			blankOut.style.filter = "alpha(opacity=0)";
			blankOut.style.display = "block";
			// fade up blank
			delay = 0;
			for(i=5;i<=80;i+=5) {
				setTimeout("blankOut.style.opacity = " + i/100 + ";", delay);
				setTimeout("blankOut.style.MozOpacity = " + i/100 + ";", delay);
				setTimeout("blankOut.style.filter = 'alpha(opacity=" + i + ")';", delay);
				delay += 20;
			}
			// open pop-up
			openPopUp(getURL);
			popupActive = true;
		}
		// return false
		return false;
	}
	
	function closePopUp() {
		getURL = "";
		popUp.innerHTML = "";
		popUp.style.display = "none";
		// fade up blank
		delay = 0;
		for(i=75;i>=0;i-=5) {
			setTimeout("blankOut.style.opacity = " + i/100 + ";", delay);
			setTimeout("blankOut.style.MozOpacity = " + i/100 + ";", delay);
			setTimeout("blankOut.style.filter = 'alpha(opacity=" + i + ")';", delay);
			delay += 20;
		}
		setTimeout("blankOut.style.display = 'none';popupActive = false;", delay);
	}


// -->

