var host  = "http://www.copitiza.org/"

function ShowImg(path)
{
	var img = "<img src=\""+host+"img/"+path+"\" border=\"0\">"
	document.write(img)
}

function ShowUrl(url, path)
{
	if (url != "") {
		if (path == 0)  {top.location=host+url+".html";}
		if (path == 1)  {top.location=host+"Organizacion_del_Ayuntamiento/"+url+".html";}
		if (path == 2)  {top.location=host+"Atencion_al_Ciudadano/"+url+".html";}
		if (path == 3)  {top.location=host+"Areas_y_Servicios/"+url+".html";}
		if (path == 4)  {top.location=host+"Informacion/"+url+".html";}
		if (path == 5)  {top.location=host+"Atencion_al_Ciudadano/Demografia/barrio-"+url+".html";}
		if (path == 10) {top.location=host+"Atencion_al_Ciudadano/Calendario/"+url+".html";}
		if (path == 11) {top.location=host+"Atencion_al_Ciudadano/Ord_Fiscales/"+url+".html";}
		if (path == 12) {top.location=host+"Areas_y_Servicios/Festejos/"+url+".html";}
		if (path == 13) {top.location=host+"Areas_y_Servicios/Cultura/"+url+".html";}
		if (path == 14) {top.location=host+"Areas_y_Servicios/Educacion/"+url+".html";}
	}
}

function ShowFiestas() 
{
	date = new Date();
	var dm = date.getDate();
	var dia = '01';

	if (dm<10) {dia='0'+dm;} else {dia=dm;}

	var textHtml = "<A HREF=\"http://www.aytosalamanca.com/Areas_y_Servicios/Festejos/Calendario/"+dia+"092001.html\" ";
	textHtml += " class=\"smallWhite\">Festejos de Hoy</a>";

	document.write(textHtml); 
}

function ShowIntro()
{
//	IntroWin = window.open(host+'Introduccion/Introflash.html',
//		'Reference',
//		'toolbar=no,top=50,left=50,width=475,height=350,directories=no,status=no,scrollbars=no');
//	IntroWin.focus();
}

function GoToNameAnchor(na)
{
	if (na != "")
		top.location="#"+na;
}

function ShowDate() 
{
	date = new Date();
	var ndw = date.getDay(); 
	var dm = date.getDate();
	var nm = date.getMonth();
	var y = date.getYear(); 

	if (y<200)
		y+=1900;
	var dw = '';
	var m = '';
 
	if(nm == 0) {m = 'Enero';}
	if(nm == 1) {m = 'Febrero';}
	if(nm == 2) {m = 'Marzo';}
	if(nm == 3) {m = 'Abril';}
	if(nm == 4) {m = 'Mayo';}
	if(nm == 5) {m = 'Junio';}
	if(nm == 6) {m = 'Julio';}
	if(nm == 7) {m = 'Agosto';}
	if(nm == 8) {m = 'Septiembre';}
	if(nm == 9) {m = 'Octubre';}
	if(nm == 10){m = 'Noviembre';}
	if(nm == 11){m = 'Diciembre';}

	if(ndw == 0){dw = 'Domingo';}
	if(ndw == 1){dw = 'Lunes';} 
	if(ndw == 2){dw = 'Martes';}
	if(ndw == 3){dw = 'Mi&eacute;rcoles';}
	if(ndw == 4){dw = 'Jueves';} 
	if(ndw == 5){dw = 'Viernes';}
	if(ndw == 6){dw = 'S&aacute;bado';}

	var fecha = '&nbsp;'+dw+', '+dm+' '+m+' '+y+'. ';
	document.write(fecha); 
} 

function OverTagTD(td,color){td.style.cursor='hand';td.bgColor=color;}
function OutTagTD(td,color){td.style.cursor='default';td.bgColor=color;}

function ShowCalendar() {
        date = new Date();
	var ndw = date.getDay();
        var d = date.getDate();
	var nm = date.getMonth();
	var y = date.getYear();
        var dia = 1;

	if (y<200)
		y+=1900;
	var m = '';
 
	if(nm == 0) {m = 'ENERO'; dm=31;}
	if(nm == 1) {m = 'FEBRERO'; if (((y-1980)%4)==0) {dm=29;} else {dm=28;}}
	if(nm == 2) {m = 'MARZO'; dm=31;}
	if(nm == 3) {m = 'ABRIL'; dm=30;}
	if(nm == 4) {m = 'MAYO'; dm=31;}
	if(nm == 5) {m = 'JUNIO'; dm=30;}
	if(nm == 6) {m = 'JULIO'; dm=31;}
	if(nm == 7) {m = 'AGOSTO'; dm=31;}
	if(nm == 8) {m = 'SEPTIEMBRE'; dm=30;}
	if(nm == 9) {m = 'OCTUBRE'; dm=31;}
	if(nm == 10){m = 'NOVIEMBRE'; dm=30;}
	if(nm == 11){m = 'DICIEMBRE'; dm=31;}

	if(ndw == 0){ndw = 7;}

        document.write('<table border=\"0\" cellspacing=\"0\" cellpadding=\"2\">');
        document.write('<tr align=\"center\">');
        document.write('<td class=\"bigWhite\" colspan=\"7\">'+m+'</td>');
        document.write('</tr>');
        document.write('<tr align=\"right\">');
        document.write('<td class=\"sboldWhite\"><b>L</b></td>');
        document.write('<td class=\"sboldWhite\"><b>M</b></td>');
        document.write('<td class=\"sboldWhite\"><b>X</b></td>');
        document.write('<td class=\"sboldWhite\"><b>J</b></td>');
        document.write('<td class=\"sboldWhite\"><b>V</b></td>');
        document.write('<td class=\"sboldWhite\"><b>S</b></td>');
        document.write('<td class=\"sboldWhite\"><b>D</b></td>');
        document.write('</tr>');
        document.write('<tr align=\"right\">');
        document.write('<td colspan=\"7\"><img src=\"img/lincal.gif\" width=\"130\" height=\"1\"></td>');
        document.write('</tr>');

        dia1=ndw-(d%7);
	if (dia1<0) dia1=dia1+7;

        document.write('<tr align=\"right\">');
        for(i=1;i<dia1+1;i++) {
                document.write('<td class=\"sboldWhite\">&nbsp;</td>');
	}
        for(i=dia1;i<7;i++) {
		if (dia==d) {document.write('<td bgcolor=\"ffffff" class=\"smallBlue\">'+dia+'</td>');}
		else {document.write('<td class=\"sboldWhite\">'+dia+'</td>');}
                dia++;
	}
        document.write('</tr>');

        for(;dia<=dm;) {
                document.write('<tr align=\"right\">');
                for(j=1;j<8 && dia<=dm;j++) {
			if (dia==d) {document.write('<td bgcolor=\"ffffff" class=\"smallBlue\"><b>'+dia+'</b></td>');}
			else {document.write('<td class=\"sboldWhite\">'+dia+'</td>');}
                        dia++;        
                }
                document.write('</tr>');
        }
                

        document.write('</table>');

}

function randImg(min,max)
{
	var nImg=min-1;
	while (nImg<min || nImg>max) 
	{
		nImg=Math.round(Math.random()*(max-min)+min);
	}
	return nImg;
}
