function pulsar(e) {
	var subm=true;
	var cl = document.buscador.id.value;
  	tecla = (document.all) ? e.keyCode :e.which;
  	if(tecla==13){
  		 if(cl.length>=3){
	  		document.buscador.action+=document.buscador.id.value+'/';;
  		}
  		subm = buscar(); 
  	}
  	return (tecla!=13 || subm);
} 
if(navigator.appVersion.indexOf("MSIE")!=-1){
		var ar=navigator.appVersion.split("MSIE");
		var ieVersion=parseFloat(ar[1]);
		if(ieVersion<7.0){
			var hojas = document.getElementsByTagName("link");
			for(i=0;i<hojas.length;i++){
				if(hojas[i].getAttribute("title") == "Por Defecto"){
					hojas[i].href = "/css/i2es_navegador_ie6.css";
				}
			}
		}
	}
// JavaScript Document
function abrirVentana(url,nombre,anchoV,altoV) { 
  var ancho=screen.width;
  var alto=screen.height; 
  var pos = (ancho-anchoV)/2;
  var vtn = window.open(url,nombre,'scrollbars=yes,width='+anchoV+',height='+altoV+',top=200,left='+pos);
}
function enviarVaciar(tipo){
	if(tipo==1){
		if(document.enviar_amigo.Amigo_Nombre.value=="Tu nombre"){
			document.enviar_amigo.Amigo_Nombre.value ="";
		}
	}
	if(tipo==2){
		if(document.enviar_amigo.Amigo_Email.value=="Tu email"){
			document.enviar_amigo.Amigo_Email.value ="";
		}
	}
	if(tipo==3){
		if(document.enviar_amigo.Amigo_NombreAmigo.value=="Nombre de tu amigo"){
			document.enviar_amigo.Amigo_NombreAmigo.value ="";
		}
	}
	if(tipo==4){
		if(document.enviar_amigo.Amigo_EmailAmigo.value=="Email de tu amigo"){
			document.enviar_amigo.Amigo_EmailAmigo.value ="";
		}
	}
}
function enviarVaciarSusc(tipo){
	if(tipo==1){
		if(document.suscripcion.Susc_Nombre.value=="Tu nombre"){
			document.suscripcion.Susc_Nombre.value ="";
		}
	}
	if(tipo==2){
		if(document.suscripcion.Susc_Email.value=="Tu email"){
			document.suscripcion.Susc_Email.value ="";
		}
	}
}
function expandirAmigo(){
	var am = document.getElementById("enviarAmigo");
	if(am.style.display=="none"){
		am.style.display = "block";	
	}else{
		am.style.display = "none";
	}
}
function expandirSuscripcion(){
	var am = document.getElementById("enviarSuscripcion");
	if(am.style.display=="none"){
		am.style.display = "block";	
	}else{
		am.style.display = "none";
	}
}
function enviarAmigo(){
	var nombre = document.enviar_amigo.Amigo_Nombre.value;
	var email = document.enviar_amigo.Amigo_Email.value;
	var nombreamigo = document.enviar_amigo.Amigo_NombreAmigo.value;
	var emailamigo = document.enviar_amigo.Amigo_EmailAmigo.value;
	
	var error="";
	if(nombre=="" || nombre=="Tu nombre"){
		error+="Ingresa tu Nombre.\n";	
	}
	if(email=="" || email=="Tu email"){
		error+="Ingresa tu email.\n";	
	}else{
		var p = email.indexOf("@");
		if(p<1){
			error+= "Tu email debe ser una dirección correcta.\n";
		}
	}
	if(nombreamigo=="" || nombreamigo=="Nombre de tu amigo"){
		error+="Ingresa el Nombre de tu amigo.\n";	
	}
	if(emailamigo=="" || emailamigo=="Email de tu amigo"){
		error+="Ingresa el Email de tu amigo.\n";	
	}else{
		var p = emailamigo.indexOf("@");
		if(p<1){
			error+= "El Email de tu amigo debe ser una dirección correcta.\n";
		}
	}
	
	if(error!=""){
		alert(error);
		return false;
	}else{
		document.enviar_amigo.submit();
		return true;	
	}
}



function enviarSuscripcion(){
	var nombre = document.suscripcion.Susc_Nombre.value;
	var email = document.suscripcion.Susc_Email.value;
	var error="";
	if(nombre=="" || nombre=="Tu nombre"){
		error+="Ingresa tu Nombre.\n";	
	}
	if(email=="" || email=="Tu email"){
		error+="Ingresa tu email.\n";	
	}else{
		var p = email.indexOf("@");
		if(p<1){
			error+= "Tu email debe ser una dirección correcta.\n";
		}
	}
	if(error!=""){
		alert(error);
	}else{
		document.suscripcion.submit();
	}	
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function enviarCurriculum(){
	var nombre = document.curriculum.Nombre.value;
	var email = document.curriculum.Email.value;
	var telefono = document.curriculum.Telefono.value;
	var domicilio = document.curriculum.Domicilio.value;
	var archivo = document.curriculum.userfile.value;
	var er = "";
	
	if(nombre==""){
		er+= "Ingrese el Nombre y Apellido.\n";	
	}
	if(email==""){
		er+= "Ingrese el Email.\n";	
	}else{
		var index = email.indexOf('@');
		if(index==-1){
			er+= "El Email debe ser una dirección de correo correcta.\n";	
		}
	}
	if(telefono==""){
		er+="Ingrese el Teléfono.\n";	
	}
	if(domicilio==""){
		er+="Ingrese el Domicilio.\n";	
	}
	if(archivo==""){
		er+="Ingrese el Archivo.\n";	
	}else{
		var arA =archivo.split(".");
		var ext = arA[(arA.length)-1];
		if(ext!="doc" & ext!="Doc" & ext!="DOC" & ext!="pdf" & ext!="Pdf" & ext!="PDF" & ext!="docx" & ext!="Docx" & ext!="DOCX" & ext!="rtf" & ext!="Rtf" & ext!="RTF"){
			er+="El Archivo debe ser un documento de texto o PDF.\n";	
		}
		
	}
	
	if(er!=""){
		alert(er);	
	}else{
		document.curriculum.submit();
	}
}
function buscar(){
	var cl = document.buscador.id.value;
	var error="";
	if(cl==""){
		error="Ingrese una palabra";	
	}else{
		if(cl.length<3){
			error="La palabra debe contener como mínimo 3 caracteres";
		}
	}
	if(error!=""){
		alert(error);
		return false;
	}else{
		document.buscador.submit();
		return true;	
	}
}
function desplegar(id){
	
	var obj = document.getElementById(id);
	if(obj.style.display == 'block'){
		obj.style.display = 'none'
	}else{
		obj.style.display = 'block'
	}
}
function enviarContacto(){
	var nombre = document.contacto.Nombre.value;
	var email = document.contacto.Email.value;
	var mensaje = document.contacto.Texto.value;
	var er = "";
	
	if(nombre==""){
		er+= "Ingrese su Nombre.\n";	
	}
	if(email==""){
		er+= "Ingrese su Email.\n";	
	}else{
		var index = email.indexOf('@');
		if(index==-1){
			er+= "El Email debe ser una dirección de correo correcta.\n";	
		}
	}
	if(mensaje==""){
		er+="Ingrese el Texto.\n";	
	}
	if(er!=""){
		alert(er);	
	}else{
		document.contacto.submit();
	}
}
function enviarLlamada(){
	var nombre = document.contacto.Nombre.value;
	var email = document.contacto.Email.value;
	var telefono = document.contacto.Telefono.value;
	var mensaje = document.contacto.Texto.value;
	var er = "";
	
	if(nombre==""){
		er+= "Ingrese su Nombre.\n";	
	}
	if(telefono==""){
		er+= "Ingrese su Teléfono.\n";	
	}
	if(email==""){
		er+= "Ingrese su Email.\n";	
	}else{
		var index = email.indexOf('@');
		if(index==-1){
			er+= "El Email debe ser una dirección de correo correcta.\n";	
		}
	}
	if(mensaje==""){
		er+="Ingrese el Texto.\n";	
	}
	if(er!=""){
		alert(er);	
	}else{
		document.contacto.submit();
	}
}
function imprimir(){
	var titulo = document.getElementById('titulo');
	window.open('/data/imprimir.php','_blank','scrollbars=yes,width=600,height=550');
}
function obtenerImpresion(){
	var titulo = opener.document.getElementById('titulo');
	var texto = opener.document.getElementById('texto');
	var parrafos = opener.document.getElementById('parrafos')
	this.document.getElementById('titulo').innerHTML = titulo.innerHTML;
	this.document.getElementById('texto').innerHTML = texto.innerHTML;
	this.document.getElementById('parrafos').innerHTML = parrafos.innerHTML;
	var imgs=document.getElementsByTagName('img');
	for(i=0;i<imgs.length;i++){
		var img = imgs[i];
		if(img.width>650){
			img.height=Math.round(img.height*650/img.width);
			img.width = 650;
		}
	}
	var embs=document.getElementsByTagName('embed');
	for(i=0;i<embs.length;i++){
		var emb = embs[i];
		emb.style.display = "none";
	}	
	var objs=document.getElementsByTagName('object');
	for(i=0;i<objs.length;i++){
		var obj = objs[i];
		obj.style.display = "none";
	}	
	var subtitulo = document.getElementById("subtitulo");
	setTimeout('window.print()',100);
}
function mostrarOreja(id,idI){
	mensajeAyax = "<div style='width:588px;overflow:hidden;height:50px;'>Cargando espere...</div>";
	ajax.enviar("GET","/data/oreja.php","idCont="+id,true,"contenido_oreja");
	
	var cont = document.getElementById('contenedor_orejas').getElementsByTagName("div");
	for (var i=0; i<cont.length; i++){
		var oreja = cont[i];
		if(oreja.id=="or_"+idI){
			if(oreja.className=="menu_productos_1_centro"){
				oreja.className="menu_productos_2_centro";
			}
		}else{
			if(oreja.className=="menu_productos_2_centro"){
				oreja.className="menu_productos_1_centro";
			}
		}
		if(oreja.id == "iz_"+idI){
			if(oreja.className=="menu_productos_1_izq"){
				oreja.className="menu_productos_2_izq";
			}
		}else{
			if(oreja.className=="menu_productos_2_izq"){
				oreja.className="menu_productos_1_izq";
			}
			
		}
		if(oreja.id == "der_"+idI){
			if(oreja.className=="menu_productos_1_der"){
				oreja.className="menu_productos_2_der";
			}
		}else{
			
			if(oreja.className=="menu_productos_2_der"){
				oreja.className="menu_productos_1_der";
			}	
		}
	}
}

// AJAX /////////////////////////////////////////////////////////////////////////////////
var http = null;
var div = "";
var mensajeAyax = "Cargando...";


function Ajax(){
		this.responder = responder;
		this.enviar = enviar;
		this.getXmlHttp = getXmlHttp;
		this.getXmlHttp();
}
function responder(){ 
		if (http.readyState == 4) { 
			results = http.responseText; 
			document.getElementById(div).innerHTML =  results; 
		}else{
			document.getElementById(div).innerHTML = mensajeAyax;
		}
	} 
function enviar(metodo,url,parametros,asincronico,etdiv) { 
		div = etdiv;
		var envio = null;
		var urlaenviar = url+"?"+parametros;
		if(metodo == "POST"){
			http.open(metodo,url,asincronico);
			http.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
			envio = parametros; 
		}else{
			http.open(metodo,urlaenviar,asincronico);
		}
		http.onreadystatechange = this.responder; 
		http.send(envio); 
} 
function getXmlHttp(){
		var xmlhttp;
		/*@cc_on 
		@if (@_jscript_version >= 5) 
		try 
		{ 
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); 
		} 
		catch (e) 
		{ 
		try 
		{ 
		xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); 
		} 
		catch (e) 
		{ 
		xmlhttp = false; 
		} 
		} 
		@else 
		xmlhttp = false; 
		@end @*/ 
		if (!xmlhttp && typeof XMLHttpRequest != 'undefined'){ 
			try 
			{ 
				xmlhttp = new XMLHttpRequest(); 
			} 
			catch (e) 
			{ 
				xmlhttp = false; 
			} 
		} 
		http = xmlhttp;
}
var ajax = new Ajax();


function mostrarFormulario(amostrar){
	if(amostrar==1){
		document.getElementById(td1).style.display = "block";
		document.getElementById(td2).style.display = "none";
		document.getElementById(td3).style.display = "none";
	}
	if(amostrar==2){
		document.getElementById(td1).style.display = "none";
		document.getElementById(td2).style.display = "block";
		document.getElementById(td3).style.display = "none";
	}
	if(amostrar==3){
		document.getElementById(td1).style.display = "none";
		document.getElementById(td2).style.display = "none";
		document.getElementById(td3).style.display = "block";
	}	
}
	