function validar(form) 
{
        e="";
		if (form.nombre.value == "")
            e += "Debe indicar el Nombre del Remitente\n";
        if (form.email.value == "")
            e += "Debe indicar el Email de la empresa\n";
        if (form.asunto.value == "")
            e += "Debe indicar el Asunto del mensaje\n";
		if (form.comentario.value == '')
            e += "Debe indicar un Comentario al mensaje\n";
        if(e != ""){
			 alert(e); 
             return false;
	    }
        else{
			visualizar();
			enviarMensaje(form.enviar);
			return true;
		}
}

function abrirPresentacion() 
{
	//var url = 'C:/Archivos de programa/Apache Group/Apache2/htdocs/files/html/presentacion.html'
	var url ='./files/html/intro.html'
	var id = 'intro'
	var w = 320
	var h = 300
	var msgWindow
    msgWindow = window.open( url, id, "scrollbars=no,resizable=yes,width=" + w + ",height=" + h +",innerWidth=" + w + ",innerHeight=" + h)
    msgWindow.focus()
}

function mostrarEnFramesNuevaVentana(fMenu, fPrincipal, id)
{
	if(top == self)
	{
		var msgWindow
		var url = "./index.html"
	    msgWindow = window.open( url, "window"+id, "")
		msgWindow.top.menutop.location = fMenu
		msgWindow.top.principal.location = fPrincipal
		location = "./index.html"
	}
}

function mostrarEnFrames(url)
{
	if(top == self)
	{
		location = url
	}
}

function writeTagACorreoOfuscado(to, user, site, subject, text)
{
	document.write('<a href=\"mailto:' + to + '&lt;' + user + '@' + site + '&gt;?subject=' + subject + '\">')
	document.write(text + '</a>')
}

function correoOfuscado(user, site)
{
	return(user + '@' + site )
}

function volver()
{
	history.back(-1);
}

function ventanaGoogle(myForm){
	//var url=myForm.buscarTexto.value;
	var url=document.getElementById("buscarTexto").value;
	if (url == "")
		window.open("http://www.google.com"); 
	else
		window.open("http://www.google.com/search?hl=es&q="+url+"&btnG=B%C3%BAsqueda&meta=lr%3Dlang_es");
}

function ventanaNueva(direccion){
		window.open(direccion); 
}

function enviarMensaje(btn){
	//btn.disabled="true";
	//alert("Enviando mensaje ... Por favor,espere.");
	btn.style.display="none";
}

//formulario contactar
function visualizar() {
    var ulNodes = getElementsByClass("enviar");
    var j = 0;
    var liNodes = null;
   
    for(var i = 0; i < ulNodes.length; i++) { 
      liNodes = ulNodes[i].getElementsByTagName("span");
      for(j = 0; j < liNodes.length; j++) {
        if(liNodes[j].className == "visualizar") {
          liNodes[j].className += " visible"; 
		}  
      }
    }
}
function getElementsByClass(searchClass,node,tag) {
	var classElements = new Array();
	  if ( node == null )
        node = document;
	  if ( tag == null )
		tag = '*';
	  var els = node.getElementsByTagName(tag);
	  var elsLen = els.length;
	  var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
	  for (i = 0, j = 0; i < elsLen; i++) {
		  if ( pattern.test(els[i].className) ) {
			classElements[j] = els[i];
			j++;
		  }
	  }
	return classElements;
 }
