// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults

function getElementsByClass(searchClass, tag) {
	var classElements = new Array();
	if ( tag == null )
		tag = '*';
	var els = document.getElementsByTagName(tag);
	var elsLen = els.length;
	var pattern = new RegExp('(^|\\s)'+searchClass+'(\\s|$)');
	for (i = 0, j = 0; i < elsLen; i++) {
		if ( pattern.test(els[i].className) ) {
			classElements[j] = els[i];
			j++;
		}
	}
	return classElements;
}

function WM_Video(url, width, height, id) {
  wm_html = '<object id="MediaPlayer" width="' + width + '" height="' + height + '" classid="CLSID:6BF52A52-394A-11D3-B153-00C04F79FAA6"'
  wm_html = wm_html + 'standby="Loading Windows Media Player components..." type="application/x-oleobject" align="middle" id="' + id + '">'
  wm_html = wm_html + '<param name="URL" value="' + url + '">'
  wm_html = wm_html + '<param name="ShowControls" value="true">'
  wm_html = wm_html + '<param name="ShowStatusBar" value="false">'
  wm_html = wm_html + '<param name="ShowDisplay" value="false">'
  wm_html = wm_html + '<param name="autoStart" value="true">'
  wm_html = wm_html + '<EMBED TYPE="application/x-mplayer2" SRC="' + url + '" NAME="MediaPlayer" '
  wm_html = wm_html + 'WIDTH="' + width + '" HEIGHT="' + height + '" ShowControls="1" ShowStatusBar="0" ShowDisplay="0" autostart="0"> </EMBED>'
  wm_html = wm_html + '</object>'
  document.writeln(wm_html);
}