	function SetValueCheckBox(checkBoxElement)
	{
		if (checkBoxElement.checked)	checkBoxElement.value = 'Yes';
		else checkBoxElement.value = 'No';
	}
 
	function clearText(thefield) {
	  if (thefield.defaultValue==thefield.value) { thefield.value = "" }
	} 
	function replaceText(thefield) {
	  if (thefield.value=="") { thefield.value = thefield.defaultValue }
	}
	
	
	
	function ValidateEmail(valor) 
    {
	    if (/\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/.test(valor))
		    return true;
	    else
		    return false;
    }

	function ValidateDataSmall(Name,Email,Doctor,Comment)
	{
		
		if ((Name.value == "") || (Name.value == Name.defaultValue))
		{
			alert('Please, enter your name.');
			Name.focus();
			return (false);
		}
		
		if ((Email.value == "") || (Email.value == Email.defaultValue))
		{
			alert('Please, enter your email.');
			Email.focus();
			return (false);
		}
		else
		{
			if(!ValidateEmail(Email.value))
			{
				alert("Please check the emails address.");
				Email.focus();
				return false;
			}
		}
			
		if ((Doctor.value == "") || (Doctor.value == Doctor.defaultValue))
		{
			alert('Please, enter your doctor.');
			Doctor.focus();
			return (false);
		}
			
		if ((Comment.value == "") || (Comment.value ==Comment.defaultValue ))
		{
			alert('Please, enter your comments.');
			Comment.focus();
			return (false);
		}
		
		return true;
	}
	
	function getSmallElement(name)
	{
	    var object = null;
	    var tbSmallContact=document.getElementById('tbSmallContact'); 
	    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;
                    }
                }
            }
           
        }    
	}
	
	function OnSubmit(){
	
		var Name=getSmallElement('Name');
		var Email=getSmallElement('Email');
		var Doctor=getSmallElement('Doctor');
		var Comment=getSmallElement('Comment');	
		var chkSingUp=getSmallElement('chkSingUp');					
		
		if (ValidateDataSmall(Name,Email,Doctor,Comment)==true)
			window.location.href="savesmallform.aspx?Name="+Name.value+"&Email="+Email.value+"&Doctor="+Doctor.value+"&Comment="+Comment.value+"&chkSingUp="+chkSingUp.value;
		
	}