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

