// Flash JS Code

var canFlashPlay = false;

function detectFlash(){
	var usedVers = 7;
	/*if (navigator.plugins) {
for(var i=0; i<navigator.plugins.length; i++)  {
	if ((navigator.plugins[i]['name']).toLowerCase().indexOf('shockwave') != -1)
		for(j in navigator.plugins[i]) {
			alert(j+"="+navigator.plugins[i][j]);
		}
}
	}
	else {
		
		alert("false");
	}*/
	if ((-1 != navigator.appVersion.indexOf('MSIE') &&  -1 != navigator.appVersion.indexOf('Windows')) ||  -1 != navigator.appVersion.indexOf('Safari') ){
		document.write('<SCR' + 'IPT TYPE="text/vbscript"\> \n');
		document.write('on error resume next \n');
		document.write('canFlashPlay = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.' + usedVers + '"))) \n');
		document.write('</SCR' + 'IPT\> \n');
	}else if (navigator.plugins && (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"])) {
		var isVers2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
		var flashDescription = navigator.plugins["Shockwave Flash" + isVers2].description;
		canFlashPlay = parseInt(flashDescription.charAt(flashDescription.indexOf(".") - 1)) >= usedVers;
		if(!canFlashPlay) {
			//idiot fix ... flash 10.0 ... hooray @ creators of this script ...
			canFlashPlay = parseInt(flashDescription.substr(flashDescription.indexOf(".") - 2,2)) >= usedVers;
		}
	}
}
function displayFlash(o){
	var i, n, cObj;
	
	cObj = new Object();

	cObj['param'] = '';
	cObj['embed'] = '<embed type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" ';
	cObj['obj']	  = '<object ';

	for (i in o){
		n = i.toLowerCase();
		switch (n){
			case 'movie':
			case 'name':
			break;
			
			case 'classid':
			case 'codebase':
			cObj.obj += n + '="' + o[i] + '" ';
			break;
			
			case 'src':
			cObj.embed += 'src="' + o[i] + '" ';
			cObj.param += '<param name="movie" value="' + o[i] + '" /> ';
			break;

			case 'width':
			case 'height':
			case 'align':
			case 'vspace': 
			case 'hspace':
			case 'class':
			case 'title':
			case 'accesskey':
			case 'tabindex':
			cObj.embed += n + '="' + o[i] + '" ';
			cObj.obj += n + '="' + o[i] + '" ';
			break;

			case 'id':
			cObj.embed += 'name="' + o[i] + '" ';
			cObj.obj += 'id="' + o[i] + '" ';
			break;

			case 'FlashVars':
			cObj.embed += 'name="' + o[i] + '" ';
			cObj.obj += 'FlashVars="' + o[i] + '" ';
			break;

			default:
			cObj.embed += n + '="' + o[i] + '" ';
			cObj.param += '<param name="' + n + '" value="' + o[i] + '" /> ';
		}
	}
	document.write(cObj.obj + '>' + cObj.param + cObj.embed + ' ></embed></object>');
}
detectFlash();

