/*
    Some basic functions used to facilitate navigation for user if JavaScript enabled
*/

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 + ',status=no,menubar=no,scrollbars=no');
}	

/* ======= SEARCH ======= */
function submitSearch() { 
    var searchForm = document.forms["searchForm"]; 
    var searchFor = searchForm.elements["query"].value;

    if (searchFor == null || searchFor.length <= 0 || searchFor == 'Suchbegriff') {
        alert("Geben Sie bitte einen Suchbegriff ein!");
        return false;
    } 

    return true;
}  

var clickedFields = new Array();

function clearField(fieldObj) {
    for (var x = 0; x < clickedFields.length; x++) {
        if (clickedFields[x] == fieldObj) {
            //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
    fieldObj.value = "";
    clickedFields.push(fieldObj);
}

