/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*  Author:	Ronald Everts
*  (c) Copyright 1999-2006 Starsale BV, Enschede, The Netherlands																													*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

/* FLASH ERROR FIX FOR IE */
function buildFlash() {
	var useragent = navigator.userAgent.toLowerCase();
	var IE = useragent.indexOf('msie') > 0 ? true : false;
	if(IE) {
		var tmp = document.getElementsByTagName('object')
		var tm = null
		var par = null
		var arr = new Array();
		for(i = 0; i < tmp.length; i++) {
			arr = new Array();
			if(tmp[i]) {
				tm =  tmp[i];
				if(tmp[i].parentNode) {
					par = tmp[i].parentNode
					
					var obj = '';
					
					var classidObj = '';
					var alignObj = '';
					var idObj = '';
					var widthObj = '';
					var heightObj = '';
					
					var embSrc = '';
					var embLoop = '';
					var embMenu = '';
					var embQuality = '';
					var embWmode = '';
					var embBgcolor = '';
					var embWidth = '';
					var embHeight = '';
					var embName = '';
					var embAlign = '';
					var embAllowScriptAccess = '';
					var embType = '';
					var embPluginspage = '';
					
					/* GET ATTRIBUTES OF MAIN OBJECT */
					if(tmp[i].getAttribute('classid')) {classidObj = 'classid="' + tmp[i].getAttribute('classid') + '"';}
					if(tmp[i].getAttribute('align')) {alignObj = 'align="' + tmp[i].getAttribute('align') + '"';}
					if(tmp[i].getAttribute('id')) {idObj = 'id="' + tmp[i].getAttribute('id') + '"';}
					if(tmp[i].getAttribute('width')) {widthObj = 'width="' + tmp[i].getAttribute('width') + '"';}
					if(tmp[i].getAttribute('height')) {heightObj = 'height="' + tmp[i].getAttribute('height') + '"';}
					
					obj = '<object ' + classidObj + ' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" ' + idObj + ' ' + widthObj + ' ' + heightObj + ' ' + alignObj + '>';
					
					/* BUILD PARAMS & EMBED */
					for(j = 0; j < tm.childNodes.length; j++) {
						if(tm.childNodes[j]) {
							if(tm.childNodes[j].nodeName.toLowerCase() == 'param') {
								obj += '<param name="' + tm.childNodes[j].getAttribute('name') + '" value="' + tm.childNodes[j].getAttribute('value') + '" />'
							} else if(tm.childNodes[j].nodeName.toLowerCase() == 'embed') {
								
								if(tm.childNodes[j].getAttribute('src')) {embSrc = 'src="' + tmp[i].getAttribute('src') + '"';}
								if(tm.childNodes[j].getAttribute('loop')) {embLoop = 'loop="' + tmp[i].getAttribute('loop') + '"';}
								if(tm.childNodes[j].getAttribute('menu')) {embMenu = 'menu="' + tmp[i].getAttribute('menu') + '"';}
								if(tm.childNodes[j].getAttribute('quality')) {embQuality = 'quality="' + tmp[i].getAttribute('quality') + '"';}
								if(tm.childNodes[j].getAttribute('wmode')) {embWmode = 'wmode="' + tmp[i].getAttribute('wmode') + '"';}
								if(tm.childNodes[j].getAttribute('bgcolor')) {embBgcolor = 'bgcolor="' + tmp[i].getAttribute('bgcolor') + '"';}
								if(tm.childNodes[j].getAttribute('width')) {embWidth = 'width="' + tmp[i].getAttribute('width') + '"';}
								if(tm.childNodes[j].getAttribute('height')) {embHeight = 'height="' + tmp[i].getAttribute('height') + '"';}
								if(tm.childNodes[j].getAttribute('name')) {embName = 'name="' + tmp[i].getAttribute('name') + '"';}
								if(tm.childNodes[j].getAttribute('align')) {embAlign = 'align="' + tmp[i].getAttribute('align') + '"';}
								if(tm.childNodes[j].getAttribute('allowScriptAccess')) {embAllowScriptAccess = 'allowScriptAccess="' + tmp[i].getAttribute('allowScriptAccess') + '"';}
								if(tm.childNodes[j].getAttribute('type')) {embType = 'type="' + tmp[i].getAttribute('type') + '"';}
								if(tm.childNodes[j].getAttribute('pluginspage')) {embPluginspage = 'pluginspage="' + tmp[i].getAttribute('pluginspage') + '"';}
								
								obj += '<embed ' + embSrc + ' ' + embLoop + ' ' + embMenu + ' ' + embQuality + ' ' + embWmode + ' ' + embBgcolor + ' ' + embWidth + ' ' + embHeight + ' ' + embName + ' ' + embAlign + ' ' + embAllowScriptAccess + ' ' + embType + ' ' + embPluginspage + '/>';
							}
						}
					}
					
					obj += '</object>';
					par.removeChild(tmp[i])
					par.innerHTML = obj;
				}
			}
		}
	}
}
setTimeout("buildFlash()", 500)