
var GLOBAL_sx = 0;
var GLOBAL_sy = 0;
var GLOBAL_tipo_mappa = 0;
var GLOBAL_geotrk_swf = '';
var randomnumber=Math.floor(Math.random()*110000);
var GLOBAL_var_country = '';

var GLOBAL_geotrk_l = '<embed wmode="transparent" play=false name="mainMovie_l" src="http://www.histats.com/swf/geo_trk.swf" quality=High bgcolor=#ffffff  width=700 height=384 type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">';
var GLOBAL_geotrk_s = '<embed wmode="transparent" play=false name="mainMovie_s" id="mainMovie_s" src="http://www.histats.com/swf/geo_trk_s.swf" quality=High bgcolor=#ffffff  width=700 height=384 type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">';


var GLOBAL_swf_caricato = 0;
var GLOBAL_tipo = 1;

var arr_riga = new Array();
var arr_riga_Unk = new Array();
var GLOBAL_intestazione_Tab;
var GLOBAL_lista_bandierine;
var GLOBAL_lista_bandierine_generato;
var GLOBAL_view_city = '';

var var_pass_pie_geo = '';


//raccolgo variabili per passare a flash
var tmp_dimensioni_cerchio = 50;

var separatore_p = '';
separatore_p = '<p>';


var masssimo_valore_city = 0;
chiamaMetodo


if(var_0city != 1 ){

    for (tmp_chiave in _cN_MAXhK){
        if(_cN_MAXhK[tmp_chiave] > masssimo_valore_city) masssimo_valore_city = _cN_MAXhK[tmp_chiave];
    }
    for (tmp_chiave in _cN_MAXhU){
        if(_cN_MAXhU[tmp_chiave] > masssimo_valore_city) masssimo_valore_city = _cN_MAXhU[tmp_chiave];
    }
}

if(masssimo_valore_city < 1 ) masssimo_valore_city = 1;

if(var_0city != 1 ){
    for ( var a = 0;a < _c.length;a++ ){
        //1548##14.23##40.81##60##Napoli##IT##35<p>
        tmp_dimensioni_cerchio = Math.ceil(((_c[ a ] /masssimo_valore_city) *50) + 50);
        if(tmp_dimensioni_cerchio > 100) tmp_dimensioni_cerchio= 100;
        if(tmp_dimensioni_cerchio < 50) tmp_dimensioni_cerchio= 50;

        GLOBAL_var_country = GLOBAL_var_country + separatore_p + a + '##' + _clo[ a ] + '##' + _cla[ a ] + '##' + tmp_dimensioni_cerchio + '##' + _ccit[ a ] + '##' + _c2c[ a ] + '##' + _c[ a ] ;
        separatore_p = '<p>';
    }
    
}
//---------------------------LISTA BANDIERE-------------------------------------------------------------------
if(var_0city != 1){
    GLOBAL_lista_bandierine_generato = '<div align="center"><table border="0" width="630" id="table1"><tr><td align="center"><a href="javascript:f_geo_lista(2,1);" class="txt_13_dg"><b>' + lingua_lista_completa_city + '</b></a><hr width="500" color="#E9E9E9" size="1"><font class="txt_12_db">' + lingua_lista_per_country + '</font><br><br>';
    for ( country in _cN_2cN ) {
        tmp_sigla = country.toLowerCase();
        GLOBAL_lista_bandierine_generato = GLOBAL_lista_bandierine_generato + '<a href="javascript:f_geo_lista(2,\'' + tmp_sigla + '\');"><img onmouseover="doTooltip_testo(event,\'' + _cN_2cN[ country ] + '\')" onmouseout="hideTip()" border="0" src="'+AR_GLOB['dom_baseIMG']+'/flags/' + tmp_sigla + '.gif" width="16" height="11"></a> ';
    }
    GLOBAL_lista_bandierine_generato = GLOBAL_lista_bandierine_generato + '</div></td></tr></table></div>';
}
//------fine-----------------LISTA BANDIERE-------------------------------------------------------------------

//--------------------------GRAFICO TORTA---------------------
if(var_0country != 1 ){

    var appo_count = 0;
    var var_val_altri_country = 0;
    for ( country in _N ) {
        if (appo_count < 6){
            var_pass_pie_geo = var_pass_pie_geo + 'valvar1_' + appo_count + '=' + _N[country] + '&namevar1_' + appo_count + '=' + country + '&';
        }else{
        var_val_altri_country = var_val_altri_country + parseInt(_N[country]);
    }
    appo_count ++;
}



if (var_val_altri_country >0){
    var_pass_pie_geo = var_pass_pie_geo + 'valvar1_5=' + var_val_altri_country + '&namevar1_5=other&';
    appo_count=6;
}

var_pass_pie_geo = var_pass_pie_geo + 'nval=' + appo_count + '&titolo1=' + lingua_country;
var varoutput_grafico_torta ='<div align="center"><embed wmode="transparent" src="http://www.histats.com/swf/graf_torta.swf?'+var_pass_pie_geo+'" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" name="obj9" width="352" height="180" quality="High"></div>';
document.getElementById('geo_piechart').innerHTML = varoutput_grafico_torta;
}
//---fine-------------------GRAFICO TORTA---------------------

//--------------------------RESET STATISTICHE GEO-------------------
var varoutput_reset_stats = '<div align="center"><table border="0" width="350" id="table4" cellspacing="0" cellpadding="0"><tr>'+
'<td align="center" height="30" width="40"><a href="'+tmp_site_histatsdomain+'/viewstats/?idsc='+idsc+'&vp_cr=533&cnt=p_cnf"><img border="0" src="http://www.histats.com/images/stock-delete.jpg" width="23" height="25"></a></td>'+
'<td align="left" height="30" width="293"><a href="'+tmp_site_histatsdomain+'/viewstats/?idsc='+idsc+'&vp_cr=533&cnt=p_cnf" class="txt_12_db">'+lang['reset_city_database']+'</a></td></tr>'+
'<tr><td align="center" height="20" width="40">&nbsp;</td>'+
'<td align="left" height="20" width="293">&nbsp;&nbsp;&nbsp;&nbsp; <font class="txt_10_dg">'+lang['last_reset']+':</font>	<font class="txt_13_dg"><b>'+last_reset_city+'</b></font></td></tr>'+
'<tr><td align="center" height="30" width="40"><a href="'+tmp_site_histatsdomain+'/viewstats/?idsc='+idsc+'&vp_cr=546&cnt=p_cnf"><img border="0" src="http://www.histats.com/images/stock-delete.jpg" width="23" height="25"></a></td>'+
'<td align="left" height="30" width="293"><a href="'+tmp_site_histatsdomain+'/viewstats/?idsc='+idsc+'&vp_cr=546&cnt=p_cnf" class="txt_12_db">'+lang['reset_country_database']+'</a></td></tr>'+
'<tr><td align="center" height="20" width="40">&nbsp;</td>'+
'<td align="left" height="20" width="293">&nbsp;&nbsp;&nbsp;&nbsp; <font class="txt_10_dg">'+lang['last_reset']+':</font>	<font class="txt_13_dg"><b>'+last_reset_country+'</b></font></td></tr>'+
'</table><br><table border="0" width="350" id="table4" cellspacing="0" cellpadding="0"><tr><td><font class="txt_10_dg">'+lang['geo_frase1']+'</font><br><font class="txt_10_dg">'+lang['geo_frase2']+'</font></td></tr></table>'+
'</tr></table></div>';
document.getElementById('geo_reset').innerHTML = varoutput_reset_stats;
//---fine-------------------RESET STATISTICHE GEO-------------------



function preload_immagini() {
   /* try {

        //immagini background
        div_gen_top = new Image();
        div_gen_top.src = "http://www.histats.com/GEO_test/images/top.jpg";
        div_gen_mid = new Image();
        div_gen_mid.src = "http://www.histats.com/GEO_test/images/mid.jpg";
        div_gen_bott = new Image();
        div_gen_bott.src = "http://www.histats.com/GEO_test/images/bott.jpg";

        div_tag_on = new Image();
        div_tag_on.src = "http://www.histats.com/GEO_test/images/etichetta_small_on.jpg";
        
        div_tag_off = new Image();
        div_tag_off.src = "http://www.histats.com/GEO_test/images/etichetta_small_off.jpg";
        div_tag_over = new Image();
        div_tag_over.src = "http://www.histats.com/GEO_test/images/etichetta_small_over.jpg";
        div_tag_vuoto = new Image();
        div_tag_vuoto.src = "http://www.histats.com/GEO_test/images/etichetta_line_vuoto.jpg";

        //immagini gif
        gif_dettagli = new Image();
        gif_dettagli.src = "http://www.histats.com/GEO_test/images/gif_dett.gif";


    }

    catch ( e ) {
        alert( "ERRORE: preload_immagini() - \n error: " + e.message );
    }*/
}


function f_tab_over( n_tab, evento ) {
    try {
        var tmp_nome_tab = '';

        if ( n_tab != GLOBAL_tipo ) {
            switch ( n_tab ) {
                case 1:
                tmp_nome_tab = 'tab_country';
                break;
                case 2:
                tmp_nome_tab = 'tab_city';
                break;
            }

            if ( evento == 1 ) {
                BgEtichetta_over = "url("+AR_GLOB['dom_baseIMG']+"/etichetta_small_over.jpg)";
                document.getElementById( tmp_nome_tab ).style.color = "fffff1";
                document.getElementById( tmp_nome_tab ).style.backgroundImage = BgEtichetta_over;

            }

            else if ( evento == 2 ) {
                BgEtichetta_off = "url("+AR_GLOB['dom_baseIMG']+"/etichetta_small_off.jpg)";
                document.getElementById( tmp_nome_tab ).style.color = "fffff0";
                document.getElementById( tmp_nome_tab ).style.backgroundImage = BgEtichetta_off;

            }
        }
    }

    catch ( e ) {
        alert( "ERRORE: f_tab_over(() - \n error: " + e.message );
    }
}

preload_immagini();






function f_geo_lista( tipo,sigla_city ) {
    try {
        var contenuto_tab = '';
        var geotrk_swf = '';
        var n_tipo = 0;
        GLOBAL_tipo = tipo;
        BgEtichetta_on = "url("+AR_GLOB['dom_baseIMG']+"/tab_on_l20k.jpg)";
        BgEtichetta_off = "url("+AR_GLOB['dom_baseIMG']+"/tab_off_l20k.jpg)";

        switch ( tipo ) {
            case 1:
          

            document.getElementById( 'div_tab_city_geo' ).style.backgroundImage = BgEtichetta_off;
            document.getElementById( 'div_tab_country_geo' ).style.backgroundImage = BgEtichetta_on;

           
            n_tipo = 1;
            break;
            case 2:
          

            document.getElementById( 'div_tab_city_geo' ).style.backgroundImage = BgEtichetta_on;
            document.getElementById( 'div_tab_country_geo' ).style.backgroundImage = BgEtichetta_off;

            n_tipo = 2;
            GLOBAL_view_city = sigla_city;
            break;
        }
        f_crealista( tipo );
    }catch ( e ) {
    alert( "ERRORE: f_geo_lista() - \n error: " + e.message );
}
}

//--------------------------------------------------------------------------------------------------------------------------------------------

function f_crealista( tipo ) {
    try {
        var tmp_split_country = new Array();
        var tmp_split_dati = new Array();
        var arr_dati_country = new Array();


        var tmp_riga = '';
        var tmp_tot_vis = 0;
        var tot_country = 0;
        var tmp_perc = 0;
        var tmp_class_tr = 'onmouseover="this.style.backgroundColor=\'#FFCC66\';" onmouseout="this.style.backgroundColor=\'#FFFFFF\';" style="background-color:#FFFFFF;"';

        GLOBAL_intestazione_Tab = '';
        var count_Ar_righe = 0;
        var count_Ar_righe_Unk = 0;
        arr_riga.length = 0;


        switch ( tipo ) {
            case 1: 	//tabella country
            if (var_0country != 1){
                GLOBAL_lista_bandierine = '';
                // ...nazioni...	IMPOSTA LE VARIABILI PASSATE IN ARRAY
                // nome, sigla, hits, percentuale
                var tmp_nome;
                var tmp_sigla = '';
                var tmp_hitsK;
                var tmp_nome_country = '';
                var tmp_percentKU;
                var tmp_lunghezza_barra = 0;
                var count_naz = 0;
                var tmp_hits_txt = 0;

                if ( _Nmax_hits < 1 ) _Nmax_hits = 1;

                for ( country in _N ) {

                    if ( count_Ar_righe % 2 == 0 ) {tmp_class_tr = 'onmouseover="this.style.backgroundColor=\'#FFCC66\';" onmouseout="this.style.backgroundColor=\'#FFFFFF\';" style="background-color:#FFFFFF;"';}

                    else {tmp_class_tr = 'onmouseover="this.style.backgroundColor=\'#FFCC66\';" onmouseout="this.style.backgroundColor=\'#ECF0F4\';" style="background-color:#ECF0F4;"';}


                    tmp_sigla = country.toLowerCase();

                    if ( _2NCh[ tmp_sigla ] ) tmp_sigla = _2NCh[ tmp_sigla ].toLowerCase();

                    tmp_nome_country = country;

                    tmp_hits = _N[ country ];
                    tmp_hits_txt = tmp_hits+'';
                    tmp_hits_txt = pulisci_numeri(tmp_hits_txt);

                    tmp_percent = Math.ceil( ( ( tmp_hits ) / _Nmax_hits ) * 100 );

                    tmp_percent_all = (Math.ceil( ( ( tmp_hits ) / _Ntotal_hits ) * 10000 )/100);
                    tmp_lunghezza_barra_off = 230;
                    tmp_lunghezza_barra = Math.ceil(230 * ( tmp_percent / 100 ));
                    tmp_lunghezza_barra_off = 230 - tmp_lunghezza_barra;

                    tmp_class_tr='bgcolor="#F7F7F7" height="20" onmouseover="this.style.backgroundColor=\'#D6DBDE\';" onmouseout="this.style.backgroundColor=\'#F7F7F7\';"';
                    if (count_Ar_righe%2==1)tmp_class_tr='bgcolor="#FFFFFF" height="20" onmouseover="this.style.backgroundColor=\'#D6DBDE\';" onmouseout="this.style.backgroundColor=\'#FFFFFF\';"';

                    tmp_no_riga_top_td = '';
                    if(count_Ar_righe==0) tmp_no_riga_top_td = 'style="border-top:0px;"';


                    arr_riga[ count_Ar_righe ] = '<tr ' + tmp_class_tr + '>' +
                    '    <td align="center" height="20" width="30" '+ tmp_no_riga_top_td +' class="td_tab_lista"><font class="txt_10_dg">' + (count_Ar_righe+1) + '</font></td>' +
                    '    <td align="center" height="20" width="30" '+ tmp_no_riga_top_td +' class="td_tab_lista"><img border="0" src="'+AR_GLOB['dom_baseIMG']+'/flags/' + tmp_sigla + '.gif" width="16" height="11"></td>' +
                    '    <td align="left" height="20" width="180" '+ tmp_no_riga_top_td +' class="td_tab_lista"><font class="txt_10_dg">' + tmp_nome_country + '</font></td>' +
                    '    <td height="20" width="290" '+ tmp_no_riga_top_td +' class="td_tab_lista"><img border="0" src="'+AR_GLOB['dom_baseIMG']+'/graphLine_tramaB.png" width="' + tmp_lunghezza_barra + '" height="8" ><img border="0" src="'+AR_GLOB['dom_baseIMG']+'/bg_inputText.jpg" width="'+tmp_lunghezza_barra_off+'" height="8"><font class="txt_10_dg">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' + tmp_percent_all + '%</font></td>' +
                    '    <td align="center" height="20" width="100" '+ tmp_no_riga_top_td +' class="td_tab_lista"><font class="txt_10_dg">' + tmp_hits_txt + '</font></td>' +
                    '</tr>';



                    count_Ar_righe ++;
                }
                arr_riga[ count_Ar_righe ] = '</table><br>';
                count_Ar_righe ++;

            
                GLOBAL_intestazione_Tab = '<br><table border="0" width="630" id="table4" cellspacing="0" cellpadding="0" background="'+AR_GLOB['dom_baseIMG']+'/bg_tb_intesta_20.jpg" height="25" style="border-top: 1px solid #DADDE0;border-bottom: 1px solid #DADDE0;"><tr><td>' +
                '	<table width="630" id="table5" cellpadding="0" height="18" cellspacing="0">' +
                '		<tr height="20">' +
                '			<td  width="30" align="center" class="td_tab_intesta"></td>' +
                '			<td  width="30" align="center" class="td_tab_intesta"></td>' +
                '			<td  width="180" align="left" class="td_tab_intesta">&nbsp;<font class="txt_13_dg">'+lingua_country+'</font></td>' +
                '			<td width="290" align="left" class="td_tab_intesta"></td>' +
                '			<td width="100" align="center" class="td_tab_intesta"><font class="txt_13_dg">'+lang['Visitors']+'</font></td>' +
                '		</tr>' +
                '	</table>' +
                '</td></tr></table>' +
                '<table border="0" width="630" id="table2" cellspacing="0" cellpadding="0"  style="border-bottom: 1px solid #DADDE0;">';

            }else if(var_0country == 1){            
                document.getElementById( "div_content_geo" ).innerHTML = '<br><font class="txt_16_mb">'+lang['No_visitors_countries']+'</font><br>';
            }
        break;
        case 2: 	//tabella city lista completa --- lista per citta
        if(var_0city != 1){
            GLOBAL_lista_bandierine = GLOBAL_lista_bandierine_generato;
            var count_city = 0;
            var tmp_nome;
            var tmp_sigla = '';
            var tmp_hits;
            var tmp_percent;
            var tmp_lunghezza_barra = 0;
            var count_naz = 0;
            var tmp_tool_nome_country = '';
            var tmp_hits_txt = 0;

            var MaxHits_city = 0;
            

            if (GLOBAL_view_city == 1){

                //----------------------------------------LISTA COMPLETA-----------------------------------

                var MaxHits_city = 0;
                var tmp_conteggio = 0;

                //calcolo il massimo valore dello stato per la barra

                for (var t=0; t<_c.length;t++){
                    if (parseInt(_c[t])>MaxHits_city){
                        //alert ( "trovato maggiore: " +  MaxHits_city + " - " +  _c[ t ] );
                        MaxHits_city = parseInt(_c[ t ]);
                    }
                }

                for ( stato in _c ) {
                   
                    tmp_city = _ccit[ stato ];

                    if ( _c2c[ stato ] ) tmp_sigla = _c2c[ stato ];

                    tmp_tool_nome_country = _cN_2cN[ tmp_sigla ];
                    tmp_sigla = tmp_sigla.toLowerCase();


                    //tmp_hits = _c[ stato ];

                    tmp_hits_txt = _c[ stato ];
                    //alert(tmp_hits_txt)
                    //tmp_hits_txt = tmp_hits+'';
                    
                    tmp_percent = Math.ceil( ( ( tmp_hits_txt ) / MaxHits_city  ) * 100 );
                    tmp_percent_all = (Math.ceil( ( ( tmp_hits_txt ) / _cTotalhitsoverall ) * 10000 )/100);
                    tmp_lunghezza_barra_off = 220;
                    tmp_lunghezza_barra = 220 * ( tmp_percent / 100 );
                    tmp_lunghezza_barra_off = 220 - tmp_lunghezza_barra;

                   /*/ tmp_percent = Math.ceil( ( ( tmp_hits ) / MaxHits_city ) * 100 );
                    tmp_percent_all = (Math.ceil( ( ( tmp_hits ) / TotHits_byCountry ) * 10000 )/100);
                    tmp_lunghezza_barra_off = 220;
                    tmp_lunghezza_barra = 220 * ( tmp_percent / 100 );
                    tmp_lunghezza_barra_off = 220 - tmp_lunghezza_barra;*/

                    tmp_hits_txt = pulisci_numeri(tmp_hits_txt);




                    if ( tmp_city != 'Unknow' ) {

                    

                         tmp_class_tr='bgcolor="#F7F7F7" height="20" onmouseover="this.style.backgroundColor=\'#D6DBDE\';" onmouseout="this.style.backgroundColor=\'#F7F7F7\';"';
                        if (count_Ar_righe%2==1)tmp_class_tr='bgcolor="#FFFFFF" height="20" onmouseover="this.style.backgroundColor=\'#D6DBDE\';" onmouseout="this.style.backgroundColor=\'#FFFFFF\';"';

                        tmp_no_riga_top_td = '';
                        if(count_Ar_righe==0) tmp_no_riga_top_td = 'style="border-top:0px;"';


                        arr_riga[ count_Ar_righe ] = '<tr ' + tmp_class_tr + '>' +
                        '    <td align="center" height="20" width="30" '+ tmp_no_riga_top_td +' class="td_tab_lista"><font class="txt_10_dg">' + (count_Ar_righe+1) + '</font></td>' +
                        '    <td align="center" height="20" width="30" '+ tmp_no_riga_top_td +' class="td_tab_lista"><a onmouseover="doTooltip_testo(event,\''+tmp_tool_nome_country+'\')" onmouseout="hideTip()"><img border="0" src="'+AR_GLOB['dom_baseIMG']+'/flags/' + tmp_sigla + '.gif" width="16" height="11"></a></td>' +
                        '    <td align="left" height="20" width="180" '+ tmp_no_riga_top_td +' class="td_tab_lista"><font class="txt_10_dg">' + tmp_city + '</font></td>' +
                        '    <td height="20" width="290" '+ tmp_no_riga_top_td +' class="td_tab_lista"><img border="0" src="'+AR_GLOB['dom_baseIMG']+'/graphLine_tramaB.png" width="' + tmp_lunghezza_barra + '" height="8" ><img border="0" src="'+AR_GLOB['dom_baseIMG']+'/bg_inputText.jpg" width="'+tmp_lunghezza_barra_off+'" height="8"><font class="txt_10_dg">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' + tmp_percent_all + '%</font></td>' +
                        '    <td align="center" height="20" width="100" '+ tmp_no_riga_top_td +' class="td_tab_lista"><font class="txt_10_dg">' + tmp_hits_txt + '</font></td>' +
                        '</tr>';



                        count_Ar_righe ++;
                    }else{//creo l'array delle citt� unknown

                  

                 tmp_class_tr='bgcolor="#F7F7F7" height="20" onmouseover="this.style.backgroundColor=\'#D6DBDE\';" onmouseout="this.style.backgroundColor=\'#F7F7F7\';"';
                  if (count_Ar_righe_Unk%2==1)tmp_class_tr='bgcolor="#FFFFFF" height="20" onmouseover="this.style.backgroundColor=\'#D6DBDE\';" onmouseout="this.style.backgroundColor=\'#FFFFFF\';"';

                  tmp_no_riga_top_td = '';
                  if(count_Ar_righe_Unk==0) tmp_no_riga_top_td = 'style="border-top:0px;"';


                   arr_riga_Unk[ count_Ar_righe_Unk ] = '<tr ' + tmp_class_tr + '>' +
                  '    <td align="center" height="20" width="30" '+ tmp_no_riga_top_td +' class="td_tab_lista"><font class="txt_10_dg">' + (count_Ar_righe_Unk+1) + '</font></td>' +
                  '    <td align="center" height="20" width="30" '+ tmp_no_riga_top_td +' class="td_tab_lista"><img border="0" src="'+AR_GLOB['dom_baseIMG']+'/flags/' + tmp_sigla + '.gif" width="16" height="11"></td>' +
                  '    <td align="left" height="20" width="180" '+ tmp_no_riga_top_td +' class="td_tab_lista"><font class="txt_10_dg">' + tmp_tool_nome_country + '</font></td>' +
                  '    <td height="20" width="290" '+ tmp_no_riga_top_td +' class="td_tab_lista"><img border="0" src="'+AR_GLOB['dom_baseIMG']+'/graphLine_tramaB.png" width="' + tmp_lunghezza_barra + '" height="8" ><img border="0" src="'+AR_GLOB['dom_baseIMG']+'/bg_inputText.jpg" width="'+tmp_lunghezza_barra_off+'" height="8"><font class="txt_10_dg">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' + tmp_percent_all + '%</font></td>' +
                  '    <td align="center" height="20" width="100" '+ tmp_no_riga_top_td +' class="td_tab_lista"><font class="txt_10_dg">' + tmp_hits_txt + '</font></td>' +
                  '</tr>';


                    count_Ar_righe_Unk ++;
                }
            }
            arr_riga[ count_Ar_righe ] = '</table>';
            count_Ar_righe ++;
            arr_riga_Unk[ count_Ar_righe_Unk ] = '</table>';
            count_Ar_righe_Unk ++;

        }else if(GLOBAL_view_city!=0 && GLOBAL_view_city!=1){//LISTA CITTA PER COUNTRY PASSATA
        
        var MaxHits_city = 0;
        var TotHits_byCountry = 0;
        var tmp_conteggio = 0;

        //calcolo il massimo valore dello stato per la barra
        var citymaiusc = GLOBAL_view_city.toUpperCase();
        for (var t=0; t<_c2c.length;t++){
            if (_c2c[t]== citymaiusc ){
                if (parseInt(_c[t])>MaxHits_city){
                   
                    MaxHits_city = parseInt(_c[ t ]);

                }
                TotHits_byCountry = TotHits_byCountry + (parseInt(_c[t]));
            }
            tmp_conteggio = tmp_conteggio+1;
        }

     

        for (var t=0; t<_c2c.length;t++){
           


            if (_c2c[t]== citymaiusc ){

                tmp_sigla = _c2c[t].toLowerCase();
                tmp_city = _ccit[t];
                tmp_tool_nome_country = _cN_2cN[ _c2c[t] ];
                tmp_hits = _c[ t ];
                tmp_percent = Math.ceil( ( ( tmp_hits ) / MaxHits_city ) * 100 );
                tmp_percent_all = (Math.ceil( ( ( tmp_hits ) / TotHits_byCountry ) * 10000 )/100);
                tmp_lunghezza_barra_off = 220;
                tmp_lunghezza_barra = 220 * ( tmp_percent / 100 );
                tmp_lunghezza_barra_off = 220 - tmp_lunghezza_barra;
                
                 tmp_hits_txt = pulisci_numeri(tmp_hits);

                if ( tmp_city != 'Unknow' ) {

                

                 tmp_class_tr='bgcolor="#F7F7F7" height="20" onmouseover="this.style.backgroundColor=\'#D6DBDE\';" onmouseout="this.style.backgroundColor=\'#F7F7F7\';"';
                  if (count_Ar_righe%2==1)tmp_class_tr='bgcolor="#FFFFFF" height="20" onmouseover="this.style.backgroundColor=\'#D6DBDE\';" onmouseout="this.style.backgroundColor=\'#FFFFFF\';"';

                  tmp_no_riga_top_td = '';
                  if(count_Ar_righe==0) tmp_no_riga_top_td = 'style="border-top:0px;"';


                   arr_riga[ count_Ar_righe ] = '<tr ' + tmp_class_tr + '>' +
                  '    <td align="center" height="20" width="30" '+ tmp_no_riga_top_td +' class="td_tab_lista"><font class="txt_10_dg">' + (count_Ar_righe+1) + '</font></td>' +
                  '    <td align="center" height="20" width="30" '+ tmp_no_riga_top_td +' class="td_tab_lista"><a onmouseover="doTooltip_testo(event,\''+tmp_tool_nome_country+'\')" onmouseout="hideTip()"><img border="0" src="'+AR_GLOB['dom_baseIMG']+'/flags/' + tmp_sigla + '.gif" width="16" height="11"></a></td>' +
                  '    <td align="left" height="20" width="180" '+ tmp_no_riga_top_td +' class="td_tab_lista"><font class="txt_10_dg">' + tmp_city + '</font></td>' +
                  '    <td height="20" width="290" '+ tmp_no_riga_top_td +' class="td_tab_lista"><img border="0" src="'+AR_GLOB['dom_baseIMG']+'/graphLine_tramaB.png" width="' + tmp_lunghezza_barra + '" height="8" ><img border="0" src="'+AR_GLOB['dom_baseIMG']+'/bg_inputText.jpg" width="'+tmp_lunghezza_barra_off+'" height="8"><font class="txt_10_dg">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' + tmp_percent_all + '%</font></td>' +
                  '    <td align="center" height="20" width="100" '+ tmp_no_riga_top_td +' class="td_tab_lista"><font class="txt_10_dg">' + tmp_hits_txt + '</font></td>' +
                  '</tr>';



                    count_Ar_righe ++;
                }else{//creo l'array delle citt� unknown

                  tmp_class_tr='bgcolor="#F7F7F7" height="20" onmouseover="this.style.backgroundColor=\'#D6DBDE\';" onmouseout="this.style.backgroundColor=\'#F7F7F7\';"';
                  if (count_Ar_righe_Unk%2==1)tmp_class_tr='bgcolor="#FFFFFF" height="20" onmouseover="this.style.backgroundColor=\'#D6DBDE\';" onmouseout="this.style.backgroundColor=\'#FFFFFF\';"';

                  tmp_no_riga_top_td = '';
                  if(count_Ar_righe_Unk==0) tmp_no_riga_top_td = 'style="border-top:0px;"';


                   arr_riga_Unk[ count_Ar_righe_Unk ] = '<tr ' + tmp_class_tr + '>' +
                  '    <td align="center" height="20" width="30" '+ tmp_no_riga_top_td +' class="td_tab_lista"><font class="txt_10_dg">' + (count_Ar_righe_Unk+1) + '</font></td>' +
                  '    <td align="center" height="20" width="30" '+ tmp_no_riga_top_td +' class="td_tab_lista"><img border="0" src="'+AR_GLOB['dom_baseIMG']+'/flags/' + tmp_sigla + '.gif" width="16" height="11"></td>' +
                  '    <td align="left" height="20" width="180" '+ tmp_no_riga_top_td +' class="td_tab_lista"><font class="txt_10_dg">' + tmp_tool_nome_country + '</font></td>' +
                  '    <td height="20" width="290" '+ tmp_no_riga_top_td +' class="td_tab_lista"><img border="0" src="'+AR_GLOB['dom_baseIMG']+'/graphLine_tramaB.png" width="' + tmp_lunghezza_barra + '" height="8" ><img border="0" src="'+AR_GLOB['dom_baseIMG']+'/bg_inputText.jpg" width="'+tmp_lunghezza_barra_off+'" height="8"><font class="txt_10_dg">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' + tmp_percent_all + '%</font></td>' +
                  '    <td align="center" height="20" width="100" '+ tmp_no_riga_top_td +' class="td_tab_lista"><font class="txt_10_dg">' + tmp_hits_txt + '</font></td>' +
                  '</tr>';




                count_Ar_righe_Unk ++;
            }
        }
    }

    arr_riga[ count_Ar_righe ] = '</table>';
    count_Ar_righe ++;
    arr_riga_Unk[ count_Ar_righe_Unk ] = '</table>';
    count_Ar_righe_Unk ++;



}

//----------------AGGIUNGO LA LISTA DELLE CITTA UNKNOWN
if (count_Ar_righe_Unk>0){   
    arr_riga[ count_Ar_righe ] = '<br><br><font class="txt_13_dg"><b>' + lingua_altre_citta + '</b></font><table id="table70" style="border-collapse: collapse;" border="0"  cellpadding="0" cellspacing="0" width="630">';
    count_Ar_righe ++;
    for (var d=0; d<count_Ar_righe_Unk; d++){
        arr_riga[ count_Ar_righe ] = arr_riga_Unk[d];
        count_Ar_righe ++;
    }
    arr_riga[ count_Ar_righe ] = '</table>';
    count_Ar_righe ++;
}
//------------------------------------------------------


GLOBAL_intestazione_Tab = '<table border="0" width="630" id="table4" cellspacing="0" cellpadding="0" background="'+AR_GLOB['dom_baseIMG']+'/bg_tb_intesta_20.jpg" height="25" style="border-top: 1px solid #DADDE0;border-bottom: 1px solid #DADDE0;"><tr><td>' +
'	<table width="630" id="table5" cellpadding="0" height="18" cellspacing="0">' +
'		<tr height="20">' +
'			<td  width="30" align="center" class="td_tab_intesta"></td>' +
'			<td  width="30" align="center" class="td_tab_intesta"></td>' +
'			<td  width="180" align="left" class="td_tab_intesta">&nbsp;<font class="txt_13_dg">'+lingua_country+'</font></td>' +
'			<td width="290" align="left" class="td_tab_intesta"></td>' +
'			<td width="100" align="center" class="td_tab_intesta"><font class="txt_13_dg">'+lang['Visitors']+'</font></td>' +
'		</tr>' +
'	</table>' +
'</td></tr></table>' +
'<table border="0" width="630" id="table2" cellspacing="0" cellpadding="0"  style="border-bottom: 1px solid #DADDE0;">';



}else if(var_0city == 1){
document.getElementById( "div_content_geo" ).innerHTML = '<p style="margin-top: 0; margin-bottom: 0">&nbsp;</p><font class="txt_16_mb">'+lang['No_visitors_cities']+'</font><p style="margin-top: 0; margin-bottom: 0">&nbsp;</p>';
document.getElementById( "swf_mappa" ).innerHTML = '<font class="txt_10_dg">'+lang['No_data']+'</font>';
}
break;


}


if((var_0city == 1 && tipo == 2) || (var_0country == 1 && tipo == 1) ){

}else{

var funzione_stampa_inner = "";

for ( var s = 0;s < arr_riga.length;s++ ) {
    funzione_stampa_inner = funzione_stampa_inner + ' + arr_riga[' + s + ']' ;
}


GLOBAL_intestazione_Tab = GLOBAL_lista_bandierine + GLOBAL_intestazione_Tab ;


var stampa_dynamic_f = new Function( 'document.getElementById( \'div_content_geo\' ).innerHTML = GLOBAL_intestazione_Tab  ' + funzione_stampa_inner + ' ; ' );

stampa_dynamic_f();

GLOBAL_intestazione_Tab = "";

document.getElementById( "div_content_geo" ).innerHTML = document.getElementById( 'div_content_geo' ).innerHTML + '</table></center>';

}
// DEBUG IN TEXTAREA




}catch ( e ) {
alert( "ERRORE: f_crealista() - \n error: " + e.message );
}
}

//-------------------------------------------------------------------------------------------------------------------------------------------





function chiamaMetodo( tipo ) {
    try {
        var IE = navigator.appName.indexOf( "Microsoft" ) != -1;
        if( tipo == 1 ) {
            var filmato = IE ? window.mainMovie_s : window.document.mainMovie_s;
            filmato.SetVariable( 'clip_js.dati_geo', GLOBAL_var_country );
          
        }else if ( tipo == 2 ) {
            var filmato = IE ? window.mainMovie_l : window.document.mainMovie_l;
            filmato.SetVariable( 'clip_js.dati_geo', GLOBAL_var_country );
            filmato.SetVariable( 'clip_js.var_glb', '' + GLOBAL_sx + '##' + GLOBAL_sy + '##' + GLOBAL_swf_caricato + '##' + GLOBAL_tipo_mappa + '' );
        }
    }catch ( e ) {
        alert( "ERRORE: chiamaMetodo() - \n error: " + e.message );
    }
}



Fob_geoS=new Object;
Fob_geoS.movie="http://www.histats.com/swf/geo_trk_s.swf";
Fob_geoS.quality="High";
Fob_geoS.wmode="transparent";
Fob_geoS.width=700;
Fob_geoS.height=384;
//Fob_geoS.width=730;
//Fob_geoS.height=400;
Fob_geoS.version="8,0,0,0";
Fob_geoS.name="mainMovie_s";
Fob_geoS.id="mainMovie_s";


//-------------------------------------------------------------------------------------------------------------------------------------------
function f_load_geo_trk( x_gradi, y_gradi, tipo_mappa ) {
    try {
        GLOBAL_sx = x_gradi;
        GLOBAL_sy = y_gradi;
        GLOBAL_tipo_mappa = tipo_mappa;
        
        if(var_0city != 1 ){
            
            document.getElementById( "swf_mappa" ).innerHTML = GLOBAL_geotrk_l ;
        }
    }catch ( e ) {
    alert( "ERRORE: f_load_geo_trk() - \n error: " + e.message );
}
}

//-------------------------------------------------------------------------------------------------------------------------------------------
function f_load_geo_trk_s() {
    if(var_0city != 1 ){
        
        document.getElementById( 'swf_mappa' ).innerHTML = GLOBAL_geotrk_s;
    }
}


setTimeout( 'f_geo_lista(1,0);', 1000 );

function pulisci_numeri(nome_campo){
    try {

        var txt_campo = '';
        txt_campo = nome_campo;

        var ar_split_int_dec = new Array();
        var ar_split_int = new Array();
        var ar_numero_pulito = new Array();
        var valore_int = '';
        var valore_dec = '';
        var parte_intera = '';

        ar_split_int_dec = txt_campo.split(',');

        valore_int = ar_split_int_dec[0];
        if (ar_split_int_dec.length>1){
            valore_dec = ar_split_int_dec[1];
        }
        if (valore_int.length>3){//metto i punti delle migliaia

            ar_split_int = valore_int.split('');
            ar_split_int.reverse();
            var contatore_arr = 0;
            for (var a=0;a<ar_split_int.length;a++){
                ar_numero_pulito[contatore_arr] = ar_split_int[a];
                contatore_arr ++;
                if ((a+1)%3==0 && ((a+1)<ar_split_int.length ) ){
                    ar_numero_pulito[contatore_arr] =  '.';
                    contatore_arr ++;
                }
            }

            var stringa_pulita = '';
            for(var b =( ar_numero_pulito.length -1); b >=0 ;b--){
                stringa_pulita = stringa_pulita + ar_numero_pulito[b];
            }
            parte_intera = stringa_pulita;
        }else{
        parte_intera = valore_int;
    }

    if (valore_dec.length>0){
        parte_intera = parte_intera +','+ valore_dec;
    }

    return parte_intera;

}catch(e){
alert("ERRORE: pulisci_numeri() - GLOBAL_tipochiamata:  \n error: " + e.message);
}
}