function pageHit(){

  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="" />';
  document.getElementById('counter').innerHTML = src;  
  
}

function toggleNewsArchive(id){ 
 
    if(document.getElementById(id).style.display  == 'none'){
        document.getElementById(id).style.display = '';
    }
    else{
        document.getElementById(id).style.display = 'none';    
    }
}

/*function $(oObj){
    return document.getElementById(oObj);
} */

onload = pageHit;

function sendForm() { 

    var whereFrom = '';
    whereFrom += document.getElementById('currentPage').value;
    
    var whereTo = '';
    if (document.getElementById('keyword').value != '') {
        whereTo += '&keyword=' + document.getElementById('keyword').value;  
    }
    if (document.getElementById('company').value != '') {
        whereTo += '&company=' + document.getElementById('company').value;  
    }   
    if (document.getElementById('requirement').value != '') {
        whereTo += '&requirement=' + document.getElementById('requirement').value;  
    }
    if (document.getElementById('position').value != '') {
        whereTo += '&position=' + document.getElementById('position').value;  
    }
    // commented want categorie staat default op 1 
    //if (document.getElementById('category').value != '') {
    //    whereTo += '&category=' + document.getElementById('category').value;  
    //}                 
    
    
    var destination = whereFrom + whereTo; 
    window.location = destination;   
}

function clearForm() {
    
    document.getElementById('keyword').value = '';
    document.getElementById('company').value = '';
    document.getElementById('requirement').value = '';
    document.getElementById('position').value = '';
    document.getElementById('category').value = '';
    
}


// stageformulier
function sendStageFormulier() {        
                              
    var whereFrom = '';
    whereFrom += document.getElementById('currentPage').value;
    var whereTo = '';
    if (document.getElementById('zoekterm').value != '') {
        whereTo += '&zoekterm=' + document.getElementById('zoekterm').value;        
    }
    if (document.getElementById('stageplaats').value != '') {
        whereTo += '&stageplaats=' + document.getElementById('stageplaats').value;  
    }   
    if (document.getElementById('stagiairs').value != '') {
        whereTo += '&stagiairs=' + document.getElementById('stagiairs').value;  
    }
    if (document.getElementById('studierichting').value != '') {
        whereTo += '&studierichting=' + document.getElementById('studierichting').value;  
    }
    if (document.getElementById('type_stage').value != '') {
        whereTo += '&type_stage=' + document.getElementById('type_stage').value;  
    }
    
    var destination = whereFrom + whereTo;
    window.location = destination;      
    
}

// clear stage form fields
function clearStageFormulier(sRootURL) {
    window.location = sRootURL + 'show/leren_en_werken/stageloket';
}


function clearZoektermField() {
    document.getElementById('zoekterm').value = '';
}