/* */
window.onload = function() {
	//alert('onload');
}

window.onunload = function() {
	//alert('unloaded');
}

function showImage(img) {
	
	if (document.getElementById) {
      var element = document.getElementById('STAGE');
			element.src = img;
  } else {
		//alert(img);
	}  
}

/**
 * Adobe Flash Player 8
 * 
 * @param string element 
 * @param string id 
 * @param string class 
 * @param string src 
 * @param string width 
 * @param string height 
 * @param string bgcolor
 * @return boolean returns TRUE on success or FALSE on failure 
 */
function swf(_element, _id, _class, _src, _width, _height, _bgcolor) {
  if (hasFlashPlayer8()) {
    if (document.getElementById) {
      var element = document.getElementById(_element);
    }

    if (element) { 
      var xhtml = ''; 
      if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) { 
        xhtml += '<embed';
        xhtml += ' id="' + _id + '"';
        xhtml += ' class="' + _class + '"';
        xhtml += ' src="' + _src + '"';
        xhtml += ' type="application/x-shockwave-flash"';
        xhtml += ' width="' + _width + '"';
        xhtml += ' height="' + _height + '"';
        xhtml += ' bgcolor="' + _bgcolor + '"';
        xhtml += ' wmode="transparent"';
        xhtml += ' allowScriptAccess="sameDomain"';
        xhtml += '></embed>';
      } else { 
        xhtml += '<object';
        xhtml += ' id="' + _id + '"';
        xhtml += ' class="' + _class + '"';
        xhtml += ' src="' + _src + '"';
        xhtml += ' type="application/x-shockwave-flash"';
        xhtml += ' width="' + _width + '"';
        xhtml += ' height="' + _height + '"';
        xhtml += '>';
        xhtml += '<param name="movie" value="' + _src + '" />';
        xhtml += '<param name="allowScriptAccess" value="sameDomain" />';
        xhtml += '<param name="bgcolor" value="' + _bgcolor + '" />';
        xhtml += '<param name="wmode" value="transparent" />';
        xhtml += '</object>';
	  }
      element.innerHTML = xhtml;
      return true;
    }
  }
  return false; 

}

/**
 * hasFlashPlayer8
 * 
 * @return boolean returns TRUE on success or FALSE on failure 
 */
function hasFlashPlayer8() {
  var majorVersion;
  if (typeof(navigator.plugins['Shockwave Flash']) == 'object') {
    var description = navigator.plugins['Shockwave Flash'].description;
    majorVersion = description.substr(16, (description.indexOf('.', 16) - 16));
  } else if (typeof(ActiveXObject) == "function") {
    try {
      if (typeof(new ActiveXObject('ShockwaveFlash.ShockwaveFlash.8')) == 'object') {
        var fp8 = new ActiveXObject('ShockwaveFlash.ShockwaveFlash.8');
        fp8.AllowScriptAccess = 'sameDomain';
        majorVersion = fp8.GetVariable('$version').split(' ')[1].split(',')[0];
      }
    }
    catch(error) {
    }
  } 
  if (parseInt(majorVersion) >= 8) {
    return true;
  } else {
    return false;
  }
}
