function resize() {
	var clientWidth = $(window).width();
	if(clientWidth < 1024) {
		jQuery('#main').css('width', '1024px');
	}
	else {
		jQuery('#main').css('width','100%');
	}
}

function showSub(id){
	jQuery('.mml').css('background-position', '0 0');
	for(var i=1; i<=3; i++){
		if(id != i){
			jQuery('#hm' + i).fadeOut(300);
		}
		
	}
	jQuery('#hm' + id).fadeIn(300);
	if(id == 3){
		jQuery('#hml2011').click();
		jQuery('#mml7').css('background-position', '0 -36px');
	}else{
		jQuery('#mml'+ id).css('background-position', '0 -36px');
	}
}

function showArch(id){
	if(id == 1){
		jQuery('#hml2010').css('text-decoration', 'underline');
		jQuery('#hml2011').css('text-decoration', 'none');
		jQuery('#hmr2011').hide();
		jQuery('#hmr2010').show();
	}
	if(id == 2){
		jQuery('#hml2011').css('text-decoration', 'underline');
		jQuery('#hml2010').css('text-decoration', 'none');
		jQuery('#hmr2010').hide();
		jQuery('#hmr2011').show();
	}
}
/*
$(document).ready(function() {
	$(window).resize(function() {resize();});
	$(window).trigger('resize');
	$('.mml').attr('processing', 'no');
	$('.glow').css('display', 'block');
	$('.glow').hide();

	$('.mml').mouseover(function() {
		if ($(this).attr('processing') == 'no') {
			$(this).attr('processing', 'yes');
			$('#' + $(this).attr('hover')).fadeIn(500);			     
		}
	});
	
	$('.mml').mouseout(function() {
		var id = '#' + $(this).attr('id');
		$('#' + $(this).attr('hover')).fadeOut(500, function() {$(id).attr('processing', 'no');});		     
	});
	jQuery('#mycarousel').jcarousel();
});*/

jQuery(document).ready(function() {
	jQuery(window).resize(function() {resize();});
	jQuery(window).trigger('resize');
/*
	$('.mml').hover(function() {
		$('#' + $(this).attr('hover')).stop();
		$('#' + $(this).attr('hover')).animate({opacity: 1});
	},
	function() {
		$('#' + $(this).attr('hover')).stop();
		$('#' + $(this).attr('hover')).animate({opacity: 0});
	});
	*/
	
	jQuery('#mycarousel').jcarousel();
	
	jQuery('#enterlink').click(function(){
		jQuery('#enterdiv, #enterdivbg').fadeIn(300);
		return false;
	});
	
	jQuery('#enterclose').click(function(){
		jQuery('#enterdiv, #enterdivbg').fadeOut(300);
		return false;
	});

	jQuery('#mml3,#mml4,#mml5,#mml6').hover(
			function(){
				jQuery('#hm1,#hm2,#hm3').fadeOut(100);
				jQuery('.mml').css('background-position', '0 0');
				jQuery(this).css('background-position', '0 -36px');
			},
			function(){
				jQuery(this).css('background-position', '0 0');		
			}
	);
	jQuery('#mml1').hover(
			function(){
				jQuery('#mml2,#mml3,#mml4,#mml5,#mml6,#mml7').css('background-position', '0 0');
				jQuery('#hm2,#hm3').fadeOut(100);
				jQuery(this).css('background-position', '0 -36px');
			},
			function(){
				setTimeout(	function(){
					jQuery('#mml1').css('background-position', '0 0');
				}, 50);		
			}
	);
	jQuery('#mml2').hover(
			function(){
				jQuery('#mml1,#mml3,#mml4,#mml5,#mml6,#mml7').css('background-position', '0 0');
				jQuery('#hm1,#hm3').fadeOut(100);
				jQuery(this).css('background-position', '0 -36px');
			},
			function(){
				setTimeout(	function(){
					jQuery('#mml2').css('background-position', '0 0');
				}, 50);		
			}
	);
	jQuery('#mml7').hover(
			function(){
				jQuery('#mml2,#mml3,#mml4,#mml5,#mml6,#mml1').css('background-position', '0 0');
				jQuery('#hm1,#hm2').fadeOut(100);
				jQuery(this).css('background-position', '0 -36px');
			},
			function(){
				setTimeout(	function(){
					jQuery('#mml7').css('background-position', '0 0');
				}, 50);		
			}
	);
	jQuery('#hm1').hover(
		function(){
			jQuery(this).fadeIn();
			jQuery('#mml1').css('background-position', '0 -36px');
		},
		function(){
			jQuery(this).fadeOut(100, function(){
				jQuery('#mml1').css('background-position', '0 0');
			});
		}
	);
	jQuery('#hm2').hover(
			function(){
				jQuery(this).fadeIn();
				jQuery('#mml2').css('background-position', '0 -36px');
			},
			function(){
				jQuery(this).fadeOut(100, function(){
					jQuery('#mml2').css('background-position', '0 0');
				});
			}
		);
	jQuery('#hm3').hover(
			function(){
				jQuery(this).fadeIn();
				jQuery('#mml7').css('background-position', '0 -36px');
			},
			function(){
				jQuery(this).fadeOut(100, function(){
					jQuery('#mml7').css('background-position', '0 0');
				});
				
			}
		);
	
});


