String.prototype.trim = function() {
	return this.replace(/^\s+|\s+$/g,"");
}

function fncValidEntries(type)
{
	alertMe = "";
	if (document.frm_LineaR.txt_nombre.value.trim() == "") {
		alertMe = "Debe escribir algún nombre";
		document.frm_LineaR.txt_nombre.focus();		
	} else if (document.frm_LineaR.txt_ApellidoP.value.trim() == "") {
		document.frm_LineaR.txt_ApellidoP.focus();
		alertMe = "Debe de escribir su apellido paterno";	
	} else if (document.frm_LineaR.txt_ApellidoM.value.trim() == "") {
		document.frm_LineaR.txt_ApellidoM.focus();
		alertMe = "Debe de escribir su apellido materno";
	} else if (document.frm_LineaR.fecha.value == "") {
		document.frm_LineaR.fecha.focus();
		alertMe = "Debe seleccionar la fecha de su nacimiento";
	} else if (document.frm_LineaR.cmb_EntidadF.value == "") {
		document.frm_LineaR.cmb_EntidadF.focus();
		alertMe = "Debe de escribir su entidad federativa";
	} else if (document.frm_LineaR.cmb_genero.value == "") {
		document.frm_LineaR.cmb_genero.focus();
		alertMe = "Debe seleccionar su género";
	}
	if (alertMe == "") {
		var nombre = document.getElementById("txt_nombre").value;	
		var appaterno = document.getElementById("txt_ApellidoP").value;
		var apmaterno = document.getElementById("txt_ApellidoM").value;
	    var fechanac = document.getElementById("fecha").value;
		var entidad = document.getElementById("cmb_EntidadF").value;		
		var genero = document.getElementById("cmb_genero").value;
		var str = "ALTA."+ nombre.trim() + "." + appaterno.trim() + "." + fechanac + "." + genero;
		var str2 = "ALTA."+ nombre.trim() + "." + appaterno.trim() + "." + apmaterno.trim() + "." + fechanac + "." + genero + "." + entidad;

//alert("debe mandar desde su celular la siguiente Linea: " +" "+ str);
		/*	
		document.frm_LineaR.txt_lineaok.value = str;
		document.frm_LineaR.txt_lineaok2.value = str2;
		*/
		
		
		if(type == null) type = 1;
		
		switch(type){
			case 1:	
				str = str.replace(/[ ]/g,"&nbsp;");
				str = str.replace(/[\.]/g,"<span style='font-size:1.5em;'>.</span>");
				lanza(str,'Para darse de alta en el RENAUT vía datos generales:',4);
			break;
			case 2:
				str2 = str2.replace(/[ ]/g,"&nbsp;");
				str2 = str2.replace(/[\.]/g,"<span style='font-size:1.5em;'>.</span>");
				lanza(str2,'Para darse de alta en el RENAUT vía datos generales (datos completos):',5);
			break;
		}
		

		Ok = true;
		
	} else {
		alert(alertMe);
		Ok = false

	}
	return Ok;	
}

function fncValidEntries2(type)
{
	alertMe = "";
	if (document.frm_LineaR.txt_nombre.value.trim() == "") {
		alertMe = "Debe escribir algún nombre";
		document.frm_LineaR.txt_nombre.focus();		
	} else if (document.frm_LineaR.txt_ApellidoP.value.trim() == "") {
		document.frm_LineaR.txt_ApellidoP.focus();
		alertMe = "Debe de escribir su apellido paterno";
	} else if (document.frm_LineaR.txt_ApellidoM.value.trim() == "") {
		document.frm_LineaR.txt_ApellidoM.focus();
		alertMe = "Debe de escribir su apellido materno";
	} else if (document.frm_LineaR.fecha.value == "") {
		document.frm_LineaR.fecha.focus();
		alertMe = "Debe seleccionar la fecha de su nacimiento";
	} else if (document.frm_LineaR.cmb_EntidadF.value == "") {
		document.frm_LineaR.cmb_EntidadF.focus();
		alertMe = "Debe de escribir su entidad federativa";
	} else if (document.frm_LineaR.cmb_genero.value == "") {
		document.frm_LineaR.cmb_genero.focus();
		alertMe = "Debe seleccionar su género";
	}
	if (alertMe == "") {
		var nombre = document.getElementById("txt_nombre").value;	
		var appaterno = document.getElementById("txt_ApellidoP").value;
		var apmaterno = document.getElementById("txt_ApellidoM").value;
		var fechanac = document.getElementById("fecha").value;
		var entidad = document.getElementById("cmb_EntidadF").value;		
		var genero = document.getElementById("cmb_genero").value;
		var str = "CURP."+ nombre.trim() + "." + appaterno.trim() + "." + apmaterno.trim() + "." + fechanac + "." + genero;
		var str2 = "CURP."+ nombre.trim() + "." + appaterno.trim() + "." + apmaterno.trim() + "." + fechanac + "." + genero + "." + entidad;

		//alert("debe mandar desde su celular la siguiente Linea: " +" "+ str);
		/*
		var div1 = document.getElementById("txt_lineaok");
		var div2 = document.getElementById("txt_lineaok2");
		*/
		/*
		document.frm_LineaR.txt_lineaok.value = str;
		document.frm_LineaR.txt_lineaok2.value = str2;
		*/
		
		if(type == null) type = 1;
		
		switch(type){
			case 1:	
				str = str.replace(/[ ]/g,"&nbsp;");
				str = str.replace(/[\.]/g,"<span style='font-size:1.5em;'>.</span>");
				lanza(str,'Para consultar su CURP vía SMS:');
			break;
			case 2:
				str2 = str2.replace(/[ ]/g,"&nbsp;");
				str2 = str2.replace(/[\.]/g,"<span style='font-size:1.5em;'>.</span>");
				lanza(str2,'Para consultar su CURP vía SMS (datos completos):',2);
			break;
		}
		//funcion de shadowbox::
		
		/*
		div1.innerHTML = str;
		div2.innerHTML = str2;
		*/

		Ok = true;
		
	} else {
		alert(alertMe);
		Ok = false

	}
	return Ok;	
}

function fncValidEntries3()
{
	alertMe = "";
	if (document.form1.txt_curp.value == "") {
		alertMe = "Debe escribir su CURP";
		document.form1.txt_curp.focus();		
	} else if (document.form1.txt_nip.value == "") {
		document.form1.txt_nip.focus();
		alertMe = "Debe escribir su NIP";
	}
	if (alertMe == "") {
		var CURP = document.getElementById("txt_curp").value;	
		var NIP = document.getElementById("txt_nip").value;
		var str = "ALTA."+ CURP + "." + NIP;
	
		//alert("debe mandar desde su celular la siguiente Linea: " +" "+ str);
				
		document.form1.txt_lineaok.value = str;

		Ok = true;
		
	} else {
		alert(alertMe);
		Ok = false

	}
	return Ok;	
}


function fncValidEntries4()
{
	alertMe = "";
	if (document.form1.txt_curp.value == "") {
		alertMe = "Debe escribir su CURP";
		document.form1.txt_curp.focus();			
	}
	if (alertMe == "") {
		var CURP = document.getElementById("txt_curp").value;	
		var str = "BAJA."+ CURP;
	
		//alert("debe mandar desde su celular la siguiente Linea: " +" "+ str);
				
		document.form1.txt_lineaok.value = str;

		Ok = true;
		
	} else {
		alert(alertMe);
		Ok = false

	}
	return Ok;	
}

function fncValidEntries5()
{
	alertMe = "";
	if (document.form1.txt_curp.value == "") {
		alertMe = "Debe escribir su CURP";
		document.form1.txt_curp.focus();		
	}
	if (alertMe == "") {
		var CURP = document.getElementById("txt_curp").value;	
		var str = "ALTA."+ CURP;
	
		//alert("debe mandar desde su celular la siguiente Linea: " +" "+ str);
				
		document.form1.txt_lineaok.value = str;

		Ok = true;
		
	} else {
		alert(alertMe);
		Ok = false

	}
	return Ok;	
}
