(function(){

    var layerid = 'layer5C89644CB5E071782E769433177B2B99';

    var module_height = '';

    if (layerid.length == 0) return;

    if(module_height && parseInt(module_height)){

        $('#'+layerid).css('height',module_height+'px').removeAttr('module_height');

        $('#'+layerid+' .wp-resizable-wrapper').css('height',module_height+'px');

    }

    var $content = $('#'+layerid+'_content');

    var bsize = "0";

    $content.css("border", 'none');

    var borderwidth = 2 * parseInt(bsize),cntheight = $content.parent().height() - borderwidth,cnvpos = $('#canvas').offset();

    cnvpos.left += $._parseFloat($('#canvas').css("borderLeftWidth")) + $('#scroll_container').scrollLeft();

    var canwidth = $('#scroll_container_bg').width()<$('#canvas').width()?$('#canvas').width():$('#scroll_container_bg').width();

    $content.css({left: -(cnvpos.left)+'px',width: (canwidth - borderwidth)+'px',height: cntheight+'px', 'position' : 'absolute'});

    $('#'+layerid).css({left: '0',width: $('#canvas').width()});

    $('#'+layerid+' .banner').css("min-height", cntheight+'px'); $('#'+layerid+' .banner').css("height", cntheight+'px');

    $('#'+layerid+' .bannerul').css("height", cntheight+'px');

    $('#'+layerid+' .banner ul li').css("min-height", cntheight+'px').css('width',($('#scroll_container_bg').width() - borderwidth)+'px');$('#'+layerid+' .banner ul li').css("height", cntheight+'px');

    $('#'+layerid+' .banner .inner').css("padding", cntheight/2+'px 0px');
    
})();

window.onload = function () {
    var nav_keys = 'Y';
    if (nav_keys == 'S') {
        var obj = $('#layer5C89644CB5E071782E769433177B2B99');
        var num = obj.find('.html5zoo-bullet-wrapper-0').children().length;
        var width = parseInt(num * 60) + parseInt(num * 12) + 30;
        for (var i = 0; i < num; i++) {
            obj.find('.html5zoo-bullet-0-'+i).css({
                'width' : '60px',
                'height' : '15px',
                'line-height' : '15px',
                'border-radius' : '0',
                'opacity' : 1,
                'margin-left' : '2px',
                'margin-right' : '2px'
            }).append((parseInt(i)+1));
        }
        obj.find('.wp-unslider_content .dotsnew div').css({
            'text-indent' : '0',
            'color' : '#FFFFFF',
        }).parent('.dotsnew').css({
            'width' : width + 'px'
        });
    }
};

function detectZoom (){ 
    var ratio = 0,
    screen = window.screen,
    ua = navigator.userAgent.toLowerCase() || '';

    if (window.devicePixelRatio !== undefined) {
        ratio = window.devicePixelRatio;
    }else if (~ua.indexOf('msie')) {  
        if (screen.deviceXDPI && screen.logicalXDPI) {
            ratio = screen.deviceXDPI / screen.logicalXDPI;
        }
    }else if (window.outerWidth !== undefined && window.innerWidth !== undefined) {
        ratio = window.outerWidth / window.innerWidth;
    }

    if (ratio){
        ratio = Math.round(ratio * 100);
    }

    return ratio;
};

$(function(){

    var ctrldown = false;

    $(window).resize(function(){

                if(!ctrldown){

                var layerid = 'layer5C89644CB5E071782E769433177B2B99';

                var $content = $('#'+layerid+'_content');

                var bsize = "0";

                var borderwidth = 2 * parseInt(bsize),cntheight = $content.parent().height() - borderwidth,cnvpos = $('#canvas').offset();

                cnvpos.left += $._parseFloat($('#canvas').css("borderLeftWidth")) + $('#scroll_container').scrollLeft() - 48;

                var canwidth = $('#scroll_container_bg').width()<$('#canvas').width()?$('#canvas').width():$('#scroll_container_bg').width();

                $content.css({left: -(cnvpos.left)+'px',width: (canwidth - borderwidth)+'px',height: cntheight+'px'});  

                

                }

    });

    $(window).keydown(function(event){

            if(!event.ctrlKey){

                var layerid = 'layer5C89644CB5E071782E769433177B2B99';

                var $content = $('#'+layerid+'_content');

                var bsize = "0";

                var borderwidth = 2 * parseInt(bsize),cntheight = $content.parent().height() - borderwidth,cnvpos = $('#canvas').offset();

                cnvpos.left += $._parseFloat($('#canvas').css("borderLeftWidth")) + $('#scroll_container').scrollLeft();

                var canwidth = $('#scroll_container_bg').width()<$('#canvas').width()?$('#canvas').width():$('#scroll_container_bg').width();

                $content.css({left: -(cnvpos.left)+'px',width: (canwidth - borderwidth)+'px',height: cntheight+'px'});



            }else{

                ctrldown = true;

            }

    });

    var $content = $('#layer5C89644CB5E071782E769433177B2B99 #layer5C89644CB5E071782E769433177B2B99_content');

    var cntheight = $content.parent().height();

    cntheight = $('#layer5C89644CB5E071782E769433177B2B99 .wp-unslider_content').height();

    if(cntheight=='') cntheight=267;

    var  cnpos = $('#layer5C89644CB5E071782E769433177B2B99 .wp-unslider_content').offset();

    var contentpos = (cntheight)-39;

    var scripts = document.getElementsByTagName("script");

    var jsFolder = "";

    for (var i= 0; i< scripts.length; i++)

    {

        if( scripts[i].src && scripts[i].src.match(/lovelygallery\.js/i))

        jsFolder = scripts[i].src.substr(0, scripts[i].src.lastIndexOf("/") + 1);

    }

    $LAB

    .script(relativeToAbsoluteURL('plugin/unslider/js/html5zoo.js')).wait(function(){

    var win_width = $('#scroll_container_bg').width();
    var easing = '';
    switch ('all') {
        case '' : 
            easing = 'slide,slice,blocks,blinds,shuffle,threed';
            break;
        case 'all' : 
            easing = 'slide,slice,blocks,blinds,shuffle,threed';
            break;
        case 'slide' :
           easing = 'slide';
           break;
        case 'slice' : 
           easing = 'slice';
           break;
        case 'blocks' : 
           easing = 'blocks';
           break;
        case 'blinds' : 
           easing = 'blinds';
           break;
        case 'shuffle' : 
           easing = 'shuffle';
           break;
        case 'threed' : 
           easing = 'threed';
           break;
    }

    var autoplay = '1' != '' ? 1 : 0;

    var slideinterval = '5' != '' ? 5000 : 3000;
    var titlecss = '';
    if ('41' != '' || 'SimSun' != '' || '#FFFFFF' != '') {
        titlecss = "display:block; position:relative; font:41px SimSun; color:#FFFFFF;";
    } else {
        titlecss = 'display:block; position:relative; font:40px SimSun; color:#fff;';
    }

    jQuery("#layer5C89644CB5E071782E769433177B2B99html5zoo-1").html5zoo({

        jsfolder:jsFolder,

        width:win_width,height:cntheight,

        skinsfoldername:"",loadimageondemand:false,isresponsive:false,

        addmargin:true,randomplay:false,

        slideinterval:slideinterval,     // 控制时间

        loop:0,

        autoplay:autoplay,

        skin:"Frontpage",

        navbuttonradius:0,

        navmarginy:contentpos,showshadow:false,

        navcolor:"#999999",

        texteffect:"fade",

        navspacing:12,

        arrowtop:50,

        textstyle:"static",

        navpreviewborder:4,

        navopacity:0.8,

        shadowcolor:"#aaaaaa",

        navborder:4,

        navradius:0,

        navmarginx:16,

        navstyle:"bullets",

        timercolor:"#ffffff",

        navfontsize:12,

        navhighlightcolor:"#333333",

        navheight:12,navwidth:12,

        navshowfeaturedarrow:false,

        titlecss:titlecss,//font style

        arrowhideonmouseleave:win_width,

        texteffectduration:win_width,

        border:0,

        timerposition:"bottom",

        navfontcolor:"#333333",

        borderradius:0,

        textcss:"display:block; padding:12px; text-align:left;",

        navbordercolor:"#ffffff",

        textpositiondynamic:"bottomleft",

        ribbonmarginy:0,

        ribbonmarginx:0,

        unsliderheight:cntheight,

        unsliderlid:'layer5C89644CB5E071782E769433177B2B99',

        slide: {

            duration:win_width,

            easing:"easeOutCubic",

            checked:true

        },

        crossfade: {

            duration:win_width,

            easing:"easeOutCubic",

            checked:true

        },

        threedhorizontal: {

            checked:true,

            bgcolor:"#222222",

            perspective:win_width,

            slicecount:1,

            duration:1500,

            easing:"easeOutCubic",

            fallback:"slice",

            scatter:5,

            perspectiveorigin:"bottom"

        },

        slice: {

            duration:1500,

            easing:"easeOutCubic",

            checked:true,

            effects:"up,down,updown",

            slicecount:10

        },

        fade: {

            duration:win_width,

            easing:"easeOutCubic",

            checked:true

        },

        blocks: {

            columncount:5,

            checked:true,

            rowcount:5,

            effects:"topleft,bottomright,top,bottom,random",

            duration:1500,

            easing:"easeOutCubic"

        },

        blinds: {

            duration:2000,

            easing:"easeOutCubic",

            checked:true,

            slicecount:3

        },

        shuffle: {

            duration:1500,

            easing:"easeOutCubic",

            columncount:5,

            checked:true,

            rowcount:5

        },

        threed: {

            checked:true,

            bgcolor:"#222222",

            perspective:win_width,

            slicecount:5,

            duration:1500,

            easing:"easeOutCubic",

            fallback:"slice",

            scatter:5,

            perspectiveorigin:"right"

        },

        transition : easing
    });

        var fontheight = $('#layer5C89644CB5E071782E769433177B2B99 .unslidertxtf').height();

        $('#layer5C89644CB5E071782E769433177B2B99 .unslidertxtf').css({
            'top':(cntheight-fontheight),
            'display' : '0' == 1 ? 'block' : 'none'
        });
        $('#layer5C89644CB5E071782E769433177B2B99 .dotsnew').css({
            'display' : '1' == 1 ? 'block' : 'none'
        });

    });    
});