
//Función para abrir ventanas alternas popups
// --- La liga que abra el popup se pondrá de la siguiente manera
// --- javascript:PopUps('pagina.ext', 'nombrePagina', 'width=300, height=500, scrollbar=yes')
function PopUps(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


//Funciones para secciones que se colapsan
// --- En la propiedad onclic se pondrá de la siguiente manera
// --- onclick="doSection(document.getElementById('idElemento'))"
function doSection (secNum){
if (secNum.style.display=="none"){secNum.style.display=""}
else {secNum.style.display="none"}
}
function noSection (secNum){
if (secNum.style.display==""){secNum.style.display="none"}
}

//Nueva funciones para secciones que se colapsan (esta es la que se esta usando)

function displaySubs(id, numHijos){
	for(i=0; i<numHijos; i++){
		if(document.getElementById(id + '_' + i)!=null){
			if(document.getElementById(id + '_' + i).className == 'hide')
				document.getElementById(id + '_' + i).className = 'show';
			else
				document.getElementById(id + '_' + i).className = 'hide';
		}
	}
}

function imgRoll(id){
 	img = document.getElementById(id); //imagen a replazar dinamicamente
	if(img.alt=="Ver m&aacute;s"){
		img.src = "images/bullet_menos.jpg";
		img.alt = "Cerrar";
		img.title = "Cerrar";
	}else{
		img.src = "images/bullet_mas.jpg";
		img.alt = "Ver m&aacute;s";
		img.title = "Ver m&aacute;s";
	}
}



//Funciones necesarias para el rollover
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];}
}

function validNumeric(e, tipo) {
    tecla = (document.all)?e.keyCode:e.which;
    if(tecla == 0 || tecla == 8 || tecla == 9 || tecla == 32){return true};
    if (tipo==0){  //numerico
          patron = /[0-9]/;
    }
    if (tipo==1){ //decimal
        patron = /[0-9.]/;
     }
    if (tipo==2){ //telefono
         patron = /[0-9.,)(-]/;
     }
    te = String.fromCharCode(tecla);
    return patron.test(te); 
} 

function validChar(e) {
    tecla = (document.all)?e.keyCode:e.which;
    if(tecla == 0 || tecla == 8 || tecla == 9 || tecla == 13 || tecla == 32){return true};
    patron = /[a-zA-Z0-9áéíóúÁÉÍÓÚñÑ´.,:$%*_/@!¡)(¿?]/;
    te = String.fromCharCode(tecla);
    return patron.test(te); 
} 

function validEmail(e) {
    tecla = (document.all)?e.keyCode:e.which;
    if(tecla == 0 || tecla == 8 || tecla == 9 || tecla == 13 || tecla == 32 ){return true};
    patron = /[-",\w.@]/; 
    te = String.fromCharCode(tecla);
    return patron.test(te); 
} 