
$(document).ready(function(){
	$(window).scroll(function (){
		pos_top = $(document).scrollTop() + "px";
		$('.case').animate({top:pos_top},{duration:1000,queue:false});
	});
});

$(function(){
	$('#content').tabs();
});

$(document).ready(function(){
	var _time = [3000, 1000, 5000];
	$('.items-hold .item').each(function(_i){
		var _el = $(this);
		var _t;
		var change_t = _time[_i];
		var _list = _el.find('.slideshow img').hide();
		var _a = _list.index(_list.filter('active:eq(0)'));
		if(_a == -1) _a = 0;
		_list.eq(_a).css('display','block');
		if(_list.length > 1) _t = setTimeout(function(){ changeEl();}, change_t);
		var _ind;
		function changeEl(){
			if(_t) clearTimeout(_t);
			if(_a == _list.length - 1) _ind = 0;
			else _ind = _a + 1;
			_list.eq(_a).removeClass('active').fadeOut(500);
			_list.eq(_ind).addClass('active').fadeIn(500);
			change_t = Math.floor(Math.random() * 2000) + 3000;
			_t = setTimeout(function(){ changeEl();}, change_t);
			_a = _ind;
		}
		var _slidebox = _el.find('.slidebox').css({top: _el.height()-53});
		_el.mouseenter(function(){
			_slidebox.show().animate({top:0}, {queue:false, duration:500});
		}).mouseleave(function(){
			_slidebox.stop().animate({top: _el.height()-53}, 500);
		});
	});
});

function initHover()
{
	var nodes = document.getElementById("navigation");
	if (nodes)
	{
		nodes = nodes.getElementsByTagName("li");
		for (var i=0; i<nodes.length; i++)
		{
			nodes[i].onmouseover = function()
			{
				this.className += " hover";
			}
			nodes[i].onmouseout = function()
			{
				this.className = this.className.replace(" hover", "");
			}
		}
	}
}
if (document.all && !window.opera) attachEvent("onload", initHover);
