function histats_site_summarystats_class() {
    try {
        this.swf_COLGRAPH_id_day = 0;
        this.swf_COLGRAPH_id_30days = 0;
        this.monthMOD = 0  ;
        this.compare_CAL_id = 0;
        this.sockTOKEN = 0;
        this.user_logged = 1;
        
        
        
    } catch(e){
        alert("err loading javascript ,    try refreshing browser cache \n "  + e.message + "\n ");
    }
} // end

var OBJ_summary = new histats_site_summarystats_class();

histats_statsmodule_class.prototype.f_set_summaryswfid_Day  = function() {
    this.swf_COLGRAPH_id = OBJ_summary.swf_COLGRAPH_id_day;
}

// build online average values based on vis
histats_statsmodule_class.prototype.f_print_ALL_HTML_summary  = function() {
    if(!OBJ_SITEs[this.ids]) return;
    var divname_summary = 'histats_summarystats_summary_part1';
    var divname_day_part1 = 'histats_summarystats_day_part1';
    var divname_day_part2 = 'histats_summarystats_day_part2';
    var divname_30day_part1 = 'histats_summarystats_30_part1';
    var divname_30day_part2 = 'histats_summarystats_30_part2';

    var HTML_SUMMARY = this.f_print_summary_HTML_summary()
    var HTML_DAY_1 = this.f_print_summary_HTML_dailypart1()
    var HTML_DAY_2 = this.f_print_summary_HTML_dailypart2()

    $('#'+divname_summary).html(HTML_SUMMARY);
    $('#'+divname_day_part1).html(HTML_DAY_1);
    $('#'+divname_day_part2).html(HTML_DAY_2);
    /*document.getElementById(divname_30day_part1).innerHTML = HTML_PART1;
  document.getElementById(divname_30day_part2).innerHTML = HTML_PART1;*/

    if(OBJ_SITE.AR_ADDITIONAL_INFO['total_hits']==0 || OBJ_SITE.AR_ADDITIONAL_INFO['total_hits']==OBJ_SITE.start_h){
        ftrova();
    }

    $(document).ready(function(){
        $(".compareTD").bind("mouseenter mouseleave",function(event){
            $(this).toggleClass("compareTD_over");
        });
        PTR_MOD.CLASSupd = new aggiornaDato_class();
        PTR_MOD.CLASSupd.sockAR_init();
        PTR_MOD.CLASSupd.CALLrun = 1;
        setTimeout("PTR_MOD.CLASSupd.f_CALLsock()", 10000);
        
    });
    
}

histats_statsmodule_class.prototype.f_print_summary_HTML_summary  = function() {
    var OBJ_SITE = OBJ_SITEs[this.ids];
    if(OBJ_SITE.AR_ADDITIONAL_INFO['last_update'] < OBJ_SITE.AR_ADDITIONAL_INFO['dateiscr'] ) OBJ_SITE.AR_ADDITIONAL_INFO['last_update'] = OBJ_SITE.AR_ADDITIONAL_INFO['dateiscr'];
    var LAST_UPDATE_dateOBJ = new    histats_datecal_class();
    LAST_UPDATE_dateOBJ.tNOW = OBJ_SITE.AR_ADDITIONAL_INFO['last_update'];
    LAST_UPDATE_dateOBJ.build_dateAR();
    var ISCR_dateOBJ = new    histats_datecal_class();
    ISCR_dateOBJ.tNOW = OBJ_SITE.AR_ADDITIONAL_INFO['dateiscr'];
    ISCR_dateOBJ.build_dateAR();
    var CURTIME_dateOBJ = new    histats_datecal_class();
    CURTIME_dateOBJ.tNOW = OBJ_SITE.site_time;
    CURTIME_dateOBJ.build_dateAR();
    var LASTHITSTIME_dateOBJ = new    histats_datecal_class();
    LASTHITSTIME_dateOBJ.tNOW = OBJ_SITE.lht -86400+ OBJ_SITE.time_offset ;
    LASTHITSTIME_dateOBJ.build_dateAR();
    //print_r(ISCR_dateOBJ);
    var str_dateISCR = ISCR_dateOBJ.get_hour() + ' ' + ISCR_dateOBJ.get_dateday_y() ;
    var str_lastupdate = LASTHITSTIME_dateOBJ.get_hour() + ' ' + LASTHITSTIME_dateOBJ.get_dateday() ;
    var current_time_timezone  = CURTIME_dateOBJ.get_hour() + ' , ' + CURTIME_dateOBJ.dateAR['day'] + ' ' + GL.R(GLOBAL_AR_MONTH[parseInt(CURTIME_dateOBJ.dateAR['month'])]) + ', ' + OBJ_SITE.timezone_str;
    if(current_time_timezone.length > 40) current_time_timezone =  current_time_timezone.substr(0,40)
    //print_r(OBJ_SITE);
    //alert('category_'+parseInt(OBJ_SITE.cat));
    
    
    
    
    HTML_TABLE = '<table border="0" width="700" cellspacing="0" cellpadding="0" height="150"><tr>\
	<td background="'+GLOBALS['FOLDER_img']+'summ340150.png" style="padding-top:5px;" width="340" valign="top" align="center">\
		<table border="0" width="320" cellspacing="0" cellpadding="0"><tr>\
			<td width="40" align="left"><img border="0" src="'+GLOBALS['FOLDER_img']+'statsS.png"></td>\
			<td width="280" align="left"><font class="text16">'+GL.R('statistiche_generali')+'</font></td>\
		</tr></table>\
		<table border="0" width="100%" cellspacing="0" cellpadding="0" height="5"><tr><td></td></tr></table>\
		<table border="0" width="330" cellspacing="0" cellpadding="0" height="25" style="border-bottom: 1px solid #DBDBDB"><tr>\
			<td width="132" style="padding-left:5px;" align="left"><font class="text11_grey">'+GL.R('pagine_viste_totale')+'</font></td>\
			<td style="padding-right:5px;" align="right"><font class="text14_Dblue" id="UPD_tot_h" value="'+OBJ_SITE.AR_ADDITIONAL_INFO['total_hits']+'">'+GL.fn(OBJ_SITE.AR_ADDITIONAL_INFO['total_hits'])+'</font></td>\
		</tr></table>\
		<table border="0" width="330" cellspacing="0" cellpadding="0" height="25" style="border-top: 1px solid #FFFFFF;border-bottom: 1px solid #DBDBDB"><tr>\
			<td width="132" style="padding-left:5px;" align="left"><font class="text11_grey">'+GL.R('totale_visit')+'</font></td>\
			<td style="padding-right:5px;" align="right"><font class="text14_Dblue" id="UPD_tot_v" value="'+OBJ_SITE.AR_ADDITIONAL_INFO['total_vis']+'">'+GL.fn(OBJ_SITE.AR_ADDITIONAL_INFO['total_vis'])+'</font></td>\
		</tr></table>\
		<table border="0" width="330" cellspacing="0" cellpadding="0" height="25" style="border-top: 1px solid #FFFFFF;border-bottom: 1px solid #DBDBDB"><tr>\
			<td width="161" style="padding-left:5px;" align="left"><font class="text11_grey">'+GL.R('pag_per_visit')+'</font></td>\
			<td style="padding-right:5px;" align="right"><font class="text14_Dblue">'+GL.fn(OBJ_SITE.AR_ADDITIONAL_INFO['ppv'])+'</font></td>\
		</tr></table>\
		<table border="0" width="330" cellspacing="0" cellpadding="0" height="25" style="border-top: 1px solid #FFFFFF;"><tr>\
			<td width="95" style="padding-left:5px;" align="left"><font class="text11_grey">'+GL.R('orario_server')+'</font></td>\
			<td style="padding-right:5px;" align="right"><font class="text14_Dblue">'+str_lastupdate+'</font></td>\
		</tr></table>\
	</td>\
	<td width="20"></td>\
	<td background="'+GLOBALS['FOLDER_img']+'summ340150.png" style="padding-top:5px;" width="340" valign="top" align="center">\
		<table border="0" width="320" cellspacing="0" cellpadding="0"><tr>\
			<td width="40" align="left"><img border="0" src="'+GLOBALS['FOLDER_img']+'accS.png"></td>\
			<td width="281" align="left"><font class="text16">'+GL.R('sommario_account')+'</font></td>\
		</tr></table>\
		<table border="0" width="100%" cellspacing="0" cellpadding="0" height="5"><tr><td></td></tr></table>\
		<table border="0" width="330" cellspacing="0" cellpadding="0" height="25" style="border-bottom: 1px solid #DBDBDB"><tr>\
			<td width="132" style="padding-left:3px;" align="left"><font class="text11_grey">'+GL.R('data_iscrizione')+'</font></td>\
			<td style="padding-right:3px;" align="right"><font class="text11_Dblue">'+str_dateISCR+'</font></td>\
		</tr></table>\
		<table border="0" width="330" cellspacing="0" cellpadding="0" height="25" style="border-top: 1px solid #FFFFFF;border-bottom: 1px solid #DBDBDB"><tr>\
			<td width="187" style="padding-left:3px;" align="left"><font class="text11_grey">'+GL.R('giorni_creazione_account')+'</font></td>\
			<td style="padding-right:3px;" align="right"><font class="text11_Dblue">'+GL.fn(OBJ_SITE.d_subscr)+'</font></td>\
		</tr></table>\
		<table border="0" width="330" cellspacing="0" cellpadding="0" height="25" style="border-top: 1px solid #FFFFFF;border-bottom: 1px solid #DBDBDB"><tr>\
			<td width="68" style="padding-left:3px;" align="left"><font class="text11_grey">'+GL.R('ora_locale')+'</font></td>\
			<td style="padding-right:3px;" align="right"><font class="text11_Dblue">'+current_time_timezone+'</font></td>\
		</tr></table>\
		<table border="0" width="330" cellspacing="0" cellpadding="0" height="25" style="border-top: 1px solid #FFFFFF;"><tr>\
			<td width="50%" style="padding-left:3px;" align="left"><font class="text11_grey">'+GL.R('tipo')+'&nbsp;</font><font class="text11_Dblue">'+GL.R('nametype_'+parseInt(OBJ_SITE.AR_ADDITIONAL_INFO['tipo']))+'</font></td>\
			<td style="padding-right:3px;" align="right" width="50%"><font class="text11_grey">'+GL.R('categoria')+'&nbsp;</font><font class="text11_Dblue">'+GL.R('category_'+parseInt(OBJ_SITE.AR_ADDITIONAL_INFO['cat']))+'</font></td>\
		</tr></table>\
	</td>\
</tr></table>\
<div id="divCNT_updDATA"></div>';
    return HTML_TABLE;
}

histats_statsmodule_class.prototype.f_print_summary_HTML_dailypart1  = function() {
    if(!OBJ_SITEs[this.ids]) return;
    var OBJ_SITE = OBJ_SITEs[this.ids];
    var OBJ_dateSID =  G_CAL_HANDLER.AR_CALENDAR[OBJ_SITE.ID_CALDATE_SITE];
    var DAY_TO_DISPLAY =OBJ_dateSID.dateAR['day'];
    OBJ_DAY = OBJ_SITE.daily_stats[DAY_TO_DISPLAY];

    var TMP_message = '<div class="TBcompare" style="margin-top:5px;margin-bottom:5px;border: 1px solid #CC0000;">\
<table border="0" width="100%" cellspacing="0" cellpadding="0" ><tr><td><font class="text11_grey"></font></td></tr></table>\
</div>';
    TMP_message = '';

    var HTML_TABLE = '<br>\
<table class="Dintesta"  border="0" width="700" cellspacing="0" cellpadding="0"><tr>\
    <td style="width:130px;" align="left">'+GL.R('oggi')+'</td>\
    <td style="width:370px;" align="left" valign="bottom"><a href="javascript:PTR_MOD.CLASSupd.f_BTplayPause();" id="BTplayPause" class="ttip" original-title=\'Auto refresh\'><img src="'+GLOBALS['FOLDER_img']+'pausel30b.png" border="0"></a></td>\
    <td style="width:220px;font-size:20px;" align="right">'+OBJ_dateSID.get_dateday_y()+'</td>\
</tr></table>\
<table border="0" width="700" cellspacing="0" cellpadding="0">\
    <tr>\
        <td align="center" valign="top" width="345">\
            <table border="0" width="340" cellspacing="0" cellpadding="0">\
                <tr>\
                    <td width="170" height="22" style="border-bottom:1px solid #E3EFF2; padding-left: 10px"  align="left"><font class="text11_grey">'+GL.R('pagine_viste')+':</font></td>\
                    <td width="170" height="22" style="border-bottom:1px solid #E3EFF2; padding-right: 10px" align="right"><font class="text14_Dblue" id="UPD_tod_h" value="'+OBJ_DAY['TOTAL_HITS']+'">'+GL.fn(OBJ_DAY['TOTAL_HITS'])+'</font></td>\
                </tr>\
                <tr>\
                    <td width="170" height="22" style="border-bottom:1px solid #E3EFF2; padding-left: 10px" bgcolor="#F2F2F2" align="left"><font class="text11_grey">'+GL.R('visitatori')+':</font></td>\
                    <td width="170" height="22" style="border-bottom:1px solid #E3EFF2; padding-right: 10px" bgcolor="#F2F2F2" align="right"><font class="text14_Dblue"  id="UPD_tod_v" value="'+OBJ_DAY['TOTAL_VIS']+'">'+GL.fn(OBJ_DAY['TOTAL_VIS'])+'</font></td>\
                </tr>\
                <tr>\
                    <td width="170" height="22" style="border-bottom:1px solid #E3EFF2; padding-left: 10px" align="left"><font class="text11_grey">'+GL.R('nuovi_visitatori')+':</font></td>\
                    <td width="170" height="22" style="border-bottom:1px solid #E3EFF2; padding-right: 10px" align="right"><font class="text14_Dblue"  id="UPD_tod_nv" value="'+OBJ_DAY['TOTAL_nVIS']+'">'+GL.fn(OBJ_DAY['TOTAL_nVIS'])+'</font> <font class="text14_Dblue">('+GL.fn(OBJ_DAY['totalnvisPERC'])+'%)</font></td>\
                </tr>\
                <tr>\
                    <td height="22" style="border-bottom:1px solid #E3EFF2; padding-left: 10px" align="left" class="td_summaryLIVE_off" onmouseout="this.className=\'td_summaryLIVE_off\';" onmouseover="this.className=\'td_summaryLIVE_over\';" onclick="location.href=\'http://www.histats.com/viewstats/?sid='+this.ids+'&act=18\';" colspan="2">\
                        <table height="22" border="0" width="340" cellspacing="0" cellpadding="0"><tr>\
                            <td width="170" ><font class="text11_Dblue"><img src="'+GLOBALS['FOLDER_img']+'liveG.gif" border="0"> '+GL.R('utenti_conn_ora')+':</font></td>\
                            <td width="170"  style="padding-right: 10px" align="right"><font class="text14_Dblue"  id="UPD_cur_online" value="'+OBJ_DAY['onlineVIS']+'">'+GL.fn(OBJ_DAY['onlineVIS'])+'</font></td>\
                        </tr></table>\
                    </td>\
                </tr>\
            </table>\
        </td>\
        <td width="10" align="center" valign="top" ></td>\
        <td width="345" align="center" valign="top" >\
            <table border="0" width="340" cellspacing="0" cellpadding="0" height="40">\
                <tr>\
                    <td width="170" height="22" style="border-bottom:1px solid #E3EFF2; padding-left: 10px" align="left"><font class="text11_grey">'+GL.R('durata_media_visita')+':</font></td>\
                    <td width="170" height="22" style="border-bottom:1px solid #E3EFF2; padding-right: 10px" align="right"><font class="text14_Dblue" >'+f_seconds_to_minhour(OBJ_DAY['tm'])+'</font></td>\
                </tr>\
                <tr>\
                    <td width="170" height="22" style="border-bottom:1px solid #E3EFF2; padding-left: 10px" bgcolor="#F2F2F2" align="left"><font class="text11_grey">'+GL.R('pag_per_visit')+':</font></td>\
                    <td width="170" height="22" style="border-bottom:1px solid #E3EFF2; padding-right: 10px" bgcolor="#F2F2F2" align="right"><font class="text14_Dblue" >'+GL.fn(OBJ_DAY['totalPPV'])+'</font></td>\
                </tr>\
            </table>\
        </td>\
    </tr>\
</table>\
<table border="0" width="100%" cellspacing="0" cellpadding="0" height="10"><tr><td></td></tr></table>\
<div class="TBcompare">\
    <table border="0" width="100%" cellspacing="0" cellpadding="0"><tr>\
            <td width="25"><img border="0" src="'+GLOBALS['FOLDER_img']+'compareICO2.png"></td>\
            <td width=""><font class="text14_blue"> '+GL.R('compare')+'</font></td>\
            <td class="compareTD ttip" onclick="OBJ_STATSsheet.ARmodules['+this.nmod+'].f_set_summaryswfid_Day();OBJ_STATSsheet.ARmodules['+this.nmod+'].f_print_noCompare(0,true);" original-title=\''+addslashes(GL.R('no_compare'))+'\'><img src="'+GLOBALS['FOLDER_img']+'150.png" border="0"> no</font></td>\
            <td class="compareTD ttip" onclick="OBJ_STATSsheet.ARmodules['+this.nmod+'].f_set_summaryswfid_Day();OBJ_STATSsheet.ARmodules['+this.nmod+'].f_print_unb(0,true);" original-title=\''+addslashes(GL.R('trend_bounce'))+'\'><img src="'+GLOBALS['FOLDER_img']+'bounce.png" border="0"> bounce</font></td>\
            <td class="compareTD ttip" onclick="OBJ_STATSsheet.ARmodules['+this.nmod+'].f_set_summaryswfid_Day();OBJ_STATSsheet.ARmodules['+this.nmod+'].f_print_average_ppv(0,true);" original-title=\''+addslashes(GL.R('trend_Ppv'))+'\'><img border="0" src="'+GLOBALS['FOLDER_img']+'trend10.png"> '+GL.R('ppv')+'</td>\
            <td class="compareTD ttip" onclick="OBJ_STATSsheet.ARmodules['+this.nmod+'].f_set_summaryswfid_Day();OBJ_STATSsheet.ARmodules['+this.nmod+'].f_print_newvis_perc(0,true);" original-title=\''+addslashes(GL.R('n_visitatori'))+'\'><img border="0" src="'+GLOBALS['FOLDER_img']+'trend10b.png"> Nvis</td>\
            <td class="compareTD ttip" onclick="OBJ_STATSsheet.ARmodules['+this.nmod+'].f_set_summaryswfid_Day();OBJ_STATSsheet.ARmodules['+this.nmod+'].f_build_avg_online(0,true);" original-title=\''+addslashes(GL.R('avg_online'))+'\'><img border="0" src="'+GLOBALS['FOLDER_img']+'liveIco.png"> '+GL.R('contval_online')+'</td>\
            <td class="compareTD ttip" onclick="OBJ_STATSsheet.ARmodules['+this.nmod+'].f_set_summaryswfid_Day();OBJ_STATSsheet.ARmodules['+this.nmod+'].f_hourlystats_do_compareday(-1,0,2);" original-title=\''+addslashes(GL.R('yesterday'))+'\'><img src="'+GLOBALS['FOLDER_img']+'026.png" border="0"> -1</td>\
            <td class="compareTD ttip" onclick="OBJ_STATSsheet.ARmodules['+this.nmod+'].f_set_summaryswfid_Day();OBJ_STATSsheet.ARmodules['+this.nmod+'].f_hourlystats_do_compareday(-7,0,2);" original-title=\'7 '+addslashes(GL.R('days_back'))+'\'><img src="'+GLOBALS['FOLDER_img']+'026.png" border="0"> -7</td>\
            <td class="compareTD ttip" onclick="OBJ_STATSsheet.ARmodules['+this.nmod+'].f_set_summaryswfid_Day();OBJ_STATSsheet.ARmodules['+this.nmod+'].f_hourlystats_do_compareday(-14,0,2);" original-title=\'14 '+addslashes(GL.R('days_back'))+'\'><img src="'+GLOBALS['FOLDER_img']+'026.png" border="0"> -14</td>\
            <td class="compareTD" id="compare_daily_stats_calendarTD" onclick="OBJ_STATSsheet.ARmodules['+this.nmod+'].f_set_summaryswfid_Day();GLOBAL_DHTMLOBJ._ELEMENT_mouseOVER_showhere(\'histats_dailystats_compare_calendar\',this.id);"><img src="'+GLOBALS['FOLDER_img']+'025.png" border="0" height="10" width="10">'+GL.R('giorno')+'<img border="0" src="'+GLOBALS['FOLDER_img']+'ar_D.gif"></td>\
    </tr></table>\
</div>\
'+TMP_message+'\
<table border="0" width="100%" cellspacing="0" cellpadding="0" height="10"><tr><td></td></tr></table>' ;

    return HTML_TABLE;
}

histats_statsmodule_class.prototype.f_print_summary_HTML_dailypart2  = function() {
    var OBJ_SITE = OBJ_SITEs[this.ids];
    var tx_fore_h = '';
    var tx_fore_d = '';

    var FOR_h7 = '';
    var FOR_h14 = '';
    var FOR_d7 = '';
    var FOR_d14 = '';
    
    var PRT_forHH = new Array();
    PRT_forHH[7] = '-';
    PRT_forHH[14] = '-';
    var PRT_forGG = new Array();
    PRT_forGG[7] = '-';
    PRT_forGG[14] = '-';

    var tx_fore_valueh = 0;
    var tx_fore_valued = 0;
    var tx_plus = '';
    var HTML_forecastTABLE = '' ; 
    if(OBJ_prev.TOTAL_VIS>0){
        tx_fore_valued = OBJ_prev.TOTAL_VIS;
    }
    if(OBJ_prev.AR_vis[OBJ_prev.cur_h]){
        tx_fore_valueh = OBJ_prev.AR_vis[OBJ_prev.cur_h];
    }
    var tmp_font_color = '';
    if(OBJ_prev.bool_troppopresto == 1 ){
        HTML_forecastTABLE = '<table border="0" width="700" cellspacing="0" cellpadding="0" height="40" background="'+GLOBALS['FOLDER_img']+'bar_70040.png"><tr>\
                                <td width="675" align="right" style="padding-right:10px;"><font class="text16_Dblue">'+GL.R('no_forecast_available')+'</font></td>\
                                <td width="25"><img border="0" src="'+GLOBALS['FOLDER_img']+'details_icon2.gif"></td>\
                            </tr></table>' ;
    }else{
        if(OBJ_prev.AR_Compared){
            for(k in OBJ_prev.AR_Compared){
                if(OBJ_prev.AR_Compared[k]['h']){
                    tmp_font_color = 'FF0000';
                    tx_plus = '';
                    if(OBJ_prev.AR_Compared[k]['h'] > 0){
                        tx_plus = ' + ';
                        tmp_font_color = '00aa00';
                    }
                    PRT_forHH[k] = '<font color="#'+tmp_font_color+'">'+tx_plus+GL.fn(OBJ_prev.AR_Compared[k]['h'])+'%</font>';
                    tx_fore_h+=' <tr height="20">\
                                                <td width="20">&nbsp;</td>\
                                                <td width="80"><font class="text16"><font color="#'+tmp_font_color+'">'+tx_plus+GL.fn(OBJ_prev.AR_Compared[k]['h'])+'%</font></font></td>\
                                                <td width="190"><font class="text11_Lgrey">'+GL.R('rispetto_a')+' '+k+' '+GL.R('giorni_fa_stessa_ora')+'</font></td>\
                                        </tr>';
                }
                if(OBJ_prev.AR_Compared[k]['d']){
                    tmp_font_color = 'FF0000';
                    tx_plus = '';
                    if(OBJ_prev.AR_Compared[k]['d'] > 0){
                        tx_plus = ' + ';
                        tmp_font_color = '00aa00';
                    }
                    
                    PRT_forGG[k] = '<font color="#'+tmp_font_color+'">'+tx_plus+GL.fn(OBJ_prev.AR_Compared[k]['d'])+'%</font>';
                    tx_fore_d+='  <tr height="20">\
                                                <td width="20"></td>\
                                                <td width="80"><font class="text16"><font color="#'+tmp_font_color+'">'+tx_plus+GL.fn(OBJ_prev.AR_Compared[k]['d'])+'%</font></font></td>\
                                                <td width="190"><font class="text11_Lgrey">'+GL.R('rispetto_a')+' '+k+' '+GL.R('giorni_fa')+'</font></td>\
                                        </tr>';
                }
            }
            /* HTML_forecastTABLE = '<table border="0" width="700" cellspacing="0" cellpadding="0"><tr>\
                        <td width="110" style="padding-left: 5px"><font class="text14_orange">'+GL.R('previsioni')+'</font></td>\
                        <td width="290">\
                                <table border="0" width="290" cellspacing="0" cellpadding="0">\
                                       <tr>\
                                                <td width="20">\
                                                <p align="center"><img src="'+GLOBALS['FOLDER_img']+'087.png" border="0" height="10" width="10"></td>\
                                                <td colspan="2" height="20"><font class="text12"> '+GL.R('Visitors')+' '+GL.R('ora_corrente')+': </font><font class="text14_Dblue">'+GL.fn(tx_fore_valueh)+'</font></td>\
                                        </tr>'+tx_fore_h+'\
                                </table>\
                        </td>\
                        <td width="10" style="border-left: 1px solid #E4E4E4">&nbsp;</td>\
                        <td width="290">\
                                <table border="0" width="290" cellspacing="0" cellpadding="0">\
                                        <tr>\
                                                <td width="20" align="center"><img src="'+GLOBALS['FOLDER_img']+'025.png" border="0" height="10" width="10"></td>\
                                                <td colspan="2" height="20"><font class="text12"> '+GL.R('Visitors')+' '+GL.R('giorno_corrente')+': </font><font class="text14_Dblue">'+GL.fn(tx_fore_valued)+'</font></td>\
                                        </tr>'+tx_fore_d+'\
                                </table>\
                        </td>\
                </tr></table>';*/
            
            HTML_forecastTABLE = '<table border="0" width="700" cellspacing="1" cellpadding="0">\
                                    <tr>\
                                        <td width="40"></td>\
                                        <td align="center" style="-webkit-border-top-left-radius: 8px;-moz-border-radius-topleft: 8px;border-top-left-radius: 8px;padding:2px; border-right:1px solid #CCCCCC; border-bottom:1px solid #CCCCCC; " width="120" bgcolor="#E4E4E4"><font class="text16_blue">'+GL.R('previsioni')+'</font></td>\
                                        <td width="180" align="center" style="padding:2px; border-right:1px solid #CCCCCC; border-bottom:1px solid #CCCCCC; " bgcolor="#E4E4E4"><font class="text11_Dblue">'+GL.R('rispetto_a')+' 7 '+GL.R('giorni_fa')+'</font></td>\
                                        <td width="180" align="center" style="padding:2px; border-right:1px solid #CCCCCC; border-bottom:1px solid #CCCCCC; " bgcolor="#E4E4E4"><font class="text11_Dblue">'+GL.R('rispetto_a')+' 14 '+GL.R('giorni_fa')+'</font></td>\
                                        <td width="180" align="center" style="-webkit-border-top-right-radius: 8px;-moz-border-radius-topright: 8px;border-top-right-radius: 8px;padding:2px; border-bottom:1px solid #CCCCCC; " bgcolor="#E4E4E4"><font class="text11_Dblue">'+GL.R('visitatori')+'</font></td>\
                                    </tr>\
                                    <tr>\
                                        <td width="40"></td>\
                                        <td height="25" width="120" align="center" style="padding:2px; border-right:1px solid #CCCCCC; border-bottom:1px solid #CCCCCC; " bgcolor="#E4E4E4"><img src="'+GLOBALS['FOLDER_img']+'087.png" border="0" height="10" width="10"><font class="text11_grey"> '+GL.R('ora_corrente')+'</font></td>\
                                        <td width="180" height="25" align="center" style="border-right: 1px solid #CCCCCC; border-bottom: 1px solid #CCCCCC" bgcolor="#F3F3F3" ><font class="text16"><font color="#339933">'+PRT_forHH[7]+'</font></font></td>\
                                        <td width="180" height="25" align="center" style="border-right: 1px solid #CCCCCC; border-bottom: 1px solid #CCCCCC" bgcolor="#F3F3F3" ><font class="text16"><font color="#339933">'+PRT_forHH[14]+'</font></font></td>\
                                        <td width="180" height="25" align="center" style="border-bottom: 1px solid #CCCCCC" bgcolor="#F3F3F3" ><font class="text16">'+GL.fn(tx_fore_valueh)+'</b></font></td>\
                                    </tr>\
                                    <tr>\
                                        <td width="40"></td>\
                                        <td height="25" width="120" align="center" style="-webkit-border-bottom-left-radius: 8px;-moz-border-radius-bottomleft: 8px;border-bottom-left-radius: 8px;padding:2px; border-right:1px solid #CCCCCC; " bgcolor="#E4E4E4" ><img src="'+GLOBALS['FOLDER_img']+'025.png" border="0" height="10" width="10"><font class="text11_grey"> '+GL.R('giorno_corrente')+'</font></td>\
                                        <td width="180" height="25" align="center" style="border-right: 1px solid #CCCCCC" bgcolor="#F3F3F3"><font class="text16"><font color="#CC0000">'+PRT_forGG[7]+'</font></font></td>\
                                        <td width="180" height="25" align="center" style="border-right: 1px solid #CCCCCC" bgcolor="#F3F3F3"><font class="text16"><font color="#339933">'+PRT_forGG[14]+'</font></font></td>\
                                        <td width="180" height="25" align="center" style="-webkit-border-bottom-right-radius: 8px;-moz-border-radius-bottomright: 8px;border-bottom-right-radius: 8px;"bgcolor="#F3F3F3"><font class="text16">'+GL.fn(tx_fore_valued)+'</b></font></td>\
                                    </tr>\
                                </table>';

        }
    }

    var HTML_TABLE = '<div id="tbForecast">'+HTML_forecastTABLE+'</div>\
		<table border="0" width="100%" cellspacing="0" cellpadding="0" height="20"><tr><td></td></tr></table>\
                <table class="Dintesta" border="0" width="700" cellspacing="0" cellpadding="0"><tr><td align="left">'+GL.R('ultimi_30_giorni')+'</td></tr></table>\
                <table border="0" cellpadding="0" cellspacing="0" width="700"><tr>\
                    <td valign="top" width="345" align="center">\
                        <table border="0" cellpadding="0" cellspacing="0" height="40" width="340">\
                            <tr>\
                                <td style="border-bottom: 1px solid rgb(227, 239, 242); padding-left: 5px;" height="22" width="175"><font class="text11_grey">'+GL.R('pagine_viste')+':</font></td>\
                                <td style="border-bottom: 1px solid rgb(227, 239, 242);padding-right: 5px;" height="22" width="170" align="right"><font class="text14_Dblue">'+GL.fn(G_MULTIMONT.TOTAL_HITS)+'</font></td>\
                            </tr>\
                            <tr>\
                                <td style="border-bottom: 1px solid rgb(227, 239, 242); padding-left: 5px;" bgcolor="#f2f2f2" height="22" width="175"><font class="text11_grey">'+GL.R('visitatori')+':</font></td>\
                                <td style="border-bottom: 1px solid rgb(227, 239, 242);padding-right: 5px;" bgcolor="#f2f2f2" height="22" width="170" align="right"><font class="text14_Dblue">'+GL.fn(G_MULTIMONT.TOTAL_VIS)+'</font></td>\
                            </tr>\
                            <tr>\
                                <td style="border-bottom: 1px solid rgb(227, 239, 242); padding-left: 5px;" height="22" width="175"><font class="text11_grey">'+GL.R('nuovi_visitatori')+':</font></td>\
                                <td style="border-bottom: 1px solid rgb(227, 239, 242);padding-right: 5px;" height="22" width="170" align="right"><font class="text14_Dblue">'+GL.fn(G_MULTIMONT.TOTAL_nVIS)+' ('+GL.fn(G_MULTIMONT.totalnvisPERC)+'%)</font></td>\
                            </tr>\
                        </table>\
                    </td>\
                    <td align="center" valign="top" width="10"></td>\
                    <td align="center" valign="top" width="345">\
                        <table border="0" cellpadding="0" cellspacing="0" height="22" width="340">\
                            <tr>\
                                <td style="border-bottom: 1px solid rgb(227, 239, 242); padding-left: 5px;"  height="22" width="175"><font class="text11_grey">'+GL.R('pag_per_visit')+':</font></td>\
                                <td style="border-bottom: 1px solid rgb(227, 239, 242);padding-right: 5px;" height="22" width="170" align="right"><font class="text14_Dblue">'+GL.fn(G_MULTIMONT.totalPPV)+'</font></td>\
                            </tr>\
                        </table>\
                    </td>\
                </tr></table>\
                <table border="0" width="100%" cellspacing="0" cellpadding="0" height="5"><tr><td></td></tr></table>\
                <div class="TBcompare">\
                    <table border="0" width="100%" cellspacing="0" cellpadding="0"><tr>\
                        <td width="25"><img border="0" src="'+GLOBALS['FOLDER_img']+'compareICO2.png"></td>\
                        <td width=""><font class="text14_blue"> '+GL.R('compare')+'</font></td>\
                        <td class="compareTD ttip" onclick="OBJ_STATSsheet.ARmodules['+OBJ_summary.monthMOD+'].f_print_MULTImonthstats_nocompare();" original-title=\''+addslashes(GL.R('no_compare'))+'\'><img src="'+GLOBALS['FOLDER_img']+'150.png" border="0"> no</font></td>\
                        <td class="compareTD ttip" onclick="OBJ_STATSsheet.ARmodules['+OBJ_summary.monthMOD+'].f_print_MULTImonthstats_unb();" original-title=\''+addslashes(GL.R('trend_bounce'))+'\'><img src="'+GLOBALS['FOLDER_img']+'bounce.png" border="0"> bounce</font></td>\
                        <td class="compareTD ttip" onclick="OBJ_STATSsheet.ARmodules['+OBJ_summary.monthMOD+'].f_print_MULTImonthstats_average_ppv();" original-title=\''+addslashes(GL.R('trend_Ppv'))+'\'><img border="0" src="'+GLOBALS['FOLDER_img']+'trend10.png"> '+GL.R('ppv')+'</td>\
                        <td class="compareTD ttip" onclick="OBJ_STATSsheet.ARmodules['+OBJ_summary.monthMOD+'].f_print_MULTImonthstats_newvis_perc();" original-title=\''+addslashes(GL.R('n_visitatori'))+'\'><img border="0" src="'+GLOBALS['FOLDER_img']+'trend10b.png"> Nvis</td>\
                        <td class="compareTD ttip" onclick="OBJ_STATSsheet.ARmodules['+OBJ_summary.monthMOD+'].f_print_MULTImonthstats_online();" original-title=\''+addslashes(GL.R('avg_online'))+'\'><img border="0" src="'+GLOBALS['FOLDER_img']+'liveIco.png"> '+GL.R('contval_online')+'</td>\
                    </tr></table>\
                </div>';
    return HTML_TABLE;
}


histats_statsmodule_class.prototype.f_print_summarystats  = function() { // set nmod and change what need to get changed when nmod is changed :)
    if(!OBJ_SITEs[this.ids]) return;
    var OBJ_SITE = OBJ_SITEs[this.ids];
    var OBJ_dateSID =  G_CAL_HANDLER.AR_CALENDAR[OBJ_SITE.ID_CALDATE_SITE];   
    this.stats_pagetype = 'histats_summarystats' ;
    var DAY_TO_DISPLAY =OBJ_dateSID.dateAR['day'];
    OBJ_DAY = OBJ_SITE.daily_stats[DAY_TO_DISPLAY];
    OBJ_DAY.monthcode = OBJ_dateSID.dateAR['monthcode'];
    this.f_append_day_to_hismonth(OBJ_DAY);
    this.f_dailystats_build_addional_stats(DAY_TO_DISPLAY);
    // crea previsioni hourly
    
    if(OBJ_prev) OBJ_prev.build_PREV();
    // ---- daily 
    this.f_print_dailystats_SWF_BASE(true);
    this.f_print_dailystats_SWF_BASE_loadswf();
    
    this.f_build_daily_comparecal_stats_table(OBJ_DAY);
    //overwrite link to redirect to summary
    G_CAL_HANDLER.AR_CALENDAR[OBJ_DAY.compare_CAL_id].AR_HTMLlinks['day'] = 'onclick="OBJ_STATSsheet.ARmodules['+this.nmod+'].f_hourlystats_do_compareday(1000,{--day--},2);"';
    G_CAL_HANDLER.AR_CALENDAR[OBJ_DAY.compare_CAL_id].build_html_portions();
    G_CAL_HANDLER.AR_CALENDAR[OBJ_DAY.compare_CAL_id].print_toDIV();
    OBJ_summary.swf_COLGRAPH_id_day = this.swf_COLGRAPH_id;

    //---- last30

    


    OBJ_summary.monthMOD =  OBJ_STATSsheet.add_module(); // add stats module
    var ptrMONTHMOD = OBJ_STATSsheet.ARmodules[OBJ_summary.monthMOD];
    ptrMONTHMOD.ids = this.ids;
    ptrMONTHMOD.build_CURRENTCAL();


    G_MULTIMONT.ids = ptrMONTHMOD.ids;
    G_MULTIMONT.nmod = ptrMONTHMOD.nmod;
    G_MULTIMONT.nmod = OBJ_summary.monthMOD;
    G_MULTIMONT.f_build_MULTImonthstats();
    // crea previsioni day
    if(OBJ_prev.TOTAL_VIS) this.f_print_forecast_day_ONmultimonth(G_MULTIMONT);
    G_MULTIMONT.f_build_swf_Data();
    G_MULTIMONT.f_build_swf_graph();
    OBJ_summary.swf_COLGRAPH_id_30days = ptrMONTHMOD.swf_COLGRAPH_id;

    ptrMONTHMOD.swf_COLGRAPH_id_30days = OBJ_summary.swf_COLGRAPH_id;
    this.f_print_ALL_HTML_summary();
}

histats_statsmodule_class.prototype.reload_FOB  = function(){
    G_SWF_HANDLER.AR_SWFOBJ[this.swf_COLGRAPH_id].LOAD_FOB();
}

histats_statsmodule_class.prototype.f_print_dataEXP  = function(JSID,type){
    var tmp_separatore = ",";
    if(type=='tsv'){
        tmp_separatore = "\t";
    }
    if(JSID==OBJ_summary.swf_COLGRAPH_id_day){//stampo export per daily
        var print_strEXP = '';
        OBJ_SITE = OBJ_SITEs[this.ids];
        var DAY_TO_DISPLAY = G_CAL_HANDLER.AR_CALENDAR[this.ID_DATECAL].dateAR['day'];
        OBJ_DAY = OBJ_SITE.daily_stats[DAY_TO_DISPLAY];
        var HTML_TABLE = '' ;
        OBJ_DAY.AR_vis = OBJ_DAY.str_vis.split("#");
        if(OBJ_DAY.AR_vis.length < 1 ) return ;
        
        if(OBJ_DAY.AR_vis.length>0){
            print_strEXP = GL.R('ora') + tmp_separatore +  GL.R('visitatori') + tmp_separatore + GL.R('pagine') + tmp_separatore + 'ppv' + tmp_separatore + GL.R('newvis') +"\n";
            for(var k in OBJ_DAY.AR_vis){
                print_strEXP += k+'.00 - '+k+'.59' + tmp_separatore + OBJ_DAY.AR_vis[k] + tmp_separatore + OBJ_DAY.AR_hits[k] + tmp_separatore + OBJ_DAY.AR_ppv[k]+ tmp_separatore  + OBJ_DAY.AR_nevis[k] +"\n";
            }
        }else{
            print_strEXP = GL.R('No_data');
        }
    }

    if(JSID==OBJ_summary.swf_COLGRAPH_id_30days){//stampo export per last 30 gg
        var month_shortname = '' ;
        if(G_MULTIMONT.AR_DISPLAYED_MONTHCODE.length < 1 ) return '';
        var MONTH_TO_DISPLAY = 0 ;
        var print_strEXP_M = '';
        if(G_MULTIMONT.AR_DISPLAYED_MONTHCODE.length>0){
            for(var k_monthcode in  G_MULTIMONT.AR_DISPLAYED_MONTHCODE ){
                MONTH_TO_DISPLAY = G_MULTIMONT.AR_DISPLAYED_MONTHCODE[k_monthcode];
                if(!OBJ_SITE.monthly_stats[MONTH_TO_DISPLAY]) return ;
                OBJ_MONTH = OBJ_SITE.monthly_stats[MONTH_TO_DISPLAY];
                month_shortname =  GL.R(GLOBAL_AR_MONTH[OBJ_MONTH.AR_date['month']]);
                print_strEXP_M = '';
                for(var k in OBJ_MONTH.AR_vis){
                    if(parseInt(k) < OBJ_MONTH.AR_date['ndayMonth']){
                        print_strEXP_M += (parseInt(k)+1)+' '+month_shortname + tmp_separatore + OBJ_MONTH.AR_vis[k] + tmp_separatore + OBJ_MONTH.AR_hits[k] + tmp_separatore + OBJ_MONTH.AR_ppv[k]+ tmp_separatore  + OBJ_MONTH.AR_nevis[k] +"\n";
                    }
                }
                print_strEXP= print_strEXP_M + print_strEXP;
            }
            print_strEXP = GL.R('giorno') + tmp_separatore +  GL.R('visitatori') + tmp_separatore + GL.R('pagine') + tmp_separatore + 'ppv' + tmp_separatore + GL.R('newvis') +"\n" + print_strEXP;
        }else{
            print_strEXP = GL.R('No_data');
        }
    }
    return print_strEXP;
}


function ftrova(){
    var offset = $("#imgCCOUNTER").offset();
    $('#divTip').offset({
        top: (offset.top+$("#imgCCOUNTER").attr("height")),
        left: offset.left
    });
    $('#divTip').fadeIn(1000, function() {
        setTimeout("$('#divTip').fadeOut(1000);", 10000);
    });
}

function aggiornaDato_class() {
    try{
        this.ARcelle = new Array();//lista dei campi che vengono aggiornati
        this.sockURL = 'http://www.histats.com/viewstats/AJAX_GET_SUMMARY.php';
        this.sockAR_param = new Array();
        this.AR_UNSERIALIZED = new Array();       
        
        this.sockVAR = '';
        this.REPEAT_upd = 0;
        this.HH_last = 0;
        
        this.BTrefresh = 1;
        this.CALLrun = 0;

        this.sockAR_init = function(){
            this.sockAR_param['idcall'] = 0;
            this.sockAR_param['thcl'] = 0;
            this.sockAR_param['sid'] = PTR_MOD.ids+'';
        }
        
        this.f_CREATE_paramCall = function(){
            this.sockVAR = '';
            var tmpPass = '';
            var tmpAND = '';
            for(var k in this.sockAR_param){
                if(this.sockAR_param[k].length>0){
                    tmpPass += tmpAND+'AR_REQ['+k+']='+this.sockAR_param[k];
                    tmpAND = '&';
                }
            }
            this.sockVAR = tmpPass;
        }
        
        this.f_CALLsock  = function() {
            
            if(this.BTrefresh==0){
                this.CALLrun=0;
                return;
            } 
            //if(this.timerCHIAMATA>0) return
            
            

            this.sockAR_param['CC'] = OBJ_summary.sockTOKEN+'';
            this.sockAR_param['idcall']++;
            var send_idcall = this.sockAR_param['idcall'] ;
            this.sockAR_param['thcl'] = $('#UPD_tot_h').attr('value');
            this.f_CREATE_paramCall();
            //alert(this.sockVAR);
            this.CALLrun = 0;
            $.post(this.sockURL,this.sockVAR+'&dbg=1',
                function(data){
                    PTR_MOD.CLASSupd.f_REPLYsock(data,send_idcall);
                });
        }
        
        this.f_REPLYsock = function(data,rcv_idcall) {
            if(this.BTrefresh==0){
                return;
            } 
            if(rcv_idcall!=this.sockAR_param['idcall']) return;
            //alert(data);
            var statoRisposta = this.f_UNSRLZsock(data);
            if(statoRisposta<90){
                this.f_displayERROR(statoRisposta);
                return;
            }
            this.f_UPD_sumDATA();
        }
        
        this.f_UNSRLZsock = function(data){
            if(data.indexOf('error')==0){
                var errore = data.substring((data.indexOf('=')+1),(data.length-1));
                return (parseInt(errore));
            }
            tmp_TOUNS = data;
            //to_U = tmp_TOUNS;
            
            this.AR_UNSERIALIZED = new Array();
            this.AR_UNSERIALIZED = json_parse(data);
            
            /*unserialize_VIGO_a();
            this.AR_UNSERIALIZED = new Array();
            if(unserialize_VIGO_tmp_OKFUNCT==1){
                this.AR_UNSERIALIZED = final;
            }*/
        }
        
        this.f_displayERROR = function(errore){
            /*var PRT_conten = '';
            var txtERR = '';
            if(errore==16) txtERR = 'session expired - refresh this page';
            else if(errore==15) txtERR = 'authentication error';
            PRT_conten = '<br><br><br><div align="center"><img border="0" src="'+GLOBALS['FOLDER_img']+'warning.gif"><br><font class="text16_blue">'+txtERR+'</font></div>';
            $('#histats_refererstats_part1').html(PRT_conten);*/
        }

        this.f_inizializza = function(){
            this.ARcelle['tot_h'] = 0;
            this.ARcelle['tot_v'] = 0;
            this.ARcelle['tod_h'] = 0;
            this.ARcelle['tod_v'] = 0;
            this.ARcelle['tod_nv'] = 0;
            this.ARcelle['cur_online'] = 0;
            
            for(var t in this.ARcelle){
                $('#divCNT_updDATA').append('<div id="div_'+t+'" class="boxUPDdata"></div>');
            }
        }
        
        this.f_UPD_sumDATA = function(){
            this.f_inizializza();

            if(this.AR_UNSERIALIZED['livearray']){
                
                if(this.AR_UNSERIALIZED['livearray']['cur_time']){
                    var tmpDataCur = new Date(parseInt(this.AR_UNSERIALIZED['livearray']['cur_time'])*1000);
                    var HHcurr = tmpDataCur.getHours();
                    
                    if(HHcurr==0 && this.HH_last==23){//salto del giorno
                        this.REPEAT_upd = 70;
                        return;
                    }
                }
                
                this.HH_last = HHcurr;
                
                if(this.AR_UNSERIALIZED['livearray']['livesummary']){
                    //###___se hits sono diverse allora stampo altrimenti mando cmq la chiamata in delay
                    /*$(this).animate(
                    {
                        top: (position.top-10)+'px', 
                        left: (position.left+10)+'px', 
                        opacity: 0
                    }, 
                    1000 
                    );*/
                    if(parseInt(this.AR_UNSERIALIZED['livearray']['livesummary']['tot_h'])>parseInt($('#UPD_tot_h').attr('value'))){
                        var position;
                        var tmpVal = 0;
                        var variazione = 0;
                        var segno = '';
                        for(var t in this.ARcelle){
                            position = $('#UPD_'+t).position();
                            //alert(position.top+' - '+position.left);
                            $('#div_'+t).css("top",(position.top));
                            $('#div_'+t).css("left",(position.left-40));
                            
                            variazione = parseInt(this.AR_UNSERIALIZED['livearray']['livesummary'][t])-parseInt($('#UPD_'+t).attr('value'));
                            segno = '+';
                            $('#div_'+t).css('color','#00AA00');
                            if(variazione<0){
                                $('#div_'+t).css('color','#CC0000');
                                segno = '';
                            }
                            
                            $('#div_'+t).text(segno+GL.fn(variazione));
                            $('#div_'+t).fadeIn(400, function() {
                                $(this).fadeOut(1500);
                            });
                            
                            tmpVal = GL.fn(parseInt(this.AR_UNSERIALIZED['livearray']['livesummary'][t]));
                            $('#UPD_'+t).text(tmpVal);
                            $('#UPD_'+t).attr('value',this.AR_UNSERIALIZED['livearray']['livesummary'][t]);
                        }
                        
                        //#####___aggiorno dati grafico flash
                        OBJ_SITE.lht = parseInt(this.AR_UNSERIALIZED['livearray']['cur_time']);
                        
                        var DAY_TO_DISPLAY = G_CAL_HANDLER.AR_CALENDAR[PTR_MOD.ID_DATECAL].dateAR['day'];
                        if(this.AR_UNSERIALIZED['livearray']['livesummary']['hourly']){
                            for(var hour in this.AR_UNSERIALIZED['livearray']['livesummary']['hourly']){
                                this.UPD_dataHOURLY(parseInt(hour),DAY_TO_DISPLAY,this.AR_UNSERIALIZED['livearray']['livesummary']['hourly'][hour]);
                            }
                        }

                        var OBJ_MOD = OBJ_STATSsheet.ARmodules[PTR_MOD.nmod];
                        
                        OBJ_DAY.TOTAL_HITS = parseInt(this.AR_UNSERIALIZED['livearray']['livesummary']['tod_h']);
                        OBJ_DAY.TOTAL_VIS =  parseInt(this.AR_UNSERIALIZED['livearray']['livesummary']['tod_v']);
                        OBJ_DAY.TOTAL_nVIS = parseInt(this.AR_UNSERIALIZED['livearray']['livesummary']['tod_nv']);            
                        OBJ_DAY.onlineVIS=  parseInt(this.AR_UNSERIALIZED['livearray']['livesummary']['cur_online']);
                        
                        OBJ_MOD.f_dailystats_strhourly(DAY_TO_DISPLAY);
                        OBJ_MOD.f_dailystats_build_addional_stats(DAY_TO_DISPLAY);
                        if(OBJ_prev) OBJ_prev.build_PREV();
                        OBJ_MOD.f_print_forecast___PORTION();
                        this.UPD_forecast();
                        
                        this.UPD_dataSWF_day(DAY_TO_DISPLAY,0);
                                               
                        if(G_MULTIMONT.tmp_col1){
                            var ArSplit = new Array();
                            ArSplit['col1'] = G_MULTIMONT.tmp_col1.split('#');
                            ArSplit['col2'] = G_MULTIMONT.tmp_col2.split('#');
                            ArSplit['col3'] = G_MULTIMONT.tmp_col3.split('#');
                            
                            ArSplit['col1'][(ArSplit['col1'].length-1)] = this.AR_UNSERIALIZED['livearray']['livesummary']['tod_nv'];
                            ArSplit['col2'][(ArSplit['col2'].length-1)] = this.AR_UNSERIALIZED['livearray']['livesummary']['tod_v'];
                            ArSplit['col3'][(ArSplit['col3'].length-1)] = this.AR_UNSERIALIZED['livearray']['livesummary']['tod_h'];
                            
                            G_MULTIMONT.tmp_col1 = ArSplit['col1'].join('#');
                            G_MULTIMONT.tmp_col2 = ArSplit['col2'].join('#');
                            G_MULTIMONT.tmp_col3 = ArSplit['col3'].join('#');
                            
                            OBJ_MOD.f_print_forecast_day_ONmultimonth(G_MULTIMONT);
                            
                            this.UPD_dataSWF_30gg();
                        }
                    }
                }
            }
            
            this.REPEAT_upd++;
            
            //$('#dbgCICLI').text(this.REPEAT_upd);

            if(this.REPEAT_upd<=20) this.timerCHIAMATA = 10000;
            else if(this.REPEAT_upd>20) this.timerCHIAMATA = 17000;
            else if(this.REPEAT_upd>40) this.timerCHIAMATA = 30000;

            if(this.REPEAT_upd<60){
                this.CALLrun = 1;
                setTimeout("PTR_MOD.CLASSupd.f_CALLsock()", this.timerCHIAMATA);
            }else{
                this.BTrefresh=1;
                this.f_BTplayPause();
            }
        }
        
        // update hourly data from livesummary
        this.UPD_dataHOURLY = function(Hour,day,ARdata){
            var OBJ_SITE = OBJ_SITEs[PTR_MOD.ids];
            if(!OBJ_SITE.daily_stats[day]) return ;
            var OBJ_DAY = OBJ_SITE.daily_stats[day];

            OBJ_DAY.AR_vis[Hour] = parseInt(ARdata['v']);
            OBJ_DAY.AR_hits[Hour] = parseInt(ARdata['h']);
            OBJ_DAY.AR_nevis[Hour] = parseInt(ARdata['nv']);
            OBJ_DAY.AR_tunb[Hour] = 0;
            OBJ_DAY.AR_unb[Hour] = 0;
            OBJ_DAY.AR_ppv[Hour] = 0;
            if(parseInt(ARdata['v'])>0){
                OBJ_DAY.AR_tunb[Hour] = parseInt((parseInt(ARdata['v']) - parseInt(ARdata['tub'])) / parseInt(ARdata['v'])*1000)/10;
                OBJ_DAY.AR_unb[Hour] = parseInt((parseInt(ARdata['v']) - parseInt(ARdata['ub'])) / parseInt(ARdata['v'])*1000)/10;
                OBJ_DAY.AR_ppv[Hour] = parseInt(parseInt(ARdata['h']) / parseInt(ARdata['v'])*100)/100;
            }
        }
          
        this.UPD_dataSWF_day = function(day,bool_forecast){
            var OBJ_SITE = OBJ_SITEs[PTR_MOD.ids];
            var OBJ_MOD = OBJ_STATSsheet.ARmodules[PTR_MOD.nmod];
            var DAY_TO_DISPLAY = G_CAL_HANDLER.AR_CALENDAR[PTR_MOD.ID_DATECAL].dateAR['day'];
            if(day == 0 ) day = DAY_TO_DISPLAY; // default
            if(bool_forecast!=true) bool_forecast=false;
            var OBJ_DAY = OBJ_SITE.daily_stats[DAY_TO_DISPLAY];

            OBJ_MOD.ARSWF_variables['var_val_col1'] = OBJ_DAY.AR_nevis.join('#');
            OBJ_MOD.ARSWF_variables['var_val_col2'] = OBJ_DAY.AR_vis.join('#');
            OBJ_MOD.ARSWF_variables['var_val_col3'] = OBJ_DAY.AR_hits.join('#');
           
            OBJ_MOD.ARSWF_variables['rldData'] = '1';
        }

        this.UPD_dataSWF_30gg = function(){
            G_MULTIMONT.ARSWF_variables['var_val_col1'] = G_MULTIMONT.tmp_col1;
            G_MULTIMONT.ARSWF_variables['var_val_col2'] = G_MULTIMONT.tmp_col2;
            G_MULTIMONT.ARSWF_variables['var_val_col3'] = G_MULTIMONT.tmp_col3;
            G_MULTIMONT.ARSWF_variables['rldData'] = '1';
        }
        
        this.UPD_forecast = function (){
            //PTR_MOD.f_append_day_to_hismonth(OBJ_DAY);
            
            var tx_fore_h = '';
            var tx_fore_d = '';

            var FOR_h7 = '';
            var FOR_h14 = '';
            var FOR_d7 = '';
            var FOR_d14 = '';
    
            var PRT_forHH = new Array();
            PRT_forHH[7] = '-';
            PRT_forHH[14] = '-';
            var PRT_forGG = new Array();
            PRT_forGG[7] = '-';
            PRT_forGG[14] = '-';

            var tx_fore_valueh = 0;
            var tx_fore_valued = 0;
            var tx_plus = '';
            var HTML_forecastTABLE = '' ; 
            if(OBJ_prev.TOTAL_VIS>0){
                tx_fore_valued = OBJ_prev.TOTAL_VIS;
            }
            if(OBJ_prev.AR_vis[OBJ_prev.cur_h]){
                tx_fore_valueh = OBJ_prev.AR_vis[OBJ_prev.cur_h];
            }
            var tmp_font_color = '';
            if(OBJ_prev.bool_troppopresto == 1 ){
                HTML_forecastTABLE = '<table border="0" width="700" cellspacing="0" cellpadding="0" height="40" background="'+GLOBALS['FOLDER_img']+'bar_70040.png"><tr>\
                                <td width="675" align="right" style="padding-right:10px;"><font class="text16_Dblue">'+GL.R('no_forecast_available')+'</font></td>\
                                <td width="25"><img border="0" src="'+GLOBALS['FOLDER_img']+'details_icon2.gif"></td>\
                            </tr></table>' ;
            }else{
                if(OBJ_prev.AR_Compared){
                    for(k in OBJ_prev.AR_Compared){
                        if(OBJ_prev.AR_Compared[k]['h']){
                            tmp_font_color = 'FF0000';
                            tx_plus = '';
                            if(OBJ_prev.AR_Compared[k]['h'] > 0){
                                tx_plus = ' + ';
                                tmp_font_color = '00aa00';
                            }
                            PRT_forHH[k] = '<font color="#'+tmp_font_color+'">'+tx_plus+GL.fn(OBJ_prev.AR_Compared[k]['h'])+'%</font>';
                            tx_fore_h+=' <tr height="20">\
                                                <td width="20">&nbsp;</td>\
                                                <td width="80"><font class="text16"><font color="#'+tmp_font_color+'">'+tx_plus+GL.fn(OBJ_prev.AR_Compared[k]['h'])+'%</font></font></td>\
                                                <td width="190"><font class="text11_Lgrey">'+GL.R('rispetto_a')+' '+k+' '+GL.R('giorni_fa_stessa_ora')+'</font></td>\
                                        </tr>';
                        }
                        if(OBJ_prev.AR_Compared[k]['d']){
                            tmp_font_color = 'FF0000';
                            tx_plus = '';
                            if(OBJ_prev.AR_Compared[k]['d'] > 0){
                                tx_plus = ' + ';
                                tmp_font_color = '00aa00';
                            }
                    
                            PRT_forGG[k] = '<font color="#'+tmp_font_color+'">'+tx_plus+GL.fn(OBJ_prev.AR_Compared[k]['d'])+'%</font>';
                            tx_fore_d+='  <tr height="20">\
                                                <td width="20"></td>\
                                                <td width="80"><font class="text16"><font color="#'+tmp_font_color+'">'+tx_plus+GL.fn(OBJ_prev.AR_Compared[k]['d'])+'%</font></font></td>\
                                                <td width="190"><font class="text11_Lgrey">'+GL.R('rispetto_a')+' '+k+' '+GL.R('giorni_fa')+'</font></td>\
                                        </tr>';
                        }
                    }
            
                    HTML_forecastTABLE = '<table border="0" width="700" cellspacing="1" cellpadding="0">\
                                    <tr>\
                                        <td width="40"></td>\
                                        <td align="center" style="-webkit-border-top-left-radius: 8px;-moz-border-radius-topleft: 8px;border-top-left-radius: 8px;padding:2px; border-right:1px solid #CCCCCC; border-bottom:1px solid #CCCCCC; " width="120" bgcolor="#E4E4E4"><font class="text16_blue">'+GL.R('previsioni')+'</font></td>\
                                        <td width="180" align="center" style="padding:2px; border-right:1px solid #CCCCCC; border-bottom:1px solid #CCCCCC; " bgcolor="#E4E4E4"><font class="text11_Dblue">'+GL.R('rispetto_a')+' 7 '+GL.R('giorni_fa')+'</font></td>\
                                        <td width="180" align="center" style="padding:2px; border-right:1px solid #CCCCCC; border-bottom:1px solid #CCCCCC; " bgcolor="#E4E4E4"><font class="text11_Dblue">'+GL.R('rispetto_a')+' 14 '+GL.R('giorni_fa')+'</font></td>\
                                        <td width="180" align="center" style="-webkit-border-top-right-radius: 8px;-moz-border-radius-topright: 8px;border-top-right-radius: 8px;padding:2px; border-bottom:1px solid #CCCCCC; " bgcolor="#E4E4E4"><font class="text11_Dblue">'+GL.R('visitatori')+'</font></td>\
                                    </tr>\
                                    <tr>\
                                        <td width="40"></td>\
                                        <td height="25" width="120" align="center" style="padding:2px; border-right:1px solid #CCCCCC; border-bottom:1px solid #CCCCCC; " bgcolor="#E4E4E4"><img src="'+GLOBALS['FOLDER_img']+'087.png" border="0" height="10" width="10"><font class="text11_grey"> '+GL.R('ora_corrente')+'</font></td>\
                                        <td width="180" height="25" align="center" style="border-right: 1px solid #CCCCCC; border-bottom: 1px solid #CCCCCC" bgcolor="#F3F3F3" ><font class="text16"><font color="#339933">'+PRT_forHH[7]+'</font></font></td>\
                                        <td width="180" height="25" align="center" style="border-right: 1px solid #CCCCCC; border-bottom: 1px solid #CCCCCC" bgcolor="#F3F3F3" ><font class="text16"><font color="#339933">'+PRT_forHH[14]+'</font></font></td>\
                                        <td width="180" height="25" align="center" style="border-bottom: 1px solid #CCCCCC" bgcolor="#F3F3F3" ><font class="text16">'+GL.fn(tx_fore_valueh)+'</b></font></td>\
                                    </tr>\
                                    <tr>\
                                        <td width="40"></td>\
                                        <td height="25" width="120" align="center" style="-webkit-border-bottom-left-radius: 8px;-moz-border-radius-bottomleft: 8px;border-bottom-left-radius: 8px;padding:2px; border-right:1px solid #CCCCCC; " bgcolor="#E4E4E4" ><img src="'+GLOBALS['FOLDER_img']+'025.png" border="0" height="10" width="10"><font class="text11_grey"> '+GL.R('giorno_corrente')+'</font></td>\
                                        <td width="180" height="25" align="center" style="border-right: 1px solid #CCCCCC" bgcolor="#F3F3F3"><font class="text16"><font color="#CC0000">'+PRT_forGG[7]+'</font></font></td>\
                                        <td width="180" height="25" align="center" style="border-right: 1px solid #CCCCCC" bgcolor="#F3F3F3"><font class="text16"><font color="#339933">'+PRT_forGG[14]+'</font></font></td>\
                                        <td width="180" height="25" align="center" style="-webkit-border-bottom-right-radius: 8px;-moz-border-radius-bottomright: 8px;border-bottom-right-radius: 8px;"bgcolor="#F3F3F3"><font class="text16">'+GL.fn(tx_fore_valued)+'</b></font></td>\
                                    </tr>\
                                </table>';

                }
            }
            
            $('#tbForecast').html(HTML_forecastTABLE)
        }
        
        this.f_BTplayPause = function(){
            
            if(this.BTrefresh == 1){
                this.BTrefresh = 0;
                $('#BTplayPause').html('<img src="'+GLOBALS['FOLDER_img']+'playl30b.png" border="0">');
            }else{
                $('#BTplayPause').html('<img src="'+GLOBALS['FOLDER_img']+'pausel30b.png" border="0">');
                this.BTrefresh = 1;
                
                if(this.REPEAT_upd>=60) this.REPEAT_upd = 0;
                if(this.CALLrun==1) return;
                this.f_CALLsock();
            }
        }


    } catch(e){
        alert("err loading javascript UPD,    try refreshing browser cache \n "  + e.message + "\n ");
    }
}


if(!JSCACHE) JSCACHE = [] ;
JSCACHE.push(['summarystats.class.js',3]);
