// <![CDATA[

function eseguiClickGrafico(id) {
	var page;
	if (id.indexOf("http://") == -1)
        page = 'http://www.eurizonvita.it/quotazioni/NavHTML/Inbox/' + id;
		//page = 'http://83.103.58.21/QuotazioniContentHtml/quotazionicontenthtmlservlet?flagGrafico=true&codiceFondo=' + id;
	else
		page = id;
	//alert ("grafico: "+page);
    var width = 550;
    var height = 310;
/*     var screenX = (window.outerWidth - width) / 2;
    var screenY = (window.outerHeight - height) / 2;
	var options = 'dependent=yes,scrollbars=no,resizable=no,location=no,width='+width+',height='+height+',screenX='+screenX+',screenY='+screenY+'';
 */    
    var screenX = parseInt(((screen.width - width) / 2), 10);
    var screenY = parseInt(((screen.height - height) / 2), 10);
	var options = 'scrollbars=no,resizable=no,location=no,width='+width+',height='+height+',left='+screenX+',top='+screenY;
    
	window.open(page, '', options).focus();
}

function eseguiClick(tr) {
	switch (tr.className) {
		case "pdf r_odd":
		case "pdf r_pair":
			//alert ("pdf");
            /*
             * vecchie URL:
			var page = 'http://83.103.58.21/aiponline/filemanager/download/commercio/rendiconti/' + tr.id;
            */
			var page = 'http://83.103.58.21/eurizonvitaonline/filemanager/download/commercio/rendiconti/' + tr.id;
			var options = 'scrollbars=yes,resizable=yes,location=no,width=950,height=710';
			window.open(page, '', options).focus();
			break;
			
		case "famiglia r_odd":
		case "famiglia r_pair":
			//alert ("famiglia");
			//var page = 'http://83.103.58.21/QuotazioniContentHtml/rendiconticontenthtmlservlet?codiceCompagnia=FV&codiceFondi=' + tr.id;
			if (document.location.href.indexOf ('showFamiglia') == -1)
				var page = document.location.href+'&showFamiglia=1&codiceFondi=' + tr.id;
			else
				var page = document.location.href;
			//var options = 'scrollbars=no,resizable=no,location=no,width=550,height=310';
			//window.open(page, '', options).focus();
			window.location = page
			break;
		case "grafico r_odd":
		case "grafico r_pair":
			//alert ("grafico");
			eseguiClickGrafico(tr.id);
			break;
		default:
	}
}

function cliccaFondo() {

    var table = document.getElementsByTagName('table');
    
    for (k=0; k<table.length; k++) {
    
        if (table[k].className.match(/int_table/gi)) { 
                
            var tbody = table[k].getElementsByTagName('tbody')[0];
            var rows  = tbody.getElementsByTagName('tr');
            
            for (i=0; i<rows.length; i++) {
                
                if (rows.id != '') {
                    rows[i].onclick = function() {
						eseguiClick(this);
					}
                }
			}
		}
    }
}

WindowOnload(cliccaFondo);

// ]]>
