var Frame = {
    data:{
        title:"title",
        content:"content",
        buttons:{}
    },
    init:function(){
        
    },  
    draw:function(){
        
        var html = "";
        html += "<tr><td class='title'><a href='javascript:void(0)' onclick='Frame.close()'>x</a><span class='text'>"+Frame.data.title+"</span></td></tr>";
        html += "<tr><td class='content'>"+Frame.data.content+"</td></tr>";
        if(Frame.data.buttons.length > 0){
            html += "<tr><td class='buttons'><div class='hr'>&nbsp;</div>";
            var n = Frame.data.buttons.length,i=0;
            for(i =0; i <n; i++){
                html += "<button onclick='new Frame.data.buttons["+i+"].event'>"+Frame.data.buttons[i].title+"</button>";
            }
                //<button>Button</button><button>Button</button><button>Button</button>
            html += "</td></tr>";
        }
        
        $("#FrameDrawPanel").html(html);
        
    },
    open:function(){
       
        Frame.draw();
        $("#DarckScreen").css('display',"block") ;
        try{
            var heightBody=window.document.getElementById("bodyDoc").scrollHeight;
        }catch(e){
            //alert(e);
        }
        
        try{
            //var width = window.document.getElementById("FrameDrawPanel").offsetWidth;
        }catch(e){
           // alert(e);
        }
        
        try{
            var width = $('#FrameDrawPanel').width();
            $('#FrameDrawPanel').css('margin-left',"-"+width/2+"px");
             var height = $('#FrameDrawPanel').height();
        if(navigator.appName=='Microsoft Internet Explorer')
                $('#FrameDrawPanel').css('margin-top',"250px");
        else
                $('#FrameDrawPanel').css('margin-top',"-"+height/2+"px");
        }catch(e){
            alert(e);
        }
        /*var gh = "-"+parseInt(parseInt(window.document.getElementById("FrameDrawPanel").offsetWidth)/2).toString()+"px";
        document.getElementById("FrameDrawPanel").style.marginLeft = gh;*/
         $("#DarckScreen").css('height',heightBody+"px") ;
         
         
         
    },
    close:function(){
        document.getElementById("DarckScreen").style.display = "none";
        if(navigator.appName=='Microsoft Internet Explorer')
            window.document.getElementById('FrameDrawPanel').style.marginTop='250px';
    }
}
