﻿$(document).ready(function () {
    //ScrollBar
    _web__default___scrollbarAutoSwitch();
    $('#_web__default .content1 .root .tr1 .td1 .scrollbar ._web__default___scrollbar .switcher').hover(function () {
        _web__default___scrollbarMouseIsOver = true;
    }, function () {
        _web__default___scrollbarMouseIsOver = false;
    });
    $('#_web__default .content1 .root .tr1 .td1 .scrollbar ._web__default___scrollbar .switcher .tr1 td').hover(function () {
        $(this).find('.image img').stop().animate(
        {
            marginTop: -($(this).width() * 5 / 16)
        }, 100);
        $(this).addClass('td_mouseover');
    }, function () {
        $(this).find('.image img').stop().animate(
        {
            marginTop: 0
        }, 100);
        $(this).removeClass('td_mouseover');
    });
    $('#_web__default .content1 .root .tr1 .td1 .scrollbar ._web__default___scrollbar .switcher .tr1 td .image img').click(function () {
        _web__default___scrollbarAutoSwitching = false;
        _web__default___scrollbarCurrentImage = $(this).attr('number');
        _web__default___scrollbarSwitchImage(_web__default___scrollbarCurrentImage);
    });

    //Topline
    _web__default___toplineSwitchLeft();
    $('#_web__default .content1 .root .tr1 .td2 .topline .switcher .tr1 td').hover(function () {
        $(this).addClass('td_mouseover');
    }, function () {
        $(this).removeClass('td_mouseover');
    });
    $('#_web__default .content1 .root .tr1 .td2 .topline ._web__default___topline .switcher .tr1 .td1').click(function () {
        _web__default___toplineSwitchLeft();
    });
    $('#_web__default .content1 .root .tr1 .td2 .topline ._web__default___topline .switcher .tr1 .td2').click(function () {
        _web__default___toplineSwitchRight();
    });
    $('#_web__default .content1 .root .tr1 .td2 .topline ._web__default___topline .newslist .title').hover(function () {
        $(this).addClass('title_mouseover');
    }, function () {
        $(this).removeClass('title_mouseover');
    });
    $('#_web__default .content1 .root .tr1 .td2 .topline ._web__default___topline .newslist .news').hover(function () {
        $(this).addClass('news_mouseover');
    }, function () {
        $(this).removeClass('news_mouseover');
    });

    //Operations
    $('#_web__default .content2 .operations ._web__default___operations .root .tr1 td .item').click(function () {
        $('#_web__default .content2 .operations ._web__default___operations .root .tr3 td .list').slideToggle('fast');
    });
    $('#_web__default .content2 .operations ._web__default___operations .root .tr1 td .item:first').addClass('item_mouseover');
    $('#_web__default .content2 .operations ._web__default___operations .root .tr2 .td1 .introductions .introduction:first').slideDown('fast');
    $('#_web__default .content2 .operations ._web__default___operations .root .tr1 td .item').hover(function () {
        $('#_web__default .content2 .operations ._web__default___operations .root .tr1 td .item').removeClass('item_mouseover');
        $(this).addClass('item_mouseover');
        var _introductionNumber = $(this).attr('introduction');
        $('#_web__default .content2 .operations ._web__default___operations .root .tr2 .td1 .introductions .introduction').slideUp('fast');
        $('#_web__default .content2 .operations ._web__default___operations .root .tr2 .td1 .introductions .introduction' + _introductionNumber).show('fast');
        _web__default___operationsSwitch(_introductionNumber);
    }, function () {
    });
    $('#_web__default .content2 .operations ._web__default___operations .root .tr3 .td1 .list .connections .connection .card').prepend('<img src="/$Data/$Image/card_logo.jpg" alt="" />');
    $('#_web__default .content2 .operations ._web__default___operations .root .tr3 .td1 .list .connections .connection .card .name').append('<div style="width : 70px; height : 10px; background-color : #FCA822;"></div>');

    //GroupUcity
    $('#_web__default .content3 .root .tr1 .td1 ._web__default___groupucity .list .news .tr1 .td2 .link a').hover(function () {
        $(this).addClass('a_mouseover');
    }, function () {
        $(this).removeClass('a_mouseover');
    });

    //SchoolGroups
    _web__default___schoolgroupsSwitch(1);
    $('#_web__default .content3 .root .tr1 .td2 ._web__default___schoolgroups .switcher .selections .tr1 td .selection').mouseover(function () {
        _web__default___schoolgroupsSwitch($(this).attr('selection'));
    });
    $('#_web__default .content3 .root .tr1 .td2 ._web__default___schoolgroups .content .session .news .tr1 .td2 .link a').hover(function () {
        $(this).addClass('a_mouseover');
    }, function () {
        $(this).removeClass('a_mouseover');
    });
});


//ScrollBar
var _web__default___scrollbarAutoSwitching = true;
var _web__default___scrollbarCurrentImage = 0;
function _web__default___scrollbarAutoSwitch() {
    if (_web__default___scrollbarAutoSwitching) {
        _web__default___scrollbarCurrentImage++;
        if (_web__default___scrollbarCurrentImage > $('#_web__default .content1 .root .tr1 .td1 .scrollbar ._web__default___scrollbar').attr('count')) {
            _web__default___scrollbarCurrentImage = 1;
        }
        _web__default___scrollbarSwitchImage(_web__default___scrollbarCurrentImage);
    }

    _web__default___scrollbarAutoSwitching = true;
    setTimeout('_web__default___scrollbarAutoSwitch();', 5000);
}

var _web__default___scrollbarMouseIsOver = false;
function _web__default___scrollbarSwitchImage(ID) {
    $('#_web__default .content1 .root .tr1 .td1 .scrollbar ._web__default___scrollbar .switcher .tr1 td').removeClass('td_on');
    var _subject = $('#_web__default .content1 .root .tr1 .td1 .scrollbar ._web__default___scrollbar .switcher .tr1 .td' + ID.toString()).addClass('td_on');
    $('#_web__default .content1 .root .tr1 .td1 .scrollbar ._web__default___scrollbar .switcher .tr1 .td' + ID.toString()).find('.image img').stop().animate({
        marginTop: -($('#_web__default .content1 .root .tr1 .td1 .scrollbar ._web__default___scrollbar .switcher .tr1 td').width() * 5 / 16)
    }, 300, function () {
        $(this).animate({
            marginTop: 0
        }, 1000);
    });

    var _subject = $('#_web__default .content1 .root .tr1 .td1 .scrollbar ._web__default___scrollbar .switcher .tr1 .td' + ID.toString() + ' .image img');
    var _target = $('#_web__default .content1 .root .tr1 .td1 .scrollbar ._web__default___scrollbar .showing');
    _target.find('a').fadeOut(200, function () {
        _target.find('a').attr('href', _subject.attr('url'));
        _target.find('a img').attr('src', _subject.attr('src'));
        _target.find('a img').attr('alt', _subject.attr('alt'));
        _target.find('a').fadeIn(100);
    });
}

//Topline
function _web__default___toplineSwitchLeft() {
    $('#_web__default .content1 .root .tr1 .td2 .topline ._web__default___topline .switcher .tr1 td').removeClass('td_on');
    $('#_web__default .content1 .root .tr1 .td2 .topline ._web__default___topline .switcher .tr1 .td1').animate({
        width: 220
    }, 300).addClass('td_on');
    $('#_web__default .content1 .root .tr1 .td2 .topline ._web__default___topline .newslist').slideUp(150, function () {
        $('#_web__default .content1 .root .tr1 .td2 .topline ._web__default___topline .newslist1').slideDown(250);
    });
}

function _web__default___toplineSwitchRight() {
    $('#_web__default .content1 .root .tr1 .td2 .topline ._web__default___topline .switcher .tr1 td').removeClass('td_on');
    $('#_web__default .content1 .root .tr1 .td2 .topline ._web__default___topline .switcher .tr1 .td1').animate({
        width: 100
    }, 300);
    $('#_web__default .content1 .root .tr1 .td2 .topline ._web__default___topline .switcher .tr1 .td2').addClass('td_on');
    $('#_web__default .content1 .root .tr1 .td2 .topline ._web__default___topline .newslist').slideUp(150, function () {
        $('#_web__default .content1 .root .tr1 .td2 .topline ._web__default___topline .newslist2').slideDown(250);
    });
}
//Operations
function _web__default___operationsSwitch(TargetID) {
    $('#_web__default .content2 .operations ._web__default___operations .root .tr3 .td1 .list .connections:first').animate({
        marginLeft: (1 - TargetID) * 960
    }, 'fast', null);
}

//SchoolGroups
function _web__default___schoolgroupsSwitch(TargetID) {
    $('#_web__default .content3 .root .tr1 .td2 ._web__default___schoolgroups .switcher .selections .tr1 td .selection').removeClass('selection_on');
    $('#_web__default .content3 .root .tr1 .td2 ._web__default___schoolgroups .switcher .selections .tr1 td .selection' + TargetID).addClass('selection_on');

    if (!$('#_web__default .content3 .root .tr1 .td2 ._web__default___schoolgroups .content .session' + TargetID).hasClass('session_on')) {
        $('#_web__default .content3 .root .tr1 .td2 ._web__default___schoolgroups .content .session').removeClass('session_on').fadeOut('fast')
        $('#_web__default .content3 .root .tr1 .td2 ._web__default___schoolgroups .content .session' + TargetID).addClass('session_on').fadeIn('fast');
    }
}


