function  getPageSize(){
       var xScroll, yScroll;

       if (window.innerHeight && window.scrollMaxY) {
               xScroll = document.body.scrollWidth;
               yScroll = window.innerHeight + window.scrollMaxY;
       } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
               xScroll = document.body.scrollWidth;
               yScroll = document.body.scrollHeight;
       } else if (document.documentElement && document.documentElement.scrollHeight > document.documentElement.offsetHeight){ // Explorer 6 strict mode
               xScroll = document.documentElement.scrollWidth;
               yScroll = document.documentElement.scrollHeight;
       } else { // Explorer Mac...would also work in Mozilla and Safari
               xScroll = document.body.offsetWidth;
               yScroll = document.body.offsetHeight;
       }

       var windowWidth, windowHeight;
       if (self.innerHeight) { // all except Explorer
               windowWidth = self.innerWidth;
               windowHeight = self.innerHeight;
       } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
               windowWidth = document.documentElement.clientWidth;
               windowHeight = document.documentElement.clientHeight;
       } else if (document.body) { // other Explorers
               windowWidth = document.body.clientWidth;
               windowHeight = document.body.clientHeight;
       }

       // for small pages with total height less then height of the viewport
       if(yScroll < windowHeight){
               pageHeight = windowHeight;
       } else {
               pageHeight = yScroll;
       }

       // for small pages with total width less then width of the viewport
       if(xScroll < windowWidth){
               pageWidth = windowWidth;
       } else {
               pageWidth = xScroll;
       }

       return [pageWidth,pageHeight,windowWidth,windowHeight];
}
var op;
  $(document).ready(
function()
{

$('#windowOpen').bind(
'click',
function() {
if($('#window').css('display') == 'none') {
//alert(innerHeight);
var t = getPageSize();
document.getElementById ("body").style.height = t[1];
document.getElementById ("body").style.width = document.body.clientWidth;
document.getElementById ("body").style.opacity = 0.4;
document.getElementById ("body").style.backgroundColor = 'black';
//document.getElementById('body').style.top = document.body.scrollTop;
document.getElementById('body').style.top = 0;
document.getElementById ("body").style.MozOpacity = 0.4;
document.getElementById ("body").style.filter = "Alpha(Opacity=40)";
//document.getElementById ("window").style.opacity = 1;
document.getElementById('window').style.left = (document.body.clientWidth-600)*0.5;
document.getElementById('window').style.top = document.body.scrollTop+ (document.body.clientHeight-500)*0.5;
op = 1;
$(this).TransferTo(
{
to:'window',
className:'transferer2', 
duration: 500,
complete: function()
{
$('#window').show();
document.submit_form.elements[0].focus();
}
}
);
}
this.blur();
return false;
}
);
$('#windowClose').bind(
'click',
function()
{
$('#window').TransferTo(
{
to:'windowOpen',
className:'transferer2', 
duration: 400
}
).hide();
document.getElementById('window').style.display = 'none';
document.getElementById ("body").style.height = 0;
document.getElementById ("body").style.width = 0;
document.getElementById ("body").style.opacity = 1;
op = 0;
}
);
$('#window').Resizable(
{
minWidth: 200,
minHeight: 60,
maxWidth: 700,
maxHeight: 400,
dragHandle: '#windowTop',
handlers: {
se: '#windowResize'
},
onResize : function(size, position) {
$('#windowBottom, #windowBottomContent').css('height', size.height-33 + 'px');
var windowContentEl = $('#windowContent').css('width', size.width - 25 + 'px');
if (!document.getElementById('window').isMinimized) {
windowContentEl.css('height', size.height - 48 + 'px');
}
}
}
);
}
);
