/* 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...
vi_width=390;//	| the box
vi_height=25;//	|
vi_timeout=2500;//1000 = 1 second
vi_slideSpeed=50;
vi_slideStep=6;//pixels
vi_slideDirection=0;//0=down-up;1=up-down
vi_pauseOnMouseOver=true;

// === 2 === THE CONTENT - ['href','text','target']
// Use '' for href to have no link item

//vi_contentilan=[
//['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']
//];

// ===
vi_count=vi_contentilan.length;
vi_cur=1;
vi_last=0;
vi_d=vi_slideDirection?-1:1;
vi_TIM=null;
vi_canPause=0;

function vi_clear_timer() {
	if (vi_TIM != null) {
		clearTimeout(vi_TIM);
		vi_TIM = null;
	}
}

function vi_getOS(a){
	return document.getElementById(a).style;
}

function vi_start(){
	vi_clear_timer();
	
	var o = vi_getOS("vi_1");
	if(parseInt(o.top)==0) {
		vi_canPause = 1;
		if(vi_count > 1)
			vi_TIM=setTimeout("vi_slide()",vi_timeout);
		return;
	}
	var newTop = parseInt(o.top) - vi_slideStep * vi_d;
	o.top = newTop * vi_d > 0 ? newTop + "px" : "0px";
	vi_TIM = setTimeout("vi_start()",vi_slideSpeed)
}

function vi_slide(){
	vi_clear_timer();
	
	vi_canPause=0;
	
	var vi_next = (vi_cur < vi_count) ? vi_cur + 1 : 1;
	var o = vi_getOS("vi_"+vi_cur);
	var o2 = vi_getOS("vi_"+vi_next);
	if (parseInt(o2.top) == 0) {
		o.top = (vi_height*vi_d)+"px";
		vi_cur = vi_next;
		vi_canPause = 1;
		vi_TIM = setTimeout("vi_slide()",vi_timeout);
		return;
	}
	var newTop = parseInt(o.top) - vi_slideStep * vi_d;
	var newTop2 = parseInt(o2.top) - vi_slideStep * vi_d;
	if (newTop2 * vi_d > 0) {
		o.top = newTop+"px";
		o2.top = newTop2+"px";
	} else {
		o.top = -vi_height*vi_d+"px";
		o2.top = "0px";
	}
	vi_TIM = setTimeout("vi_slide()",vi_slideSpeed);
};

function vi_link_mouseover() {
	if(vi_canPause && vi_count > 1) 
		vi_clear_timer();
}

function vi_link_mouseout() {
	if(vi_canPause && vi_count > 1 && vi_TIM == null) 
		vi_TIM = setTimeout("vi_slide();", vi_timeout);
}

vi_temp="<div style=\"position: relative; margin-top: 5px; margin-left: 2px; "+
	"width:"+vi_width+"px; height:"+vi_height+"px; overflow:hidden;\">";
for(var vi_i=0;vi_i<vi_count;vi_i++) {
	var is_link = vi_contentilan[vi_i][0]!="";
	var tagName = is_link ? "a" : "span";

	vi_temp+="<div id=vi_"+(vi_i+1)+" style='position: absolute; top:"+(vi_height*vi_d)+"px; "+
		"left: 0px; width: "+vi_width+"px; height: "+vi_height+"px; overflow:hidden;'>";	
	vi_temp+="<" + tagName;	
	if (is_link) {
		vi_temp+=" href='"+vi_contentilan[vi_i][0]+"'";
		if (vi_contentilan[vi_i][2] != "")
			vi_temp+=" target='"+vi_contentilan[vi_i][2]+"'";
	}
	if (vi_pauseOnMouseOver)
		vi_temp+=" class='ust_yazi'";
	vi_temp+=">" + vi_contentilan[vi_i][1] + "</" + tagName + ">";
	vi_temp+="</div>";
}
vi_temp+="</div>";
document.write(vi_temp);
vi_TIM = setTimeout("vi_start()",1000);
