function initPage(){
	$('#nav li').hover(function(){
		$(this).addClass('hover');
	},function(){
		$(this).removeClass('hover');
	});
}
if (window.attachEvent && !window.opera)
	window.attachEvent("onload", initPage);

$(function(){
	$('ul#nav li').hover(function(){
		if($(this).hasClass('multiple')) {
	// first drop down
			$(this).find('.drop').css('display','block');
			var _drop = $(this).find('.drop');
			var _minUlWidth = 0;
			
			// dropdown width
			_drop.find('a').each(function(){
				if($(this).width()>_minUlWidth) _minUlWidth = $(this).width();
			});
			_drop.find('.area').css('width',_minUlWidth*4+150);
			_drop.css('width',_minUlWidth*4+170);
			
			// dropdown height
			_drop.find('.area').each(function(){
				var _minUlHeight = 0;
				$(this).find('ul').each(function(){
					if($(this).height()>_minUlHeight) _minUlHeight = $(this).height();
				});
				_drop.find('.column').each(function(){
					$(this).css('height',_minUlHeight);
				});
				$(this).css('height',_minUlHeight+15);
			});

			_drop.find('.column').each(function(){
				$(this).css('width',_minUlWidth+10);
			});
			
			// right shadow span height
			_drop.find('.drop-hold span.right').css('height',0);
			_drop.find('.drop-hold span.right').css('height',_drop.height()-16);
		}else{
	// multilevel
			$(this).children('.drop1').css('display','block');
			var _drop = $(this).find('.drop1');
			var _minUlWidth = 0;
			setTimeout(function(){
				_drop.each(function(){
					$(this).find('a').each(function(){
						if($(this).width()>_minUlWidth) _minUlWidth = $(this).width();
					});
					// multilevel width
					$(this).css({
						'width':_minUlWidth+45
					});
					if($(this).parent().parent().hasClass('navigation')){
						$(this).find('.top').css({
							'width':_minUlWidth+45
						});
						$(this).find('.bottom').css({
							'width':_minUlWidth+45
						});
					}else{
						$(this).find('.top').css({
							'width':_minUlWidth+44
						});
						$(this).find('.bottom').css({
							'width':_minUlWidth+44
						});
					}
					// multilevel height
					$(this).find('.drop-hold span.right').each(function(){
						if($(this).parent().is('.drop-hold')) {
							$(this).css('height','auto');
							$(this).css('height',_drop.height()-16);
						}
					});
				});
			},5);
		}
	},function(){
		$(this).find('.drop').css('display','none');
	});
});