
	var is = null;
	var browserEventType = document.all ? true : false;
	
	function replaceHtml(el, html) 
	{
	        var oldEl = (typeof el === "string" ? document.getElementById(el) : el);
	        var newEl = document.createElement(oldEl.nodeName);
	        newEl.id = oldEl.id;
	        newEl.className = oldEl.className;
	        newEl.innerHTML = html;
	        oldEl.parentNode.replaceChild(newEl, oldEl);
	        return newEl;
	}

	function URLEncode(value)
	{
		var SAFECHARS = "0123456789" +					// Numeric
						"ABCDEFGHIJKLMNOPQRSTUVWXYZ" +	// Alphabetic
						"abcdefghijklmnopqrstuvwxyz" +
						"-_.!~*'()";					// RFC2396 Mark characters
		var HEX = "0123456789ABCDEF";

		var plaintext = value;
		var encoded = "";
		for (var i = 0; i < plaintext.length; i++ ) {
			var ch = plaintext.charAt(i);
		    if (ch == " ") {
			    encoded += "+";				// x-www-urlencoded, rather than %20
			} else if (SAFECHARS.indexOf(ch) != -1) {
			    encoded += ch;
			} else {
			    var charCode = ch.charCodeAt(0);
				if (charCode > 255) {
					encoded += "+";
				} else {
					encoded += "%";
					encoded += HEX.charAt((charCode >> 4) & 0xF);
					encoded += HEX.charAt(charCode & 0xF);
				}
			}
		} // for

		return encoded;
	};

	function URLDecode(value)
	{
	   var HEXCHARS = "0123456789ABCDEFabcdef";
	   var encoded = value;
	   var plaintext = "";
	   var i = 0;
	   while (i < encoded.length)
	   {
	       var ch = encoded.charAt(i);
		   if (ch == "+")
		   {
		       plaintext += " ";
			   i++;
		   }
		   else if (ch == "%")
		   {
				if (i < (encoded.length-2)
						&& HEXCHARS.indexOf(encoded.charAt(i+1)) != -1
						&& HEXCHARS.indexOf(encoded.charAt(i+2)) != -1 )
				{
					plaintext += unescape( encoded.substr(i,3) );
					i += 3;
				}
				else
				{
					plaintext += "%[ERROR]";
					i++;
				}
			}
			else
			{
			   plaintext += ch;
			   i++;
			}
		}
	   return plaintext;
	};

	//-- Browsercheck
	function BrowserCheck() {
		var b = navigator.appName;
		if (b=="Netscape") this.b = "ns";
		else if (b=="Microsoft Internet Explorer") this.b = "ie";
		this.v = parseInt(navigator.appVersion);

		this.ns4 = (this.b=="ns" && this.v<=4);
		this.ie4 = (navigator.userAgent.indexOf('MSIE 4')>0);
		this.ie5 = (navigator.userAgent.indexOf('MSIE 5')>0);
		this.ie6 = (navigator.userAgent.indexOf('MSIE 6')>0);
		this.moz = (this.b=="ns" && this.v>=5);
	}
	is = new BrowserCheck();

	function jumpMenu(baseUrl, url)
	{
		window.location = baseUrl+url;
	}


function JSopenWindow(pcUrlCall,piWidth,piHeight)
{	var iScreenAvailWidth = window.screen.availWidth - 8;
	var iScreenAvailHeight = window.screen.availHeight;
	// Check parameters
	piWidth  = (JSopenWindow.arguments.length<=1 ? iScreenAvailWidth : piWidth);
	piHeight = (JSopenWindow.arguments.length<=2 ? iScreenAvailHeight : piHeight);
	// Force center top/left coordinates
	var piCenterX = parseInt( (iScreenAvailWidth - piWidth) / 2, 10);
	var piCenterY = parseInt( (iScreenAvailHeight - piHeight) / 2, 10);
	// Force unique window name
	oDate = new Date();
	iTime = oDate.getTime();
	oWindowName = window.open( pcUrlCall, 'Win' + iTime.toString(),'width=' + piWidth.toString() + ',height=' + piHeight.toString() + ',top=' +piCenterY.toString() +',left=' + piCenterX.toString()+',toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=0');
	oWindowName.focus();
}

function switchForum(x)
{
	var s = x.options[x.selectedIndex];
	if (s.value != '')
	{
		if (s.id == 'switchCat')
			this.location.href = '/forum/#cat_' + s.value;
		else
			this.location.href = '/showforum/' + s.value;
	}
}

function getObjectLeft(oObj)
{
	if (oObj)
		return ((oObj.clientLeft||0) + (oObj.offsetLeft||0) + getObjectLeft(oObj.offsetParent));
	else
		return 0;
}

function getObjectTop(oObj)
{
	if (oObj)
		return ((oObj.clientTop||0) + (oObj.offsetTop||0) + getObjectTop(oObj.offsetParent));
	else
		return 0;
}

getLeft=function(object)
{
	if((document.compatMode)&&(document.compatMode == 'CSS1Compat')&&(document.documentElement)){
		objDocument = document.documentElement;
	}else if(document.body){
		objDocument = document.body;
	}
	
	return ((objDocument.scrollLeft||0) + (objDocument.clientLeft||0) + getObjectLeft(object));
	return getObjectLeft(object);
}

getTop=function(object)
{
	if((document.compatMode)&&(document.compatMode == 'CSS1Compat')&&(document.documentElement)){
		objDocument = document.documentElement;
	}else if(document.body){
		objDocument = document.body;
	}
	
	return ((objDocument.scrollTop||0) + (objDocument.clientTop||0) + getObjectTop(object));
}

function getElementLeft(Elem) {

	var elem = Elem;

	xPos = elem.offsetLeft;
	tempEl = elem.offsetParent;
		while (tempEl != null) {
			xPos += tempEl.offsetLeft;
  		tempEl = tempEl.offsetParent;
		}
	return xPos;
}


function getElementTop(Elem) {
	if (ns4) {
		var elem = getObjNN4(document, Elem);
		return elem.pageY;
	} else {
		if(document.getElementById) {	
			var elem = document.getElementById(Elem);
		} else if (document.all) {
			var elem = document.all[Elem];
		}
		yPos = elem.offsetTop;
		tempEl = elem.offsetParent;
		while (tempEl != null) {
  			yPos += tempEl.offsetTop;
	  		tempEl = tempEl.offsetParent;
  		}
		return yPos;
	}
}

function setInnerHTML(oId, sHTML)
{
	if (document.getElementById(oId))
		document.getElementById(oId).innerHTML = sHTML;
}

function createFlashHtml(sId, sIdFF, sSrc, sVars, sWidth, sHeight, sWmode, sBgColor)
{
	if (sWmode == '')
		sWmode = 'window';
		
	if (sBgColor == '')
	{
		sBgColorIE = '';
		sBgColorFF = '';
	}
	else
	{
		sBgColorIE = '<param name="bgcolor" value="'+sBgColor+'">';
		sBgColorFF = 'bgcolor="'+sBgColor+'" ';
	}
		
	flash_html = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" id="'+sId+'" align="middle" height="'+sHeight+'" width="'+sWidth+'">' +
			'<param name="allowScriptAccess" value="always">' +
			'<param name="movie" value="'+sSrc+'">' +
			'<param name="quality" value="high">' +
			sBgColorIE +
			'<param name="wmode" value="'+sWmode+'">' +
			'<param name="FlashVars" value="'+sVars+'">' + 
			'<embed id="'+sIdFF+'" src="'+sSrc+'" FlashVars="'+sVars+'" '+sBgColorFF+'wmode="'+sWmode+'" quality="high" bgcolor="'+sBgColor+'" name="banner" allowscriptaccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" align="middle" height="'+sHeight+'" width="'+sWidth+'">' +

			'</object>';
	return flash_html;
}

	//FUNCTIONS FOR BACKUP POST
	///////////////////////////////////////////////////////////
	
	var backupTimer;
	var myDate = new Date();
	
	function backupInput()
	{
		if(inputField.value.length != 0)
		{
			setCookie('addPostBackup_'+topicId, inputField.value, 2, '/', '', '');
			fTimer = 0;
			timedFeedback();
		}
	}
	
	function timedBackup()
	{
		backupTimer = window.setInterval('backupInput()', 10000);
	}
	
	function getBackup ()
	{
		if (isQuote == 0)
		{
			backUp = getCookie('addPostBackup_'+topicId);
			
			if(backUp)
			{
				inputField.value = backUp;
				backupFeedback.innerHTML = 'Je oude bewaarde post is teruggezet'
			}
		}
	}
	
	function timedFeedback()
	{
		var myDate = new Date();
		backupFeedback.innerHTML = 'Tekst automatisch bewaard om: '+checkTime(myDate.getHours())+':'+checkTime(myDate.getMinutes())+':'+checkTime(myDate.getSeconds());
		
	}
	
	function stopTimer()
	{
		window.clearInterval(backupTimer);
	}
	
	function checkTime(i)
	{
		if (i<10) 
	  		{i="0" + i}
  		return i
	}

	
	function setCookie( name, value, expires, path, domain, secure ) 
	{
		// set time, it's in milliseconds
		var today = new Date();
		today.setTime( today.getTime() );
		
		/*
		if the expires variable is set, make the correct 
		expires time, the current script below will set 
		it for x number of days, to make it for hours, 
		delete * 24, for minutes, delete * 60 * 24
		*/
		if ( expires )
		{
		expires = expires * 1000 * 60 * 60 * 24;
		}
		var expires_date = new Date( today.getTime() + (expires) );
		
		document.cookie = name + "=" +escape( value ) +
		( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + 
		( ( path ) ? ";path=" + path : "" ) + 
		( ( domain ) ? ";domain=" + domain : "" ) +
		( ( secure ) ? ";secure" : "" );
	}
	
	function getCookie( name ) {
		var start = document.cookie.indexOf( name + "=" );
		var len = start + name.length + 1;
		if ( ( !start ) &&
		( name != document.cookie.substring( 0, name.length ) ) )
		{
		return null;
		}
		if ( start == -1 ) return null;
		var end = document.cookie.indexOf( ";", len );
		if ( end == -1 ) end = document.cookie.length;
		return unescape( document.cookie.substring( len, end ) );
	}

	function deleteCookie( name, path, domain ) {
		if ( Get_Cookie( name ) ) document.cookie = name + "=" +
		( ( path ) ? ";path=" + path : "") +
		( ( domain ) ? ";domain=" + domain : "" ) +
		";expires=Thu, 01-Jan-1970 00:00:01 GMT";
	}
		
	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 var 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;
	}
	
	function eraseCookie(name) {
		createCookie(name,"",-1);
	}
	
	var hideUserBarTimeout;

	function showUserbarRegionDropDown()
	{
		var oRegionDropdown = document.getElementById('boxUserBarRegionDropdown');
		oRegionDropdown.style.display = 'block';
		clearTimeout(hideUserBarTimeout);
	}
	
	function hideUserbarRegionDropDown()
	{
		var oRegionDropdown = document.getElementById('boxUserBarRegionDropdown');
		oRegionDropdown.style.display = 'none';
	}
	
	function startHideUserbarRegionDropDown()
	{
		hideUserBarTimeout = setTimeout('hideUserbarRegionDropDown()', 400);
	}

	function containsDOM (container, containee) 
	{
		var isParent = false;
		do {
			if ((isParent = container == containee))
				break;
			containee = containee.parentNode;
		}
		while (containee != null);
		
		return isParent;
	}

	function checkMouseLeave (element, evt) 
	{
		if (element.contains && evt.toElement) 
			return !element.contains(evt.toElement);
		else if (evt.relatedTarget) 
			return !containsDOM(element, evt.relatedTarget);
	}

	function RegionSearchKeyup (e)
	{
		if(window.event)
			keynum = e.keyCode;
		else if(e.which)
			keynum = e.which;
			
		oRegionSearchInput = document.getElementById('RegionSearchInput');
		
		if ((keynum != 38) && (keynum != 40) && (keynum != 13))
		{
			RegionSearchCity(oRegionSearchInput.value);
		}
	}

	function RegionSearchBoxKeydown (e)
	{
		if(window.event)
			keynum = e.keyCode;
		else if(e.which)
			keynum = e.which;

		oRegionSearchList = document.getElementById('RegionSearchList');
		if (oRegionSearchList.style.display == 'block')
		{
			if (keynum == 38)
			{
				if (RegionSearchBoxPosition > 1)
					RegionSearchBoxPosition--;
				else
					RegionSearchBoxPosition = 1;
					
				RegionSearchHighlight(RegionSearchBoxPosition);
			}
			else if (keynum == 40)
			{
				if (RegionSearchBoxPosition < oRegionSearchList.currentCityCount)
					RegionSearchBoxPosition++;
					
				RegionSearchHighlight(RegionSearchBoxPosition);
			}
			else if ((keynum == 13) && (RegionSearchBoxPosition > 0))
			{
				oRegionSearchInput.value = oRegionSearchList.childNodes[RegionSearchBoxPosition - 1].title;
				oRegionSearchList.style.display = 'none';
			}
		}

		function RegionSearchHighlight (Index)
		{
			oRegionSearchList = document.getElementById('RegionSearchList');
			
			for(i = 0; i < oRegionSearchList.childNodes.length; i++)
			{
				oRegionSearchItem = oRegionSearchList.childNodes[i];
				
				if (i == (Index - 1))
					oRegionSearchItem.className = 'regionSearchListItemHover';
				else
					oRegionSearchItem.className = 'regionSearchListItem';
			}
		}
					
		return false;
	}
	
	function switchAll(clicked)
	{
		checkBoxes = document.getElementsByTagName('input');
		if(clicked.checked == true)
		{
			for(i=0;i<checkBoxes.length;i++)
			{
				if(checkBoxes[i].getAttribute('type')=='checkbox')
					checkBoxes[i].checked = true;
			}
		}
		else
		{
			for(i=0;i<checkBoxes.length;i++)
			{
				if(checkBoxes[i].getAttribute('type')=='checkbox')
					checkBoxes[i].checked = false;
			}
		}
	}
	
	var arrOnLoadFunctions = new Array();
	
	function onLoadRegister(sFunction)
	{
		arrOnLoadFunctions[arrOnLoadFunctions.length] = sFunction;
	}
	
	function onLoadCallBack()
	{
		for (i = 0; i < arrOnLoadFunctions.length; i++)
		{
			oFunction = new Function(arrOnLoadFunctions[i]);
			oFunction();
		}
	}
	
	
	
	function SbsdCreateImageCheckboxAlt(i, sNormal, sRollover, sSelected, bSelected, fCallback)
	{
		var _imageObject = document.getElementById(i);
		var _imageNormal = sNormal;
		var _imageRollover = sRollover;
		var _imageSelected = sSelected;
		var _selected = bSelected;
		
		_imageObject.style.cursor = 'pointer';

		if (_selected == true)
			_imageObject.src = _imageSelected;
		else
			_imageObject.src = _imageNormal;

		_imageObject.selectUncheck = function()
		{
			this._selected = false;
			this.src = _imageNormal;
		}
		
		_imageObject.onclick = function()
		{
			this._selected = true;
			this.src = _imageSelected;

			fCallback(this);
		}
		
		_imageObject.onmouseout = function()
		{
			if (this._selected == true)
				this.src = _imageSelected;
			else
				this.src = _imageNormal;
		}
		
		_imageObject.onmousemove = function()
		{
			if (this._selected == true)
				this.src = _imageSelected;
			else
				this.src = _imageRollover;
		}
	}
	
	
	function SbsdCreateImageCheckbox(i, sNormal, sRollover, sSelected, bSelected, sValue, sNonValue)
	{
		var _imageObject = document.getElementById(i);
		var _imageNormal = sNormal;
		var _imageRollover = sRollover;
		var _imageSelected = sSelected;
		var _selected = bSelected;
		var _value = sValue;
		var _nonValue = sNonValue;
		
		_imageObject.style.cursor = 'pointer';
		
		if (_selected == true)
			_imageObject.checkValue = sValue;
		else
			_imageObject.checkValue = sNonValue;
			
		if (_selected == true)
			this.src = _imageSelected;
		else
			this.src = _imageNormal;
		
		_imageObject.onclick = function()
		{
			_selected = !_selected;
			
			if (_selected == true)
			{
				this.src = _imageSelected;
				this.checkValue = _value;
			}
			else
			{
				this.src = _imageRollover;
				this.checkValue = _nonValue;
			}
			
			SbsdPhotoEditor.preview();
		}
		
		_imageObject.onmouseout = function()
		{
			if (_selected == true)
				this.src = _imageSelected;
			else
				this.src = _imageNormal;
		}
		
		_imageObject.onmousemove = function()
		{
			if (_selected == true)
				this.src = _imageSelected;
			else
				this.src = _imageRollover;
		}
	}
	
	
	function SbsdImageRadioGroupClass(i, s)
	{
		var _buttonArray = new Array();
		var _oParent = document.getElementById(i);
		var _groupObject = s;
		
		this.addButton = function(sNormal, sRollover, sSelected)
		{
			oButton = document.createElement('img');
			
			oButton.src = sNormal;
			oButton.onmousemove = "if (this.isSelected == false) { this.src = '"+sNormal+"' };";
			oButton.onmouseout = "if (this.isSelected == false) { this.src = '"+sNormal+"' };";
			oButton.onclick = "";
		}
	}
	
	function SbsdPhotoEditorClass(i)
	{
		var _rotateAngle = 90;
		var _photoId;
		
		_photoId = i;

		this.rotateLeft = function()
		{
			_rotateAngle = _rotateAngle - 90;
			_rotateAngle = _rotateAngle % 360;
			
			this.preview();
		}
		
		this.rotateRight = function()
		{
			_rotateAngle = _rotateAngle + 90;
			_rotateAngle = _rotateAngle % 360;
			
			this.preview();
		}
		
		this.colorspaceGrayscale = function()
		{
			
		}
		
		this.colorspaceColor = function()
		{
			
		}
		
		this.preview = function()
		{
			lEffects = 0;
			lEffects = lEffects + document.getElementById('photoEditorEffectBlur').checkValue;
			lEffects = lEffects + document.getElementById('photoEditorEffectEmboss').checkValue;
			lEffects = lEffects + document.getElementById('photoEditorEffectFindedges').checkValue;
			lEffects = lEffects + document.getElementById('photoEditorEffectInvert').checkValue;
			lEffects = lEffects + document.getElementById('photoEditorEffectSmooth').checkValue;
			lEffects = lEffects + document.getElementById('photoEditorEffectMeanremoval').checkValue;
			lEffects = lEffects + document.getElementById('photoEditorMirrorHorizontal').checkValue;
			lEffects = lEffects + document.getElementById('photoEditorMirrorVertical').checkValue;
			
			if (document.getElementById('photoEditorColorGrayscale')._selected == true)
				lEffects = lEffects + 256;

			oPreview = document.getElementById('photoEditorPreview');
			oPreview.style.display = 'none';
			oPreview.src = '/photoedit.php?i='+_photoId+'&r='+_rotateAngle+'&e='+lEffects;
		}
		
		this.loadSettings = function(r)
		{
			_rotateAngle = r;
		}

	}
	
	function SbsdPhotoEditorAlign(oPhoto)
	{
		oTempImage = new Image;
		oTempImage.src = oPhoto.src;
		
		oPhoto.style.marginTop = ((300-oTempImage.height)/2)+'px';
		oPhoto.style.display = 'inline';

	}
	
	// count hits
	function hitcount(desc, id) {
      var img = document.createElement("img") ;
      img.src = "http://www.sugababes.nl/hit?desc=" + desc + (id ? "&id=" + id : "") ;
    }