/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*\
'
' © 2000-2002 Steve Mapúa
' All Rights Reserved
' Steve.Mapua@GlobalTelesis.com
'
' To registrater this applet send me an email.  Cost $0.00.
' Registering gives you free technical support.
'
' You may not alter the code with out my express approval.
'
' This applet is freely distributable.
'
\*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
//----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
function ValidateForm(MyForm)
{
    var szErrMsg = new String();
    var szTest   = new String();
    var szTest2  = new String();
    var nCnt     = new Number();
    var iPos     = new Number();
    var nFocus   = new Number();
    var dummy;

    nFocus    = 0;
    szErrMsg = "";
    szTest   = "";

    with(MyForm)
    {

        szTest = MyURL.value;
        iPos = szTest.indexOf(".");
        if((szTest.length <= 7) ||(iPos <= 0) || (szTest.substring(iPos + 1).length <= 0))
        {
            szErrMsg += "Please enter the URL for your site.\n";
            nFocus += 2;
        }

        szTest = UserName.value;
        if(szTest.length <= 0)
        {
            szErrMsg += "Please enter your full name.\n";
            nFocus += 16;
        }

        szTest = EMail.value;
        iPos = szTest.indexOf("@");
        if((szTest.length <= 0) ||(iPos <= 0) || (szTest.substring(iPos + 1).length <=0))
        {
            szErrMsg += "Please enter your email.\n";
            nFocus += 32;
        }
        else
        {
            szTest = szTest.substring(iPos + 1);
            iPos = szTest.indexOf(".");
            if(szTest.substring(iPos + 1).length <= 0)
            {
                szErrMsg += "Please enter your email.\n";
                nFocus += 32;
            }
        }

        try
        {
            if(YourURL != null)
            {
                szTest = YourURL.value;
                if(szTest.length <= 0)
                {
                    szErrMsg += "Please enter your reciprocal link page.\n";
                    nFocus += 64;
                }


            }
        }catch(dummy){}

    }
    if(szErrMsg.length)
    {
        alert(szErrMsg);

        if((nFocus & 2) == 2)
        {
            MyForm.MyURL.focus();
            MyForm.MyURL.value="http://";
        }
        else if((nFocus & 16) == 16)
        {
            MyForm.UserName.focus();
        }
        else if((nFocus & 32) == 32)
        {
            MyForm.EMail.focus();
        }

        try
        {
            if(YourURL != null)
            {
                if((nFocus & 64) == 32)
                {
                    MyForm.YourURL.focus();
                }
            }
        }catch(dummy){}

        return false;
    }

    MyForm.MyState.value = 1;
    MyForm.submit();
    return true;
}
//----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
