function marquee(x,typ,p){

        typ={

            'up':[-1,'top','offsetHeight'],

            'down':[1,'top','offsetHeight'],

            'left':[-1,'left','offsetWidth'],

            'right':[1,'left','offsetWidth']

        }[typ];

        var m=this,mOut,mIn,turlaj,T,i=typ[0],j=0,p=p||25;

        (mOut=document.getElementById(x)).onmouseover=function(){T=clearInterval(T);T=setInterval(turlaj,40)};

            mOut.appendChild((mIn=mOut.childNodes)[0].cloneNode(1));

            mOut.onmouseout=function(e){

                e=e||event;e=e.toElement||e.relatedTarget;

                if(e)do{if(e==this)return!1}while(e=e.parentNode) 

                T=clearInterval(T);T=setInterval(turlaj,25)

            };

        mOut=mIn[0][typ[2]];

        turlaj=function(){

            mIn[0].style[typ[1]]=(-2*i*(j+=i)<(i-1)*mOut?(j=(-i-1)/2*mOut+i):j)+'px';

            mIn[1].style[typ[1]]=j+mOut+'px';

        }

        T=setInterval(turlaj,p);    

    }
	var $ = jQuery.noConflict();
	$(document).ready(function(){	
	 	$('#slideshow').cycle({
		timeout: 6000,  
		fx:      'fade',           
		pause:   0,	
		cleartypeNoBg: true,
		pauseOnPagerHover: 0 
		});

	});	

var headline_count;
var current_headline=0;

$(document).ready(function(){
  headline_count = $("div.headline").size();
  $("div.headline:eq("+current_headline+")").css('top', '20px');
  setInterval(headline_rotate,13000); //time in milliseconds
});

function headline_rotate() {
  old_headline = current_headline % headline_count;
  new_headline = ++current_headline % headline_count;
  $("div.headline:eq(" + old_headline + ")").css('top', '413px');
  $("div.headline:eq(" + new_headline + ")").show().animate({top: 20},"slow");     
}
$(function() {
	  
		//cache the ticker
		var ticker = $("#ticker");
		  
		//wrap dt:dd pairs in divs
		ticker.children().filter("h6").each(function() {
		  
		  var dt = $(this),
		    container = $("<div>");
		  
		  dt.next().appendTo(container);
		  dt.prependTo(container);
		  
		  container.appendTo(ticker);
		});
				
		//hide the scrollbar
		ticker.css("overflow", "hidden");
		
		//animator function
		function animator(currentItem) {
		    
		  //work out new anim duration
		  var distance = currentItem.height();
			duration = (distance + parseInt(currentItem.css("marginTop"))) / 0.025;

		  //animate the first child of the ticker
		  currentItem.animate({ marginTop: -distance }, duration, "linear", function() {
		    
			//move current item to the bottom
			currentItem.appendTo(currentItem.parent()).css("marginTop", 0);

			//recurse
			animator(currentItem.parent().children(":first"));
		  }); 
		};
		
		//start the ticker
		animator(ticker.children(":first"));
				
		//set mouseenter
		ticker.mouseenter(function() {
		  
		  //stop current animation
		  ticker.children().stop();
		  
		});
		
		//set mouseleave
		ticker.mouseleave(function() {
		          
          //resume animation
		  animator(ticker.children(":first"));
		  
		});
	  });
