function stringLen(type){
	if(type == "password")
		x=6;
	else if(type == "phone" || type == "cell" || type == "fax")
		x=10;
	else if(type == "zip")
		x=5;
	else
		x=2;
		
	return x;
}

function changeColor(id, f1, div){
	var mail = new Array('@', '.');
	if(f1 == "email"){
		var z=0;
		var temp = document.getElementById(id)[f1].value;
		for(i=0; i<=temp.length; i++){
			t = temp.substr(i, 1);
			if(t == mail[0] || t == mail[1])
				z++;
		}
		if(z == 2)
			document.getElementById(div).style.color="#CCCCCC";
	}else{
		x = stringLen(f1);
		if(document.getElementById(id)[f1].value.length >= x)
			document.getElementById(div).style.color="#CCCCCC";
		else
			document.getElementById(div).style.color="#FF0000";
	}
}

var msg='';
function valText(id, f1, txt){
	x = stringLen(f1);
	if(document.getElementById(id)[f1].value.length < x)
		msg = "The "+ txt +" field has not been completed correctly.\r\n\r\n";
	else
		msg = '';
	return msg;
}

function valPull(id, f1, txt){
	if(document.getElementById(id)[f1].value == '')
		msg = "There has nor been a "+ txt +" selected for this job.\r\n\r\n";
	else
		msg = '';
	return msg;
}

function valEmail(id, f1, txt){
	var z=0;
	var mail = new Array('@', '.');
	var temp = document.getElementById(id)[f1].value;
	for(i=0; i<=temp.length; i++){
		t = temp.substr(i, 1);
		if(t == mail[0] || t == mail[1])
			z++;
	}
	if(z == 2 || z == 3)
		msg = '';
	else
		msg = "The "+ txt +" field is not a valid email.\r\n\r\n";
	return msg;
}

function valPass(id, f1, txt){
	x=6;
	if(document.getElementById(id)[f1].value.length < x)
		msg = "The "+ txt +" does not meet the minimum number of characters.\r\n\r\n";
	else
		msg = '';
	return msg;
}

function alertEr(error){
	alert(error);
}
