//-------------------------------------------------
//Non ELIMINARE necessari al programma!!!

// Browser Detection
isMac = (navigator.appVersion.indexOf("Mac")!=-1) ? true : false;
NS4 = (document.layers) ? true : false;
IEmac = ((document.all)&&(isMac)) ? true : false;
IE4plus = (document.all) ? true : false;
IE4 = ((document.all)&&(navigator.appVersion.indexOf("MSIE 4.")!=-1)) ? true : false;
IE5 = ((document.all)&&(navigator.appVersion.indexOf("MSIE 5.")!=-1)) ? true : false;
ver4 = (NS4 || IE4plus) ? true : false;
NS6 = (!document.layers) && (navigator.userAgent.indexOf('Netscape')!=-1)?true:false;

// Body onload utility (supports multiple onload functions)
var gSafeOnload = new Array();
function SafeAddOnload(f)
{
	if (IEmac && IE4)  // IE 4.5 blows out on testing window.onload
	{
		window.onload = SafeOnload;
		gSafeOnload[gSafeOnload.length] = f;
	}
	else if  (window.onload)
	{
		if (window.onload != SafeOnload)
		{
			gSafeOnload[0] = window.onload;
			window.onload = SafeOnload;
		}		
		gSafeOnload[gSafeOnload.length] = f;
	}
	else
		window.onload = f;
}
function SafeOnload()
{
	for (var i=0;i<gSafeOnload.length;i++)
		gSafeOnload[i]();
}

// Call the following with your function as the argument
//SafeAddOnload(yourfunctioname);

//-----------------------------------------------------------------------------------------------------------------------------------------------------------


function POPUP(theurl){
	popWindow=window.open(theurl,'popUp','toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=no,width=490,height=360,left=150,top=100');
}


function popup(theurl){
	popWindow=window.open(theurl,'popUp','toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=no,width=550,height=360,left=150,top=100');
}


function setPointer(theRow, thePointerColor) {
    if (typeof(theRow.style) == 'undefined' || typeof(theRow.cells) == 'undefined') {
        return false;
    }

    var row_cells_cnt           = theRow.cells.length;
    for (var c = 0; c < row_cells_cnt; c++) {
        theRow.cells[c].bgColor = thePointerColor;
    }
    return true;
}


function settaframe() {
	iFrameContenuto.document.write(ContenutoIframe.innerHTML);
}

//-------------------------------------------------

function tblPaginator_next () {
	this.page++;
	if (this.page>this.pMax) {
		this.page=this.pMax;
	}
	this.showPage();
}


function tblPaginator_prev () {
	this.page--;
	if (this.page<1) {
		this.page=1;
	}
	this.showPage();
}


function tblPaginator_showPage () {
	tb = document.getElementById(this.tbody);
	Pout = this.nRowsPerPage * this.page -1;
	Pin  = Pout - this.nRowsPerPage +1;
	for (var i=0; i<tb.rows.length; i++) {
		if (i<Pin || i>Pout) {
			tb.rows[i].style.visibility = 'hidden';
			tb.rows[i].style.display = 'none';
		} else {
			tb.rows[i].style.visibility = 'visible';
			tb.rows[i].style.display = '';
		}
	}
}

function tblPaginator (tbody, nRows) {
	this.tbody = tbody;
	this.nRowsPerPage = nRows;
	this.pMax = Math.ceil(document.getElementById(this.tbody).rows.length / this.nRowsPerPage);
	this.page = 0;
	this.showPage = tblPaginator_showPage;
	this.next = tblPaginator_next;
	this.prev = tblPaginator_prev;
	this.next();
}

//-------------------------------------------------
