function OpenWindow(theURL,winName,features) {
  var w = window.open(theURL,winName,features);
  w.focus();
}

var activeCatTab = 'tab01';
function activateCatTab(objId) {
  if(activeCatTab != "") {
    document.getElementById(activeCatTab).className = 'invisible';
    document.getElementById(activeCatTab+'Tab').className = 'tabje';
  }
  activeCatTab = objId;
  document.getElementById(objId).className = 'visible';
  document.getElementById(objId+'Tab').className = 'tabjeactief';
}


sfHover = function() {
if (document.getElementById("navtab")){
	var sfEls = document.getElementById("navtab").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
}

if (window.attachEvent) window.attachEvent("onload", sfHover);


function addplus(items)
   {
   var plussed = "";
   for (var t = 1 ; t <= items.length ; t++) { if (items.substring(t-1,t) == " ") {  plussed+="+";  } else { plussed+=items.substring(t-1,t); } }
   return plussed;
}

function doSearch() {
    var words;
    words = document.searchforit.query.value;
   var searchitems;
   //searchitems=addplus(words);

   itemsArr = words.split(" ");
   searchitems = "";
   for (i =0;i<itemsArr.length;i++){
       if (i > 0){ searchitems += "+"; }
       searchitems += escape(itemsArr[i]).replace(/\+/g,"%2B");
   }

   var index;
   //  Obtain the selectedIndex properties from the search engines options for
   index = document.searchforit.service.selectedIndex;
   if (index>=0)
    {
	 if (index==1)
	      {
		    document.forms['postvacform'].query.value=words ;
		  document.getElementById('postvacform').submit();
		}
	else
	{
      var site;
      site = document.searchforit.service.options[index].value;
      site+=searchitems;
      if (notEmpty(searchitems))
         {
         window.open("","_self");
         window.open(site,"_self");
         }
      }
}



   else
      {alert("\nJe moet nog een rubriek kiezen.");}
   }

//     Check for empty contents in search searchitems
function notEmpty(word)
   {
   if (word == "" || word == null)
      {
      self.status="ENTER SEARCH searchitems";
      alert("\n Je hebt geen zoekwoord opgegeven.");
      document.searchforit.query.focus();
      return false;
      }
   else
      {
      self.status = "SEARCHING FOR:  " + word;
      return true;
      }
   }

var toggleTimer;

function toggleTheTimer(bedrijfsnummer) {
  toggleTimer = setTimeout("toggle_companyBox("+bedrijfsnummer+", 'hide', '')", 1000);
}

var activeCompanyBox = "";

function toggle_companyBox(bedrijfsnummer, status, e)
{
  if(status == 'hide') {
    document.getElementById('companyBox_' + bedrijfsnummer).className = 'invisible';
    window.clearTimeout(toggleTimer);
    activeCompanyBox = "";
  } else {

    if(activeCompanyBox != "") {
      document.getElementById(activeCompanyBox).className = 'invisible';
      window.clearTimeout(toggleTimer);
      activeCompanyBox = "";
    }

    var posx = 0;
  	var posy = 0;

  	window.clearTimeout(toggleTimer);
  	if (e.pageX || e.pageY) 	{
  		posx = e.pageX;
  		posy = e.pageY;
  	}
  	else if (e.clientX || e.clientY) 	{
  		posx = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
  		posy = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;
  	}

    document.getElementById('companyBox_' + bedrijfsnummer).className = 'visible';
    children = document.getElementById('companyBox_' + bedrijfsnummer).childNodes;
    for (var i = 0; i < children.length; i++)
    {
     if(children[i].className == "companyBox") {
       children[i].style.left = (posx-100) +"px";
       children[i].style.top = (posy+10) +"px";
     }
    }
    activeCompanyBox = 'companyBox_' + bedrijfsnummer;
    toggleTimer = setTimeout("toggle_companyBox("+bedrijfsnummer+", 'hide', '')", 3000);
  }
}

function ConfirmClose() {
//if (confirm("Wilt u echt afsluiten?")){
      window.close()
//}
}

function submitenterVB(myfield,e) {

			var key;
				     if(window.event)
				          key = window.event.keyCode; //IE
				     else
				          key = e.which; //firefox
	if (key == 13)   {
			     if (vaczoek.jobfinder_job.value ==' Welke functie?'){
					vaczoek.jobfinder_job.value ='';
				}
				if (vaczoek.jobfinder_city.value ==' In welke plaats?'){
					vaczoek.jobfinder_city.value ='';
				}
			   myfield.form.submit();
			   return false;
			   }
			else {
			   return true;
			   }
}

function setAlert() {
    document.getElementById('from').value = document.location + "";
    if(document.getElementById('zoekterm').value == "")
    {
        alert("Er is iets mis gegaan");
        return;
    }
    if(document.getElementById('emailadres').value == "")
    {
        alert("U moet een e-mailadres opgeven");
        return;
    }
    document.alertForm.submit();

}

function goSearch(f){

			if (f.jobfinder_city.value ==' In welke plaats?'){
				f.jobfinder_city.value ='';
			}
			if (f.jobfinder_job.value ==' Welke functie?'){
				f.jobfinder_job.value ='';
			}
			document.vaczoek.submit();
}

// de volgende drie functies zijn voor het bladeren door de divs
function getVisibleDiv(d,c){
  // bekijk welke van de set zichtbaar is en return het nummertje
  var activeID;
  for (i=0;i<=c;i++){
    var thisDiv = d+"_"+i;
    if (document.getElementById(thisDiv)) {
      var el = document.getElementById(thisDiv);
      if  ( (!el.style.display) || (el.style.display =="block") ) {
        activeID = i;
        }
    }
  }
  return activeID;
}
function getDivCount(d){
  // tel het aantal divs met een bepaalde id
  var dcount = -1; // omdat de div's beginnen bij 0 en dcount het aantal gevonden divs is....
  var divArray = document.getElementsByTagName('div');
  for (var i = 0; i < divArray.length; i++) {
     var e = divArray[i].getAttribute('id')+"";
      e = e.replace(/\d/g, '');
    if (e.length > 1) {
      if (e.lastIndexOf("_") == (e.length-1)){
        e = e.substring(0,e.length-1);
      }
        if (e == d ){
        dcount++;
      }
    }
  }
  return dcount ;
}
function paginator(d,p){


  if (d == 'portlet_shorty_topright') {
		clearInterval(intervalID);
	}
	if (!d){
		d='portlet_shorty_topright';
	}
	if (!p) {
		p = 1;
	}


  // blader door de divs....
  var maxD = getDivCount(d);
  var activeID = getVisibleDiv(d,maxD);
  var nextID = activeID + p;
  var activeDiv = d +"_"+activeID;
  var nextDiv =  d +"_"+(nextID);
  // aan het begin of eind? gewoon doorgaan....
  if ((activeID == maxD) && (p == 1) ){
    var nextDiv =  d +"_"+0;
  }
  if ((activeID == 0) && (p == -1) ){
    var nextDiv =  d +"_"+maxD;
  }
  // zet de zichtbare div uit en de andere aan

    var current = document.getElementById(activeDiv);
    var next = document.getElementById(nextDiv);


    current.style.display = "none";
    next.style.display = "block";


}
//eind blader divs...

  <!--

var ac1 = "ma"
var ac2 = "ilt"
var ac3 = "o:"
var ac4 = "&#64"
var ad3 = "vnumedia.nl"
var ad4 = "computable.nl"

  //-->


// login functies - start
function readProfileCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}
function clearEmailField()
	{
	if(document.UserLogin.email.value =='log in met e-mailadres'){document.UserLogin.email.value='';}
	}
 function changeBox()
 {
    document.getElementById('pass_temp').style.display='none';
    document.getElementById('password').style.display='';
    document.getElementById('password').focus();
 }
 function restoreBox()
 {
    if(document.getElementById('password').value=='')
    {
      document.getElementById('pass_temp').style.display='';
      document.getElementById('password').style.display='none';
    }
 }
function printUser(meld){

	path = "http://profile.computable.nl";

	i = window.location.href.indexOf("meld=")-1;
	if (i == -2) i = window.location.href.length;
	url_to = window.location.href.substring(0,i);

	var validUser = readProfileCookie('pr_naam');
	if (validUser) {
		validUser = unescape(validUser);
		validUser = decodeURIComponent(validUser.replace(/\+/g,  " "));
		var fullname =  validUser.substring(validUser.indexOf('FNAME:')+6,validUser.indexOf('|UNAME:'));
		var username =  validUser.substring(validUser.indexOf('|UNAME:')+7,validUser.lastIndexOf('|EMAIL'));
		var email =  validUser.substring(validUser.indexOf('|EMAIL:')+7,validUser.lastIndexOf('|'));
 		var accountBox = '<div style="width:144px;float: left;font-size: 11px; color: #666;padding:3px;">';
 		accountBox += 'Je bent ingelogd<br /><strong>'+fullname+'</strong></div>';
		accountBox += '<div style="float: left;width:80px;"><ul style="margin-bottom:2px;"><li style="margin-left:4px;margin-top:3px;float: left;"><a href="' +path+ '/edituserprofile/' +username+ '">bewerk profiel</a></li><li style="margin-left:4px;margin-top:3px;float: left;"><a href="' +path+ '/profile/' +username+ '">bekijk profiel</a></li><li style="margin-left:4px;margin-top:3px;float: left;"><a href="' +path+ '/logout.php?url_to='+url_to+'">uitloggen</a></li></ul></div>';

	}else{
		var accountBox = '<div style="width: 166px;float: left;"><form name="UserLogin" style="margin:0;padding:0;" id="UserLogin" method="post" action="' +path+ '/login.php">';
		if (meld.length>0){
			alert (meld);
		}
		accountBox += '<input name="email" id="email" type="text" value="log in met e-mailadres" style="margin:4px;padding:0px;width:148px;font-size: 12px; color: #666666;" onclick=" clearEmailField()">';
		accountBox += '<input id="pass_temp" type="text" value="en wachtwoord" style="margin-left:4px;padding:0px;width:119px; color: #666666;font-size: 12px;" onfocus="changeBox()">';
		accountBox += '<input name="password" id="password" type="password" value="" style="margin-left:4px;padding:0px;width:119px; color: #666666;font-size: 12px;;display:none" onBlur="restoreBox()">';
		accountBox += '&nbsp;<input type="button" style="width: 25px;height: 20px;font-size: 11px;padding: 0 0 5px 0;" onclick="document.UserLogin.submit()" value="ok">';
		accountBox += '<input type="hidden" id="url_to" name="url_to" value="' +url_to+ '">';
		accountBox += '<input type="hidden" id="path" name="path" value="' +path+ '">';
		accountBox += '<input type="hidden" name="login" value="1"></form></div>';
		accountBox += '<div style="float: left;width:74px;"><ul style="margin-bottom:2px;"><li style="margin-left:4px;margin-top:3px;float: left;"><a href="'+path+ '/nieuw_wachtwoord.php">Wachtwoord vergeten</a></li><li style="float: left;margin-left:5px;margin-top:3px"><a href="'+path+ '/registreer.php">Registreren</a></li></ul></div></div>';
	}

	document.getElementById('profileLoginBox').innerHTML = '';
	document.getElementById('profileAccountBox').innerHTML = accountBox;
}
// login functies - eind

function registerTakeover(type, backgroundImage, backgroundColor)
	{
       document.body.style.background = (backgroundColor || '#B9B9B9') + (backgroundImage ? ' url(' + backgroundImage + ') no-repeat top center' : '');
       document.getElementById('main1').style.background='none';
       document.getElementById('main1').style.backgroundColor='#ffffff';
 	   document.getElementById('main2').style.background='none';
       document.getElementById('main2').style.backgroundColor='#ffffff';
	}

function wisseldiv(target,clicklink) {
var e = document.getElementById(target);
var j = document.getElementById(clicklink);
if(e.style.display == 'block')
{
e.style.display = 'none';
j.innerHTML = '+';
}
else
{
e.style.display = 'block';
j.innerHTML = '-';
}
}




