// JavaScript Document
//temUrl ='http://'+location.hostname+'/Alfadomus/'; 		
temUrl ='http://' +location.hostname+'/'; 	
//temUrl ='http://'+location.hostname+'/Prueba/';


function funPaginacion(){
	var opcion = document.getElementById('paginas').options[document.getElementById('paginas').selectedIndex].value;
	total_pag = document.getElementById('total_pag').value;
	cadena = document.getElementById('cadena').value;
	boletin = document.getElementById('boletin').value;
	orden = document.getElementById('orden').value;
	mostrar = document.getElementById('mostrar').value;	
	ocupacion = document.getElementById('ocupacion').value;	
	genero = document.getElementById('genero').value;
	pais = document.getElementById('pais').value;
	ciudad = document.getElementById('ciudad').value;
//	alert(opcion+cadena+" "+ocupacion);
	values = 'pagina='+opcion+'&ocupacion='+ocupacion+'&boletin='+boletin+'&orden='+orden+'&mostrar='+mostrar+'&genero='+genero+'&pais='+pais+'&ciudad='+ciudad;
//	alert (cadena);
//	values = 'pagina='+opcion;
	_URL_ = temUrl + "mCargarDatosTabla.php?";
	xmlreq = new InstanciarXMLHttpRequest();	
	xmlreq.open("POST", _URL_, true);
	xmlreq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	xmlreq.onreadystatechange = function(){
		if(xmlreq.readyState == 4){	

			if(xmlreq.status == 200){	
				var datosxml = xmlreq.responseText;	

				funCargarXHTML(datosxml, 'tabla');				
			}
			else{
				if(xmlreq.status==404){
					alert("La URL NO existe");
				}
				else{
					alert("Error: "+xmlreq.status);
				}
			}			
		}
	}
	
	xmlreq.send(values);
//	alert (opcion);

}

function Act_usuarios(id){
//	id_user=id;
	
	var user=document.getElementById('user').value;
	var nombres=document.getElementById('nombres').value;
	var apellidos=document.getElementById('apellidos').value;
	var email=document.getElementById('email').value;
	var telefono=document.getElementById('telefono').value;
	var clave=document.getElementById('clave').value;
	var genero=document.getElementById('genero').options[document.getElementById('genero').selectedIndex].text;
	var anio = document.getElementById('anio').options[document.getElementById('anio').selectedIndex].text;	
	var mes = document.getElementById('mes').options[document.getElementById('mes').selectedIndex].text;
	var dia = document.getElementById('dia').options[document.getElementById('dia').selectedIndex].text;
//	alert(anio+"+"+mes+"+"+dia);
	var ciudad=document.getElementById('ciudad').value;
	var pais=document.getElementById('pais').value;
	var ocupacion=document.getElementById('ocupacion').options[document.getElementById('ocupacion').selectedIndex].text;	
	var fecha_nac=anio+"-"+mes+"-"+dia;

	values = 'id_user='+id+'&user='+user+'&nombres='+nombres+'&apellidos='+apellidos+'&email='+email+'&telefono='+telefono+'&clave='+clave+'&genero='+genero+'&fecha_nac='+fecha_nac+'&ciudad='+ciudad+'&pais='+pais+'&ocupacion='+ocupacion;
	
	_URL_ = temUrl+"Controlador/cActUsuarios.php";
	xmlreq = new InstanciarXMLHttpRequest();	
	xmlreq.open("POST", _URL_, true);
	xmlreq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	xmlreq.onreadystatechange = function(){
		if(xmlreq.readyState == 4)
		{	
			if(xmlreq.status == 200)
			{			
				var datosxml = xmlreq.responseText;	
				funCargarXHTML(datosxml, 'contentInt');
			}
			else
			{
				if(xmlreq.status==404){
					alert("La URL NO existe");
				}
				else{
					alert("Error: "+xmlreq.status);
				}
			}			
		}
	}
	xmlreq.send(values);

//	window.close();
//	if (window.opener && !window.opener.closed) {
//		window.opener.location.reload();
//	}

	
	
}

function Cambiar_Pais(){
	var pais = document.getElementById('pais2').options[document.getElementById('pais2').selectedIndex].value;
	document.getElementById('pais').value=pais;
}


function Borrar_div(){
	var datosxml="";
	alert ("cargar datos");
	document.getElementById("div_login").innerHTML="";
	document.getElementById("div_login2").innerHTML="";
}


function MM_openBrWindow(theURL,winName,features) { //v2.0

  window.open(theURL,winName,features);
}

function funCargarXHTML(datosxml, divOld){
	refDiv = document.getElementById(divOld);
	refDiv.innerHTML = datosxml; 
}

function funCargarXHTMLbanner(datosxml, divOld){
	refDiv = document.getElementById(divOld);
	refDiv.innerHTML = datosxml; 
}

function funCargarContenido(id,tipo){ 

	opcion = 'menuCategoria';
	values = 'id='+id+'&tipo='+tipo;

//	_URL_=temUrl+"controlador/CCargacolecc0.php";
	_URL_=temUrl+"Controlador/CCargarContenido.php";

//	_URL_=temUrl+"hola.xml";
	var datosxml = null;
	xmlreq = new InstanciarXMLHttpRequest();	
	xmlreq.open("POST", _URL_, true);
	xmlreq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	xmlreq.onreadystatechange = function(){
		if(xmlreq.readyState == 4){	
			if(xmlreq.status == 200){

			//	var datosxml = xmlreq.responseXML;
				datosxml = xmlreq.responseText;	
//				alert(datosxml);
				funCargarXHTML(datosxml, 'contentInt');
				if (id == 1){//Para que cargue el banner de HOme al regresarse d la galeria
					setTimeout("MostrarSWF(0)", 300);
				}

				if (id == 200){//Productos
					setTimeout("MostrarSWF(200)", 500);
				}

				if (id == 301)//Quienes somos
				{
					setTimeout("MostrarSWF(301)", 500);
				}

				if (id == 303)//La Planta
				{
					setTimeout("MostrarSWF(303)", 500);
				}

				if (id == 304)//Exportaciones
				{
					setTimeout("MostrarSWF(304)", 500);
				}

				if (id == 400)//Galeria de obras
				{
					document.getElementById('contenedor').innerHTML='<div id="div_banner"></div>';
					//document.getElementById('contenedor').style.display='none';
					//document.getElementById('contenedor').style.height='0';
					//document.getElementById('div_banner').style.height='0';
					
					setTimeout("MostrarSWF(1)", 1500);
				}

				if (id == 501){//distribuidores

					setTimeout("MostrarSWF(501)", 1500);
					
				}

			}
			else{
				if(xmlreq.status==404){
					alert("La URL NO existe");

				}
				else{
					alert("Error: "+xmlreq.status);

				}
			}			
		}
	}
	
	
	xmlreq.send(values);
}

function MostrarSWF(id)
{
	var attributes = {
		wmode: "transparent"
	};
	var params = {wmode:'transparent'};
	if (id == 0)//Banner HOme
	{
		banner1=temUrl+"swf/banner_home.swf";
		refDiv1="div_banner";
		alto1="247";
		ancho1="806";
		swfobject.embedSWF(banner1, refDiv1, ancho1, alto1, "9.0.0", "expressInstall.swf",false,params,attributes);
	}
	
	if (id == 1)
	{
		banner1=temUrl+"swf/gallery.swf";
		refDiv1="div_galeria";
		alto1="580";
		ancho1="806";
		swfobject.embedSWF(banner1, refDiv1, ancho1, alto1, "9.0.0", "expressInstall.swf",false,params,attributes);
	}
	if (id == 200)//Productos
	{
		banner1=temUrl+"swf/banner_productos.swf";
		refDiv1="div_banner";
		alto1="247";
		ancho1="806";
		swfobject.embedSWF(banner1, refDiv1, ancho1, alto1, "9.0.0", "expressInstall.swf",false,params,attributes);
	}
	if (id == 301)//Quienes somos
	{
		banner1=temUrl+"swf/banner_quienes.swf";
		refDiv1="div_banner";
		alto1="247";
		ancho1="806";
		swfobject.embedSWF(banner1, refDiv1, ancho1, alto1, "9.0.0", "expressInstall.swf",false,params,attributes);
	}
	
	if (id == 303)//Quienes somos
	{
		banner1=temUrl+"swf/banner_planta.swf";
		refDiv1="div_banner";
		alto1="247";
		ancho1="806";
		swfobject.embedSWF(banner1, refDiv1, ancho1, alto1, "9.0.0", "expressInstall.swf",false,params,attributes);
	}
	
	

	if (id == 304)//Exportaciones
	{
		banner1=temUrl+"swf/banner_export.swf";
		refDiv1="div_banner";
		alto1="247";
		ancho1="806";
		swfobject.embedSWF(banner1, refDiv1, ancho1, alto1, "9.0.0", "expressInstall.swf",false,params,attributes);
	}



	if (id == 501)//Distribuidores
	{
		banner1=temUrl+"swf/mapa.swf";
		refDiv1="div_distribuidores";
		alto1="345";
		ancho1="450";
		swfobject.embedSWF(banner1, refDiv1, ancho1, alto1, "9.0.0", "expressInstall.swf",false,params,attributes);
	}

}



function InstanciarXMLHttpRequest(){
var aVersions = [ 'MSXML2.XMLHttp.5.0',
'MSXML2.XMLHttp.4.0','MSXML2.XMLHttp.3.0',
'MSXML2.XMLHttp','Microsoft.XMLHttp'
];

	if (window.XMLHttpRequest){
		// para IE7, Mozilla, Safari, etc: que usen el objeto nativo
		return new XMLHttpRequest();
		}else if (window.ActiveXObject){
			// de lo contrario utilizar el control ActiveX para IE5.x y IE6.x
			for (var i = 0; i < aVersions.length; i++) {
				try {
					var oXmlHttp = new ActiveXObject(aVersions[i]);
					return oXmlHttp;
				}catch (error) {
				//no necesitamos hacer nada especial
				}
			}
	}
}


function funRegistrar(){

	user = document.getElementById('user2').value;
	pass = document.getElementById('clave2').value;	
	apellido = document.getElementById('apellido2').value;
	nombre = document.getElementById('nombre2').value;
	email = document.getElementById('email2').value;	
	telefono = document.getElementById('telefono2').value;	
	genero = document.getElementById('genero2').options[document.getElementById('genero2').selectedIndex].text;
	anio = document.getElementById('anio2').options[document.getElementById('anio2').selectedIndex].text;	
	mes = document.getElementById('mes2').options[document.getElementById('mes2').selectedIndex].text;	
	dia = document.getElementById('dia2').options[document.getElementById('dia2').selectedIndex].text;
	pais =document.getElementById('pais2').options[document.getElementById('pais2').selectedIndex].text;
	ciudad = document.getElementById('ciudad2').value;	
	ocupacion =document.getElementById('ocupacion2').options[document.getElementById('ocupacion2').selectedIndex].text;
//	Validar campos obligatorios
	if(user == ''){
		alert('Debe ingresar el usuario de la persona'); return false;
	}
	if(pass == ''){
		alert('Debe ingresar la fecha de nacimiento'); return false;
	}
	if(nombre == ''){
		alert('Debe ingresar los nombres de la persona'); return false;
	}
	if(apellido == ''){
		alert('Debe ingresar los apellidos de la persona'); return false;
	}
	if(email == ''){
		alert('Debe ingresar el correo de la persona'); return false;
	}
	if(telefono == ''){
		alert('Debe ingresar el telefono de la persona'); return false;
	}
	if(genero == ''){
		alert('Debe ingresar el genero de la persona'); return false;
	}
	if(anio == ''){
		alert('Debe escoger un anio de nacimiento para la persona'); return false;
	}
	if(mes == ''){
		alert('Debe escoger un mes de nacimiento para la persona'); return false;
	}
	if(dia == ''){
		alert('Debe escoger un dia de nacimiento para la persona'); return false;
	}
	if(pais == ''){
		alert('Debe ingresar el pais de origen de la persona'); return false;
	}
	if(ciudad == ''){
		alert('Debe escoger una ciudad para la persona'); return false;
	}
	if(ocupacion == ''){
		alert('Debe escoger una ocupacion para la persona'); return false;
	}

	_URL_=temUrl+"Controlador/cInsertarDatos.php?";
//	alert(_URL_);
	values = 'user='+user+'&pass='+pass+'&nombre='+nombre+'&apellido='+apellido+'&email='+email+'&telefono='+telefono+'&genero='+genero+'&anio='+anio+'&mes='+mes+'&dia='+dia+'&pais='+pais+'&ciudad='+ciudad+'&ocupacion='+ocupacion;

	xmlreq = new InstanciarXMLHttpRequest();	
	xmlreq.open("POST", _URL_, true);
	xmlreq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	xmlreq.onreadystatechange = function(){
		if(xmlreq.readyState == 4){	
			if(xmlreq.status == 200){			
				var datosxml = '';	
				//alert (values);
				datosxml = xmlreq.responseText;	
				//alert(datosxml);
				funCargarXHTML(datosxml, 'contentInt');
			}
			else{
				if(xmlreq.status==404){
					alert("La URL NO existe");
				}
				else{
					alert("Error: "+xmlreq.status);
				}
			}			
		}
	}
	xmlreq.send(values);
	
}
//Registra pero no envia el mail de confirmacion al cliente o al administrador
function funRegistrar_sinmail(){

	user = document.getElementById('user2').value;
	pass = document.getElementById('clave2').value;	
	apellido = document.getElementById('apellido2').value;
	nombre = document.getElementById('nombre2').value;
	email = document.getElementById('email2').value;	
	telefono = document.getElementById('telefono2').value;	
	genero = document.getElementById('genero2').options[document.getElementById('genero2').selectedIndex].text;
	anio = document.getElementById('anio2').options[document.getElementById('anio2').selectedIndex].text;	
	mes = document.getElementById('mes2').options[document.getElementById('mes2').selectedIndex].text;	
	dia = document.getElementById('dia2').options[document.getElementById('dia2').selectedIndex].text;
	pais =document.getElementById('pais2').options[document.getElementById('pais2').selectedIndex].text;
	ciudad = document.getElementById('ciudad2').value;	
	ocupacion =document.getElementById('ocupacion2').options[document.getElementById('ocupacion2').selectedIndex].text;
//	Validar campos obligatorios
	if(user == ''){
		alert('Debe ingresar el usuario de la persona'); return false;
	}
	if(pass == ''){
		alert('Debe ingresar la fecha de nacimiento'); return false;
	}
	if(nombre == ''){
		alert('Debe ingresar los nombres de la persona'); return false;
	}
	if(apellido == ''){
		alert('Debe ingresar los apellidos de la persona'); return false;
	}
	if(email == ''){
		alert('Debe ingresar el correo de la persona'); return false;
	}
	if(telefono == ''){
		alert('Debe ingresar el telefono de la persona'); return false;
	}
	if(genero == ''){
		alert('Debe ingresar el genero de la persona'); return false;
	}
	if(anio == ''){
		alert('Debe escoger un anio de nacimiento para la persona'); return false;
	}
	if(mes == ''){
		alert('Debe escoger un mes de nacimiento para la persona'); return false;
	}
	if(dia == ''){
		alert('Debe escoger un dia de nacimiento para la persona'); return false;
	}
	if(pais == ''){
		alert('Debe ingresar el pais de origen de la persona'); return false;
	}
	if(ciudad == ''){
		alert('Debe escoger una ciudad para la persona'); return false;
	}
	if(ocupacion == ''){
		alert('Debe escoger una ocupacion para la persona'); return false;
	}

	_URL_=temUrl+"Controlador/cInsertarDatos_sinmail.php?";
//	alert(_URL_);
	values = 'user='+user+'&pass='+pass+'&nombre='+nombre+'&apellido='+apellido+'&email='+email+'&telefono='+telefono+'&genero='+genero+'&anio='+anio+'&mes='+mes+'&dia='+dia+'&pais='+pais+'&ciudad='+ciudad+'&ocupacion='+ocupacion;

	xmlreq = new InstanciarXMLHttpRequest();	
	xmlreq.open("POST", _URL_, true);
	xmlreq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	xmlreq.onreadystatechange = function(){
		if(xmlreq.readyState == 4){	
			if(xmlreq.status == 200){			
				var datosxml = '';	
				//alert (values);
				datosxml = xmlreq.responseText;	
				//alert(datosxml);
				funCargarXHTML(datosxml, 'contentInt');
			}
			else{
				if(xmlreq.status==404){
					alert("La URL NO existe");
				}
				else{
					alert("Error: "+xmlreq.status);
				}
			}			
		}
	}
	xmlreq.send(values);
	
}


function mensaje_mundo()
{
	alert('Hola mundo');

}

/*-FORMULARIO DE SERVICIO TECNICO-*/

function Enviar_Contrasenia()
{
	var mailuser = document.getElementById('mailuser').value;	
	if (mailuser.length == 0){
		alert("Debe ingresar una direccion de Email");
	}
	else{
		validar=1;
	}
//      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
//        if (p<1 || p==(val.length-1)) errors+='- '+nm+' debe contener una dirección válida de E-mail.\n';
//      } 
//
//		validar=1;

  	_URL_=temUrl+"controlador/cEnviarRecuperarContrasenia.php?";
//	if ()
	if (validar == 1){
		values = 'mailuser='+mailuser;
			
		xmlreq = new InstanciarXMLHttpRequest();	
		xmlreq.open("POST", _URL_, true);
		xmlreq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		xmlreq.onreadystatechange = function(){
			if(xmlreq.readyState == 4)
			{	
				if(xmlreq.status == 200)
				{			
					var datosxml = '';	
	//				alert (values);
					datosxml = xmlreq.responseText;	
	//				alert(datosxml);
					funCargarXHTML(datosxml, 'div_cuerpo');
				}
				else
				{
					if(xmlreq.status==404)
					{
						alert("La URL NO existe");
					}
					else
					{
						alert("Error: "+xmlreq.status);
					}
				}			
			}
		}
		xmlreq.send(values);
	}else{
		alert ("No fue posible realizar la operaci&oacute;n de recuperaci&oacute;n de la contrase&ntilde;a.");
		}

}

function Ingresar_Usuario()
{

	var mailuser = document.getElementById('mail_user').value;
	var clave = document.getElementById('clave').value;	
	if (mailuser.length == 0 || mailuser == '@'){
		alert("Debe ingresar una direccion de Email");
	}else{
		validar=1
	}
	if (clave.length == 0){
		alert("Debe ingresar su clave de usuario");
	}
	else{
		validar=validar+1;
	}
	if (isEmailAddress()){
		validar=validar+1;
	}
  	_URL_=temUrl+"controlador/cIngresoUsuario.php?";

	if (validar == 3){
		values = 'mailuser='+mailuser+'&clave='+clave;
			
		xmlreq = new InstanciarXMLHttpRequest();	
		xmlreq.open("POST", _URL_, true);
		xmlreq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		xmlreq.onreadystatechange = function(){
			if(xmlreq.readyState == 4)
			{	
				if(xmlreq.status == 200)
				{			
					var datosxml = '';	
					datosxml = xmlreq.responseText;
					//para validar debe buscar el mail que exista dentro de la base antes d enviar a mostrar el mensaje de Bienvenido con los respectivos nombres y apellidos
					if(datosxml.indexOf('correo no se encuentra registrado')<=0){
						Borrar_Div_Login(mailuser,clave);
					}else{
						document.getElementById('mail_user').value="@";

					}
					
					funCargarXHTML(datosxml, 'div_cuerpo');
				}
				else
				{
					if(xmlreq.status==404)
					{
						alert("La URL NO existe");
					}
					else
					{
						alert("Error: "+xmlreq.status);
					}
				}			
			}
		}
		document.getElementById('clave').value="";
		xmlreq.send(values);
	}else{
		alert ("No fue posible realizar la operación de ingreso con el mail ingresado.");
		}

}

function cargar_usuario(){
	var email=document.getElementById('user_name').value;
	var pass=document.getElementById('user_pass').value;
	values = 'email='+email+'&pass='+pass;
	_URL_ = temUrl + "Controlador/cCargarEditarUsuario.php?";
	xmlreq = new InstanciarXMLHttpRequest();	
	xmlreq.open("POST", _URL_, true);
	xmlreq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	xmlreq.onreadystatechange = function(){
		if(xmlreq.readyState == 4)
		{	
			if(xmlreq.status == 200)
			{	
				var datosxml = xmlreq.responseText;
				funCargarXHTML(datosxml, 'contentInt');				
				}
				else
				{
					if(xmlreq.status==404){
						alert("La URL NO existe");
					}
					else
					{
						alert("Error: "+xmlreq.status);
					}
				}			
			}
		}
		xmlreq.send(values);

}

function Login_user()
{
	var	email = document.getElementById('usuario').value;
	var	pass = document.getElementById('pass').value;
	var bandera = -1;
	if (email.lenght < 5 || email == ""){
		alert ("Debe ingresar el email del usuario");
		document.getElementById('usuario').focus();
		bandera = 0;
		return false;
	}else{
		bandera = 1;
	}
	
	if (pass.lenght <= 0 || pass == ""){
		alert ("Debe ingresar la clave del usuario");
		document.getElementById('pass').focus();
		bandera =0;
		return false;
	}else{
		bandera = bandera +1;
	}
	if(bandera >=2)
	{
		values = 'email='+email+'&pass='+pass;
		_URL_ = temUrl + "Controlador/cCargarEditarUsuario.php?";
		xmlreq = new InstanciarXMLHttpRequest();	
		xmlreq.open("POST", _URL_, true);
		xmlreq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		xmlreq.onreadystatechange = function(){
			if(xmlreq.readyState == 4){	
	
				if(xmlreq.status == 200){	
					var datosxml = xmlreq.responseText;	
					if(datosxml.indexOf('El mail no se encuentra registrado en nuestro sistema.')<0){						Borrar_Div_Login(email,pass);
					}else{
						document.getElementById('pass').value="";

					}
					funCargarXHTML(datosxml, 'contentInt');				
				}
				else
				{
					if(xmlreq.status==404){
						alert("La URL NO existe");
					}
					else
					{
						alert("Error: "+xmlreq.status);
					}
				}			
			}
		}
		xmlreq.send(values);
	//	document.getElementById('pass').value="";
//		Borrar_div();

	}
	
}


function Borrar_Div_Login(mail,clave){
	  	_URL_=temUrl+"Controlador/cBorrarDivLogin.php?";

		values = 'mailuser='+mail+'&clave='+clave;

		xmlreq = new InstanciarXMLHttpRequest();	
		xmlreq.open("POST", _URL_, true);
		xmlreq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		xmlreq.onreadystatechange = function(){
			if(xmlreq.readyState == 4)
			{	
				if(xmlreq.status == 200)
				{			
					var datosxml = '';	
					datosxml = xmlreq.responseText;	
					funCargarXHTML(datosxml, 'div_login');
				}
				else
				{
					if(xmlreq.status==404)
					{
						alert("La URL NO existe");
					}
					else
					{
						alert("Error: "+xmlreq.status);
					}
				}			
			}
		}
//		document.getElementById('clave').value="";
		xmlreq.send(values);
		
}

function Carga_Div_Login(){
		_URL_=temUrl+"Modelo/mCargaDivLogin.php?";
		values = "";
			
		xmlreq = new InstanciarXMLHttpRequest();	
		xmlreq.open("POST", _URL_, true);
		xmlreq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		xmlreq.onreadystatechange = function(){
			if(xmlreq.readyState == 4)
			{	
				if(xmlreq.status == 200)
				{			
					var datosxml = '';	
					datosxml = xmlreq.responseText;	
					//alert(datosxml);
					//Aki pongo el mensaje q se ha desconectado de forma correcta
					funSalidaUsuario();
					funCargarXHTML(datosxml, 'div_login');

				}
				else
				{
					if(xmlreq.status==404)
					{
						alert("La URL NO existe");
					}
					else
					{
						alert("Error: "+xmlreq.status);
					}
				}			
			}
		}
//		document.getElementById('clave').value="";

		xmlreq.send(null);
}
function funSalidaUsuario(){
		_URL_=temUrl+"Modelo/mSalidaUsuario.php?";
		values = "";
			
		xmlreq = new InstanciarXMLHttpRequest();	
		xmlreq.open("POST", _URL_, true);
		xmlreq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		xmlreq.onreadystatechange = function(){
			if(xmlreq.readyState == 4)
			{	
				if(xmlreq.status == 200)
				{			
					var datosxml = '';	
					datosxml = xmlreq.responseText;	
					//alert(datosxml);
					funCargarXHTML(datosxml, 'contentInt');
				}
				else
				{
					if(xmlreq.status==404)
					{
						alert("La URL NO existe");
					}
					else
					{
						alert("Error: "+xmlreq.status);
					}
				}			
			}
		}
//		document.getElementById('clave').value="";

		xmlreq.send(null);
}



function Actualizar_Datos(){
	var nombres = document.getElementById('nombres').value;	
	var apellidos = document.getElementById('apellidos').value;	
	var email = document.getElementById('email').value;	
	var telefono = document.getElementById('telefono').value;
	var ciudad = document.getElementById('ciudad').value;
	var user = document.getElementById('user').value;		
	var ocupacion = document.getElementById('ocupacion2').options[document.getElementById('ocupacion2').selectedIndex].value;	
;		

	if (nombres.length == 0){
		alert("Debe ingresar el nombre del usuario");
		validar=0;
	}
	if (apellidos.length == 0){
		alert("Debe ingresar al menos un apellido del usuario");
		validar=0;
	}
	if (email.length == 0){
		alert("Debe ingresar una direccion de Email");
		validar=0;	
	}
	if (telefono.length == 0){
		alert("Debe ingresar un telefono del usuario");
		validar=0;
	}
	if (ciudad.length == 0){
		alert("Debe ingresar la ciudad de origen del usuario");
		validar=0;
	}
	if (ocupacion.length == 0){
		alert("Debe escoger una profesion de la lista");
		validar=0;		
	}
	else{
		validar=1;
	}
  	_URL_=temUrl+"controlador/cActDatos.php?";
//	if ()
	if (validar == 1){
	values = 'nombres='+nombres+'&apellidos='+apellidos+'&email='+email+'&telefono='+telefono+'&ciudad='+ciudad+'&ocupacion='+ocupacion+'&user='+user;
			
		xmlreq = new InstanciarXMLHttpRequest();	
		xmlreq.open("POST", _URL_, true);
		xmlreq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		xmlreq.onreadystatechange = function(){
			if(xmlreq.readyState == 4)
			{	
				if(xmlreq.status == 200)
				{			
					var datosxml = '';	
	//				alert (values);
					datosxml = xmlreq.responseText;	
	//				alert(datosxml);
					Carga_Div_Login();
					funCargarXHTML(datosxml, 'div_cuerpo');
				}
				else
				{
					if(xmlreq.status==404)
					{
						alert("La URL NO existe");
					}
					else
					{
						alert("Error: "+xmlreq.status);
					}
				}			
			}
		}
		xmlreq.send(values);
	}else{
		alert ("No fue posible realizar la operaci&oacute;n de actualizaci&oacute;n de los datos.");
		}

}

function funBorrarContenido(){
	document.getElementById('nombre').value="";
	document.getElementById('ciudad').value="";
	document.getElementById('email').value="";	
	document.getElementById('titulo').value="";
	document.getElementById('mensaje1').value="";	

}

function funEnviarContactenos(){
	var nombre = document.getElementById('nombre').value;
	var ciudad = document.getElementById('ciudad').value;
	var email = document.getElementById('email').value;	
	var titulo = document.getElementById('titulo').value;
	var mensaje = document.getElementById('mensaje1').value;	
	var validar=1;
	if (nombre.length == 0){
		alert("Debe ingresar el nombre de la persona.");
		document.getElementById('nombre').focus();
		validar=0;
	}
	if (ciudad.length == 0){
		alert("Debe ingresar la ciudad de origen de la persona.");
		document.getElementById('ciudad').focus();
		validar=0;
	}
	if (email.length == 0){
		alert("Debe ingresar una direccion de Email para poder comunicarnos con Ud.");
		document.getElementById('email').focus();
		validar=0;
	}
	if (titulo.length == 0){
		alert("Debe ingresar un titulo para su mensaje.");
		document.getElementById('titulo').focus();
		validar=0;
	}
	if (mensaje.length == 0){
		alert("Debe ingresar el mensaje con su inquietud.");
		document.getElementById('mensaje1').focus();
		validar=0;		
	}
	
	if (validar >=1){
		values = 'nombre='+nombre+'&ciudad='+ciudad+'&email='+email+'&titulo='+titulo+'&mensaje='+mensaje;

		_URL_=temUrl+"Controlador/cEnviarMailAsesoria.php?";
		xmlreq = new InstanciarXMLHttpRequest();	
		xmlreq.open("POST", _URL_, true);
		xmlreq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		xmlreq.onreadystatechange = function(){
			if(xmlreq.readyState == 4)
			{	
				if(xmlreq.status == 200)
				{			
					var datosxml = '';	
					datosxml = xmlreq.responseText;	
					funCargarXHTML(datosxml, 'div_cuerpo');
				}
				else
				{
					if(xmlreq.status==404)
					{
						alert("La URL NO existe");
					}
					else
					{
						alert("Error: "+xmlreq.status);
					}
				}			
			}
		}
		xmlreq.send(values);
	}

}

function EnviarMasivos()
{

		_URL_=temUrl+"Controlador/cEnviarMasivos.php?";
		xmlreq = new InstanciarXMLHttpRequest();	
		xmlreq.open("POST", _URL_, true);
		xmlreq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		xmlreq.onreadystatechange = function()
		{
			if(xmlreq.readyState == 4)
			{	
				if(xmlreq.status == 200)
				{			
					var datosxml = '';	
					datosxml = xmlreq.responseText;	
					funCargarXHTML(datosxml, 'div_cuerpo');
				}
				else
				{
					if(xmlreq.status==404)
					{
						alert("La URL NO existe");
					}
					else
					{
						alert("Error: "+xmlreq.status);
					}
				}			
			}
		}
		xmlreq.send(null);
		
}


function AbrirImagenCertificacion(id){

	if (id == 1)
	{
		_URL_="Certificacion.html";
	}

	if (id == 2)
	{
		_URL_="Certificacion2.html";
	}
	if (id == 3)
	{
		_URL_="Certificacion3.html";
	}	
	win1=window.open(_URL_ , "Imagen_Certificacion" ,	"width=378,height=550,left=400,top=300,scrollbars=YES,resizable=NO,location=NO,directories=YES"); 

}