var capavisible="";


// JavaScript Document

function antispam(clase)
{
	var usuario = "info"
	var dominio = "cbcoslada.net"
	document.write("<a class='"+clase+"' href=\"mailto:" + usuario + "@" + dominio + "\">" + usuario + "@" + dominio + "</a>")
}


function fecha(){
	var mydate=new Date();
	var year=mydate.getYear();
	if (year < 1000)
		year+=1900;
	var day=mydate.getDay();
	var month=mydate.getMonth();
	var daym=mydate.getDate();
	if (daym<10)
	daym="0"+daym;
	var dayarray=new Array("Domingo","Lunes","Martes","Miercoles","Jueves","Viernes","Sábado");
	var montharray=new Array("Ene","Feb","Mar","Abr","May","Jun","Jul","Ago","Sep","Oct","Nov","Dic");
	document.write( daym + " " + montharray[month] + "." + year + ".");
}
function hora(){
	if (!document.layers&&!document.all&&!document.getElementById)
	return
	var Digital=new Date()
	var hours=Digital.getHours()
	var minutes=Digital.getMinutes()
	var seconds=Digital.getSeconds()
	var dn="AM" 
	if (hours>12){
	dn="PM"
	hours=hours-12
	}
	if (hours==0)
	hours=12
	if (minutes<=9)
	minutes="0"+minutes
	if (seconds<=9)
	seconds="0"+seconds
	//change font size here to your desire
	myclock=hours+":"+minutes+":"+seconds
	if (document.layers){
	document.layers.liveclock.document.write(myclock)
	document.layers.liveclock.document.close()
	}
	else if (document.all)
	liveclock.innerHTML=myclock
	else if (document.getElementById)
	document.getElementById("liveclock").innerHTML=myclock
	setTimeout("hora()",1000)
}

    var map;
    function onLoad() {
        if (GBrowserIsCompatible()){
            map = new GMap2(document.getElementById("map"));
            map.addControl(new GLargeMapControl());
            map.setCenter(new GLatLng(40.419189,-3.546492), 16);
            map.addControl(new GMapTypeControl());
            
            var icon = new GIcon();
            icon.image = "imagenes/logomapa.png";
            
            icon.iconSize = new GSize(60, 60);
            
            icon.iconAnchor = new GPoint(58, 58);
            icon.infoWindowAnchor = new GPoint(58, 58);
            
            
            function createMarker(point,html,icono) {
                html = "<div style=' text-align:center;' >" + html + "<\/div>";
                var marker = new GMarker(point,icono);
            
                GEvent.addListener(marker, "click", function() {
                    if (map.getZoom()<17){
                    map.setCenter(point, 17);
                    }
                });
            
                GEvent.addListener(marker, "mouseover", function() {
                    marker.openInfoWindow(html);
                });
            
                GEvent.addListener(marker, "dblclick", function() {
                    if (map.getZoom()<17){
                        map.setCenter(point, 17);
                    }
                });
    
            return marker;
            }
            
            var punto = new GLatLng(40.419189,-3.546492);
            var marca = createMarker(punto,"<strong>Club Baloncesto Coslada<\/strong><br />C/Mosc&uacute;, s/n<br />Coslada (Madrid) 28820<br />Tel.:<strong>+34 916 74 13 74<\/strong> <br /><a href='mailto:info@cbcoslada.net' class='enlace_mapa'> info@cbcoslada.net<\/a>",icon);
            map.addOverlay(marca);
        }
    }


//imprimir una capa

function imprimir(capa) {


var ventana = window.open("", "", "");
var contenido = "<html><head><title>.:: Club de Baloncesto Coslada ::.</title><link href=\"./css/estilo.css\" rel=\"stylesheet\" type=\"text/css\"/></head><body onload='window.print();window.close();'><div style=\"width:630px; float:left; margin-top:10px;\">" + document.getElementById(capa).innerHTML + "</div></body></html>";


ventana.document.open();
ventana.document.write(contenido);
ventana.document.close();
}

//funcion para desplegar la capa de enviar noticia

function desplegar(nombre){

	var capa;

	var boton;

	

	capa = document.getElementById(nombre);

	if (capavisible != ""){

		capavisible.style.display = 'none';		

	}else{

		capavisible = document.getElementById('plantilla');

		capavisible.style.display = 'none';						

	}

	capavisible=capa;

	capa.style.display = '';

}

function desplegarcapa(nombre){
	var capa;
	
	capa = document.getElementById(nombre);

	if (capa.style.display != 'none'){
		capa.style.display = 'none';
	}
	else
	{
		capa.style.display = '';
	}
}


var botonactivo;
botonactivo = "b0";

			

function controlboton(boton,accion){		
	var actual;

	actual = document.getElementById(boton);	

	if(botonactivo != boton){
		if(accion == "mostrar"){
			actual.src='./imagenes/' + boton + 'off.gif';
		}
		if(accion == "ocultar"){
			actual.src='./imagenes/' + boton + 'on.gif';
		}
	}	
}


function cambioboton(boton){
	var actual;
	var anterior;
	
	actual = document.getElementById(boton);
	anterior = document.getElementById(botonactivo);
	
	if(botonactivo != "b0"){
		anterior.src='./imagenes/'+ botonactivo +'off.gif';
	}
	actual.src='./imagenes/'+ boton +'on.gif';
	botonactivo = boton;
}