function on(img) {
	document[img].src="/site/images/"+img+"_on.jpg";
}

function off(img) {
	document[img].src="/site/images/"+img+".jpg";
}


//CHECK INFO FORM
////////////////////////////////////////////////////////
function chkforcode(str) {
	var bad_val = "";
	
	var badstrings = new Array(5)
		badstrings[0] = "www"
		badstrings[1] = "http"
		badstrings[2] = ".com"
		badstrings[3] = ".net"
		badstrings[4] = "url"

	for (var i = 0; i < badstrings.length; i++) {

		bad_val = badstrings[i];
		// alert(bad_val);
		this_result = str.search(bad_val);
		// alert (this_result);
		// returns -1 if value not found
		if (this_result > -1) {
			return this_result
		}
	}
	return this_result
}

function chkentries() {
   f=document.contactfrm;
   var badCount = 0;
   var goodchars = 0;
   var msg = "";

// Name 
	var curfld=f.f_name.value;
	if (curfld.length < 5) {
		badCount = badCount + 1;
		msg =  msg + "\n Name must be longer than 5 characters.";
	} else {
		tmp = chkforcode(curfld);
		if (tmp != -1){
			badCount = badCount + 1;
			msg = msg + "\nEnter a Valid Name.";
		}
	}

//Company Name
	var curfld=f.f_company.value;
	if (curfld.length < 5) {
		badCount = badCount + 1;
		msg = msg + "\n Company Name must be longer than 5 characters.";
	} else {
		tmp = chkforcode(curfld);
		if (tmp != -1){
			badCount = badCount + 1;
			msg = msg + "\nEnter a Valid Company Name.";
		}
	}
	
	var curfld=f.f_phone.value;
	if (curfld.length < 12) {
		badCount = badCount + 1;
		msg =  msg + "\nEnter a Phone Number.";
	} else {
		tmp = chkforcode(curfld);
		if (tmp != -1){
			badCount = badCount + 1;
			msg = msg + "\nPhone must be in 999-999-9999 format.";
		}
	}
	
	if (f.f_email.value == "") {
      badCount = badCount + 1;
	  if (msg =="") {
	     msg = "Enter an E-mail Address.";
	  } else {
	    msg = msg + "\nEnter an E-mail Address.";
	  }
   }
   
 // check format of e-mail
   tmp = f.f_email.value;
   var fldEmail=f.f_email;
   var strEmail=tmp
   if (window.RegExp) { //For browsers that support RegExp
   		var strReg1 = "(@.*@)|(\\.\\.)|(@\\.)|(\\.@)|(^\\.)";
     	var strReg2 = "^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$";
    	var reg1 = new RegExp(strReg1);
        var reg2 = new RegExp(strReg2);

		if (reg1.test(fldEmail.value) || !reg2.test(fldEmail.value)) {
			badCount = badCount + 1;
	  		if (msg =="") {
	     		msg = "Improper e-mail format";
		  	} else {
			    msg = msg + "\nImproper e-mail format";
	  	  	}
		}

    } else { //For browsers that don't support RegExp
		if ( !(fldEmail.value.indexOf("@")>=0) ) {
			badCount = badCount + 1;
	  		if (msg =="") {
	    		msg = "Improper e-mail format";
			} else {
		    	msg = msg + "\nImproper e-mail format";
	  		}
		}
    }
	
	curfld = f.f_biz_type.value;
	if (curfld.length == "") {
		// that's okay 
	} else {
		tmp = chkforcode(curfld);
		if (tmp != -1){
			badCount = badCount + 1;
			msg = msg + "\nEnter a Valid Business Type.";
		}
	}

	curfld = f.f_citystate.value;
	if (curfld.length == "") {
		// that's okay 
	} else {
		tmp = chkforcode(curfld);
		if (tmp != -1){
			badCount = badCount + 1;
			msg = msg + "\nEnter a Valid City/State.";
		}
	}
	
	curfld = f.f_fax.value;
	if (curfld.length == "") {
		// that's okay 
	} else {
		tmp = chkforcode(curfld);
		if (tmp != -1){
			badCount = badCount + 1;
			msg = msg + "\nEnter a Valid Fax Number.";
		}
	}
	
	curfld = f.f_last_field.value;
	if (curfld.length == "") {
			badCount = badCount + 1;
			msg = msg + "\nLast Field is MUST ENTER.";
	} else {
		tmp = chkforcode(curfld);
		if ((tmp != -1) || (curfld > 9) || (curfld < 9)){
			badCount = badCount + 1;
			msg = msg + "\nEnter a Valid Value in Last Field.";
		}
	}

	if (badCount == 0) {
    	return true;
    } else {
    	alert (msg);
      	return false;
    }

} 
////////////////////////////////////////////////////////