
function histats_statsmodule_class() {
    try {
        this.BOOL_MAIN_DIV_CREATED = false; // if main div has been created 
        this.v = 0 ; //idvista
        this.nmod = 0 ; //module number (unique id inside sheet)

        this.FOB_OBJ = null ; // flash object

        this.AR_FOB = new Array();
 
        this.ids = 0 ; 

        this.stats_pagetype = 'summary' ;

        this.ID_DATECAL = 0 ; //main datecal id
     

        this.OBJ_ARdatecal = null ; //additional datecal object
        this.OBJ_infovis = new Array(); // contain infovis object
        this.OBJ_GEOLOC =null; // contain geoloc object



        this.ids = 0 ;

        this.ARSWF_variables = new Array();
        
        this.HTML_DIVCONTENT = Array();
        this.HTML_DIV_TEMPLATE_COPYCAT = ''; // div name to duplicate
 
    } catch(e){
        alert("err loading javascript ,    try refreshing browser cache \n "  + e.message + "\n ");
    }
	
} // end

// histats_stats_divmod_12345678900
histats_statsmodule_class.prototype.f_print_HTMLDIV  = function(){
    var HTMLmoduleutils =document.getElementById('div_module_utils').innerHTML;
    HTMLmoduleutils= HTMLmoduleutils.split("12345678900").join(this.nmod);
    document.getElementById('histats_stats_divmodMAIN_' + this.nmod  ).innerHTML = HTMLmoduleutils + this.HTML_DIVCONTENT;
//alert(document.getElementById('histats_stats_divmodMAIN_' + this.nmod  ).innerHTML);
}

// duplicate template div 
histats_statsmodule_class.prototype.f_print_HTMLDIV_copycat  = function(){
    if(this.HTML_DIV_TEMPLATE_COPYCAT.length < 1 ) return ;
    var HTMLmoduleutils =document.getElementById('div_module_utils').innerHTML;
    HTMLmoduleutils= HTMLmoduleutils.split("12345678900").join(this.nmod);
    
    var tmp_divcontent = document.getElementById(this.HTML_DIV_TEMPLATE_COPYCAT).innerHTML;
    tmp_divcontent= tmp_divcontent.split("12345678900").join(this.nmod);
     
    document.getElementById('histats_stats_divmodMAIN_' + this.nmod ).innerHTML = HTMLmoduleutils + tmp_divcontent;
//alert(document.getElementById('histats_stats_divmodMAIN_' + this.nmod  ).innerHTML);
}


histats_statsmodule_class.prototype.divshow  = function(){
    document.getElementById( "histats_stats_divmodMAIN_"+this.nmod).style.display = 'block';
}

histats_statsmodule_class.prototype.divhide  = function(){
    document.getElementById( "histats_stats_divmodMAIN_"+this.nmod).style.display = 'none';
}

/*
 *  create flash object in this module 
 */
histats_statsmodule_class.prototype.create_FOB  = function(fob_divname){
    this.FOB_OBJ = new SWFobj_class();
    this.FOB_OBJ.nmod = this.nmod;
 
    this.FOB_OBJ.nome_DIV_CONTAINER = fob_divname + this.nmod;
    this.FOB_OBJ.LOAD_FOB();
}

/*
 *  create flash object in this module
 */
histats_statsmodule_class.prototype.reload_FOB  = function(){
    //this.FOB_OBJ = new SWFobj_class();
    this.FOB_OBJ.nmod = this.nmod;
    this.FOB_OBJ.BOOL_fobcreated = false;

    this.FOB_OBJ.LOAD_FOB();
}

/*
 *  build current datecal object 
 */
histats_statsmodule_class.prototype.build_CURRENTCAL  = function(){


    this.ID_DATECAL  = G_CAL_HANDLER.crate_cal_obj();
    G_CAL_HANDLER.AR_CALENDAR[this.ID_DATECAL].build_OVER_IDS(this.ids);

  
    G_CAL_HANDLER.AR_CALENDAR[this.ID_DATECAL].div_datecal = 'div_moduleDATECAL_'+this.nmod;
    G_CAL_HANDLER.AR_CALENDAR[this.ID_DATECAL].nmod = this.nmod;


//G_CAL_HANDLER.AR_CALENDAR[this.ID_DATECAL].build_html_portions();
//G_CAL_HANDLER.AR_CALENDAR[this.ID_DATECAL].print_toDIV();

}


histats_statsmodule_class.prototype.PRINT_MAIN  = function(){
    if(this.BOOL_MAIN_DIV_CREATED ) return ;
    var divcontainer = document.getElementById("HISTATS_statsmodule_container");

    parentDiv = document.createElement("div");
    parentDiv.setAttribute("id", "histats_stats_divmodMAIN_"+this.nmod);
    parentDiv.setAttribute("name", "histats_stats_divmodMAIN_"+this.nmod);
    divcontainer.appendChild(parentDiv);
    this.divshow();
    this.BOOL_MAIN_DIV_CREATED =true ;
//this.f_print_HTMLDIV();
}

histats_statsmodule_class.prototype.SWF_send_VAR  = function(varname) {
    //alert(varname);
 
    if(!this.ARSWF_variables){

        return "";
    }
    if(!this.ARSWF_variables[varname]) return "";

    //alert(varname + ' = ' + this.ARSWF_variables[varname]);
    var tmpreturn = this.ARSWF_variables[varname];
    return tmpreturn;
}



/*
BUILD CALENDARs BASED ON CAL OBJECT
*/
histats_statsmodule_class.prototype.BUILD_CALENDAR_day  = function(){
    if(!this.OBJ_MAINdatecal) return ;
    var str_DAILYCAL = f_BUILD_DATECALENDAR_daily(this.OBJ_CURRENTdatecal,this.nmod);
    var new_textselect = f_insert_text_in_text(document.getElementById('div_dhtmlMENU_date_'+this.nmod).innerHTML,'<!--START SELECT FIELD -->','<!--END SELECT FIELD -->',str_DAILYCAL);
    document.getElementById('div_dhtmlMENU_date_'+this.nmod).innerHTML = new_textselect;
}
/*
BUILD CALENDARs BASED ON CAL OBJECT
*/
histats_statsmodule_class.prototype.BUILD_CALENDAR_month = function(){
    if(!this.OBJ_MAINdatecal) return ;
    var str_DAILYCAL = f_BUILD_DATECALENDAR_monthly(this.OBJ_CURRENTdatecal,this.nmod);
}


  if(!JSCACHE) JSCACHE = [] ;
JSCACHE.push(['statsmodule.class.js',1]);
