    function jumpto(stat,fe,st) {
        var f= document.forms[0];
//		var url= f.action;
//		url= url+"?s="+stat;
		f.s.value= stat;
//		f.o.value= '';
        if (typeof(fe) != 'undefined') {
            for (var i= 0; i < fe.length; i++) {
                if (typeof(st[i]) != 'undefined' && eval("typeof(f."+fe[i]+")") != 'undefined') {
                    st[i]= "'"+st[i]+"'";
                    eval("f."+fe[i]+".value= "+st[i]);
//						url= url+"&"+fe[i]+"="+st[i];
				}
            }
        }
//		window.location.assign(url);
        f.submit();
    }
    
    function winStatus(stat) {
        top.s= stat;
        return true;
    }
        
    function getObject(id,type,url) {
        var f= document.forms[0];
        f.s.value= type;
        f.o.value= id;
        f.submit();
        if (typeof(url)!='undefined' && url != '') {
            top.offsiteWindow= window.open(url, "offsiteWindow", "width=615,menubar=0,height=400,dependent=1,resizable=1,scrollbars=1,location=1")
            top.offsiteWindow.focus();
        }
    }

    function editObject(id,type,next,parent) {
        var f= document.forms[0];
        f.s.value= type+".Edit";
        f.o.value= id;
        if (typeof(next) != 'undefined') {
            f.ns.value= next;
        } else {
            f.ns.value= '';
        }
        if (typeof(parent) != 'undefined') {
            f.p.value= parent;
        }
        f.submit();
    }

    function previewObject(type) {
        var f= document.forms[0];
        f.s.value= type+".Edit.Preview";
		f.action+= '#preview';
        f.submit();
    }

    function quoteObject(id,type) {
        var f= document.forms[0];
        f.s.value= "View.Edit.Quote."+id;
        if (typeof(type) != 'undefined') {
	        f.s.value= type+".Edit.Quote."+id;
		}
        f.submit();
    }

    function addObject(type,parent,next) {
        var f= document.forms[0];
        f.s.value= type+".Edit";
        if (typeof(parent) != 'undefined') {
            f.p.value= parent;
        } else {
            f.p.value= '';
        }
        if (typeof(next) != 'undefined') {
            f.ns.value= next;
        } else {
            f.ns.value= '';
        }
        f.o.value= '';
        f.submit();
    }

    function updateObject(type,id,parent,next) {
        var f= document.forms[0];
        f.s.value= type+".Edit.Update";
        f.o.value= id;
        if (typeof(parent) != 'undefined') {
            f.p.value= parent;
        } else {
            f.p.value= '';
        }
        if (typeof(next) != 'undefined') {
            f.ns.value= next;
        } 
        f.submit();
    }

    function deleteObject(type,id,next) {
        var f= document.forms[0];
        if (confirm('Deleting Object:\n\n'+type+': '+ id+'\n\nAre you sure.\n\nThis action is not undoable,\nthis object and all associated data will be lost.')) {
            f.ns.value= f.s.value;
            f.s.value= type+".Delete";
            f.o.value= id;
	        if (typeof(next) != 'undefined') {
		        f.ns.value= next;
			}
            f.submit();
        }
    }

	function reportObject(type,id) {
        var f= document.forms[0];
        f.ns.value= f.s.value;
		f.p.value= f.o.value;
        f.s.value= type+".Report";
        f.o.value= id;
        f.submit();
    }

    function editPage(sv) {
        var f= document.forms[0];
        f.s.value= 'Usercontent.Edit';
        f.ns.value= sv;
        f.submit();    
    }
       
    function wrstyle(im) {
        setCookie('wrStyle',im);
        document.forms[0].submit();
    }

    function updateUserContent() {
        var f= document.forms[0];
        f.s.value= 'Usercontent.Edit.Update';
        f.submit();        
    }


    function setVal(f,name,val) {
        if (typeof(val) != 'undefined') {
            f.name.value= val;
        } else {
            f.name.value= '';
        }
        alert('Updated: '+name+' = '+val);
    } 


    function search() {
        var f= document.forms[0];
        f.s.value= 'Search.Results';
        f.submit();
    }

    function chat() {
        top.chatWindow= window.open("/cgi-bin/wigan?s="+escape("Chat.Popup"), "chatWindow", "width=615,menubar=0,height=500,dependent=1,resizable=1,scrollbars=1,location=0")
        top.chatWindow.focus();
    }

    function help(status) {
        top.chatWindow= window.open("/cgi-bin/wigan?s=Help"+escape("."+status), "chatWindow", "width=615,menubar=0,height=500,dependent=1,resizable=1,scrollbars=1,location=0")
        top.chatWindow.focus();
    }



////////////////////////////////////////////////////////////////////////////////////////
/////////// Message Board functions
////////////////////////////////////////////////////////////////////////////////////////

function decode(x) {
    var re= /\+/g;
    x= x.replace(re," ");
    x= unescape(x);    
    return(x);
}

function quote() {
    var f= document.forms[0];
    f.VIEW_BODY.value= decode(f.Quote.value)+f.VIEW_BODY.value;
}

function tag(tname) {
    var f= document.forms[0];
    f.VIEW_BODY.value= f.VIEW_BODY.value+'['+tname+']'+'[/'+tname+']';
}

function related(id,type) {
    top.chatWindow= window.open("/wigan/?s="+escape("View."+id+".Related."+type), "chatWindow", "width=615,menubar=0,height=500,dependent=1,resizable=1,scrollbars=1,location=0")
    top.chatWindow.focus();    
} 

function emoticons() {
        top.emoticonsWindow= window.open("/wigan/?s="+escape("Emoticon.Popup"), "emoticonsWindow", "width=256,menubar=0,height=400,dependent=1,resizable=1,scrollbars=1,location=0")
        top.emoticonsWindow.focus();
    }

function emoticon(text,name) {
    var d= document;
    if (window.opener && window.opener != window) {
        d= window.opener.document;
    }
    var txtarea = d.forms[0].VIEW_BODY;
    if (typeof(txtarea) == 'undefined') {
		txtarea = d.forms[0].PRIVATEMESSAGE_BODY;
	}
    if (typeof(name) != 'undefined') {
	    eval("txtarea = d.forms[0]."+name);
	}
    text = ' ' + text + ' ';
    if (txtarea.createTextRange && txtarea.caretPos) {
        var caretPos = txtarea.caretPos;
        caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + ' ' : text;
        txtarea.focus();
    } else {
        txtarea.value  += text;
        txtarea.focus();
    }
}

	function alertNewPM() {
        var f= document.forms[0];
        if (confirm('New Private Message:\n\nClick OK to go to your inbox.')) {
            f.s.value= "User.Inbox";
            f.o.value= '';
            f.submit();
        }
    }
