function whichBrs() {
var agt=navigator.userAgent.toLowerCase();
if (agt.indexOf("opera") != -1) return 'Opera';
if (agt.indexOf("staroffice") != -1) return 'Star Office';
if (agt.indexOf("webtv") != -1) return 'WebTV';
if (agt.indexOf("beonex") != -1) return 'Beonex';
if (agt.indexOf("chimera") != -1) return 'Chimera';
if (agt.indexOf("netpositive") != -1) return 'NetPositive';
if (agt.indexOf("phoenix") != -1) return 'Phoenix';
if (agt.indexOf("firefox") != -1) return 'Firefox';
if (agt.indexOf("safari") != -1) return 'Safari';
if (agt.indexOf("skipstone") != -1) return 'SkipStone';
if (agt.indexOf("msie") != -1) return 'Internet Explorer';
if (agt.indexOf("netscape") != -1) return 'Netscape';
if (agt.indexOf("mozilla/5.0") != -1) return 'Mozilla';
if (agt.indexOf('\/') != -1) {
if (agt.substr(0,agt.indexOf('\/')) != 'mozilla') {
return navigator.userAgent.substr(0,agt.indexOf('\/'));}
else return 'Netscape';} else if (agt.indexOf(' ') != -1)
return navigator.userAgent.substr(0,agt.indexOf(' '));
else return navigator.userAgent;
}

function checkEmail(myForm) {
    if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(myForm.email_from.value)){
        return (true)
    }
    alert("Invalid E-mail Address! Please re-enter.")
    return (false)
}

function trim(s) {
	var l=0; var r=s.length -1;
	while(l < s.length && s[l] == ' ') {	
        l++; 
    }

	while(r > l && s[r] == ' ') {	
        r-=1;	
    }

	return s.substring(l, r+1);
}

function validate_email(field, alerttxt) {
    with (field) {
        apos = value.indexOf("@");
        dotpos = value.lastIndexOf(".");
        if (apos < 1 || dotpos - apos < 2) {
            alert(alerttxt);return false;
        } else {
            return true;
        }
    }
}

function validateSignup(f) {
    if (!validate_email(f.email_from, "Please enter your valid email address.")) {
        f.email_from.focus();
        return false;
    }

    return true;
}

function validForm(f) {
    if (trim(f.name.value) == "") {
        alert("Please enter your name");
        f.name.focus();
        return false;
    } 
    if (validate_email(f.email_from, "Please enter a valid email address.") == false) {
        f.email_from.focus()
        return false
    }
    // if (f.agree.checked == false) {
        // alert("We ask you give us permission to contact you.")
        // f.agree.focus()
        // return false;
    // }

    return true;
}

