
function ToggleVisibility(id)
{
    var element = document.getElementById(id);
    if (element)
    {
        if (element.style.display == 'none')
        {
            element.style.display = '';
        }
        else
        {
            element.style.display = 'none';
        }
    }
}

// trims a string 
function Trim(s) 
{
    if (s.length > 0)
    {
        // remove leading spaces and carriage returns
        while ((s.substring(0,1) == ' ') || (s.substring(0,1) == '\n') || (s.substring(0,1) == '\r'))
        {
            s = s.substring(1,s.length);
        }

        // remove trailing spaces and carriage returns
        while ((s.substring(s.length-1,s.length) == ' ') || (s.substring(s.length-1,s.length) == '\n') || (s.substring(s.length-1,s.length) == '\r'))
        {
            s = s.substring(0,s.length-1);
        }
    }
    return s;
}

function popupClone(sURL, iWidth, iHeight, iX, iY, scrollBars) {

    if (!scrollBars)
    {
        scrollBars = "0";
    }
    var myCloneWindow = window.open ("" + sURL + "", "mywindow","resizable=1,menubar=1,location=1,status=1,scrollbars=" + scrollBars + ", width=" + iWidth + ",height=" + iHeight + "");
    myCloneWindow.moveTo(iX,iY);
    myCloneWindow.focus();
} 