var UserOK

function openOverlay(title,url,width,height) {
	GB_showCenter(title, url, /* optional */ height, width)
}


function hideFlash(){
	if (top.document.getElementById('showVimeo')){
		top.document.getElementById('showVimeo').style.display='none';
	}
}

function showFlash(){
	if (top.document.getElementById('showVimeo')){
		top.document.getElementById('showVimeo').style.display='block';
	}
}

function closeSearch() {
	showFlash();
	top.setMo(top.document.getElementById('btn_zoeken'), true);
	parent.hs.close();
}

/* begin functies voor mouseover afbeeldingen */

function mOnstyle(id) {
	document.getElementById(id).style.display = "none";
	document.getElementById(id+'_on').style.display = "block";
}

function mOutstyle(id) {
		
	document.getElementById(id+'_on').style.display = "none";
	document.getElementById(id).style.display = "block";
}

function mOn(obj) {
	var ext = obj.src.slice(-3)
	if(obj.src.indexOf('__o.'+ ext)==-1){
		obj.src=obj.src.replace('.'+ ext,'__o.'+ ext);
	}
}

function mOut(obj) {
	var ext = obj.src.slice(-3)
	obj.src=obj.src.replace('__o.'+ext,'.'+ext)
}

function mOnTab(text) {
	var obj = document.getElementById(text.id.replace('tekst_','tab_'))
	var ext = obj.src.slice(-3)
	if(obj.src.indexOf('__o.'+ ext)==-1){
		obj.src=obj.src.replace('.'+ ext,'__o.'+ ext)
	}
	if(text){
		text.style.color = '#ffffff'
	}
}
function mOutTab(text) {
	var obj = document.getElementById(text.id.replace('tekst_','tab_'))
	var ext = obj.src.slice(-3)
	obj.src=obj.src.replace('__o.'+ext,'.'+ext)
	if(text){
		text.style.color = '#5e5e5e'
	}
}
/* eind functies voor mouseover afbeeldingen */

/* functie voor mouseover zoeken */
function setMo(obj, state){
	if(state) {
		obj.onmouseout = function(){
			var ext = this.src.slice(-3) 
			this.src=this.src.replace('__o.'+ ext,'.'+ ext)
		}
		mOut(obj)
	}else{
		obj.onmouseout = function(){}
	}
}

/* begin functies voor mouseover format items */
function fOn(obj) {
	if(obj.className.indexOf('_on')==-1){
		obj.className += '_on'
	}
}
function fOut(obj) {
	obj.className=obj.className.replace('_on','')
}
/* eind functies voor mouseover format items */

function initSIFR() {
	if(typeof sIFR == "function"){
		sIFR.replaceElement(named( {
			sSelector:"h1",
			sFlashSrc:_PROJECT_URL + "flash/h1.swf",
			sColor:"#ed1b2e",
			sWmode:"transparent",
			nPaddingTop:0,
			nPaddingBottom:0,
			sFlashVars:"offsetTop=0"
			}
		));
		sIFR.replaceElement(named( {sSelector:"h2.red",sFlashSrc:_PROJECT_URL + "flash/h2.swf",sColor:"#ed1b2e",sWmode:"transparent",nPaddingTop:0,nPaddingBottom:0,sFlashVars:"offsetTop=0"}));
		sIFR.replaceElement(named( {sSelector:"h2.italic",sFlashSrc:_PROJECT_URL + "flash/h2i.swf",sColor:"#939598",sWmode:"transparent",nPaddingTop:0,nPaddingBottom:0,sFlashVars:"textalign=right&offsetTop=0"}));

		sIFR.replaceElement(named( {sSelector:"h2",sFlashSrc:_PROJECT_URL + "flash/h2.swf",sColor:"#6f6f6f",sWmode:"transparent",nPaddingTop:0,nPaddingBottom:0,sFlashVars:"offsetTop=0"}));
		sIFR.replaceElement(named( {sSelector:"h3.right",sFlashSrc:_PROJECT_URL + "flash/h3.swf",sColor:"#6f6f6f",sWmode:"transparent",nPaddingTop:0,nPaddingBottom:0,sFlashVars:"textalign=right&offsetTop=0"}));
		sIFR.replaceElement(named( {sSelector:"h3.red",sFlashSrc:_PROJECT_URL + "flash/h3.swf",sColor:"#ed1b2e",sWmode:"transparent",nPaddingTop:0,nPaddingBottom:0,sFlashVars:"offsetTop=0"}));
		sIFR.replaceElement(named( {sSelector:"h3",sFlashSrc:_PROJECT_URL + "flash/h3.swf",sColor:"#6f6f6f",sWmode:"transparent",nPaddingTop:0,nPaddingBottom:0,sFlashVars:"offsetTop=0"}));
		sIFR.replaceElement(named( {sSelector:"h4",sFlashSrc:_PROJECT_URL + "flash/h3.swf",sColor:"#000000", sLinkColor:"#767676", sBgColor:"#FFFFFF", sHoverColor:"#ffffff",sWmode:"transparent",nPaddingTop:3,nPaddingBottom:0,sFlashVars:"textalign=center&offsetTop=3"}));
		sIFR.replaceElement(named( {sSelector:"td.aaa",sFlashSrc:_PROJECT_URL + "flash/h3.swf",sColor:"#000000", sLinkColor:"#767676", sBgColor:"#FFFFFF", sHoverColor:"#ffffff",sWmode:"transparent",nPaddingTop:3,nPaddingBottom:0,sFlashVars:"textalign=center&offsetTop=3"}));

};
}

function getCheckboxValue(id) {
	var allInputTags = document.getElementById(id+'_group').getElementsByTagName('INPUT');
	for (var c=0; c<allInputTags.length; c++) {
		if (allInputTags[c].checked) {
			return allInputTags[c].value;
			break;
		}
	}
	return ""
}

function selAll() {
	var span = document.getElementById('checkboxes').getElementsByTagName('INPUT')
	var select = span[0].checked
	for(i=0;i<span.length;i++){
		if(span[i].type=='checkbox'){
			span[i].checked = select
		}
	}
}

function countChars(id,qty) {
	var obj = document.getElementById(id)
	obj.onclick=function(){document.getElementById('cntChars').innerHTML = qty - obj.value.length}
	obj.onkeyup=function(){
		document.getElementById('cntChars').innerHTML = qty - obj.value.length; 
		if (obj.value.length >= qty){
			document.getElementById(id).value=document.getElementById(id).value.substring(0,qty)
		}
	}
	document.getElementById('cntChars').innerHTML = qty - obj.value.length
}

function printme() {
	var objOut = document.getElementById("output");
	var out = objOut.innerHTML;
		
	var wh = window.open("","wh","width=640px,height=480px,scrollbars=yes");
	wh.document.open();
	var output = '<link href="css/popup.css" rel="stylesheet" type="text/css">';
	output = '<html><head>'+output+'</head><body>'+out.replace('<object','<!--object').replace('/object>','/object-->')+'</body></html>';
	output += '<'+'script type="text/javascript">';
	output += 'setTimeout("window.print()",2000);';	
	output += '</'+'script>';
	wh.document.writeln(output);
	wh.document.close();
}

function display(id,arr,noReturn) {
	if(arr!=undefined) {
		var a = arr.split(',')
		for(i=0;i<a.length;i++){
			if(document.getElementById(a[i])) document.getElementById(a[i]).style.display='none'
		}
	}
	if(id!=''){
		if(document.getElementById(id)){
			var obj = document.getElementById(id).style
			if(obj.display=='none'){
				obj.display='block'
			}
		}
	}
	if(noReturn = undefined || noReturn == false){
		return false
	}
}

function displayRange(id,rangeIdWithoutId,rangeLength) { // Functie zelfde als display, maar handelt automatisch een 'range' van items.
	if(rangeIdWithoutId!=undefined) {
		for(i=0;i<rangeLength;i++){
			if(document.getElementById(rangeIdWithoutId+i)) {
				document.getElementById(rangeIdWithoutId+i).style.display='none'
				document.getElementById('tekst_'+i).onmouseout = function() {mOutTab(this)};
				document.getElementById('tekst_'+i).onmouseover = function() {mOnTab(this)};
				mOutTab(document.getElementById('tekst_'+i))
			}
		}
	}
	if(id!=''){
		if(document.getElementById(id)){
			var obj = document.getElementById(id).style
			if(obj.display=='none'){
				obj.display='block';
				id = id.replace('formatpage_','');
				id = id.replace('aboutpage_','');				
				
				document.getElementById('tekst_'+id).onmouseout = function() {};
				document.getElementById('tekst_'+id).onmouseover = function() {};
 				mOnTab(document.getElementById('tekst_'+id));
			}
		}
	}
	return false
}

//functie voor setten van checkboxen
function check(v,id,input) {
	var obj = document.getElementById(input)
	var rest
	if(obj.value.indexOf(','+v+',')==-1){
		if(obj.value==''){
			obj.value=','
		}
		if(obj.value!=''){
			obj.value=obj.value+v+',';
		}
		document.getElementById(id).src = document.getElementById(id).src.replace('.gif','_o.gif')
	}else{
		obj.value = obj.value.replace(','+v+',',',')
		if(obj.value.length==1) obj.value=''
		document.getElementById(id).src = document.getElementById(id).src.replace('_o.gif','.gif')
	}
}

//functie voor setten van radiobutton
function radio(v,id,input,val) {
	var obj = document.getElementById(input)
	var curId = document.getElementById(id)
	var checked = false
	if(curId.src.indexOf('_o.gif')>-1) checked = true
	//reset alle items
	for(var i=0;i<document.getElementById(input + '_cnt').value;i++){
		document.getElementById('radio'+i).src = document.getElementById('radio'+i).src.replace('_o.gif','.gif')
	}
	//wanneer nog niet geselecteerd, selecteer item
	if(!checked){
		obj.value=val
		document.getElementById(id).src = document.getElementById(id).src.replace('.gif','_o.gif')
	}else{
		obj.value=''
	}
}

function loadYouTube(url, container, width, height){
	if (url.indexOf("http://") == 0)
	{
		if (url.indexOf("youtube.com") > 0)
		{
			url = url.replace("http://youtube.com/watch?v=",'');
			url = url.replace("http://www.youtube.com/watch?v=",'');
			url = url.replace("http://nl.youtube.com/watch?v=",'');
			var so = new SWFObject("http://www.youtube.com/v/"+url+"&rel=0", "site", width, height, "0,0,0,0", "#000000");
		}
		if (url.indexOf("vimeo.com") > 0)
		{
			url = url.replace("http://www.vimeo.com/",'');
			url = url.replace("http://vimeo.com/",'');
			var so = new SWFObject("http://vimeo.com/moogaloop.swf?clip_id="+url, "site", width, height, "0,0,0,0", "#000000");
		}
		else
		{
			var so = new SWFObject(""+url+"", "site", width, height, "0,0,0,0", "#000000");
		}
	} else {
		var so = new SWFObject("http://www.youtube.com/v/"+url+"&rel=0", "site", width, height, "0,0,0,0", "#000000");
	}	
	so.addParam("allowFullscreen","true")
	so.write(container);
}

function mOverPNG(id) {
	document.getElementById(id).src = eval(id+'__o').src
}

function mOutPNG(id) {
	document.getElementById(id).src = eval(id).src
}

function showImage(img) {
	document.getElementById('imageBig').style.backgroundImage = 'url('+img+')'
}
