/* USE WORDWRAP AND MAXIMIZE THE WINDOW TO SEE THIS FILE
========================================
 V-NewsTicker modified by CRLin - http://web.dhjh.tcc.edu.tw/~gzqbyr/Hestia/
 Demo : http://web.dhjh.tcc.edu.tw/~gzqbyr/JS/V-NewsTicker/example4.html
 Feature : Put example 1, example 2 into one page
 LEAVE THESE NOTES PLEASE
========================================
 V-NewsTicker v2.2
 License : Freeware (Enjoy it!)
 (c)2003 VASIL DINKOV- PLOVDIV, BULGARIA
========================================
 For IE4+, NS4+, Opera5+, Konqueror3.1+
========================================
 Get the NewsTicker script at:
 http://www.smartmenus.org/other.php
 and don't wait to get the Great SmartMenus script at:
 http://www.smartmenus.org
 LEAVE THESE NOTES PLEASE - delete the comments if you want */

// BUG in Opera:
// If you want to be able to control the body margins
// put the script right after the BODY tag, not in the HEAD!!!

News_arr = new Array();

v_ua=navigator.userAgent;
v_nS4=document.layers?1:0;
v_iE=document.all&&!window.innerWidth&&v_ua.indexOf("MSIE")!=-1?1:0;
v_oP=v_ua.indexOf("Opera")!=-1&&document.clear?1:0;
v_oP7=v_oP&&document.appendChild?1:0;
v_oP4=v_ua.indexOf("Opera")!=-1&&!document.clear;
v_kN=v_ua.indexOf("Konqueror")!=-1&&parseFloat(v_ua.substring(v_ua.indexOf("Konqueror/")+10))<3.1?1:0;

function NewsObj(obj) {
	for (var i in obj) eval("this."+i+"=obj[i]")
	
	this.v_d=this.v_slideDirection?-1:1;
	this.v_fontSize2=v_nS4&&navigator.platform.toLowerCase().indexOf("win")!=-1?this.v_fontSizeNS4:this.v_fontSize;
}

function v_MakeArray(m,n)
{
	var a = new Array(m)
	for (i=0; i < m; i++) a[i] = new Array(n)
	return a;
}

function v_getOS(NewsObj_Num,a)
{
	var t = News_arr[NewsObj_Num];
	return v_iE ? document.all[a].style:(v_nS4 ?document.layers[t.obj+"_v_container"].document.layers[a]:document.getElementById(a).style)
}
	
function v_start(NewsObj_Num)
{
	var t = News_arr[NewsObj_Num];
	var o,px;
	o=v_getOS(NewsObj_Num,t.obj+"_v_1");
	px=v_oP&&!v_oP7||v_nS4?0:"px";

	if(parseInt(o.top)==t.v_paddingTop)
	{
		t.v_canPause=1;
		if(t.v_count>1) {
			t.v_canPause=0
			t.v_TIM=setTimeout("v_slide("+NewsObj_Num+")",t.v_timeout);
		}
		return
	}
	
	if ((parseInt(o.top)-t.v_slideStep*t.v_d)*t.v_d>t.v_paddingTop*t.v_d)
	{
		o.top=parseInt(o.top)-t.v_slideStep*t.v_d+px
	} else {
		o.top=t.v_paddingTop+px
	}
	if(v_oP&&o.visibility.toLowerCase()!="visible")o.visibility="visible";
	setTimeout("v_start("+NewsObj_Num+")",t.v_slideSpeed)
};

function v_slide(NewsObj_Num)
{
	var t = News_arr[NewsObj_Num];
	var o,o2,px;
	o=v_getOS(NewsObj_Num,t.obj+"_v_"+t.v_cur);
	o2=v_getOS(NewsObj_Num,t.obj+"_v_"+(t.v_cur<t.v_count?t.v_cur+1:1));
	px=v_oP&&!v_oP7||v_nS4?0:"px";
	t.v_canPause=0;
	if(parseInt(o2.top)==t.v_paddingTop)
	{
		if(v_oP)o.visibility="hidden";
		o.top=t.v_height*t.v_d+px;
		t.v_cur=t.v_cur<t.v_count?t.v_cur+1:1;
		t.v_canPause=1;
		t.v_TIM=setTimeout("v_slide("+NewsObj_Num+")",t.v_timeout);
		return
	}
	if(v_oP&&o2.visibility.toLowerCase()!="visible")o2.visibility="visible";
	if((parseInt(o2.top)-t.v_slideStep*t.v_d)*t.v_d>t.v_paddingTop*t.v_d)
	{
		o.top=parseInt(o.top)-t.v_slideStep*t.v_d+px;
		o2.top=parseInt(o2.top)-t.v_slideStep*t.v_d+px
	} else {
		o.top=-t.v_height*t.v_d+px;
		o2.top=t.v_paddingTop+px
	}
	setTimeout("v_slide("+NewsObj_Num+")",t.v_slideSpeed)
}

function v_mouseover(NewsObj_Num) {
	var t = News_arr[NewsObj_Num];
	if(t.v_canPause && t.v_count>1){clearTimeout(t.v_TIM);t.v_cl=1}
}

function v_mouseout(NewsObj_Num) {
	var t = News_arr[NewsObj_Num];
	if(t.v_canPause && t.v_count>1&&t.v_cl)
	{
		t.v_canPause=0;t.v_cl=0
		t.v_TIM=setTimeout("v_slide("+NewsObj_Num+")",t.v_timeout)
	}
}

NewsObj.prototype.v_newsticker = function (v_content)
{
	this.v_count=v_content.length;
	News_arr[News_arr.length] = this;
	this.obj = "Newscroll"+News_arr.length;
	var i = News_arr.length-1
	
	if(v_nS4||v_iE||v_oP||document.getElementById&&!v_kN&&!v_oP4)
	{
		//document.write("<style>.vnewsticker"+i+",a.vnewsticker"+i+"{font-family:"+this.v_font+";font-size:"+this.v_fontSize2+";color:"+this.v_fontColor+";text-decoration:"+this.v_textDecoration+";font-weight:"+this.v_fontWeight+"}a.vnewsticker"+i+":hover{font-family:"+this.v_font+";font-size:"+this.v_fontSize2+";color:"+this.v_fontColorHover+";text-decoration:"+this.v_textDecorationHover+"}</style>");
		//vnewsticker = "cattitle"
		v_temp="<div "+(v_nS4?"name":"id")+"="+this.obj+"_v_container"
		v_temp+=" style='position:"+this.v_position+";top:"+this.v_top+"px;left:"+this.v_left+"px;width:"+this.v_width+"px;height:"+this.v_height+"px;background:"+this.v_bgColor+";layer-background"+(this.v_bgColor.indexOf("url(")==0?"-image":"-color")+":"+this.v_bgColor+";clip:rect(0,"+this.v_width+","+this.v_height+",0);overflow:hidden'>"
		v_temp+=(v_iE?"<div style='position:absolute;top:0px;left:0px;width:100%;height:100%;clip:rect(0,"+this.v_width+","+this.v_height+",0)'>":"");
		for(v_i=0;v_i<this.v_count;v_i++) {
			v_temp+="<div "+(v_nS4?"name":"id")+"="+this.obj+"_v_"+(v_i+1)
			v_temp+=" style='position:absolute;top:"+(this.v_height*this.v_d)+"px;left:"+this.v_paddingLeft+"px;width:"+(this.v_width-this.v_paddingLeft*2)+"px;height:"+(this.v_height-this.v_paddingTop*2)+"px;clip:rect(0,"+(this.v_width-this.v_paddingLeft*2)+","+(this.v_height-this.v_paddingTop*2)+",0);overflow:hidden"+(v_oP?";visibility:hidden":"")+";text-align:"+this.v_textAlign+"' class="+vnewsticker+">"
			v_temp+=(!v_nS4?"<table width="+(this.v_width-this.v_paddingLeft*2)+" height="+(this.v_height-this.v_paddingTop*2)+" cellpadding=0 cellspacing=0 border=0><tr><td width="+(this.v_width-this.v_paddingLeft*2)+" height="+(this.v_height-this.v_paddingTop*2)+" align="+this.v_textAlign+" valign="+this.v_textVAlign+" class="+vnewsticker+">":"")
			v_temp+=(v_content[v_i][0]!=""?"<a href='"+v_content[v_i][0]+"' target='"+v_content[v_i][2]+"' class="+vnewsticker+(this.v_pauseOnMouseOver?" onmouseover='v_mouseover("+i+")' onmouseout='v_mouseout("+i+")'":"")+">":"<span"+(this.v_pauseOnMouseOver?" onmouseover='v_mouseover("+i+")' onmouseout='v_mouseout("+i+")'":"")+">")+v_content[v_i][1]+(v_content[v_i][0]!=""?"</a>":"</span>")
			v_temp+=(!v_nS4?"</td></tr></table>":"")+"</div>";
		}
		v_temp+=(v_iE?"</div>":"")+"</div>";
		document.write(v_temp);
		setTimeout("v_start("+i+")",1000);
		if(v_nS4)onresize=function(){ location.reload() }
	}
}

function v_scroll(obj, v_content){
	var temp = new NewsObj(obj);
	temp.v_newsticker(v_content)
}