	/************************************************************************************************************
	(C) www.dhtmlgoodies.com, November 2005
	
	This is a script from www.dhtmlgoodies.com. You will find this and a lot of other scripts at our website.	
	
	Terms of use:
	You are free to use this script as long as the copyright message is kept intact. However, you may not
	redistribute, sell or repost it without our permission.
	
	Thank you!
	
	www.dhtmlgoodies.com
	Alf Magne Kalleland
	
	Modified by Andrzej Marczewski for Jet Web
	
	************************************************************************************************************/
		
	var slideTimeBetweenSteps = 50;	// General speed variable (Higher = slower)
	
	
	var scrollingContainer = false;
	var scrollingContent = false;
	var containerHeight;
	var contentHeight;	
	var bavail=false
	var contentObjects = new Array();
	var originalslideSpeed = false;
	function slideContent(containerId)
	{
		var topPos = contentObjects[containerId]['objRef'].style.top.replace(/[^\-0-9]/g,'');
		topPos = topPos - contentObjects[containerId]['slideSpeed'];
		if(topPos/1 + contentObjects[containerId]['contentHeight']/1<0)topPos = contentObjects[containerId]['containerHeight'];
		contentObjects[containerId]['objRef'].style.top = topPos + 'px';
		setTimeout('slideContent("' + containerId + '")',slideTimeBetweenSteps);
		
	}
	
	function stopSliding()
	{
		var containerId = this.id;
		contentObjects[containerId]['slideSpeed'] = 0;	
	}
	
	function restartSliding()
	{
		var containerId = this.id;
		contentObjects[containerId]['slideSpeed'] = contentObjects[containerId]['originalSpeed'];
		
	}
	function initSlidingContent(containerId,slideSpeed,url)
	{
		getNews(url)
		if(bavail){
			setTimeout("init('"+containerId+"','"+slideSpeed+"')",200)
		}else{
			setTimeout("initSlidingContent('"+containerId+"','"+slideSpeed+"','"+url+"')",200);
		}
	}	
	function init(containerId,slideSpeed){
		scrollingContainer = document.getElementById(containerId);
		scrollingContent = scrollingContainer.getElementsByTagName('DIV')[0];
		scrollingContainer.style.display='block';
		scrollingContainer.style.position = 'relative';
		scrollingContainer.style.overflow = 'hidden';
		scrollingContent.style.position = 'relative';
		
		scrollingContainer.onmouseover = stopSliding;
		scrollingContainer.onmouseout = restartSliding;
		
		originalslideSpeed = slideSpeed;
		
		scrollingContent.style.top = '0px';
		
		contentObjects[containerId] = new Array();
		contentObjects[containerId]['objRef'] = scrollingContent;
		contentObjects[containerId]['contentHeight'] = scrollingContent.offsetHeight;
		contentObjects[containerId]['containerHeight'] = scrollingContainer.clientHeight;
		contentObjects[containerId]['slideSpeed'] = slideSpeed;
		contentObjects[containerId]['originalSpeed'] = slideSpeed;
		
		slideContent(containerId);
		
	}
	
//ajax
function ajaxRequest(params){
	var url = params.url
	err  = new String
	if(params.start !=null){
		params.start()
	}
	if (window.XMLHttpRequest) {
		xmlhttp = new XMLHttpRequest();
                if(!document.all){
		    		xmlhttp.overrideMimeType("text/xml");
                }
	}else {
		xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	}
	xmlhttp.onreadystatechange = function(){ 
		//alert(xmlhttp.readyState)
		if (xmlhttp.readyState == 4) {
			if (xmlhttp.status == 200) {
			if(params.finish !=null){
				params.finish(xmlhttp)
			}
				
			}else if (xmlhttp.status == 500){
				err = "There was a problem retrieving the XML data:\n" + xmlhttp.statusText
				if(params.error !=null){
					params.error(err)
				}else{
					alert(err)
				}
			}else{
				err = "There has been an error: \n" + xmlhttp.statusText + ' - ' + xmlhttp.status
				if(params.error !=null){
					params.error(err)
				}else{
					alert(err)
				}
			}
		}
	}
	xmlhttp.open("GET",url,true);
	xmlhttp.setRequestHeader('content-type', 'text/xml'); 		
	xmlhttp.send(null);	
}
var news=""
function getNews(url){
	ajaxRequest(
		params = {
			'url' : url,
			'start' : loader,
			'finish'  : displayNews
		}
	)
}
function loader(){
	document.getElementById('scrollingContent').innerHTML = "Loading..."
}
function displayNews(xmlhttp){
	document.getElementById('scrollingContent').innerHTML = xmlhttp.responseText
	bavail=true;
}

//ajax
	function randid(){
		var Session = new String();
		Session = Math.floor(Math.random() * 0xFFFFFF).toString(16);
		return Session
	}
