﻿function toggleVisible(name, visible)
{
    document.getElementById(name).style.display = visible;
}


function popup(url, title, width, height) {

    if(!width){
        width = 400;
    }
    if(!height){
        height = 500;
    }
    if(!title){
        title = '';
    }
    
    var left   = (screen.width  - width)/2;
	var top    = (screen.height - height)/2;
    window.open(url, title, 'height=' + height + ',width=' + width + ',top=' + top + ',left=' + left + ',resizable=yes,scrollbars=yes,toolbar=no,menubar=no,location=no,,status=yes');
}

function popupModal(url, title, width, height) {

    if(!width){
        width = 400;
    }
    if(!height){
        height = 500;
    }
    if(!title){
        title = '';
    }
    return window.showModalDialog(url,title,'dialogWidth:' + width + 'px;dialogHeight:' + height + 'px;center;help:no;Yes;resizable:yes;status:no;scroll:yes');
}

function closePopupRefresh(){
    if(window.opener != null){
        window.opener.location = window.opener.location;
    }
    window.close();
}

function closePopup(){
    window.close();
}

function clearContents(field, fieldValue)
{
    if(!fieldValue){
        fieldValue = "dd-MMM-yyyy";
    }
    if(field.value == fieldValue)
        field.value = "";
}