/*<!--
This javascript is part of a web mail management tool created by Brian Power/deluxepowerhost.com
and is included in the copyrighted software and is not for sale or distribution. 
Copyright (C)2010 Brian Power/deluxepowerhost.com
----------------------------------------------


----------------------------------------------

-->
*/

<!--

function isEmpty(str) {
var tval = (str == null || str == "") ? true : false
return tval
}
function nosymb ( address ) {
    if ( address.indexOf ( '@', 0 ) == -1 ) {
        return ( true )
    } else {
        return ( false );
    }
}
function strblank ( address ) {
    if ( address.length < 1 ) {
        return ( true );
    } else {
        return ( false );
    }
}
function nodot ( address ) {
    if ( address.indexOf ( '@', 0 ) > 1 && address.charAt ( address.length - 1 ) == ']' )
        return ( false );
    if ( address.indexOf ( '.', 0 ) == -1 )
        return ( true );
    return ( false );
}
function nosuf ( address ) {
    if ( address.indexOf ( '@', 0 ) > 1 && address.charAt ( address.length - 1 ) == ']' )
        return ( false );
    var len = address.length;
    var pos = address.lastIndexOf ( '.', len - 1 ) + 1;
    if ( ( len - pos ) < 2 || ( len - pos ) > 3 ) {
        return ( true );
    } else {
        return ( false );
    }
}
function nopre ( address ) {
    if ( address.indexOf ( '@', 0 ) < 1 ) {
        return ( true )
    } else {
        return ( false );
    }
}
function nrb ( address ) {
    if ( address.indexOf ( '[', 0 ) > -1 && address.charAt ( address.length - 1 ) != ']' ) {
        return ( true );
    } else {
        return ( false );
    }
}
function nlb ( address ) {
    if ( address.indexOf ( '[', 0 ) == -1 && address.charAt ( address.length - 1 ) == ']' ) {
        return ( true )
    } else {
        return ( false );
    }
}
function checkit ( ) {
var email_addr = document.forms.eMail.email_address.value;
var custname = document.forms.eMail.name.value;

if (isEmpty(custname))
         alert ("Please provide your name.");
       	   
       	else if (isEmpty(email_addr))
         alert ("Please enter your email address.");
		 else if ( nosymb ( email_addr ) )

        alert ( "There is no '@' symbol in your email address..." );
		
		else if ( nodot ( email_addr ) )

        alert ( "Sorry, usually, emails have a dot '.' in them, but your address seems not to have that little dot." );
		
		else if ( nosuf ( email_addr) )

        alert ( "Your email needs a 2 or 3 character suffix like, .com  or .ca or .org, etc..." );

        else if ( nopre ( email_addr ) )

        alert ( "There is no user name before the '@' symbol in your email address" );
		
		else if ( nrb ( email_addr ) )

        alert ( "You are using brackets and did not enter the right bracket in your email address" );

        else if ( nlb ( email_addr ) )

        alert ( "You are using brackets and did not enter the left bracket in your email address" );
		
		
		   else
        return (true);
	
    return ( false );
	
}
-->
