﻿function OpenToWindow(pageUrl, windowName, width, height, top, left, resizable, scrollbars)
{
	window.open(pageUrl, windowName, 'width='+ width +', height='+ height +', resizable=' + resizable + ', scrollbars=' + scrollbars + ', location=no, toolbar=no, menubar=no, status=no, top=' + top + ', left=' + left );
}

function MaxCharacter(ObjectId,MaxLength)
{
    if (document.getElementById(ObjectId).value.length>MaxLength)
    {
        document.getElementById(ObjectId).value = document.getElementById(ObjectId).value.substr(0,MaxLength);
    }
}
function SearchShow(SearchCheck,SearchCheckLinkTable,SearchTable)
{   
    if (document.getElementById(SearchTable).style.display == "none")
    {
        document.getElementById(SearchCheck).checked = true;
        document.getElementById(SearchCheckLinkTable).style.display = "none";
        document.getElementById(SearchTable).style.display = "block";
    }
    else
    {
        document.getElementById(SearchCheck).checked = false;
        document.getElementById(SearchCheckLinkTable).style.display = "block";
        document.getElementById(SearchTable).style.display = "none";
    }
}
function OnUpdatingGeneral()
{
    //set cursor 
    document.body.style.cursor = 'wait';

    // get the update progress div
    var updateProgressDiv = $get('updateProgressDiv'); 

    // make it visible
    updateProgressDiv.style.display = 'block';

    //  get the gridview element        
    //var gridView = $get(document.getElementById("OnUpdatingObject").value);
   
    // get the bounds of both the gridview and the progress div
    //var gridViewBounds = Sys.UI.DomElement.getBounds(gridView);
    var updateProgressDivBounds = Sys.UI.DomElement.getBounds(updateProgressDiv);
    
    //    do the math to figure out where to position the element (the center of the gridview)
    //var x = gridViewBounds.x + Math.round(gridViewBounds.width / 2) - Math.round(updateProgressDivBounds.width / 2);
    //var y = gridViewBounds.y + Math.round(gridViewBounds.height / 2) - Math.round(updateProgressDivBounds.height / 2);
    
    //    set the progress element to this position
    //Sys.UI.DomElement.setLocation(updateProgressDiv, x, y);        
}

function OnUpdatedGeneral() 
{
    //set cursor 
    document.body.style.cursor = 'default';

    // get the update progress div
    var updateProgressDiv = $get('updateProgressDiv'); 
    // make it invisible
    updateProgressDiv.style.display = 'none';
}


