var __menu = false;
var __menuTimer;

showMenus = function(mn, x, y, wd) {
	clearTimeout(__menuTimer);
	hideMenus();
	mne = document.getElementById("Mn" + mn);
	/*
	if( (mn=="news") || (mn=="programs") || (mn=="about")) {
		document.getElementById("left-column").style.visibility = "hidden";
	}
	*/
	
	if (mne) {
		mne.style.top = y + "px";
		mne.style.left = x + "px";
		mne.style.width = wd + "px";
		mne.style.visibility = "visible";
		mne.style.display = "block";
		//Element.setOpacity(mne.id, 0.6);
		__menu = mne;
	}
}

hideMenuCountdown = function() {
	/*__menuTimer = setTimeout(function() {
		Effect.Fade(__menu.id, {
			duration: 0.3
		});
	}, 2500);*/
	__menuTimer = setTimeout(hideMenus, 600);
}

activeSubMenu = function(i) {
	clearTimeout(__menuTimer);
	
}

hideMenus = function() {
	document.getElementById("left-column").style.visibility = "visible";
	if (__menu != false) {
		__menu.style.visibility = "hidden";
	}
}

var __messagewin;

openImageWindow = function(image, w, h, caption) {
	hideHeader();
	w = parseInt(w) + 20;
	h = parseInt(h) + 20;
	
	__messagewin = new Window("my_messagewindow", {zIndex: 40, hideEffectOptions: {afterFinish: showHeader}, className: "dialog", title: caption,
										width: w, height: h});
	__messagewin.getContent().innerHTML = '<div style="padding: 8px; text-align: center"><img src="' + image + '" onclick="__messagewin.hide();"></div><input type="button" onclick="__messagewin.hide();" style="position:absolute; top:2px; right:2px;" value="close" />';
	__messagewin.setDestroyOnClose();
	__messagewin.showCenter(true);
}

function quotePost(content) {
	obj = document.getElementById('addPostComment');
	obj.value = "[QUOTE]\n";
	obj.value += document.getElementById(content).innerHTML;
	obj.value += '[/QUOTE]';
}

hideHeader = function() {
	document.getElementById("header").style.visibility = "hidden";
}

showHeader = function() {
	document.getElementById("header").style.visibility = "visible";
}


openLoginWindow = function(redir) {
	hideHeader();
	
	var inh = '<div style="padding: 8px; font-size: 14px">';

	inh += '<div style="width: 420px; margin: 10px auto 0px auto;">';
	inh += '<table border="0" cellspacing="0" cellpadding="0"><tr><td valign="top"><form method="post" action="' + CCM_REL + '/"><input type="hidden" name="rcURL" value="' + redir + '" /><b>Login</b><br/><br/>Username<br/><input type="text" name="uName" style="width: 180px" />';
	inh += '<br/><br/>Password<br/><input type="password" name="uPassword" style="width: 180px" /><br/><br/><input type="submit" name="login" value="Login" style="float: right" />';
	inh += '</form></td><td><div style="width: 40px">&nbsp;</div></td><td valign="top"><form method="post" action="' + CCM_REL + '/register/"><b>Create an Account</b>';
	inh += '<br/><br/>Username<br/><input type="text" name="uName" style="width: 180px" /><br/><br/>Email Address<br/><input type="text" name="uEmail" style="width: 180px" /><br/><br/>';
	inh += 'Password<br/><input type="password" name="uPassword" style="width: 180px" /><br/><br/>Confirm Password<br/><input type="password" name="uPasswordConfirm" style="width: 180px" />';
	inh += '<br/><br/><input type="checkbox" name="uak_3" style="vertical-align: middle" /> I am 14 or older and have read the terms of service.';
	inh += '<br/><br/><input type="hidden" name="_disableLogin" value="1" /><input type="hidden" name="submit" value="1" /><input type="submit" name="sub" value="Register" style="float: right" />';
	inh += '<input type="hidden" name="rcURL" value="' + redir + '" /></form></td></tr></table><br/>';
	inh += '</div>';
	inh += '</form></div><input type="button" onclick="winLR.hide();" style="position:absolute; top:2px; right:2px;" value="close" />';
	
	winLR = new Window("winLR", {zIndex: 40, className: "dialog", hideEffectOptions: {afterFinish: showHeader}, title: "Login/Register", width: 540, height: 440});
	winLR.getContent().innerHTML = inh;
	winLR.setDestroyOnClose();
	winLR.showCenter(true);
//	this.options.hideEffectOptions.afterFinish
}