///////////////////////////////////////////////////////////////
//                    PHOTOREVISTA                           //
//                                                           //
//        Programmed: Javier Vega Martinez                   //
//                    www.emdb-design.com                    //
//                    info@emdb-design.com                   //
//                                                           //
///////////////////////////////////////////////////////////////


//Cargamos las imagenes para que no tarde despues.
		
		// IMAGENES MENU  Columna2
		var imagenes_menu_columna2 = new Array("b_foro.jpg","blogmes.jpg","exposiciones.jpg","asociacion.jpg","escuelas.jpg"); 
    var lista_imagenes_menu_columna2 = new Array(); 
		var imagenes_menu_columna2_rollover = new Array("b_foro_rollover.jpg","blogmes_rollover.jpg","exposiciones_rollover.jpg","asociacion_rollover.jpg", "escuelas_rollover.jpg"); 
    var lista_imagenes_menu_columna2_rollover = new Array(); 
		
		// IMAGENES MENU  Columna3
		var imagenes_menu_columna3 = new Array("suscribete.jpg","blog.jpg","links.jpg","galeria.jpg"); 
    var lista_imagenes_menu_columna3 = new Array(); 
		var imagenes_menu_columna3_rollover = new Array("suscribete_rollover.jpg","blog_rollover.jpg","links_rollover.jpg","galeria_rollover.jpg"); 
    var lista_imagenes_menu_columna3_rollover = new Array(); 
		
		 
		var Path='Imagenes/Botones/';
		var Imagenes_Cargadas=false;
		function cargarimagenesmenu(){ 
			for(i in imagenes_menu_columna2){ 
				lista_imagenes_menu_columna2[i] = new Image(); 
				lista_imagenes_menu_columna2[i].src = Path + imagenes_menu_columna2[i];
				lista_imagenes_menu_columna2_rollover[i] = new Image(); 
				lista_imagenes_menu_columna2_rollover[i].src = Path + imagenes_menu_columna2_rollover[i];
			}
			for(i in imagenes_menu_columna3){ 
				lista_imagenes_menu_columna3[i] = new Image(); 
				lista_imagenes_menu_columna3[i].src = Path + imagenes_menu_columna3[i];
				lista_imagenes_menu_columna3_rollover[i] = new Image(); 
				lista_imagenes_menu_columna3_rollover[i].src = Path + imagenes_menu_columna3_rollover[i];
			}
			Imagenes_Cargadas=true;
		}
		// FUNCIONES COLUMNA2
		function Imagen_Rollover_Menu_Columna2(Seccion){
				var Imagen = document.getElementById('columna2menu'+Seccion);
				if (Imagenes_Cargadas == true){
					Imagen.src=lista_imagenes_menu_columna2_rollover[Seccion].src;
				}
		}
		
		function Imagen_Rollout_Menu_Columna2(Seccion){
			var Imagen = document.getElementById('columna2menu'+Seccion);
			if (Imagenes_Cargadas == true){
				Imagen.src=lista_imagenes_menu_columna2[Seccion].src;
			}
		}
		// FUNCIONES COLUMNA3
		function Imagen_Rollover_Menu_Columna3(Seccion){
				var Imagen = document.getElementById('columna3menu'+Seccion);
				if (Imagenes_Cargadas == true){
					Imagen.src=lista_imagenes_menu_columna3_rollover[Seccion].src;
				}
		}
		
		function Imagen_Rollout_Menu_Columna3(Seccion){
			var Imagen = document.getElementById('columna3menu'+Seccion);
			if (Imagenes_Cargadas == true){
				Imagen.src=lista_imagenes_menu_columna3[Seccion].src;
			}
		}
		
		////////////////////////////////////////////////////////////////
		//            THUMBS GALERIA
		////////////////////////////////////////////////////////////////
		//Detectamo navegador
		var navegador = navigator.appName 
		
		function Thumb_Rollover(Thumb){
			var Thumb = document.getElementById('thumb_'+Thumb);
			if (navegador == "Microsoft Internet Explorer"){
				Thumb.filters.alpha.opacity=100;
			}else{
				Thumb.style.opacity=1;
			}
		}
		
		function Thumb_Rollout(Thumb){
			var Thumb = document.getElementById('thumb_'+Thumb);
			if (navegador == "Microsoft Internet Explorer"){
				Thumb.filters.alpha.opacity=20;
			}else{
				Thumb.style.opacity=0.2;
			}
		}
		
		////////////////////////////////////////////////////////////////
		//         VENTANA GALERIA
		////////////////////////////////////////////////////////////////
		
		function AbirVentanaGaleria(galeria,apellido,carpeta){ 
				window.open("Galeria.php?gal="+galeria+"&ape="+apellido+"&dir="+carpeta,"CLUB","width=950,height=600,scrollbars=NO,resizable=NO,top=20,left=20"); 
		} 
		
		function AbirVentanaClub(){ 
    	window.open("Club.php","CLUB","width=1000,height=252,scrollbars=NO,resizable=NO,top=200,left=20"); 
		} 
	
///////////////////////////////////////////////////////////
/////////////// CONFIGURATION /////////////////////////////

	// Set the clock's font face:
	var myfont_face = "Verdana";

	// Set the clock's font size (in point):
	var myfont_size = "10";

	// Set the clock's font color:
	var myfont_color = "#000000";
	
	// Set the clock's background color:
	var myback_color = "#FFFFFF";

	// Set the text to display before the clock:
	var mypre_text = "";

	// Set the width of the clock (in pixels):
	var mywidth = 300;

	// Display the time in 24 or 12 hour time?
	// 0 = 24, 1 = 12
	var my12_hour = 0;

	// How often do you want the clock updated?
	// 0 = Never, 1 = Every Second, 2 = Every Minute
	// If you pick 0 or 2, the seconds will not be displayed
	var myupdate = 2;

	// Display the date?
	// 0 = No, 1 = Yes
	var DisplayDate = 0;

/////////////// END CONFIGURATION /////////////////////////
///////////////////////////////////////////////////////////

// Browser detect code
        var ie4=document.all
        var ns4=document.layers
        var ns6=document.getElementById&&!document.all

// Global varibale definitions:

	var dn = "";
	var mn = "th";
	var old = "";

// The following arrays contain data which is used in the clock's
// date function. Feel free to change values for Days and Months
// if needed (if you wanted abbreviated names for example).
	var DaysOfWeek_es = new Array(7);
		DaysOfWeek_es[1] = "Lunes";
		DaysOfWeek_es[2] = "Martes";
		DaysOfWeek_es[3] = "Miercoles";
		DaysOfWeek_es[4] = "Jueves";
		DaysOfWeek_es[5] = "Viernes";
		DaysOfWeek_es[6] = "Sabado";
		DaysOfWeek_es[0] = "Domingo";
	
	var DaysOfWeek_ca = new Array(7);
		DaysOfWeek_ca[1] = "DILLUNS";
		DaysOfWeek_ca[2] = "DIMARTS";
		DaysOfWeek_ca[3] = "DIMECRES";
		DaysOfWeek_ca[4] = "DIJOUS";
		DaysOfWeek_ca[5] = "DIVENDRES";
		DaysOfWeek_ca[6] = "DISSABTE";
		DaysOfWeek_ca[0] = "DIUMENGE";
	
	var DaysOfWeek_en = new Array(7);
		DaysOfWeek_en[1] = "MONDAY";
		DaysOfWeek_en[2] = "TUESDAY";
		DaysOfWeek_en[3] = "WEDNESDAY";
		DaysOfWeek_en[4] = "THURSDAY";
		DaysOfWeek_en[5] = "FRIDAY";
		DaysOfWeek_en[6] = "SATURDAY";
		DaysOfWeek_en[0] = "SUNDAY";

var MonthsOfYear_es = new Array(12);
		MonthsOfYear_es[0] = "Enero";
		MonthsOfYear_es[1] = "Febreo";
		MonthsOfYear_es[2] = "Marzo";
		MonthsOfYear_es[3] = "Abril";
		MonthsOfYear_es[4] = "Mayo";
		MonthsOfYear_es[5] = "Junio";
		MonthsOfYear_es[6] = "Julio";
		MonthsOfYear_es[7] = "Agosto";
		MonthsOfYear_es[8] = "Septiembre";
		MonthsOfYear_es[9] = "Octubre";
		MonthsOfYear_es[10] = "Noviembre";
		MonthsOfYear_es[11] = "Diciembre";
		
var MonthsOfYear_ca = new Array(12);
		MonthsOfYear_ca[0] = "GENER";
		MonthsOfYear_ca[1] = "FEBRER";
		MonthsOfYear_ca[2] = "MARÇ";
		MonthsOfYear_ca[3] = "ABRIL";
		MonthsOfYear_ca[4] = "MAIG";
		MonthsOfYear_ca[5] = "JUNY";
		MonthsOfYear_ca[6] = "JULIOL";
		MonthsOfYear_ca[7] = "AGOST";
		MonthsOfYear_ca[8] = "SETEMBRE";
		MonthsOfYear_ca[9] = "OCTUBRE";
		MonthsOfYear_ca[10] = "NOVENBRE";
		MonthsOfYear_ca[11] = "DESEMBRE";
		
	var MonthsOfYear_en = new Array(12);
		MonthsOfYear_en[0] = "GENER";
		MonthsOfYear_en[1] = "FEBRER";
		MonthsOfYear_en[2] = "MARÇ";
		MonthsOfYear_en[3] = "ABRIL";
		MonthsOfYear_en[4] = "MAIG";
		MonthsOfYear_en[5] = "JUNY";
		MonthsOfYear_en[6] = "JULIOL";
		MonthsOfYear_en[7] = "AGOST";
		MonthsOfYear_en[8] = "SEPTEMBER";
		MonthsOfYear_en[9] = "OCTUBRE";
		MonthsOfYear_en[10] = "NOVENBRE";
		MonthsOfYear_en[11] = "DESEMBRE";

// This array controls how often the clock is updated,
// based on your selection in the configuration.
	var ClockUpdate = new Array(3);
		ClockUpdate[0] = 0;
		ClockUpdate[1] = 1000;
		ClockUpdate[2] = 60000;

// For Version 4+ browsers, write the appropriate HTML to the
// page for the clock, otherwise, attempt to write a static
// date to the page.
	/*if (ie4||ns6) { document.write('<span id="LiveClockIE" style="width:'+mywidth+'px; background-color:'+myback_color+'"></span>'); }
	else if (document.layers) { document.write('<ilayer bgColor="'+myback_color+'" id="ClockPosNS" visibility="hide"><layer width="'+mywidth+'" id="LiveClockNS"></layer></ilayer>'); }
	else { old = "true"; show_clock(); }*/





// The main part of the script:
	function show_clock(lenguaje) {
		
		if (old == "die") { return; }
	
	// Get all our date variables:
		var Digital = new Date();
		var ano = Digital.getYear();
		var day = Digital.getDay();
		var mday = Digital.getDate();
		var month = Digital.getMonth();
		var hours = Digital.getHours();

		var minutes = Digital.getMinutes();
		var seconds = Digital.getSeconds();
    var myclock;
		var fecha;
	// Fix the "mn" variable if needed:
		if (mday == 1) { mn = "st"; }
		else if (mday == 2) { mn = "nd"; }
		else if (mday == 3) { mn = "rd"; }
		else if (mday == 21) { mn = "st"; }
		else if (mday == 22) { mn = "nd"; }
		else if (mday == 23) { mn = "rd"; }
		else if (mday == 31) { mn = "st"; }

	// Set up the hours for either 24 or 12 hour display:
		if (my12_hour) {
			dn = "AM";
			if (hours > 12) { dn = "PM"; hours = hours - 12; }
			if (hours == 0) { hours = 12; }
		} else {
			dn = "";
		}
		if (minutes <= 9) { minutes = "0"+minutes; }
		if (seconds <= 9) { seconds = "0"+seconds; }

	// This is the actual HTML of the clock. If you're going to play around
	// with this, be careful to keep all your quotations in tact.
		myclock = '';
		fecha = '';
		//myclock += '<font style="color:'+myfont_color+'; font-family:'+myfont_face+'; font-size:'+myfont_size+'pt;">';
		myclock += mypre_text;
		myclock += hours+':'+minutes;
		if ((myupdate < 2) || (myupdate == 0)) { myclock += ':'+seconds; }
		myclock += ' '+dn;
		if (DisplayDate) { 
			switch(lenguaje){
				case 'es':
					myclock += ' on '+DaysOfWeek_es[day]+', '+mday+mn+' '+MonthsOfYear_es[month]; 
					break;
				case 'ca':
					myclock += ' on '+DaysOfWeek_ca[day]+', '+mday+mn+' '+MonthsOfYear_ca[month]; 
					break;
				case 'en':
					myclock += ' on '+DaysOfWeek_en[day]+', '+mday+mn+' '+MonthsOfYear_en[month]; 
					break;
				default:
					myclock += ' on '+DaysOfWeek_es[day]+', '+mday+mn+' '+MonthsOfYear_es[month]; 
					break;
			}
		}
		//myclock += '</font>';
		myclock+=' h';
		ano=ano;
		if (ie4) {
     
		}
		else if (ns6){   //FIREFOX
			ano+=1900;
    }
		switch(lenguaje){
				case 'es':
					fecha = myclock+'&nbsp;&nbsp;&nbsp;&nbsp;'+DaysOfWeek_es[day]+', '+mday+' '+MonthsOfYear_es[month]+' de '+ano; 
					break;
				case 'ca':
					fecha = DaysOfWeek_ca[day]+', '+mday+' '+MonthsOfYear_ca[month]+' de '+ano; 
					break;
				case 'en':
					fecha = DaysOfWeek_en[day]+', '+mday+' '+MonthsOfYear_en[month]+' OF '+ano; 
					break;
				default:
					fecha = DaysOfWeek_es[day]+', '+mday+' '+MonthsOfYear_es[month]+' de '+ano;
					break;
			}
		
		if (old == "true") {
			document.write(myclock);
			old = "die";
			return;
		}
	  // Write the clock to the layer:
		if (ns4) {
			//clockpos = document.ClockPosNS;
			//var Hora = 
			//document.getElementById('hora1').innerHTML='HOLAQ';
			//Hora.innerHTML="HOLA Q";
			//liveclock = clockpos.document.LiveClockNS;
			//liveclock = document.hora;
			//liveclock.document.write(myclock);
			//liveclock.document.close();
			//var texto = "Texto creado dinámicamente";
			//document.all.hora1.innerHTML = texto
			//alert('hola');
			// document.getElementById('hora1').innerHTML = myclock;
		} else if (ie4) {       //OPERA e IE
			document.all.fecha.innerHTML = fecha;
		} else if (ns6){   //FIREFOX
			document.getElementById('fecha').innerHTML = fecha;
    }
		
	if (myupdate != 0) { setTimeout("show_clock()",ClockUpdate[myupdate]); }
}
