function ValidateEmail(valor) 
    {
	    if (/\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/.test(valor))
		    return true;
	    else
		    return false;
    }  
function CustomValidateEmail(source, arguments)
{
    if(arguments)
    {
        var Email = getElementContact(source.controltovalidate);
        if (Email.value == "")
	    {
		    source.errormessage = 'Please, enter your email.';
		   
		    arguments.IsValid=false;
		    return;
	    }
	    else
	    {
	    if(!ValidateEmail(Email.value))
		    {
			    source.errormessage = "Please check the emails address.";
			 
			    arguments.IsValid=false;
			    return;
		    }
	    }
        arguments.IsValid=true;
    
    }    
}


function ValidateComments(source, arguments)
{
   
    var Comment = getElementContact(source.controltovalidate);
    if (Comment.value == "")
	{
		source.errormessage = 'Please, enter your comments.';
		Comment.focus();
		arguments.IsValid=false;
		return;
	}		
    arguments.IsValid=true;
}

function getElementContact(name)
	{
	    var object = null;
	    var tbSmallContact=document.getElementById('tbContact'); 
	    for (var i=0; i<tbSmallContact.rows.length; i++)
        {
            for (var j=0; j<tbSmallContact.rows[i].cells.length; j++)
            {
                for (var k=0; k<tbSmallContact.rows[i].cells[j].childNodes.length; k++)
                {                
                    if(tbSmallContact.rows[i].cells[j].childNodes[k].id == name)
                    {
                       object = tbSmallContact.rows[i].cells[j].childNodes[k];
                       return object;
                    }
                }
            }
           
        }    
	}