/**
 * @author: Erkan GUNES
 * @copyright: 2007 January
 *
 * @description: SWF Object Control Copyright
 *
 */


 function SwfObject() 
 {
 <!--
	this.param = new Array();
	this.attribute = new Array();
	
		
	this.SwfObject = function(strName, strId, strWidth, strHeight, strVersion, strColor, strQuality) {
		this.attribute = new Array("demo.swf","myid","200","200","7","#FFFFFF","high");
		if(strName) { 
			this.attribute[0] = this.isControl("swf", strName, '.');
		}
		if(strId) {
			this.attribute[1] = strId;
		}
		if(strWidth) {
			this.attribute[2] = strWidth;
		}
		if(strHeight) { 
			this.attribute[3] = strHeight;
		}
		if(strVersion) { 
			this.attribute[4] = strVersion;
		} 
		if(strColor) { 
			this.attribute[5] = strColor;
		}
		if(strQuality) { 
			this.attribute[6] = strQuality;
		}
		
		this.setParam("movie", this.attribute[0]);
		this.setParam("bgcolor", this.attribute[5]);
		this.setParam("quality", this.attribute[6]);
	}
	
	
	this.destroy = function() {
		this.SWFObject = new Object();
		this.param = new Array();
		this.attribute = new Array();
	}
	
	
	this.setParam = function(strName, strValue) {
		this.param += '<param name="' + strName + '" value="' + strValue +'">';
	}
	
	
	this.isControl = function(strCon, strVar, strRegexp) {
		erkVar = strVar.toString().split(strRegexp);
		
		sonNok = (erkVar.length - 1);	
		
		if (erkVar[sonNok].search(/^(swf)$/) != 0) 
		{
			
			if (erkVar[sonNok].search(/(swf)+[\?\A-Za-z\=]+[0-9]$/) != 0)
			{
				return 'demo.swf';
			}
			else
			{
				return strVar;
			}
			
		} 
		else 
		{
			return strVar;
		}
	}
	
	
	this.isFlash = function() { 
		var erkFlash = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=' + this.attribute[4] + ',0,0,0" width="' + this.attribute[2] + '" height="' + this.attribute[3] + '" id="' + this.attribute[1] + '">' +
		'<param name="allowScriptAccess" value="sameDomain" />' + this.param +
		'<embed src="' + this.attribute[0] + '" quality="' + this.attribute[6] + '" ' + this.isWmodeParam(this.param) + this.isMenuParam(this.param) + '  width="' + this.attribute[2] + '" height="' + this.attribute[3] + '" name="start" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />' +
		'</object>';
		document.write(erkFlash);
		
		this.destroy(); 
		
		return false;
	} 
	
	
	this.isWmodeParam = function(strArr) {
		if(strArr.toString().indexOf('wmode') == -1) {
			return 'bgcolor="' + this.attribute[5] + '" ';
		} else if (strArr.toString().indexOf('opaque') == -1) {
			return 'wmode="transparent"';
		} else {
			return 'bgcolor="' + this.attribute[5] + '" ' + 'wmode="opaque" ';
		}
		return 'wmode="transparent"';
	}
	
	
	this.isMenuParam = function(strArr) {
		if(strArr.toString().indexOf('menu') == -1) {
			return false;
		} 
		return 'menu="false" ';
	}
 //-->	
 }

 
