/***********************************************
* Cross browser Marquee II-  Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
*
* Cross browser Marquee III- Using CreativeCommons (http://creativecommons.org/licenses/by-nc-sa/2.5/)
* This notice MUST stay intact for legal use
* This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License
* author: Riccardo Pasquini (riccardo.pasquini@gmail.com)
***********************************************/

var JSMarquee = {
  Version: '1',
  prototypeVersion: parseFloat(Prototype.Version.split(".")[0] + "." + Prototype.Version.split(".")[1])
}
JSMarquee.Marquee = Class.create();

JSMarquee.Marquee.prototype = {

    initialize: function(marqueeName, marqueeContent) {
        this.delayb4scroll   = 0;
        this.marqueespeed    = 1;
        this.pauseit         = 1;
        this.copyspeed       = this.marqueespeed;
        this.pausespeed      = (this.pauseit==0)? this.copyspeed: 0;
        this.actualheight    = '';
        this.actualwidth     = '';
        this.mName           = marqueeName;
        this.content         = marqueeContent;
        this.initializemarquee();
    },

    verticalscrollmarquee: function() {
        if (parseInt(this.cross_marquee.style.top)>(this.actualheight*(-1)))
            this.cross_marquee.style.top=(parseInt(this.cross_marquee.style.top)-this.copyspeed)+"px";
        else
            this.cross_marquee.style.top=(parseInt(this.marqueeheight)+5)+"px";
    },

    horizontalscrollmarquee: function() {
        if (parseInt(this.cross_marquee.style.left)>(this.actualwidth*(-1)))
            this.cross_marquee.style.left=(parseInt(this.cross_marquee.style.left)-this.copyspeed)+"px";
        else
            this.cross_marquee.style.left=(parseInt(this.marqueewidth)+5)+"px";
    },

    initializemarquee: function() {
        this.cross_marquee=document.getElementById(this.content);
        this.cross_marquee.style.top=0;
        this.cross_marquee.style.left=0;
        this.marqueeheight=document.getElementById(this.mName).offsetHeight;
        this.marqueewidth=document.getElementById(this.mName).offsetWidth;
        this.actualheight=this.cross_marquee.offsetHeight + 20;
        this.actualwidth=this.cross_marquee.offsetWidth + 20;
    },

    start: function() {
        this.copyspeed = this.marqueespeed;
    },

    stop: function() {
        this.copyspeed = 0;
    }
};

/**
CALL METHOD EXAMPLE:
just after the div container
that's required cause IE valorizes offset* on load and not on call :__(
<script type="text/javascript">
if(window.addEventListener)
    window.addEventListener("load", doScrollAnsa, false);
else if (window.attachEvent)
    window.attachEvent("onload", doScrollAnsa);
else if (document.getElementById)
    window.onload=doRollNews;
</script>
*/
var rollNews;
var scrollAnsa;
function doRollNews() {
    rollNews = new JSMarquee.Marquee("rollingMarqueeContainer", "rollingMarquee");
    setTimeout('setInterval("rollNews.verticalscrollmarquee()",30)', rollNews.delayb4scroll);
}
function doScrollAnsa() {
    scrollAnsa = new JSMarquee.Marquee("scrollingAnsa", "scrollingAnsaContent");
    setTimeout('setInterval("scrollAnsa.horizontalscrollmarquee()",30)', scrollAnsa.delayb4scroll);
}