 

//GLOBALES RELOJ
var timerID = null;
var timerRunning = false;

//******************************** CONTROL FECHA ********************************
//FUNCION PARA FECHA ACTUAL
function FechaActual()
{
var dias_semana = new Array ('Domingo','Lunes','Martes','Miércoles','Jueves','Viernes','Sábado');
var nombres_mes = new Array ('Enero','Febrero','Marzo','Abril','Mayo','Junio','Julio','Agosto', 'Septiembre','Octubre','Noviembre','Diciembre');

 var fecha = new Date (); 
 var dia = fecha.getDay (); 
 dia = dias_semana[dia]; 
 var dia_mes = fecha.getDate(); 
 var mes = fecha.getMonth (); 
 mes = nombres_mes[mes]; 
 var anio = fecha.getFullYear(); 
 document.write (dia + ' ' + dia_mes + ' de ' + mes + ' de ' + anio); 
 }
 
//MUESTRA EL DIA DE LA SEMANA EN EL QUE ESTAMOS
function diaSemana()
{
var dias_semana = new Array ('Domingo','Lunes','Martes','Miércoles','Jueves','Viernes','Sábado');

 var fecha = new Date (); 
 var dia = fecha.getDay (); 
 dia = dias_semana[dia]; 
 
document.write(dia);
}
 
//TERMINA DE COMPLETAR EL RESTO DE LA FECHA
function restoFecha()
{
var nombres_mes = new Array ('Enero','Febrero','Marzo','Abril','Mayo','Junio','Julio','Agosto', 'Septiembre','Octubre','Noviembre','Diciembre');

 var fecha = new Date (); 
 var mes = fecha.getMonth (); 
 var dia_mes = fecha.getDate(); 
 var anio = fecha.getFullYear(); 
 mes = nombres_mes[mes]; 

 document.write(dia_mes + ' de ' + mes + ' de ' + anio);
}
//******************************** FIN CONTROL FECHA ********************************


//******************************** RELOJ ********************************

//PARA EL RELOJ 
function stopclock (){

        if(timerRunning)
                clearTimeout(timerID);
        timerRunning = false;
}

//MUESTRA EL MOVIMIENTO DEL RELOJ CADA SEGUNDO
function showtime () {

        var now = new Date();
        var hours = now.getHours();
        var minutes = now.getMinutes();
        var seconds = now.getSeconds()

        var timeValue = "" + ((hours >12) ? hours -12 :hours)
        timeValue += ((minutes < 10) ? ":0" : ":") + minutes
        timeValue += ((seconds < 10) ? ":0" : ":") + seconds

        //document.clock.face.value = timeValue;
		document.getElementById('face').value = timeValue;

        timerID = setTimeout("showtime()",1000);
        timerRunning = true;

}

// INICIO DE RELOJ
function startclock () {

        stopclock();
        showtime();
}
//******************************** FIN RELOJ ********************************

//******************************** BARRA DE ESTADO **********************



//******************************** FIN BARRA DE ESTADO **********************

//******************************** PINTA LISTA  **********************


function eliminar(src,color_eliminar) {
	src.bgColor="FF0000";
}

	function entrar(src,color_entrada) {
		if (src.bgColor != "FF0000")
			src.bgColor=color_entrada;
			
	}
	
	function sortir(src,color_default) {
		if (src.bgColor != "FF0000")
			src.bgColor=color_default;
			
	}
	var enlace;
	function enlazar(enlace){
		window.location.href=enlace;
	}

//******************************** FIN PINTA LISTA **********************

//******************************** BUSCADOR *****************************
function validarBusqueda(formu) {

if (formu.txt.value=="")
	alert("Debes Introducir un Criterio de Busqueda");
else if (formu.opBusqueda.value == "0")
	alert("Debes Seleccionar una Opcion de la Lista");
else
	formu.submit();
}
//******************************** FIN BUSCADOR **************************

function ShowProgress()
{
  strAppVersion = navigator.appVersion;
  if (document.frmAddImagen.txtArchivoP.value != "" || document.frmAddImagen.txtArchivoG.value != "" )
  {
    if (strAppVersion.indexOf('MSIE') != -1 && strAppVersion.substr(strAppVersion.indexOf('MSIE')+5,1) > 4)
    {
      winstyle = "dialogWidth=385px; dialogHeight:140px; center:yes";
      window.showModelessDialog('<% = barref %>&b=IE',null,winstyle);
    }
    else
    {
      window.open('<% = barref %>&b=NN','','width=370,height=115', true);
    }
  }
  return true;
}

//************************ Añadir a favoritos IE y Firefox ****************

function addBookmark(title,url) {
	if (window.sidebar) {
		window.sidebar.addPanel(title, url,"");
	} else if( document.all ) {
		window.external.AddFavorite( url, title);
	} else if( window.opera && window.print ) {
		return true;
	}
}

//************************ Mostrar botón especial para escaparates ****************

function botonEscaparate() {
	//se cuenta desde 1 que es el array de la primera imagen del botón
	var i = 1; 
	
	//las imágenes de los botones de cabecera tienen números pares, al añadir la imagen del logotipo
	while(i<=8) {
		
		//divide para obtener número par
		if(i%2!=1) {
			var imagen_off = document.images[i];
			//reposicionamos la imagen por ser más alta
			imagen_off.style.position='relative';
			imagen_off.style.top='-10px';
			
			//imagen por defecto
			imagen_off.src='img/btnDetalle_es.gif';
			
			//rollovers especial para esta imagen
			imagen_off.onmouseover=function(){
				this.src='img/btnDetalle_es_f2.gif';
			}
			
			imagen_off.onmouseout=function(){
				this.src='img/btnDetalle_es.gif';
			}
		}
		i++;
	}
			
}

//rollovers y focus generales para los elementos de formularios y colores de fondo

function rollOverButton (nombre, clase) {
	var boton = document.getElementById(nombre).className = clase;
}

function rollOutButton (nombre, clase) {
	var boton = document.getElementById(nombre).className = clase;
}

function foco (element) {
	var objeto = document.getElementById(element);	
	if (navigator.appName == 'Microsoft Internet Explorer') {
		objeto.style.backgroundColor='#ffffff';	
		
	}
	
	objeto.onfocusin = function(){
		objeto.style.backgroundColor='#ffffff';					
	}
	
	objeto.onfocusout = function(){ 
		objeto.style.backgroundColor='#eeeeee';					
	}
	
}

function foco2 (element) {
	var objeto = document.getElementById(element);	
	if (navigator.appName == 'Microsoft Internet Explorer') {
		objeto.style.backgroundColor='#E2E7E4';	
		
	}
	
	objeto.onfocusin = function(){
		objeto.style.backgroundColor='#E2E7E4';					
	}
	
	objeto.onfocusout = function(){ 
		objeto.style.backgroundColor='#8c8d93';					
	}
	
}


//tabulador activo de panel para detalle de productos y servicios
function swap(obj){
	var fichas = new Array(document.getElementById('uno'), document.getElementById('dos'));
	
	
	for(i=0; i<fichas.length;i++){
		if(i==obj){
			fichas[i].className = 'current';
			document.getElementById('cap'+(i+1)).style.display='block';
			
		}else{
			fichas[i].className = null;
			document.getElementById('cap'+(i+1)).style.display='none';
			
		}
	}
}

//Mostrar imagen del menú activo de la plantilla 2
function menuActivo(obj){
	var menu = new Array(document.getElementById('info'), document.getElementById('cata'), document.getElementById('tien'), document.getElementById('cest'), document.getElementById('busc'), document.getElementById('sug'));
	
	
	for(i=0; i<menu.length;i++){
		if(i==obj){
			menu[i].className = 'current';
			
			
		}else{
			menu[i].className = null;
			
			
		}
	}
}

//Mostrar imagen del menú activo de la plantilla 2
function menuActivo_w(obj){
	var menu = new Array(document.getElementById('btnpresentacion'), document.getElementById('btnactividad'), document.getElementById('btnirTienda'), document.getElementById('btncontacto'), document.getElementById('btnlocalizacion'));
	var menu_eng = new Array(document.getElementById('btnpresentacion1'), document.getElementById('btnactividad1'), document.getElementById('btnirTienda1'), document.getElementById('btncontacto1'), document.getElementById('btnlocalizacion1'));

	for(i=0; i<menu.length;i++){
		if(i==obj){
			menu[i].className = 'current';
			menu_eng[i].className = 'current';
			
		}else{
			menu[i].className = null;
			menu_eng[i].className = null;
			
		}
	}
}

//tabulador activo de panel para detalle de productos y servicios
function gesMenu(obj){
	var fichas = new Array(document.getElementById('gesPortal'), document.getElementById('gesTienda'), document.getElementById('gesEmpresa'), document.getElementById('gesServicios'));
	
	
	for(i=0; i<fichas.length;i++){
		if(i==obj){
			fichas[i].className = 'current';
			document.getElementById('ges'+(i+1)).style.display='block';
			
		}else{
			fichas[i].className = null;
			document.getElementById('ges'+(i+1)).style.display='none';
			
		}
	}
}

function lenguaje(lang){
	var idioma = new Array();
	idioma[0] = ['Es','Presentaci&oacute;n','Actividad','Productos','Cat&aacute;logo','Noticias','Contacto','Grupo Noticias','&Uacute;ltimas Noticias','Historial Noticias','Anuncios','Galer&iacute;a de im&aacute;genes','Foro','Localizaci&oacute;n'];
	idioma[1] = ['Eng','Presentation','Activity','Products','Catalog','News','Contact','Newsgroup','Latest News','history news','Advertisement','Images Gallery','Forum','Location'];
	
	for (var i=0; i<idioma.length;i++){
		if (lang==idioma[i][0]){				
			document.getElementById(lang).style.display="block";
			presentacion		= idioma[i][1];
			actividad 			= idioma[i][2];
			productos 			= idioma[i][3];
			catalogo 			= idioma[i][4];
			noticias 			= idioma[i][5];
			contacto 			= idioma[i][6];
			grpNoticias			= idioma[i][7];
			ultimasNoticias		= idioma[i][8];
			historialNoticias	= idioma[i][9];
			anuncios			= idioma[i][10];
			galeria				= idioma[i][11];
			foro				= idioma[i][12];
			localizacion		= idioma[i][13];
		}else{			
			for(var objetoin in document.getElementById(idioma[i][0])){				
				document.getElementById(idioma[i][0]).style.display="none";
			}
			
		}
	}
}

//Uso de la tecla ENTER en verificación de formularios

function enterForm () {
	
	//IE
	document.body.onkeypress=function(e){
		 if((e||event).keyCode==13)
		 	verificarUserPanel();
	}
	
	//Mozilla
	window.onkeypress=function(e){
		 if((e||event).keyCode==13)
		  verificarUserPanel();
	}
}

var new_window=null;

function start_window(url,ancho,alto){
	
	w = screen.availWidth;
   	h = screen.availHeight;
	
	var leftPos = (w-ancho)/2, topPos = (h-alto)/2	
	
	if (new_window==null) {
	  new_window = null;
	} else {
	  new_window.close();
	  new_window = null;
	}
	
	new_window = window.open(url, 'NewWindow', 'directories=no, menubar=no, resizable=no, top='+topPos+', left='+leftPos+' ,width='+ancho+',height='+alto);
	new_window.focus();
  
}

