/*
 @Descripcion: Metodo que obtiene todos los nodos que tienen 
el mismo nombre de clase
 
 @Param className: nombre de la clase q voy a buscar
 
 @Param node: Nodo en donde voy a buscar los nodos que necesito
 */

 function getElementByClass(className, node){
  if(!node) node=document;
  var refTags = document.all ? node.all : node.getElementsByTagName("*");
  var retVal = new Array();
  for(var z=0;z<refTags.length;z++){
   if(refTags[z].className==className)
    retVal.push(refTags[z]);
  }
  return retVal;
 }


startList = function() {

	// code for IE
	if(!document.body.currentStyle) return;
	var subs = getElementByClass('submenu');
	for(var i=0; i<subs.length; i++) {
		var li = subs[i].parentNode;

		if(li && li.lastChild.style) {
			li.onmouseover = function() {
				this.lastChild.style.visibility = 'visible';
				this.lastChild.style.display = 'block';
			}
			li.onmouseout = function() {
				this.lastChild.style.visibility = 'hidden';
				this.lastChild.style.display = 'none';
			}
		}
	}
}
window.onload=startList;


function mapaweb(alto){
	w=265;
	h=alto;
	xF=0+Math.ceil(Math.random()*50);
	yF=0+Math.ceil(Math.random()*50);
	var crc="width="+w+",height="+h+",toolbar=no,menubar=no,status=no,scrollbars=no,resizable=yes,top="+yF+",left="+xF+",fullscreen=no,hotkeys=no";
	v=window.open("mapa.php","mapaweb",crc);
	v.resizeTo(w,h);
	v.moveTo(xF,yF);
}

function galeria_formacion(){
	w=760;
	h=530;
	xF=0+Math.ceil(Math.random()*50);
	yF=0+Math.ceil(Math.random()*50);
	var crc="width="+w+",height="+h+",toolbar=no,menubar=no,status=no,scrollbars=no,resizable=no,top="+yF+",left="+xF+",fullscreen=no,hotkeys=no";
	v=window.open("galeria/index.php","Galeria",crc);
	v.resizeTo(w,h);
	v.moveTo(xF,yF);
}


function galeria_turismo(){
	w=760;
	h=530;
	xF=0+Math.ceil(Math.random()*50);
	yF=0+Math.ceil(Math.random()*50);
	var crc="width="+w+",height="+h+",toolbar=no,menubar=no,status=no,scrollbars=no,resizable=no,top="+yF+",left="+xF+",fullscreen=no,hotkeys=no";
	v=window.open("turismo/index.php","Galeria",crc);
	v.resizeTo(w,h);
	v.moveTo(xF,yF);
}

function popup(alto, ancho, img){
	w=ancho;
	h=alto;
	xF=0+Math.ceil(Math.random()*50);
	yF=0+Math.ceil(Math.random()*50);
	var crc="width="+w+",height="+h+",toolbar=no,menubar=no,status=no,scrollbars=no,resizable=yes,top="+yF+",left="+xF+",fullscreen=no,hotkeys=no";
	v=window.open(img,"Asemcal",crc);
	v.resizeTo(w,h);
	v.moveTo(xF,yF);
}

function mostrar(capa,enlace){

	document.getElementById('submenu1').style.display='none';
	document.getElementById('submenu2').style.display='none';
	
	document.getElementById('enlace1').style.color='white';
	document.getElementById('enlace2').style.color='white';
	
	if (capa!=''){
		eval("var obj=document.getElementById('"+capa+"');");
		
		obj.style.display='inline';
		
	}
	
	if (enlace!=''){
		eval("document.getElementById('"+enlace+"').style.color='#feff7f';");
	}
}


function enviar_empleo(){

var enviar=true;
var msg_error='Error:';
var f=document.frm;

var v1=f.nombre.value;
if (v1=='') {enviar=false; msg_error+='\n- Debe escribir su nombre';}

var v1=f.email.value;
if (v1=='') {enviar=false; msg_error+='\n- Debe escribir su email';}

var v1=f.asunto.value;
if (v1=='') {enviar=false; msg_error+='\n- Debe escribir un asunto';}

var v1=f.texto.value;
if (v1=='') {enviar=false; msg_error+='\n- Debe escribir un comentario';}

var v1=f.cv.value;
if (v1=='') {enviar=false; msg_error+='\n- Debe enviarnos su C.V.';}


if (!enviar)
	alert(msg_error);
else
	f.submit();	

}


function enviar_buzon(){

	var enviar=true;
	var msg_error='Error:';
	var f=document.frm;
	
	var v1=f.nombre.value;
	if (v1=='') {enviar=false; msg_error+='\n- Debe escribir su nombre';}
	
	var v1=f.email.value;
	if (v1=='') {enviar=false; msg_error+='\n- Debe escribir su email';}
	
	var v1=f.asunto.value;
	if (v1=='') {enviar=false; msg_error+='\n- Debe escribir un asunto';}
	
	var v1=f.texto.value;
	if (v1=='') {enviar=false; msg_error+='\n- Debe escribir un comentario';}
	
	
	if (!enviar)
		alert(msg_error);
	else
		f.submit();	

}


function enviar_contacto(){

	var enviar=true;
	var msg_error='Error:';
	var f=document.frm;
	
	var v1=f.asunto.value;
	if (v1=='') {enviar=false; msg_error+='\n- Debe escribir un asunto';}
	
	var v1=f.texto.value;
	if (v1=='') {enviar=false; msg_error+='\n- Debe escribir un comentario';}
	
	
	if (!enviar)
		alert(msg_error);
	else
		f.submit();	

}


function enviar_noticia(){

	var enviar=true;
	var msg_error='Error:';
	var f=document.frm;
	
	var v1=f.titulo.value;
	if (v1=='') {enviar=false; msg_error+='\n- Debe escribir un titulo';}
	
	var v1=f.texto.value;
	if (v1=='') {enviar=false; msg_error+='\n- Debe escribir el cuerpo de la noticia';}
	
	if (!enviar)
		alert(msg_error);
	else
		f.submit();	

}




function enviar_enlace(){

	var enviar=true;
	var msg_error='Error:';
	var f=document.frm;
	
	var v1=f.titulo.value;
	if (v1=='') {enviar=false; msg_error+='\n- Debe escribir un titulo';}
	
	var v1=f.url.value;
	if (v1=='') {enviar=false; msg_error+='\n- Debe escribir la direccinn';}
	
	if (!enviar)
		alert(msg_error);
	else
		f.submit();	

}



function enviar_sector(){

	var enviar=true;
	var msg_error='Error:';
	var f=document.frm;
	
	var v1=f.nombre.value;
	if (v1=='') {enviar=false; msg_error+='\n- Debe escribir un nombre';}
	
	if (!enviar)
		alert(msg_error);
	else
		f.submit();	

}


function enviar_socio(){

	var enviar=true;
	var msg_error='Error:';
	var f=document.frm;
	
	var v1=f.nombre_empresa.value;
	if (v1=='') {enviar=false; msg_error+='\n- Debe escribir el nombre de la empresa';}
	
	var v1=f.referencia.value;
	if (v1=='') {enviar=false; msg_error+='\n- Debe escribir la referencia';}
	
	var v1=f.sector_id.value;
	if (v1=='0') {enviar=false; msg_error+='\n- Debe seleccionar el sector de la empresa';}
	
	var v1=f.actividad.value;
	if (v1=='') {enviar=false; msg_error+='\n- Debe escribir la actividad de la empresa';}
	
	var v1=f.login.value;
	if (v1=='') {enviar=false; msg_error+='\n- Debe escribir el login para la empresa';}
	
	var v1=f.pass.value;
	if (v1=='') {enviar=false; msg_error+='\n- Debe escribir una contrasena para la empresa';}
	
	if (!enviar)
		alert(msg_error);
	else
		f.submit();	

}



function enviar_perfil(){

	var enviar=true;
	var msg_error='Error:';
	var f=document.frm;
	
	var v1=f.actividad.value;
	if (v1=='') {enviar=false; msg_error+='\n- Debe escribir la actividad de la empresa';}
	
	var v1=f.pass.value;
	if (v1=='') {enviar=false; msg_error+='\n- Debe escribir una contrasena para la empresa';}
	
	if (!enviar)
		alert(msg_error);
	else
		f.submit();	

}
