// JavaScript Document

$(function () {



    //�^�[�Q�b�g�u�����N

    $("a.blank").click(function () {

        window.open(this.href);

        return false;

    });



//Mac ����

    if ($.os.name == 'mac') {

        if ($('#system')[0]) {



            $('#leftContents table').css({

                'font-size': '9px'

            });



            $('#blogBody ul#profileList').css({

                'font-size': '9px'

            });



            $('#schedule').css({

                'font-size': '9px'

            });

        }



        if ($('#blog')[0]) {

            $('#blogBody ul#profileList').css({

                'font-size': '9px'

            });



            $('#schedule').css({

                'font-size': '9px'

            });

			$('.blogFooter').css({

                'font-size': '9px'

            });

			

			

        }

		$('#footer').css({"font-size":"10px"})

    }

    if ($('#home')[0]) {

        $('#mainV').beforeAfter({

            animateIntro: true,

            introDelay: 1000,

            introDuration: 500,

            showFullLinks: false

        });

    }



    if ($('#salon')[0]) {

        var z = 0;

        var inAnimation = false;



        $('#pictures img').each(function () {

            z++;

            $(this).css('z-index', z);

        });



        function swapFirstLast(isFirst) {

            if (inAnimation) return false;

            else inAnimation = true;



            var processZindex, direction, newZindex, inDeCrease;



            if (isFirst) {

                processZindex = z;

                direction = '-';

                newZindex = 1;

                inDeCrease = 1;

            } else {

                processZindex = 1;

                direction = '';

                newZindex = z;

                inDeCrease = -1;

            }



            $('#pictures img').each(function () {

                if ($(this).css('z-index') == processZindex) {

                    $(this).animate({

                        'top': direction + $(this).height() + 'px',

                        'opacity': '0'

                    }, 'slow', function () {

                        $(this).css('z-index', newZindex).animate({

                            'top': '0'

                        }, 'slow', function () {

                            inAnimation = false;

                        }).animate({

                            'opacity': '1'

                        });

                    });

                } else {

                    $(this).animate({

                        'top': '0'

                    }, 'slow', function () {

                        $(this).css('z-index', parseInt($(this).css('z-index')) + inDeCrease);

                    });

                }

            });

            return false;

        }

        $('#next a').click(function () {

            return swapFirstLast(false);

        });

        $('#prev a').click(function () {

            return swapFirstLast(true);

        });

    }



    //Custom settings

    var style_in = 'easeOutBounce';

    var style_out = 'jswing';

    var speed_in = 1000;

    var speed_out = 300;



    //Calculation for corners

    var neg = Math.round($('.qitem').width() / 2) * (-1);

    var pos = neg * (-1);

    var out = pos * 2;



    $('.qitem').each(function () {



        url = $(this).find('a').attr('href');

        img = $(this).find('img').attr('src');

        alt = $(this).find('img').attr('img');



        $('img', this).remove();

        $(this).append('<div class="topLeft"></div><div class="topRight"></div><div class="bottomLeft"></div><div class="bottomRight"></div>');

        $(this).children('div').css('background-image', 'url(' + img + ')');



        $(this).find('div.topLeft').css({

            top: 0,

            left: 0,

            width: pos,

            height: pos

        });

        $(this).find('div.topRight').css({

            top: 0,

            left: pos,

            width: pos,

            height: pos

        });

        $(this).find('div.bottomLeft').css({

            bottom: 0,

            left: 0,

            width: pos,

            height: pos

        });

        $(this).find('div.bottomRight').css({

            bottom: 0,

            left: pos,

            width: pos,

            height: pos

        });



    }).hover(function () {



        $(this).find('div.topLeft').stop(false, true).animate({

            top: neg,

            left: neg

        }, {

            duration: speed_out,

            easing: style_out

        });

        $(this).find('div.topRight').stop(false, true).animate({

            top: neg,

            left: out

        }, {

            duration: speed_out,

            easing: style_out

        });

        $(this).find('div.bottomLeft').stop(false, true).animate({

            bottom: neg,

            left: neg

        }, {

            duration: speed_out,

            easing: style_out

        });

        $(this).find('div.bottomRight').stop(false, true).animate({

            bottom: neg,

            left: out

        }, {

            duration: speed_out,

            easing: style_out

        });



    },



    function () {



        $(this).find('div.topLeft').stop(false, true).animate({

            top: 0,

            left: 0

        }, {

            duration: speed_in,

            easing: style_in

        });

        $(this).find('div.topRight').stop(false, true).animate({

            top: 0,

            left: pos

        }, {

            duration: speed_in,

            easing: style_in

        });

        $(this).find('div.bottomLeft').stop(false, true).animate({

            bottom: 0,

            left: 0

        }, {

            duration: speed_in,

            easing: style_in

        });

        $(this).find('div.bottomRight').stop(false, true).animate({

            bottom: 0,

            left: pos

        }, {

            duration: speed_in,

            easing: style_in

        });



    }).click(function () {
	var temp = $(this).find('a').attr('target');
	if(temp=="_blank"){
		var x = $(this).find('a').attr('href');
		window.open(x);
		return false;
	}else{
		window.location = $(this).find('a').attr('href');
	}

    });

    if ($('#sitepolicy')[0]) {

        $('#site_policy div#scroll').jScrollPane({

/*

		verticalDragMinHeight: 120,

		verticalDragMaxHeight: 120

		*/

        });

    }



    //blog

    if ($("#blog")[0]) {

        $('.blogComment').hide();

        $('.comeentR a').click(function () {

            $(this).parent().parent().next().toggle('fast');

        });

    }





    $(function () {

        if (!$("#blog")[0] && $("#news_box")[0]) {

            $("ul.news_body").liScroll();

        }

    });



    //map

    if ($("#system")[0]) {



        var check_flame_set = function () {

                if (!parent.document.getElementById("TB_window")) {

                    clearInterval(timerID);

                    show_map();

                } else if (parent.document.getElementById("TB_window").style.display == "block") {

                    clearInterval(timerID);

                    show_map();

                }

            }

        var timerID = setInterval(check_flame_set, 500);



        var show_map = function () { /*google API ver2�g�p MAP�\��*/

                $("#googleMap").gMap({

                    markers: [{

                        latitude: 35.663506,

                        longitude: 139.734228,

                        html: '<span style="font-size:12px;font-weight:bold;color:#454545;">�h���X����</span><br /><span style="font-size:12px;">�����s�`��Z�{��3-8-18<br />�����ރr���b�WB2F</span>',

                        popup: false

                    }],

                    zoom: 16

                });

            }





    }



    $("#rightContents p span img").toggle(function () {

        $("#mapBox").css({

            "z-index": "1"

        });

        $("#imageBox").css({

            "z-index": "0"

        });

    }, function () {

        $("#mapBox").css({

            "z-index": "0"

        });

        $("#imageBox").css({

            "z-index": "1"

        });

    });







    if (!$("#recruit")[0]) {



    $(".lightBox").fancybox({

        'overlayColor': '#000000',

        'overlayOpacity': 0.5

    });



        var _memberPop = (function () {

            if ($.os.name == 'win' && $.browser.name == 'msie' && $.browser.version == 6) {

                $('.memberPop').fancybox({

                    'padding': 0,

                    'titleShow': false,

                    'autoScale': false,

                    'transitionIn': 'none',

                    'transitionOut': 'none',

                    'type': 'iframe',

                    'centerOnScroll': true,

                    'scrolling': 'no',

                    'overlayShow': true,

                    'overlayOpacity': 0.5,

                    'overlayColor': '#000',

                    'enableEscapeButton': true,

                    'width': 324,

                    'height': 221

                });

            } else {

                $('.memberPop').fancybox({

                    'padding': 0,

                    'titleShow': false,

                    'autoScale': false,

                    'transitionIn': 'none',

                    'transitionOut': 'none',

                    'type': 'iframe',

                    'scrolling': 'no',

                    'overlayShow': true,

                    'overlayOpacity': 0.5,

                    'overlayColor': '#000',

                    'enableEscapeButton': true,

                    'width': 324,

                    'height': 221

                });

            }

            $("#memberPop").css({

                "width": "320px"

            });

        })();



        var _regPop = (function () {

            if ($.os.name == 'win' && $.browser.name == 'msie' && $.browser.version == 6) {

                $('.regPop').fancybox({

                    'padding': 0,

                    'titleShow': false,

                    'autoScale': false,

                    'transitionIn': 'none',

                    'transitionOut': 'none',

                    'type': 'iframe',

                    'centerOnScroll': true,

                    'scrolling': 'no',

                    'overlayShow': true,

                    'overlayOpacity': 0.5,

                    'overlayColor': '#000',

                    'enableEscapeButton': true,

                    'width': 320,

                    'height': 170

                });

            } else {

                $('.regPop').fancybox({

                    'padding': 0,

                    'titleShow': false,

                    'autoScale': false,

                    'transitionIn': 'none',

                    'transitionOut': 'none',

                    'type': 'iframe',

                    'scrolling': 'no',

                    'overlayShow': true,

                    'overlayOpacity': 0.5,

                    'overlayColor': '#000',

                    'enableEscapeButton': true,

                    'width': 320,

                    'height': 170

                });

            }

            $("#regPop").css({

                "width": "320px"

            });

        })();



        var _regPop = (function () {

            if ($.os.name == 'win' && $.browser.name == 'msie' && $.browser.version == 6) {

                $('.remPop').fancybox({

                    'padding': 0,

                    'titleShow': false,

                    'autoScale': false,

                    'transitionIn': 'none',

                    'transitionOut': 'none',

                    'type': 'iframe',

                    'centerOnScroll': true,

                    'scrolling': 'no',

                    'overlayShow': true,

                    'overlayOpacity': 0.5,

                    'overlayColor': '#000',

                    'enableEscapeButton': true,

                    'width': 320,

                    'height': 140

                });

            } else {

                $('.remPop').fancybox({

                    'padding': 0,

                    'titleShow': false,

                    'autoScale': false,

                    'transitionIn': 'none',

                    'transitionOut': 'none',

                    'type': 'iframe',

                    'scrolling': 'no',

                    'overlayShow': true,

                    'overlayOpacity': 0.5,

                    'overlayColor': '#000',

                    'enableEscapeButton': true,

                    'width': 320,

                    'height': 140

                });

            }

            $("#remPop").css({

                "width": "320px"

            });

        })();





        var _mypagePop = (function () {

            if ($.os.name == 'win' && $.browser.name == 'msie' && $.browser.version == 6) {

                $('.mypagePop').fancybox({

                    'padding': 0,

                    'titleShow': false,

                    'autoScale': false,

                    'transitionIn': 'none',

                    'transitionOut': 'none',

                    'type': 'iframe',

                    'centerOnScroll': true,

                    'scrolling': 'no',

                    'overlayShow': true,

                    'overlayOpacity': 0.5,

                    'overlayColor': '#000',

                    'enableEscapeButton': true,

                    'width': 541,

                    'height': 665

                });

            } else {

                $('.mypagePop').fancybox({

                    'padding': 0,

                    'titleShow': false,

                    'autoScale': false,

                    'transitionIn': 'none',

                    'transitionOut': 'none',

                    'type': 'iframe',

                    'scrolling': 'no',

                    'overlayShow': true,

                    'overlayOpacity': 0.5,

                    'overlayColor': '#000',

                    'enableEscapeButton': true,

                    'width': 541,

                    'height': 665

                });

            }



        })();





        if ($("#blog")[0]) {

            var _blogWPop = (function () {

                if ($.os.name == 'win' && $.browser.name == 'msie' && $.browser.version == 6) {

                    $('.blogWPop').fancybox({

                        'padding': 0,

                        'titleShow': false,

                        'autoScale': false,

                        'transitionIn': 'none',

                        'transitionOut': 'none',

                        'type': 'iframe',

                        'centerOnScroll': true,

                        'scrolling': 'no',

                        'overlayOpacity': 0.5,

                        'enableEscapeButton': true,

                        'width': 490,

                        'height': 340

                    });

                } else {

                    $('.blogWPop').fancybox({

                        'padding': 0,

                        'titleShow': false,

                        'autoScale': false,

                        'transitionIn': 'none',

                        'transitionOut': 'none',

                        'type': 'iframe',

                        'scrolling': 'no',

                        'enableEscapeButton': true,

                        'width': 490,

                        'height': 340

                    });

                }

            })();

        }

    }

    //��ʐ؂�ւ�

    if ($('#cast')[0]) {

        var imgArray2 = [];

        $("#imageGallery li.image").each(function (i) {

            i = i + 1

            var img = "#image" + i;

            $(this).hover(function () {

                $("#image img").each(function (i) {

                    $(this).removeClass("selected");

                })

                $(img).addClass("selected");

                $(this).children().children().stop(true, false).fadeTo(1, 0.33);

            }, function () {

                $(this).children().children().stop(true, false).fadeTo(1, 1.0);



            })

        })

        //member�摜����

        $(".privatePhoto .image").each(function () {

            $(this).hover(function () {

                $(this).children().stop(true, false).fadeTo(1, 0.5);

            }, function () {

                $(this).children().stop(true, false).fadeTo(1, 1.0);

            })

        })



        $("#imageGallery li.image  a").fancybox({

            'overlayOpacity': 0.7,

            'overlayColor': '#000000',

            'titlePosition': 'inside',

            'speedIn': 600,

            'speedOut': 200,

            'overlayShow': true

        });



        $("a.lightBox").fancybox({

            'overlayOpacity': 0.7,

            'overlayColor': '#000000',

            'titlePosition': 'inside',

            'speedIn': 600,

            'speedOut': 200,

            'overlayShow': true

        });







        //������{

        if ($.os.name == 'win' && $.browser.name == 'msie' && $.browser.version == 6 || $.browser.version == 7) {

            $("div.image a").center({

                ie: true

            });

//        } else {

//            $("div.image a").center();

        }



    }

    $('.scrollbar').css({

        'margin': '10px 0px 0',

        'margin-bottom': '0'

    })

	

	if ($("#coupon")[0]) {

		if ($.os.name == 'win' && $.browser.name == 'msie' && $.browser.version == 6 || $.browser.version == 7) {

        $("#nomal span").center({

                ie: true

            });

        $("#member span").center({

                ie: true

            });

		}

    }

	

	    //recruit��ʐ؂�ւ�

    if ($('#recruit')[0]) {

        var imgArray = [];



        $("#shopImageR li img").each(function (i) {

            imgArray.push($(this))

            $(imgArray[i]).hover(function () {

                img = "#shopImageL img." + $(this).attr("id")

                $("#shopImageL img:first").removeClass("selected");

                $(img).addClass("selected");

                //console.log(img)

            }, function () {

                $(img).removeClass("selected");

                $("#shopImageL img:first").addClass("selected");

            })

        })

    }

  if($(".showCaption")[0]){

	$(".scrollbar").css({"margin-bottom":"0px"});

	$(".position").css({"margin":"0 0 0 0"});

	

	//ie6�p

	$('.ContentFlow .flow .item .label').remove()

  }	



});
