function TetraSignupForm() {
    $('sufSubmit').update('<div id="Signup1-pbox0" class="pbox0 pbox0-pbutton pbox0-pb-Signup" style="" onclick="javascript:if(cansub==1){$(\'sufForm\').submit();}" ><div id="Signup1-pbox1" class="pbox1 pbox1-pbutton pbox1-pb-Signup" style="background-image:url(\'http://www.thinkcreek.com/corner.php4?img=d&amp;angle=0&amp;tl=002F66&amp;r1=000000&amp;r2=000000&amp;r3=trans&amp;r4=trans\');" ><div id="Signup1-pbox2" class="pbox2 pbox2-pbutton pbox2-pb-Signup" style="background-image:url(\'http://www.thinkcreek.com/corner.php4?img=d&amp;angle=90&amp;tl=002F66&amp;r1=000000&amp;r2=000000&amp;r3=trans&amp;r4=trans\');" ><div id="Signup1-pbox3" class="pbox3 pbox3-pbutton pbox3-pb-Signup" style="background-image:url(\'http://www.thinkcreek.com/corner.php4?img=d&amp;angle=180&amp;tl=002F66&amp;r1=000000&amp;r2=000000&amp;r3=trans&amp;r4=trans\');" ><div id="Signup1-pbox4" class="pbox4 pbox4-pbutton pbox4-pb-Signup" style="background-image:url(\'http://www.thinkcreek.com/corner.php4?img=d&amp;angle=270&amp;tl=002F66&amp;r1=000000&amp;r2=000000&amp;r3=trans&amp;r4=trans\');" ><div id="Signup1-pbox5" class="pbox5 pbox5-pbutton pbox5-pb-Signup" style="background-image:url(\'http://www.thinkcreek.com/corner.php4?img=d2&amp;angle=360&amp;tl=002F66&amp;r1=000000&amp;r2=000000&amp;r3=trans&amp;r4=trans\');" ><a href="#" id="pblink-Signup1" class="mclink">Signup</a></div></div></div></div></div></div>');
}
function inviterVal() {
    ia = new Ajax.Updater('inviterWarning', 'http://www.thinkcreek.com/validate.php4?&html=bang&method=filter&filter=274&warning=Invalid+URL&string=' + $F('inviterInputEmail'));
}
function InviterForm() {
    $('inviterSubmit').update('<div id="inviterButton-pbox0" class="pbox0 pbox0-pbutton pbox0-pb-Send" style="" onclick="javascript:$(\'inviterForm\').submit();" ><div id="inviterButton-pbox1" class="pbox1 pbox1-pbutton pbox1-pb-Send" style="background-image:url(\'http://www.thinkcreek.com/corner.php4?img=d&amp;angle=0&amp;tl=002F66&amp;r1=000000&amp;r2=000000&amp;r3=trans&amp;r4=trans\');" ><div id="inviterButton-pbox2" class="pbox2 pbox2-pbutton pbox2-pb-Send" style="background-image:url(\'http://www.thinkcreek.com/corner.php4?img=d&amp;angle=90&amp;tl=002F66&amp;r1=000000&amp;r2=000000&amp;r3=trans&amp;r4=trans\');" ><div id="inviterButton-pbox3" class="pbox3 pbox3-pbutton pbox3-pb-Send" style="background-image:url(\'http://www.thinkcreek.com/corner.php4?img=d&amp;angle=180&amp;tl=002F66&amp;r1=000000&amp;r2=000000&amp;r3=trans&amp;r4=trans\');" ><div id="inviterButton-pbox4" class="pbox4 pbox4-pbutton pbox4-pb-Send" style="background-image:url(\'http://www.thinkcreek.com/corner.php4?img=d&amp;angle=270&amp;tl=002F66&amp;r1=000000&amp;r2=000000&amp;r3=trans&amp;r4=trans\');" ><div id="inviterButton-pbox5" class="pbox5 pbox5-pbutton pbox5-pb-Send" style="background-image:url(\'http://www.thinkcreek.com/corner.php4?img=d2&amp;angle=360&amp;tl=002F66&amp;r1=000000&amp;r2=000000&amp;r3=trans&amp;r4=trans\');" ><a href="#" id="pblink-inviterButton" class="mclink">Send</a></div></div></div></div></div></div>');
inviterVal();
}
function iv2() {
if($('inviterWarning').innerHTML.match(":)") !== null){return true;alert('truth');}else{return false;}
}
function inviterSend() {

}
function pbutton(id,bname,uhref,bgcolor,forceID) {
    bname=encodeURIComponent(bname);
    uhref=encodeURIComponent(uhref);
    bgcolor=encodeURIComponent(bgcolor);
    forceID=encodeURIComponent(forceID);
    /*alert('http://www.thinkcreek.com/template.xhtml.php4?&func=pbutton&name='+bname+'&href='+uhref+'&bgcolor='+bgcolor+'&forceID='+forceID);*/
    nn=new Ajax.Updater(id, 'http://www.thinkcreek.com/template.xhtml.php4?&func=pbutton&name='+bname+'&href='+uhref+'&bgcolor='+bgcolor+'&forceID='+forceID, {method:'GET'});

}

function suForm() {

}
function sufVal2() {
    cansub=1;
    newml=$('sufWarningBox2').innerHTML;
    $('sufWarningBox').update(newml);
    if($('sufWarningBox').innerHTML.empty() == false){cansub=0;}
    if(cansub===0){$('pblink-Signup1').style.color="#696969";}else{$('pblink-Signup1').style.color="#FFFFFF";cansub=1;}
}

function sufVal() {
$('sufWarningBox2').update('');
nn=new Ajax.Updater('sufWarningBox2', 'http://www.thinkcreek.com/validate.php4?&html=bigbox&method=www&warning=Invalid+URL&string=' + $F('sufInputWWW'), {insertion: Insertion.Bottom});
nn=new Ajax.Updater('sufWarningBox2', 'http://www.thinkcreek.com/validate.php4?&warning=No+Invite+No+Fun.&method=password&html=bigbox&string=' + $F('sufInputInviteCode'), {insertion: Insertion.Bottom});
nn=new Ajax.Updater('sufWarningBox2', 'http://www.thinkcreek.com/validate.php4?&warning=Invalid+Email&method=email&html=bigbox&string=' + $F('sufInputEmail'), {insertion: Insertion.Bottom});
nn=new Ajax.Updater('sufWarningBox2', 'http://www.thinkcreek.com/validate.php4?&warning=Please+choice+a+better+password.&method=password&html=bigbox&string=' + $F('sufInputPassword'), {insertion: Insertion.Bottom});
nn=new Ajax.Updater('sufWarningBox2', 'http://www.thinkcreek.com/validate.php4?&warning=Name+taken.+Pick+a+new+one.&method=canHasUsername&html=bigbox&string=' + $F('sufInputUsername'), {insertion: Insertion.Bottom});
nn=new Ajax.Updater('sufWarningBox2', 'http://www.thinkcreek.com/validate.php4?&warning=Invalid+Username&method=username&html=bigbox&string=' + $F('sufInputUsername'), {insertion: Insertion.Bottom});
    setTimeout("sufVal2()",500);
}
function tetraForm(id,fname) {
    this.id=id;
    this.fname=fname;

this.canHasAjax=false;
this.filters=0;
this.isValid=new Hash();
this.vurl='';

    function testValid() {

        el = Form.getElements($(this.id));

        var fields = Form.serializeElements(el);

        vurl = this.vurl+'&';
        args = {method:'thought',string:'AJAX'};
        reqq = new Ajax.Request(vurl + Object.toQueryString(args), {
            method: 'GET',
          onSuccess: function(t) {
            this.canHasAjax=true;
          }.bind(this)
        });
    }
this.testValid=testValid;
    function fvalid(vname) {
        valid=true;
        if(vname.empty() !== true) {
            valid=this.isValid[vname];
        } else {
            for(x in this.filters) {
                xv = this.isValid[x];
                if(!xv){valid=false;}
            }
        }
        return valid;
    }
    function xvalid() {
        if(this.canHasAjax === 1337){return true;}
        for(x in this.filters) {
            this.validate(x);
        }
    }
this.xvalid=xvalid;
    function validate(vname) {
        v = this.filters[vname];
        vstring = v.string;
        el = Form.getElements($(this.id));

        var fields = Form.serializeElements(el,true);
        vurl = this.vurl+'&';
        for(k in fields) {
            vsearch = new RegExp("%"+k+"%");
            vstring = vstring.replace(vsearch,fields[k]);
        }

        args=$H({string:vstring,method:v.method});
          args=args.merge($H(v.options));


        reqq = new Ajax.Request(vurl + Object.toQueryString(args), {
            method: 'GET',
          onSuccess: function(transport) {
            this.isValid[vname]=true;

            $('fVal-'+v.display).update(transport.responseText);
          }.bind(this),
          onFailure: function (transport) {

            $('fVal-'+v.display).update(transport.responseText);
            if(transport.responseText == '') {

                hcode=$H({code:'no'});
                nn=new Ajax.Updater('fVal-'+v.display, vurl + Object.toQueryString(args.merge(hcode)));
            }
            this.isValid[vname] =false;
          }.bind(this)
        });
    }
    function fsubmit() {
        if(this.canHasAjax === true){this.xvalid();}
        if(this.fvalid("") || this.canHasAjax===false) {
            $(this.id).submit();
        } else {alert('One or more form fields are invalid. Please check.');}
    }
    function formSubmitButton(id,bname,bgcolor) {
        pbutton(id,bname,'onclick="'+ this.fname +'.fsubmit();"',bgcolor);
    }
    this.fvalid=fvalid;
    this.fsubmit=fsubmit;
    this.formSubmitButton=formSubmitButton;
    this.validate = validate;
}
