// JavaScript Document
function CheckContactDefualt(){
	var errocount = 0;
	if($("Name").value == ""){
		$("Name").addEvent('keyup',function(){
			if($("Name").value == ""){
				$("Name").setStyle('background','transparent url(../images/txtbox1_error.jpg) no-repeat scroll 0 0');
			}else{
				$("Name").setStyle('background');
			}
											});
			$("Name").setStyle('background','transparent url(../images/txtbox1_error.jpg) no-repeat scroll 0 0');
			errocount = errocount + 1;
	}
	
	var okforemail = /(@\w[-._\w]*\w\.\w{2,3})$/;
	if(!okforemail.test($('Email').value)){
		$('Email').addEvent('keyup',function(){
			if(!okforemail.test($('Email').value)){
				$('Email').setStyle('background','transparent url(../images/txtbox2_error.jpg) no-repeat scroll 0 0');
			}else{
				$('Email').setStyle('background');
			}
												 });
		
		$('Email').setStyle('background','transparent url(../images/txtbox2_error.jpg) no-repeat scroll 0 0 ');
		errocount = errocount + 1;
	}
	
	var okforphone = new RegExp("^((1)|(2)|(3)|(4)|(5)|(6)|(7)|(8)|(9)|(0)|(\\()|(\\))|(-)|(\\.)|(\\s))+$");
	if (($("Phone").value == "") || (!okforphone.test($("Phone").value))){
		$('Phone').addEvent('keyup',function(){
			if (($("Phone").value == "") || (!okforphone.test($("Phone").value))){
				$('Phone').setStyle('background','transparent url(../images/txtbox3_error.jpg) no-repeat scroll 0 0');
			}else{
				$('Phone').setStyle('background');
			}
												 });
		
		$('Phone').setStyle('background','transparent url(../images/txtbox3_error.jpg) no-repeat scroll 0 0 ');
		errocount = errocount + 1;
	}
	
	if($("Comments").value == ""){
		$("Comments").addEvent('keyup',function(){
			if($("Comments").value == ""){
				$("textarea_outer").setStyle('background','transparent url(../images/txtarea_error.jpg) no-repeat scroll 0 0');
			}else{
				$("textarea_outer").setStyle('background');
			}
											});
			$("textarea_outer").setStyle('background','transparent url(../images/txtarea_error.jpg) no-repeat scroll 0 0');
			errocount = errocount + 1;
	}
	
	if (errocount > 0 ){
		alert('Please fix the errors marked with a red x.');
	}else{
		$('ContactDefualt').submit();
	}
	
}
