/*-----------------------------------*/
/* Copyright 06/2006 Daniel Schicker */
/* info a t danielschlicker dot de   */
/*-----------------------------------*/
/* All rights reserved.              */
/* This file is part of the TWEBS.DE */
/* Content-Management-System         */
/*-----------------------------------*/
/* Free to use for private websites. */
/* For Commercial use please contact */
/* me at email above.                */
/*-----------------------------------*/

// CONFIG
var divname = "newsticker1_data";
var displayed_height = 103;
var scrollheight = 105;
var speed = 30;
var pixel = 2;
var pause = 2500;

// DO NOT EDIT BELOW THIS LINE
var scrolled_pixel = 0;
var max_height = 0;
var looped_pixel = -6;
var domove = 1;
var pausetime = 0;
var scrolltime = 0;
var firsttime = 1;

var clientPC = navigator.userAgent.toLowerCase(); // Get client info
var is_ie = ((clientPC.indexOf("msie") != -1) && (clientPC.indexOf("opera") == -1));
if (is_ie) scrollheight = 109;

function newsticker_init() {
   if(document.getElementById) {
      max_height = document.getElementById(divname).offsetHeight - 2;
	  scrolled_pixel = displayed_height;
      newsticker_show();
   }
}
function newsticker_scroll() {
  if(looped_pixel < scrollheight) {
	if(domove == 1){
	  if(document.getElementById)
	   document.getElementById(divname).style.top = 
	   (displayed_height - scrolled_pixel) + "px";
	  scrolled_pixel += pixel;
	  looped_pixel += pixel;
	  if(scrolled_pixel > max_height) {
		looped_pixel = -6;
		window.clearTimeout(scrolltime);
		newsticker_show();
	  }
	  else scrolltime = window.setTimeout("newsticker_scroll()",speed);
	}
  }else{
	  looped_pixel = 0;
  	  window.clearTimeout(scrolltime);
  	  window.clearTimeout(pausetime);
	  pausetime = window.setTimeout("newsticker_scroll()",pause);
  }
  firsttime = 0;
}
function newsticker_show() {
  scrolled_pixel = displayed_height;
  window.clearTimeout(pausetime);
  pausetime = window.setTimeout("newsticker_scroll()", pause);
}
function newsticker_pause() {
  domove = 0;
}
function newsticker_continue() {
  domove = 1;
  window.clearTimeout(pausetime);
  pausetime = window.setTimeout("newsticker_scroll()",speed);
}