
	window.onload = jDisplayBody;
	
	var sDefaultSearchText = "Achtung le search...";
	
	function jFocusSearch(oInput) {
		if (oInput.value == sDefaultSearchText) {
			oInput.value = "";
		}
	}
	
	function jBlurSearch(oInput) {
		if (oInput.value == "") {
			oInput.value = sDefaultSearchText;
		}
	}
	
	/* Submits the search form. */
	function jSubmitSearch() {
		var oInputElement = document.forms["Search"]["SearchQuery"];
		window.location = "./?sSearch=" + oInputElement.value;
		return false;
	}
	
	/* Displays the page body. */
	function jDisplayBody() {
		document.getElementById("BodyContainer").style.display = "";
	}
	
	/* Hides the ajax popup screen. */
	function jHidePopupScreen() {
		document.getElementById("AjaxPopupScreenContainer").style.visibility = "hidden";
		document.getElementById("AjaxPopupScreenContainer").style.display = "none";
		
		setTimeout("jResetPopupScreen();", 500);
	}
	
	/* Resets the ajax popup screen. */
	function jResetPopupScreen() {
		document.getElementById("AjaxPopupScreenTitle").innerHTML = "";
		document.getElementById("AjaxPopupScreenDIV").innerHTML = "";
	}	
	
	/* Shows the ajax login screen. */
	function jShowLoginScreen() {
		jAjaxRequest("./includes/ajax/member-login.ajax.php", document.getElementById("AjaxPopupScreenDIV"));
		
		document.getElementById("AjaxPopupScreenTitle").innerHTML = "Member Login";
		document.getElementById("AjaxPopupScreenContainer").style.visibility = "visible";
		document.getElementById("AjaxPopupScreenContainer").style.display = "";
	}
	
	/* Shows the ajax screen for adding an article. */
	function jShowAddArticleScreen() {
		jAjaxRequest("./includes/ajax/add-article.ajax.php", document.getElementById("AjaxPopupScreenDIV"));
		
		document.getElementById("AjaxPopupScreenTitle").innerHTML = "Add Article";
		document.getElementById("AjaxPopupScreenContainer").style.visibility = "visible";
		document.getElementById("AjaxPopupScreenContainer").style.display = "";
	}
	
	/* Shows the ajax screen for registering. */
	function jShowRegisterScreen() {
		jAjaxRequest("./includes/ajax/register.ajax.php", document.getElementById("AjaxPopupScreenDIV"));
		
		document.getElementById("AjaxPopupScreenTitle").innerHTML = "Member Registration";
		document.getElementById("AjaxPopupScreenContainer").style.visibility = "visible";
		document.getElementById("AjaxPopupScreenContainer").style.display = "";
	}
	
	/* Shows the ajax screen for modifying an article. */
	function jShowModifyArticleScreen(sArticleID) {
		jAjaxRequest("./includes/ajax/modify-article.ajax.php?sArticleID=" + sArticleID, document.getElementById("AjaxPopupScreenDIV"));
		
		document.getElementById("AjaxPopupScreenTitle").innerHTML = "Modify Article";
		document.getElementById("AjaxPopupScreenContainer").style.visibility = "visible";
		document.getElementById("AjaxPopupScreenContainer").style.display = "";
	}
	
	/* Shows a SWF file in the popup screen. */
	function jShowPopupSWF(sTitle, sSWF, iWidth, iHeight, oFlashVars, oParams, oAttributes) {
		document.getElementById("AjaxPopupScreenDIV").innerHTML = "<div id=\"AjaxPopupScreenSWF\"></div>";
		swfobject.embedSWF(sSWF, "AjaxPopupScreenSWF", iWidth, iHeight, "9", false, oFlashVars, oParams, oAttributes);
		
		document.getElementById("AjaxPopupScreenTitle").innerHTML = sTitle;
		document.getElementById("AjaxPopupScreenContainer").style.visibility = "visible";
		document.getElementById("AjaxPopupScreenContainer").style.display = "";
	}
	
	/* Shows an image in the popup screen. */
	function jShowPopupImage(sTitle, sImageURL, sCaption) {
		document.getElementById("AjaxPopupScreenContainer").style.visibility = "visible";
		document.getElementById("AjaxPopupScreenContainer").style.display = "";
		
		document.getElementById("AjaxPopupScreenDIV").innerHTML = "<img src=\"" + sImageURL + "\" title=\"" + sTitle + "\" /><div class=\"photoCaption\">" + sCaption + "</div>";
		document.getElementById("AjaxPopupScreenTitle").innerHTML = sTitle;
	}
	
	function jShowLiveWebcam(sHandle, sTitle, sWebcamID, sMediaServerURL) {
		document.getElementById("AjaxWebcamScreenDIV").innerHTML = "<div id=\"AjaxWebcamScreenSWF\"></div>";
		swfobject.embedSWF("./flash/webcam-468x350-live.swf?sMediaServerURL=" + sMediaServerURL + "&sWebcamID=" + sWebcamID, "AjaxWebcamScreenSWF", 468, 350, "9", false, {}, {}, {});
		
		document.getElementById("AjaxWebcamChatDIV").innerHTML = "<div id=\"AjaxWebcamChatSWF\"></div>";
		swfobject.embedSWF("./flash/webcam-chat.swf?sRefreshInterval=5000&sHandle=" + sHandle, "AjaxWebcamChatSWF", 259, 411, "9", false, {}, {}, {});
		
		document.getElementById("AjaxWebcamPopoutLink").innerHTML = "<a href=\"javascript:jShowLiveWebcamPopout('" + sHandle + "', '" + sTitle + "', '" + sWebcamID + "', '" + sMediaServerURL + "');\" class=\"popupCloseLink\">POPOUT</a>";
		
		document.getElementById("AjaxWebcamScreenTitle").innerHTML = sTitle;
		document.getElementById("AjaxWebcamScreenContainer").style.visibility = "visible";
		document.getElementById("AjaxWebcamScreenContainer").style.display = "";
	}
	
	function jShowLiveWebcamPopout(sHandle, sTitle, sWebcamID, sMediaServerURL) {
		window.open ("http://www.endseven.net/webcam.php?sWebcamID=" + sWebcamID + "&sMediaServerURL=" + sMediaServerURL, "WebcamWindow_" + sWebcamID, "location=0, status=0, scrollbars=0, width=768, height=542");
		jHideWebcamScreen();
	}
	
	function jShowWebcam(sTitle, sWebcamID, sRootURL, sHandle) {
		document.getElementById("AjaxWebcamScreenDIV").innerHTML = "<div id=\"AjaxWebcamScreenSWF\"></div>";
		swfobject.embedSWF("./flash/webcam-468x350.swf?sRootURL=" + sRootURL + "&sWebcamID=" + sWebcamID, "AjaxWebcamScreenSWF", 468, 350, "9", false, {}, {}, {});
		
		document.getElementById("AjaxWebcamChatDIV").innerHTML = "<div id=\"AjaxWebcamChatSWF\"></div>";
		swfobject.embedSWF("./flash/webcam-chat.swf?sRootURL=" + sRootURL + "&sWebcamID=" + sWebcamID + "&sRefreshInterval=5000&sHandle=" + sHandle, "AjaxWebcamChatSWF", 259, 411, "9", false, {}, {}, {});
		
		document.getElementById("AjaxWebcamScreenTitle").innerHTML = sTitle;
		document.getElementById("AjaxWebcamScreenContainer").style.visibility = "visible";
		document.getElementById("AjaxWebcamScreenContainer").style.display = "";
	}
	
	function jHideWebcamScreen() {
		document.getElementById("AjaxWebcamScreenContainer").style.visibility = "hidden";
		document.getElementById("AjaxWebcamScreenContainer").style.display = "none";
	}
	
	function jToggleShareThis(sArticleID) {
		document.getElementById("ShareContainer" + sArticleID).style.display = "";
	}
	
	function jToggleShareDescription(sArticleID, sValue) {
		if (sValue != "") document.getElementById("ShareDescription" + sArticleID).innerHTML = (sValue == "" ? "Share this article with someone." : sValue);
	}
	