// JavaScript Document
function CheckContactRight(){
	var errocount = 0;
	if($("Name").value == ""){
		$("Name").addEvent('keyup',function(){
			if($("Name").value == ""){
				$("Name").setStyle('background','transparent url(../images/inner_txtbox1_error.jpg) no-repeat scroll 0 0');
			}else{
				$("Name").setStyle('background');
			}
											});
			$("Name").setStyle('background','transparent url(../images/inner_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/inner_txtbox2_error.jpg) no-repeat scroll 0 0');
			}else{
				$('Email').setStyle('background');
			}
												 });
		
		$('Email').setStyle('background','transparent url(../images/inner_txtbox2_error.jpg) no-repeat scroll 0 0 ');
		errocount = errocount + 1;
	}
	
	if (($("Phone").value == "") || ($("Phone").value.search(/\d{3}\-\d{3}\-\d{4}/)==-1)){
		$('Phone').addEvent('keyup',function(){
			if (($("Phone").value == "") || ($("Phone").value.search(/\d{3}\-\d{3}\-\d{4}/)==-1)){
				$('Phone').setStyle('background','transparent url(../images/inner_txtbox3_error.jpg) no-repeat scroll 0 0');
			}else{
				$('Phone').setStyle('background');
			}
												 });
		
		$('Phone').setStyle('background','transparent url(../images/inner_txtbox3_error.jpg) no-repeat scroll 0 0 ');
		errocount = errocount + 1;
	}
	
	if($("Comments").value == ""){
		$("Comments").addEvent('keyup',function(){
			if($("Comments").value == ""){
				$("textarea_outer2").setStyle('background','transparent url(../images/inner_txtarea_error.jpg) no-repeat scroll 0 0');
			}else{
				$("textarea_outer2").setStyle('background');
			}
											});
			$("textarea_outer2").setStyle('background','transparent url(../images/inner_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{
		$('ContactRight').submit();
	}
	
}