var prevObject = null;

google.load("jquery", "1.4.2");
google.setOnLoadCallback(function() {	
	$('#header ul#main li ul').css('display','none');
	$('#header ul#main li a').not($('#header ul#main li ul a')).hover(function(){showSubNavi(this);});	
	$('#content').hover(function(){hideSubNavi(this);});	
	$('#keywords').focus(function(){$('#keywords').val('');});
	//$('#product_sub li a').click(function(){loadLiveContent(this.href);return false;});	
	
	$('#go_prev').click(function(){moveScroller(876); return false;});	
	$('#go_next').click(function(){moveScroller(-876); return false;});		
});


function moveScroller(where) {
	where = parseInt($('#modelscroller').css('left'))+where;
	if (where < 1) { 
		$('#modelscroller').animate({left: where}, 500);
	}
}

function loadLiveContent(that) {
	$('#livecontent').load(that);
}

function showSubNavi(that) {
	$('#mainimage div').fadeOut(100);
	$('#header ul#main li ul').css('display','none');
	$(prevObject).removeClass('overlay');
	prevObject = that.parentNode;
	$(that.parentNode).addClass('overlay');
	var theclass = $(that.parentNode).attr('class');
	theclass = theclass.replace('page_item ','.');
	theclass = theclass.replace('current_page_item','');
	theclass = theclass.replace('current_page_ancestor','');
	theclass = theclass.replace('overlay','');
	$(theclass+' ul').css('display','block');
}

function hideSubNavi(that) {
	$('#mainimage div').fadeIn(100);
	$('#header ul#main li ul').fadeOut(1000);
	$(prevObject).removeClass('overlay');
}
