// Title: Tigra Scroller
// Description: See the demo at url
// URL: http://www.softcomplex.com/products/tigra_scroller/
// Version: 1.5
// Date: 07-03-2003 (mm-dd-yyyy)
// Note: Permission given to use this script in ANY kind of applications if
//    header lines are left unchanged.

// set correct path to Tigra Scroller files
var Tscroll_path_to_files = '/'

// please, don't change anything below this line
function Tscroll_init (id) {
	document.write ('<iframe id="Tscr' + id + '" scrolling=no frameborder=no src="' + Tscroll_path_to_files + 'sc.html?' + id + '" width="1" height="1"></iframe>');
	//autofitIframe("Tscr" + id );
}

function autofitIframe(id){
	
	if (document.all && document.getElementById){
		
		document.getElementById(id).style.height=this.document.body.offsetHeight+"px";
	
	} else if(document.getElementById) {
		
		document.getElementById(id).style.height=this.document.body.scrollHeight+"px"
	}
}

function mudaCalendario(dir) {

	if   (dir == 1) {
		get_prev = 1;
		get_prox = 0;
		month = month + 1;
	} else {
		get_prev = 0;
		get_prox = 1;
		month = month - 1;
	}

	if (month>12){
		year  = year + 1;
		month = 1;
	}


	if (month==0){
		month=12;
		year = year -1;
	}
	
	
	ajax('/calendarios.php?month='+month+'&year='+year+'&get_prev='+get_prev+'&get_prox='+get_prev, 'calendario1');
}

function ajax(url,funcao)
{
	
    req = null;
    // branch for native XMLHttpRequest object
    if (window.XMLHttpRequest)
    {
        req = new XMLHttpRequest();
        req.onreadystatechange =  eval(funcao);
        req.open("GET", url, true);
        req.send(null);

    // branch for IE/Windows ActiveX version
    } else if (window.ActiveXObject) {
        isIE = true;
        req = new ActiveXObject("Microsoft.XMLHTTP");
        if (req)
        {
              if (funcao != "")
                req.onreadystatechange = eval(funcao);
            req.open("GET", url, true);
            req.send();
        }
    }
}

function calendario1 () {
	 if (req.readyState == 4)
        {
            if (req.status == 200)
            {
                temp = req.responseText;

                texto = req.responseText;
				document.getElementById('calendario1').innerHTML=texto;
				ajax('/calendarios.php?month='+(month+1)+'&year='+year+'&get_prev='+get_prev+'&get_prox='+get_prev, 'calendario2');
            }
        }
}

function calendario2 () {
	 if (req.readyState == 4)
        {
            if (req.status == 200)
            {
                temp = req.responseText;

                texto = req.responseText;
				document.getElementById('calendario2').innerHTML=texto;
            }
        }
}

function showHideDiv(div, force) {
	var estado = document.getElementById(div).style.visibility;

	if (estado!="visible" || force==1){
		document.getElementById(div).style.visibility = "visible";
		document.getElementById(div).style.display    = "";
	} else {
		document.getElementById(div).style.visibility = "hidden";
		document.getElementById(div).style.display    = "none";
	}
}
