var newwindow;
function popup(url, width, height) {
    var top;
    var left;

    var dependent; 
    var directories;
    var fullscreen; 
    var location; 
    var menubar; 
    var resizable;

    var scrollbars;
    var status; 
    var toolbar;

    dependent = 'no';
    directories = 'no';
    fullscreen = 'no';
    location = 'no';
    menubar = 'no';
    resizable = 'no';

    scrollbars = 'yes';
    status = 'yes';
    toolbar = 'yes';


    if (windowHeight() > 0) {
    top = windowHeight()/2 - parseInt(height)/2;
    }
    if (windowWidth() > 0) {
    left = windowWidth()/2 - parseInt(width)/2;
    }

    var properties = 'width='+width+',height='+height+',top='+top+',left='+left+',scrollbars=yes';
    // alert(properties);
    newwindow=window.open(url,'name',properties);
    newwindow.focus();
    return;
}

function windowHeight() {
    var height;
    if (self.innerWidth)
    {
        height = self.innerHeight;
    }
    else if (document.documentElement && document.documentElement.clientWidth)
    {
        height = document.documentElement.clientHeight;
    }
    else if (document.body)
    {
        height = document.body.clientHeight;
    }
    else height = 0;

    //alert(height);
    return height;
}

function windowWidth() {
    var widht;
    
    if (self.innerWidth)
    {
        width = self.innerWidth;
    }
    else if (document.documentElement && document.documentElement.clientWidth)
    {
        width = document.documentElement.clientWidth;
    }
    else if (document.body)
    {
        width = document.body.clientWidth;
    }
    else width = 0;

    //alert(width);
    return width;
}

function resizeIFrameHeight(iframe)
{
    if(document.getElementById) {
        var o = document.getElementById(iframe);
        var the_height = o.contentWindow.document.body.scrollHeight;
        o.height = the_height;
    }
}


function OpenRoute(href)
{
    var uri = new Array();
    var querysting = new Array();
    var paramKeys = new Array();
    var params = "";

    var i,j;

    // Toegestane parameters voor de window.open functie
    paramKeys.push("width", "height");

    // Meegegeven href splitten in een uri en een querystring
    uri = href.split('?');
    querysting = uri[1].split('&');

    // Toegestane parameters uit de querystring filteren en params string opbouwen
    for(i=0; i<querysting.length; i++)
    {
        for(j=0; j<paramKeys.length; j++)
        {
            if(querysting[i].indexOf(paramKeys[j]) != -1)
            {
                params += querysting[i] + ",";
            }
        }
    }
    // Laatste komma erafhalen
    params = params.substring(0, params.length-1);

    // Window openen en focus zetten
    var wnd = window.open(href, "route", "," + params);
    if (wnd) wnd.focus()
}

// --- Hoverfunctie voor IE6 ----------------------------------------------------------------- //
sfHover = function() {
	if(document.getElementById("nav"))
	{
	    if(document.getElementById("nav").getElementsByTagName("LI"))
	    {
	        var sfEls = document.getElementById("nav").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);
