function nameBlur(obj_id, t_string){
	var obj;
	obj = window.document.getElementById(obj_id);
	if(obj.value ==""){
		obj.value = t_string;	
	}
}
function nameFocus(obj_id, t_string){
	var obj;
	obj = window.document.getElementById(obj_id);
	if(obj.value == t_string){
		obj.value = "";	
	}
}
//validation
function validate_email($email) {
	//Validates a correctly formatted email address
    var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
    if (!filter.test($email)) {
    	// failed validation do what you want here 
		return false;
    }else{
		return true;	
	}
}
function checkTel(){
	var obj;
	obj = window.document.getElementById("tel");
	if(obj.value == "telephone" || obj.value ==""){
		return false;	
	}else{
		return true;	
	}
}
function checkEmail(){
	var email_ok;	
	var obj;
	obj = window.document.getElementById("email");
	email_ok = validate_email(obj.value);
	return email_ok;
}
function checkSubmit(){		
	var email_ok;
	var tel_ok;	
	email_ok = checkEmail();
	tel_ok = checkTel();
	
	if(email_ok && tel_ok){		
		return true;
	}else{
		var obj_email;
		obj_email = window.document.getElementById("email_msg");
		var obj_tel;
		obj_tel = window.document.getElementById("tel_msg");
		if(!email_ok){					
			obj_email.style.display = "block";
		}else{
			obj_email.style.display = "none";
		}
		if(!tel_ok){
			obj_tel.style.display = "block";
		}else{
			obj_tel.style.display = "none";
		}
		//alert("email :" + email_ok + " tel: " + tel_ok);
		return false;	
	}
}


