﻿
function ___GetSourceElementIDFromSender(sender)
{
    var result = false;
    try
    {
        result = sender._postBackSettings.sourceElement.id;
    }
    catch(e)
    {}
    return result;
}
function ___OpenModalWindow(url,width,height,showScroll,showStatus,allowResize,inArg)
{
    var showStyle = "dialogWidth:415px;dialogHeight:420px;scroll:no;status:no;resizable:no;";
    showStyle += "dialogWidth:" + width + "px;";
    showStyle += "dialogHeight:" + height + "px;";
    showStyle += "scroll:" + (showScroll ? "yes;" : "no;");
    showStyle += "status:" + (showStatus ? "yes;" : "no;");
    showStyle += "resizable:" + (allowResize ? "yes;" : "no;");
    if (url.indexOf("?") >= 0)
        url += "&Temp__Data__=" + String(Math.random());
    else
        url += "?Temp__Data__=" + String(Math.random());
    url = encodeURI(url);
    return window.showModalDialog(url, inArg, showStyle);
}
function ___SetWindowRreturnValue(returnValue)
{
    window.returnValue = returnValue;
}
function ___SelectTabPage(tabHeadBox, tabPageCtr)
{   
    if(tabHeadBox.className == "TabItemSelected") return;
    var row = tabHeadBox.parentElement;
    var selectedIndex = -1;
    for(var i=0;i<row.cells.length-1;i++)
    {
        if (row.cells[i].className == "TabItemSelected")
        {
            row.cells[i].className = "TabItem";
            selectedIndex = i;
            break;
        }
    }
    tabHeadBox.className = "TabItemSelected";
    if (selectedIndex != -1)
        tabPageCtr.rows[selectedIndex].style.display = "none";
    tabPageCtr.rows[tabHeadBox.cellIndex].style.display = "block";
}
