function MM_jumpMenu(targ,selObj,restore){ //v3.0

  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");

  if (restore) selObj.selectedIndex=0;

}

function validateFormOnSubmit(theForm) {

	var reason = "";

	//seccion donde validamos los datos de la agencia

  	reason += validateEmpty(theForm.correo);

	reason += validateEmpty(theForm.nombre);

	reason += validateEmpty(theForm.pais);

	reason += validateEmpty(theForm.estado);

	reason += validateEmpty(theForm.password);

	reason += validateEmpty(theForm.apellido);

	reason += validateEmpty(theForm.roll);

	reason += validateEmpty(theForm.industria);

	reason += validateEmpty(theForm.codigo_postal);
	reason += validateEmpty(theForm.ciudad);

	//termina seccion para la validacion  de detalle inmueble

	

  if (reason != "") {

    alert("Estos campos necesitas ser llenados:\n" + reason);

    return false;

  }else{

	  return true;

  }

}

function validateEmpty(fld) {

    var error = "";

  

    if (fld.value.length == 0) {

        fld.style.background = 'Yellow';

		fld.focus();

        error = "Estos campos necesitas ser llenados:\n"

    } else {

        fld.style.background = 'White';

    }

    return error;   

}



function trim(s)

{

  return s.replace(/^\s+|\s+$/, '');

} 



function validateEmail(fld) {

    var error="";

    var tfld = trim(fld.value);                        // value of field with whitespace trimmed off

    var emailFilter = /^[^@]+@[^@.]+\.[^@]*\w\w$/ ;

    var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/ ;

    

    if (fld.value == "") {

        fld.style.background = 'Yellow';

        error = "Su Dirección De Correo Es Invalida.\n";

    } else if (!emailFilter.test(tfld)) {              //test email for illegal characters

        fld.style.background = 'Yellow';

        error = "Su Dirección De Correo Es Invalida.\n";

    } else if (fld.value.match(illegalChars)) {

        fld.style.background = 'Yellow';

        error = "Su Dirección De Correo Es Invalida Contiene Caracteres No validos.\n";

    } else {

        fld.style.background = 'White';

    }

    return error;

}

function validatePhone(fld) {

    var error = "";

    var stripped = fld.value.replace(/[\(\)\.\-\ ]/g, '');     



   if (fld.value == "") {

        error = "You didn't enter a phone number.\n";

        fld.style.background = 'Yellow';

    } else if (isNaN(parseInt(stripped))) {

        error = "The phone number contains illegal characters.\n";

        fld.style.background = 'Yellow';

    } else if (!(stripped.length == 10)) {

        error = "The phone number is the wrong length. Make sure you included an area code.\n";

        fld.style.background = 'Yellow';

    } 

    return error;

}