/* USE WORDWRAP AND MAXIMIZE THE WINDOW TO SEE THIS FILE
========================================
 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!!!

// === 1 === FONT, COLORS, EXTRAS...
v_width=580;//	| the box
v_height=18;//	|
v_timeout=2500;//1000 = 1 second
v_slideSpeed=50;
v_slideStep=6;//pixels
v_slideDirection=0;//0=down-up;1=up-down
v_pauseOnMouseOver=true;

// === 2 === THE CONTENT - ['href','text','target']
// Use '' for href to have no link item

//v_content=[
//['http://www.smartmenus.org/other.php','<img src=strelka.gif align=top width=20 height=11 border=0>Welcome to the V-NewsTicker example page!','_blank'],
//['','<img src=strelka.gif align=top width=20 height=11 border=0>Featuring:  blah, blah , blah, blah ....','_blank'],
//['http://www.smartmenus.org/','<img src=strelka.gif align=top width=20 height=11 border=0>Get the most advanced navigation system for your site - the SmartMenus.','_blank']
//];

// ===
v_count=v_content.length;
v_cur=1;
v_last=0;
v_d=v_slideDirection?-1:1;
v_TIM=null;
v_canPause=0;

function v_clear_timer() {
	if (v_TIM != null) {
		clearTimeout(v_TIM);
		v_TIM = null;
	}
}

function v_getOS(a){
	return document.getElementById(a).style;
}

function v_start(){
	v_clear_timer();
	
	var o = v_getOS("v_1");
	if(parseInt(o.top)==0) {
		v_canPause = 1;
		if(v_count > 1)
			v_TIM=setTimeout("v_slide()",v_timeout);
		return;
	}
	var newTop = parseInt(o.top) - v_slideStep * v_d;
	o.top = newTop * v_d > 0 ? newTop + "px" : "0px";
	v_TIM = setTimeout("v_start()",v_slideSpeed)
}

function v_slide(){
	v_clear_timer();
	
	v_canPause=0;
	
	var v_next = (v_cur < v_count) ? v_cur + 1 : 1;
	var o = v_getOS("v_"+v_cur);
	var o2 = v_getOS("v_"+v_next);
	if (parseInt(o2.top) == 0) {
		o.top = (v_height*v_d)+"px";
		v_cur = v_next;
		v_canPause = 1;
		v_TIM = setTimeout("v_slide()",v_timeout);
		return;
	}
	var newTop = parseInt(o.top) - v_slideStep * v_d;
	var newTop2 = parseInt(o2.top) - v_slideStep * v_d;
	if (newTop2 * v_d > 0) {
		o.top = newTop+"px";
		o2.top = newTop2+"px";
	} else {
		o.top = -v_height*v_d+"px";
		o2.top = "0px";
	}
	v_TIM = setTimeout("v_slide()",v_slideSpeed);
};

function v_link_mouseover() {
	if(v_canPause && v_count > 1) 
		v_clear_timer();
}

function v_link_mouseout() {
	if(v_canPause && v_count > 1 && v_TIM == null) 
		v_TIM = setTimeout("v_slide();", v_timeout);
}

v_temp="<div style=\"position: relative; margin-top: 5px; margin-left: 2px; "+
	"width:"+v_width+"px; height:"+v_height+"px; overflow:hidden;\">";
for(var v_i=0;v_i<v_count;v_i++) {
	var is_link = v_content[v_i][0]!="";
	var tagName = is_link ? "a" : "span";

	v_temp+="<div id=v_"+(v_i+1)+" style='position: absolute; top:"+(v_height*v_d)+"px; "+
		"left: 0px; width: "+v_width+"px; height: "+v_height+"px; overflow:hidden;'>";	
	v_temp+="<" + tagName;	
	if (is_link) {
		v_temp+=" href='"+v_content[v_i][0]+"'";
		if (v_content[v_i][2] != "")
			v_temp+=" target='"+v_content[v_i][2]+"'";
	}
	if (v_pauseOnMouseOver)
		v_temp+=" onmouseover='v_link_mouseover();' onmouseout='v_link_mouseout();'";
	v_temp+=">" + v_content[v_i][1] + "</" + tagName + ">";
	v_temp+="</div>";
}
v_temp+="</div>";
document.write(v_temp);
v_TIM = setTimeout("v_start()",1000);
