window.onload = init;

function checkifElementExists(elemString)
{
	var buildDom = '';
	var domArray = elemString.split(".");
	var returnBool = true;
	var loop = 0;

	
	for (loop; loop < domArray.length; loop++)
	{
		//Build the dom nodes
		if (loop != 0)
		{
			buildDom += '.' + domArray[loop];
		}
		else
		{
			buildDom += domArray[loop];
		}		
		
		//Check if dom exists
		if (!eval(buildDom))
		{
			returnBool = false;
			break;
		}
	}

	return returnBool;
}

//scripts to resize iframe
function iFrameSize(w,h,iframeId)
{ 
	var elemPoll = document.getElementById('poll_' + iframeId);
	if (elemPoll)
	{
		elemPoll.style.width=w+'px' 
		elemPoll.style.height=h+'px' 
	}
	else
	{
		alert('poll: poll_' + iframeId + 'not found');
	}
} 


// SCRIPTS VOOR de zoekmachine ========================================================================================================
function fnSearch(welkform)
{

	if (welkform == 0)
	{
		var elemZoek = document.getElementById('strZoekTekst');
	}
	if (welkform == 1)
	{
		var elemZoek = document.getElementById('strZoekTekst1');
	}
	if (welkform == 2)
	{
		var elemZoek = document.getElementById('strZoekTekst2');
	}
	
	if (elemZoek)
	{
		if (elemZoek.value.length < 3)
		{
			alert('Voor een zoekopdracht zijn minimaal 3 karakters nodig.');
		}
		else
		{
			if (welkform == 0)
			{
				document.zoekform.submit();
			}
			else
			{
				document.getElementById('strZoekTekst1').value = elemZoek.value
				document.zoekform2.submit();
			}
		}
	}
}


// SCRIPTS VOOR HET KENNISNETMENU ========================================================================================================
var strMainTableBgColor = '#FFFFFF';
var strMainTableFgColor = '#006282';

function showSub()
{
	var subTable = document.getElementById('kennissub');
	subTable.style.display = 'block';
	strShowTheSub = 'block';
	strMainTableBgColor = '#006282';
	strMainTableFgColor = '#FFFFFF';
	var mainTable = document.getElementById('kennismain');
	mainTable.style.backgroundColor = strMainTableBgColor;
	mainTable.style.color = strMainTableFgColor;
}

function changeDisplay()
{
	alert
	//subTable = document.getElementById('kennissub');
	//subTable.style.display = 'block';
	//strShowTheSub = 'block';
	strMainTableBgColor = '#006282';
	strMainTableFgColor = '#FFFFFF';
	var mainTable = document.getElementById('kennismain');
	mainTable.style.backgroundColor = strMainTableBgColor;
	mainTable.style.color = strMainTableFgColor;
}
function TriggerHideSub()
{
	strShowTheSub = 'none';
	strMainTableBgColor = '#FFFFFF';
	strMainTableFgColor = '#006282';
	setTimeout('hideSub()',700);
}

function hideSub()
{
	subTable = document.getElementById('kennissub');
	subTable.style.display = strShowTheSub;
	var mainTable = document.getElementById('kennismain');
	mainTable.style.backgroundColor = strMainTableBgColor;
	mainTable.style.color = strMainTableFgColor;
}

function fnSubOut(tdElem,bgColor,fgColor)
{
	if (tdElem)
	{
		tdElem.style.backgroundColor = bgColor;
		tdElem.style.color = fgColor;
	}
}

function fnSubOver(tdElem,bgColor,fgColor)
{
	if (tdElem)
	{
		tdElem.style.backgroundColor = bgColor;
		tdElem.style.color = fgColor;
	}
}

function fnSubOnclick(theUrl)
{
	if (theUrl != '')
	{
		document.location.href = '/'+theUrl;
	}
}

//Script om de hoogte van de pagina( het mainframe) te bepalen bij de onload en de onresize ==============================================================================================

function init()
{
	if (window.fnOtherFunctions)
	{
		fnOtherFunctions();
	}
}

//Script voor het tonen van een modelessDialog (of anders een popup) ==============================================================================================
//fnPopWindow('test.htm',320,240,'no','no','no','no','no','no','no','mod','naam');
function fnPopWindow(theUrl,width,height,scrollbars,resizable,menubar,toolbar,personalbar,locationbar,status,mod,naam)
{
	IE = ((document.all)&&(navigator.appVersion.indexOf("MSIE")!=-1)) ? true : false;

	//Added by TI vd Berg [10-07-2007]
	isStaticPage = true;
	docName = theUrl.substr(theUrl.lastIndexOf("/") + 1);
	if(docName.substr(0,1) == "_" || docName.substr(0,1) == "#")
		isStaticPage = false;
	//--
	
	if (IE && mod=='yes' && !isStaticPage)
	{
		window.showModalDialog(theUrl,window,"dialogWidth: "+width+"px; dialogHeight: "+height+"px; dialogTop: px; dialogLeft: px; edge: Raised; center: Yes; help: No; scroll: "+scrollbars+"; resizable: "+resizable+"; status: "+status+";");
	}
	
	else
	{
		var winleft = (screen.width - width) / 2;
		var winUp = (screen.height - height) / 2;
		winUp = winUp -40;
		var winProp = 'width='+width+',height='+height+',left='+winleft+',top='+winUp+',scrollbars=1,resizable=1,menubar='+menubar+',toolbar='+toolbar+',personalbar='+personalbar+',location='+locationbar+',status='+status+''
		if (naam=='')
		{
			naam= date.getSeconds ;
		}
		Win = window.open(theUrl, naam, winProp)
	}
}

//Script voor de shop onclick
function fnStudentAlert(listId,defaultListId)
{
	var elemStudent = document.getElementById(listId);
	if (elemStudent)
	{
		if (elemStudent.checked == true)
		{
			if (confirm('Aankruisen van de optie \'Student\' heeft alleen zin als u in aanmerking komt voor de onderwijskorting.\r\nDat is alleen het geval als u staat ingeschreven bij een onderwijsinstelling en u een of meer cd-rom(s) of meer dan een verschillende schriftelijke publicaties wilt bestellen.\r\nAls dat niet het geval is, dan kunt u beter de optie \'Anders\' aankruisen.\r\nDan kunt u namelijk het bestelformulier gewoon digitaal verzenden en hoeft u geen kopie van een collegekaart mee te sturen'))
			{
				//
			}
			else
			{
				var elemAnders = document.getElementById(defaultListId);
				if (elemAnders)
				{
					elemAnders.checked = true;
				}
			}
		}
	}
}

//Functies om de querystring uit te lezen==================================================================================================================================
function QueryString(key)
{
	var value = null;
	for (var i=0;i<QueryString.keys.length;i++)
	{
		if (QueryString.keys[i]==key)
		{
			value = QueryString.values[i];
			break;
		}
	}
	return value;
}
QueryString.keys = new Array();
QueryString.values = new Array();

function QueryString_Parse()
{
	var query = window.location.search.substring(1);
	var pairs = query.split("&");
	
	for (var i=0;i<pairs.length;i++)
	{
		var pos = pairs[i].indexOf('=');
		if (pos >= 0)
		{
			var argname = pairs[i].substring(0,pos);
			var value = pairs[i].substring(pos+1);
			QueryString.keys[QueryString.keys.length] = argname;
			QueryString.values[QueryString.values.length] = value;		
		}
	}

}

QueryString_Parse();

//Functie om het kennisnetmenu te genereren==================================================================================================================================
function genKennisnetMenu()
{

document.write("<table id='kennissub' class='kennissub' border='0' cellspacing='1' cellpadding='2' onmouseover='showSub();' onmouseout='TriggerHideSub();'>")
document.write("<tr>")
document.write("	<td id='td1' bgcolor='#98C000' onmouseover=\"fnSubOver(this,'#D1F0A3','#000000');\" onmouseout=\"fnSubOut(this,'#98C000','#000000');\" style='color:#000000;' class='kennistd' onclick=\"fnSubOnclick('openbareruimte');\" >")
document.write("		Openbare ruimte")
document.write("	</td>")
document.write("</tr>")
document.write("<tr>")
document.write("	<td id='td2' bgcolor='#008434' onmouseover=\"fnSubOver(this,'#AADCAF','#000000');\" onmouseout=\"fnSubOut(this,'#008434','#FFFFFF');\" style='color:#FFFFFF;' class='kennistd' onclick=\"fnSubOnclick('mobiliteitentransport');\" >")
document.write("		Mobiliteit en Transport")
document.write("	</td>")
document.write("</tr>")
document.write("<tr>")
document.write("	<td id='td3' bgcolor='#FFD300' onmouseover=\"fnSubOver(this,'#FFF29E','#000000');\" onmouseout=\"fnSubOut(this,'#FFD300','#000000');\" style='color:#000000;' class='kennistd' onclick=\"fnSubOnclick('verkeerstechniek');\" >")
document.write("		Verkeerstechniek")
document.write("	</td>")
document.write("</tr>")
document.write("<tr>")
document.write("	<td id='td4' bgcolor='#601585' onmouseover=\"fnSubOver(this,'#D3A9E0','#000000');\" onmouseout=\"fnSubOut(this,'#601585','#FFFFFF');\" style='color:#FFFFFF;' class='kennistd' onclick=\"fnSubOnclick('infra');\" >")
document.write("		Infrastructuur")
document.write("	</td>")
document.write("</tr>")
document.write("<tr>")
document.write("	<td id='td5' bgcolor='#E00026' onmouseover=\"fnSubOver(this,'#FFB296','#000000');\" onmouseout=\"fnSubOut(this,'#E00026','#FFFFFF');\" style='color:#FFFFFF;' class='kennistd' onclick=\"fnSubOnclick('besteksregelgeving');\" >")
document.write("		Besteksregelgeving")
document.write("	</td>")
document.write("</tr>")
document.write("<tr>")
document.write("	<td id='td6' bgcolor='#8B0200' onmouseover=\"fnSubOver(this,'#FCAA97','#000000');\" onmouseout=\"fnSubOut(this,'#8B0200','#FFFFFF');\" style='color:#FFFFFF;' class='kennistd' onclick=\"fnSubOnclick('contractvormen');\" >")
document.write("		Contractvormen")
document.write("	</td>")
document.write("</tr>")
document.write("<tr>")
document.write("	<td id='td7' bgcolor='#F28E00' onmouseover=\"fnSubOver(this,'#FFDA9C','#000000');\" onmouseout=\"fnSubOut(this,'#F28E00','#000000');\" style='color:#000000;' class='kennistd' onclick=\"fnSubOnclick('bouwprocesmanagement');\" >")
document.write("		Bouwprocesmanagement")
document.write("	</td>")
document.write("</tr>")
document.write("<tr>")
document.write("	<td id='td8' bgcolor='#006282' onmouseover=\"fnSubOver(this,'#B1D5F0','#000000');\" onmouseout=\"fnSubOut(this,'#006282','#FFFFFF');\" style='color:#FFFFFF;' class='kennistd' onclick=\"window.open('http://www.aanbestedingskalender.nl');\" >")
document.write("		Aanbestedingskalender")
document.write("	</td>")
document.write("</tr>")
document.write("<tr>")
document.write("	<td id='td9' bgcolor='#006282' onmouseover=\"fnSubOver(this,'#B1D5F0','#000000');\" onmouseout=\"fnSubOut(this,'#006282','#FFFFFF');\" style='color:#FFFFFF;' class='kennistd' onclick=\"window.open('http://www.crow.nl/asvv');\" >")
document.write("		ASVV")
document.write("	</td>")
document.write("</tr>")
document.write("<!--tr>")
document.write("	<td id='td10' bgcolor='#006282' onmouseover=\"fnSubOver(this,'#B1D5F0','#000000');\" onmouseout=\"fnSubOut(this,'#006282','#FFFFFF');\" style='color:#FFFFFF;' class='kennistd' onclick=\"window.open('http://www.crow.nl/dubo');\" >")
document.write("		Duurzaam Bouwen")
document.write("	</td>")
document.write("</tr-->")
document.write("<tr>")
document.write("	<td id='td20' bgcolor='#006282' onmouseover=\"fnSubOver(this,'#B1D5F0','#000000');\" onmouseout=\"fnSubOut(this,'#006282','#FFFFFF');\" style='color:#FFFFFF;' class='kennistd' onclick=\"fnSubOnclick('duurzaamveilig');\" >")
document.write("		Duurzaam Veilig Verkeer")
document.write("	</td>")
document.write("</tr>")
document.write("<tr>")
document.write("	<td id='td22' bgcolor='#006282' onmouseover=\"fnSubOver(this,'#B1D5F0','#000000');\" onmouseout=\"fnSubOut(this,'#006282','#FFFFFF');\" style='color:#FFFFFF;' class='kennistd' onclick=\"fnSubOnclick('ehk');\" >")
document.write("		Essentiële Herkenbaarheidkenmerken")
document.write("	</td>")
document.write("</tr>")
document.write("<tr>")
document.write("	<td id='td33' bgcolor='#006282' onmouseover=\"fnSubOver(this,'#B1D5F0','#000000');\" onmouseout=\"fnSubOut(this,'#006282','#FFFFFF');\" style='color:#FFFFFF;' class='kennistd' onclick=\"fnSubOnclick('iks');\" >")
document.write("		Kindvriendelijke straten")
document.write("	</td>")
document.write("</tr>")
document.write("<tr>")
document.write("	<td id='td34' bgcolor='#006282' onmouseover=\"fnSubOver(this,'#B1D5F0','#000000');\" onmouseout=\"fnSubOut(this,'#006282','#FFFFFF');\" style='color:#FFFFFF;' class='kennistd' onclick=\"window.open('http://www.ruimte-mobiliteit.nl');\" >")
document.write("		Programma Ruimte &amp; Mobiliteit")
document.write("	</td>")
document.write("</tr>")
document.write("<tr>")
document.write("	<td id='td13' bgcolor='#006282' onmouseover=\"fnSubOver(this,'#B1D5F0','#000000');\" onmouseout=\"fnSubOut(this,'#006282','#FFFFFF');\" style='color:#FFFFFF;' class='kennistd' onclick=\"fnSubOnclick('raw');\" >")
document.write("		RAW")
document.write("	</td>")
document.write("</tr>")
document.write("<tr>")
document.write("	<td id='td13' bgcolor='#006282' onmouseover=\"fnSubOver(this,'#B1D5F0','#000000');\" onmouseout=\"fnSubOut(this,'#006282','#FFFFFF');\" style='color:#FFFFFF;' class='kennistd' onclick=\"window.open('http://www.risnet.nl');\" >")
document.write("		RISNET")
document.write("	</td>")
document.write("</tr>")
document.write("<tr>")
document.write("	<td id='td14' bgcolor='#006282' onmouseover=\"fnSubOver(this,'#B1D5F0','#000000');\" onmouseout=\"fnSubOut(this,'#006282','#FFFFFF');\" style='color:#FFFFFF;' class='kennistd' onclick=\"window.open('http://www.stadspoort.com');\" >")
document.write("		StadsPOORT")
document.write("	</td>")
document.write("</tr>")
document.write("<tr>")
document.write("	<td id='td21' bgcolor='#006282' onmouseover=\"fnSubOver(this,'#B1D5F0','#000000');\" onmouseout=\"fnSubOut(this,'#006282','#FFFFFF');\" style='color:#FFFFFF;' class='kennistd' onclick=\"window.open('http://www.stillerverkeer.nl');\" >")
document.write("		Stillerverkeer.nl")
document.write("	</td>")
document.write("</tr>")
document.write("<tr>")
document.write("	<td id='td15' bgcolor='#006282' onmouseover=\"fnSubOver(this,'#B1D5F0','#000000');\" onmouseout=\"fnSubOut(this,'#006282','#FFFFFF');\" style='color:#FFFFFF;' class='kennistd' onclick=\"window.open('http://www.uavgc.nl');\" >")
document.write("		UAV-gc")
document.write("	</td>")
document.write("</tr>")
document.write("<tr>")
document.write("	<td id='td16' bgcolor='#006282' onmouseover=\"fnSubOver(this,'#B1D5F0','#000000');\" onmouseout=\"fnSubOut(this,'#006282','#FFFFFF');\" style='color:#FFFFFF;' class='kennistd' onclick=\"window.open('http://www.verkeerstekens.nl');\" >")
document.write("		Verkeertekens.nl")
document.write("	</td>")
document.write("</tr>")
document.write("<tr>")
document.write("	<td id='td17' bgcolor='#006282' onmouseover=\"fnSubOver(this,'#B1D5F0','#000000');\" onmouseout=\"fnSubOut(this,'#006282','#FFFFFF');\" style='color:#FFFFFF;' class='kennistd' onclick=\"window.open('http://www.visi.nl');\" >")
document.write("		VISI")
document.write("	</td>")
document.write("</tr>")
document.write("<tr>")
document.write("	<td id='td19' bgcolor='#006282' onmouseover=\"fnSubOver(this,'#B1D5F0','#000000');\" onmouseout=\"fnSubOut(this,'#006282','#FFFFFF');\" style='color:#FFFFFF;' class='kennistd' onclick=\"fnSubOnclick('wiu');\" >")
document.write("		Werk in Uitvoering")
document.write("	</td>")
document.write("</tr>")
document.write("</table>")
}

  
