
/* Browser sensing */
/* Set up boolian variables to record the browser type */
var isNS4 = 0;
var isIE4 = 0;
var isIE5 =0;
var isNew = 0;
var isNS6up = 0;
var docObj, styleObj, currObj;

/* Determines the browser name and browser version */
var brow = ((navigator.appName) + (parseInt(navigator.appVersion)));

/* reassign variable depending on the browser */
if      (parseInt(navigator.appVersion) >= 5)    isNew = 1;
else if (brow == "Netscape4") 	                 isNS4 = 1;
else if (brow == "Microsoft Internet Explorer4") isIE4 = 1;

if ((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) >= 5)){
	isNS6up = 1;
}

/* TO GET EXCAT VERSION OF Internet Explorer */
if(isIE4){
	var version = navigator.appVersion;
	var MSIE = version.lastIndexOf("MSIE");
	var IEversion = parseFloat( version.substr(MSIE+5) );

	if(IEversion >= 5 ){
		isIE5 = 1;
	}
}


if (isNS4||isIE4||isNew) {
	docObj = (isNS4) ? 'document' : 'document.all';
	styleObj = (isNS4) ? '' : '.style';
}


function swapImg(oldImg, newImg) {
	if ( isNS4 || isIE4 || isIE5 || isNew || isNS6up){
		eval('document.images.' + oldImg +'.src=' + newImg +'.src');
	}
}

var a = new Array();
function navCommand(oldImg, newImg, menu, section) {
    navClose(section);
    swapImg(oldImg, newImg);

    if(menu != 'noDiv'){
    	if (isIE4){
    		eval('document.all.'+menu+'.style.visibility = "visible";')
    	}

    	if (isNS6up){
    	 	eval('document.getElementById(menu).style.visibility = "visible";')
    	}

    	if (isNS4){
    	 	eval('document.'+menu+'.visibility = "show";')
    	}
    }
}


// Email Validation. Written by PerlScriptsJavaScripts.com

function check_email(e) {
ok = "1234567890qwertyuiop[]asdfghjklzxcvbnm.@-_QWERTYUIOPASDFGHJKLZXCVBNM";

	for(i=0; i < e.length ;i++){
		if(ok.indexOf(e.charAt(i))<0){
		return (false);
		}
	}

	if (document.images) {
		re = /(@.*@)|(\.\.)|(^\.)|(^@)|(@$)|(\.$)|(@\.)/;
		re_two = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/;
		if (!e.match(re) && e.match(re_two)) {
		return (-1);
		}
	}

}

function check_form_value(v){
    if( v.length <= 0){
alert(v.lenght);
        return(-1);
    }
}

function check_proposal_form(f) { // f is the form (passed using the this keyword)
// check the first email address ( the exclamation means "not" )

    var message = 'Please Enter ';

    if(f.fname.value == ''){
		alert(message+"a First Name");
		f.fname.focus();
	    return false;
	}

    if(f.lname.value == ''){
		alert(message+"a Last Name");
		f.lname.focus();
	    return false;
	}

	if(!check_email(f.email.value)){
		alert(message+"a valid email address");
		f.email.focus();
	    return false;
	}

    if(f.cname.value == ''){
		alert(message+"a Company Name");
		f.cname.focus();
	    return false;
	}

    if(f.wphone.value == ''){
		alert(message+"a Work Phone Number");
		f.wphone.focus();
	    return false;
	}


    if(f.address.value == ''){
		alert(message+"a Street Address");
		f.address.focus();
	    return false;
	}

    if(f.city.value == ''){
		alert(message+"a City");
		f.city.focus();
	    return false;
	}

    if(f.state.value == ''){
		alert(message+"a State");
		f.state.focus();
	    return false;
	}

    if(f.zip.value == ''){
		alert(message+"a Zip Code");
		f.zip.focus();
	    return false;
	}
}