/**********************************************************************
Deze functie kijkt of de enter knop is ingedrukt in het trefwoord veld.
**********************************************************************/
function handleKeyPress(e){
    var key=e.keyCode || e.which;
    if (key==13){
        showSearch(document.getElementById('keyword').value);
    }
}




/**********************************************************************
Stop teh click event from passing throught the dom object
**********************************************************************/
function stopClick(e){
    if (!e){
        var e = window.event;
    }
    e.cancelBubble = true;
    if (e.stopPropagation){
        e.stopPropagation();
    }
}



/**********************************************************************
You can use the checkForTag method to check whether specific tags exist.
**********************************************************************/
function checkForTag(tag){
    if(tag != undefined){
        return true;
    } else {
        return false;
    }
}

/**
*   Return document.getElementById() without the typing.
**/
function $(id){
    return document.getElementById(id);
}


/**********************************************************************
Statistieken teller. De stats zijn in webbeheer uit te lezen.
Je kan een pagina adres opgeven (handig voor ajax requests).
Als je geen pagina opgeeft wordt document.location.href gebruikt. 
**********************************************************************/
function pageHit(pagina){
    
    if(pagina != null){
        p = escape(pagina);
    } else {
        p = escape(document.location.href);
    }
        
    rfr = escape(document.referrer);
    if (rfr == "undefined"){ rfr = "";}
    sx = screen.width;
    sy = screen.height;
    sc = (navigator.appName.indexOf("Microsoft") > -1) ? screen.colorDepth : screen.pixelDepth;
    src = 'stats.php?p=' + p + '&rfr=' + rfr + '&sx=' + sx + '&sy=' + sy + '&sc=' + sc;
    //src = '<img style="position:absolute;left:-10px;top:-10px;" src="' + src + '" width="1" height="1" border="0" alt="" />';
    src = '<img src="' + src + '" width="1" height="1" border="0" alt="" />';
    
    document.getElementById('counter').innerHTML = src;
}

function cleanInput(sValue, sInputId){
    el = $(sInputId);
    
    if ( el && el.value == sValue ) {
        el.value='';
    }
}
