﻿var tot=0;
    var pos=100;
    var scroll=true;
    var scrollTime;
    //proxy.php?url=
    
    $(document).ready(function(){
        $('#news').html('');
        $.each(na,function(index, item){
           datef = new Date(item[0]*1000);
            $('<div></div>').html('<span>'+datef.format("d/m")+'</span> '+item[2]).appendTo('#news');
        });
        //$("a#news").attr ('href', '#');
        /*
			$.ajax({
				type: "GET",
				url: "proxy.php?url=http://www.gazzetta.it/rss/Home.xml",
				dataType: "xml",
				success: function(xml) {
				    tot=0;
				    conta=0;
					$(xml).find('channel item').each(function(){
						var title = $(this).find('title').text();
					    var desc = $(this).find('description').text();
						     var current = $('<div></div>').html('<span>'+title+'</span><br />'+desc.replace(title,'').replace('<b>','').replace('</b>','')).appendTo('#news');
						tot +=current.height();
						conta++;
					});
					scrollUP();
				}
			});
			*/
			scrollUP();
			$("#scrollup").mouseover(function(){
			    scroll=false;
			    clearTimeout(scrollTime)
            });
			$("#scrollup").mouseout(function(){
			    scroll=true;
			    scrollUP();
            });
            $("#tdtr").mousedown(function(){
			    changePage(12);
            });
		});

    function apri()
    {
                newWindow = window.open("temporeale.htm",'newWin','toolbar=no,titlebar=no,toolbar=no,location=no,scrollbars=yes,resizable=yes,width=200,height=200,left=0,top=0');
                newWindow.focus();
    }
    function scrollUP()
    {
        if ((pos*-1)>$("#news").height()+100) 
        {
            pos=110;
            //alert("OK");
        }
        pos=pos-1;
        $("#news").css( { "top":pos+ "px" } );
        if (scroll) scrollTime=setTimeout(scrollUP,20);
    }
    
    function changePage(np)
    {
        switch(np)
        {
            case 0:
                $('#box').attr("src","regolamento.htm"); 
                break;
            case 1:
                $("#box").css("background-color", "#FFFFFF");
                $('#box').attr("src","http://www.fantaclub.it/servlet/fantacalcio-voti"); 
                break;
            case 2:
                $("#box").css("background-color", "#FFFFFF");
                $('#box').attr("src","http://www.fantaclub.it/servlet/fantacalcio-quotazioni"); 
                break;
            case 3:
                $("#box").css("background-color", "#FFFFFF");
                $('#box').attr("src","http://www.fantaclub.it/statistiche.jsp"); 
                break;
            case 4:
                $('#box').attr("src","punteggi.htm"); 
                break;
            case 5:
                $('#box').attr("src","foto.htm"); 
                break;
            case 6:
                $('#box').attr("src","http://www.rojadirecta.org/"); 
                break;
            case 7:
                $('#box').attr("src","http://www.asdmonteverde.altervista.org/"); 
                break;
            case 8:
                $('#box').attr("src","http://www.gazzetta.it/Calcio/prob_form/"); 
                break;
            case 9:
                $('#box').attr("src","http://www.gazzetta.it/speciali/risultati_classifiche/2010/calcio/seriea/index.shtml"); 
                break;
            case 10:
                $('#box').attr("src","http://www.ladritta.com/"); 
                break;
            case 11:
                $('#box').attr("src","http://www.fantaclub.it/servlet/Entra?nome=fantacalciogold&insito=si"); 
                break;
            case 12:
                $('#box').attr("src","http://www.gazzetta.it/tr_xml_sics/index.html"); 
                break;
                
        }
    }