	function checklogin(){
		if (document.login.username.value == ""){
			alert("Please enter a username.");
			return false;
		}
		if (document.login.password.value == ""){
			alert("Please enter a password.");
			return false;
		}
	}

	function submitonce(theform){
		if (document.all||document.getElementById){
			for (i=0;i<theform.length;i++){
				var tempobj=theform.elements[i]
				if(tempobj.type.toLowerCase()=="submit"||tempobj.type.toLowerCase()=="reset")
					tempobj.disabled=true
			}
		}
	}

	function vbl_refresh(letter, typeTitle, pageName){
		if (typeTitle != ''){
			window.location = pageName+'char='+letter+'&typeTitle='+typeTitle;
		} else {
			window.location = pageName+'char='+letter;
		}
	}

	function row_hover( tableCellRef, hoverFlag) {
		if ( hoverFlag ) {
			tableCellRef.style.backgroundColor = '#FFFFCC';
		} else {
			tableCellRef.style.backgroundColor = bgColor;
		}
	}

	function row_hover2 ( tableCellRef, hoverFlag, bgColor) {
		if ( hoverFlag ) {
			tableCellRef.style.backgroundColor = '#EEEEFF';
		} else {
			tableCellRef.style.backgroundColor = bgColor;
		}
	}
	function checkAll(){
		var f = document.adminList;
		for(i=0;i<f.id.length;i++)
			if (f.selectAll.checked)
				f.id[i].checked=true;
			else
				f.id[i].checked=false;
	}

	function row_hoverClick( tableCellRef, url ) {
		row_hover( tableCellRef, 1);
		window.location.href = url;
	}

	function goTo(url){
		window.location = url;
	}

	function popWin(pageName,windowWidth,windowHeight)
	{
		window.open(pageName, 'window', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width='+windowWidth+',height='+windowHeight+',top=150,left=150');return false;
	}

	function confirmSubmit(deleteWhat){
		var agree=confirm("Are you sure you want to delete "+deleteWhat+"? Press OK to continue.");
		if (agree)
			return true ;
		else
			return false ;
	}
	
	function showRatings(systemID, a, rID, er, c){
		if (rID == 0){
			cr[a] = 0; 
		} else {
			cr[a] = er;
		}
		var d = "/images/";
		document.write("<img src = \"/images/"+cr[a]+"stars.gif\" usemap=#ro"+systemID+" border=0 name=stars"+systemID+" >");
		document.write("<map name='ro"+systemID+"'>");
		document.write("<area shape=rect coords='0,12,2,0' href=\"/rt.asp?s="+systemID+"&c="+c+"&r=0&rID="+rID+"\"   onmouseover=\"stars"+systemID+".src='"+d+"0stars.gif'\"; onmouseout=\"s("+systemID+", "+a+")\";  onClick=\"cr["+a+"] = 0;\"; >");
		document.write("<area shape=rect coords='2,12,14,0' href=\"/rt.asp?s="+systemID+"&c="+c+"&r=1&rID="+rID+"\"   onmouseover=\"stars"+systemID+".src='"+d+"1stars.gif'\"; onmouseout=\"s("+systemID+", "+a+")\";  onClick=\"cr["+a+"] = 1;\"; >");
		document.write("<area shape=rect coords='15,12,27,0' href=\"/rt.asp?s="+systemID+"&c="+c+"&r=2&rID="+rID+"\"   onmouseover=\"stars"+systemID+".src='"+d+"2stars.gif'\"; onmouseout=\"s("+systemID+", "+a+")\";  onClick=\"cr["+a+"] = 2;\"; >");
		document.write("<area shape=rect coords='28,12,40,0' href=\"/rt.asp?s="+systemID+"&c="+c+"&r=3&rID="+rID+"\"   onmouseover=\"stars"+systemID+".src='"+d+"3stars.gif'\"; onmouseout=\"s("+systemID+", "+a+")\";  onClick=\"cr["+a+"] = 3;\"; >");
		document.write("<area shape=rect coords='41,12,53,0'  href=\"/rt.asp?s="+systemID+"&c="+c+"&r=4&rID="+rID+"\"   onmouseover=\"stars"+systemID+".src='"+d+"4stars.gif'\"; onmouseout=\"s("+systemID+", "+a+")\";  onClick=\"cr["+a+"] = 4;\"; >");
		document.write("<area shape=rect coords='54,12,66,0' href=\"/rt.asp?s="+systemID+"&c="+c+"&r=5&rID="+rID+"\"  onmouseover=\"stars"+systemID+".src='"+d+"5stars.gif'\"; onmouseout=\"s("+systemID+", "+a+")\";  onClick=\"cr["+a+"] = 5;\"; >");
		document.write("</map>");
	}
	
	function showGuestRatings(systemID, a){
		cr[a] = 0; 
		var d = "/images/";
		document.write("<SPAN CLASS=listingtext>Your rating:</SPAN>");
		document.write("<img src = \"/images/"+cr[a]+"stars.gif\" usemap=#ro"+systemID+" border=0 name=stars"+systemID+" >");
		document.write("<map name='ro"+systemID+"'>");
		document.write("<area shape=rect coords='0,12,2,0' href=\"/riot/customized_rankings.asp\"   onmouseover=\"stars"+systemID+".src='"+d+"0stars.gif'\"; onmouseout=\"s("+systemID+", "+a+")\";>");
		document.write("<area shape=rect coords='2,12,14,0' href=\"/riot/customized_rankings.asp\"   onmouseover=\"stars"+systemID+".src='"+d+"1stars.gif'\"; onmouseout=\"s("+systemID+", "+a+")\";>");
		document.write("<area shape=rect coords='15,12,27,0' href=\"/riot/customized_rankings.asp\"   onmouseover=\"stars"+systemID+".src='"+d+"2stars.gif'\"; onmouseout=\"s("+systemID+", "+a+")\";>");
		document.write("<area shape=rect coords='28,12,40,0' href=\"/riot/customized_rankings.asp\"   onmouseover=\"stars"+systemID+".src='"+d+"3stars.gif'\"; onmouseout=\"s("+systemID+", "+a+")\";>");
		document.write("<area shape=rect coords='41,12,53,0'  href=\"/riot/customized_rankings.asp\"   onmouseover=\"stars"+systemID+".src='"+d+"4stars.gif'\"; onmouseout=\"s("+systemID+", "+a+")\";>");
		document.write("<area shape=rect coords='54,12,66,0' href=\"/riot/customized_rankings.asp\"  onmouseover=\"stars"+systemID+".src='"+d+"5stars.gif'\"; onmouseout=\"s("+systemID+", "+a+")\";>");
		document.write("</map>");
	}
	
	function ur(a,r){
		cr[a] = r;
	}
	function s(systemID, a){
		document.images["stars" + systemID].src = "/images/"+cr[a]+"stars.gif";
	}
	
	function checkEmail(which){
		var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
		if(which.email.value == ""){
			alert("Email address cannot be blank.");
			which.email.focus();
			return false;
		} else if (!filter.test(which.email.value)){
			alert('Email address is not valid.');
			which.email.focus();
			return false;
		}
		return true;
	}
	function check_textarea_length(what, maxlimit){
		if (what.value.length > maxlimit) {
			what.value = what.value.substring(0, maxlimit);
			alert('Responses can only '+maxlimit+' characters or less');
			what.focus;
			return false;
		}
		return true;
	}
	
	function mousedown(id){
		if(id=='previewbtn'){
			document.getElementById(id).className='btndownedit';
		} else {
			document.getElementById(id).className='btndown';
		}
	}
	function mouseup(id){
		document.getElementById(id).className='btn';
	}
	function bq(){
		document.getElementById('imagebox').style.display='none';
		document.getElementById('linkbox').style.display='none';
		document.getElementById('l_btn').className='btn';
		document.getElementById('img_btn').className='btn';

		var textarea=document.getElementById("message");  
    	var txt=selecttxt();
		if (txt!=''){
			textarea.value=textarea.value + "<blockquote>"+txt+"</blockquote>";
		} else {
			alert("Select text to quote.");	
		}
	}
	function selecttxt(){
		var txt='';
		if (window.getSelection){
			txt=window.getSelection();
		} else if (document.getSelection){
			txt=document.getSelection();
		} else if (document.selection) {
			txt=document.selection.createRange().text;
		} else return;
		return txt;
	}
	function addimage(){
		var textarea=document.getElementById("message");  
		var imageurl=document.getElementById("imagelink").value;
		if(imageurl.indexOf("http://") >= 0){
			textarea.value=textarea.value + "<img src=\""+imageurl+"\" />";
			document.getElementById('imagebox').style.display='none';
			document.getElementById('img_btn').className='btn';
		} else{
			alert("The link to the image needs to start with: http://");
		}
	}
	function addlink(){
		var textarea=document.getElementById("message");
		var linkURL=document.getElementById("linkURL").value;
		var linktext=document.getElementById('linktext').value;
		if(linkURL.indexOf("http://") >= 0){
			if(linktext.indexOf(linktext) >= 0){
				textarea.value=textarea.value + "<a href=\""+linkURL+"\">"+linktext+"</a>";
			} else {
				textarea.value=textarea.value + "<a href=\""+linkURL+"\">"+linkURL+"</a>";
			}
			document.getElementById('linkbox').style.display='none';
			document.getElementById('l_btn').className='btn';
		} else {
			alert("The link needs to start with: http://");
		}
	}
	function setlink(){
		var textarea=document.getElementById("message");  
		var len=textarea.value.length;  
		var start=textarea.selectionStart;
		var end=textarea.selectionEnd;  
		var sel=textarea.value.substring(start, end);  
		document.getElementById('img_btn').className='btn';
		document.getElementById('imagebox').style.display='none';
		document.getElementById('linktext').value=sel;
		document.getElementById('linkbox').style.display='block';
	}
	function setimage(){	
		document.getElementById('l_btn').className='btn';
		document.getElementById('imagebox').style.display='block';
		document.getElementById('linkbox').style.display='none';
	}	
	function updateSel(format){
		document.getElementById('imagebox').style.display='none';
		document.getElementById('linkbox').style.display='none';
		document.getElementById('l_btn').className='btn';
		document.getElementById('img_btn').className='btn';

		var textarea=document.getElementById("message");  
		var len=textarea.value.length;  
		var start=textarea.selectionStart;  
		var end=textarea.selectionEnd;  
		var sel=textarea.value.substring(start, end);  
		if (sel.length >0){
			if (format=='b'){
				var replace='<strong>' + sel + '</strong>';
			} else if (format=='i'){
				var replace='<em>' + sel + '</em>';
			}
			textarea.value=textarea.value.substring(0,start) + replace + textarea.value.substring(end,len);
		}else{
			if (format=='b'){
				alert("Select text to make it bold.");
			}else if (format=='i'){
				alert("Select text to italicize it.");
			}
		}
	}
	var btns=new Array('b_btn','i_btn','bq_btn','l_btn','img_btn');
	function preview(){
		document.getElementById('imagebox').style.display='none';
		document.getElementById('linkbox').style.display='none';
		document.getElementById('l_btn').className='btn';
		document.getElementById('img_btn').className='btn';
		
		if (document.getElementById('previewbtn').value=='Preview'){
			document.getElementById('preview').innerHTML=document.getElementById('message').value.replace(new RegExp( "\\n", "g" ), '<br />');
			document.getElementById('message').style.display='none';
			document.getElementById('previewbtn').value='Edit';
			document.getElementById('previewbtn').className='btnedit';
			document.getElementById('preview').style.display='block';
			for (var i=0;i<btns.length;i++){
				document.getElementById(btns[i]).className='btngrayedout';
				document.getElementById(btns[i]).disabled=true;
			}
		} else {
			document.getElementById('preview').style.display='none';
			document.getElementById('message').style.display='block';
			document.getElementById('previewbtn').value='Preview';
			document.getElementById('previewbtn').className='btn';
			for (var i=0;i<btns.length;i++){
				document.getElementById(btns[i]).className='btn';
				document.getElementById(btns[i]).disabled=false;
			}
		}
		document.getElementById('previewbtn').blur();
	}
	function msgsubmit(){
		var btns=new Array('b_btn','i_btn','bq_btn','l_btn','img_btn','p_btn','previewbtn');
		for (var i=0;i<btns.length;i++){
			document.getElementById(btns[i]).disabled=true;
		}

		document.getElementById('postarea').style.display='none';
		document.getElementById('waitingarea').style.display='block';
		document.f.submit();
	}