$(window).load(function() {
    $('.drop').css('left', 1).hide();
});
$(document).ready(function() {
    initCufon();
    setTimeout(function() {

    })
    $('div.drop').jqueryTabs({
        event: 'mouseover',
        tabset: 'ul.tabset'
    });
    $('div.drop').jqueryTabs({
        event: 'mouseover',
        tabset: 'p'
    });
    $('div.drop').jqueryTabs({
        event: 'mouseover',
        tabset: 'area'
    });
    /*$("img.a").hover(
function() {
    $(this).stop().animate({ "opacity": "0" }, "fast");
},
function() {
    $(this).stop().animate({ "opacity": "1" }, "fast");
});*/


    if (serverVars) {
        var logo = $('#amvestLogo');
        var fade = $('#amvestLogo span');


        fade.fadeOut(0);

        if (serverVars.logoHoverClass != "NONE") {
            logo.removeClass();
            fade.removeClass();
            logo.addClass(serverVars.logoFadeClass + 'Fade');
            fade.addClass(serverVars.logoHoverClass + 'Hover');
        }



        if (fade.is(':animated')) {
            fade.stop().fadeTo(500, 1);
        } else {
            fade.fadeIn(500);
        }
    }



    $(".scroll").click(function(event) {
        //prevent the default action for the click event
        event.preventDefault();


        var full_url = this.href;


        var parts = full_url.split("#");
        var trgt = parts[1];

        //get the top offset of the target anchor
        var anch = $("#" + trgt);
        if (anch) {

            var target_offset = anch.offset();
            if (target_offset) {
                var target_top = target_offset.top;
                //goto that anchor by setting the body scroll top to anchor top
                $('html, body').animate({ scrollTop: target_top }, 500);
            }
        }


    });


    // navigation **************************************************************
    var _navHolder = $('ul.menu'),
		_nav = $('> li', _navHolder),
		_hideDrop = $('a.hide-drop', _navHolder),
		_activeLi = {}, _activeClass;

    var _panoramaFader = $('<div/>');
    _panoramaFader.css({
        'position': 'absolute',
        'top': 0,
        'left': 0,
        'opacity': 0.35,
        'height': '100%',
        'width': '100%',
        'zIndex': 100
    }).hide().addClass('fader');
    var _panorama = $('div.panorama');
    if (_panorama.length) {
        _panorama.append(_panoramaFader);
    } else {
        _panoramaFader.css({
            'height': 305,
            'top': 95
        })
        $('#header').after(_panoramaFader);
    }

    _nav.each(function() {
        var _link = $('> a', this),
			_drop = $('div.drop', this),
			_li = $(this);

        if (_li.hasClass('active')) {
            _navHolder.parent().addClass($('a', _li).attr('rel'));
            _li.addClass('active');
            _drop.slideDown(300);
            _activeLi.drop = _drop;
            _activeLi.li = _li;
            if (_panoramaFader.is(':hidden'))
                _panoramaFader.fadeIn(300);
        }
        if (_li.hasClass('selected')) {
            _navHolder.parent().addClass($('a', _li).attr('rel'));
        }

        _link.click(function() {


            if (serverVars) {
                var logo = $('#amvestLogo');
                var fade = $('#amvestLogo span');
                fade.fadeOut(0);


                serverVars.logoHoverClass = GetLogoCssClass(_link.attr('class'))
                if (serverVars.logoHoverClass != "NONE") {
                    logo.removeClass();
                    fade.removeClass();
                    if (_li.hasClass('active')) {
                        serverVars.logoHoverClass = serverVars.logoClass;
                    }

                    logo.addClass(serverVars.logoFadeClass + 'Fade');
                    fade.addClass(serverVars.logoHoverClass + 'Hover');
                }
                serverVars.logoFadeClass = serverVars.logoHoverClass;


                if (fade.is(':animated')) {
                    fade.stop().fadeTo(500, 1);
                } else {
                    fade.fadeIn(500);
                }
            }

            if (_li.hasClass('active')) {
                _navHolder.parent().removeClass(this.rel);
                _li.removeClass('active');
                _drop.slideUp(300);
                _panoramaFader.fadeOut(300);
                _activeLi.li = false;
            } else {
                if (_activeLi.li) {
                    _activeLi.li.removeClass('active');
                    _navHolder.parent().attr('class', _activeClass);
                    _activeLi.drop.slideUp(300);


                }
                _navHolder.parent().addClass(this.rel);
                _li.addClass('active');
                _drop.slideDown(300);
                _activeLi.drop = _drop;
                _activeLi.li = _li;
                if (_panoramaFader.is(':hidden'))
                    _panoramaFader.fadeIn(300);
            }
            Cufon.refresh('ul.menu > li > a');
            return false;
        });
    });
    _activeClass = _navHolder.parent().attr('class');

    _nav.find('> a').each(function() {
        var _f = false;
        if (_navHolder.parent().hasClass(this.rel)) _f = true;
        if (!_f) {
            $(this).mouseenter(function() {
                if (_nav.hasClass('active')) return false;
                _navHolder.parent().addClass(this.rel);
                Cufon.refresh('ul.menu > li > a');
            }).mouseleave(function() {
                if (_nav.hasClass('active')) return false;
                _navHolder.parent().removeClass(this.rel);
                if (_navHolder.attr('class') == 'navbar')
                    _navHolder.parent().attr('class', _activeClass);
                Cufon.refresh('ul.menu > li > a');
            });
        }
    });

    _hideDrop.click(function() {
        _nav.removeClass('active');
        _navHolder.parent().attr('class', _activeClass);
        _panoramaFader.fadeOut(300);
        Cufon.refresh('ul.menu > li > a');
        if (_activeLi.li)
            _activeLi.drop.slideUp(300);



        if (serverVars) {
            var logo = $('#amvestLogo');
            var fade = $('#amvestLogo span');
            fade.fadeOut(0);
            fade.removeClass();
            serverVars.logoHoverClass = serverVars.logoClass;
            fade.addClass(serverVars.logoHoverClass + 'Hover');
            if (fade.is(':animated')) {
                fade.stop().fadeTo(500, 1);
            } else {
                fade.fadeIn(500);
            }
        }
    });

    // sitemap *****************************************************************
    $('div.sitemap').each(function() {
        var _button = $('> div.row a.button', this),
			_slide = $('> div.holder', this),
			_holder = $(this);

        _slide.hide();
        _holder.removeClass('open-sitemap');

        _button.click(function() {
            if (_holder.hasClass('open-sitemap')) {
                _slide.slideUp(250);
                $(document).scrollTo($('#header'), 1000);
                _holder.removeClass('open-sitemap');
            } else {
                _holder.addClass('open-sitemap');
                _slide.slideDown(400, function() {
                    $(document).scrollTo($('ul.service'), 1000);
                });
            }
            return false;
        });
    });

    // panorama ****************************************************************
    var _panorama = $('div.panorama-holder'),
		_slideRight = $('div.panorama-nav a.right'),
		_slideLeft = $('div.panorama-nav a.left'),
		_nav = $('div.panorama-nav');

    var _speedPSec = 30;

    var _movers = $('div.panorama-mover');
    var _dir = 'left';
    _k = 1;

    _panorama.each(function() {
        var _holder = $(this),
			_mover = $('div.panorama-mover', _holder),
			_scrollEl = $('div.panorama-slide', _mover),
			_next = $('a.next', _holder),
			_prev = $('a.prev', _holder),
			_cloneEl = _scrollEl.clone(),
			_cloneEl2 = _scrollEl.clone(),
			_scrollElWidth = _scrollEl.outerWidth(true),
			_margin = _scrollElWidth,
			_duration = _speedPSec * _scrollElWidth,
			_img = $('img', _scrollEl);




        if (_img && $(_img[0]).attr("src") == '/sites/AMVEST/PublishingImages/Over/roundshot_werkenbij.jpg') {
            _scrollEl.css({ 'width': '3961px', 'float': 'left', 'position': 'relative' });
        }


        var _html = _mover.html();
        _html = _html + _html + _html;

        _mover.append(_cloneEl);
        _mover.prepend(_cloneEl2);
        _mover.css('marginLeft', -_margin);

        _prev.mouseenter(function() {
            var _btn = $(this);
            _dir = 'right';
            _k = _btn.attr('rel');
            _movers.filter(':visible').trigger('scroll');
        }).mouseleave(function() {
            _k = 1;
            _movers.filter(':visible').trigger('scrollStop');
        });
        _next.mouseenter(function() {
            var _btn = $(this);
            _dir = 'left';
            _k = _btn.attr('rel');
            _movers.filter(':visible').trigger('scroll');
        }).mouseleave(function() {
            _k = 1;
            _movers.filter(':visible').trigger('scrollStop');
        });

        //Set Autorotation
        var _int, _flag;
        _mover.bind('scroll', function() {
            var _el = $(this);
            var _width = (_el.children().length - 1) * _scrollElWidth;
            _flag = false;
            if (_int) clearInterval(_int);
            _int = setInterval(function() {
                _margin = parseInt(_el.css('margin-left'));
                var _dur = (2 * _scrollElWidth + _margin) * 1000 / (_speedPSec * _k);
                var _lastPoint = _scrollElWidth * 2;
                var _startPoint = _scrollElWidth;
                if (_dir == 'right') {
                    var _dur = -(_scrollElWidth + _margin) * 1000 / (_speedPSec * _k);
                    var _startPoint = _scrollElWidth * 2;
                    var _lastPoint = _scrollElWidth;
                }
                if (_flag) return;
                _flag = true;
                _el.stop().animate({ 'marginLeft': -_lastPoint }, { duration: _dur, easing: 'linear', complete: function() {
                    _el.css({ 'margin-left': -_startPoint });
                    _flag = false;
                } 
                });
            }, 100);
        }).bind('scrollStop', function() {
            var _el = $(this);
            if (_int) {
                clearInterval(_int);
                _flag = true;
                var _step = _dir == 'right' ? -100 : 100;
                _marginL = parseInt(_el.css('margin-left'));
                _el.stop().animate({ 'marginLeft': _marginL - _step }, { duration: 100 * 1000 / _speedPSec, easing: 'easeOutSine' });
            }
        })

        function setNavWidth() {
            var _dW = $('body').innerWidth();
            if (_dW > 960) {
                var _w = (_dW - 960) / 2;
                if (_w < 30) _w = 30;
                _next.css({ 'width': _w / 3, 'right': _w * 2 / 3 });
                _prev.css({ 'width': _w / 3, 'left': _w * 2 / 3 });
                _next.filter('.next2').css({ 'width': _w / 3, 'right': _w * 1 / 3 });
                _next.filter('.next3').css({ 'width': _w / 3, 'right': 0 });
                _prev.filter('.prev2').css({ 'width': _w / 3, 'left': _w * 1 / 3 });
                _prev.filter('.prev3').css({ 'width': _w / 3, 'left': 0 });
            }
        };
        _next.css('cursor', 'url(' + _next.attr('href') + '), e-resize');
        _prev.css('cursor', 'url(' + _prev.attr('href') + '), w-resize');
        _next.attr('href', '#');
        _prev.attr('href', '#');
        setNavWidth();

        $(window).resize(function() {
            setNavWidth();
        });
    });


    // hotspot *****************************************************************
    var _hotspot = $('div.hotspot, div.hs');
    _hotspot.each(function() {
        var _hs = $(this),
			_overEl = $('div.holder, > a', _hs);

        _hs.left = parseInt(_hs.css('left'));
        _hs.top = parseInt(_hs.css('top'));

        _hs.css({
            'padding': '30px 40px',
            'top': _hs.top - 30,
            'left': _hs.left - 40
        });
        var _timer = false, _timerOut = false;
        _overEl.mouseenter(function() {
            _hs.addClass('over');
            _hs.removeClass('near');
        });

        _hs.mouseenter(function() {
            $(this).addClass('near');
            Cufon.refresh('.hotspot .holder a');
        }).mouseleave(function() {
            $(this).removeClass('near').removeClass('over');
            Cufon.refresh('.hotspot .holder a');
        });

    });

    // slideshow ***************************************************************
    $('div.panorama').slideShow({
        projectNameEl: 'p.project-name',
        slideEl: 'div.gallery-slide',
        linkNext: 'ul.paging a.next',
        linkPrev: 'ul.paging a.prev',
        linkPause: 'a.pause',
        numElement: 'ul.paging a.bullet',
        duration: 500,
        autoSlideShow: false,
        switchTime: 5000,
        noCicle: false,
        disableClass: 'no-active',
        event: 'click',
        currentEl: 'span.cur',
        allEl: 'span.all',

        hideBeforeShow: false,
        hoverStopGallery: true

    });


    // 360 gallery enable
    _slideLeft.mouseenter(function() {
        _k = 6;
        _dir = "right";
        _movers.filter(':visible').trigger('scroll');
    }).mouseout(function() {
        _movers.filter(':visible').trigger('scrollStop');
    });
    _slideRight.mouseenter(function() {
        _k = 6;
        _dir = "left";
        _movers.filter(':visible').trigger('scroll');
    }).mouseleave(function() {
        _movers.filter(':visible').trigger('scrollStop');
    });
    if (!$('.panorama').hasClass('noautoscroll')) {
        _movers.filter(':visible').stop();
        _movers.filter(':visible').trigger('scroll');
    }
    $('.panorama .gallery-slide').mouseenter(function() {
        _dir = "left";
        _movers.filter(':visible').trigger('scrollStop');
    }).mouseleave(function() {
        _dir = "left";
        _k = 1;
        _movers.filter(':visible').trigger('scroll');
    })
    $('.panorama').bind('changeStart', function() {
        _movers.filter(':visible').trigger('scrollStop');
    }).bind('changeSlide', function() {
        _dir = "left";
        _k = 1;
        _movers.filter(':visible').trigger('scroll');
    });

});

/* 
* jQuery slideShow v1.3.0
*/

jQuery.fn.slideShow = function(_options) {
    // defaults options	    
    var _options = jQuery.extend({
        slideEl: 'div.slide',
        projectNameEl: 'p.project-name',
        linkNext: 'a.next',
        linkPrev: 'a.prev',
        linkPause: 'a.pause',
        numElement: 'div.slideNav li a',
        duration: 500,
        autoSlideShow: false,
        switchTime: 3000,
        noCicle: false,
        disableClass: 'no-active',
        event: 'click',
        currentEl: 'span.cur',
        allEl: 'span.all',
        hideBeforeShow: false,
        hoverStopGallery: true
    }, _options);
    return this.each(function() {
        var _THIS = jQuery(this),
			_slideEl = jQuery(_options.slideEl, _THIS),
			_projectNameEl = jQuery(_options.projectNameEl, _THIS),
			_linkNext = jQuery(_options.linkNext, _THIS),
			_linkPrev = jQuery(_options.linkPrev, _THIS),
			_linkPause = jQuery(_options.linkPause, _THIS),
			_numElement = jQuery(_options.numElement, _THIS),
			_currentEl = jQuery(_options.currentEl, _THIS),
			_allEl = jQuery(_options.allEl, _THIS),
			_duration = _options.duration,
			_switchTime = _options.switchTime,
			_numElActive, _timer = false, _hover = false, _current = 0, _next = 0, _pause = true;

        if (!_slideEl.filter('.active').length) {
            _slideEl.eq(0).addClass('active');
            _projectNameEl.eq(0).removeClass('project-name');
            _projectNameEl.eq(0).addClass('active1');
            _current = 0;
        } else {
            _current = _slideEl.index(_slideEl.filter('.active'));
        }
        _slideEl.not(".active").hide();
        _projectNameEl.not(".active1").hide();

        if (jQuery(_numElement).length && _options.numElement) activeNumEl();
        if (_options.autoSlideShow) {
            _pause = false;
            _timer = setTimeout(function() { nextEl() }, _switchTime);
            if (_linkPause.length && _options.linkPause) _linkPause.addClass('play')
            if (_options.hoverStopGallery) contentHover();
        }
        if (_options.currentEl && _currentEl.length) {
            _allEl.html(_slideEl.length);
            currentNum();
        }
        if (_linkNext.length && _options.linkNext) {
            _linkNext.click(function() {
                nextEl();
                return false;
            });
        }
        if (_options.noCicle) {
            _linkPrev.addClass('prev-' + _options.disableClass);
        }
        if (_linkPrev.length && _options.linkPrev) {
            _linkPrev.click(function() {
                _linkNext.removeClass('next-' + _options.disableClass);
                if (!_slideEl.is(':animated') && !jQuery(this).hasClass('prev-' + _options.disableClass)) {
                    if (_timer) clearTimeout(_timer);
                    _next = _current - 1;
                    if (_next < 0) _next = _slideEl.length - 1;
                    if (_options.noCicle && _next - 1 < 0) {
                        jQuery(this).addClass('prev-' + _options.disableClass);
                    }
                    fadeElement();
                    activeNumEl();
                    pauseCode();
                }
                return false;
            });
        }
        if (_numElement.length && _options.numElement) {
            _numElement.bind(_options.event, function() {
                if (!_slideEl.is(':animated')) {
                    _next = _numElement.index(jQuery(this));
                    _linkNext.removeClass('next-' + _options.disableClass);
                    _linkPrev.removeClass('prev-' + _options.disableClass);
                    if (_options.noCicle && _next + 1 >= _slideEl.length) _linkNext.addClass('next-' + _options.disableClass);
                    if (_options.noCicle && _next - 1 < 0) _linkPrev.addClass('prev-' + _options.disableClass);
                    if (_timer) clearTimeout(_timer);
                    if (!_slideEl.eq(_next).hasClass("active")) {
                        fadeElement();
                        activeNumEl();
                        pauseCode();
                    }
                }
                return false;
            });
        }
        if (_linkPause.length && _options.linkPause) {
            _linkPause.click(function() {
                if (!_pause) {
                    jQuery(this).removeClass('play');
                    clearTimeout(_timer);
                    _pause = true;
                } else {
                    jQuery(this).addClass('play');
                    _timer = setTimeout(function() { nextEl() }, _switchTime);
                    _pause = false;
                }
                return false;
            });
        }
        function fadeElement() {
            if (_current != _next) {
                _slideEl.removeClass('active');
                _slideEl.eq(_current).addClass('hide');
                _THIS.trigger('changeStart');
                _projectNameEl.removeClass('active1');
                _projectNameEl.eq(_current).addClass('hide');

                if (!_options.hideBeforeShow) {
                    _slideEl.eq(_next).fadeIn(_duration, function() {
                        _slideEl.filter('.hide').hide().removeClass('hide');
                        _THIS.trigger('changeStart');
                    }).addClass('active');

                    _projectNameEl.eq(_next).fadeIn(_duration, function() {
                        _projectNameEl.filter('.hide').hide().removeClass('hide');
                    }).addClass('active1');
                } else {
                    _slideEl.filter('.hide').fadeOut(_duration, function() {
                        _slideEl.eq(_next).fadeIn(_duration);
                    }).removeClass('hide');

                    _projectNameEl.filter('.hide').fadeOut(_duration, function() {
                        _projectNameEl.eq(_next).fadeIn(_duration);
                    }).removeClass('hide');
                }
                _current = _next;
                if (_options.currentEl && _currentEl.length) currentNum();
            }
        };
        function currentNum() {
            _currentEl.html(_current + 1);
        }
        function activeNumEl() {
            _numElement.parent().removeClass("active");
            _numElement.eq(_current).parent().addClass("active");

            _projectNameEl.removeClass("active1");
            _projectNameEl.eq(_current).addClass('active1');
        };
        function nextEl() {
            _linkPrev.removeClass('prev-' + _options.disableClass);
            if (!_slideEl.is(':animated') && !_linkNext.hasClass('next-' + _options.disableClass)) {
                if (_timer) clearTimeout(_timer);
                _next = _current + 1;
                if (_next == _slideEl.length) _next = 0;
                if (_options.noCicle && _next + 1 >= _slideEl.length) {
                    _linkNext.addClass('next-' + _options.disableClass);
                }
                fadeElement();
                activeNumEl();
                pauseCode();
            }
        };
        function pauseCode() {
            if (!_pause && !_hover) {
                if (_linkPause.length && _options.linkPause) {
                    if (_linkPause.hasClass('play')) {
                        _timer = setTimeout(function() { nextEl() }, _switchTime);
                    }
                } else {
                    _timer = setTimeout(function() { nextEl() }, _switchTime);
                }
            }
        }
        function contentHover() {
            _THIS.mouseenter(function() {
                _hover = true;
                if (_timer) clearTimeout(_timer);
            }).mouseleave(function() {
                _hover = false;
                pauseCode();
            });
        }
    });
};

; (function(d) { var k = d.scrollTo = function(a, i, e) { d(window).scrollTo(a, i, e) }; k.defaults = { axis: 'xy', duration: parseFloat(d.fn.jquery) >= 1.3 ? 0 : 1 }; k.window = function(a) { return d(window)._scrollable() }; d.fn._scrollable = function() { return this.map(function() { var a = this, i = !a.nodeName || d.inArray(a.nodeName.toLowerCase(), ['iframe', '#document', 'html', 'body']) != -1; if (!i) return a; var e = (a.contentWindow || a).document || a.ownerDocument || a; return d.browser.safari || e.compatMode == 'BackCompat' ? e.body : e.documentElement }) }; d.fn.scrollTo = function(n, j, b) { if (typeof j == 'object') { b = j; j = 0 } if (typeof b == 'function') b = { onAfter: b }; if (n == 'max') n = 9e9; b = d.extend({}, k.defaults, b); j = j || b.speed || b.duration; b.queue = b.queue && b.axis.length > 1; if (b.queue) j /= 2; b.offset = p(b.offset); b.over = p(b.over); return this._scrollable().each(function() { var q = this, r = d(q), f = n, s, g = {}, u = r.is('html,body'); switch (typeof f) { case 'number': case 'string': if (/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(f)) { f = p(f); break } f = d(f, this); case 'object': if (f.is || f.style) s = (f = d(f)).offset() } d.each(b.axis.split(''), function(a, i) { var e = i == 'x' ? 'Left' : 'Top', h = e.toLowerCase(), c = 'scroll' + e, l = q[c], m = k.max(q, i); if (s) { g[c] = s[h] + (u ? 0 : l - r.offset()[h]); if (b.margin) { g[c] -= parseInt(f.css('margin' + e)) || 0; g[c] -= parseInt(f.css('border' + e + 'Width')) || 0 } g[c] += b.offset[h] || 0; if (b.over[h]) g[c] += f[i == 'x' ? 'width' : 'height']() * b.over[h] } else { var o = f[h]; g[c] = o.slice && o.slice(-1) == '%' ? parseFloat(o) / 100 * m : o } if (/^\d+$/.test(g[c])) g[c] = g[c] <= 0 ? 0 : Math.min(g[c], m); if (!a && b.queue) { if (l != g[c]) t(b.onAfterFirst); delete g[c] } }); t(b.onAfter); function t(a) { r.animate(g, j, b.easing, a && function() { a.call(this, n, b) }) } }).end() }; k.max = function(a, i) { var e = i == 'x' ? 'Width' : 'Height', h = 'scroll' + e; if (!d(a).is('html,body')) return a[h] - d(a)[e.toLowerCase()](); var c = 'client' + e, l = a.ownerDocument.documentElement, m = a.ownerDocument.body; return Math.max(l[h], m[h]) - Math.min(l[c], m[c]) }; function p(a) { return typeof a == 'object' ? a : { top: a, left: a} } })(jQuery);

//* jquery tabs *********************************************************************************
jQuery.fn.jqueryTabs = function(_options) {
    // defaults options
    /*
    event: 'click','mouseover','mouseleave'
    */
    var _options = jQuery.extend({
        event: 'click',
        tabset: 'ul.tabset'
    }, _options);

    return this.each(function() {
        var _this = jQuery(this);
        var _tabset = jQuery(_options.tabset, _this);

        _tabset.each(function() {
            var _list = $(this);
            var _links = _list.find('a.tab', _list);
            if (_links.filter('.active').length == 0) _links.eq(0).addClass('active');

            _links.each(function() {
                var _link = $(this);
                var _href = _link.attr('href');
                var _tab = $(_href, _this);

                if (_link.hasClass('active')) _tab.show();
                else _tab.hide();

                _link.bind(_options.event, function() {
                    _links.filter('.active').each(function() {
                        $($(this).removeClass('active').attr('href')).hide();
                    });
                    _link.addClass('active');
                    _tab.show();
                    return false;
                });
            });
        });
    })
}
/* expertise donut */
function showDonutItem(id) {
    //alert(id);
    switch (id) {
        case 1:
            document.getElementById('expertise01').style.display = 'block';
            document.getElementById('expertise02').style.display = 'none';
            document.getElementById('expertise03').style.display = 'none';
            document.getElementById('expertise04').style.display = 'none';
            document.getElementById('expertise05').style.display = 'none';
            document.getElementById('expertise06').style.display = 'none';

            break;
        case 2:
            document.getElementById('expertise01').style.display = 'none';
            document.getElementById('expertise02').style.display = 'block';
            document.getElementById('expertise03').style.display = 'none';
            document.getElementById('expertise04').style.display = 'none';
            document.getElementById('expertise05').style.display = 'none';
            document.getElementById('expertise06').style.display = 'none';
            break;
        case 3:
            document.getElementById('expertise01').style.display = 'none';
            document.getElementById('expertise02').style.display = 'none';
            document.getElementById('expertise03').style.display = 'block';
            document.getElementById('expertise04').style.display = 'none';
            document.getElementById('expertise05').style.display = 'none';
            document.getElementById('expertise06').style.display = 'none';
            break;
        case 4:
            document.getElementById('expertise01').style.display = 'none';
            document.getElementById('expertise02').style.display = 'none';
            document.getElementById('expertise03').style.display = 'none';
            document.getElementById('expertise04').style.display = 'block';
            document.getElementById('expertise05').style.display = 'none';
            document.getElementById('expertise06').style.display = 'none';
            break;
        case 5:
            document.getElementById('expertise01').style.display = 'none';
            document.getElementById('expertise02').style.display = 'none';
            document.getElementById('expertise03').style.display = 'none';
            document.getElementById('expertise04').style.display = 'none';
            document.getElementById('expertise05').style.display = 'block';
            document.getElementById('expertise06').style.display = 'none';
            break;
        case 6:
            document.getElementById('expertise01').style.display = 'none';
            document.getElementById('expertise02').style.display = 'none';
            document.getElementById('expertise03').style.display = 'none';
            document.getElementById('expertise04').style.display = 'none';
            document.getElementById('expertise05').style.display = 'none';
            document.getElementById('expertise06').style.display = 'block';
            break;
    }
}

/* projects-map */
function showProjectsMap(id) {
    //alert(id);
    switch (id) {
        case 1:
            document.getElementById('project_map_img_01').style.display = 'block';
            document.getElementById('project_map_img_02').style.display = 'none';
            break;
        case 2:
            document.getElementById('project_map_img_01').style.display = 'none';
            document.getElementById('project_map_img_02').style.display = 'block';
            break;
    }
}


function GetLogoCssClass(classNme) {
    switch (classNme) {
        case "project":
            return "Purple";
            break;
        case "about":
            return "Magenta";
            break;

        case "expertise":
            return "Orange";
            break;

        case "relations":
            return "Green";
            break;

        case "contact":
            return "Blue";
            break;

        default:
            return "NONE"
            break;
    }

}


/*
* 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;
    }
});

/*
*
* TERMS OF USE - EASING EQUATIONS
* 
* Open source under the BSD License. 
* 
* Copyright В© 2001 Robert Penner
* 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. 
*
*/


function overlay(bShow) {

    var el = $('#overlayAjaxLo');
    el.css({
        'position': 'absolute',
        'top': -10,
        'left': 182,
        'opacity': 0.4,
        'height': '285px',
        'width': '100%',
        'zIndex': 100
    })

    var im = $('#overlayImage');
    im.css({
        'position': 'absolute',
        'top': '130px',
        'left': '430px',
        'z-index': '200'

    })
    if (bShow) {
        el.show();
        im.show();
    }
    else {
        el.hide();
        im.hide();
    }

}


