﻿// Archivo JScript
var bigpicWin = null;

function AmpliaImg(aImg,aAncho,aAlto){
//url = "../Imagenes/Grande/" + foto
//aImg = "../imagenes/Carteleria/Grande/C001.jpg"
picwidth=aAncho;
picheight=aAlto;

//description="Imagen Ampliada";

if (!bigpicWin || bigpicWin.closed)
{
usrwidth = screen.width;
usrheight = screen.height;
winwidth = picwidth;
winheight = picheight;
var X = (usrwidth - winwidth) / 2;
var Y = (usrheight - winheight) / 2;
properties = "toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=no,copyhistory=no,width="+winwidth+",height="+winheight+",";
checkie = navigator.appName.indexOf("icrosoft");
if (checkie == -1)
{
properties = properties+"screenX="+X+",screenY="+Y;
}
else
{
properties = properties+"left="+X+",top="+Y;
}
bigpicWin = window.open('','bigpicWin',properties);
bigpicWin.document.open();
bigpicWin.document.write('<HTML><HEAD>');
bigpicWin.document.write('<TITLE>'+description+'</TITLE>');
bigpicWin.document.write('</HEAD>');
bigpicWin.document.write('<BODY MARGINWIDTH="0" MARGINHEIGHT="0" LEFTMARGIN="0" TOPMARGIN="0" BOTTOMMARGIN="0">');
bigpicWin.document.write('<A HREF="JavaScript:self.close()"><IMG SRC="'+aImg+'" HSPACE="0" VSPACE="0" BORDER="0"></A>');
bigpicWin.document.write('</BODY>');
bigpicWin.document.write('</HTML>');
bigpicWin.document.close()
bigpicWin.focus();
}
else
{
bigpicWin.focus();
}

}

function focoGanado(campo, valor){
    if(campo.value==valor){
		    campo.value = '';
    }
}
function focoPerdido(campo, valor){
    if(campo.value==''){
			campo.value = valor;
    }
}

function Find_Term(search,field)
{
	var pattern

	if (search.value == "") 
	{
		field.options.selectedIndex = -1;
		return;
	}
	//Use "i" to make search not case-sensitive
	pattern = new RegExp("^" + search.value, "i");

	for(var x=0; x < field.options.length; x++)
	{
		if (pattern.test(field.options[x].text) == true)
		{
			
			field.options[x].selected = true
			break;
		}
	}
}

function Ocultar(objVis,txtOcul,limite) 
{
// objVis es el numero del objeto que se va a visualizar u ocultar
// txtOcul es la base que deben tener le resto de objetos que se van a ocultar todos
// limite es el numero de objetos que se van a tratar(ocultar)
    for (i=1; i<=limite; i++){
        if (i==objVis){
            if (document.getElementById(txtOcul+i).style.display == 'none'){
	            document.getElementById(txtOcul+i).style.display = '';
	        }
	        else {
	            document.getElementById(txtOcul+i).style.display = "none";
	        }   
        }
        else{
        document.getElementById(txtOcul+i).style.display = 'none';
        }
    }
}

function Mostrar(objVis,txtOcul,limite) 
{
// objVis es el numero del objeto que se va a visualizar
// txtOcul es la base que deben tener le resto de objetos que se van a ocultar todos
// limite es el numero de objetos que se van a tratar(ocultar)
    for (i=1; i<=limite; i++){
        if (i==objVis){
            document.getElementById(txtOcul+i).style.display = '';
        }
        else{
            document.getElementById(txtOcul+i).style.display = 'none';
        }
    }
}

function OcultarMostrar(objVis) 
{
// objVis es el numero del objeto que se va a visualizar u ocultar
// Oculta o muestra el objeto (cambia el estado dependiendo de como este)
   if (document.getElementById(objVis).style.display == 'none'){
        document.getElementById(objVis).style.display = '';
   }
   else {
        document.getElementById(objVis).style.display = "none";
    }
}

function MostrarSolo(objVis) 
{
// objVis es el numero del objeto que se va a visualizar
// Muestra el objeto (solo un objeto)
    document.getElementById(objVis).style.display = '';
}


function OcultarSolo(objVis) 
{
// objVis es el numero del objeto que se va a visualizar
// Muestra el objeto (solo un objeto)
    document.getElementById(objVis).style.display = 'none';
}

function OcultarMostrarValue(objVis, aValue) 
{
// objVis es el numero del objeto que se va a visualizar u ocultar
// Oculta o muestra el objeto (cambia el estado dependiendo de como este)
   
   if (aValue == 'true'){
        document.getElementById(objVis).style.display = '';
   }
   else {
        document.getElementById(objVis).style.display = "none";
    }
}

function ConfiPnl(obj1,obj2,obj3,obj4,obj5,vis1,vis2,vis3,vis4,vis5) 
{
// objVis es el numero del objeto que se va a visualizar
// Muestra el objeto (solo un objeto)
    document.getElementById(obj1).style.display = vis1;
    document.getElementById(obj2).style.display = vis2;
    document.getElementById(obj3).style.display = vis3;
    document.getElementById(obj4).style.display = vis4;
    document.getElementById(obj5).style.display = vis5;
}

function ConfiPnl2(obj1,obj2,vis1,vis2) 
{
// objVis es el numero del objeto que se va a visualizar
// Muestra el objeto (solo un objeto)
    document.getElementById(obj1).style.display = vis1;
    document.getElementById(obj2).style.display = vis2;
}


function MostrarColor(objVis,txtOcul,txtLink,limite) 
{
// objVis es el numero del objeto que se va a visualizar
// txtOcul es la base que deben tener le resto de objetos que se van a ocultar todos
// limite es el numero de objetos que se van a tratar(ocultar)
    for (i=1; i<=limite; i++){
        if (i==objVis){
            document.getElementById(txtOcul+i).style.display = '';
            document.getElementById(txtLink+i).style.color = '#B51333';
        }
        else{
            document.getElementById(txtOcul+i).style.display = 'none';
//document.getElementById('link'+).style.color = '#000000';
            document.getElementById(txtLink+i).style.color = '#000000';
        }
    }
}

function MostrarDestaca(vis,obj,limite) 
{
// Destaca el frm con color de fondo y cambia color de letra
// muestra un "frm + A" (Submenu) y oculta todos los demas "frm + A" (submenus)

// vis es el numero del objeto que se va a destacar
// obj es la base (texto) que debe tener el frm que de va destacar y los que se van a ocultar
// limite es el numero de objetos que se van a tratar(ocultar)
    for (i=1; i<=limite; i++){
        if (i==vis){
            document.getElementById(obj+i).style.backgroundColor = '#B51333';
            document.getElementById(obj+i).style.color = '#FFFFFF';
            document.getElementById(obj+'A'+i).style.display = '';
        }
        else{
            document.getElementById(obj+i).style.backgroundColor = '#FFFFFF';
            document.getElementById(obj+i).style.color = '#999999';
            document.getElementById(obj+'A'+i).style.display = 'none';
        }
    }
}


function OcultarDestaca(vis,obj,limite1,limite2) 
{
// Destaca el frm con color de fondo y cambia color de letra
// y oculta todos los demas frm

// vis es el numero del objeto que se va a destacar
// obj es la base (texto) que debe tener el frm que de va destacar y los que se van a ocultar
// limite1 es el numero de objetos que se van ocultar
// limite2 (porque hay frm que no tienen submenu) es el numero de objetos que se van cambiar solo el fondo y texto (no tienen submenu)
// ojo que limite2 en este caso solo afecta a los ultimos frm (porque los limite1 primeros si tienes submenu)
    for (i=1; i<=limite1; i++){
        if (i==vis){
            //document.getElementById(obj+'A'+i).style.display = '';
            document.getElementById(obj+i).style.backgroundColor = '#B51333';
            document.getElementById(obj+i).style.color = '#FFFFFF';
        }
        else{
            document.getElementById(obj+'A'+i).style.display = 'none';
            document.getElementById(obj+i).style.backgroundColor = '#FFFFFF';
            document.getElementById(obj+i).style.color = '#999999';
        }
    }

for (i=limite1; i<=limite2; i++){
        if (i==vis){
            //document.getElementById(obj+'A'+i).style.display = '';
            document.getElementById(obj+i).style.backgroundColor = '#B51333';
            document.getElementById(obj+i).style.color = '#FFFFFF';
        }
        else{
            document.getElementById(obj+i).style.backgroundColor = '#FFFFFF';
            document.getElementById(obj+i).style.color = '#999999';
        }
    }



}


function OcultarTodo2(obj,limite,pasada) 
{
// objVis es el numero del objeto que se va a visualizar u ocultar
// txtOcul es la base que deben tener le resto de objetos que se van a ocultar todos
// limite es el numero de objetos que se van a tratar(ocultar)
    if (pasada <= 5)
    {
        pasada = pasada + 1;
        //mytime=setTimeout('OcultarTodo2('+obj,limite,pasada+')', 1);
        setTimeout(OcultarTodo2('MenuA','4',pasada), 10000);
    }
    else 
    {
        for (i=1; i<=limite; i++){
            document.getElementById(obj+i).style.display = "none";
        }
    }
}




function OcultarTodo(obj,limite) 
{
// objVis es el numero del objeto que se va a visualizar u ocultar
// txtOcul es la base que deben tener le resto de objetos que se van a ocultar todos
// limite es el numero de objetos que se van a tratar(ocultar)
    for (i=1; i<=limite; i++){
        
        document.getElementById(obj+i).style.display = "none";
    }
}


function destacarA(obj, val, limite)
{
 for (i=1; i<=limite; i++){
        if (i==val){
            document.getElementById(obj+i).style.backgroundColor = '#B51333';
            document.getElementById(obj+i).style.color = '#FFFFFF';
        }
        else{
            document.getElementById(obj+i).style.backgroundColor = '#FFFFFF';
            document.getElementById(obj+i).style.color = '#999999';
        }
    }
}

function destacarB(obj, val)
{
    document.getElementById(obj).style.backgroundColor = '#B51333';
}




//----------------------------------------------------------------------------
//Para sustituir las imagenes del apartado ubicacion (madrid, barcelona y valencia)

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.0
  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 && document.getElementById) x=document.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];}
}

//---------------------------------------------------------------------------


//---------------------------------------------------------------------------
// Secuencia de imagenes del apartado Empresa/Quienes

function oscurece(avalor) {
  obj = document.getElementById('ImgBase');
  fil = 100 - avalor
  obj.style.filter = 'alpha(opacity='+fil+')';
  obj.style.MozOpacity= fil / 100;
  avalor += 1;
    if (fil>5 || avalor<80) {
        setTimeout('oscurece('+avalor+')', 20);
    }
    else {
        MM_swapImage('ImgBase','','../Imagenes/ImgQuienes2.jpg',1);
         aclarar(1);
    }
}

function oscurece2(avalor) {
  obj = document.getElementById('ImgBase');
  fil = 100 - avalor
  obj.style.filter = 'alpha(opacity='+fil+')';
  obj.style.MozOpacity= fil / 100;
  avalor += 1;
    if (fil>5 || avalor<80) {
        setTimeout('oscurece2('+avalor+')', 20);
    }
    else {
        MM_swapImage('ImgBase','','../Imagenes/ImgQuienes3.jpg',1);
         aclarar2(1);
    }
}

function aclarar(avalor) {
  obj = document.getElementById('ImgBase');
//  ainicio -= avalor;
  fil = 5 + avalor
  obj.style.filter = 'alpha(opacity='+fil+')';
  obj.style.MozOpacity= fil / 100;
  avalor += 1;
   if (fil<100) {
        setTimeout('aclarar('+avalor+')', 20)
    }
    else {
        setTimeout('oscurece2(1)', 5000);
    }
}

function aclarar2(avalor) {
  obj = document.getElementById('ImgBase');
  fil = 5 + avalor
  obj.style.filter = 'alpha(opacity='+fil+')';
  obj.style.MozOpacity= fil / 100;
  avalor += 1;
   if (fil<100) {
        setTimeout('aclarar2('+avalor+')', 20)
    }
}

function SecuenciaImg() {
    MM_swapImage('ImgBase','','../Imagenes/ImgQuienes.jpg',1);
    setTimeout('oscurece(1)', 5000);
}

//---------------------------------------------------------------------------


//---------------------------------------------------------------------------
// Secuencia de imagenes del apartado Empresa/Espiritu

function oscureceE(avalor) {
  obj = document.getElementById('ImgBase');
  fil = 100 - avalor
  obj.style.filter = 'alpha(opacity='+fil+')';
  obj.style.MozOpacity= fil / 100;
  avalor += 1;
    if (fil>5 || avalor<80) {
        setTimeout('oscureceE('+avalor+')', 20);
    }
    else {
        MM_swapImage('ImgBase','','../Imagenes/ImgEspiritu2.jpg',1);
         aclararE(1);
    }
}
/*
function oscureceE2(avalor) {
  obj = document.getElementById('ImgBase');
  fil = 100 - avalor
  obj.style.filter = 'alpha(opacity='+fil+')';
  obj.style.MozOpacity= fil / 100;
  avalor += 1;
    if (fil>5 || avalor<80) {
        setTimeout('oscureceE2('+avalor+')', 20);
    }
    else {
        MM_swapImage('ImgBase','','../Imagenes/ImgQuienes3.jpg',1);
         aclararE2(1);
    }
}
*/
function aclararE(avalor) {
  obj = document.getElementById('ImgBase');
//  ainicio -= avalor;
  fil = 5 + avalor
  obj.style.filter = 'alpha(opacity='+fil+')';
  obj.style.MozOpacity= fil / 100;
  avalor += 1;
   if (fil<100) {
        setTimeout('aclararE('+avalor+')', 20)
    }

}

/*
function aclararE2(avalor) {
  obj = document.getElementById('ImgBase');
  fil = 5 + avalor
  obj.style.filter = 'alpha(opacity='+fil+')';
  obj.style.MozOpacity= fil / 100;
  avalor += 1;
   if (fil<100) {
        setTimeout('aclararE2('+avalor+')', 20)
    }
}
*/

function SecuenciaImgE() {
    MM_swapImage('ImgBase','','../Imagenes/ImgEspiritu.jpg',1);
    setTimeout('oscureceE(1)', 5000);
}
































var x;
x=$(document);
x.ready(inicializarEventos);

function inicializarEventos()
{
  var x=$("#boton1");
  x.click(ocultarRecuadro);
  x=$("#boton2");
  x.click(mostrarRecuadro);
}

function ocultarRecuadro(obj,limite)
{
  var x=$("#MenuA1");
  
   for (i=1; i<=limite; i++){
            x=$("#"+obj+i);
        x.hide(500);
        }
    //x.hide(500);
}

function mostrarRecuadro()
{
  var x=$("#MenuA1");
  x.show("fast");
}
