function parentnum(){
	var parentboard = document.getElementById("boardnumber").value;
	return(parentboard.charAt(0));
}
function readcode(code) {
	document.getElementById("speakerbox").src = 'http://tools.boardhost.com/audio_verify.cgi?' + code + '&1';
	document.getElementById("speakerbox").style.display="";
	document.getElementById("verify_word").focus();
}
function checktabname() {
	if (!document.getElementById("tabname").value) { 
		alert("Please enter a name for your new tab.");
		return false;
	}
	var chars = /^[\w\s_\-'&!\.\?\,@\*\(\)\/]+$/;
	if (!chars.test(document.getElementById("tabname").value)) {
		alert("Your tab name contains characters that are not permitted.\n\nPlease enter letters, numbers, spaces and punctuation only.");
		return false;
	}
}
function checktopicname() {
	if (!document.getElementById("subtopicnamefield").value) { 
		alert("Please enter a name for your new topic.");
		return false;
	}
	var chars = /^[\w\s_\-'&!\.\?\,@\*\(\)\/]+$/;
	if (!chars.test(document.getElementById("subtopicnamefield").value)) {
		alert("Your topic name contains characters that are not permitted.\n\nPlease enter letters, numbers, spaces and punctuation only.");
		return false;
	}
}
function logincancel() {
	document.getElementById("cover").style.display = "none";
	document.getElementById("loginbox").style.display = "none";
	document.getElementById("loginbutton").style.borderStyle = "outset";
}
function setcollapsed(username,board) {
	var date = new Date();
	date.setTime(date.getTime()+(365*24*60*60*1000));
	var expires = "; expires="+date.toGMTString();

	document.cookie = "ec=c"+expires+";path=/";
	var r = Math.random();
	window.location = "http://" + username + ".boardhost.com/" + board + "/?" + r;
}
function setexpanded(username,board) {
	var date = new Date();
	date.setTime(date.getTime()+(365*24*60*60*1000));
	var expires = "; expires="+date.toGMTString();

	document.cookie = "ec=e"+expires+";path=/";
	var r = Math.random();
	window.location = "http://" + username + ".boardhost.com/" + board + "/?" + r;
}
function cookiecheck(username) {
	document.cookie = "test=1"; 
	var foundcookie = GetCookie("test");
	if (!foundcookie) {
		window.location = "http://" + username + ".boardhost.com/cookies.cgi";
		return false;
	}
	else { return true }
}
function poll() {
	document.getElementById("hiddenpoll").style.display = "";
	document.getElementById("pollbutton").style.display = "none";
	document.getElementById("pollpost").value = "1";
}
function pollcancel() {
	document.getElementById("hiddenpoll").style.display = "none";
	document.getElementById("pollbutton").style.display = "";
	document.getElementById("pollpost").value = "0";
}
function search(o) {
	if (document.getElementById("adminsettingsform")) {
		document.getElementById("adminsettingsform").style.display = "none";
	}
	if (document.getElementById("adminsubtopicform")) {
		document.getElementById("adminsettingsform").style.display = "none";
	}
	if (document.getElementById("adminheaderform")) {
		document.getElementById("adminsettingsform").style.display = "none";
	}
	var pos = Position.get(o);
	Position.set('searchform',(pos.left-290),(pos.top+16));
	document.getElementById("cover").style.display = "";
	var pos = Position.get(document.getElementById("bottomofpage"));
	var height = pos.top;
	var height2 = document.body.clientHeight; if (height2 > height) { var height = height2; }
	document.getElementById("cover").style.height = height;
	document.getElementById("searchform").style.display = "";
	document.getElementById("searchbutton").style.borderStyle = "inset";
	document.getElementById("searchterms").focus();
}
function searchcancel() {
	document.getElementById("cover").style.display = "none";
	document.getElementById("searchform").style.display = "none";
	document.getElementById("searchbutton").style.borderStyle = "outset";

}
/////////////////////////////////////////////////////////////
// Written by: Bill Dortch, hIdaho Design <bdortch@netw.com>
// The following functions are released to the public domain.
function getCookieVal (offset) {
         var endstr = document.cookie.indexOf (";", offset);
            if (endstr == -1)
            endstr = document.cookie.length;
         return unescape(document.cookie.substring(offset, endstr));
         }

function GetCookie (name) {
         var arg = name + "=";
         var alen = arg.length;
         var clen = document.cookie.length;
         var i = 0;
         while (i < clen) {
         var j = i + alen;
             if (document.cookie.substring(i, j) == arg)
             return getCookieVal (j);
         i = document.cookie.indexOf(" ", i) + 1;
             if (i == 0) break;
             }

     return null;
     }
// End cookie code
/////////////////////////////////////////////////////////////
