﻿// JavaScript Document
$(document).ready(function () {

    $('#rootID17').addClass('gold');
    $('#rootID96').addClass('gold');
    $('#rootID97').addClass('gold');
    $('#rootID98').addClass('gold');
    $('#rootID99').addClass('gold');
    $('#rootID100').addClass('gold');

    $('#map a').hover(function () {
        $(this).next('div.info').fadeIn(100);
    }, function () {
        $(this).next('div.info').fadeOut(100);
    });
    var sliderHtml = '';
    /*$('#photo-gallery-content div.floatbox').each(function(){
    sliderHtml = sliderHtml+'<div class="item">'+$(this).html()+'</div>';
    });*/
    $('#photo-gallery-content div.gallery-photo').each(function () {
        sliderHtml = sliderHtml + $(this).html();
    });

    $('#photo-gallery-content div.floatbox').remove();
    $('#photo-gallery-content').append('<a href="javascript:void(0)" class="prev"></a><a href="javascript:void(0)" class="next"></a><div id="mask"><div class="items">' + sliderHtml + '</div></div>');
    $('#mask div.thumb').addClass('item');
    $.getScript(gUrl+'/javascript/tools.scrollable-1.1.2.min.js', function () {
        $('#mask').scrollable({
            size: 3,
            clickable: false
        });
    });
    /*var clickIndex = 0;
    $('#photo-gallery-content a.prev, #photo-gallery-content a.next').click(function(){
    if($(this).hasClass('prev') && clickIndex == 0){
    $(this).css({display: 'none'});
    return;
    }
    if(clickIndex != 0){
    $('#photo-gallery-content a.prev').css({display: 'block'});
    }
    if($(this).hasClass('next') && clickIndex == $('#mask div.thumb').size()-1){
    $(this).css({display: 'none'});
    return;
    }
    var way = $('#mask div.thumb').width()+parseInt($('#mask div.thumb').css('padding-right'));
    var direction;
    if($(this).hasClass('next')){
    direction = '-';
    clickIndex++;
    }
    if($(this).hasClass('prev')){
    direction = '+';
    clickIndex--;
    }
    $('#mask div.items').animate({left: direction+'='+way+'px'});
    });*/

    if (document.location.pathname == '/') {
        $('#content').css({ background: 'none' });
    }
    $('ul').each(function () {
        $(this).children('li:first').addClass('first');
        $(this).children('li:last').addClass('last')
    })
    $('ul.accordion li ul li.current').parents('ul.sub').prev('a').addClass('open');
    $('ul.accordion li ul li.current').parents('ul.sub').slideDown(500);
    $('ul.accordion > li > a').click(function () {
        if ($(this).next('ul.sub').size() > 0) {
            $(this).toggleClass('open')
        }
        $(this).next('ul').slideToggle({ duration: 500, easing: 'easeOutExpo' })
        $(this).parent('li').siblings('li').each(function () {
            $(this).children('ul:visible').slideUp({ duration: 500, easing: 'easeOutExpo' }).prev('a').removeClass('open')
        })
    });
    $('#menu > ul > li > a').hover(function () {
        $(this).next('ul').slideDown({ duration: 500, easing: 'easeOutExpo' })
        $(this).parent('li').mouseleave(function () {
            $(this).children('ul').slideUp({ duration: 500, easing: 'easeOutExpo' })
        })
    })
    $('#slideshow img:first').fadeIn(0).siblings('img').fadeOut(0);
    //slideshow
    var imgSize = $('#slideshow img').size();
    var imgCount = 0;
    $('#slideshow').everyTime('5s', 'slideshow', function () {
        imgCount++;
        if (imgCount == imgSize) {
            imgCount = 0;
        }
        $('#slideshow img').eq(imgCount).fadeIn(300).siblings('img').fadeOut(300);
    });
});
$(window).load(function(){
});
