function isValidDate(psYear, psMonth, psDay)
{
	psYear = parseInt(psYear);
	psMonth = parseInt(psMonth) -1;
	psDay = parseInt(psDay);

	
	var d = new Date(psYear, psMonth, psDay);
	
	return (!isNaN(d) && d.getFullYear() == psYear && d.getMonth() == psMonth && d.getDate() == psDay);
}

function mobilemoneysale(ordernumber, pos, skin, validationcode)
{
	mmrefname = 'marik';
	mmlanguage = 'xx';
	mmpskin = '';
	
	if (skin && skin != '')
	{
		mmpskin = skin;
	}
	
	sURL = 'http://www.mobilemoney.com/salespopup.asp?pos='+escape(pos)+'&ordernumber='+escape(ordernumber)+'&refname='+escape(mmrefname)+'&language='+escape(mmlanguage)+'&popupskin='+escape(mmpskin)+'&location='+escape(document.location)+'';
	
	if (validationcode && validationcode != '')
	{
		sURL += '&validationcode=' + validationcode;
	}
	
	window.open(sURL,'popup','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=468,height=550,left='+eval((screen.availWidth/2)-234)+',top=50');
}



function get_ubb_buttons(psTextarea, psToolbar)
{
	window.addEvent('load', function()
	{
		do_get_ubb_buttons(psTextarea, psToolbar);
	});
}
function get_ubb_toolbar(psTextarea)
{
	get_ubb_buttons(psTextarea, 'ubbtoolbar');
}
function do_get_ubb_buttons(psTextarea, psToolbar)
{
	var ubbtoolbar = new nawte(psTextarea, psToolbar, {interceptTabs:false});
	
	ubbtoolbar.addFunction('Bold', function() {
		selection = this.getSelection();
		this.replaceSelection('[b]' + selection + '[/b]');
	}, {'id': 'bold_button', 'title': 'Bold'});
	
	ubbtoolbar.addFunction('Italic', function() {
		selection = this.getSelection();
		this.replaceSelection('[i]' + selection + '[/i]');
	}, {'id': 'italic_button', 'title': 'Italic'});
	
	ubbtoolbar.addFunction('Underline', function() {
		selection = this.getSelection();
		this.replaceSelection('[u]' + selection + '[/u]');
	}, {'id': 'underline_button', 'title': 'Underline'});
	
	ubbtoolbar.addFunction('Strike through', function() {
		selection = this.getSelection();
		this.replaceSelection('[s]' + selection + '[/s]');
	}, {'id': 'strikethrough_button', 'title': 'Strike'});
	
	ubbtoolbar.addFunction('Superscript', function()
	{
		selection = this.getSelection();
		this.replaceSelection('[sup]' + selection + '[/sup]');
	}, {'id': 'superscript_button', 'title': 'Superscript'});
	
	ubbtoolbar.addFunction('Subscript', function()
	{
		selection = this.getSelection();
		this.replaceSelection('[sub]' + selection + '[/sub]');
	}, {'id': 'subscript_button', 'title': 'Subscript'});
	
	ubbtoolbar.addFunction('Image', function() {
		var selection = this.getSelection();  
		var response = prompt('Enter image URL','');  
		if (response == null || response == '')
		return;  
		this.replaceSelection('[img]' + response + '[/img]');
	}, {'id': 'image_button', 'title': 'Image'});
	
	if (window.ie)
	{
		ubbtoolbar.addFunction('Color', function() {
			var selection = this.getSelection();  
			var response = prompt('Enter color','');  
			if (response == null || response == '')
			return;  
			this.replaceSelection('[color=' + response + ']...[/color]');
		}, {'id': 'color_button', 'title': 'Kleur'});
	}
	else
	{
		function ChangeDivBorderColor()
		{
			var selection = ubbtoolbar.getSelection();  
			ubbtoolbar.replaceSelection('[color=' + myColorPicker.CurColor.rgbToHex() + ']...[/color]');
			myColorPicker.close();
		}
		function ChangeCancel()
		{
			myColorPicker.close();
		}
		function rePosition()
		{
			var coords = $('color_button').getCoordinates();
			$E('.cpDialog').setStyles({
				'left': coords.left,
				'top': coords.top + coords.height + 10
			});
		}
		
		myColorPicker = new ColorPicker(
		{
			initialState: "Closed",
			showSelectedSwatch: true,
			showPreviewSwatch: false,
			showHSVFields: false,
			showRGBFields: false,
			showOKButton: true,
			showCancelButton: true,
			showTitleBar: false,
			hueBarWidth: 8,
			hueBarHeight:120,
			svBoxWidth:120,
			svBoxHeight:120
		});
		myColorPicker.OKCallback = ChangeDivBorderColor;
		myColorPicker.CancelCallback = ChangeCancel;
		ubbtoolbar.addFunction('Color', function()
		{
			myColorPicker.open();
			rePosition();
		}, {'id': 'color_button', 'title': 'Kleur'});
	}
	
	ubbtoolbar.addFunction('Video', function() {
		var selection = this.getSelection();  
		var response = prompt('Enter Link URL','');  
		if(response == null || response == '')
		return;  
		this.replaceSelection('[video]' + response + '[/video]');
	}, {'id': 'video_button', 'title': 'Video'});
	
	ubbtoolbar.addFunction('Insert Link', function() {
		var selection = this.getSelection();  
		var response = prompt('Enter Link URL','');  
		if(response == null || response == '')  
		return;  
		this.replaceSelection('[url=' +  (response == '' ? 'http://link_url/' : response) + ']' + (selection == '' ? 'Link Text' : selection) + '[/url]');
	}, {'id': 'link_button', 'title': 'Link'});
	
	ubbtoolbar.addFunction('Left', function()
	{
		var selection = this.getSelection();
		this.replaceSelection('[left]' + selection + '[/left]');
	}, {'id': 'left_button', 'title': 'Left'});
	
	ubbtoolbar.addFunction('Center', function()
	{
		var selection = this.getSelection();
		this.replaceSelection('[center]' + selection + '[/center]');
	}, {'id': 'center_button', 'title': 'Center'});
	
	ubbtoolbar.addFunction('Right', function()
	{
		var selection = this.getSelection();
		this.replaceSelection('[right]' + selection + '[/right]');
	}, {'id': 'right_button', 'title': 'Right'});
	
	ubbtoolbar.addFunction('Spoiler', function()
	{
		var selection = this.getSelection();
		this.replaceSelection('[spoiler]' + selection + '[/spoiler]');
	}, {'id': 'spoiler_button', 'title': 'Spoiler'});
	
	ubbtoolbar.addFunction('Quote', function()
	{
		var selection = this.getSelection();
		this.replaceSelection('[quote]' + selection + '[/quote]');
	}, {'id': 'quote_button', 'title': 'Quote'});
	
	ubbtoolbar.addFunction('Offtopic', function()
	{
		var selection = this.getSelection();
		this.replaceSelection('[offtopic]' + selection + '[/offtopic]');
	}, {'id': 'offtopic_button', 'title': 'Offtopic'});
	
	ubbtoolbar.addFunction('Google', function()
	{
		var selection = this.getSelection();
		this.replaceSelection('[google]' + selection + '[/google]');
	}, {'id': 'google_button', 'title': 'Google'});
	
	ubbtoolbar.addFunction('Woordenboek', function()
	{
		var selection = this.getSelection();
		this.replaceSelection('[woordenboek]' + selection + '[/woordenboek]');
	}, {'id': 'woordenboek_button', 'title': 'Woordenboek'});
	
	ubbtoolbar.addFunction('List', function()
	{
		var selection = this.getSelection();
		this.replaceSelection('[ul][li]' + selection + '[/li][/ul]');
	}, {'id': 'list_button', 'title': 'Lijst'});
	
	ubbtoolbar.addFunction('Horizontale lijn', function()
	{
		var selection = this.getSelection();
		this.replaceSelection(selection + '[hr]');
	}, {'id' : 'hr_button', 'title': 'Horizontale lijn'});
	
	ubbtoolbar.addFunction('Edit', function()
	{
		var selection = this.getSelection();
		this.replaceSelection('[edit]' + selection + '[/edit]');
	}, {'id': 'edit_button', 'title': 'Edit'});
}

function user_images()
{
	var im  = $$('img.scale'), i = im.length;
	while (i--)
	{
		if (im[i].naturalWidth || im[i].complete)
		{
			scale_image(im[i]);
		}
		else if (typeof im[i].onreadystatechange != 'undefined')
		{
			im[i].onreadystatechange = scale_image;
		}
		else
		{
			im[i].onload = scale_image;
		}
		
		im[i].onerror = scale_image;
		im[i].onabort = scale_image;
	}
	if (window.ie)
	{
		window.addEvent('load', user_images_ie);
	}
}
function user_images_ie()
{
	var im = document.images, i = im.length;
	while (i--)
	{
		if (im[i].className.indexOf('scale') != -1)
		{
			scale_image(im[i]);
		}
	}
}
function scale_image(img)
{
	if (!img)
	{
		img = this;
	}
	
	if (img.width || img.complete)
	{
		if (img.naturalWidth)
		{
			imgwidth = img.naturalWidth;
			imgheight = img.naturalHeight;
		}
		else if (img.complete)
		{
			var dum = new Image(); dum.src = img.src;
			imgwidth = dum.width;
			imgheight = dum.height;
		}
		
		if (imgwidth)
		{
			if (img.onreadystatechange)
			{
				img.onreadystatechange = null;
			}
			if (img.onload)
			{
				img.onload = null;
			}
		}
		
		var contentDiv = img.parentNode, inQuote = false;
		while (contentDiv)
		{
			if (contentDiv.className && contentDiv.className.indexOf('imagecontainer') != -1)
			{
				break;
			}
			contentDiv = contentDiv.parentNode;
		}
		
		if (contentDiv)
		{
			var maxWidth = contentDiv.offsetWidth;
			if (window.ie6)
			{
				/* Beware... Dirty IE 6 hack. What a worthless browser. */
				s = contentDiv.outerHTML;
				regexp = new RegExp("(.*)width: ([0-9]+)px(.*)", "i");
				ar = regexp.exec(s);
				if (ar[2])
				{
					maxWidth = ar[2];
				}
			}
			
			if (imgwidth > maxWidth)
			{
				if (img.parentNode.nodeName != 'A')
				{
					if (!img.naturalWidth)
					{
						img.naturalWidth = imgwidth;
					}
					if (!img.naturalHeight)
					{
						img.naturalHeight = imgheight;
					}
					img.className += ' resized hand';
					//img.onclick = openImage;
					el = img;
				}
				else
				{
					img.className += ' resized';
					//img.parentNode.className = 'multibox_userimages';
				}
			}
			
			if (img.width > maxWidth)
			{
				if (img.height)
				{
					img.height = Math.round(maxWidth / img.width * img.height);
				}
				img.width = maxWidth;
			}
		}
	}
}

function passwordStrength(password)
{
	var desc = new Array();
	desc[0] = 'Zeer zwak';
	desc[1] = 'Zwak';
	desc[2] = 'Beter';
	desc[3] = 'Gemiddeld';
	desc[4] = 'Sterk';
	desc[5] = 'Sterkst';

	var score = 0;

	//if password bigger than 6 give 1 point
	if (password.length > 6) score++;

	//if password has both lower and uppercase characters give 1 point	
	if ( ( password.match(/[a-z]/) ) && ( password.match(/[A-Z]/) ) ) score++;

	//if password has at least one number give 1 point
	if (password.match(/\d+/)) score++;

	//if password has at least one special caracther give 1 point
	if ( password.match(/.[!,@,#,$,%,^,&,*,?,_,~,-,(,)]/) )	score++;

	//if password bigger than 12 give another 1 point
	if (password.length > 12) score++;

	 $('password-description').innerHTML = desc[score];
	 $('password-strength').className = 'password-strength-' + score;
}

function loadSifr()
{
	return;
	
	var oFontEnglish = {
		src: 'http://www.brandongevallen.nl/_includes/sifr/fonts/english.swf'
	};
	
	sIFR.activate(oFontEnglish);
	
	sIFR.replace(
		oFontEnglish,
		{
			selector: 'body#sitetype_designer div#headerbottom ul li'
		},
		{
			wmode: 'transparent'
		}
	);
	
	/*
	new MoosIFR("body#sitetype_designer div#headerbottom ul li", {
		flashsrc: "",
		bgcolor: "#FFFFFF",
		textcolor: "#000000",
		linkcolor: "#000000",
		hovercolor: "#CCCCCC",
		wmode: 'transparent'
	});
	*/
}


window.addEvent('domready', function()
{
	oMultiBox = new MultiBox('multibox', {
		descClassName: false,
		useOverlay: true,
		useKeyboardNavigation: true
	});
	loadSifr();
});
window.addEvent('load', function()
{
	user_images();
	/*
	new MultiBox('multibox_userimages', {
		descClassName: false,
		useOverlay: true
	});
	*/
});



function vuldiv(tevullendiv,gekozenwaarde)
{
 
  document.getElementById(gekozenwaarde).style.display = "block"; 
  
  if (gekozenwaarde == 'inhouda')
  {
  	document.getElementById('inhoudb').style.display = "none"; 
  	document.getElementById('inhoudc').style.display = "none"; 
  }
  if (gekozenwaarde == 'inhoudb')
  {
  	document.getElementById('inhouda').style.display = "none"; 
  	document.getElementById('inhoudc').style.display = "none";
  	
  }
  if (gekozenwaarde == 'inhoudc')
  {
  	document.getElementById('inhouda').style.display = "none"; 
  	document.getElementById('inhoudb').style.display = "none";
  }
  

/*document.getElementById(DivId).innerHTML = 'testt';*/
}