
/*be listed form*/
function check_listed(form)
{
	if(form.fname.value == "" || form.fname.value.length < 2) {
		alert("You must fill the first name field !");
		form.fname.focus();
		form.fname.select();
		return false;
	}

	if(form.lname.value == "" || form.lname.value.length < 2) {
		alert("You must fill the last name field !");
		form.lname.focus();
		form.lname.select();
		return false;
	}

	if(form.address.value.length < 7) {
		alert("You must fill the address field !");
		form.address.focus();
		form.address.select();
		return false;
	}

	if(form.city.value == "" || form.city.value.length < 2) {
		alert("You must fill the city field !");
		form.city.focus();
		form.city.select();
		return false;
	}

	if(form.state.value == "" || form.state.value.length != 2) {
		alert("You must fill the state field (2 letters) !");
		form.state.focus();
		form.state.select();
		return false;
	}

	if(form.zip.value == "" || form.zip.value.length != 5) {
		alert("You must fill the zip field (5 digits) !");
		form.zip.focus();
		form.zip.select();
		return false;
	}

	if(isNaN(form.zip.value)) {
		alert("Zip number incorrect !");
		form.zip.focus();
		form.zip.select();
		return false;
	}

	if(form.tel.value.length < 10) {
		alert("You must fill the phone field !");
		form.tel.focus();
		form.tel.select();
		return false;
	}

	if(isNaN(form.tel.value)) {
		alert("The phone field must contain just digits !");
		form.tel.focus();
		form.tel.select();
		return false;
	}
	
	if(form.email.value == "") {
		alert("You must fill the e-mail field !");
		form.email.focus();
		form.email.select();
		return false;
	}
	
	var filter=/^(\w+(?:\.\w+)*)@((?:\w+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
	if(!filter.test(form.email.value)) {
		alert("The e-mail address is invalid !");
		form.email.focus();
		form.email.select();
		return false;
	}
}

/*row color*/
function mouseState(id, state, color) {
	myrow = document.getElementById('rowid' + id);
	switch (state) {
		case 1:  //mouseOver
			myrow.style.backgroundColor = color;
			break;
		case 2: //mouseDown
			break;
		case 3: //mouseUp
			break;
		default: //mouseOut
			myrow.style.backgroundColor = color;
	}
}

function mouseState2Col(id, state, color) {
	myrow = document.getElementById('rowid' + id);
	switch (state) {
		case 1:  //mouseOver
			myrow.style.backgroundColor = color;
			break;
		case 2: //mouseDown
			break;
		case 3: //mouseUp
			break;
		default: //mouseOut
			myrow.style.backgroundColor = color;
	}
}