$(document).ready(function(){
var bodyid = $("body").attr("id");

$(".SnsLinks").SnsLinks();

if (bodyid=='home'){
	swfobject.embedSWF("/cmn/swf/main_img_940x440.swf", "topFlash", "940", "440", "9.0.0");
	informationXML("#informationxml","/love/top.xml")

	if ($.browser.msie && $.browser.version == 6.0){
	}else{
	$("#home ul.leftLinks li,div.pickupitem,div.informations,#home ul.banners li").each(function(i){$(this).delay(i*200).animate({opacity:1},750)});
	}
	$("#home ul.leftLinks li a,div.pickupitem p.btn a,#home div.informations p a,#home div.informations h2.info a").mouseover(function(){$(this).animate({opacity:1},'fast')}).mouseout(function(){$(this).animate({opacity:0},'fast')});
	$('div.pickupitem dl a').mouseover(function(){$(this).animate({opacity:0.8},'fast')}).mouseout(function(){$(this).animate({opacity:1.0},'fast')});
	$(".tweetCont").tweet({username:["love_lesouk"],count:1,avatar_size:53,loading_text:"Now Loading..."});
	
	$(".pickupitem dd.new span").newmark();
	
}else{
swfobject.embedSWF("/cmn/swf/logo_156x156.swf", "logo", "156", "156", "9.0.0");
$("#aside ul.navi li a,#styling #article ul.stylelinks li a").mouseover(function(){$(this).animate({opacity:1},'fast')}).mouseout(function(){$(this).animate({opacity:0},'fast')});

}

if(bodyid=='styling'){

	$("ul.stylelinks li a").click(function(){
		var rel = $(this).attr("rel");
		$('html,body').animate({scrollTop:0},{duration:500,easing:"swing",complete:function(){
			$("ul.stylelinks").animate({height:962,opacity:0},{duration:750,easing:"easeOutExpo",
					    complete:function(){
						$("ul.stylelinks").css("z-index",0);						
			}})
			$("#styling #article div.style."+rel).fadeIn().addClass("now");
		}});	
		return false;
	});
	
	$("#styling #article div.style div.inner ul.btns li.close a").click(function(){
		$("ul.stylelinks").animate({height:1534,opacity:1},{duration:750,easing:"easeOutExpo",
					    complete:function(){
						$("ul.stylelinks").css("z-index",50);						
			}})
		$("#styling #article div.style").fadeOut();
		return false;
	});
	
	$("#styling #article div.style div.inner ul.btns li.next a,#styling #article div.style div.inner ul.btns li.prev a").click(function(){
		if($(this).hasClass("off")){
			return false;
		}else{
		var rel = $(this).attr("rel");
		$("#styling #article div.style.now").fadeOut().removeClass("now");
		$("#styling #article div.style."+rel).fadeIn().addClass("now");
		return false;
		}
	});

}

if(bodyid=='pickupitem'){
	$(window).load(function(){
		$('#pickupitem ul.itemList li p.txt').heightfix({clear:4});
		$("#pickupitem ul.itemList li").each(function(i){
			$(this).delay(i*200).animate({opacity:1},{duration:750,easing:"swing",	complete:function(){
				$(this).find("a").append("<span></span>")
			}})
		});
		$("#pickupitem ul.itemList li a").mouseover(function(){
			$(this).find("span").addClass("hover");
				if ($.browser.msie && $.browser.version == 6.0){
				}else{
				$(this).find("img").animate({opacity:0.7},'fast');
				}
		}).mouseout(function(){
			$(this).find("span").removeClass("hover");
				if ($.browser.msie && $.browser.version == 6.0){
				}else{
				$(this).find("img").animate({opacity:1},'fast');
				}
		});
	});
}

//End
});

/*  ================================================================================
heightfix JavaScript MIT-style license.
2011 Kazuya Abe // http://ossi.co.jp/
$('#gallery ul.index li').heightfix();	：	一番高い要素に揃える
$('#gallery ul.index li').heightfix({clear:5});		5個ずつ高さ揃え
$('#gallery ul.index li').heightfix({tc:'turn'});	:	折り返し	class="turn"
$('#gallery ul.index li').heightfix({sc:'start'});	:	各行開始	class="start"
================================================================================  */
(function($,s){
var s=0;
$.fn.heightfix=function(options){
var options = jQuery.extend({
clear: 9999,
tc:'turn',
sc:'start'
},options);
var m=0; var n=0; s++;
if(options.clear==0||options.clear==null){clear=9999};
$(this).each(function(i){i++;
if(i%options.clear==0){$(this).addClass(options.tc);}
if(i%options.clear==1){n++; $(this).css('clear','both').addClass(options.sc)}
$(this).addClass('heightfixgroup'+ s + n);
});
for(m=1;m<=n;m++){var mt=0;
$(".heightfixgroup"+s+m).each(function(){
var thisHeight = $(this).height();
if(thisHeight>mt){mt=thisHeight};
});
$(".heightfixgroup"+s+m).height(mt);
};
};
})(jQuery);


/*  ================================================================================
・blank
・IE クリックライン消
・イメージロールオーバー　テキスト＆背景画像用
================================================================================  */
$(document).ready(function () {
$('.blank').click(function(){window.open(this.href, '_blank');return false;});
$("a").focus(function(){$(this).blur();});
$('a img.rollover,a.rollover').mouseover(function(){$(this).animate({opacity:0.8},'fast')}).mouseout(function(){$(this).animate({opacity:1.0},'fast')});
});

/*  ================================================================================
イメージロールオーバー スワップ
================================================================================  */
var preLoadImg = new Object();
function initRollOvers(){
$("a img.imgRollover,#footer ul li a img").each(function(){
var imgSrc = this.src;
var sep = imgSrc.lastIndexOf('.');
var onSrc = imgSrc.substr(0, sep) + '_o' + imgSrc.substr(sep, 4);
preLoadImg[imgSrc] = new Image();
preLoadImg[imgSrc].src = onSrc;
$(this).hover(
function() { this.src = onSrc; },
function() { this.src = imgSrc; }
);
});
}
$(function(){
initRollOvers();
});


/*  ================================================================================
SNS エントリーリスト 
================================================================================  */
(function($){
$.fn.SnsLinks = function(options){

return this.each(function(i){

var url = $(this).find(".url").text();
var title = $(this).find(".title").text();

if(url==null){url == location.href;}
if(title==null){title == $("head").find("title").text()}

var snshtml = "<ul class='sns'>";
var encurl = encodeURIComponent(url);

// Twitter
var twitterattr = 'data-url="'+ url +'" data-text="'+ title +'" data-count="horizontal" data-lang="ja"';
var twittertag  = '<li class="twitter"><a href="http://twitter.com/share" class="twitter-share-button"' + twitterattr + '>Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></li>';
snshtml += twittertag;


// Face Book
var fcw =110;
var fch =20;
var facebooktag = '<li class="facebook"><iframe src="http://www.facebook.com/plugins/like.php?href=' + encurl + '&amp;layout=button_count&amp;show_faces=true&amp;width=' + fcw + '&amp;action=like&amp;font&amp;colorscheme=light&amp;height=' + fch + '" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:' + fcw + 'px; height:' + fch + 'px;" allowTransparency="true"></iframe></li>';
snshtml += facebooktag;


snshtml += "</ul>";

$(this).append(snshtml);
	
});

};
	
})(jQuery);

/*-----------------------------------------------------
スムーズスクロール
-----------------------------------------------------*/
jQuery.fn.extend({
scrollTo : function(speed, easing) {
if(!$(this)[0].hash || $(this)[0].hash == "#") {
return false;
}
return this.each(function() {
var targetOffset = $($(this)[0].hash).offset().top;
$('html,body').animate({scrollTop: targetOffset}, speed, easing);
});
}
});

$(document).ready(function(){
$('p.pageTop a').click(function() {
$(this).scrollTo(1000);
return false;
});
});

/*  ================================================================================
ポップアップ
================================================================================  */
(function($) {
$.fn.openwin = function(settings) {
settings = jQuery.extend({
option		: {
width		: false,
height		: false,
top			: false,
left		: false,
menubar		: "no",
toolbar		: "no",
location	: "no",
status		: "no",
resizable	: "no",
scrollbars	: "no",
directories	: "no",
titlebar	: "yes",
fullscreen	: "no"
},
target		: "_blank",
blur		: false,
focus		: false
}, settings);

this.click(function() {
var options = [];
if($(this).attr("rel")) {
var rel = $(this).attr("rel").split(",");
var reloption = {};
for(var i in rel) {
var a = rel[i].split("=");
reloption[a[0]] = a[1];
}
}
for(var k in settings.option) {
var v = settings.option[k];
if(reloption) {
if(reloption[k]) {
v = reloption[k];
}
}
if(v != false) {
options.push(k + "=" + v);
}
}
var target = settings.target;
if(reloption) {
if(reloption["target"]) {
target = reloption["target"];
}
}
var win = window.open($(this).attr("href"), target, options.join(","));
if(settings.blur == true) {
win.blur();
}
if(settings.focus == true) {
win.focus();
}
return false;
});
}
})(jQuery);

$(document).ready(function(){
var pop_w = 673;
var pop_h = 500;
var screen_w = screen.width;
var screen_h = screen.height;
var win_w = ((screen_w-pop_w)/2);
var win_h = ((screen_h-pop_h)/2);
$('a.shop_popup').openwin({option:{width:pop_w,height:pop_h,left:win_w,top:win_h,scrollbars:"yes",location:"no",directories:"no"},target:"popup",focus:true});
});


/*
 * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
 *
 * Uses the built in easing capabilities added In jQuery 1.1
 * to offer multiple easing options
 *
 * TERMS OF USE - jQuery Easing
 * 
 * Open source under the BSD License. 
 * 
 * Copyright © 2008 George McGinley Smith
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without modification, 
 * are permitted provided that the following conditions are met:
 * 
 * Redistributions of source code must retain the above copyright notice, this list of 
 * conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright notice, this list 
 * of conditions and the following disclaimer in the documentation and/or other materials 
 * provided with the distribution.
 * 
 * Neither the name of the author nor the names of contributors may be used to endorse 
 * or promote products derived from this software without specific prior written permission.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 *  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 
 * OF THE POSSIBILITY OF SUCH DAMAGE. 
 *
*/

// t: current time, b: begInnIng value, c: change In value, d: duration
jQuery.easing['jswing'] = jQuery.easing['swing'];

jQuery.extend( jQuery.easing,
{
	def: 'easeOutQuad',
	swing: function (x, t, b, c, d) {
		//alert(jQuery.easing.default);
		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;
	}
});

(function() {
	jQuery.fn.newmark = function(config){
		config = jQuery.extend({
			past: 168,
			icon: '<img src="/cmn/images/icn_new.gif" width="28" height="16" alt="NEW" />'
			},config);

		var currentDate = new Date();

		$(this).each(function(){
			var entryDay = $(this).attr('title');

			var day_array = entryDay.split(":");
			var entryDate = new Date(day_array[0], day_array[1]-1, day_array[2]);

			var diff = (currentDate.getTime() - entryDate.getTime())/(60*60*1000);
			diff = Math.ceil(diff);

			if( diff <= config.past ){
				$(this).after( config.icon );
			}
		});
	};
})(jQuery);

function informationXML(list,xml){
var xmlMain = "<dl class='info'>\n";

$.get(xml,function(data){
	$('entry',data).each(function(i){
		i++;
		var title       = $('title', this).text();
		var url         = $('link', this).text();
		var cont        = $('content', this).text();
		xmlMain += "<dt><a href='"+ url +"' target='_blank'>"+title+"</a></dt>";
		xmlMain += "<dd>"+cont+"</dd>";
	});
	xmlMain  +='</dl>\n';
	$(list).append(xmlMain);
	}).complete(function(){
	});
}


