jQuery(function(){

	/**
	 * main
	 */

	$('<a />',{'href': $('#main ul a:eq(0)').attr('href')}).prependTo('#main h2');
	
	$('#main h2 img').prependTo('#main h2 a');
	

	$('#main ul a').each(function(i) {
		
		if(i !== 0){
			$('<img />',{
				'src': './images/top' + i + '.jpg',
				'alt': $(this).find('img').attr('alt')}
			).appendTo('#main h2 a').css('opacity', 0);
		} else {
			$(this).hover(function(){
				$('h2 img:eq(0)').attr('src','./images/top0.jpg');
			});			
		}
		

		$(this).hover(
			function(){
				$('#main h2 a').attr('href', $(this).attr('href'));
				$('#main h2 img:not(#main img:eq('+ i+'))').stop(true, false).fadeTo(500, 0);
				$('#main h2 img:eq('+ i +')').stop(true, false).fadeTo(500, 1);
			},
			function (){}
		);
		
	});



	
});

