if (!document.getElementById || !document.createElement)
{
	alert('Je browser is voor internetbegrippen uit het stenen tijdperk!\nHet kan zijn dat daarom de pagina\'s niet goed worden weergegeven.\n');
}

DetectBrowser = function()
{
	var Browser = navigator.userAgent.toLowerCase();
	
	if(Browser.indexOf("msie") > 0)
	{
		Browser = "msie";
	}
	else if(Browser.indexOf("gecko") > 0)
	{
		Browser = "gecko";
	}
	else if(Browser.indexOf("opera") > 0)
	{
		Browser	=	"opera";
	}
	
	return Browser;
}

var BrowserVersion = DetectBrowser();


SetFocus = function(FormName, FieldName)
{
	document.forms[FormName].elements[FieldName].focus();
}

Redirect = function(Url)
{
	location = Url;
}

CheckLength = function(Field, Limit)
{
	if (Field.value.length > Limit)
	{
		Field.value = Field.value.substring(0, Limit);
	}
}

ImplodeArray = function(Array, Glue)
{
	var ReturnString = "";
	
	for (Index = 0, ArrayLength = Array.length; Index < ArrayLength; Index++)
	{
		ReturnString += Array[Index] + Glue;
	}
	
	return ReturnString.substring(0, ReturnString.length - Glue.length);
}

SetStyle = function(Object, StyleName, Value)
{
	Object.style[StyleName] = Value;
}

OpenMediaWindow = function(MediaUrl, Width, Height)
{
  var Left	= (screen.width / 2) - (Width / 2);
  var Top		= (screen.height / 2) - (Height / 2) - 25; 
	  
	var HtmlSource = '<html>' +
									 '	<head>' +
									 '		<title>Media Browser</title>' +
									 '		<style type="text/css">' +
									 '		body { margin: 0px; padding: 0px; overflow: hidden; cursor: pointer;}' +
									 '		</style>' +
									 '	</head>' +
									 '<body>' +
									 '	<img src="' + MediaUrl + '" width="' + Width + '" height="' + Height + '" onclick="window.close();"/>' +
									 '</body>' +
									 '</html>';
	
	MediaWindow = window.open("", "MediaWindow", "toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbar=no, copyhistory=no, left=" + Left + ", top=" + Top + ", width=" + Width + ", height=" + Height);
	MediaWindow.document.open();
	MediaWindow.document.write(HtmlSource);
	MediaWindow.document.close();
	MediaWindow.focus();
}