//-------------------------------------------------
//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();
}

//-------------------------------------------------

function inserisci_flash(menusel,testata,lingua) {
	    var oeTags = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'
    + 'width="780" height="140"'
    + 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab">'
    + '<param name="movie" value="../images/testata.swf?menusel='+menusel+'&testata='+testata+'&lingua='+lingua+'" /><param name="quality" value="high" /><param name="bgcolor" value="#000000" /><param name="menu" value="false"'
    + '<embed src="../images/testata.swf?menusel='+menusel+'&testata='+testata+'&lingua='+lingua+'" quality="high" bgcolor="#000000" '
    + 'width="780" height="140" name="testata" align="middle"'
    + 'play="true"'
    + 'loop="false"'
	+ 'menu="false"'
    + 'quality="high"'
    + 'allowScriptAccess="sameDomain"'
    + 'type="application/x-shockwave-flash"'
    + 'pluginspage="http://www.macromedia.com/go/getflashplayer">'
    + '<\/embed>'
    + '<\/object>';
    document.write(oeTags);   // embed the flash movie
}

function inserisci_home() {
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="782" height="400"><param name="movie" value="../images/home.swf"><param name="quality" value="high"><embed src="../images/home.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="782" height="400"></embed></object>');
}

function cartina(){
	popWindow=window.open('index.php?id=83','popUp','toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=no,width=628,height=435');
}

