jQuery.noConflict()(function($){

	var preLoadImg = new Object();

// メインメニュー
	$('body.home #mainmenuhomeimg').css({opacity:"0"}).attr('src','/common_2010/pic/home-b_f2.jpg').animate({opacity:"1"}, 800 );
	$('body.regist #mainmenuregistimg').css({opacity:"0"}).attr('src','/common_2010/pic/regist-b_f2.jpg').animate({opacity:"1"}, 800 );
	$('body.coupon #mainmenucouponimg').css({opacity:"0"}).attr('src','/common_2010/pic/coupon-b_f2.jpg').animate({opacity:"1"}, 800 );
	$('body.modify #mainmenumodifyimg').css({opacity:"0"}).attr('src','/common_2010/pic/modify-b_f2.jpg').animate({opacity:"1"}, 800 );
	$('body.qanda #mainmenuqandaimg').css({opacity:"0"}).attr('src','/common_2010/pic/qanda-b_f2.jpg').animate({opacity:"1"}, 800 );
	$('body.inquiry #mainmenuinquiryimg').css({opacity:"0"}).attr('src','/common_2010/pic/inquiry-b_f2.jpg').animate({opacity:"1"}, 800 );
	$('body.terms_of_use #mainmenuterms_of_useimg').css({opacity:"0"}).attr('src','/common_2010/pic/terms_of_use-b_f2.jpg').animate({opacity:"1"}, 800 );
	$("#mainmenu li a,#submenu li a").each(function(){
		$(this).hover(
			function() {
				$(this).find('img').animate({ 
				opacity: 0.75}, 250 );
			},
			function() {
				$(this).find('img').animate({ 
				opacity: 1}, 250 );
			});
	});
	$('#globalmenu-tk img').css({opacity:"0"}).attr('src','https://common.ringerhut.co.jp/common_2010/pic/globalmenu-tokutoku-b_f2.jpg').animate({opacity:"1"}, 1000 );

// 店舗検索
	$('.searchresulttable tbody tr:odd td').css({background:"#f5f5f5"});
	$('.searchresulttable tbody tr:even td').css({background:"#ffffff"});
	$('.searchresulttable tbody tr').css('cursor','pointer').each(function(){
			var bg_str=$(this).children('td').css('background');				   
			$(this).hover(
			function() {
				$(this).children('td').css({background:"#ffffe5"});
			},
			function() {
				$(this).children('td').css({background:bg_str});
			});
		}).click(
		function() {
			var href_str=$(this).find('a').attr('href');
			location.href=href_str;
	});


// メニュー
	var body_id = $('body').attr('id');
	var over_num=1;
	if(body_id == 'recommendmenuimagepage'){ // オススメメニューイメージありの時のみ実行
		var recommendimagechangetimer;
		var recommendmenubox_num;

		$('#recommendmenubox > p.group').each(function(idx){
			var menu_pass_arr=$(this).children('a').attr('href').split("/");
			var menub_pos_x=idx*170+5;
			var group_num = idx+1;
			$(this).attr('id','group'+group_num).children('a').append('<img src="recommend/'+menu_pass_arr[1]+'/pic/menu-b.gif" class="recommendmenub" />')
			.children('.recommendmenub').css('left',menub_pos_x+'px');
			if(idx=='0') {
				$(this).find('.recommendimage').show();
				$(this).find('.recommendmenub').css({opacity:"0.5"});
			}
			recommendmenubox_num_max = group_num-1;
		}).hover(
		function() {
			clearInterval(recommendimagechangetimer);
		},function() {
			if(recommendmenubox_num_max>1){
				over_num = $('#recommendmenubox > p.group').index(this)+1
				set_timer();
			}
		});
		
		function set_timer(){
			recommendimagechangetimer = setInterval(
			function(){
				recommendimagehange();
			},5000);
		}
		$('#recommendmenubox > p.group > a > .recommendmenub').mouseover(
		function() {
			var now_num=$('#recommendmenubox > p.group > a > .recommendmenub').index(this)+1;
			if(now_num!=over_num){
				$('.recommendmenub').css({opacity:"1"});
				$(this).animate({ 
						opacity: 0.5}, 250 );
				$('.recommendimage').fadeOut(250);
				$(this).parent('a').find('.recommendimage').fadeIn(250);
				}
		});
		if(recommendmenubox_num_max>1){
			set_timer();
		}
		function recommendimagehange() {
			if(over_num>recommendmenubox_num_max){
				over_num=0;
			}
			$('.recommendmenub').css({opacity:"1"});
			$('#recommendmenubox > p.group:eq('+over_num+') > a > .recommendmenub').animate({ 
					opacity: 0.5}, 250 );
			$('.recommendimage').fadeOut(250);
			$('#recommendmenubox > p.group:eq('+over_num+') > a .recommendimage').fadeIn(250);
			over_num++;
		}
	}
	$('.recommendmenubox').css('cursor','pointer').click(
		function() {
			var href_str=$(this).find('a').attr('href');
			location.href=href_str;
	});
	$('.menubacknumberlist li').css('cursor','pointer').hover(
		function() {
			$(this).css({background:"#ffffe5"});
		},
		function() {
			$(this).css({background:"transparent"});
		}).click(
		function() {
			var href_str=$(this).find('a').attr('href');
			location.href=href_str;
	});
});


window.addEvent('domready', function(){
	//call multiBox
	var initMultiBox = new multiBox({
		mbClass: '.mb',//class you need to add links that you want to trigger multiBox with (remember and update CSS files)
		container: $(document.body),//where to inject multiBox
		descClassName: 'mbDesc',//the class name of the description divs
		path: './Files/',//path to mp3 and flv players
		useOverlay: true,//use a semi-transparent background. default: false;
		maxSize: {w:900, h:1000},//max dimensions (width,height) - set to null to disable resizing
		addDownload: false,//do you want the files to be downloadable?
		pathToDownloadScript: './Scripts/ForceDownload.asp',//if above is true, specify path to download script (classicASP and ASP.NET versions included)
		addRollover: true,//add rollover fade to each multibox link
		addOverlayIcon: true,//adds overlay icons to images within multibox links
		addChain: false,//cycle through all images fading them out then in
		recalcTop: true,//subtract the height of controls panel from top position
		addTips: true//adds MooTools built in 'Tips' class to each element (see: http://mootools.net/docs/Plugins/Tips)
	});
});

