// ----------------------------------------
// Calendar
// ----------------------------------------
var YearView = 0;
var MonthView = 0;
var DaysInMonth = 0;
var DaysOffset = 0;
var MaxDays = 0;
var Now = new Date();

// Parse arguments
var args = getArgs();

// ----------------------------------------
function getArgs()
// ----------------------------------------
{
	var args = new Object();
	var query = location.search.substring(1); 
	var pairs = query.split("&"); 
	
	for(var i = 0; i < pairs.length; i++)
	{
		var pos = pairs[i].indexOf('='); 
		if (pos == -1) continue; 
		var argname = pairs[i].substring(0,pos); 
		var value = pairs[i].substring(pos+1); 
		args[argname] = unescape(value); 
	}
	
	return args;
}

// ----------------------------------------
function InvokeNext()
// ----------------------------------------
{
MonthView = MonthView + 1;
location.href = "calendar.html?month=" + MonthView + "&year=" + YearView;
}

// ----------------------------------------
function InvokePrev()
// ----------------------------------------
{
MonthView = MonthView - 1;
location.href = "calendar.html?month=" + MonthView + "&year=" + YearView;
}

// ----------------------------------------
function InvoqueProximo()
// ----------------------------------------
{
MonthView = MonthView + 1;
location.href = "calendario.html?month=" + MonthView + "&year=" + YearView;
}

// ----------------------------------------
function InvoquePrevio()
// ----------------------------------------
{
MonthView = MonthView - 1;
location.href = "calendario.html?month=" + MonthView + "&year=" + YearView;
}

// ----------------------------------------
// ----------------------------------------
// Set Defaults
// ----------------------------------------
// ----------------------------------------
if (args.month)
{
    MonthView = parseInt(args.month);
    YearView = parseInt(args.year);
} else {
    MonthView    = Now.getMonth() + 1; 
    YearView     = Now.getFullYear(); 
}

if ( (MonthView > 12) )
{
    MonthView    = 1;
    YearView = YearView + 1; 
} 

if ( (MonthView < 01) )
{
    MonthView    = 12;
    YearView = YearView - 1; 
}

// ----------------------------------------
function Set_Banner() {
// ----------------------------------------

var photos=new Array()
var lindex=0

photos[lindex]="./photos/calendar/p1.jpg"
photos[++lindex]="./photos/calendar/p2.jpg"
photos[++lindex]="./photos/calendar/p3.jpg"
photos[++lindex]="./photos/calendar/p4.jpg"
photos[++lindex]="./photos/calendar/p5.jpg"
photos[++lindex]="./photos/calendar/p6.jpg"
photos[++lindex]="./photos/calendar/p7.jpg"
photos[++lindex]="./photos/calendar/p8.jpg"
photos[++lindex]="./photos/calendar/p9.jpg"
photos[++lindex]="./photos/calendar/p10.jpg"
photos[++lindex]="./photos/calendar/p11.jpg"
photos[++lindex]="./photos/calendar/p12.jpg"
photos[++lindex]="./photos/calendar/p13.jpg"
photos[++lindex]="./photos/calendar/p14.jpg"
photos[++lindex]="./photos/calendar/p15.jpg"
photos[++lindex]="./photos/calendar/p16.jpg"
photos[++lindex]="./photos/calendar/p17.jpg"
photos[++lindex]="./photos/calendar/p18.jpg"
photos[++lindex]="./photos/calendar/p19.jpg"
photos[++lindex]="./photos/calendar/p20.jpg"
photos[++lindex]="./photos/calendar/p21.jpg"
photos[++lindex]="./photos/calendar/p22.jpg"
photos[++lindex]="./photos/calendar/p23.jpg"
photos[++lindex]="./photos/calendar/p24.jpg"
photos[++lindex]="./photos/calendar/p25.jpg"
photos[++lindex]="./photos/calendar/p26.jpg"
photos[++lindex]="./photos/calendar/p27.jpg"
photos[++lindex]="./photos/calendar/p28.jpg"
photos[++lindex]="./photos/calendar/p29.jpg"
photos[++lindex]="./photos/calendar/p30.jpg"
photos[++lindex]="./photos/calendar/p31.jpg"
photos[++lindex]="./photos/calendar/p32.jpg"
photos[++lindex]="./photos/calendar/p33.jpg"
photos[++lindex]="./photos/calendar/p34.jpg"
photos[++lindex]="./photos/calendar/p35.jpg"
photos[++lindex]="./photos/calendar/p36.jpg"
photos[++lindex]="./photos/calendar/p37.jpg"
photos[++lindex]="./photos/calendar/p38.jpg"
photos[++lindex]="./photos/calendar/p39.jpg"
photos[++lindex]="./photos/calendar/p40.jpg"
photos[++lindex]="./photos/calendar/p41.jpg"
photos[++lindex]="./photos/calendar/p42.jpg"
photos[++lindex]="./photos/calendar/p43.jpg"
photos[++lindex]="./photos/calendar/p44.jpg"

var random1=Math.floor(Math.random()*(lindex + 1));

var random2=random1 + 6;
if ( random2 > lindex ) { random2 = random2 - (lindex + 1) };

var random3=random2 + 6;
if ( random3 > lindex ) { random3 = random3 - (lindex + 1) };

var random4=random3 + 6;
if ( random4 > lindex ) { random4 = random4 - (lindex + 1) };

var random5=random4 + 6;
if ( random5 > lindex ) { random5 = random5 - (lindex + 1) };

document.images.photoimage1.src=photos[random1];
document.images.photoimage2.src=photos[random2];
document.images.photoimage3.src=photos[random3];
document.images.photoimage4.src=photos[random4];
document.images.photoimage5.src=photos[random5];

}