
var wOpened = null;

function openWindow(url, width, height) {
        if (wOpened != null) {
                wOpened.close();
        }		
        var yPos = (window.screen.height - height)/2;
        var xPos = (window.screen.width - width)/2;
        wOpened	= window.open(url, null, 'width=' + width + ',height=' + height + ',left=' + xPos + ',top=' + yPos + ',screenX=' + xPos + ',screenY=' + yPos + ',location=no,status=no,menubar=no,scrollbars=no,resizable=no,toolbar=no');
}	

/**
    For hiliting images 
    @param imgId - the image id (name)
    @param hilite - boolean value; if true hilite, else unhilite
*/
function hilite(imgId, hilite) {
    //no change if already hilited through being the active category
    //crop the "top_" or "bottom_" part to just get the rubric
    if (imgId.substring(imgId.indexOf('_') + 1, imgId.length) == rubric) {
        return;
    }

    var imgObj = document.images[imgId];
    imgObj.src = ctxtPath + "/docroot/templates/imgs/design/nav_" + imgObj.name + (hilite ? "_active_" : "_") + imgObj.width + "x" + imgObj.height + ".gif";
}

var clickedFields = new Array();

function clearField(fieldId) {
    for (var x = 0; x < clickedFields.length; x++) {
        if (clickedFields[x] == fieldId) {
            //field already clicked once, meaning init-text appeared -> do nothing (user alter's her input)
            return;
        }
    }

    //id was not found in array; clear the field (init-text) and add it to the clickedFields-list
    document.getElementById(fieldId).value = "";
    clickedFields.push(fieldId);
}

