function openWindow(url,winname,w,h) {
    var leftPosition = 0;
    var topPosition = 0;
    
    if(screen.width > 0 && screen.width > w)
        leftPosition = (screen.width-w)/2;
        
    if(screen.height > 0 && screen.height > h)
        topPosition = (screen.height-h)/2;
        
    var width = w;
    var height = h;
    var scrollbars = "no";
    var resizable = "no";
    
    if(w > screen.width) {
        width = screen.width;
        scrollbars = "yes";
        resizable = "yes";
    }
        
    if(h > screen.height) {
        height = screen.height;
        scrollbars = "yes";
        resizable = "yes";
    }
        
    popupWin = window.open(url, winname, 'menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars='+scrollbars+',resizable='+resizable+',dependent=no,width='+width+',height='+height+',top='+topPosition+',left='+leftPosition +',screenx=50,screeny=50');
    if (popupWin)
        popupWin.focus();
    
    return false
}

function toggleElement(elementId, linkElement) {
    if (elementId.style.display == 'none') {
        elementId.style.display = 'block';
        linkElement.removeChild(linkElement.firstChild);
        linkElement.appendChild(document.createTextNode('[-]'));
    } else {
        elementId.style.display = 'none';
        linkElement.removeChild(linkElement.firstChild);
        linkElement.appendChild(document.createTextNode('[+]'));
    }
}