// JavaScript Document
function objetoAjax(){
	var xmlhttp=false;
 	try {
 		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 	} catch (e) {
 		try {
 			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
 		} catch (E) {
 			xmlhttp = false;
 		}
  	}

	if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
 		xmlhttp = new XMLHttpRequest();
	}
	return xmlhttp;

}
function carga_c(){
	
	var divamostrar = window.document.getElementById('id_imagen');
	
	divamostrar.innerHTML ='<iframe src="http://www.talentolaboral.com/cosea/formnuevocandidato.php" style=" width:100%; height:100%" application="talento" frameborder="0" id="iframe_talento" scrolling="auto" ></iframe>';
	ajax=objetoAjax();
	
/*	ajax.open("POST","http://www.talentolaboral.com/encuesta/poll.php",true);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			//mostrar resultados en esta capa
			divamostrar.innerHTML = ajax.responseText
			
				
		}
	}
	ajax.setRequestHeader('Content-type',
    'application/x-www-form-urlencoded');
 ajax.send(null);
*/
	}

function carga_menu(menu,pagina){
muestra_imagen(pagina);
		var divamostrar = window.document.getElementById('men_lateral');
	if(menu=="inicio"){
	divamostrar.innerHTML='';
	}
	else if(menu=="cont"){
		divamostrar.innerHTML='';
		}
		else if(menu=="portafolios"){
			divamostrar.innerHTML='';
			}
	else if(menu=="subecv"){
		divamostrar.innerHTML='<img src="images/m_'+menu+'.png" width="145" border="0"  /><br><br><div align="center"><input align="center" type="button" value="Subir CV" onclick="carga_c()" /></div>';
		}
	else{
	divamostrar.innerHTML='<img src="images/m_'+menu+'.png" width="145" border="0" usemap="#Map3" />';
	
		}
		

	}
	


function muestra_mapa(mapa,quien){
	
	window.document.getElementById('men_lateral').innerHTML='<img src="images/m_'+quien+'.png" width="145" border="0" />';
	var divamostrar = window.document.getElementById('id_imagen');
	
	ajax=objetoAjax();
	
	ajax.open("POST","imagen.php",true);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			//mostrar resultados en esta capa
			divamostrar.innerHTML = ajax.responseText
			
				
		}
	}
	ajax.setRequestHeader('Content-type',
    'application/x-www-form-urlencoded');
 ajax.send('id_imagen='+mapa+'&quien='+quien);


	
	}
	
	
	function enviarcorreo(){
		var divamostrar = window.document.getElementById('id_imagen');
	var serv=window.document.getElementById('servicio').value
		var em=window.document.getElementById('correo').value
			var asunto=window.document.getElementById('mensaje').value
				var para=window.document.getElementById('aquien').value
		
	ajax=objetoAjax();
	
	ajax.open("POST","enviarcorreo.php",true);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			//mostrar resultados en esta capa
			divamostrar.innerHTML = ajax.responseText
			
				
		}
	}
	ajax.setRequestHeader('Content-type',
    'application/x-www-form-urlencoded');
 ajax.send('correo='+em+'&mensaje='+asunto+'&servicio='+serv+'&aquien='+para);

		
		}
		
	function muestra_imagen(id_imagen){
	
	var divamostrar = window.document.getElementById('id_imagen');
	
	ajax=objetoAjax();
	
	ajax.open("POST","imagen.php",true);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			//mostrar resultados en esta capa
			divamostrar.innerHTML = ajax.responseText
			
				
		}
	}
	ajax.setRequestHeader('Content-type',
    'application/x-www-form-urlencoded');
 ajax.send('id_imagen='+id_imagen);


	
	}
	
	
	function valida(){
		//	alert('que onda..');
			
			new Ajax.Request('valida.php',{method:'get', parameters: $('login_form').serialize(true),
		onSuccess: function(transport){
			var response = transport.responseText;
      if (transport.responseText.match('ok')){
		new Ajax.Updater('id_imagen', 'imagen.php', {method: 'post',parameters:{id_imagen:'ejecutivo'} });
		}
		  else{
			alert("Tu usuario o password estan incorrectos..");
			  }
	  },
    onFailure: function(){ alert('Algo mal con el ajax') }
  });
			

	
	}
	
	function manda_datosmail(){

  		new Ajax.Updater('id_imagen', 'mandar_mail.php', { method: 'get',parameters: $('archivo_form').serialize(true)} );
		
		}
