﻿// Muestra/Oculta capas div
//

function abrirCerrar(pstrIdDiv){
if (document.getElementById(pstrIdDiv).className=="cerrado"){
document.getElementById(pstrIdDiv).className="abierto"
}else{
	document.getElementById(pstrIdDiv).className="cerrado"
}
}

// Verificador de dirección email válida
//Advanced Email Check credit-
//By JavaScript Kit (http://www.javascriptkit.com)
//Over 200+ free scripts here!
var testresults

function checkemail(){
var str=document.datos.email.value
var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
if (filter.test(str))
testresults=true
else{
alert("El formato del E-Mail suministrado no es el correcto. Por favor, intente de nuevo.")
testresults=false
}
return (testresults)
}

function verificar(){
if (document.layers||document.getElementById||document.all)
return checkemail()
else
return true
}

function validate(chk){
if (chk.checked == 1)
testresults=true
else{
alert("Por favor, marque el recuadro para certificar que ha leído y esta de acuerdo con la política de protección de datos. Gracias.")
testresults=false
}
return (testresults)
}

/**************************************************************************
 *                                                                        *
 *  JAVASCRIPT MENU HIGHLIGHTER v.1.5 (080929)                            *
 * --------------------------------------------                           *
 * ©2005 Media Division (www.MediaDivision.com)                           *
 *                                                                        *
 * Written by Marius Smarandoiu & Armand Niculescu                        *
 *                                                                        *
 * You are free to use, modify and distribute this file, but please keep  *
 * this header and credits                                                *
 *                                                                        *
 * Usage:                                                                 *
 * - the script will apply the .current class to the <a> and its parent   *
 *   <li> that is contained in the element with id="primarynav" and points*
 *   to the current URL                                                   *
 * - works in IE6, Firefox and Opera                                      *
 **************************************************************************/
function extractPageName(hrefString)
{
	var arr = hrefString.split('/');
	return  (arr.length<2) ? hrefString : arr[arr.length-2].toLowerCase() + arr[arr.length-1].toLowerCase();               
}

function setActiveMenu(arr, crtPage)
{
	for (var i=0; i<arr.length; i++)
	{
		if(extractPageName(arr[i].href) == crtPage)
		{
			if (arr[i].parentNode.tagName != "DIV")
			{
				arr[i].className = "current";
				arr[i].parentNode.className = "current";
			}
		}
	}
}

function setPage()
{
	hrefString = document.location.href ? document.location.href : document.location;

	if (document.getElementById("menu")!=null)
		setActiveMenu(document.getElementById("menu").getElementsByTagName("a"), extractPageName(hrefString));
}
