var flashVersion = deconcept.SWFObjectUtil.getPlayerVersion();
var FlashMinVersion = 7
var FlashMode = (flashVersion['major'] >= FlashMinVersion);

Type.registerNamespace('SoftClub.UI');

// -----------------------------------------
// ---      Class: SoftClub.UI._Baner    ---
// -----------------------------------------

SoftClub.UI._Baner = function() {
  SoftClub.UI._Baner.initializeBase(this);
  
}

SoftClub.UI._Baner.prototype = {

  // === Constants ===
  
  pageBodyBorder : 1,

  // === Overrides ===
  
  initialize : function SoftClub$UI$_Baner$initialize() {
    SoftClub.UI._Baner.callBaseMethod(this, 'initialize');
  },
  
  dispose : function SoftClub$UI$_Baner$dispose() {
    SoftClub.UI._Baner.callBaseMethod(this, 'dispose');
  },
  
  ShowLeft : function SoftClub$UI$_Baner$ShowLeft(name, bgcolor) {
		var obj = this.GetObject( name );
		if( obj != null ){
		  document.write('<div class="leftPanelBox"><div class="banner">');
			document.write( Banner.CreateFromArr( obj, bgcolor ) );
			document.write( '</div></div>' );
		}    
  },
  
	CreateFromArr : function SoftClub$UI$_Baner$CreateFromArr( arr, bgcolor ){
	  if( arguments.length > 0 )
      return this.Create( arr[0], arr[1], arr[2], arr[3], arr[4], arr[5], arr[6], arr[7], bgcolor );
	}, 
	
	Create : function SoftClub$UI$_Baner$Create( id, width, height, text, cach, imgID, updated, flashID, bgcolor ){
	
	  var file = '/filedb.aspx?id=';
		var request = '/redirect.aspx?id=';
	  var path = '';
	  var str;
	  
	  if( cach ) path += '&nocache=yes&' + (new Date).getTime();

	  if( flashID > 0 && FlashMode ){
	  
			if( !this.CheckExists( bgcolor ) )  bgcolor = "#FFFFFF";
	    path = file + flashID + path +'&link1=' + request +id;
	    path += '&cc=' + updated;
	    
      var so = new SWFObject(path, '', width, height, FlashMinVersion, bgcolor);
      so.setAttribute('style', '');
      so.addParam("quality", "high");
      so.addParam("wmode", "opaque");
      so.addParam("scale", "noscale");
	    
	    str = so.getSWFHTML();
	    
	    so = null;
	  }
	  else{
	    path = file + imgID + path;
	    path += '&cc=' + updated;
  		str = '<a href="'+request+id+'"><img width=\"'+width+'\" height=\"'+height+'\" src=\"'+path+'\" alt="'+text+'"></a>';
		}
		
		return str;
	},	 
  
	GetObject : function SoftClub$UI$_Baner$GetObject(name)
	{
		var obj = this[name];
		if( !this.CheckExists( obj ) )
			obj = null;
		return obj;
	},	  
	
	CheckExists : function SoftClub$UI$_Baner$CheckExists(obj){
		return ((obj != null) && (typeof(obj) != 'undefined'));
	}
}

SoftClub.UI._Baner.registerClass('SoftClub.UI._Baner', Sys.Component);  

var Banner = $create(SoftClub.UI._Baner);
  
  
  
