jQuery.noConflict();
(function($) {

$(document).ready(function(){
	$(function() {
		$('table.xc_calendar tr:not(:first) td').css({'background-color':'#cce5c2'});
		$('table.xc_calendar tr:not(:first)').each(function() {
			$(this).find('td:first').css({'background-color':'#e2f0dc'});
		});
		$('.xc_cartInfo div.xc_toRegister a').html('').append('<img src="//xc525.eccart.jp/j477/img/btn_regi.gif" width="58" heihgt="17" alt="レジへ進む" style="margin:5px 0 0 6px;" />');
		$('.xc_searchBlockBody ul li').each(function (){
			if ($('.xc_searchBlockBody ul li').index(this) == 2) $(this).prepend('<img src="//xc525.eccart.jp/j477/img/freeword.gif" width="101" heihgt="14" alt="フリーワード検索" style="margin:2px 0 6px;" />');
			if ($('.xc_searchBlockBody ul li').index(this) == 3) $(this).css({'display':'none'});
			if ($('.xc_searchBlockBody ul li').index(this) == 4) $(this).css({'margin-bottom':'0'});
		});
		$('.xc_itemDataBox').each(function(){
			if ($('.xc_itemDataBox').index(this) % 3 == 2) $(this).css({'margin-right':'0'});
			$(this).find('img').attr('src',$(this).find('img').attr('src').replace('_s','_l'));
			var href = $(this).find('.xc_productName a').attr('href');
			$(this).append('<div class="btndetail"><a href="'+href+'"><img src="//xc525.eccart.jp/j477/img/btn_detail.gif" width="163" height="33" alt="詳細を確認" /></a></div>');
		});
		$('.xc_itemList .xc_tdPrice').prepend('<span style="font-weight:normal;color:#333333;">価格：　</span>');
		if ($('.xc_login input').length == 0) {
			$('.xc_login').css({'background-image':'url(//xc525.eccart.jp/j477/img/logoutbox.gif)','padding-left':'14px'});
			$('.xc_login a').each(function(){
				if ($('.xc_login a').index(this) == 0) $(this).html('').append('<img src="//xc525.eccart.jp/j477/img/btn_mypage.gif" width="88" height="29" alt="MYページ" style="margin-left:40px;position:relative;top:-7px;" />');
				if ($('.xc_login a').index(this) == 1) $(this).html('').append('<img src="//xc525.eccart.jp/j477/img/btn_logout.gif" width="89" height="29" alt="ログアウト" style="margin-left:8px;position:relative;top:-7px;" />');
			});
			$('.xc_login .xc_loginBody').append('<a href="https://xc525.eccart.jp/j477/mypage_entry_form/"><img src="//xc525.eccart.jp/j477/img/btn_freereg.gif" width="160" height="40" alt="会員登録無料CLICK" style="position:absolute;top:13px;left:586px;" /></a>');
		} else {
			$('.xc_login form').append('<input type="image" src="//xc525.eccart.jp/j477/img/btn_login.gif" style="position:absolute;top:13px;left:218px;" /><a href="https://xc525.eccart.jp/j477/forward_mypage_index/"><img src="//xc525.eccart.jp/j477/img/btn_mypage.gif" width="88" height="29" alt="MYページ" style="position:absolute;top:14px;left:314px;" /></a><a href="https://xc525.eccart.jp/j477/mypage_entry_form/"><img src="//xc525.eccart.jp/j477/img/btn_freereg.gif" width="160" height="40" alt="会員登録無料CLICK" style="position:absolute;top:13px;left:586px;" /></a>');
		}
		$('#betapanel .xc_productList .xc_productListBox').each(function() {
			$(this).find('.xc_productListAmount input').before($(this).find('.xc_productListImage .xc_productListLink input'));
		});
		$('.xc_productDetailData1 .xc_tdPrice').appendTo($('.xc_productDetailData1 .xc_thPrice'));
		$('.xc_tdPrice').css('display','inline').css('float','none');

		$('.hover img').hover(function(){
			var src = $(this).attr('src');
			$(this).attr('src',src.replace(/(\.\w+)$/,'_o$1'));
		},function(){
			var src = $(this).attr('src');
			$(this).attr('src',src.replace(/_o(\.\w+)$/,'$1'));
		});
		// banners
		$.get('/images/banner/banners.html',function(data){
			$(data).find('#joypalbanners').appendTo('body');
			$('#joypalbannerstag').click(toggleJoypalBanner).hover(function(){
				var src = $(this).attr('src');
				$(this).attr('src',src.replace(/(\.\w+)$/,'_o$1'));
			},function(){
				var src = $(this).attr('src');
				$(this).attr('src',src.replace(/_o(\.\w+)$/,'$1'));
			});
		});
	});
});

var joypalbannersview = true;
function toggleJoypalBanner() {
	if (!joypalbannersview) {
		showJoypalBanner();
	} else {
		hideJoypalBanner();
	}
}
function showJoypalBanner() {
	$('#joypalbannerstag').attr('src','/images/banner/close.png');
	$('#joypalbanners').stop().animate({bottom:'0'},500);
	joypalbannersview = true;
	//joypelbannertimer = null;
}
function hideJoypalBanner() {
	$('#joypalbannerstag').attr('src','/images/banner/open.png');
	$('#joypalbanners').stop().animate({bottom:'-78px'},500);
	joypalbannersview = false;
}

})(jQuery);

