function lib_bwcheck(){ //Browsercheck (needed)
	this.ver=navigator.appVersion
	this.agent=navigator.userAgent
	this.dom=document.getElementById?1:0
	this.opera5=this.agent.indexOf("Opera 5")>-1
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0; 
	this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;
	this.ie4=(document.all && !this.dom && !this.opera5)?1:0;
	this.ie=this.ie4||this.ie5||this.ie6
	this.mac=this.agent.indexOf("Mac")>-1
	this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
	this.ns4=(document.layers && !this.dom)?1:0;
	this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5)
	return this
}
var bw=new lib_bwcheck()

var speed = 30
var loop, timer

function makeObj(obj,nest){
    nest=(!nest) ? "":'document.'+nest+'.'
	this.el=bw.dom?document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+'document.'+obj):0;
  	this.css=bw.dom?document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+'document.'+obj):0;
	this.scrollHeight=bw.ns4?this.css.document.height:this.el.offsetHeight
	this.clipHeight=bw.ns4?this.css.clip.height:this.el.offsetHeight
	this.up=goUp;this.down=goDown;
	this.moveIt=moveIt; this.x=0; this.y=0;
    this.obj = obj + "Object"
    eval(this.obj + "=this")
    this.myTag = 1;
    return this
}

function makeObj2(obj,nest){
    nest=(!nest) ? "":'document.'+nest+'.'
	this.el=bw.dom?document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+'document.'+obj):0;
  	this.css=bw.dom?document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+'document.'+obj):0;
	this.scrollHeight=bw.ns4?this.css.document.height:this.el.offsetHeight
	this.clipHeight=bw.ns4?this.css.clip.height:this.el.offsetHeight
	this.up=goUp;this.down=goDown;
	this.moveIt=moveIt; this.x=0; this.y=0;
    this.obj = obj + "Object"
    eval(this.obj + "=this")
    this.myTag = 2;
    return this
}

var px = bw.ns4||window.opera?"":"px";

function moveIt(x,y){
	this.x = x
	this.y = y
	this.css.left = this.x+px
	this.css.top = this.y+px
}

function goDown(move){
  var xheight2,height;
  xheight2 = this.scrollHeight;
//  alert(xheight2);
  if (this.myTag == 1) xheight = oCont.clipHeight;
  else xheight = oCont2.clipHeight;

// @ers Eger dongu istenmiyorsa bu satirlar comment out edilecek 
	if (this.y==-this.scrollHeight+xheight && this.myTag!=1)  this.moveIt(0,0);
  
	if (this.y>-this.scrollHeight+xheight && move>0){
	  if (myPageScroll) {
	    move = +myPageScroll*0.2
	    if (move < 0.1) {
        move = myPageScroll;
    		loop = false;
	    }
	    myPageScroll = myPageScroll-move;
	  } 
		this.moveIt(0,this.y-move)
//    window.status = 'Move-down: ' + move + '   My Page Scroll: '+ myPageScroll + '   this.y'+this.y;
  	if (loop) setTimeout(this.obj+".down("+move+")",speed)
  	else this.moveIt(0,Math.round(this.y))
	} else if (myPageScroll) 
	  noScroll();
}
function goUp(move){

  var xheight2,height;
  xheight2 = this.scrollHeight;
  if (this.myTag == 1) xheight = oCont.clipHeight;
  else xheight = oCont2.clipHeight;

// @ers Eger dongu istenmiyorsa bu satirlar comment out edilecek 
	if (this.y==0 && this.myTag!=1)  this.moveIt(0,-this.scrollHeight+xheight);

	if (this.y<0){
	  if (myPageScroll) {
	    move = -myPageScroll*0.2
	    if (move > -0.1) {
        move = -myPageScroll;
    		loop = false;
	    }
	    myPageScroll = myPageScroll+move;
	  }
		this.moveIt(0,this.y-move)
//    window.status = 'Move-up: ' + move + '   My Page Scroll: '+ myPageScroll + '   this.y'+this.y;
		if (loop) setTimeout(this.obj+".up("+move+")",speed)
  	else this.moveIt(0,Math.round(this.y))
	} else if (myPageScroll) 
	  noScroll();
}

function AutoScroll() {
  scroll2(10);
  setTimeout('AutoScroll()',10000);
}

AutoScroll();

function scroll2(speed){
	if (scrolltextLoaded && !loop){
  	myPageScroll = 30;
		loop = true;
		if (speed>0) oScroll2.down(speed)
		else oScroll2.up(speed)
	}
}
function noScroll(){
//  window.status = 'no scroll called';
	loop = false
	myPageScroll = 0;
	if (timer) clearTimeout(timer)
}
var scrolltextLoaded = false
function scrolltextInit(){
//	alert('x');
	oCont2 = new makeObj2('divScrollTextCont2')
	oScroll2 = new makeObj2('divText2','divScrollTextCont2')
	oScroll2.moveIt(0,0)
	oCont2.css.visibility = "visible"
	scrolltextLoaded = true
}
if (bw.bw) onload = scrolltextInit
