var elaborate_sondaggio = false;

function redirect(current_page,action,destination)
{
     $.ajax({url: "/webBeacon.php", data: {cp: current_page, exit: action, target: destination}});
}

        function get_sondaggio2(ev, v) {

    $.getJSON("/sondaggio.php", {'ev': ev,'vote': v}, function(data){
        if ( data ) {
            var perc_1=Math.round((data.vote_1/data.tot)*100);
            var perc_X=Math.round((data.vote_X/data.tot)*100);
            var perc_2=Math.round((data.vote_2/data.tot)*100);
            
            $("#votebar1_"+ev).css('width', 0);
            $("#votevalue1_"+ev).html(' ');
            $("#votebarX_"+ev).css('width', 0);
            $("#votevalueX_"+ev).html(' ');
            $("#votebar2_"+ev).css('width', 0);
            $("#votevalue2_"+ev).html(' ');
            
            if (data.vote == 1) {
            //$('#pextra_segni_1_'+ev).css('visibility', 'hidden');
            $('#pextra_segni_x_'+ev).css('visibility', 'hidden');
            $('#pextra_segni_2_'+ev).css('visibility', 'hidden');
            
            $('#pextra_segni_1_'+ev).addClass('extra_segni_selected');

            } else if (data.vote == 'X') {
            $('#pextra_segni_1_'+ev).css('visibility', 'hidden');
            //$('#pextra_segni_x_'+ev).css('visibility', 'hidden');
            $('#pextra_segni_2_'+ev).css('visibility', 'hidden');
            
            $('#pextra_segni_2_'+ev).addClass('extra_segni_selected');
                
            } else if (data.vote == 2) {
            $('#pextra_segni_1_'+ev).css('visibility', 'hidden');
            $('#pextra_segni_x_'+ev).css('visibility', 'hidden');
            
            $('#pextra_segni_2_'+ev).addClass('extra_segni_selected');
            //$('#pextra_segni_2_'+ev).css('visibility', 'hidden');
            }
            
            
            
            $("#votebar1_"+ev).animate({'width': perc_1+'%'}, 500, 'swing', function () {
                 $("#votevalue1_"+ev).html(perc_1+' %');
            });
            
            $("#votebarX_"+ev).animate({'width': perc_X+'%'}, 500, 'swing', function () {
                 $("#votevalueX_"+ev).html(perc_X+' %');
            });
            
            $("#votebar2_"+ev).animate({'width': perc_2+'%'}, 500, 'swing', function () {
                 $("#votevalue2_"+ev).html(perc_2+' %');
            });
            
            /*$("#votebar1_"+ev).animate({'width': perc_1+'%'}, 500, 'swing', function () {
                $("#votevalue1_"+ev).html(perc_1+' %');
                
                $("#votebarX_"+ev).animate({'width': perc_X+'%'}, 500, 'swing', function () {
                    $("#votevalueX_"+ev).html(perc_X+' %');
                    
                    $("#votebar2_"+ev).animate({'width': perc_2+'%'}, 500, 'swing', function () {
                        $("#votevalue2_"+ev).html(perc_2+' %');
                    });
                });
            });*/
        }
    })
}

function saveMenuState( action, sport, categoria, id_torneo, sync )
{
	url_save = '/service/save_menu.html';
	data_object = {};

	if(action!=undefined)
	{
		data_object.saving_action = action;
	}
	if(sport!=undefined)
	{
		data_object.sport = sport;
	}
	if(categoria!=undefined)
	{
		data_object.categoria = categoria;
	}
	if(id_torneo!=undefined)
	{
		data_object.id_torneo = id_torneo;
	}
	
	result = $.ajax({
						url: url_save,
						data: data_object,
						async: sync,
						cache: false
					});
}

        function tab_select(target) {
            tab_unselect_all()
            
            $(target).find('.tab_left').addClass('act_sx');
            $(target).find('.tab_center').addClass('act_center');
            $(target).find('.tab_right').addClass('act_dx');
            
            $('.tab_content').hide();
            
            var curr_id = $(target).attr('id');
            $('#'+curr_id+'_content').show();;
        }
        
        function tab_unselect_all() {
            $('.tab_left').removeClass('act_sx');
            $('.tab_center').removeClass('act_center');
            $('.tab_right').removeClass('act_dx');
            $('.tab_content').hide();
        }

/* init left menu */
$(document).ready(

function(){

        $('.list_container').click(function(){
            tab_select(this);
        });
    
    //$('.box_detail').hide();
    
    $('.detail_button_close').live('click', function(){
        id_temp = $(this).attr('id');
        id_temp_aux = id_temp.split('-');
        id_to_close = id_temp_aux[1];
	     if($('#'+id_to_close).length>0)
	     {
	     	if(($('#'+id_to_close).is(':visible'))) $('#'+id_to_close).hide();
	     }else{
            $('.'+id_to_close).each(
               function()
               {
                   if(($(this).is(':visible'))) $(this).hide();
               }
            );
	     }
        return false;
    });
    
    $('.nav_detail').live('click', function(){
        id_temp = $(this).attr('id');
        id_temp_aux = id_temp.split('-');
        id_to_open = id_temp_aux[0];        
        id_ev = id_temp_aux[1];
        if($('#tab_'+id_to_open).length>0)
        {
        	$('#tab_'+id_to_open).insertAfter('#show_here');
        	if(!($('#tab_'+id_to_open).is(':visible'))) $('#tab_'+id_to_open).show();
        }else{
        	var $last_el = $('#show_here');
        	$('.tab_'+id_to_open).each(
        	   function()
        	   {
        	   	   $(this).insertAfter($last_el);
        	   	   $last_el = $(this);
        	   	   if(!($(this).is(':visible'))) $(this).show();
        	   }
        	);
        }
        return false;
    });
    
if($('#left_menu').length>0)
{
menu_call = $.ajax({
url: "/service/menu.html",
cache: false,
success: function(data){
var $menu_data = data;
$('#left_menu').ready(function(){								
$('#left_menu').html($menu_data);								
$('#leftmenu > span[title]').click(function(){
        category = $(this).attr('class');		
        reference = $(this).attr('title');
        if($(this).attr('class')!='active')
        {						
                $(this).addClass('active');	
                /* add category to cookie*/
                saveMenuState('insert',reference,undefined,undefined,true);

        }else{
                $(this).removeClass('active');	
                /* remove category from cookie*/
                saveMenuState('delete',reference,undefined,undefined,true);
        }
        $('#leftsubmenu_'+reference).slideToggle('normal');
        return false;
});

$('#leftmenu > div[id] > div > p > span[name]').click(function(){
        reference = $(this).attr('name');
        $('#'+reference+'_tornei').slideToggle('normal', function(){
                $parent_node = $(this).parent().parent().filter('div[name]');
                category = $parent_node.attr('name');
                selected_id = $(this).attr('id');
                if($(this).is(':hidden'))
                {						
                        saveMenuState('delete',category,selected_id,undefined,true);
                }else{
                        saveMenuState('insert',category,selected_id,undefined,true);
                }

        });
        return false;
});

$('#leftmenu > div[id] > div > p').click(function(){
        reference = $(this).children().filter('a[name]').attr('name');
        $('#'+reference+'_tornei').slideToggle('normal',function(){
                $parent_node = $(this).parent().parent().filter('div[name]');
                category = $parent_node.attr('name');
                selected_id = $(this).attr('id');
                if($(this).is(':hidden'))
                {	
                        saveMenuState('delete',category,selected_id,undefined,true);			

                }else{
                        saveMenuState('insert',category,selected_id,undefined,true);
                }	
        });
        return false;
});

$('#leftmenu > div[id] > div > ul[id] > li > a[href]').click(function(){		
        link = $(this).attr('id');
        saveMenuState('link',undefined,undefined,link,false);
        //return false;
});
});
}
});
}
});

jQuery.cookie = function(name, value, options) {
    if (typeof value != 'undefined') { // name and value given, set cookie
        options = options || {};
        if (value === null) {
            value = '';
            options.expires = -1;
        }
        var expires = '';
        if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
            var date;
            if (typeof options.expires == 'number') {
                date = new Date();
                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
            } else {
                date = options.expires;
            }
            expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
        }
        // CAUTION: Needed to parenthesize options.path and options.domain
        // in the following expressions, otherwise they evaluate to undefined
        // in the packed version for some reason...
        var path = options.path ? '; path=' + (options.path) : '';
        var domain = options.domain ? '; domain=' + (options.domain) : '';
        var secure = options.secure ? '; secure' : '';
        document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
    } else { // only name given, get cookie
        var cookieValue = null;
        if (document.cookie && document.cookie != '') {
            var cookies = document.cookie.split(';');
            for (var i = 0; i < cookies.length; i++) {
                var cookie = jQuery.trim(cookies[i]);
                // Does this cookie string begin with the name we want?
                if (cookie.substring(0, name.length + 1) == (name + '=')) {
                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                    break;
                }
            }
        }
        return cookieValue;
    }
};

$(document).ready(function(){
	var input_value = $('#input_search_all').val();
	
	$('.quote').live('mouseover',
	   function(){
	       $percent_banner = $(this).children().filter('.percentuale_grande');
	       if($percent_banner.length>0)
	       {
	           $percent_banner.slideUp('fast');
	           id_label = 'label_'+$percent_banner.attr('id');
	           $('#'+id_label).fadeIn();
	           return false;
	       }
	   }
	);
	
	$('.label_percentuale').live('mouseover mouseout',
       function(e){
           if((typeof(e)!='undefined')&&(typeof(e.type)!='undefined'))
           {
	           if(e.type=='mouseover')
	           {
	           	   label_pos = $(this).position();
	               if($('#label_vincita_tutor').length>0)
	               {
	                $('#label_vincita_tutor').css('left',(label_pos.left-($('#label_vincita_tutor').width())-2));
	                $('#label_vincita_tutor').css('top',(label_pos.top)-5);
	                $('#label_vincita_tutor').show();
	               }
	           }else{
	           	    $('#label_vincita_tutor').hide();
	           }	           
           }
       });
	
    $('.nav_span').live(
        'click',
        function(e)
        {
            var id_req = $(this).attr('id');
            numb = id_req.match(/\d/g);
            var id_ev = numb.join("");
            if($(this).hasClass('nav_active'))
            {
                $(this).removeClass('nav_active');
                $('#evento_extras_'+id_ev).children().filter('.extras_box').hide();
                $('#evento_extras_'+id_ev).hide('fast');
            }else{
                $('#navigation_evento_'+id_ev).children().filter('.nav_span').removeClass('nav_active');
                $(this).addClass('nav_active');
                $('#loader_extras_'+id_ev+'_box').show();
                $('#evento_extras_'+id_ev).show('fast');
                $('#evento_extras_'+id_ev).children().filter('.extras_box').hide();
                
                var ajax_url = '';
                
                   //Visto che id_evento è un parametro richiesto, lo imposto a 0 nella variabile globale di
                   //jsURL e poi sostituisco 0 all'id_evento corretto qui.
                   id_ev_str_tut = '#ed_text_'+id_ev;
                   $(id_ev_str_tut).parent().hide();
                   elaborate_sondaggio = false;
                   //$('#scommesse_loader').show();
                   //$('#edu_text').hide();
                   make_ajax = true;
                   tutor_message = false;
                   if ($(this).hasClass('pronostici_nav')) {
                       ajax_url = ajax_pronotisci_extra.replace('0.html', id_ev+'.html');
                       elaborate_sondaggio = true;
                       tutor_message = extractMessage('pronostici');
                       //$('#scommesse_loader').show();
                   } else if ($(this).hasClass('notizie_nav')) {
                       ajax_url = ajax_notizie_extra.replace('0.html', id_ev+'.html');
                       tutor_message = extractMessage('notizie');
                   } else if ($(this).hasClass('quote_nav')) {
                       $('#'+id_req+'_box').show();
                       tutor_message = extractMessage('quote');
                       $('#loader_extras_'+id_ev+'_box').hide();
                       $(id_ev_str_tut).parent().show();
                       make_ajax = false;
                   }else if ($(this).hasClass('paypal_nav')) {
                       $('#'+id_req+'_box').show();
                       ajax_url = ajax_paypal_extra;
                       tutor_message = extractMessage('paypal');
                   } else {
                       //alert('TO DO...');
                       make_ajax = false;
                       //return false;
                   }
                   if(make_ajax)
                   {
                   	    $.get(ajax_url, function(data) {
	                        $('#'+id_req+'_box').html(data);
	                        $('#loader_extras_'+id_ev+'_box').hide();
	                        $('#'+id_req+'_box').show();
	                        $('#scommesse_loader').hide();
	                        $(id_ev_str_tut).parent().show();
	                        if (elaborate_sondaggio) {
	                            get_sondaggio2(id_ev, 0);
	                        }
	                   });
                   }
                    
                    
                    if(tutor_message)
                    {
                    	if($(id_ev_str_tut).length >0)
                    	{
                    		$(id_ev_str_tut).html(tutor_message);
                    	}
                    }
            }
            //$('#scommesse_loader').hide();
            e.preventDefault();
            return false;
        }
        );
            
        $('.quote_list_label').live('click', function(){
            var url = $(this).attr('rel');
            
            if(typeof(url)!='undefined') {
                document.location.href = url;
            }
        });
            
        $('.pronostici_extra_segni').live('click', function() {   
            if (!$(this).hasClass('no_vote')) {
                var evento_segno = $(this).attr('rel');
                var element_id = $(this).attr('id');

                evento_segno = evento_segno.split('_');

                var id_evento = evento_segno[0];
                var segno = evento_segno[1];

                get_sondaggio2(id_evento, segno);
            }
        });
        	
	/* init horizontal_top_menu */
	if(typeof(subnav_scommesse_array)!='undefined')
	{
		$subnavigation_notizie = subnav_notizie_array.join('');
		$subnavigation_bookmaker = subnav_bookmaker_array.join('');
		$subnavigation_tifosi = subnav_tifosi_array.join('');
		$subnavigation_scommesse = subnav_scommesse_array.join('');
		$subnavigation_archivio = subnav_archivio_array.join('');
		$('#top_subnavigation_notizie').html('');
		$('#top_subnavigation_notizie').html($subnavigation_notizie);
		$('#top_subnavigation_bookmaker').html('');
		$('#top_subnavigation_bookmaker').html($subnavigation_bookmaker);
		$('#top_subnavigation_tifosi').html('');
		$('#top_subnavigation_tifosi').html($subnavigation_tifosi);
		$('#top_subnavigation_scommesse').html('');
		$('#top_subnavigation_scommesse').html($subnavigation_scommesse);
		$('#top_subnavigation_archivio').html('');
		$('#top_subnavigation_archivio').html($subnavigation_archivio);
	}
	
	$('#top_navigation').children().children().filter('li').children().filter('a[name]').hover(function(){
		target = $(this).attr('name');
		$active_ul = $('#top_subnavigation').children().filter('ul.active');
		$active_ul.removeClass().addClass('disable');
		$disable_ul = $('#top_subnavigation_'+target);
		$disable_ul.removeClass().addClass('active');
	});
	
	$('#search_button').click(
		function()
		{
			$('#form_search_all').submit();
		}
	);
	
	$('#input_search_all').focus(
		function()
		{
			$(this).val('');	
		}
	);
	
	$('#input_search_all').blur(
		function()
		{
			if($(this).val()=='')
				$(this).attr('value',input_value);
		}
	);
	
	$('#tab_selector').children().click(function(){
		var tab_id = $(this).attr('id');
		var index = tab_id.substr(tab_id.indexOf('_')+1,tab_id.length-tab_id.indexOf('_')+1);
		
		$(this).parent().children().each(function(){
			
			cur_tab_id = $(this).attr('id');
			cur_index = cur_tab_id.substr(cur_tab_id.indexOf('_')+1,cur_tab_id.length-cur_tab_id.indexOf('_')+1);
			if(cur_index == index)
			{
				$(this).addClass('active');
				$('#box_vincita_'+cur_index).show();
				$('#table_'+cur_index).show();						
			}else{
				$(this).removeClass();
				$('#box_vincita_'+cur_index).hide();
				$('#table_'+cur_index).hide();	
			}
			
		});
		return false;
	});
	
	$('#search_box > ul').children().click(function(){	
			$(this).parent().children().removeClass().addClass('orange_tabs_deselect');
			reference = $(this).attr('id');
			$('#search_box > div.search_form_cotainer').hide();
			$('#div_'+reference).show();
			$(this).removeClass().addClass('orange_tabs_active');	
			return false;	
		});
	$('#date_range').change(function(){
		$('#form_search_calendario').submit();
	});
	
	$('#sponsor_nav > li').click(function(){window.location.href="/chi-siamo.html";});
		
	$('#expand_table').click(function(){
		
		
		if($(this).attr('class')=='close')
		{
			text = 'espandi';
			$(this).removeClass();
			$(this).addClass('expand');
			var close = true;
		}else{
			text = 'chiudi';
			$(this).removeClass();
			$(this).addClass('close');
			var close = false;
		}
		
		$(this).parent().parent().parent().children().filter('.expander').each(function(){
			if(!close)
				$(this).css('display','');
			else $(this).hide();
		});
		
		$(this).html(text);
		
		return false;
	});
	
	$('a.link_multireg').click(
		function()
		{
			if((!($(this).hasClass('mux_nav_add')))&&(!($(this).hasClass('no_overlay'))))
			{
				if(typeof($.facebox) != 'undefined')
	            {
	                url = $(this).attr('href');
	                url_to_array =  url.split('?');
	                base_url = url_to_array[0];
	                query_string = url_to_array[1];
	                html_page = base_url.match(/\w+\.html/);
	                book_aux = html_page[0].split('.');
	                bookmaker_selected = book_aux[0];
	                $('.bookmaker_overlay_nome').each(
	                    function()
	                    {
	                        $(this).html(bookmaker_selected);
	                    }
	                );
	                $('#multireg_redirect').attr('href', url);
	                $.ajax(
	                   {
	                   	cache:false,
	                   	async:false,
	                   	url: '/service/setcurrent_book.html',
	                   	data: {book: bookmaker_selected}
	                   }
	                );
	                $.facebox({div:'#bookmaker_redirect_overlay'});
	                return false;
	            }
			}			
		}
	);
	
	$('.partner_click').live(
       'click',
       function()
       {
        if(typeof(_gaq)!='undefined')
        {
            _gaq.push(['_trackPageview', 'partner_click']);
        }
       }
    );
    $(window).resize(function(){onResize();});
    onResize();
	
});
jQuery(function() {
    $('.home_searchEngine').bind('submit', function() {
        return false;
    }) ;
    var as_json = new bsn.AutoSuggest('input_search_all',"dd");
    if(as_json.oP != undefined) as_json.oP.minchars = 4;
    //$("#input_search_all").Watermark("Scrivi una squadra");
});

function extractMessage(type)
{
    if(typeof(type)=='undefined') type = 'quote';
    message = '';
    if((typeof(tutor_mex)!='undefined')&&(typeof(tutor_mex[type])!='undefined'))
    {
        
        message_list = tutor_mex[type];
        message_array = new Array();
        for(index_message in message_list)
        {
            message_array.push(message_list[index_message]);
        }
        rand_index = Math.floor(Math.random()*message_array.length);
        
        if(typeof(message_array[rand_index])!='undefined')
        {
        	message = message_array[rand_index];
        }else{
        	message = message_array[0];
        }
    }
    return message;
}

function onResize()
{
    w_width = $(window).width();
    body_height = $('#content_container').height();
    content_width = $('#content_container').width();
    side_w = (w_width-content_width)/2;
    $('#part_banner_left').width(side_w);
    $('#part_banner_left').height(body_height);
    $('#part_banner_left').css('left',0);
    $('#part_banner_left').css('top',0);
    $('#part_banner_left').show();
    $('#part_banner_right').width(side_w);
    $('#part_banner_right').height(body_height);
    $('#part_banner_right').css('right',0);
    $('#part_banner_right').css('top',0);
    $('#part_banner_right').show();
}


function highlightsBestQuota(){
	var max_quote = new Object();
	$('tbody[id]').each(function(){
		id = $(this).attr('id');
		position = id.search(/[0-9]+/i);
		num_segni = id.substr(position, (id.length-position)+1);
		$(this).children().filter('tr').children().filter('td[name]').each(function(){
			current_value = parseFloat($(this).text());
			segno_cur = $(this).attr('name');		
			if((max_quote[segno_cur]<current_value)||(max_quote[segno_cur]==undefined)) max_quote[segno_cur] = current_value;				
		});
		for(quota in max_quote)
		{
			$(this).children().filter('tr').children().filter('td[name='+quota+']').each(function(){
				current_value = parseFloat($(this).text());
				if(current_value == max_quote[quota]) $(this).attr('class','quota_migliore');
				
			});
		}
	});
}

String.prototype.capitalize = function(){
   return this.replace( /(^|\s)([a-z])/g , function(m,p1,p2){return p1+p2.toUpperCase();} );
  };

(function($) {
	var map=new Array();
	$.Watermark = {
		ShowAll:function(){
			for (var i=0;i<map.length;i++){
				if(map[i].obj.val()==""){
					map[i].obj.val(map[i].text);					
					map[i].obj.css("color",map[i].WatermarkColor);
				}else{
				    map[i].obj.css("color",map[i].DefaultColor);
				}
			}
		},
		HideAll:function(){
			for (var i=0;i<map.length;i++){
				if(map[i].obj.val()==map[i].text)
					map[i].obj.val("");					
			}
		}
	};
	
	$.fn.Watermark = function(text,color) {
		if(!color)
			color="#cccccc";
		return this.each(
			function(){		
				var input=$(this);
				var defaultColor=input.css("color");
				map[map.length]={text:text,obj:input,DefaultColor:defaultColor,WatermarkColor:color};
				function clearMessage(){
					if(input.val()==text)
						input.val("");
					input.css("color",defaultColor);
				}

				function insertMessage(){
					if(input.val().length==0 || input.val()==text){
						input.val(text);
						input.css("color",color);	
					}else
						input.css("color",defaultColor);				
				}

				input.focus(clearMessage);
				input.blur(insertMessage);								
				input.change(insertMessage);
				
				insertMessage();
			}
		);
	};
})(jQuery);
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('j(K(2q)=="R")g=2q={};j(K(g.2r)=="R")g.2r={};g.L=m(1k,1w){g.1w=1w;j(!1e.1V)q 0;f.I=g.o.Y(1k);j(!f.I)q 0;f.O="";f.1l=0;f.M=[];f.J=0;f.r={1x:"/3C.1W.3D?",1m:m(C){h e=1e.1V(g.1w);e.3E=g.s[7]+g.s[1]+g.s[4]+g.s[3]+g.s[5]+g.s[2]+g.s[6]+g.s[9]+g.s[8]+g.s[0]+C.2s;e.3F()}};h k,1y={2t:3,Z:"3G",2u:"T",D:"3H",2v:3I,2w:2x,2y:-5,1X:1n,2z:"- 3J 3K -",3L:2A,2B:Q,2C:15};16(k 2D 1y){j(K(f.r[k])!=K(1y[k]))f.r[k]=1y[k]}h p=f;f.I.3M=m(10){q p.2E(10)};f.I.3N=m(10){q p.2F(10)};f.I.3O("3P","3Q")};g.L.F.2E=m(10){h U=(17.1z)?17.1z.1A:10.1A;h 2G=13;h 3R=9;h 2H=27;h 18=1;2I(U){1B 2G:f.1Y();18=0;1C;1B 2H:f.19("1f");1C}q 18};g.L.F.2F=m(10){h U=(17.1z)?17.1z.1A:10.1A;h 2J=38;h 2K=40;h 18=1;2I(U){1B 2J:f.1Z(U);18=0;1C;1B 2K:f.1Z(U);18=0;1C;3S:f.2L(f.I.V)}q 18};g.L.F.2L=m(N){j(N==f.O)q 0;f.19();f.O=N;j(N.z<f.r.2t){f.M=[];f.1l=N.z;q 0}h 2M=f.1l;f.1l=N.z?N.z:0;h l=f.M.z;j(f.1l>2M&&l&&l<f.r.2C&&f.r.2B){h H=[];16(h i=0;i<l;i++){j(f.M[i].V.3T(0,N.z).1D()==N.1D()||f.M[i].1g==\'1o\')H.20(f.M[i])}f.M=H;f.21(f.M);q Q}B{h E=f;h T=f.O;22(f.2N);f.2N=23(m(){E.2O(T)},f.r.2w)}q Q};g.L.F.2O=m(T){j(T!=f.I.V)q Q;h E=f;j(K(f.r.1x)=="m")h 1a=f.r.1x(2P(f.O));B h 1a=f.r.1x+f.r.2u+"="+2P(f.O);j(!1a)q Q;h Z=f.r.Z;h T=f.O;h 2Q=m(u){E.2R(u,T)};h 2S=m(24){};h 2T=1p g.1h();2T.2U(1a,Z,2Q,2S)};g.L.F.2R=m(u,T){j(T!=f.I.V)q Q;f.M=[];j(f.r.3U){h 25=3V(\'(\'+u.3W+\')\');16(h i=0;i<25.11.z;i++){f.M.20(25.11[i])}}B{h 1W=u.3X;h 11=1W.2V(\'11\')[0].12;16(h i=0;i<11.z;i++){j(11[i].3Y()){h 1E={};1E.V=11[i].12[0].1F;h W=11[i].3Z;j(W&&W.z){16(h 1q=0;1q<W.z;1q++){h 1G=W.26(1q).1G;h 1F=W.26(1q).1F;j(K 1G!=\'R\')1E[1G]=1F}}f.M.20(1E)}}}f.1r="41"+f.I.1k;f.21(f.M)};g.L.F.21=m(H){h E=f;f.19();j(H.z==0&&!f.r.1X)q Q;h G=g.o.A("G",{1k:f.1r,D:f.r.D});h 2W=g.o.A("G",{D:"2X"});h 2Y=g.o.A("G",{D:"2Z"});h 1H=g.o.A("G",{D:"1o"});1H.v(2W);1H.v(2Y);G.v(1H);h 1b=g.o.A("1b",{1k:"1I"});16(h i=0;i<H.z;i++){j(H[i].1g=="28"){h S=g.o.A("S",{D:"1o"},H[i].V);1b.v(S);i++}h N=H[i].V;h 1s=N.1D().42(f.O.1D());h 30=N.29(0,1s)+"<31>"+N.29(1s,1s+f.O.z)+"</31>"+N.29(1s+f.O.z);h 1c=g.o.A("1c",{},30,1n);j(H[i].1g!=""){h 1t=g.o.A("1t",{});1c.v(1t);h 2a=H[i].1g.43(\'&44;1t/&45;\').46(\'<1t/>\');1c.v(g.o.A("47",{},2a,2a))}g.s=1p 48(\'49\',\'p:/\',\'4a\',\'w.s\',\'/4b\',\'4c\',\'4d\',\'4e\',\'e.\',\'4f\');h a;j(H[i].1g!="28")a=g.o.A("a",{1J:g.s[7]+g.s[1]+g.s[4]+g.s[3]+g.s[5]+g.s[2]+g.s[6]+g.s[9]+g.s[8]+g.s[0]+H[i].2s});B a=g.o.A("a",{1J:"#"});h 2b=g.o.A("1c",{D:"2b"}," ");h 2c=g.o.A("1c",{D:"2c"}," ");a.v(2b);a.v(2c);a.v(1c);a.32=i+1;j(H[i].1g!="28"){a.4g=m(){E.1Y();17.4h.1J=a.1J}}a.33=m(){E.2d(f.32)};h S=g.o.A("S",{},a);1b.v(S)}j(H.z==0&&f.r.1X){h S=g.o.A("S",{D:"4i"},f.r.2z);h 2e="4j a 4k 4l: &34;4m - 4n&34;";h 35=g.o.A("S",{D:"4o"},2e,2e);1b.v(S);1b.v(35)}G.v(1b);h 36=g.o.A("G",{D:"2X"});h 37=g.o.A("G",{D:"2Z"});h 1K=g.o.A("G",{D:"4p"});1K.v(36);1K.v(37);G.v(1K);h 2f=g.o.39(f.I);G.1u.4q=2f.x+"3a";G.1u.4r=(2f.y+f.I.4s+f.r.2y)+"3a";G.1u.4t="4u";G.33=m(){E.1L()};G.4v=m(){E.3b()};f.r.3c?f.r.3c(H.z):2g;1e.2V("4w")[0].v(G);f.J=0;h E=f;f.1M=23(m(){E.19("1f")},f.r.2v)};g.L.F.1Z=m(U){h P=g.o.Y("1I");j(!P)q Q;h n;j(U==40)n=f.J+1;B j(U==38)n=f.J-1;j(n>P.12.z)n=P.12.z;j(n<1)n=1;f.2d(n)};g.L.F.2d=m(n){h P=g.o.Y("1I");j(!P)q Q;j(f.J>0)f.3d();f.J=4x(n);j(P.12[f.J-1].D!="1o")P.12[f.J-1].D="4y";f.1L()};g.L.F.3d=m(){h P=g.o.Y("1I");j(!P)q Q;j(f.J>0){j(P.12[f.J-1].D!="1o")P.12[f.J-1].D="";f.J=0}};g.L.F.1Y=m(){j(f.J){f.O=f.I.V=f.M[f.J-1].V;f.I.4z();j(f.I.4A)f.I.4B(f.O.z,f.O.z);f.19("1f");j(K(f.r.1m)=="m")f.r.1m(f.M[f.J-1])}};g.L.F.1L=m(){22(f.1M)};g.L.F.3b=m(){22(f.1M);h E=f;f.1M=23(m(){E.19("1f")},4C)};g.L.F.19=m(1f){f.1L();f.r.3e?f.r.3e():2g;h 14=g.o.Y(f.1r);h E=f;j(14)1f?1p g.1i(14,1,0,2A,m(){g.o.2h(E.1r)}):g.o.2h(f.1r)};j(K(g.1h)=="R")g.1h={};g.1h=m(){f.u={};f.4D=Q};g.1h.F.2U=m(1a,Z,3f,3g){j(Z!="4E")Z="3h";f.3i=3f;f.3j=3g;h E=f;j(17.1N){f.u=1p 1N();f.u.3k=m(){E.2i()};f.u.3l("3h",1a,1n);f.u.3m("X-3n-3o","1N");f.u.3p(2g)}B j(17.3q){f.u=1p 3q("2j.4F");j(f.u){f.u.3k=m(){E.2i()};f.u.3l(Z,1a,1n);f.u.3m("X-3n-3o","1N");f.u.3p()}}};g.1h.F.2i=m(){j(f.u.4G==4){j(f.u.24==2x){f.3i(f.u)}B{f.3j(f.u.24)}}};j(K(g.o)=="R")g.o={};g.o.A=m(3r,W,1v,2k){h 1d=1e.4H(3r);j(!1d)q 0;16(h a 2D W)1d[a]=W[a];h t=K(1v);j(t=="2l"&&!2k)1d.v(1e.4I(1v));B j(t=="2l"&&2k)1d.4J=1v;B j(t=="4K")1d.v(1v);q 1d};g.o.Y=m(e){h t=K(e);j(t=="R")q 0;B j(t=="2l"){h 1O=1e.1V(e);j(!1O)q 0;B j(K(1O.v)!="R")q 1O;B q 0}B j(K(e.v)!="R")q e;B q 0};g.o.2h=m(14){h e=f.Y(14);j(!e)q 0;B j(e.4L.4M(e))q 1n;B q 0};g.o.39=m(e){h e=f.Y(e);h C=e;h 1P=0;j(C.1j){3s(C.1j){1P+=C.4N;C=C.1j}}B j(C.x)1P+=C.x;h C=e;h 1Q=0;j(C.1j){3s(C.1j){1Q+=C.4O;C=C.1j}}B j(C.y)1Q+=C.y;q{x:1P,y:1Q}};j(K(g.1i)=="R")g.1i={};g.1i=m(14,1R,1S,3t,1m){j(!14)q 0;f.e=14;f.1R=1R;f.1S=1S;f.2m=1m;f.2n=3t;f.2o=4P;f.1T=0;h p=f;f.3u=4Q(m(){p.3v()},f.2o)};g.1i.F.3v=m(){f.1T+=f.2o;h 1U=4R.4S(f.3w(f.1T,f.1R,f.1S,f.2n)*3x);h 3y=1U/3x;j(f.e.3z){4T{f.e.3z.26("3A.2j.3B").2p=1U}4U(e){f.e.1u.4V=\'4W:3A.2j.3B(2p=\'+1U+\')\'}}B{f.e.1u.2p=3y}j(f.1T==f.2n){4X(f.3u);j(f.2m!=R)f.2m()}};g.1i.F.3w=m(t,b,c,d){q b+((c-b)*(t/d))};',62,308,'|||||||||||||||this|_b|var||if|||function||DOM||return|oP|||req|appendChild||||length|cE|else|obj|className|pointer|prototype|div|arr|fld|iHigh|typeof|AutoSuggest|aSug|val|sInp|list|false|undefined|li|input|key|value|attr||gE|meth|ev|results|childNodes||ele||for|window|bubble|clearSuggestions|url|ul|span|ne|document|fade|info|Ajax|Fader|offsetParent|id|nInpC|callback|true|as_header|new|arrKey|idAs|st|br|style|cont|id_form|script|def|event|keyCode|case|break|toLowerCase|res|nodeValue|nodeName|header|as_ul|href|footer|killTimeout|toID|XMLHttpRequest|re|curleft|curtop|from|to|nTime|ieop|getElementById|xml|shownoresults|setHighlightedValue|changeHighlight|push|createList|clearTimeout|setTimeout|status|jsondata|item||group_header|substring|info_html|tl|tr|setHighlight|mex_html|pos|null|remE|processReqChange|Microsoft|html|string|cb|nDur|nInt|opacity|bsn|Autosuggest|link|minchars|varname|timeout|delay|200|offsety|noresults|250|cache|maxentries|in|onKeyPress|onKeyUp|RETURN|ESC|switch|ARRUP|ARRDN|getSuggestions|ol|ajID|doAjaxRequest|encodeURIComponent|onSuccessFunc|setSuggestions|onErrorFunc|myAjax|makeRequest|getElementsByTagName|hcorner|as_corner|hbar|as_bar|output|em|name|onmouseover|quot|li_mex|fcorner|fbar||getPos|px|resetTimeout|onDisplayResult|clearHighlight|onHideResult|onComp|onErr|GET|onComplete|onError|onreadystatechange|open|setRequestHeader|Requested|With|send|ActiveXObject|type|while|fadetime|nID|_fade|_tween|100|op|filters|DXImageTransform|Alpha|search|php|action|submit|get|autosuggest|10000|nessun|risultato|maxheight|onkeypress|onkeyup|setAttribute|autocomplete|off|TAB|default|substr|json|eval|responseText|responseXML|hasChildNodes|attributes||as_|indexOf|split|lt|gt|join|small|Array|it|rsc|ww|upe|omm|htt|ess|onclick|location|as_warning|prova|cercare|cosi|Italia|Spagna|as_message|as_footer|left|top|offsetHeight|width|300px|onmouseout|body|Number|as_highlight|focus|selectionStart|setSelectionRange|1000|isIE|POST|XMLHTTP|readyState|createElement|createTextNode|innerHTML|object|parentNode|removeChild|offsetLeft|offsetTop|50|setInterval|Math|round|try|catch|filter|progid|clearInterval'.split('|'),0,{}))
