/*!
 * Disbolibilidad de dominios usando AJAX con JQUERY
 * http://baeez.com/verificar_dominios
 *
 * Copyright 2010, Edgar Baez Perez


 * Date: 9 de mayo del 2010
 */
function vacio(q) {
        for ( i = 0; i < q.length; i++ ) {
                if ( q.charAt(i) != " " ) {
                        return true
                }
        }
        return false
}


function disponibilidad_de_dominios_en_mafle(dominio,objeto){
     if( vacio(dominio) == false ) {
                alert("Introduzca un cadena de texto.")
                return;
        }

	$.ajax({
			url: "index.php",
			cache: false,
			data: "M=whois&dominio_mafle="+dominio,
		    async:true,
			timeout:20000,
		//	contentType: "application/x-www-form-urlencoded",
        	dataType: "html",
			type: "POST",
			success: function(resultado_mafle){

				if( resultado_mafle == "DOMINIO_MAFLE_DISPONIBLE"){
					eval("DOMINIO_DISPONIBLE_"+objeto+"();");
				}else if( resultado_mafle == "DOMINIO_MAFLE_NO_DISPONIBLE"){
					eval("DOMINIO_NO_DISPONIBLE_"+objeto+"();");
				}else{
					eval("DOMINIO_DISPONIBLE_ERROR_"+objeto+"();");
				}


				//alert(datos);
			},
			error: function(){
			eval("DOMINIO_DISPONIBLE_ERROR_"+objeto+"();");
			}
			});

}