////CONFIG OPTIONS////
function JPscrollConfig() 
{
	//min 1
	JPSCROLL_width=150;
	//min 1
	JPSCROLL_height=100;
	JPSCROLL_bgcolor="#000d9a";
	JPSCROLL_bordercolor="#cfcf1b";
	JPSCROLL_speed=40;
	//min 0
	JPSCROLL_pagepause = 0;
	//min 0
	JPSCROLL_borderwidth = 3;
	JPSCROLL_borderstyle = "ridge";
	//min 0
	JPSCROLL_bordergap = 1;
	JPSCROLL_alignment = "left";
	JPSCROLL_textcolor = "#FFFFFF";
	//min 6
	JPSCROLL_fontsize = 11;
	JPSCROLL_fontfamily = "Arial, sans-serif";
	JPSCROLL_fontstyle = "normal";
	JPSCROLL_fontweight = "normal";
	JPSCROLL_borderstyle = JPSCROLL_borderstyle.toLowerCase();
	JPSCROLL_alignment = JPSCROLL_alignment.toLowerCase();
	JPSCROLL_fontstyle = JPSCROLL_fontstyle.toLowerCase();
	JPSCROLL_fontweight = JPSCROLL_fontweight.toLowerCase();
	JPSCROLL_innerwidth = JPSCROLL_width - 2*JPSCROLL_borderwidth - 2*JPSCROLL_bordergap;
	JPSCROLL_innerheight = JPSCROLL_height - 2*JPSCROLL_borderwidth - 2*JPSCROLL_bordergap;
}

//MAIN FUNCTION
function JPscrollStart() 
{
	JPscrollgetcontent();
	JPSCROLL_outerdiv=document.getElementById('JPSCROLL_outer');
	JPSCROLL_outerdiv.style.height = JPSCROLL_height+'px';
	JPSCROLL_outerdiv.style.width = JPSCROLL_width+'px';
	JPSCROLL_outerdiv.style.border = JPSCROLL_bordercolor+' '+JPSCROLL_borderstyle+' '+JPSCROLL_borderwidth+'px';
	JPSCROLL_outerdiv.style.clip = 'rect(0 '+JPSCROLL_innerwidth+' '+JPSCROLL_innerheight+' 0)';
	JPSCROLL_outerdiv.style.backgroundColor = JPSCROLL_bgcolor;
	JPSCROLL_style = 'position:relative; overflow: hidden;height:'+(JPSCROLL_height-2*JPSCROLL_borderwidth)+'px; width: '+(JPSCROLL_width-2*JPSCROLL_borderwidth)+'px; border-color: '+JPSCROLL_bgcolor+'; border-style: solid; border-width: '+JPSCROLL_bordergap+'px; background-color:'+JPSCROLL_bgcolor+'; ' +'color: '+JPSCROLL_textcolor+';'+'font-size: '+JPSCROLL_fontsize+'px; '+'font-family: '+JPSCROLL_fontfamily+'; '+'font-style: '+JPSCROLL_fontstyle+'; '+'font-weight: '+JPSCROLL_fontweight+'; ';
	JPSCROLL_outerdiv.innerHTML='<div style="'+JPSCROLL_style+'"><div id="JPSCROLL_area" style="position:relative; overflow: hidden; width:'+JPSCROLL_innerwidth+'px;text-align: '+JPSCROLL_alignment+'; border: 0px; margin: 0px; padding: 0px;"></div></div>';
	JPSCROLL_div=document.getElementById('JPSCROLL_area');
	JPSCROLL_div.style.top=JPSCROLL_innerheight+'px';
	JPSCROLL_div.innerHTML=JPSCROLL_message;
	JPSCROLL_vsize=JPSCROLL_div.offsetHeight;
	adjustVsize();
	JPSCROLL_div.innerHTML=JPSCROLL_message + JPSCROLL_filler + JPSCROLL_message;
	JPscroll();
}

//ADJUST FILLER SIZE
function adjustVsize() 
{
	var tempheight = 0;
	while (tempheight<JPSCROLL_vsize) 
	{
		tempheight = tempheight + JPSCROLL_innerheight;
	}
	if ( (tempheight-JPSCROLL_vsize-2)<1 ) 
	{
		JPSCROLL_filler = "";
	}
	else 
	{
		JPSCROLL_filler = '<div style="border: 0px; margin: 0px; padding: 0px; background-color: '+JPSCROLL_bgcolor+'; height: '+(tempheight-JPSCROLL_vsize-2)+'px;"> </div>';
	}
	JPSCROLL_vsize = tempheight;
}

//SCROLL THE NEWS
function JPscroll() 
{
	JPSCROLL_pagepixelcount++;
	if (JPSCROLL_pagepixelcount > JPSCROLL_innerheight) 
	{
		JPSCROLL_pagepixelcount = 0;
		if (JPSCROLL_pagepause>0) 
		{
			setTimeout("JPscroll()",JPSCROLL_pagepause);
		}
		else 
		{
			JPscroll();
		}
	}
	else 
	{
		if(parseInt(JPSCROLL_div.style.top)>=JPSCROLL_vsize*(-1)) 
		{
			JPSCROLL_div.style.top=parseInt(JPSCROLL_div.style.top)-JPSCROLL_sspeed+'px';
			setTimeout("JPscroll()",JPSCROLL_speed)+'px';
		}
		else 
		{
			JPSCROLL_div.style.top=-2+'px';
			JPscroll();
		}
	}
}

//LOAD NEWS FROM PAGE
function JPscrollgetcontent() 
{
	try 
	{
		document.getElementById('JPSCROLL_content').style.visibility="hidden";
		document.getElementById('JPSCROLL_content').style.height="1px";
		document.getElementById('JPSCROLL_content').style.width="1px";
		document.getElementById('JPSCROLL_content').style.overflow="hidden";
		JPSCROLL_message = document.getElementById('JPSCROLL_content').innerHTML;
	}
	catch (ex) 
	{
		JPSCROLL_message = "Error <br> Unable to load content<br><br>Ensure Content DIV tag is placed before the SCRIPT tags.";
	}
}

var JPSCROLL_sspeed=1;
var JPSCROLL_restart=JPSCROLL_sspeed;
var JPSCROLL_innerwidth = JPSCROLL_width - 2*JPSCROLL_borderwidth - 2*JPSCROLL_bordergap;
var JPSCROLL_innerheight = JPSCROLL_height - 2*JPSCROLL_borderwidth - 2*JPSCROLL_bordergap;
var JPSCROLL_message='no content';
var JPSCROLL_width=1;
var JPSCROLL_height=2;
var JPSCROLL_bgcolor="#FFDDDD";
var JPSCROLL_bordercolor="#FF0000";
var JPSCROLL_speed=10;
var JPSCROLL_borderwidth = 1;
var JPSCROLL_borderstyle = "dashed";
var JPSCROLL_bordergap = 2;
var JPSCROLL_alignment = "left";
var JPSCROLL_pagepause = 1000;
var JPSCROLL_pagepixelcount = 0;
var JPSCROLL_textcolor = "#000000";
var JPSCROLL_fontsize = 12;
var JPSCROLL_fontfamily = "Arial, sans-serif";
var JPSCROLL_fontstyle = "normal";
var JPSCROLL_fontweight = "normal";
var JPSCROLL_filler = "";
JPscrollConfig();
JPscrollStart();
