//popUp window
function popWindow(property){
    this.iframe = property.iframe;
    this.iframePage = property.iframePage;
    this.popContent = property.popContent;
    this.popButtons = property.popButtons;
    this.init();
}
popWindow.prototype = {
    iframe : false,//内容是否以Iframe显示
    iframePage : '',//Iframe连接的显示页面
    popContent : '',//显示的文本内容
    popButtons : '',//操作按钮
    init : function(){
		//this.insertPopDom();
    },
    
    insertPopDom : function(){
        var w = Math.max(document.documentElement.scrollWidth,document.body.clientWidth,document.body.scrollWidth,document.documentElement.clientWidth);
        var h = Math.max(document.documentElement.scrollHeight,document.body.clientHeight,document.body.scrollHeight,document.documentElement.clientHeight);
        if(!this.iframe){
            var popStr = '<div id="id_popWindow" class="id_panel"><div class="id_panelContent"><span class="id_closeBtn" title="关闭"></span><div class="id_panelText">'+ this.popContent +'</div><div class="id_panelBar">'+ this.popButtons +'</div></div></div>';
        }else{
            var popStr = '<div id="id_popWindow" class="id_panel"><div class="id_panelContent"><span class="id_closeBtn" title="关闭"></span><div class="id_popIframe"><iframe width="300" id="id_popIframe" height="171" frameborder="0" src="'+ this.iframePage +'" scrolling="no"></iframe></div></div></div>';
        }
        var blackLayer = '<div class="id_bg"></div>';
        $(blackLayer).appendTo('body').css({width : w + 'px',height : h + 'px'});
        $(popStr).appendTo('body');
        window.onresize = function(){
            $('.id_bg').css('width',Math.max(document.documentElement.scrollWidth,document.body.clientWidth,document.body.scrollWidth,document.documentElement.clientWidth)+'px');
            $('.id_bg').css('height',Math.max(document.documentElement.scrollHeight,document.body.clientHeight,document.body.scrollHeight,document.documentElement.clientHeight)+'px');
        }
        
    },
    
    openPopWindow : function(){
        this.insertPopDom();
        $('.id_closeBtn').bind('click',this.closePopWindow);
        $('#id_popOk').bind('click',this.closePopWindow);
        //$('#popIframe').contents().find('img').bind('click',this.closePopWindow);
    },
    
    closePopWindow : function(){
        $('.id_bg').remove();
        $('#id_popWindow').remove();
    }
    
}
