function build_extrahtml (t, s, w, h) {
	switch (t) {
		case '_er_youtube':
			v = /v=(\w+)/i.exec(s)[1] || '';
			return '<object width="'+w+'" height="'+h+'"><param name="movie" value="http://www.youtube.com/v/'+v+'"></param><param name="allowFullScreen" value="false"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/'+v+'" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="'+w+'" height="'+h+'"></embed></object>';
		break;	
		case '_er_flash':
			var sfo = new SWFObject(s, 'flash'+((new Date()).getTime()), w, h, '9');
			sfo.addParam('allowfullscreen', 'false');
			sfo.addParam('allowscriptaccess', 'never');
			sfo.addParam('alt', s);
			return sfo.getSWFHTML();
		break;	
		case '_er_video':
			switch (s.replace(/^.+\./, '')) {
				case 'flv':
				case 'mp4':
					var sfo = new SWFObject('player.swf', 'video'+((new Date()).getTime()), w, h, '9', '#FFFFFF');
					sfo.addParam('allowfullscreen', 'false');
					sfo.addParam('allowscriptaccess', 'never');
					sfo.addParam('alt', s);
					sfo.addParam('flashvars', 'file='+s);
					return sfo.getSWFHTML();
				break;
				case 'avi':
				case 'mpg':
				case 'wmv':
					h = h * 1 + 60;
					return '<object type="application/x-mplayer2" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" width="'+w+'" height="'+h+'"><param name="url" value="'+s+'" /><param name="autostart" value="true" /><param name="balance" value="0" /><param name="currentPosition" value="0" /><param name="currentMarker" value="0" /><param name="enableContextMenu" value="false" /><param name="enableErrorDialogs" value="false" /><param name="enabled" value="true" /><param name="fullScreen" value="false" /><param name="invokeURLs" value="false" /><param name="mute" value="false" /><param name="playCount" value="1" /><param name="rate" value="1" /><param name="ShowStatusBar" value="true" /><param name="uimode" value="full" /><param name="volume" value="100" /><embed width="'+w+'" height="'+h+'" type="application/x-mplayer2" src="'+s+'" enableContextMenu="0" autoStart="1" stretchToFit="1" showStatusBar="1" showPositionControls="0" BufferingTime="3" AutoSize="1" windowlessVideo="1" showcontrols="1" playCount="1" volume="0"  pluginspage="http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/" /></object>';
				break;
			}
		break;
	}
}

function parse_extrahtml (content) {
	var width, height, src;
	var piece, html;
	
	html 	= content.innerHTML;
	piece 	= /<img[\s]*class=['"]?(_er_youtube|_er_flash|_er_video)['"]?[^>]+>/i.exec(html);
	
	while (null != piece){
		width 	= /width=['"]?(\d+)/i.exec(piece[0])[1] || '';
		height 	= /height=['"]?(\d+)/i.exec(piece[0])[1] || '';
		src 	= /alt=['"]?([^" ]+)/i.exec(piece[0])[1] || '';
		html 	= html.replace(piece[0], build_extrahtml(piece[1], src, width, height));
		piece 	= /<img[\s]*class=['"]?(_er_youtube|_er_flash|_er_video)['"]?[^>]+>/i.exec(html);
	}
	
	content.innerHTML = html;
}

function addFavorite(url, title){
	if (document.all)   {
		window.external.AddFavorite(url, title);
	}
	if (window.sidebar) {
		window.sidebar.addPanel(title, url, '');
	}
}

function accesskey_switch (f) { // focus
	if (true == f) {
		this.addClassName('accesskey-focus');
	} else {
		this.removeClassName('accesskey-focus');
	}
}