// JavaScript Document
//Función Macromedia para roll over de imagens
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 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];}}
}

//Función Macromedia para abrir pop ups
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

//Función Macromedia para validar formularios
function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' debe ser una dirección de e-mail válida.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' debe ser un entero.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' es un campo requerido.\n'; }
  } if (errors) alert('Ocurrio el siguiente error:\n'+errors);
  document.MM_returnValue = (errors == '');
}



//Función encuesta, LDG. Erika Nolasco
function PopUpReload(pagina,nombre,propiedades)
{
  nombre = window.open(pagina,nombre,propiedades);
  nombre.focus();
}

// Función para convertir Letras primarias a mayúsculas, LDG. Erika Nolasco
function cambia(formObj) {
var inicio;
var strTemporal;
var caracTemporal;
var preString;
var postString;
var strLongitud;

strTemporal = formObj.value.toLowerCase();
strLongitud = strTemporal.length;

if (strLongitud > 0) 
	{
	for (inicio = 0; inicio < strLongitud; inicio++)
	{
	if (inicio == 0) 
		{
		caracTemporal = strTemporal.substring(0,1).toUpperCase();
		postString = strTemporal.substring(1,strLongitud);
		strTemporal = caracTemporal + postString;
		}
		else 
		{
		caracTemporal = strTemporal.substring(inicio, inicio+1);
		if (caracTemporal == " " && inicio < (strLongitud-1))  {
		caracTemporal = strTemporal.substring(inicio+1, inicio+2).toUpperCase();
		preString = strTemporal.substring(0, inicio+1);
		postString = strTemporal.substring(inicio+2,strLongitud);
		strTemporal = preString + caracTemporal + postString;
         }
      }
   }
}
formObj.value = strTemporal;
}

//Proteger imagesne y contenido
var clickmessage="Derechos Reservados"

function disableclick(e) {
if (document.all) {
if (event.button==2||event.button==3) {
if (event.srcElement.tagName=="IMG"){
alert(clickmessage);
return false;
}
}
}
else if (document.layers) {
if (e.which == 3) {
alert(clickmessage);
return false;
}
}
else if (document.getElementById){
if (e.which==3&&e.target.tagName=="IMG"){
alert(clickmessage)
return false
}
}
}

function associateimages(){
for(i=0;i<document.images.length;i++)
document.images[i].onmousedown=disableclick;
}

if (document.all)
document.onmousedown=disableclick
else if (document.getElementById)
document.onmouseup=disableclick
else if (document.layers)
associateimages()



// Script para Slide show de las imagenes de ES
// Fijar duración de la imagen (milisegundos)
var slideShowSpeedES = 5000;
// Duracion del crossfade (segundos)
var crossFadeDurationES = 3;
// Especificando las imagenes
var PicES = new Array();
// para agregar mas imágenes solo copia, pega y modifica según el patron.

PicES[0] = 'creaImaES.php?src=cgWSbin/aniES/01.jpg&wmax=245&hmax=169'
PicES[1] = 'creaImaES.php?src=cgWSbin/aniES/02.jpg&wmax=245&hmax=169'
PicES[2] = 'creaImaES.php?src=cgWSbin/aniES/03.jpg&wmax=245&hmax=169'
PicES[3] = 'creaImaES.php?src=cgWSbin/aniES/04.jpg&wmax=245&hmax=169'
PicES[4] = 'creaImaES.php?src=cgWSbin/aniES/05.jpg&wmax=245&hmax=169'

// no editar
var t;
var j = 0;
var p = PicES.length;
var preLoad = new Array();
for (i = 0; i < p; i++) {
preLoad[i] = new Image();
preLoad[i].src = PicES[i];
}
function runSlideShowES() {
if (document.all) {
document.images.SlideShowES.style.filter="blendTrans(duration=2)";
document.images.SlideShowES.style.filter="blendTrans(duration=crossFadeDuration)";
document.images.SlideShowES.filters.blendTrans.Apply();
}
document.images.SlideShowES.src = preLoad[j].src;
if (document.all) {
document.images.SlideShowES.filters.blendTrans.Play();
}
j = j + 1;
if (j > (p - 1)) j = 0;
t = setTimeout('runSlideShowES()', slideShowSpeedES);
}


// Script para Slide show de las imagenes de SP
// Fijar duración de la imagen (milisegundos)
var slideShowSpeedSP = 6000;
// Duracion del crossfade (segundos)
var crossFadeDurationSP = 3;
// Especificando las imagenes
var PicSP = new Array();
// para agregar mas imágenes solo copia, pega y modifica según el patron.

PicSP[0] = 'creaImaSP.php?src=cgWSbin/aniSP/01.jpg&wmax=245&hmax=169'
PicSP[1] = 'creaImaSP.php?src=cgWSbin/aniSP/02.jpg&wmax=245&hmax=169'
PicSP[2] = 'creaImaSP.php?src=cgWSbin/aniSP/03.jpg&wmax=245&hmax=169'
PicSP[3] = 'creaImaSP.php?src=cgWSbin/aniSP/04.jpg&wmax=245&hmax=169'
PicSP[4] = 'creaImaSP.php?src=cgWSbin/aniSP/05.jpg&wmax=245&hmax=169'

// no editar
var tSP;
var jSP = 0;
var pSP = PicSP.length;
var preLoadSP = new Array();
for (iSP = 0; iSP < pSP; iSP++) {
preLoadSP[iSP] = new Image();
preLoadSP[iSP].src = PicSP[iSP];
}
function runSlideShowSP() {
if (document.all) {
document.images.SlideShowSP.style.filter="blendTrans(duration=2)";
document.images.SlideShowSP.style.filter="blendTrans(duration=crossFadeDuration)";
document.images.SlideShowSP.filters.blendTrans.Apply();
}
document.images.SlideShowSP.src = preLoadSP[jSP].src;
if (document.all) {
document.images.SlideShowSP.filters.blendTrans.Play();
}
jSP = jSP + 1;
if (jSP > (pSP - 1)) jSP = 0;
tSP = setTimeout('runSlideShowSP()', slideShowSpeedSP);
}