function onLoad() {
	menuRollovers();
	loadPrefilledTextFields();
	
	//alert('load');
}

function menuRollovers() {
	var items = $A($('menu').getElementsByClassName('menu_item'));
	
	items.each(function(i) {
		i.onmouseover = function() {
			this.src = this.src.slice(0, -4) + '_a.gif';
			this.overstate = "over";
		}
		i.onmouseout = function() {
			if(this.overstate == "over") { // make sure that the state was mouseover before onmouseout action is executed
				this.src = this.src.slice(0, -6) + '.gif';
			}
			this.overstate = "out";
		}
	});
}

function loadPrefilledTextFields(element) {
	if(element) {
		element = $(element);
	} else {
		element = $(document.body);
	}
	var prefilled_color = '#f9c326';
	var filled = $A(element.getElementsBySelector('input.prefilled'));
	filled.each( function (f) {
		f.normal_color = f.getStyle('color');
		f.setStyle( {color:prefilled_color} );
		f.onfocus = function() {
			if(!this.start_value || this.value.strip() == this.start_value.strip()) {
				this.start_value=this.value; 
				this.value='';
				$(this).setStyle( {color:this.normal_color} );
			}
		}
		f.onblur = function() {
			if($(this).value.strip() == '') { 
				this.value = this.start_value;
				$(this).setStyle( {color:prefilled_color} );
			}
		}
	});
}

function videoPOP(url,breedte,hoogte)
{
	var brow_c;
	if(breedte > 0 && hoogte > 0) {
		var win_h 	= hoogte;
		var win_w 	= breedte;
	} else {
		var win_h 	= 320;
		var win_w 	= 320;
	}
	var left  	= parseInt((screen.availWidth-win_w) / 2);
	var top   	= parseInt((screen.availHeight-win_h) / 2);
	if(document.all) {
		brow_c 	= '' +
		'	CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6"' +
		'	type="application/x-oleobject"';
	} else {
		brow_c 	= 'type="application/x-mplayer2"';
	}
	var content	= ''+
	'<html lang="nl" xmlns="http://www.w3.org/1999/xhtml" xml:lang="nl" dir="ltr">'+
	'<body style="height:100%;">' +
	'<OBJECT id="VIDEO" width="'+win_w+'" height="'+win_h+'"' +
	'	style="position:absolute; left:0;top:0;"' +
	'	'+brow_c+'>' +
	'	' +
	'	<PARAM NAME="URL" VALUE="'+url+'">' +
	'	<PARAM NAME="SRC" VALUE="'+url+'">' +
	'	<PARAM NAME="SendPlayStateChangeEvents" VALUE="True">' +
	'	<PARAM NAME="AutoStart" VALUE="True">' +
	'	<PARAM NAME="stretchToFit" VALUE="True">' +
	//'	<PARAM name="uiMode" value="mini">' +
	'	<PARAM name="PlayCount" value="1">' +
	'</OBJECT></body></html>';
	//alert('Open '+url+', breedte: '+breedte+'px, hoogte: '+hoogte+'px');*/
	//var content = '<embed style="width:'+win_w+'px; height:'+win_h+'px; background:#ffffff;" src="'+url+'" autostart="true" />';
	var opt = "directories=no,"
			+ "height="+win_h+","
			+ "width="+win_w+","
			+ "left="+left+","
			+ "top="+top+","
			+ "location=no,"
			+ "menubar=no,"
			+ "status=no,"
			+ "toolbar=no";
	//alert(opt);
	if(document.movieclip) {
		document.movieclip.close();
	}
	document.movieclip = window.open("", "movieclip", opt);
	document.movieclip.focus();
	document.movieclip.document.open();
	document.movieclip.document.write(content);
	document.movieclip.document.title = "Bits 'n Pieces - Videoclip";
	document.movieclip.document.close();
}