/*
Author: Marco Chiodetti
Email: devilmark84 at hotmail dot it

Require jQuery!

/////////////////////////////////INSTRUCTIONS//////////////////////////////////////////////

This is the code to add:
    <div id="slider_loghi">
      <div id="slider_loghi_riga"><span>fjkdsfhjdkfhsdlk</span><span>fdsjkhfskdsn</span></div>
    </div>

Every news show be contained between <span></span> tag.
Note that it's important to know that there couldn't be spaces between span tags!

/////////////////////////////////INSTRUCTIONS//////////////////////////////////////////////

Enjoy!

*/

//CONFIGURATION AREA
var scroll_speed = 10;        //time in milliseconds to move 1px
var px_after_end = 30;        //pixel to add at the end of news scroll to simulate a delay
//END OF CONFIGURATION AREA
/////////////////////////DO NOT EDIT BELOW THIS LINE!!!////////////////////////////////

function muoviSlider() {
	act_left = parseInt(jQuery("#slide_frame ul").css("left"));
	new_left = act_left - 1;
	jQuery("#slide_frame ul").css("left",new_left+"px");
	if ((-act_left) > (parseInt(jQuery("#slide_frame ul").outerWidth())+px_after_end)) jQuery("#slide_frame ul").css("left",parseInt(jQuery("#slide_frame").width())+"px");
}

jQuery(document).ready(function() {
    
    var est_largh = jQuery("#slide_frame").width();
    jQuery("#slide_frame ul").css("left",est_largh+"px");
    
    //dimensioning slider_loghi_riga
    var lungh = 0;
    jQuery("#slide_frame ul li").each(function() {
        lungh+= parseInt(jQuery(this).outerWidth(true));
    });
    jQuery("#slide_frame ul").css("width",lungh+"px");
    
    var h_slider = setInterval("muoviSlider()",scroll_speed);
});