var DHTML = (document.getElementById || document.all || document.layers);
var marked_row = new Array;

function getObj(name)
{
	if (document.getElementById)
	{
		return document.getElementById(name).style;
	}
	else if (document.all)
	{
		return document.all[name].style;
	}
	else if (document.layers)
	{
		return document.layers[name];
	}
}

var d = document;
var wH; // window handler

function zoom3(pad,img,id,pag,afmeting)
{
	foto = new Image;
	foto.src = pad;

    if (d[img][0])
    {
     breedte = d[img][0].width;
     hoogte = d[img][0].height;

    }
    else
    {
     breedte = d[img].width;
     hoogte = d[img].height;
    }

    if (breedte >= hoogte)
    {
	  percentage = afmeting / breedte;
    }
    else
    {
	  percentage = afmeting / hoogte;
	}

	w = Math.round(breedte * percentage) -3; // foto.width <- IE4;
	h = Math.round(hoogte * percentage) - 1; // foto.height <- IE4;
	
	x = (screen.width - w) / 2;
	y = (screen.height - h) / 2;

	url = pag + '&id=' + id + '&w=' + w + '&h=' + h;
	options = "width=" + w + ",height=" + h + ",left=" + x + ",top=" + y + ",scrollbars=no";

	wH = window.open (url, 'image', options);
	if (!wH) wH.opener = self;
}
 
sfHover = function() 
{
	var sfEls = document.getElementById("nav2").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) 
	{
		sfEls[i].onmouseover=function() 
		{

			if (this.className == "eind")
			{
				this.className+=" sfhovereind";
			}

			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() 
		{
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
			this.className=this.className.replace(new RegExp(" sfhovereind\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

var isDHTML = 0;
var isID = 0;
var isAll = 0;
var isLayers = 0;

if (document.getElementById) 
{
	isID = 1; isDHTML = 1;
}
else 
{
	if (document.all) 
	{
		isAll = 1; isDHTML = 1;
	}
	else 
	{
		browserVersion = parseInt(navigator.appVersion);
		if ((navigator.appName.indexOf('Netscape') != -1) && (browserVersion == 4)) 
		{
			isLayers = 1; isDHTML = 1;
		}
	}
}

var DHTML = (document.getElementById || document.all || document.layers);

function closePopup(flag,obj,obj2)
{
	if (!DHTML) return;
	var x = getObj(obj);
	var y = getObj(obj2);
	x.visibility = (flag) ? 'hidden' : 'visible'
	y.visibility = (flag) ? 'hidden' : 'visible'
}

function getObj(name)
{
	if (document.getElementById)
	{
		return document.getElementById(name).style;
	}
	else if (document.all)
	{
		return document.all[name].style;
	}
	else if (document.layers)
	{
		return document.layers[name];
	}
}

var openvenster = 0;
var slideDelay = 0;
var domStyle = null;

var inspringen = 460;
var snelheid = 20;
var verberg = "closepopup";
var tab = "tabvacatures";

function setMenu (objectID)
{
	var y = getObj(verberg);

	if (openvenster == 1)
	{
		y.visibility = 'hidden';
	}

	if (isDHTML)
	{
		domStyle = getObj(objectID);
		if (openvenster) { fX = -inspringen; cX = 0; openvenster = 0; }
			else { fX = 0; cX = -inspringen; openvenster = 1; }
			slideMenu(cX,fX);
	}

	setCookie('popup', openvenster, '');
}	
		
function slideMenu (cX,fX) 
{
	if (cX != fX) 
	{
		if (cX > fX) { cX -= snelheid; }
		else { cX += snelheid;}
		domStyle.left = cX + 'px';
		setTimeout('slideMenu(' + cX + ',' + fX + ')', slideDelay);  
	}
	else
	{

		var y = getObj(verberg);
		var x = getObj(tab);

		if (openvenster == 1)
		{
			y.visibility = 'visible';
			x.visibility = 'hidden';
		}
		else
		{
			x.visibility = 'visible';
		}
	}

	return;
}


function toonMenu()
{
	var cookie = readCookie('popup');

	if (cookie == '')
	{
		setTimeout('setMenu("popup")', 2000);
	}
	else if (cookie == 0)
	{
		var x = getObj(tab);
		x.visibility = 'visible';
	}
	else if (cookie == 1)
	{
		var x = getObj("popup");
		x.left = 0 + 'px';
		x.visibility = 'visible';

		openvenster = 1;
		var y = getObj(verberg);
		y.visibility = 'visible';		
	}
	else
	{
		setTimeout('setMenu("popup")', 2000);
	}
}


/**
 * Add a new cookie
 *
 * @param string    The name of the cookie
 * @param string    The value of the cookie
 * @param mixed     A pre-set date object or an integer representing the number of days. Default value creates a 'session' cookie.
 * @param string    The domain access of the cookie. Defaults to the current domain.
 * @param string    The path access of the cookie. Defaults to the entire site, "/".
 */
function setCookie(name, value, expires, domain, path)
{
    //------------------------------
    // Build expiry
    //------------------------------
    // Date object
    if(expires.toGMTString)
        expires = '; expires=' + expires.toGMTString();

    // Integer, assume its number of days
    else if(typeof(expires) == 'integer')
    {
        var date = new Date();
		date.setTime( date.getTime() + (expires * 86400) );
		expires = '; expires=' + date.toGMTString();
    }

    // Session cookie
    else
        expires = '';


    //------------------------------
    // Build domain
    //------------------------------
    if(domain)
        domain = '; domain=' + domain;
    else
        domain = '';


    //------------------------------
    // Build path
    //------------------------------
    if(path)
        path = '; path=' + path;
    else
        path = '; path=/';


    //------------------------------
    // Make cookie
    //------------------------------
    document.cookie = name + '=' + escape(value) + expires + domain + path;
}


/**
 * Read the value of a cookie.
 *
 * @param string The name of the cookie you want to gain the value of
 *
 * @return mixed The value of the cookie if it was found, and null if it was not
 */
function readCookie(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 eraseCookie(name)
{
	setCookie(name,"",-1);
}

function toonCookie()
{
	var cookie = readCookie('popup');

    if(!cookie)
        cookie = '';

	alert("De waarde van de Cookie is: " + cookie);
}


function openVenster(url, naampag, w, h, scroll) 
{
var winl = (screen.width - w) / 2;

if (h == '*') {

 if ((screen.availHeight - 10) > 700) 
	{
	 var winh = 700;
	 var wint = ((screen.availHeight - 30) - winh) / 2;
    } else {
	 var winh = screen.availHeight - 30;
	 var wint = 0;
	}

  } else {
	 var winh = h;
	 var wint = ((screen.availHeight - 30) - h) / 2;
	}

winprops = 'height='+winh+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable';

win = window.open(url, naampag, winprops);
if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}

function groteFoto(pid,sid,tid,fid) 
{
 	var url = '/?pag_id=' + pid + '&site_id=' + sid + '&dr=zm' + '&tid=' + tid + '&fid=' + fid;
		openVenster(url,'popupwin','670','*','yes');	
}

function groteFotoNieuws(pid,sid,nid,fid) 
{
 	var url = '/?pag_id=' + pid + '&site_id=' + sid + '&dr=zm' + '&nid=' + nid + '&fid=' + fid;
	openVenster(url,'popupwin','670','*','yes');
	
}
