<!--

// Script Source for GA's Forum Light.
// GA Soft http://www.gurgensvbstuff.com


function checkAll(oChkBox)
{
var bStatus = oChkBox.checked;
var docFrm = document.forms["admin"];
    for (i=0; i < docFrm.elements.length; i++) {
    	if (docFrm.elements[i].type == "checkbox") {
			docFrm.elements[i].checked = bStatus;
       }
    }
}
function forum(oform)
{
var fvalue = (oform.fForum.options[oform.fForum.selectedIndex].value);
var x = fvalue.replace(/\s/g, "+");
window.location="default.asp?Forum=" + x
}

function submitform(oform)
{
var errorm = "";
var uname = (oform.fName.value);
var uname = uname.replace(/\s/g, "");
var topic = (oform.fTopic.value);
var topic = topic.replace(/\s/g, "");
var email = (oform.fEmail.value);
var ePat = /^([\w-\.]+)@([\w-]+)\.([\w-\.]+)$/g;
var matchEmail=email.match(ePat);
var comment = (oform.fComment.value);
var comment = comment.replace(/\s/g, "");
	if (uname == "") {
		var errorm = ("    -- Name must be specified !    " + "\n");
		var trap = ("error");
	}
	if (topic == ""){
		var errorm = errorm + ("    -- Topic must be specified !    " + "\n");
		var trap = ("error");
	}
	if (email !== "") {
		if (matchEmail == null){
			var errorm = errorm + ("    -- Email format is invalid !    " + "\n");
			var trap = ("error");
		}	
	}
	if (comment == "") {
		var errorm = errorm + ("    -- Please state your comment !    " + "\n");
		var trap = ("error");
	}

	if (trap == "error") {
		alert ("Please fix the following errors and resubmit:" + "\n" + "\n" + errorm);
	}else{

		if (oform == document.viewpost) {
			if (!window.confirm("Send your reply?")) {return;}
		}
		var longPat = /^(?!http)((\S){70})/gi;
		oform.fComment.value = oform.fComment.value.replace(longPat, "$1" + "\n");
		oform.submit();
	}
}

function clickme(chkid)
{
var bname = chkid.value;
var startid = "";
var trap = false;
var docFrm = document.forms["admin"];
    for (i=0; i < docFrm.elements.length; i++) {
    	if (docFrm.elements[i].type == "checkbox") {
    		if (trap == true) {
    			if (docFrm.elements[i].id > startid){
				docFrm.elements[i].checked = checkme;
				docFrm.elements[i].disabled = checkme;
			}
			else
				return
		}
			if (docFrm.elements[i].value == bname){
				trap = true;
				startid = docFrm.elements[i].id
				if (docFrm.elements[i].checked == true){
					checkme = true;
				}
				else
					checkme = false;
			}
       }
    }
}

function viewpages(PPvalue, Pvalue, asppage)
{
	var asppage = escape(asppage);
	var link = "filter.asp?url="+asppage+"&pp="+PPvalue+"&pn="+Pvalue;
	window.location = link;
}

function popup(url,wname,params)
{
PopWin = window.open(url,wname,params);
PopWin.focus();
}

function pop_onload(id)
{
var topic = "T" + id;
var message = "H" + id;
var docFrm = window.opener.document.forms["admin"];
    for (i=0; i < docFrm.elements.length; i++) {
    	if (docFrm.elements[i].name == message) {
		document.pop.S1.value = docFrm.elements[i].value;
       }
    	if (docFrm.elements[i].name == topic) {
		document.pop.T1.value = docFrm.elements[i].value;
       }
    }
}

function Save_Message(action)
{

	if (action == "save"){
		var conf = window.confirm("Are you sure you want to save changes?");
		if (!conf){
		return
		}
		else
			document.pop.action.value = "save"
			document.pop.submit();
	}

	if (action == "cancel"){
		var conf = window.confirm("This action will cancel current message clearing the message body. Continue?");
		if (!conf){
		return
		}
		else
			document.pop.action.value = "cancel"
    			document.pop.submit();
	}
	

}

function delrec()
{


var docFrm = document.forms["admin"];
    for (i=0; i < docFrm.elements.length; i++) {
    	if (docFrm.elements[i].type == "checkbox") {
		if (docFrm.elements[i].checked == true) {
			var submitForm = true;
			docFrm.elements[i].disabled = false;
		}
	}
    }
if (submitForm == true) {
	window.document.admin.submit();
}
else	
	alert("You did not select records to delete.");
}

function sting(cform)
{
var n = (cform.T1.value);
var p = (cform.T2.value);
var c = (cform.T3.value);
if (p !== c) {
	alert("Password does not match.");
	cform.T2.value = ("");
	cform.T3.value = ("");
	return
}
if (n == "" | p == "") {
	var conf = window.confirm("Name or Password is blank. Do you want to continue?");
	if (!conf) {
	return
	}
}
cform.action = "control.asp?action=commit";
cform.submit();
}

function conform(cform)
{
var msg = cform.status.value;
alert(msg);
window.close();
}

function showArchive(oform)
{

	if (oform.options.length == 0){
		alert("Archive List is Empty!");
		return
	}

var selArch = oform.options[oform.selectedIndex].value;
popup("archive.asp?arch=" + selArch + "&Page=1","archive","toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=1000,height=700");

}
function delarchive()
{

	if (document.fcontrol.D2.options.length == 0){
		alert("Archive List is Empty!");
		return
	}
	if (window.confirm("You are about to delete selected Archive.")){
		document.fcontrol.action = "control.asp?act=delarch";
		document.fcontrol.submit();
	}
}

function createNew()
{

	var fName = document.fcreate.T4.value
	var fName = fName.replace(/\s/g, "");
	var fPat = (/\W/g);
	var checkForum = fName.match(fPat);
	
	if (fName == ""){
		alert("Please specify Forum name.");
		document.fcreate.T4.focus();
		return
	}
	if (checkForum !== null){
		alert("Forum name can only be alphanumeric.");
		document.fcreate.T4.focus();
		return
	}
		document.fcreate.submit();


}

function feedback(reportform)
{
	if (typeof(document.forms[reportform]) == "object"){
		if (typeof(document.forms[reportform].report) == "object"){
			alert(document.forms[reportform].report.value);
		}
	}
}

function controlForum()
{


var arch = document.archive.D1.options[document.archive.D1.selectedIndex].value
var docFrm = document.forms["archive"];
	for (i=0; i < docFrm.elements.length; i++) {
		if (docFrm.elements[i].type == "radio") {
			if (docFrm.elements[i].checked == true) {
				var submitForm = true;
				var forum = docFrm.elements[i].value
			}
		}
	}
	if (submitForm == true){
		if (arch == "1"){
			if (window.confirm("You are about to delete forum -" + forum + ".")){
				window.document.archive.submit();
				return
			}
			else
				return
		}
		if (arch == "2"){
			if (window.confirm("You are about to move all messages from forum -" + forum + ".")){
				window.document.archive.submit();
			}
			else
				return
		}
		else
			if (window.confirm("You are about to archive messages older than " + arch + " days from forum -" + forum + ".")){
				window.document.archive.submit();
			}
			
	}
	else
		alert("Please select a forum first.");
}


function searchForums(){
	var Forum = document.search.D1.options[document.search.D1.selectedIndex].value;
	var sType = document.search.D2.options[document.search.D2.selectedIndex].value;
	var sDate = document.search.D3.options[document.search.D3.selectedIndex].value;
	var searchStr = document.search.T1.value;
	var searchStr = searchStr.replace(/[^A-Za-z0-9\s_]/g, "");
	var checkStr = searchStr.replace(/\s/g, "");
	if (checkStr == "")
		return alert("Please specify a String to search.");
	if (sType !== "3"){
		var tempSplit = searchStr.split(" ");
		var searchStr = "";
		for (var i=0; i < tempSplit.length; i++){
			if (tempSplit[i] !== ""){
				var searchStr = searchStr + "+" + tempSplit[i];
			}
		}
		searchStr = searchStr.replace(/\+/, "");
	}
	document.search.action = "search.asp?forum=" +  Forum + "&string=" + escape(searchStr) + "&type=" + sType + "&Displ=1&Date=" + sDate;
	document.search.submit();

}


//-->


