    // Using multiple unit types within one animation.
    // VELOCITA' 
    var spider_right;
    
    function spider_go() {
        r = Math.ceil(Math.random() * 200) + 150;
        //console.log('go:   ' + r + ' : ' + r * 34 + 'ms \n');
        spider_right = spider_right + r;
        $("#spiderpork").attr("src",spider_path + "spider.gif");
        $("#spiderpork").animate({
            marginRight: spider_right
        }, r * 30, 'linear', spider_stop );
    }
    function spider_stop() {
        if (spider_right>getWindowWidth()) {
            spider_right = 0;
            $("#spiderpork").animate({
                marginRight: spider_right
            }, 1, 'linear', spider_go );
            //console.log('return back\n');
        } else {
            r = Math.ceil(Math.random() * 100) + 50;
            //console.log('stop: ' + r + ' : ' + r * 34 + 'ms \n');
            $("#spiderpork").attr("src",spider_path + "spiderstop.gif");
            $("#spiderpork").animate({
                marginRight: spider_right
            }, r * 30, 'linear', spider_go );
        }
    }
    
	function getWindowWidth() {
		var windowWidth = 0;
		if (typeof(window.innerWidth) == 'number') {
			windowWidth = window.innerWidth;
		}	else {  if (document.documentElement && document.documentElement.clientWidth) {
				windowWidth = document.documentElement.clientWidth;
			}else {	if (document.body && document.body.clientWidth) {
					windowWidth = document.body.clientWidth;	}	}	}
		return windowWidth;
	}
    
    $(document).ready(function(){
        if (!window.spider_path) {
            alert('You must set server_path javascript variable to the path of spider images.');
        }
        spider_right = 0;
        $('<a href="http://www.lordalcol.com/blog/spider-pork-widget/" alt="Spider Pork Widget" title="Spider Pork Widget" style="border: 0;"><img id="spiderpork" src="' + spider_path + 'spider.gif" style="right: 0; margin-right: 0px; border: 0; position: absolute; z-index: 999; top: 0;" /></a>').appendTo('body');
        $('#spiderpork').css('margin-right',spider_right + 'px');
        $('#spiderpork').mouseover(function() { $('#spiderpork').stop(); $("#spiderpork").attr("src",spider_path + "spiderstop.gif"); });
        $('#spiderpork').mouseout(function() { $('#spiderpork').stop(); spider_go(); });
        //$('spiderpork').css('display','block');
        spider_go();
    });