// Tarantinov Flash SwfObject

var swfObj = function(swf,width,height,name){
	    
		var flashVar = new Array();
		var fI = 0;
		var elem = null;
	    var IE = false;
	    if(navigator.appName == "Microsoft Internet Explorer"){
			IE = true;
		};
	
		if(IE){
		   var sObj  = '<object id="'+name+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+width+'" height="'+height+'">';
	           sObj += '<param name="movie" value="'+swf+'" />';
		}else{
           var sObj = '<embed width="'+width+'" height="'+height+'" name="'+name+'" src="'+swf+'" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"';
		};
	
	
	    this.param = function(nameVal,paramVal){
			if(nameVal.toLowerCase() != "flashvars"){
				if(IE){
					   sObj += '<param name="'+nameVal+'" value="'+paramVal+'" />';
				}else{
				       sObj += ' '+nameVal+'="'+paramVal+'"';
				};
			};
		}
	
		this.flashVar = function(fName,fValue){
		  if(fName != ""){
			flashVar[fI] = fName+'->'+encodeURIComponent(fValue);
			fI++;
		  };
		}
		
		this.add = function(){
			
			if(flashVar.length > 0){
				var FlashVars = '';
				for(jk = 0; jk < flashVar.length; jk++){
					var tmpVare = flashVar[jk].split('->');
				       FlashVars += tmpVare[0]+'='+tmpVare[1];
					if(jk < (flashVar.length-1)){
					   FlashVars += '&';
					};
				};
				
				if(IE){
					   sObj += '<param name="FlashVars" value="'+FlashVars+'" />';
				}else{
				       sObj += ' FlashVars="'+FlashVars+'"';
				};				
				
			};
			
				if(IE){
					   sObj += '</object>';
				}else{
				       sObj += '></embed>';
				};
				
			    document.write(sObj);
				
		}
		
		this.HTML = function(){
			
			if(flashVar.length > 0){
				var FlashVars = '';
				for(jk = 0; jk < flashVar.length; jk++){
					var tmpVare = flashVar[jk].split('->');
				       FlashVars += tmpVare[0]+'='+tmpVare[1];
					if(jk < (flashVar.length-1)){
					   FlashVars += '&';
					};
				};
				
				if(IE){
					   sObj += '<param name="FlashVars" value="'+FlashVars+'" />';
				}else{
				       sObj += ' FlashVars="'+FlashVars+'"';
				};				
				
			};
			
				if(IE){
					   sObj += '</object>';
				}else{
				       sObj += '></embed>';
				};
				
			    return sObj;
				

		}		
		
		this.obj = function(){
				if(name != ''){
				   if(IE){
					   elem = document.getElementById(name);
				   }else{
				       elem = document[name];
				   };
				};			
			return elem;
		}
};
