window.addEvent('domready', function(){

	// generic function to insert flash
	function swiff(src, width, height){
		source  = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ';
		source += 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" ';
		source += 'width="'+width+'" height="'+height+'" accesskey="2" tabindex="b" title="Learn more" wmode="transparent">';
		source += '<param name="movie" value="'+src+'" />';
		source += '<param name="wmode" value="transparent" />';
		source += '<param name="quality" value="high" />';
		source += '<embed src="'+src+'" quality="high" ';
		source += 'pluginspage="http://www.macromedia.com/go/getflashplayer" ';
		source += 'type="application/x-shockwave-flash" ';
		source += 'width="'+width+'" height="'+height+'" ';
		source += 'wmode="transparent"></embed></object>'
		return source;
	}

	// insert flash asset
	if ($('swiff_homemovie')) 
		$('swiff_homemovie').set('html', swiff('/images/homemovie.swf', 550, 190));

	// install sub-menu script
	var parentNav = $('navbar').getChildren();
	parentNav.set({
		'events': {
			'mouseenter': function(){
				if(subNav = this.getElement('ul')) subNav.setStyles({'display': 'block'});
			},
			'mouseleave': function(){
				if(subNav = this.getElement('ul')) subNav.setStyle('display', 'none');
			}
		}
	});
	
});