﻿// JScript File

var winW = 800, winH = 600;
//Get window Size
function GetWindowSize()
{
// the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
if (typeof window.innerWidth != 'undefined')
{
    winW = window.innerWidth;
    winH = window.innerHeight;
}
// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)
else if (typeof document.documentElement != 'undefined'
            && typeof document.documentElement.clientWidth !=
                'undefined' && document.documentElement.clientWidth != 0)
{
    winW = document.documentElement.clientWidth;
    winH = document.documentElement.clientHeight;
}
// older versions of IE
else
{
    winW = document.getElementsByTagName('body')[0].clientWidth,
    winH = document.getElementsByTagName('body')[0].clientHeight
}
}   	   
//Show Div
function OpenSubWindows(sTitle, objDiv, objIFrame, url, MaPH, HeightDiv)
{    
   var Title =  document.getElementById('TieuDeTD');
   Title.innerHTML = sTitle;
   
   var PosWidth = (winW-900)/2-11;
   var PosHeight;
   var PHeight;
   if (HeightDiv == 0)
   {
        PosHeight = (winH-140);
   }
   else
   {
        PosHeight = HeightDiv;
   }
   var PosTop = (winH - PosHeight)/2;
   var pTop = PosTop + "px";
   PHeight = PosHeight + "px";
   var PWidth = PosWidth + "px";
   var ODiv = '#' + objDiv;              
    $.blockUI({ 
        message: $(ODiv), 
        css: 
        { 
            top:    pTop,
            width:  '900px',
            height: PHeight,
            left:   PWidth,
            border:		'2px solid #aaa',
            padding: '3px',
            backgroundColor:'#F6F6F6'
            
        } 
     }); 
    
     //set chiều cao cho IFrame		    
    var IFrame = document.getElementById(objIFrame);
    var hIFrame = PosHeight - 35;
    IFrame.style.width = '900px';
    IFrame.style.height = hIFrame + "px";
    url += MaPH;
    IFrame.src = url;
}

function CloseSubWindow(objDiv, objFlag, url)
{

    var hFlag = document.getElementById(objFlag);
    var Flag = parseInt(hFlag.value);
    if(Flag == 0)
    {
        $.unblockUI();
        hFlag.value = 0;
    }
    else
    {
        hFlag.value = 0;
        //document.location.reload(true);
        window.location.href = url;
    }
}


function OpenBoSung(MaPH)
{
    var divsub = document.getElementById('DIVBoSung');
    var PosWidth = (winW-900)/2-11;
    var PosHeight = (winH-140);
    var PWidth = PosWidth + "px";
   // divsub.style.backgroundColor = "#FFFFFF";
    var PHeight = PosHeight + "px";
    
   divsub.style.display = "";
   divsub.style.position = "absolute";
   divsub.style.width = "900px";
   divsub.style.top = "90px";
   divsub.style.left= PosWidth + "px";
   
   
   var IFrame = document.getElementById('IFrameBoSung');
   var hIFrame = PosHeight - 40;
   IFrame.style.width = '900px';
   IFrame.style.height = hIFrame + "px";
   url = 'BoSungFB.aspx?EditMaPhanHoi=' + MaPH;
   IFrame.src = url;
}
function CloseBoSung()
{
    var divsub = document.getElementById('DIVBoSung');
    divsub.style.display = "none";
}