	function ApplyJob(JobId)
	{
		location.href = 'JobApply.asp?VacancyId=' + JobId;
	}

	function ViewVacancies()
	{
		location.href = 'Vacancies.asp?Title=Vacatures'
	}

	var TIMER;
	var OLDREFERENCEID
	var NEWREFERENCEID
	var xmlhttp;
	
	function loadXMLDoc(url, state_Change)
	{
		xmlhttp=null
		// code for Mozilla, etc.
		if (window.XMLHttpRequest)
		{
			xmlhttp=new XMLHttpRequest();
		}
		// code for IE
		else if (window.ActiveXObject)
		{
			xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
		
		if (xmlhttp!=null)
		{		
			xmlhttp.onreadystatechange=state_Change;
			xmlhttp.open("GET",url,true);
			xmlhttp.send(null);
		}
		else
		{
			alert("Deze functie wertk niet.\nJe browser ondersteund geen XMLHTTP.");
		}
	}
	
	
	function BottomGlideIn()
	{		
		var Height;
		var Top;
		var Elem1;
		var Elem2;
		
		Elem1 = document.getElementById('Bottom');
		Top = Elem1.style.marginTop;
		Top = parseInt(Top.replace("px", ""));
		Top--;
		
		Elem2 = document.getElementById('BottomContent');
		Height = Elem2.style.height;
		Height = parseInt(Height.replace("px", ""));
		Height++;
				
		Elem1.style.marginTop = Top + "px";				
		Elem1.style.height = Height + "px";
		Elem2.style.height = Height + "px";

				
		if (Height < 86)
		{
			TIMER = setTimeout("BottomGlideIn()", 15);
		}
		else
		{
			clearInterval(TIMER);	
		}

	}
	
	function BottomGlideInAndDisplay() 
	{
		var Height;
		var Top;
		var Elem1;
		var Elem2;
				
		Elem1 = document.getElementById('Bottom');
		Top = Elem1.style.marginTop;
		Top = parseInt(Top.replace("px", ""));
		Top--;
		
		Elem2 = document.getElementById('BottomContent');
		Height = Elem2.style.height;
		Height = parseInt(Height.replace("px", ""));
		Height++;
				
		Elem1.style.marginTop = Top + "px";				
		Elem1.style.height = Height + "px";
		Elem2.style.height = Height + "px";

				
		if (Height < 86)
		{			
			TIMER = setTimeout("BottomGlideInAndDisplay()", 15);
		}
		else
		{			
			Elem2.style.visibility = "visible";
			clearTimeout(TIMER);	
		}	
	}
	
	function BottomGlideInHalf() 
	{
		var Height;
		var Top;
		var Elem1;
		var Elem2;
				
		Elem1 = document.getElementById('Bottom');
		Top = Elem1.style.marginTop;
		Top = parseInt(Top.replace("px", ""));
		Top--;
		
		Elem2 = document.getElementById('BottomContent');
		Height = Elem2.style.height;
		Height = parseInt(Height.replace("px", ""));
		Height++;
				
		Elem1.style.marginTop = Top + "px";				
		Elem1.style.height = Height + "px";
		Elem2.style.height = Height + "px";

				
		if (Height < 36)
		{			
			TIMER = setTimeout("BottomGlideInHalf()", 15);
		}
		else
		{			
			Elem2.style.visibility = "visible";
			clearTimeout(TIMER);	
		}	
	}
	
	function BottomGlideOut()
	{		
		var Height;
		var Top;
		var Elem1;
		var Elem2;
		
		Elem1 = document.getElementById('Bottom');
		Top = Elem1.style.marginTop;
		Top = parseInt(Top.replace("px", ""));
		Top++;		
		
		Elem2 = document.getElementById('BottomContent');
		Height = Elem2.style.height;
		Height = parseInt(Height.replace("px", ""));
		Height--;
				
		Elem1.style.marginTop = Top + "px";				
		Elem1.style.height = Height + "px";
		Elem2.style.height = Height + "px";

				
		if (Height > 0)
		{
			TIMER = setTimeout("BottomGlideOut()", 15);
		}
		else
		{
			Elem1.style.display = "none";
			clearTimeout(TIMER);	
		}

	}
	
	function BottomShowDirect()
	{
		var Elem1;
		var Elem2;
		
		Elem1 = document.getElementById('Bottom');
		Elem2 = document.getElementById('BottomContent');
		
		Elem1.style.marginTop = "0px";				
		Elem1.style.height = "86px";
		Elem2.style.height = "86px";
		Elem2.style.visibility = "visible";
	}
	
	function BottomShowDirectHalf()
	{
		var Elem1;
		var Elem2;
		
		Elem1 = document.getElementById('Bottom');
		Elem2 = document.getElementById('BottomContent');
		
		Elem1.style.marginTop = "50px";				
		Elem1.style.height = "36px";
		Elem2.style.height = "36px";
		Elem2.style.visibility = "visible";
	}
	
	function BottomGlideOutDirect()
	{
		var Elem1;
		var Elem2;
		
		Elem1 = document.getElementById('Bottom');
		Elem2 = document.getElementById('BottomContent');
		
		Elem1.style.marginTop = "86px";				
		Elem1.style.height = "0px";
		Elem2.style.height = "0px";
		Elem2.style.display = "none";
	}
	
	function ViewReference(ReferenceId)
	{
		NEWREFERENCEID = ReferenceId;
		loadXMLDoc("Ajax/ReferencePopup.asp?ReferenceId=" + ReferenceId, ShowReference);	
	}
	
	function ShowReference() 
	{
		var Elem;
		Elem = document.getElementById("ReferenceDetail");		
		if (xmlhttp.readyState==4)
		{			
			if (xmlhttp.status==200)
			{
				if ((Elem.style.display == "none") || (Elem.style.display == "") || (OLDREFERENCEID != NEWREFERENCEID))
				{
					Elem.innerHTML = xmlhttp.responseText;
					Elem.style.display = "block";
					OLDREFERENCEID = NEWREFERENCEID;
				}
				else
				{
					Elem.style.display = "none";	
				}
			}
		}
	}
	
	function SubmitOnEnter(myfield,e, SortBy, SortOrder)
	{
		var keycode;
		if (window.event)
		{
			keycode = window.event.keyCode;
		}
		else
		{
			if (e)
			{
				keycode = e.which;
			}
			else
			{ 
				return true;
			}
		}
		
		if (keycode == 13)
		{
		   SelectPage(SortBy, SortOrder, myfield.value);
		   return false;
		}
		else
		{
		   return true;
		}
	}
	
	function CheckCallMe() 
	{
		var Name = document.getElementById('CallMeName');
		var Phone = document.getElementById('CallMePhone');
		var PhoneValue;
		var ValidPhonePattern = /^[0-9\-\ \(\)\+]+$/;
		
		if ((Name.value != "") && (Phone.value != ""))
		{
			PhoneValue = Phone.value
			
			if (PhoneValue.match(ValidPhonePattern))
			{
				return true;	
			}
			else
			{
				alert("Telefoonnummer is ongeldig!");
				return false;	
			}
		}
		else
		{
			if (Name.value == "")
				alert("Naam is een verplicht veld!");
			
			if (Phone.value == "")	
				alert("Telefoonnummer is een verplicht veld!");
				
			return false;
				
		}
			
	}
