/*
 * Including Flash detection 
 */
document.write('<script language="javascript" src="'+baseUrl+'resources/js/flashdetect.js" ></script>');
document.write('<script language="VBScript" src="'+baseUrl+'resources/js/flashmsdetect.js" ></script>');

/*
 * Prototyping the flash class
 */
function Flash() {
	this.swf = '';
	this.alt = ''; // Alternative image if swf fails
	this.width = '';
	this.height = '';
	this.id = 'myFlash';
	this.align = 'middle';
	this.properties = new Array();
	this.swfVersion = 6;
	this.useAlt = false;
	
	this.addProperty = function (prop, val) {
		this.properties[prop] = val;
	}
	
	this.disableCache = function() {
		var d = new Date();
		this.swf += "?"+d.getTime();	
	}
	
	this.setSize = function (sizeArray) {
		this.width = sizeArray[0];	
		this.height = sizeArray[1];			
	}
	
	this.toHTML = function() {
		var myParams = "";		
		var myAttr = "";
		for(var key in this.properties) {
			myParams 	+= '<param name="'+key+'" value="'+this.properties[key]+'">\n';
			myAttr 		+= key+'="'+this.properties[key]+'" ';			
		}
		
		var myHTML 	 = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+this.width+'" height="'+this.height+'" id="'+this.id+'" align="'+this.align+'">';
		myHTML 		+= '<param name="movie" value="'+this.swf+'" />';
		myHTML 		+= myParams;
		myHTML 		+= '<embed src="'+this.swf+'" width="'+this.width+'" height="'+this.height+'" name="'+this.id+'" align="'+this.align+'" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"'+myAttr+' /></object>';
		return myHTML;
	}
	
	this.toImage = function() {
		return '<img src="'+this.alt+'" width="'+this.width+'" height="'+this.height+'" id="'+this.id+'" alt="" />';	
	}
	
	this.render = function() {
		/*if (flashinstalled != 2 || (flashversion*1) < this.swfVersion) {
			if (this.useAlt == true) {
				document.write(this.toImage());
			} else {
				if (confirm('This site uses a newer version of flash than you currently have installed, would you like to proceed to macromedia.com and install it?')) {
					document.location = 'http://www.macromedia.com/flashplayer';
				} else {
					alert('Some functions on this site will be disabled until you upgrade your flash-player.');	
				}
			}
		} else {*/
			document.write(this.toHTML());
		//}
	}
}