﻿/* updated by sunil Gupta*/
var wVal = "";
var hVal = "";
var winH = "";
var Title = "";
function showModelPopup(url, wHeight, titleName) {
    if (document.all) e = event;
    var hid = document.getElementById('interVeil');
    var sid = document.getElementById('pageContainer');
    //var width = sid.scrollWidth;
    var width = screen.width - 22;
  //  var height = sid.scrollHeight; 
  var height = screen.height - 22;
    winH = wHeight;
    Title = titleName;
    hid.style.visibility = 'visible';
    document.getElementById('modelwindow').style.display = 'block';


    var st = Math.max(document.body.scrollTop, document.documentElement.scrollTop);
    if (navigator.userAgent.toLowerCase().indexOf('safari') >= 0) st = 0;
    hid.style.width = width + "px";
    hid.style.height = height + "px";
    //alert(width + " /" + height);
    //the_timeout=setTimeout('move();',100);
    window.setTimeout('placeIt()', 20);
    openwindow(width, height, url);
}

function openwindow(w, h, url) {
    wVal = (w / 2) - (795 / 2);
    hVal = (h / 2) - (550 / 2);
    //moveDiv(end, wVal, hVal); 
    document.getElementById("modelwindow").style.left = wVal + "px";
    document.getElementById("modelwindow").style.top = hVal + "px";
    //document.getElementById("modelwindow").style.top = "30px";
    document.getElementById('titleModel').innerHTML = "<h2>"+Title+"</h2>";
    document.getElementById('DivExample').innerHTML = "<iframe src='" + url + "' style='overflow:hidden; overflow-y:auto; width:785px; height:" + winH + "px; scrolling='no' frameborder='0' align='middle'></iframe>";
}

function placeIt() {
    var nAgt = navigator.userAgent;
    var obj = document.getElementById('modelwindow');
    var objmain = document.getElementById('pageContainer');
    var tHeight = screen.height - 150; 
    if (nAgt != "Natscape") {
        theLeft = document.documentElement.scrollLeft;
        //theTop = document.documentElement.scrollTop;
        theTop = (tHeight / 2) - (winH / 2);
        theTop = (theTop - 25);
    }
    else if (nAgt == "Natscape") {
        theLeft = document.body.scrollLeft;
        //theTop = document.body.scrollTop;
        theTop = (tHeight / 2) - (winH / 2);
    }
    //alert(theTop);
    obj.style.left = Math.abs(theLeft) + (screen.width / 2) - (795 / 2) + 'px';
    obj.style.top = Math.abs(theTop) + 'px';
 
    window.setTimeout('placeIt()', 20);
}

function hideWind(Msg) {   
    document.getElementById('modelwindow').style.display = 'none';
    var hid = document.getElementById('interVeil');
    document.getElementById('DivExample').innerHTML = "";
    hid.style.visibility = 'hidden';
    parent.AddMessage(Msg);
}

function hideWindAndParentRedirect(redirect) {
    document.getElementById('modelwindow').style.display = 'none';
    var hid = document.getElementById('interVeil');
    document.getElementById('DivExample').innerHTML = "";
    hid.style.visibility = 'hidden';
    parent.location = redirect;
}

function hideWindClose() {   
    document.getElementById('modelwindow').style.display = 'none';
    var hid = document.getElementById('interVeil');
    document.getElementById('DivExample').innerHTML = "";
    hid.style.visibility = 'hidden';
    }
var the_timeout;
function move() {
    var the_style = getStyleObject("modelwindow");
    if (the_style) {
        var start = parseInt(the_style.left);
        var end = 75;
        moveDiv(end, wVal, hVal);
    }

}




//*** Model Windoe (Hight & width) Sunil Gupta June 04, 2009 **/
var wValR = "";
var hValR = "";
var winHR = "";
var winWR = "";
var TitleR = "";
function showModelHWPopup(url, wHeight, wWidth, titleName) {
    if (document.all) e = event;
    var hid = document.getElementById('interVeil');
    var sid = document.getElementById('pageContainer');
    //var width = sid.scrollWidth;
    var width = screen.width - 22;
    var height = sid.scrollHeight;
    winHR = wHeight/2;
    winWR = wWidth/2;
    TitleR = titleName;
    hid.style.visibility = 'visible';
    document.getElementById('modelWindReport').style.display = 'block';
    var st = Math.max(document.body.scrollTop, document.documentElement.scrollTop);
    if (navigator.userAgent.toLowerCase().indexOf('safari') >= 0) st = 0;
    hid.style.width = width + "px";
    hid.style.height = height + "px";
    //window.setTimeout('placeHWIt()', 1);
    openHWwindow(width, height, winHR, winWR, url);
}

function openHWwindow(w, h, HR, WR, url) {
    //wValR = (w / 2) - WR;
    wValR = ((screen.width - 22)/2) - WR;
    hValR = (h / 2) - HR;
    
    //alert(wValR);
    document.getElementById("modelWindReport").style.left = (wValR)/2 + "px";
    document.getElementById("modelWindReport").style.top = "30px";
    document.getElementById('titleModelHW').innerHTML = "<h2>" + TitleR + "</h2>";
    document.getElementById('DivExampleHW').innerHTML = "<iframe src='" + url + "' style='overflow:hidden; overflow-y:auto; width:" + ((winWR * 2) + 30) + "px; height:" + (winHR * 2) + "px;' scrolling=no frameborder=0 align=middle></iframe>";
   // alert(document.getElementById('DivExampleHW').innerHTML);
}

function placeHWIt() {
    var nAgt = navigator.userAgent;
    var obj = document.getElementById('modelWindReport');
    var objmain = document.getElementById('pageContainer');
    var tHeight = screen.height - 150;
    if (nAgt != "Natscape") {
        theLeft = document.documentElement.scrollLeft;
        //theTop = document.documentElement.scrollTop;
        theTop = (tHeight / 2) - (winH / 2);
    }
    else if (nAgt == "Natscape") {
        theLeft = document.body.scrollLeft;
        //theTop = document.body.scrollTop;
        theTop = (tHeight / 2) - (winH / 2);
    }
    obj.style.left = Math.abs(theLeft) + (screen.width / 2) - (795 / 2) + 'px';
    obj.style.top = Math.abs(theTop) + 'px';

    window.setTimeout('placeHWIt()', 20);
}

function hideHWwind() {   
    document.getElementById('modelWindReport').style.display = 'none';
    var hid = document.getElementById('interVeil');
    document.getElementById('DivExampleHW').innerHTML = "";
    hid.style.visibility = 'hidden';
}
 