﻿//右下角弹窗JS代码

var showadbox = function(boxad11id, tipheight) {
    if (!boxad11id) boxad11id = 'boxad11';
    if (!tipheight) tipheight = 150;

    var objclientheigth = document.getElementById(boxad11id).clientHeight;
    jQuery('#' + boxad11id).height(objclientheigth + 2);
    if (objclientheigth < tipheight) {
        setTimeout(function() { showadbox(boxad11id, tipheight) }, 5);
    }
}

var closead11adbox = function(boxad11id) {
    if (!boxad11id) boxad11id = 'boxad11';
    var objclientheigth = document.getElementById(boxad11id).clientHeight;
    /*
    jQuery('#'+boxad11id).height(objclientheigth-2);
    if(objclientheigth>1 && objclientheigth<=202) {
    setTimeout(function(){closead11adbox(boxad11id)},5);        
    }*/
    jQuery('#' + boxad11id).height(1);
    if (objclientheigth <= 1) {
        jQuery('#' + boxad11id).hide();
    }
}

var zoomad11InBox = function(boxad11id) {
    if (!boxad11id) boxad11id = 'boxad11';
    var objclientheigth = document.getElementById(boxad11id).clientHeight;
    jQuery('#' + boxad11id).height(30);
    /*
    if(objclientheigth>=30 && objclientheigth<=202) {
    setTimeout(function(){zoomad11InBox(boxad11id)},5);        
    }*/
}

var zoomad11OutBox = function(boxad11id, tipheight) {
    if (!boxad11id) boxad11id = 'boxad11';
    if (!tipheight) tipheight = 150;

    var objclientheigth = document.getElementById(boxad11id).clientHeight;
    jQuery('#' + boxad11id).height(objclientheigth + 2);
    if (objclientheigth < tipheight) {
        setTimeout(function() { zoomad11OutBox(boxad11id, tipheight) }, 5);
    }
}

jQuery(function() {

    if (jQuery.browser.msie) { //对于不同浏览弹出高度的区别IE为210,其他194
        var tipheight = 28;
    } else {
        var tipheight = 28;
    }
//    if (jQuery.cookie('hasshow') != 1) {
//        jQuery('#boxad11').show();
//        showadbox('boxad11', tipheight);
//    }
    jQuery('#closead11').click(function() {
        closead11adbox('boxad11');
        jQuery.cookie('hasshow', 1);
    });
    jQuery('#zoomad11').click(function() {
        if (document.getElementById('boxad11').clientHeight >= tipheight) {
            zoomad11InBox('boxad11');
            jQuery('#zoomad11').attr("title", "点击展开");
            jQuery('#zoomad11 img').attr("src", "/skins/front/images/kai.jpg");
        } else {
            zoomad11OutBox('boxad11', tipheight);
            jQuery('#zoomad11').attr("title", "点击收缩");
            jQuery('#zoomad11 img').attr("src", "/skins/front/images/xiao.jpg");
        }
    });

});

