//Vraaggerichte zoekengine
var defaultQuestionType_1 = "Type uw zoekwoord of stel uw vraag";
var defaultQuestionType_2 = "bijv.: Ik wil een paspoort";
var defaultQuestionType_3 = "Type uw zoekwoord of stel uw vraag m.b.t. het bestuur";

var TEXT_FIELD_TYPE_1 = 1;
var TEXT_FIELD_TYPE_2 = 2;
var TEXT_FIELD_TYPE_3 = 3;
var clicks = 0;

function clearContent(textField, typeNumber) {
	if (typeNumber == TEXT_FIELD_TYPE_1) {
		if (textField.value == defaultQuestionType_1) {
			textField.value = "";
			textField.style.color = "#000000";
		}
	}
	else 
	{
		if (textField.value == defaultQuestionType_2) 
		{
			textField.value = "";
			textField.style.color = "#000000";
		}
		else
		{
			if (textField.value == defaultQuestionType_3) 
			{
				textField.value = "";
				textField.style.color = "#000000";
			}
		}
	}

}

function fillContent(textField, typeNumber) {
	if (typeNumber == TEXT_FIELD_TYPE_1) {
		if (textField.value == "") {
			textField.value = defaultQuestionType_1;
			textField.style.color = "#999999";
		}
	}
	else 
	{
		if (typeNumber == TEXT_FIELD_TYPE_3) 
		{
			textField.value = defaultQuestionType_3;
			textField.style.color = "#999999";
		}
		else
		{
			if (textField.value == "") {
				textField.value = defaultQuestionType_2;
				textField.style.color = "#999999";
			}
		}
	}
}

// Fontsizing
// StyleSwitcher functions written by Paul Sowden
// http://www.alistapart.com/stories/alternate/
function setActiveSS(title) { var i, a, main; for (i=0; (a = document.getElementsByTagName("link")[i]); i++) { if (a.getAttribute("rel") && a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) { a.disabled = true; if(a.getAttribute("title") == title) a.disabled = false; } } }
function getActiveSS() { var i, a; for (i=0; (a = document.getElementsByTagName("link")[i]); i++) { if (a.getAttribute("rel") && a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled ) return a.getAttribute("title"); } return null; }
function getPreferredSS() { var i, a; for (i=0; (a = document.getElementsByTagName("link")[i]); i++) { if (a.getAttribute("rel") && a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("rel").indexOf("alt") == -1 && a.getAttribute("title") ) return a.getAttribute("title"); } return null; }
function createCookie(name,value,days) { if (days) { var date = new Date(); date.setTime(date.getTime()+(days*24*60*60*1000)); var expires = "; expires="+date.toGMTString(); } else expires = ""; document.cookie = name+"="+value+expires+"; path=/"; }
function readCookie(name) { var nameEQ = name + "="; var ca = document.cookie.split(';'); for(var i=0;i < ca.length;i++) { var c = ca[i]; while (c.charAt(0)==' ') c = c.substring(1,c.length); if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); } return null; }
window.onload = function(e) { var cookie = readCookie("style"); var title = cookie ? cookie : getPreferredSS(); setActiveSS(title); }
window.onunload = function(e) { var title = getActiveSS(); createCookie("style", title, 365); }
var cookie = readCookie("style");
var title = cookie ? cookie : getPreferredSS();
setActiveSS(title);

//Show elements when JS is turned on, this adds a classname js to the html tag. If script is of the element are hidden and a noscript tag is available to present an alternative
document.documentElement.className = "js";

// Open External Links as Blank Targets via Unobtrusive JavaScript
// http://perishablepress.com/press/2007/11/20/open-external-links-as-blank-targets-via-unobtrusive-javascript/
function externalLinks() {
	if (!document.getElementsByTagName) return;
	var anchors = document.getElementsByTagName("a");
	for (var i=0; i<anchors.length; i++) {
		var anchor = anchors[i];
		if (
			anchor.getAttribute("href") && ( 
			anchor.getAttribute("rel") == "external" || 
			anchor.getAttribute("rel") == "external nofollow" || 
			anchor.getAttribute("rel") == "nofollow external" )
			)
		anchor.target = "_blank";
	}
}
window.onload = function() {
	externalLinks();
};
