﻿function center(obj) {
             var x, y
             if (document.documentElement || document.body.offsetWidth) {
                 if (document.documentElement && document.documentElement.offsetWidth && document.documentElement.offsetWidth > 0) {
                     x = document.documentElement.offsetWidth;
                     y = document.documentElement.offsetHeight;
                 } else {
                     x = document.body.offsetWidth;
                     y = document.body.offsetHeight;
                 }
             } else {
                 x = top.innerWidth;
                 y = top.innerHeight;
             }
             obj.style.left = Math.floor((x - obj.offsetWidth) / 2) + "px";
             obj.style.top = Math.floor((y - obj.offsetHeight) / 2) + "px";
         }

function center1(object)
 {
  object.style.marginLeft = parseInt((document.body.clientWidth - object.offsetWidth) / 2) + "px";
  object.style.marginTop = parseInt((screen.height - object.offsetHeight) / 2) + "px";
 }

         function GetWidth() {
                var x = 0;
                if (self.innerHeight) {
                    x = self.innerWidth;
                }
                else if (document.documentElement && document.documentElement.clientHeight) {
                    x = document.documentElement.clientWidth;
                }
                else if (document.body) {
                    x = document.body.clientWidth;
                }
                return x;
            }

            function GetHeight() {
                var y = 0;
                if (self.innerHeight) {
                    y = self.innerHeight;
                }
                else if (document.documentElement && document.documentElement.clientHeight) {
                    y = document.documentElement.clientHeight;
                }
                else if (document.body) {
                    y = document.body.clientHeight;
                }
                return y;
            }

         function loadwindow(url, width, height) {
             //document.body.className = "modalBackground";


             document.getElementById("dwindow").style.display = ''
             document.getElementById("dwindowSec").style.display = ''

             newWidth = screen.width;// GetWidth();
             newHeight = Math.max(GetHeight(), document.body.clientHeight);


             document.getElementById("dwindow").style.width = newWidth + 'px';
             document.getElementById("dwindow").style.height = newHeight + 'px';


             document.getElementById("dwindowSec").style.width = width + 'px';
             document.getElementById("dwindowSec").style.height = height + 'px';


             document.getElementById("cframe").style.width = width + 'px';
             document.getElementById("cframe").style.height = height + 'px';
             document.getElementById("cframe").src = url;


            if(navigator.appName == 'Microsoft Internet Explorer')
            center(document.getElementById("dwindowSec"));
             else
            center1(document.getElementById("dwindowSec"));
            }
         
        
         

         function closeit() {
             window.parent.document.getElementById("dwindowSec").style.display = 'none'
             window.parent.document.getElementById("dwindow").style.display = "none"
             window.parent.document.getElementById("cframe").src = "";
             //document.body.className = "";
         }