//jQuery.noConflict();
/*$(document).ready(function() {
	$('#bigimage').slideShow();
});
*/
$(document).ready(function() {
	// Banners on the startpage 
	//$('#banner_startpage ul').slideImages('horizontal', 804, 263, 1200, 'easeOutExpo', 'timer=9000');
	$("#banner_startpage ul").bxSlider({
            auto: true,
            autoControls: true,
            autoHover: true,
            pager: false,
            controls: true,
            speed: 1500,
			pause: 6000,
        });
});


$.fn.latestNewsDouble = function() {
	this.each(function() {
		var _self = this;
		var interval;
		
		_self.init = function() {
			var i = 1;
			jQuery('.news-latest-item', _self).each(function() {
				var current_item = jQuery(this);
				var target_url = jQuery('a', this).attr("href");
				var whitebox = jQuery('<div class="whitebox"></div>').appendTo(current_item);
				
				if(i%2==0) {
					current_item.css({left: "418px"});
				}
				current_item.css({top: "-200px"});
				current_item.bind('mousemove', function() {
					clearInterval(interval);
				}).bind('mouseout', function() {
					clearInterval(interval);
					interval = setInterval(function(){
						_self.showNext();
					}, 1000);
				}).bind('click', function() {
					window.location.href = target_url;
				});
				i++;
			});
		
			_self.showNext();
		}
		
		_self.showNext = function() {
			clearInterval(interval);
			
			var first = (jQuery('.active1', _self) ? jQuery('.active1', _self) : jQuery('.news-latest-item:first', _self));
			var first_whitebox = jQuery('.whitebox', first);
			var second = (jQuery('.active2', _self) ? jQuery('.active2', _self) : first.next('.news-latest-item'));
			var second_whitebox = jQuery('.whitebox', second);
			var third = (second.next('.news-latest-item').length ? second.next('.news-latest-item') : jQuery('.news-latest-item:first', _self));
			var third_whitebox = jQuery('.whitebox', third);
			var fourth = (third.next('.news-latest-item').length ? third.next('.news-latest-item') : jQuery('.news-latest-item:first', _self));
			var fourth_whitebox = jQuery('.whitebox', fourth);
			
			first.removeClass('active1').animate({top: "200px"}, 1000, "swing"); //, opacity: 0.0
			first_whitebox.animate({opacity: 1.0}, 900, "swing");
			second.removeClass('active2').animate({top: "200px"}, 1000, "swing"); //, opacity: 0.0
			second_whitebox.animate({opacity: 1.0}, 900, "swing");
			third.addClass('active1').css({top: "-200px"}).animate({top: "0px"}, 1000, "swing"); //, opacity: 1.0
			third_whitebox.animate({opacity: 0.0}, 900, "swing");
			fourth.addClass('active2').css({top: "-200px"}).animate({top: "0px"}, 1000, "swing"); //, opacity: 1.0
			fourth_whitebox.animate({opacity: 0.0}, 900, "swing");
			
			interval = setInterval(function(){
				_self.showNext();
			}, 10000);
		}
		
		_self.init();
	});
}
