	function checkForm(id) 
	{
        var error = false;
        $$('form#'+id+' .required').each(function(node){    	
        	
            if (node.value == "") 
            {               
				error = true;
				node.select();
				node.focus();
                $(node.id + '_m').innerHTML = "<spam style='color:#FF0000'>(Campo requerido)</spam>";
            }
        });
        
        $$('form#'+id+' .requiredN').each(function(node){

            if (node.value == "") 
            {               
				error = true;
				node.select();
				node.focus();
                $(node.id + '_m').innerHTML = "<spam style='color:#FF0000'>(Formato no numerico)</spam>";
            }
            else
            {
            	var strChars = "0123456789.-";
            	
	            for (i = 0; i < node.value.length; i++) {
	
	                strChar = node.value.charAt(i);
	
	                if (strChars.indexOf(strChar) == -1) 
	                {					
						error = true;
	                	$(node.id + '_m').innerHTML = "<spam style='color:#FF0000'>(Formato no numerico)</spam>";	
	                }
	            }
            }
        });
        
        $$('form#'+id+' .fechainc').each(function(node){

        	var exp_reg_fecha = "([0-9]{1,2})-([0-9]{1,2})-([0-9]{4})";

            if (node.value.search(exp_reg_fecha)) 
            {               
				error = true;
				//node.select();
				//node.focus();
                $(node.id + '_m').innerHTML = "<spam style='color:#FF0000'>(Fecha incorrecta)</spam>";
            }
        });
                
        $$('form#'+id+' .emailR').each(function(node){
        
        	if(isValidEmailAddress(node.value) == false)
        	{
		    	error = true;
		        $(node.id + '_m').innerHTML = "<spam style='color:#FF0000'>(Formato Mail incorrecto)</spam>";		
        	}	
        	
        });        
                      
        $$('form#'+id+' .selection').each(function(node){
        	      	      	
            if (node.value == "0") 
            {               
				error = true;				
				node.focus();
                $(node.id + '_m').innerHTML = "<spam style='color:#FF0000'>(Seleccione una opcion)</spam>";
            }
            
        });
        
        if (error == true) 
        {
            alert('Asegurese de rellenar todos los campos requeridos');
            return false;
        } 
        else
        	return true;
    }
    
    function isValidEmailAddress(s)
	{
		var atPosition = s.indexOf("@");
	
		if(atPosition == -1)
			return false;
	
		if(atPosition < s.lastIndexOf("@"))
			return false; // more than one
	
		var dotPosition = s.lastIndexOf(".");
	
		if(dotPosition < atPosition || dotPosition == (atPosition + 1))
			return false;
	
		return true;
		
	}
