﻿/// <reference path="~/scripts/jquery-vsdoc.js" />
var lazyload, clickfix;
(function ($) {

    $(document).ready(function () {
        clickfix();
        $("label.overlabel").overlabel();
        lazyload();
        $('div.tabheader .tabs div a').click(function () {
            $($(this).attr("rel")).show().siblings().hide();
            $(this).parent("div").addClass('selected').siblings().removeClass('selected');
        });
        $('div.ts-statusbox > div.ts-statusbox-icon-close').click(function (e) {
            $(this).parent().fadeOut(function () { $(this).remove(); });
        });
    });

//    $(function () {
//        $('#smsboxcontainer_TopPos').bind('inview', function (event, visible) {
//            if (visible) {
//                var $tmp = $('#boxSmsGreetings');
//                $tmp.prependTo('#smsboxcontainer_TopPos');
//                updateScrollBanners();
//                setTimeout('updateScrollBanners()', 600);
//            } else {
//                var $tmp = $('#boxSmsGreetings');
//                $tmp.prependTo('#smsboxcontainer_BottomPos');
//                updateScrollBanners();
//                setTimeout('updateScrollBanners()', 600);
//            }
//        });
//    });

     $(function () {
        $('iframe.inview').bind('inview', function (event, visible) {
            var banner = $(this);
            if (visible && banner.attr('src') == undefined) {
                banner.attr('src', banner.data('src'));
                banner.removeAttr("data-src");
            }
        });
    });

    lazyload = function (scope) {
        var $ = jQuery;
        if (scope == null) scope = 'body';
        $("img.lazy,.lazy img", $(scope)).lazyload({
            placeholder: '/pic/0.gif',
            effect: 'fadeIn'
        });
    };
    

    clickfix = function (scope) {
        var $ = jQuery;
        if (scope == null) scope = 'body';
        $(".clickfix a", $(scope)).click(function (e) {
            e.stopPropagation();
        });
    };

})(jQuery);

