/*
 * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
 *
 * Copyright (c) 2007 George Smith
 * Licensed under the MIT License:
 *   http://www.opensource.org/licenses/mit-license.php
 */
jQuery.easing['jswing']=jQuery.easing['swing'];jQuery.extend(jQuery.easing,{def:'easeOutQuad',swing:function(x,t,b,c,d){return jQuery.easing[jQuery.easing.def](x,t,b,c,d)},easeInQuad:function(x,t,b,c,d){return c*(t/=d)*t+b},easeOutQuad:function(x,t,b,c,d){return-c*(t/=d)*(t-2)+b},easeInOutQuad:function(x,t,b,c,d){if((t/=d/2)<1)return c/2*t*t+b;return-c/2*((--t)*(t-2)-1)+b},easeInCubic:function(x,t,b,c,d){return c*(t/=d)*t*t+b},easeOutCubic:function(x,t,b,c,d){return c*((t=t/d-1)*t*t+1)+b},easeInOutCubic:function(x,t,b,c,d){if((t/=d/2)<1)return c/2*t*t*t+b;return c/2*((t-=2)*t*t+2)+b},easeInQuart:function(x,t,b,c,d){return c*(t/=d)*t*t*t+b},easeOutQuart:function(x,t,b,c,d){return-c*((t=t/d-1)*t*t*t-1)+b},easeInOutQuart:function(x,t,b,c,d){if((t/=d/2)<1)return c/2*t*t*t*t+b;return-c/2*((t-=2)*t*t*t-2)+b},easeInQuint:function(x,t,b,c,d){return c*(t/=d)*t*t*t*t+b},easeOutQuint:function(x,t,b,c,d){return c*((t=t/d-1)*t*t*t*t+1)+b},easeInOutQuint:function(x,t,b,c,d){if((t/=d/2)<1)return c/2*t*t*t*t*t+b;return c/2*((t-=2)*t*t*t*t+2)+b},easeInSine:function(x,t,b,c,d){return-c*Math.cos(t/d*(Math.PI/2))+c+b},easeOutSine:function(x,t,b,c,d){return c*Math.sin(t/d*(Math.PI/2))+b},easeInOutSine:function(x,t,b,c,d){return-c/2*(Math.cos(Math.PI*t/d)-1)+b},easeInExpo:function(x,t,b,c,d){return(t==0)?b:c*Math.pow(2,10*(t/d-1))+b},easeOutExpo:function(x,t,b,c,d){return(t==d)?b+c:c*(-Math.pow(2,-10*t/d)+1)+b},easeInOutExpo:function(x,t,b,c,d){if(t==0)return b;if(t==d)return b+c;if((t/=d/2)<1)return c/2*Math.pow(2,10*(t-1))+b;return c/2*(-Math.pow(2,-10*--t)+2)+b},easeInCirc:function(x,t,b,c,d){return-c*(Math.sqrt(1-(t/=d)*t)-1)+b},easeOutCirc:function(x,t,b,c,d){return c*Math.sqrt(1-(t=t/d-1)*t)+b},easeInOutCirc:function(x,t,b,c,d){if((t/=d/2)<1)return-c/2*(Math.sqrt(1-t*t)-1)+b;return c/2*(Math.sqrt(1-(t-=2)*t)+1)+b},easeInElastic:function(x,t,b,c,d){var s=1.70158;var p=0;var a=c;if(t==0)return b;if((t/=d)==1)return b+c;if(!p)p=d*.3;if(a<Math.abs(c)){a=c;var s=p/4}else var s=p/(2*Math.PI)*Math.asin(c/a);return-(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b},easeOutElastic:function(x,t,b,c,d){var s=1.70158;var p=0;var a=c;if(t==0)return b;if((t/=d)==1)return b+c;if(!p)p=d*.3;if(a<Math.abs(c)){a=c;var s=p/4}else var s=p/(2*Math.PI)*Math.asin(c/a);return a*Math.pow(2,-10*t)*Math.sin((t*d-s)*(2*Math.PI)/p)+c+b},easeInOutElastic:function(x,t,b,c,d){var s=1.70158;var p=0;var a=c;if(t==0)return b;if((t/=d/2)==2)return b+c;if(!p)p=d*(.3*1.5);if(a<Math.abs(c)){a=c;var s=p/4}else var s=p/(2*Math.PI)*Math.asin(c/a);if(t<1)return-.5*(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b;return a*Math.pow(2,-10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p)*.5+c+b},easeInBack:function(x,t,b,c,d,s){if(s==undefined)s=1.70158;return c*(t/=d)*t*((s+1)*t-s)+b},easeOutBack:function(x,t,b,c,d,s){if(s==undefined)s=1.70158;return c*((t=t/d-1)*t*((s+1)*t+s)+1)+b},easeInOutBack:function(x,t,b,c,d,s){if(s==undefined)s=1.70158;if((t/=d/2)<1)return c/2*(t*t*(((s*=(1.525))+1)*t-s))+b;return c/2*((t-=2)*t*(((s*=(1.525))+1)*t+s)+2)+b},easeInBounce:function(x,t,b,c,d){return c-jQuery.easing.easeOutBounce(x,d-t,0,c,d)+b},easeOutBounce:function(x,t,b,c,d){if((t/=d)<(1/2.75)){return c*(7.5625*t*t)+b}else if(t<(2/2.75)){return c*(7.5625*(t-=(1.5/2.75))*t+.75)+b}else if(t<(2.5/2.75)){return c*(7.5625*(t-=(2.25/2.75))*t+.9375)+b}else{return c*(7.5625*(t-=(2.625/2.75))*t+.984375)+b}},easeInOutBounce:function(x,t,b,c,d){if(t<d/2)return jQuery.easing.easeInBounce(x,t*2,0,c,d)*.5+b;return jQuery.easing.easeOutBounce(x,t*2-d,0,c,d)*.5+c*.5+b}});

/*
 * jcommon.js v1.2
 *
 * Copyright (c) 2009 C.M.A. Co.,Ltd.
 * All rights reserved.
 * Last Added : 2009-04-08
 */
(function($){

	
	//URL解析
	location.linkArray=location.pathname.split('/');location.linkArray=location.linkArray.slice(1);var isLinkAry=new Array;var isLinkAry2=new Array;for(var i=1;i<=location.linkArray.length;i++){isLinkAry[i]=location.linkArray.slice(-i);isLinkAry[i]=isLinkAry[i].join('/');isLinkAry[i]=isLinkAry[i].replace(/\/index.*$/,"/")}location.linkArray=location.linkArray.slice(0,-1);for(var i=1;i<=location.linkArray.length;i++){isLinkAry2[i]=location.linkArray.slice(0,i);isLinkAry2[i]=isLinkAry2[i].join('/');isLinkAry2[i]=isLinkAry2[i].replace(/\/index.*$/,"");isLinkAry2[i]=isLinkAry2[i]+'/'}location.linkArray=isLinkAry.concat(isLinkAry2);
	//jcommon
	$.jcommon={preloader:{loadedImages:[],load:function(url){var img=this.loadedImages;var l=img.length;img[l]=new Image();img[l].src=url}},URI:function(path){path=path.replace(/^file:\/\/\//,"");path=path.replace(/^https[^a-z]*/,"");path=path.replace(/^http[^a-z]*/,"");path=path.replace(document.domain,"");path=path.replace(/^[\.|\/]*/,"");path=path.replace(/index.*$/,"");this.absolutePath=path;this.len=location.linkArray.length;this.isSelfLink=false;while(this.len--){this.isSelfLink=this.isSelfLink||(this.absolutePath==location.linkArray[this.len])}}};
	//ロールオーバー
	$.fn.addRollOver=function(add){$(this).filter('img').each(function(){$(this).runRollOver(add,$(this));}).end().not('img').each(function(){$(this).runRollOver(add,$(this).find('img'));});return this;};
	$.fn.runRollOver=function(add,target){$(this).each(function(num){this.originalSrc=String(target.attr('src'));this.rolloverSrc=this.originalSrc.replace(/(\.gif|\.jpg|\.png)/,add+"$1");}).hover(function(){target.attr('src',this.rolloverSrc);},function(){target.attr('src',this.originalSrc);});return this;};
	//現在のページへのリンク
	$.fn.addCurrentImages=function(add,flag){$(this).each(function(){var href=new $.jcommon.URI($(this).attr('href'));if(href.isSelfLink){$(this).addClass('current');$(this).unbind('mouseenter');$(this).unbind('mouseleave');if(flag){$(this).find('img').each(function(){$(this).unbind('mouseenter');$(this).unbind('mouseleave');this.currentSrc=this.getAttribute('src').replace(/(\.gif|\.jpg|\.png)/,add+"$1");$(this).attr('src',this.currentSrc)});}}});return this;};
	//画像popUp
	$.fn.imagePoper=function(){$(this).click(function(){var _x;var _y;var popImg;var _URL=$(this).attr("href");var floatingObj='#floatingWrapper,#floatingWindow';function closeEvent(){$('#floatingWindow').hide(250,function(){$(this).remove();$('#floatingWrapper').fadeOut(100,function(){$(this).remove()})});return false}$('body').append('<div id="floatingWrapper"></div>').append('<div id="floatingWindow"><p><img src="'+_URL+'" /></p><span class="closeBtn" href="">閉じる</span></div>');$('#floatingWrapper').css({display:"none",height:$('body').height()+'px'}).click(function(){closeEvent()}).fadeIn(250,function(){$('#floatingWindow').find('img').each(function(){var scTop=$.browser.opera?250:$(window).height()/2;popImg=$(this);_x=$(window).width()/2-popImg.width()/2;_y=scTop+$(window).scrollTop()-popImg.height()/2}).end().css({display:"none",top:_y+'px',left:_x+'px',width:popImg.width()+'px'}).show(250).click(function(){closeEvent()})});return false})};
	//ページpopUp
	$.fn.pagePoper=function(){$(this).each(function(){this.param=$(this).attr("href");this.param=this.param.split('?');this.param[1]=this.param[1].split('&');this.param[1]=this.param[1].join(',');$(this).attr("href","")}).click(function(){window.open(this.param[0],'popup',"menubar=1,location=1,resizable=1,status=1,"+this.param[1]);return false})};
	//するするアニメーション
	$.fn.easeScroller = function(d,e){$(this).click(function(){$($(this).attr('href'))||false$('html,body').animate({scrollTop:$($(this).attr('href')).offset().top},{duration:d,easing:e});return false;});}
	//要素全体にリンク
	$.fn.groupLink=function(){$(this).hover(function(){$(this).css({cursor:"pointer"});$(this).addClass('hover')},function(){$(this).removeClass('hover')}).click(function(){location.href=$(this).find('a').attr('href');return false})}
	//外部リンクは別ウインドウを設定
	$.fn.blankWindow=function(){$(this).addClass('externalLink').click(function(){window.open(this.href, '_blank');return false;});}
})(jQuery);

$(function(){

	
/*------------------------------------------------
	全体
------------------------------------------------*/

	//フォントリサイズ
	//	$("#subNav").after("<dl id='textResizer'><dt><img src='/shared/img/ti_fontsize.gif' alt='文字の大きさ' /></dt><dd><ul><li><a href='javascript:void(0);' onclick=\"textresize('83%','fontS');\" class='fontS'><img src='/shared/img/btn_font-s.gif' alt='小' /></a></li><li><a href='javascript:void(0);'  onclick=\"textresize('93%','fontM');\" class='fontM'><img src='/shared/img/btn_font-m.gif' alt='中' /></a></li><li><a href='javascript:void(0);'  onclick=\"textresize('110%','fontL');\" class='fontL'><img src='/shared/img/btn_font-l.gif' alt='大' /></a></li></ul></dd></dl>");
	$("#subNav").after("<div id='textResizer'><ul><li><a href='javascript:void(0);' onclick=\"textresize('65%','fontS');\" class='fontS'><img src='/shared/img/btn_resizer_s.gif' width='25' height='25' alt='小' /></a></li><li><a href='javascript:void(0);'  onclick=\"textresize('79%','fontM');\" class='fontM'><img src='/shared/img/btn_resizer_m.gif' width='25' height='25' alt='中' /></a></li><li><a href='javascript:void(0);'  onclick=\"textresize('100%','fontL');\" class='fontL'><img src='/shared/img/btn_resizer_l.gif' width='25' height='25' alt='大' /></a></li></ul></div>");

	//footerの上部のバナー群　外部モジュールロード
	$("#bottomBnrs").load('/shared/module/bottom_bnrs.html');
	

	$("body #main").add("body #sub").css("font-size",$.cookie('fsize'));
	//if($.cookie('fclass') == null){
	if($.cookie('fclass') == null){
		$("#textResizer a.fontM").find('img').each(function(){
			this.currentSrc = this.getAttribute('src').replace(/(\.gif|\.jpg|\.png)/, "_on$1");
			$(this).attr('src',this.currentSrc);
		});
	}
	$("#textResizer a").each(function(){
	 // ボタンを表示
		if($(this).attr('class') == $.cookie('fclass')){
			$(this).find('img').each(function(){
				this.currentSrc = this.getAttribute('src').replace(/(\.gif|\.jpg|\.png)/, "_on$1");
				$(this).attr('src',this.currentSrc);
			});
		}
	});

	//ロールオーバー
	$('a img.btn,a.btn,#globalNav li a,#subNav li a,#foreignNav li a').addRollOver('_on');
	//現在のページへのリンク
	$('#globalNav li a').addCurrentImages('_cr',true);	
	$('#localNav dl').find('dd a').addCurrentImages('_cr',false);	
	//要素全体にリンク
	$('li','#main .withArrowListM,.withArrowListS').add('.shopTable tbody tr','#main').add('#whatsnew dd','body#home').groupLink();
	//するするアニメーション
	//$('a[href^="#"]:not([href^="#tab"])').easeScroller(1000,"easeOutExpo");
	//画像popUp
	$('a[href$=".jpg"],area[href$=".jpg"],a[href$=".gif"]','#main').lightBox();
	
	
	//外部リンク
	$('a[href^="http://"]:not([href^="http://www.alpark.net/"],[href^="http://www.lalaport.jp/"],[href^="http://testwww.alpark.net/"],[href^="http://www.lalaport.co.jp/"],[href^="http://www.lalaport.net/"]),.extLink','#main,#sub,#header')
	.add('area[href^="http://"]:not([href^="http://www.alpark.net/"],[href^="http://testwww.alpark.net/"],[href^="http://www.lalaport.co.jp/"],[href^="http://www.lalaport.net/"]),.extLink','#main,#sub,#header').click(function(){
		//var message = $(this).attr('title');
		window.alert('ここから先はアルパークとは別のウェブサイトです。');
	});
	
	//外部リンク
	$('#bottomBnrs ul li a').click(function(){
		//var message = $(this).attr('title');
		alert("aaaa");
		window.alert('ここから先はアルパークとは別のウェブサイトです。');
	});
		
	
	
	//外部リンクは別ウインドウを設定
	var noBlank	=[	
				   	'[href^="http://www.alpark.net/"],[href^="http://www.lalaport.jp/"],[href^="http://testwww.alpark.net/"],[href^="http://www.lalaport.net/"]'
				 ];
	$('a[href$=".pdf"],a[href^="http://"]:not('+noBlank+')')
	.add('area[href$=".pdf"],area[href^="http://"]:not('+noBlank+')').blankWindow();
	$('a[href$=".pdf"],a[href^="http://www.adobe.com/"]').removeClass('externalLink');
	
	//pdfアイコン
	$('a[href$=".pdf"]').addClass('pdfLink').find('img').parent('a[href$=".pdf"]').removeClass('pdfLink');
	//linkクラス
	$('ul.list li').each(function(){
			if($(this).find('a').length !=0){
					$(this).addClass('link');
			}
		});


	//ショップカテゴリの写真アニメーション
	$('.thumbSelector a','#entries').toggle(function(){
		$(this).parents('#entries').find('.logo').queue('fx',[]).animate({ 
 	   marginTop: "-116px"
 		 },600,"easeOutExpo");
		$(this).text('ロゴで見る');
		return false;
	},function(){
		$(this).parents('#entries').find('.logo').queue('fx',[]).animate({ 
			marginTop: "0"
		},600,"easeOutExpo");
		$(this).text('写真で見る');
		return false;
	});
	
		
	//tablesorterを効かせる
	$(".shopTable","body.shop #main").add(".shopTable","body#aboHour #main").add(".shopTable","body.floor #main").each(function(){
		$(this).tablesorter({
			widgets: ['zebra'],
			sortList: [[0, 0]]
		});
		$(this).find('.header').css({cursor:"pointer"});
	}); 
	
	//footerPluginBanner
	$('.pluginBnrs','#footer').each(function(){
		$(this).find('li a').after('<p>当サイトにはAdobe Flash Playerを必要とするコンテンツが含まれております。<br/>ご覧いただけない方は、最新のプラグインをインストールしてご覧いただくことをオススメします。</p>');
	}); 
	
	
	//oddとevenを追加
	$("body.ranking #main #chart table tr")
		.filter(':odd').addClass('even').end().filter(':even').addClass('odd');
	
	//:first-child, :last-childをクラスとして追加
	//$('body#eveTowerrecord #main #chart table tr td').add("body#eveYajimaya #main #chart table tr td").filter(':last-child').addClass('lastChild');
	
	//n段組み
	//$('.col3 dd:nth-child(3n)').add('.col4 li:nth-child(4n)').addClass('clearMargin');


/*------------------------------------------------
	body#home トップページ
------------------------------------------------*/

	if($('body#home').length){
		//タブ
		$(' div#shopNews').imageTabs({
        animate: 'fadeIn',
        duration: 'slow',
        opentab: 'tabFashion'
    });
		// $('#mainVisual').before('<img src="img/jishin_message.gif" width="950" height="158" style="display:block;margin: 5px 0" />');
		
		$("#rotator > ul").tabs({fx:{opacity: "toggle"}}).tabs("rotate", 8000, true);
		
		$("ul#ticker").liScroll(); 
	}

	exeFlatheights();
});


function textresize(size,c){
 	// Cookie生成
	if(c != $.cookie('fclass')){
			$("body #main").add("body #sub").css("font-size",size);
			$.cookie("fsize",size,{expires:30,path:'/'});
			$.cookie("fclass",c,{expires:30,path:'/'});
		// Cookie内のclass値とボタンのclass値が同等なら反転
		$("#textResizer a").each(function(){
			if($(this).attr('class') == $.cookie('fclass')){
				$(this).find('img').each(function(){
					this.currentSrc = this.getAttribute('src').replace(/(\.gif|\.jpg|\.png)/, "_on$1");
					$(this).attr('src',this.currentSrc);
				});
			// 不等ならデフォルト状態に戻す
			}else if($(this).attr('class') != $.cookie('fclass')){
				$(this).find('img').each(function(){
					this.currentSrc = this.getAttribute('src').replace(/_on(\.gif|\.jpg|\.png)/, "$1");
					$(this).attr('src',this.currentSrc);
				});
			}
		});
		
	}
	exeFlatheights();
}


/*------------------------------------------------
	exeFlatheights flatheightsの設定
------------------------------------------------*/

function exeFlatheights(){
	// liを3つずつ高さを揃える
	$('.withArrowListM','body.news #category').add('.withArrowListM','body#home #shopNews #tabFashion').add('.shop','body.event #main').each(function(){
		var sets = [], temp = null;
		$(this).children('li').each(function(i){
			if (i % 3 == 0 && temp != null) {
				sets.push(temp);
				temp = [];
			}
			temp==null?temp=[]:'';
			temp.push(this);
			if($(this).parent('ul').children('li').length == i+1){
				sets.push(temp);
			}
		});
		if (temp == null) sets.push(temp);
		$.each(sets, function(){
			$(this).flatHeights();
		});
	});
	// liを4つずつ高さを揃える
	$('.withArrowListM','body.shop #entries').each(function(){
		var sets4 = [], temp4 = null;
		$(this).children('li').each(function(i){
			if (i % 4 == 0 && temp4 != null) {
				sets4.push(temp4);
				temp4 = [];
			}
			temp4==null?temp4=[]:'';
			temp4.push(this);
			if($(this).parent('ul').children('li').length == i+1){
				sets4.push(temp4);
			}
		});
		if (temp4 == null) sets4.push(temp4);
		$.each(sets4, function(){
			$(this).flatHeights();
		});
	});
}
