/*   Free Script provided by HIOXINDIA            */
/*   visit us at http://www.hscripts.com     */
/*   This is a copyright product of hioxindia.com */

var heading = "#ffaaff";
var bgcolor1 = "#ffdddd";
var bgcolor2 = "#eeffcc";
var font1 = "blue";
var font2 = "#000000";
var height = "180";
var width = "145";
var mes_final = "";

function DaysInMonth(Y, M) 
{
    with (new Date(Y, M, 1, 12)) {
        setDate(0);
        return getDate();
    }
}

function setcal(mon,yea)
{
	mon = mon+1;
	mes_final = mon;

	var days = DaysInMonth(yea,mon);
	var D = new Date(mon+"/01/"+yea);

	var day = D.getDay();
	var form = document.getElementById('frmCalendario');
	
	var ar = new Array(form.m01.value,form.m02.value,form.m03.value,form.m04.value,form.m05.value,form.m06.value,form.m07.value,form.m08.value,form.m09.value,form.m10.value,form.m11.value,form.m12.value);
	var df = ar[mon-1];

	df = df+", "+D.getFullYear();

	document.xxx.ddd.value = df;

	var ddf = document.calen.length;
	
	for(var xx=0; xx<ddf; xx++)
		document.calen[xx].value = "";

	var ss = 1;
	for(var xx=day; xx<day+days; xx++){
		document.calen[xx].value = ss++;
	}
}

var exd = new Date();
var monthe = exd.getMonth();
var yeare = exd.getFullYear();

function prev()
{
	monthe = monthe-1;
	if(monthe < 0)
	{
		yeare = yeare-1;	
		monthe = 11;
	}
	setcal(monthe, yeare);
	return false;
}

function next()
{
	monthe = monthe+1;
	if(monthe > 11)
	{
		yeare = yeare+1;	
		monthe = 0;
	}
	setcal(monthe, yeare);
	return false;
}

function thismon()
{
	//yeare = yeare+1900;
	setcal(monthe, yeare);
}

var code = ""

code = "<table><tr><td colspan=7><table><tr><td colspan=3><a href=\"eventos.asp?dia=15&mes=11&ano=2008&tipo_evento=&evento=&filtro=true \"></a></td><tr><td><a onclick=\"return prev();\" style=\"cursor:pointer;\"><img src=\"App_Themes/ATL/Images/calendar_back.jpg\"</a></td><form name=xxx><td><input type=text name=ddd id=ddd size=17 class=calendario1></td></form><td><a onclick=\"return next()\" style=\"cursor:pointer;\"><img src=\"App_Themes/ATL/Images/calendar_for.jpg\"></a></td></tr></table></td></tr><tr><td class=calendario1>D</td><td class=calendario1>2</td><td class=calendario1>3</td><td class=calendario1>4</td><td class=calendario1>5</td><td class=calendario1>6</td><td class=calendario1>S</td></tr>";
code += "<form name=calen id=calen style=\"border: 0px; padding:0px;\">";

for(var xx=0; xx<6; xx++)
{
	code = code + 	"<tr>";
	for(var cc=0; cc<7; cc++){
		var dd = xx*7+cc;
		if(dd == 41)
			code = code + "<td align=center size=1>&nbsp;</td>"
		else
			code = code + "<td align=center><input class=\"calendar_days\" onClick=\"setLinks("+dd+");\" name=x"+dd+" readonly size=1></td>";
	}
	code = code + "</tr>";
}

code = code + "</form></table>";
document.write(code);
thismon();

/*   Free Script provided by HIOXINDIA            */
/*   visit us at http://www.hscripts.com     */
/*   This is a copyright product of hioxindia.com */


function setLinks(id)
{
	mes_actual = monthe + 1;
//	//window.location = 'eventos_pesquisa.asp?filtro=true&mes=' + mes_actual + '&ano=' + yeare + "&tipo_evento=";
//	window.location = 'eventos_pesquisa.asp?dia='+document.calen[id].value+'&mes=' + mes_actual + '&ano=' + yeare + "&tipo_evento=";		
//	//alert(document.calen[id].value);
//
//	alert('Redirect para a pesquisa de eventos no mes e dia escolhido: dia-' + document.calen[id].value + '; mês-' + mes_actual + '; ano-' + yeare);
    //alert('/Conteudos/Eventos/Pesquisa-Eventos.aspx?&mes=');
	top.window.location ='/Conteudos/Eventos/Pesquisa-Eventos.aspx?&dia='+ document.calen[id].value +'&mes=' + mes_actual + '&ano=' + yeare;
	return false;
		
}



