var api = {
	init: function() {
		menu1.init();
		$('#side div.img').each(function(){
			var s = $('#side').offset();
			var o = $(this).offset();
			var t = o.top - s.top;
			var h = $('#wrap2').height() - t;
			$(this).css({ height: h + 'px' });
		});
		$('#products > li > div, #content .content1 > div').each(function(){
			var hp = $(this.parentNode).height();
			var hm = $(this).height();
			if (hm < hp - 5) {
				$(this).css({ 'margin': Math.floor((hp - hm) / 2) + 'px 0 0' });
			}
		});
	}
};
var menu1 = {
	active: null, t: null,
	init: function() {
		$('#menu > ul > li:has(ul)').bind('mouseenter', function(){
			menu1.show(this);
		}).bind('mouseleave', function(){
			menu1.hide(this);
		});
	},
	show: function(li) {
		if ($.browser.msie && ($.browser.version <= 7))
		{
			$('#content h1').css({ visibility: 'hidden' });
			$('ul', li).show();
		}
		else 
		{
			$('#content h1').fadeTo(20, 0.05);
			$('ul', li).fadeIn(300);
		}
		if (menu1.t)
		{
			clearTimeout(menu1.t);
			menu1.t = null;
		}
	},
	hide: function(li) {
		if ($.browser.msie && ($.browser.version <= 7))
		{
			$('ul', li).hide();
		}
		else 
		{
			$('ul', li).fadeOut(200);
		}
		menu1.t = setTimeout(menu1.finished, 250);
	},
	finished: function() {
		if ($.browser.msie && ($.browser.version <= 7))
		{
			$('#content h1').css({ visibility: 'visible' });
		}
		else
		{
			$('#content h1').fadeTo(20, 1);
		}
	}
};
$(document).ready(api.init);