/********** DOMREADY *******************************/
	window.addEvent('domready', function() {
		if ($('sidebarTweets')) {
			MooTools.lang.setLanguage("nl-NL");
			new Twidget({
				user: 'LudensUtrecht',
				count: '3',
				element: 'sidebarTweetsInner'
			});
		}
	});

/********** FUNCTIONS ******************************/

	function ShowHideFAQ(divid, sPrefix) {
		if ($(divid).style.display == "none") {
			for (var iCnt = 0; iCnt < $('aantal_faq').value; iCnt++) {
				$("faq_" + iCnt).style.display = "none";
				$("icon_faq_" + iCnt + "").src = sPrefix + 'media/img/plus.jpg';
				$("link_faq_" + iCnt + "").className = '';
			}

			$(divid).style.display = "block";

			$("icon_" + divid + "").src = sPrefix + 'media/img/minus.jpg';
			$("link_" + divid + "").className = 'active';
		} else {
			$(divid).style.display = "none";
			$("icon_" + divid  +"").src = sPrefix + 'media/img/plus.jpg';
			$("link_" + divid + "").className = '';
		}
	}

	function ShowHideJob(divid, sPrefix) {
		if ($(divid).style.display == "none") {
			$(divid).style.display = "block";
			$("icon_" + divid + "").src = sPrefix + 'media/img/minus.jpg';
			$("link_" + divid + "").className = 'active';

		} else {
			$(divid).style.display = "none";
			$("icon_" + divid + "").src = sPrefix + 'media/img/plus.jpg';
			$("link_" + divid + "").className = '';
		}
		var divid = divid.replace(/job_/i,"sentafriend_");
		if (divid.indexOf('sentafriend') !=-1) {
			$(divid).style.display = "none";
			$("icon_" + divid + "").src = sPrefix + 'media/img/plus.jpg';
			$("link_" + divid + "").className = '';
		}
	}

	function ShowHideSentaFriend(divid, sPrefix) {
		if ($(divid).style.display == "none") {
			$(divid).style.display = "block";
			$("icon_" + divid + "").src = sPrefix + 'media/img/minus.jpg';
			$("link_" + divid + "").className = 'active';

		} else {
			$(divid).style.display = "none";
			$("icon_" + divid + "").src = sPrefix + 'media/img/plus.jpg';
			$("link_" + divid + "").className = '';
		}

		var divid = divid.replace(/sentafriend_/i,"job_");
		if ($(divid)) {
		$(divid).style.display = "none";
		$("icon_" + divid + "").src = sPrefix + 'media/img/plus.jpg';
		$("link_" + divid + "").className = '';
		}
	}

	function ShowHideVideo(divid, sPrefix) {
		if ($(divid).style.display == "none") {
			$(divid).style.display = "block";
			$("icon_" + divid + "").src = sPrefix + 'media/img/minus.jpg';
			$("link_" + divid + "").className = 'active';
		} else {
			$(divid).style.display = "none";
			$("icon_" + divid + "").src = sPrefix + 'media/img/plus.jpg';
			$("link_" + divid + "").className = '';
		}
	}

	function ShowHideFieldset(divid, sPrefix) {
		if ($(divid).style.display == "none") {
			$(divid).style.display = "block";
			$("icon_" + divid + "").src = sPrefix + 'media/img/minus.jpg';
			// $("link_" + divid + "").className = 'active';
		} else {
			$(divid).style.display = "none";
			$("icon_" + divid + "").src = sPrefix + 'media/img/plus.jpg';
			// $("link_" + divid + "").className = '';
		}
	}

	function ShowHideTSO(divid, sPrefix) {
		if (($(divid).style.display == "none") || ($(divid).style.display == ""))  {
			$(divid).style.display = "block";
			//$("icon_" + divid + "").src = sPrefix + 'media/img/minus.jpg';
			$("link_" + divid + "").className = 'active';
		} else {
			$(divid).style.display = "none";
			//$("icon_" + divid  +"").src = sPrefix + 'media/img/plus.jpg';
			$("link_" + divid + "").className = '';
		}
	}


	function is_child_of(parent, child) {
		if (child != null) {
			while(child.parentNode) {
				if((child = child.parentNode) == parent) {
					return true;
				}
			}
		}

		return false;
	}


	// A function which receives a US-formatted currency amount (e.g. 1725.95) and
	// converts it to European format for displaying on-screen (e.g. 1.725,95)
	// @iAmount - an integer which is a currency amount in US formatting
	function fConvertCurrency(iCost) {
		// Store the euros and cents separate from each other in an array
		var aAmount = (iCost.toString()).split(".");

		// If the amount is at least a thousand euro, start to iterate through each digit
		var sFormattedAmount = "";
		if (aAmount[0].length > 3) {
			for (iCnt = 0; iCnt < aAmount[0].length; iCnt++) {
				// Add this digit to the formatted amount string
				sFormattedAmount = sFormattedAmount + "" + aAmount[0].charAt(iCnt);

				// If this iteration is a multiplier of 3 and not the final digit, insert a grouping period character
				if (((aAmount[0].length - (iCnt + 1)) % 3 == 0) && ((iCnt + 1) != aAmount[0].length)) {
					sFormattedAmount = sFormattedAmount + ".";
				}
			}

			// After iterating through all the digits, the cents need to be concatenated to the amount
			sFormattedAmount = sFormattedAmount + "," + aAmount[1];
		} else {
			// As the amount is no more than 999, just concatenate the euros and cents together
			sFormattedAmount = aAmount[0] + "," + aAmount[1];
		}

		return sFormattedAmount;
	}


	// A function which checks the state of a specified table (child) element and opens or closes it
	//
	// Arguments:
	// @oElement - a reference to the element to be toggled
	function fToggleTable(oElement) {
		// If the element is set to not display on the page, reverse this; otherwise, set
		// it to display on the page; do the same for the plus / minus icons
		if ((oElement.style.display != 'table-row') && (oElement.style.display != 'inline')) {
			// Good browsers, like Firefox and Chrome
			try {
				// Display the TR which holds the photos
				oElement.style.display = 'table-row';
			} catch (e) {
				// Bad browsers, like Internet Explorer
				try {
					// Display the TR which holds the photos
					oElement.style.display = 'inline';
				} catch (e) {
					// Even worse than IE...
				}
			}
		} else {
			oElement.setStyle('display', 'none');
		}
	}


	// A function which checks an array for a certain value and returns true if it is found
	//
	// Arguments:
	// @value - a mixed value to search for
	// @array - the array to search in
	function in_array(value, array) {
		for (var iCnt = 0; iCnt < array.length; iCnt++) {
			if(array[iCnt] == value) {
				return true;
			}
		}

		return false;
	}
