// JavaScript Document
document.write('<!--[if lt IE 7]>');
document.write('<script type="text/javascript" src="/js/jquery.belatedPNG.min.js"><\/script>');
document.write('<![endif]-->');

$(document).ready(function(){
if ($.browser.msie && $.browser.version < 7){
$(".png,#wrap,#logo").fixPng();
}

if ($.browser.msie )
{
$("a").focus(function(){
$(this).blur();
});
$("img").attr("title","");
}

$("#navi").find("li").each(function(){
var c = $(this).attr("class");
$(this).find("a").hover(
function () {
$("body").removeClass("all one six od acc")
$("body").addClass("hide")
$("body").addClass(c)
$("#sub_navi").find("span").removeClass("one six od acc")
$("#sub_navi").find("span").addClass(c)
},
function () {
}
);									
});

/*wink*/
$("a.btn_r img,#online_shop a img,#bana_sec img,.btn").hover(function(){
$(this).css("opacity", "0.5");
$(this).fadeTo("slow", 1.0);
},
function(){}
);

/*FAQ scroll*/
var tag = $("#faq_sec").find(".two_boxs").find("li").find("a");
tag.each(function(i){
var ii = i+1;
$(this).click(function(){
 
	 var basepos = $("#flex_contentwrapper").position().top;//全体の位置
	 var vpos = $(".box"+ii).position().top;//アイテム毎の位置
	 var pos = basepos-vpos;
	 
	 var baseh = $("#flex_contentwrapper").height();//全体の高さ
	 var frameh = $(".flexcroll").height();//frameの高さ
	 var per = frameh/baseh;//比率
	 var bar_pos = vpos*per;
    
$("#flex_contentwrapper").animate({ top: "-"+vpos+"px" }, 300); //animeで大体配置
	
var flex = document.getElementById('flex');  
flex.fleXcroll.setScrollPos(false,vpos); //元々の設定で正確に配置

});
});
/*FAQ scroll END*/

/*li decimal-leading-zero*/
if ($.browser.msie && $.browser.version < 8)
{
var tag = $("#faq_sec").find(".two_boxs").find("li").find("a");
tag.each(function(i){
var ii = gf_TimeFormat(i+1)+". ";
$(this).text(ii+$(this).text()).css("margin-left","-24px")
});
function gf_TimeFormat(aparam){
  return ret = 
    (
       function(astr){
         return astr.substr(astr.length-2,2);
       }("00" + aparam.toString())
    );
}
}

$("#sub_navi span:first").attr("class","png "+$('body').attr('class'))

//$("#sub_navi").find("li.od:eq(3)").append("<p class='miniico'>new</p>").addClass("ico_p");
//
//$("#list_sec_one").find("h2:last").append("<p class='miniico'>new</p>").addClass("ico_p");
//
//$("body.quest_jillstuart").find("#main").find(".pr_ttl").append("<p class='miniico'>new</p>").addClass("ico_p");

//$("body.quest_sport").find(".color").find(".bro_dee").append("<p class='miniico'>new</p>").addClass("ico_p");




crrent();

});/////////readyEND

function fx(){
var flex = document.getElementById('flex');  
flex.fleXcroll.setScrollPos(false,200);
console.log(flex.fleXdata.scrollPosition)
}

function crrent(){
var href = location.href.split(/[#?]/)[0];
var href = href.replace(/[/]$/,'/index.html');
var href = href.replace(/.*\//,'');

$("a").each(function() {
var myhref = this.href;
var myhref = myhref.replace(/[/]$/,'/index.html');
var myhref = myhref.replace(/.*\//,'');

if (href==myhref){
$(this).addClass("current");
}
});//each
}

/*
CSS Browser Selector v0.3.1
Rafael Lima (http://rafael.adm.br)
*/
function css_browser_selector(u){var ua = u.toLowerCase(),is=function(t){return ua.indexOf(t)>-1;},g='gecko',w='webkit',s='safari',h=document.getElementsByTagName('html')[0],b=[(!(/opera|webtv/i.test(ua))&&/msie\s(\d)/.test(ua))?('ie ie'+RegExp.$1):is('firefox/2')?g+' ff2':is('firefox/3')?g+' ff3':is('gecko/')?g:/opera(\s|\/)(\d+)/.test(ua)?'opera opera'+RegExp.$2:is('konqueror')?'konqueror':is('chrome')?w+' '+s+' chrome':is('applewebkit/')?w+' '+s+(/version\/(\d+)/.test(ua)?' '+s+RegExp.$1:''):is('mozilla/')?g:'',is('j2me')?'mobile':is('iphone')?'iphone':is('ipod')?'ipod':is('mac')?'mac':is('darwin')?'mac':is('webtv')?'webtv':is('win')?'win':is('freebsd')?'freebsd':(is('x11')||is('linux'))?'linux':'','js']; c = b.join(' '); h.className += ' '+c; return c;}; css_browser_selector(navigator.userAgent);
//* CSS Browser Selector  END


/*====================================================================================================
//////////////////////////////////////////////////////////////////////////////////////////////////////

 Author : http://www.yomotsu.net
 created: 2007/03/13
 update : 2008/01/21
 Licensed under the GNU Lesser General Public License version 2.1

//////////////////////////////////////////////////////////////////////////////////////////////////////
====================================================================================================*/
var yomotsuRollover = {

main : function() {
	var img = document.images, ipt = document.getElementsByTagName('input'), i, preLoadImg = [];
	// img elements
	for (i = 0; i <img.length; i++) {
		if ((img[i].src.match(/.*_n\./))||(img[i].style.filter)){
			preLoadImg[preLoadImg.length] = new Image;
			preLoadImg[preLoadImg.length-1].src = img[i].src.replace('_n.', '_r.');

			img[i].onmouseover = yomotsuRollover.over;
			img[i].onmouseout  = yomotsuRollover.out;
			
			try {img[i].addEventListener('click', yomotsuRollover.click, false);}
			catch(e){img[i].attachEvent('onclick', (function(el){return function(){yomotsuRollover.click.call(el);};})(img[i]));}
		}
	}
	// input[image] elements
	for (i = 0; i <ipt.length; i++) {
		if ((ipt[i].src.match(/.*_n\./))&&(ipt[i].getAttribute('type')=='image')){
			preLoadImg[preLoadImg.length] = new Image;
			preLoadImg[preLoadImg.length-1].src = img[i].src.replace('_n.', '_r.');

			ipt[i].onmouseover = yomotsuRollover.over;
			ipt[i].onmouseout  = yomotsuRollover.out;
			try {ipt[i].addEventListener('click', yomotsuRollover.click, false);}
			catch(e){ipt[i].attachEvent('onclick', (function(el){return function(){yomotsuRollover.click.call(el);};})(ipt[i]));}
		}
	}
}
,

over : function() {
	var imgSrc, preLoadImgSrc;
	if((this.style.filter)&&(this.style.filter.match(/_n\.png/)))//(IE5.5-6 && png)
		this.style.filter = this.style.filter.replace('_n.png', '_r.png');
		
	else
		this.src = this.src.replace('_n.', '_r.');
},

out : function(){
	if((this.style.filter)&&(this.style.filter.match(/_r\.png/))&&(this.className !="no"))//(IE5.5-6 && png)
		this.style.filter = this.style.filter.replace('_r.png', '_n.png');

	else
		this.src = this.src.replace('_r.', '_n.');
},

click : function(){
	if((this.style.filter)&&(this.style.filter.match(/_r\.png/)))//(IE5.5-6 && png)
		this.style.filter = this.style.filter.replace('_r.png', '_n.png');

	else
		this.src = this.src.replace('_r.', '_n.');
},

addEvent : function(){
	try {
		window.addEventListener('load', this.main, false);
	} catch (e) {
		window.attachEvent('onload', this.main);
	}
}
}

yomotsuRollover.addEvent();


