//	======================================================================
//
//
//	bsn.showFlashContent.js
//
//
//	project:	none
//
//	author:		Timothy Groves	tim.groves [at] element3.de
//	version:	1.0
//	
//	language:	javascript
//	requires:	var flashversion - integer (not required!)
//
//	tested on:	Safari 2.0 Mac / FF 1.0.6 Mac / Opera 8 Mac
//
//	history:	11.08.2005	-	created
//
//	======================================================================

// set up bsn namespace
if (typeof(bsn) == "undefined")	var bsn = {};

bsn.showFlashContent = function (eleID,flVer,swf,w,h,vars) {

	var wrapper, url, agt, is_ie, newHTML, obj, param;

	// check flash version
	if (typeof(flashversion) == "number"  &&  flVer < flashversion)
		return;
		
	//alert(swf);
		
	// check DOM capabilities
	if ( document.getElementById )
	{
		wrapper = document.getElementById( eleID );
		
		// clear wrapper children
		while (wrapper.firstChild)
			wrapper.removeChild(wrapper.firstChild);
			
		// build url of swf & add variables
		url = swf;
		if (vars.length) url += "?"+vars.join("&");

		// add flash satay object using innerHTML or DOM
		agt = navigator.userAgent.toLowerCase(); 
		is_ie = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
		if (is_ie)
		{
			// innerHTML method for IE
			newHTML = '<object type="application/x-shockwave-flash" data="'+url+'" width="'+w+'" height="'+h+'"><param name="movie" value="'+url+'"></param></object>'
			wrapper.innerHTML = newHTML;
		}
		else
		{
			// doin' it with tha DOM! - create flash satay element
			obj = document.createElement("object");
			obj.type = "application/x-shockwave-flash";
			obj.data = url; obj.width = w; obj.height = h;
			param = document.createElement("param");
			param.name = "movie"; param.value = url;
			
			obj.appendChild(param);
			wrapper.appendChild( obj );
		}
	}
}
