/***********************************************
* 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.
***********************************************/

var delayb4scroll=2000 //Specify initial delay before marquee starts to scroll on page (2000=2 seconds)
var marqueespeed=1 //Specify marquee scroll speed (larger is faster 1-10)
var pauseit=1 //Pause marquee onMousever (0=no. 1=yes)?


var copyspeed=marqueespeed
var pausespeed=(pauseit==0)? copyspeed: 0
var actualheight=''
var p_inuse;
var p_list;
var css;
var orig_html = "";
var orig_height = 0;
var extra_ps = "<div style='width:100%; height:0px; line-height:0px; font-size:0px;'></div>";
var threshold = 75;




function scrollmarquee(){
if (parseInt(cross_marquee.style.top)>(actualheight*(-1)+8)) //if scroller hasn't reached the end of its height
cross_marquee.style.top=parseInt(cross_marquee.style.top)-copyspeed+"px" //move scroller upwards
else //else, reset to original position
cross_marquee.style.top=parseInt(marqueeheight)+8+"px"
}

function scrollmarquee2(){
if(p_list[0].currentStyle){
	curr_mt = parseInt(p_list[0].currentStyle.marginTop);
} else {
	css = getComputedStyle(p_list[0],'')
	curr_mt = parseInt(css.getPropertyValue("margin-top"));
}

if(parseInt(curr_mt-copyspeed) == parseInt((-1 * orig_height) - threshold)){
	document.getElementById("vmarquee").innerHTML = orig_html;
	p_list = document.getElementById("vmarquee").getElementsByTagName("p");
	extra_ps = "<div style='width:100%; height:0px; line-height:0px; font-size:0px;'></div>";
	for(var i=0; i<p_list.length; i++){
		extra_ps += "<p>" + p_list[i].innerHTML + "</p>";
	}
	document.getElementById("vmarquee").innerHTML += extra_ps;
	
} else {
	p_list[0].style.marginTop = parseInt(curr_mt-copyspeed)+"px" //move scroller upwards
}
}

function initializemarquee(){
cross_marquee=document.getElementById("vmarquee")
cross_marquee.style.top=0
marqueeheight=document.getElementById("marqueecontainer").offsetHeight
actualheight=cross_marquee.offsetHeight; //height of marquee content (much of which is hidden from view)
if (window.opera || navigator.userAgent.indexOf("Netscape/7")!=-1){ //if Opera or Netscape 7x, add scrollbars to scroll and exit
cross_marquee.style.height=marqueeheight+"px"
cross_marquee.style.overflow="scroll"
return
}

if(browser.isIE) threshold = 0;

if(document.getElementById("vmarquee")){
	if(document.getElementById("vmarquee").offsetHeight < 400){
		setTimeout('lefttime=setInterval("scrollmarquee()",30)', delayb4scroll);
	} else {
		p_list = document.getElementById("vmarquee").getElementsByTagName("p");
		orig_height = document.getElementById("vmarquee").offsetHeight;
		orig_html = document.getElementById("vmarquee").innerHTML;
		for(var i=0; i<p_list.length; i++){
			extra_ps += "<p>" + p_list[i].innerHTML + "</p>";
		}
		
		document.getElementById("vmarquee").innerHTML += extra_ps;
			
		setTimeout('lefttime=setInterval("scrollmarquee2()",30)', delayb4scroll);
	}
}
}


function detect() {
	
	agent 	= navigator.userAgent.toLowerCase();
						
	this.isIE		= (agent.indexOf('msie') != -1);
	this.isIE6		= (agent.indexOf('msie 6.') != -1);
	this.isIE5		= (agent.indexOf('msie 5.') != -1);
}

var browser = new detect();


if (window.addEventListener)
window.addEventListener("load", initializemarquee, false)
else if (window.attachEvent)
window.attachEvent("onload", initializemarquee)
else if (document.getElementById)
window.onload=initializemarquee