// JavaScript Document


// COMUNES RollOvers

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


//-------------------
//Pop up para ABRIRLO
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

// La función "oculta()" la utilizo para ocultar todas las capas
//function oculta(cual){
	//	document.getElementById(cual).style.display = 'none'
//}


//-------------------

// La función menu_index(nombre) la uso para mostrar y ocultar las capas
function menu_index(nombre){
	if (nombre!=undefined){
		if (document.getElementById(nombre).style.display != 'block'){
			document.getElementById(nombre).style.display = 'block'
		}
		else{
			document.getElementById(nombre).style.display = 'none'
		}
	}
}

//-------------------

function goto_1(ruta){
	parent.document.location.href = ruta;
}


function goto_planos(ruta){
	window.open(ruta, "_blank");
}


// --------- ------ -- MENUS TRABAJOS ----- ---------------------


function menu_on_comu_o(nombre, obj){
	
	obj.style.cursor = 'pointer';
	document.getElementById(nombre).className = "btn_comu_o arial_negro font10";
}

function menu_on_comu_n(nombre, obj){
	
	obj.style.cursor = 'default';
	document.getElementById(nombre).className = "btn_comu arial_azul_oscuro font10";
}

function menu_on_promo_o(nombre, obj){
	obj.style.cursor = 'pointer';
	document.getElementById(nombre).className = "btn_promo_o arial_blanco font11";
}

function menu_on_promo_n(nombre, obj){
	obj.style.cursor = 'default';
	document.getElementById(nombre).className = "btn_promo arial_gris_oscuron font11";
}

function menu_on_curso_o(nombre, obj){
	obj.style.cursor = 'pointer';
	document.getElementById(nombre).className = "btn_curso_o arial_blanco font11";
}

function menu_on_curso_n(nombre, obj){
	obj.style.cursor = 'default';
	document.getElementById(nombre).className = "btn_curso arial_negro font11";
}

function submenu_planos_o(nombre, obj){
	obj.style.cursor = 'pointer';
	document.getElementById(nombre).className = "btn_planos_o arial_blanco font11";
}

function submenu_planos_n(nombre, obj){
	obj.style.cursor = 'default';
	document.getElementById(nombre).className = "btn_planos_n arial_gris_claro font11";
}


// --------- ------ FIN MENUS TRABAJOS ----- --------------------

var cualImagen = "imag_01";

function submenu_imagenes_o(nombre, obj){
	if (cualImagen != nombre){
		obj.style.cursor = 'pointer';
		document.getElementById(nombre).className = "imag_peque_o";
	}
}

function submenu_imagenes_n(nombre, obj){
	if (cualImagen != nombre){
		obj.style.cursor = 'default';
		document.getElementById(nombre).className = "imag_peque_n";
	}
}

function sustituyeImagen(ruta, nombre, w, h){
	if (cualImagen != nombre){
		document.getElementById(cualImagen).className = "imag_peque_n";
		document.getElementById("imag_grande").src = ruta;
		document.getElementById("imag_grande").width = w;
		document.getElementById("imag_grande").height = h;
		document.getElementById(nombre).className = "imag_peque_o";
		cualImagen = nombre;
	}
}



// --------- ------ COMBO BOX CURSOS ----- --------------------

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

// --------- ------ FIN COMBO BOX CURSOS ----- --------------------

//validador de formulario/////////////////////////////////////////////////////////////////////////
<!--



function clearText(thefield){
	if (thefield.defaultValue==thefield.value)
		thefield.value = ""
}


function validamelo(){
	var theForm = document.form1;
	var emailRE = /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/;
	var errMsg = "";
	var setfocus = "";
	
	
	
/*
	if (!emailRE.test(theForm['$email'].value)){
		errMsg = "Inserte su dirección de corrreo electrónico";
		setfocus = "['$email']";
	}
	if (theForm['$telefono'].value == ""){
		errMsg = "Inserte su teléfono";
		setfocus = "['$telefono']";
	}
	if (theForm['$apellidos'].value == ""){
		errMsg = "Inserte sus apellidos";
		setfocus = "['$apellidos']";
	}
	if (theForm['$nombre'].value == ""){
		errMsg = "Inserte su nombre";
		setfocus = "['$nombre']";
	}
	
	
	if (errMsg != ""){
		alert(errMsg);
		eval("theForm" + setfocus + ".focus()");
	}
	//else theForm.action = "sendForm/sendForm.php";
	
	else*/ theForm.submit();
	
	//alert("ppppppppppppppppppppfdsfpdsfpsfpsdfpdpsddpfkpsd"); 
	
	
}

//---------------------------------------------------------------------


// --------- ------ DESCARGA PDF CALIDADES ----- --------------------

function descarga_pdf(ruta){
	window.open(ruta, "_blank");
}

function descarga_pdf_o(nombre, obj){
	obj.style.cursor = 'pointer';
	document.getElementById(nombre).className = "arial_gris_oscuro_pdf_o font11";
}

function descarga_pdf_n(nombre, obj){
	obj.style.cursor = 'default';
	document.getElementById(nombre).className = "arial_gris_oscuro_pdf_n font11";
}







