var qcactivex = 1;

function findFlash(){
	if (!document.getElementsByTagName || !document.createElement || !document.appendChild) {return;}
	// exclude IE/Mac (will only get GIFs from now on)
	if ((navigator.userAgent.indexOf("Mac")>=0) && (navigator.userAgent.indexOf("MSIE")>=0)) {return;}
	var obArr = document.getElementsByTagName('object');
	var techsourceObj = new Array();
	var len = obArr.length;
	for(var i=0;i<len;i++){
		// checking for id string "techsource_" and adding object to Array techsourceObj
		if(obArr[i].id.substring(0,11) == ('techsource_')){
			var x = techsourceObj.push(obArr[i]);
		}
	}
	var newlen = techsourceObj.length;
	// calling addFlash for each of the objects found
	for(var i=0;i<newlen;i++){
		addFlash(techsourceObj[i].id);
	}
}
function addFlash(id){
	// exclude browsers with Gecko engine (Firefox, Netscape etc...) from this if it's
	// a wallpaper ad (String "wallpaper" contained in Object id).
	if (id.indexOf("techsource_")>=0 && (navigator.userAgent.indexOf("Gecko")>=0)) {return}
	var namex = document.getElementById(id);
	// gets Codebase from object tag to add to newly created object
	var newCodebase=namex.getAttribute("codebase");
	var par = new Array();
	// assigning all <param> elements to array partmp
	var partmp = document.getElementsByTagName('param');
	var txt = "";
	for (i = 0; i < partmp.length; i++) {
		// comparing the id of the parent node of the <param> element found
		// with the id object ID: Must be the same.
	  var parentid = partmp[i].parentNode.id;
	  if(parentid == id){
      paramname = partmp[i].name;
      paramvalue = partmp[i].value;
      par[paramname] = paramvalue;
    }
  }
  	// gets id and strips it of "techsource_" and "wallpaper_" for newly created object/embed tags (some of the 
  	// wallpapers require the flash files to have certain ids in order to work)
  	var newId = (id.indexOf("wallpaper_")==11)?id.substring(21):id.substring(11);
	if(!window.ActiveXObject){
		// create an <embed> tag for non-IE-Browsers
		var flashElement = document.createElement('embed');
		flashElement.pluginspage = "http://www.macromedia.com/go/getflashplayer";
		flashElement.type = "application/x-shockwave-flash";
		for(n in par){
			if(n == 'movie'){
				flashElement.src = par[n];
			}else{
				flashElement[n] = par[n];
			}
		}
		// sets new id
		flashElement.name=newId;
  }else{
  	// create flash object for IE
		var flashElement = document.createElement('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="'+newId+'" codebase="'+newCodebase+'">');
		var tmp;
		for(n in par){
			tmp = document.createElement('param');
			tmp.name = n;
			tmp.value = par[n];
			flashElement.appendChild(tmp);
		}
	}
	flashElement.width = namex.width;
	flashElement.height = namex.height;
	namex.parentNode.insertBefore(flashElement,namex);
	newHiddenId=newId+"_hidden";
	document.getElementById(id).setAttribute("id", newHiddenId);
}
findFlash();