/**
 *  Flash Embed
 *
**/

var flash_objects = 0;

function flash(s, w, h, c, v) {

  c = typeof(c) == 'object' ? c : document.getElementById(c);
  v = typeof(v) == 'object' ? v : {};

  if( c ) {

    flash_objects++;

    v['base']   = v['base']   ? v['base']   : document.location.protocol + '//' + document.domain + '/';
    v['wmode']  = v['wmode']  ? v['wmode']  : 'transparent';

    var html  = '<object id="flash-object-' + flash_objects + '"'
              + ' classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"'
              + ' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0"'
              + ' width="' + w + '"'
              + ' height="' + h + '"' + '>' + "\n";

        html += '<param name="movie" value="' + s + '" />' + "\n";

          for(var p in v) {
            html += '<param name="' + p + '" value="' + v[p] + '" />' + "\n";

          }

        html += '<embed '
              + ' pluginspage="http://www.macromedia.com/go/getflashplayer"'
              + ' base="' + v['base'] + '"'
              + ' src="' + s + '"'
              + ' width="' + w + '"'
              + ' height="' + h + '"';

          for(var p in v) {
            html += ' ' + p + '="' + v[p] + '"';

          }

        html += '/>' + "\n";

        html += '</object>' + "\n";

    c.innerHTML = html;

  }

} // ! flash()
