function change(id, newClass)
{
  document.getElementById(id).className=newClass;
}

function movepic(imgname, source)
{
    document[imgname].src=source;
}

function clearTextBox (inputId)
{
if (document.getElementById(inputId).value == "- geen voorkeur -")
    document.getElementById(inputId).value = "";
if (document.getElementById(inputId).value == "gebruikersnaam")
    document.getElementById(inputId).value = "";
}

function fillTextBox (inputId,fillText)
{
if (document.getElementById(inputId).value == "")
    document.getElementById(inputId).value = fillText;
}

function clearPassBox (inputId)
{
if (document.getElementById(inputId).value == "wachtwoord")
    {
        document.getElementById(inputId).value = "";
        document.getElementById(inputId).type = "password";
    }
}

function fillPassBox(inputId,Pass)
{
    if (document.getElementById(inputId).value == "")
    {
        document.getElementById(inputId).value = Pass;
        document.getElementById(inputId).type = "text";
    }
}

function toggle(definitionId)
{
    if (document.getElementById(definitionId).style.display=="block")
    {
        document.getElementById(definitionId).style.display="none";
    }
    else
    {
        document.getElementById(definitionId).style.display="block";
    }
}

function fullScreen(aan)
{
 	if(aan)
 	{
 	 	fullscreenHoogte = document.documentElement.scrollHeight;
		document.getElementById('fullscreen').style.display='block';
		document.getElementById('fullscreen').style.height=fullscreenHoogte+0+'px';	
	}
	else
	{
		document.getElementById('fullscreen').style.display='none';
	}	
}

function showLogin(aan)
{
	if(aan)
	{
		document.getElementById('loginContainer').style.display="block";			
		fullScreen(1);
		document.getElementById('rightTopNav').style.top="110px";
		document.getElementById('loginLink').className="active";		
		document.getElementById('catLink').className="";		
	}
	else
	{
		document.getElementById('loginContainer').style.display="none";		
		fullScreen(0);	
		document.getElementById('rightTopNav').style.top="0px";
		document.getElementById('loginLink').className="";		
		document.getElementById('catLink').className="active";
	}	

}

function Preload()
{
    var arImages=new Array();
    var temp = Preload.arguments;
    for(x=0; x < temp.length; x++)
    {
        arImages[x]=new Image();
        arImages[x].src=Preload.arguments[x];
    }
}

function writeFlash(flashFile,flashWidth,flashHeight)
{
    document.write("<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'");
    document.write("codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0'");
    document.write("width='" + flashWidth + "' height='" + flashHeight + "' id='top' align=''>");
    document.write("    <param name=wmode value='transparent' />");
    document.write("    <param name=movie value='" + flashFile + "' />");
    document.write("    <param name=quality value=high />");
    document.write("    <param name=bgcolor value=#d9d9d9 />");
    document.write("    <embed src='" + flashFile + "' quality=high bgcolor=#d9d9d9 width='" + flashWidth + "' height='" + flashHeight + "' name='top' align=''");
    document.write(" type='application/x-shockwave-flash' pluginspace='http://www.macromedia.com/go/getflashplayer' wmode='transparent'>");
    document.write("    </embed>");
    document.write("</object>");
}

function loadContent() 
{	
	setTimeout("fadeIn('thumb2')", 10);	
	setTimeout("fadeIn('thumb3')", 10);	
	setTimeout("fadeIn('thumb4')", 10);
	
	slide("thumb1");
	
	var theList = document.getElementById('thumb1');	
	xb.addEvent(theList, 'mouseenter', enter, false);	
	xb.addEvent(theList, 'mouseleave', leave, false);
	xb.addEvent(theList, 'mousedown', click, false);
	
	var theList = document.getElementById('thumb2');	
	xb.addEvent(theList, 'mouseenter', enter, false);
	xb.addEvent(theList, 'mouseleave', leave, false);	
	xb.addEvent(theList, 'mousedown', click, false);		

	var theList = document.getElementById('thumb3');	
	xb.addEvent(theList, 'mouseenter', enter, false);
	xb.addEvent(theList, 'mouseleave', leave, false);	
	xb.addEvent(theList, 'mousedown', click, false);	

	var theList = document.getElementById('thumb4');	
	xb.addEvent(theList, 'mouseenter', enter, false);
	xb.addEvent(theList, 'mouseleave', leave, false);	
	xb.addEvent(theList, 'mousedown', click, false);	
}

var activeThumb;

function click(e)
{
	clearTimeout(y);
	slide(this.id);
	
	activeThumb = this.id;
}

var y;

function slide(id)
{
	activeThumb = id;
	 
	window.setTimeout("new Effect.Fade('portfolioImg1', {duration:.3})", 300);	
	window.setTimeout("new Effect.Fade('portfolioImg2', {duration:.3})", 300);	
	window.setTimeout("new Effect.Fade('portfolioImg3', {duration:.3})", 300);	
	window.setTimeout("new Effect.Fade('portfolioImg4', {duration:.3})", 300);	
		
	window.setTimeout("new Effect.Opacity('"+id+"', {duration:0.3, from:0.6, to:1.0})", 400);	
	document.getElementById(id).style.background="#ff5900";
	
	if(document.getElementById('thumb1').style.opacity > 0.9)
	{
		new Effect.Opacity('thumb1', {duration:0.4, from:1.0, to:0.4}); 
	}
	if(document.getElementById('thumb2').style.opacity > 0.9)
	{
		new Effect.Opacity('thumb2', {duration:0.4, from:1.0, to:0.4}); 		
	}
	if(document.getElementById('thumb3').style.opacity > 0.9)
	{
		new Effect.Opacity('thumb3', {duration:0.4, from:1.0, to:0.4}); 	
	}		
	if(document.getElementById('thumb4').style.opacity > 0.9)
	{
		new Effect.Opacity('thumb4', {duration:0.4, from:1.0, to:0.4}); 	
	}	
	
	if(id == 'thumb1')
	{		
		window.setTimeout('Effect.Appear(\'portfolioImg1\', {duration:.3})',700);		
		y = window.setTimeout('slide("thumb2")',5000);					
		new Effect.Move ('selector',{ x: 6, y: 326, mode: 'absolute'});
	}
	else if(id == 'thumb2')
	{
		window.setTimeout('Effect.Appear(\'portfolioImg2\', {duration:.3})',700);
		y = window.setTimeout('slide("thumb3")',5000);							
		new Effect.Move ('selector',{ x: 132, y: 326, mode: 'absolute'});		
	}
	else if(id == 'thumb3')
	{
		window.setTimeout('Effect.Appear(\'portfolioImg3\', {duration:.3})',700);		
		y = window.setTimeout('slide("thumb4")',5000);			
		new Effect.Move ('selector',{ x: 257, y: 326, mode: 'absolute'});		
	}	
	else if(id == 'thumb4')
	{
		window.setTimeout('Effect.Appear(\'portfolioImg4\', {duration:.3})',700);		
		y = window.setTimeout('slide("thumb1")',5000);			
		new Effect.Move ('selector',{ x: 383, y: 326, mode: 'absolute'});		
	}	
}

var opacObj;

function enter(e)
{
	var currentOpac = this.style.opacity;

	if(activeThumb == this.id)
	{
		return;
	}
	else
	{	
		//alert('mouseenter: ' + this.id);
		opacObj = new Effect.Opacity(this, {duration:0.3, from:+currentOpac, to:1.0});	
	}
}

function leave(e)
{
	var currentOpac = this.style.opacity;
		
	if(activeThumb == this.id)
	{
		return;
	}
	else
	{
		//alert('mouseleave: ' + this.id);
		opacObj = new Effect.Opacity(this, {duration:0.4, from:+currentOpac, to:0.4}); 		
	}	
}

function fadeIn(divId)
{
	new Effect.Opacity(divId, {duration:0.4, from:0.2, to:0.6});		
}

function escapeWindow(e) {
  var kC  = (window.event) ?    // MSIE or Firefox?
             event.keyCode : e.keyCode;
  var Esc = (window.event) ?   
            27 : e.DOM_VK_ESCAPE // MSIE : Firefox
  if(kC==Esc)
  {
	showLogin(0);
  }      
}