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 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=9,0,0,0'");
    document.write("width='" + flashWidth + "' height='" + flashHeight + "' id='top' align=''>");
    document.write("    <param name=movie value='" + flashFile + "' />");
    document.write("    <param name=quality value=high />");
    document.write("    <param name=bgcolor value=#FFFFFF />");
	 document.write("		<param name='wmode' value='transparent' />");    
    document.write("    <embed src='" + flashFile + "' quality=high bgcolor=#FFFFFF width='" + flashWidth + "' height='" + flashHeight + "' name='top' align=''");
    document.write(" type='application/x-shockwave-flash' pluginspace='http://www.macromedia.com/go/getflashplayer'>");
    document.write("    </embed>");
    document.write("</object>");
}


function showMediaPlayer(video, event)
{
	popupDiv(event, 'mediaPlayer', 0, 1);
	writeFlashGroot('http://www.fileproof.nl/groenegolfteam/fla/'+escape(video)+'_480.flv', 'FlowPlayerBlack.swf', '480', '376', ', autoPlay: true, scale: false, loop: false');	
		
	if(video == 'V_W_Zwemmen')
	{
		document.getElementById('commercial1').style.display='none';
		document.getElementById('commercial2').style.display='block';
	}
	else if(video == 'tvc')
	{
		document.getElementById('commercial1').style.display='block';
		document.getElementById('commercial2').style.display='none';		
	}
}

function fullScreen(aanuit)
{
 	if(aanuit)
 	{
 	 	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 popupDiv(e, divId, positioning, aan)
{
	if(aan == true)
	{
	   	if(positioning == true)
	   	{
		    document.getElementById(divId).style.display="block";
			showDivInPosition(e, divId);
		}
		else
		{
		    document.getElementById(divId).style.display="block";
			showDivCentered(divId);
		}

		fullScreen(true);		
		
		//document.getElementById(divId).innerHTML='CONTENT HIER';

	}
	else
	{
		fullScreen(false);
		document.getElementById(divId).style.display='none';		
	}
	
	return false;
}

function showDivCentered(divId)
{
    document.getElementById(divId).style.left='50%';
    document.getElementById(divId).style.margin='0 0 0 -240px';
    //document.getElementById(divId).style.width='480px';
    //document.getElementById(divId).style.height='400px';	    
	
	if (document.documentElement && !document.documentElement.scrollTop)
	{
		var newPos = 0;
	}
	else if (document.documentElement && document.documentElement.scrollTop)
	{	
		var newPos = document.documentElement.scrollTop;
	}
	else if (document.body && document.body.scrollTop)
	{
		var newPos = document.body.scrollTop;	
	}
	
	document.getElementById(divId).style.top= '50%'; //newPos + 10 + 'px';
    document.getElementById(divId).style.margin='-200px 0 0 -240px';	
	document.getElementById(divId).style.display='block';

	return false;
}

var ie5=document.all&&document.getElementById;
var ns6=document.getElementById&&!document.all;

function showDivInPosition(e, divId)
{
 	if(!e)
 	{
		e = window.event;
	}
    if(!ie5)
    {
        e.cancelBubble = true;
        e.returnValue = false;
    }
    
	if (document.documentElement && !document.documentElement.scrollTop)
	{
		var topScroll = 0;
		var leftScroll = document.documentElement.scrollLeft;
	}
	else if (document.documentElement && document.documentElement.scrollTop)
	{	
		var topScroll = document.documentElement.scrollTop;
		var leftScroll = document.documentElement.scrollLeft;			
	}
	else if (document.body && document.body.scrollTop)
	{
		var topScroll = document.body.scrollTop;
		var leftScroll = document.body.scrollLeft;	
	}

    //Find out how close the mouse is to the corner of the window
    var rightedge=ie5? document.documentElement.clientWidth-event.clientX : window.innerWidth-e.clientX;
    var bottomedge=ie5? document.documentElement.clientHeight-event.clientY : window.innerHeight-e.clientY;
 
    //if the horizontal distance isn't enough to accomodate the width of the context menu
    if (rightedge<document.getElementById(divId).offsetWidth)
    {
        //move the horizontal position of the menu to the left by it's width
        document.getElementById(divId).style.left=ie5? leftScroll+event.clientX-document.getElementById(divId).offsetWidth+"px" : window.pageXOffset+e.clientX-document.getElementById(divId).offsetWidth+"px";
    }
    else
    {
        //position the horizontal position of the menu where the mouse was clicked
        document.getElementById(divId).style.left=ie5? leftScroll+event.clientX+"px" : window.pageXOffset+e.clientX+"px";
    }

    //same concept with the vertical position
    if (bottomedge<document.getElementById(divId).offsetHeight)
    {
        document.getElementById(divId).style.top=ie5? topScroll+event.clientY-document.getElementById(divId).offsetHeight+"px" : window.pageYOffset+e.clientY-document.getElementById(divId).offsetHeight+"px";
    }
    else
    {
        document.getElementById(divId).style.top=ie5? topScroll+event.clientY+"px" : window.pageYOffset+e.clientY+"px";
    }

    return false;
}


