﻿///*******************************************
/// Processing PopOut Message v1.0
/// 
///  Created On:  12/18/2006 by Rich Grimes
/// Modified On:
///*******************************************

/// Included on page <div id="PocPopOutContainer" style="visibility:hidden;position:absolute;"></div>
/// At end of page include <script type="text/javascript">AttachProcPopOut('lemonchiffon','images/Warning.gif','images/Close.gif')</script>

var ProcTable = document.createElement("table");
var ProcTableBody = document.createElement("tbody");
var ProcTableRow = document.createElement("tr");

var PointerTable = document.createElement("table");
var PointerTableBody = document.createElement("tbody");
var PointerTableRow = document.createElement("tr");
var PointerCell = document.createElement("td");
var PointerArrowCell = document.createElement("td");

var ImageCell = document.createElement("td");
var ImageCellIcon = document.createElement("img");
var ProcessingMessageCell = document.createElement("td");
    
// Processing Table
ProcTable.id = "PopOut"
ProcTable.cellPadding = 0;
ProcTable.cellSpacing = 0;
ProcTable.border = 0;
ProcTable.width = "190;";

// Processing Table Row
ProcTableRow.vAlign = 'top';
ProcTableRow.style.height = "100%";

// Pointer Cell
PointerCell.width = 20;
PointerCell.align = "right";
PointerCell.style.height = "100%";
PointerCell.style.verticalAlign = "top";

// Pointer Table
PointerTable.cellPadding = 0;
PointerTable.cellSpacing = 0;
PointerTable.border = 0;
PointerTable.style.height = "100%";

// Pointer Arrow Cell
PointerArrowCell.align = "right";
PointerArrowCell.vAlign = "top";
PointerArrowCell.style.fontSize = "1px";
PointerArrowCell.style.paddingTop = "8px";

// Image Cell
ImageCell.width = 20;
ImageCell.style.borderTop = "1px solid black";
ImageCell.style.borderLeft = "1px solid black";
ImageCell.style.borderBottom = "1px solid black";
ImageCell.style.padding = "5px";
ImageCell.style.backgroundColor = 'LemonChiffon';
ImageCell.vAlign = "middle"

// Image Cell Icon
ImageCellIcon.border = 0;
ImageCellIcon.src = "images/SmallGear.gif";

// Processing Message Cell
ProcessingMessageCell.id = "tdErrMsg";
ProcessingMessageCell.style.backgroundColor = 'LemonChiffon';
ProcessingMessageCell.style.fontFamily = 'verdana';
ProcessingMessageCell.style.fontSize = '10px';
ProcessingMessageCell.style.padding = "5px";
ProcessingMessageCell.style.borderTop = "1px solid black";
ProcessingMessageCell.style.borderBottom = "1px solid black";
ProcessingMessageCell.style.borderRight = "1px solid black";
ProcessingMessageCell.width = '100%';
ProcessingMessageCell.vAlign = "middle"

// Attach PopOut to "PocPopOutContainer"
function AttachProcPopOut(BgColor,IconSrc)
{
        
    // Create the DOM tree
    var pCont = document.getElementById("PocPopOutContainer")
    pCont.appendChild(ProcTable)
        
    ProcTable.appendChild(ProcTableBody);
    ProcTableBody.appendChild(ProcTableRow);
    ProcTableRow.appendChild(PointerCell);
    PointerCell.appendChild(PointerTable);
    PointerTable.appendChild(PointerTableBody);
    PointerTableBody.appendChild(PointerTableRow);
    PointerTableRow.appendChild(PointerArrowCell);
    ProcTableRow.appendChild(ImageCell);
    ImageCell.appendChild(ImageCellIcon);
    ProcTableRow.appendChild(ProcessingMessageCell);
           
    // initialize callout arrow
    var div1 = document.createElement("div");
    div1.style.fontSize = "1px";
    div1.style.position = "relative";
    div1.style.left = "1px";
    div1.style.borderTop = "1px solid black";
    div1.style.width = "15px";
    PointerArrowCell.appendChild(div1);        
    
    for(var i = 14; i > 0; i--)
    {
        var line1 = document.createElement("div");
            line1.style.width = i.toString() + "px";
            line1.style.height = "1px";
            line1.style.overflow = "hidden";
            line1.style.backgroundColor = BgColor;
            line1.style.borderLeft = "1px solid black";
            div1.appendChild(line1);
    }
    
     // Assign Style
    IconCell.style.backgroundColor = BgColor;
    MessageCell.style.backgroundColor = BgColor;
    CloseCell.style.backgroundColor = BgColor;
    ImageCellIcon.src = IconSrc;
    
}
    
function ShowProcMessage(objectID,message)
{
    
    var p = document.getElementById(objectID);
    p.disabled = true;
    
    var pCont = document.getElementById('PocPopOutContainer');
        
    var top  = null;
    var left = null;
        
    top = p.offsetTop;
    left = p.offsetLeft + (p.offsetWidth / 2);
              
    while (p = p.offsetParent) {
	    top += p.offsetTop;
	    left += p.offsetLeft;
    }
    
    pCont.style.position   = "absolute";
    pCont.style.top        = top + 'px';
    pCont.style.left       = left + 'px';
    pCont.style.visibility = "visible";
    
    ProcessingMessageCell.innerHTML = message;
                
}
    
function HideProcMessage(objectID)
{
    var pCont = document.getElementById('PocPopOutContainer');
    pCont.style.visibility = "hidden";
    
    var p = document.getElementById(objectID);
    p.disabled = false;
}