function media() {}
media.prototype.evaluate = function(source) {
	this.srcImage = '';
	this.srcFlash = '';
	this.TYPES = {NONE: 0, IMAGE: 1, FLASH: 2};
	this.source = source;
	this.type = this.TYPES.NONE;
	
	if(this.source) {
		if(this.source.indexOf("?")>-1)
		{ 
			if(this.source.indexOf("?") == 0) {
				this.srcFlash = this.source.substr(1);
				this.type = this.type | this.TYPES.FLASH;
			} else {
				var retval = {};
				var result = this.source.split(/\?/);
				this.srcImage = result.shift();
				this.type = this.type | this.TYPES.IMAGE;
				var nodes = result[0].split(/&/g);
				for(var it in nodes) {
					var keyvalue = nodes[it].split(/=/g);
					retval[keyvalue[0]] = keyvalue[1];
				}
				if(retval.flv) {
					this.srcFlash = retval.flv;
					this.type = this.type | this.TYPES.FLASH;
				}
			}
		} else {
			this.srcImage = this.source;
			this.type = this.TYPES.IMAGE;
		}

	} 
}
media.prototype.hasImage = function() { return( this.type & this.TYPES.IMAGE) > 0; }
media.prototype.hasFlash = function() { return( this.type & this.TYPES.FLASH) > 0; }
media.prototype.hasImageAndFlash = function() { return this.hasImage() && this.hasFlash(); }
media.prototype.getFlash = function(obj) {
		var scale = true;
		obj.find('img').load(res = {repl : obj, cont: this}, function() {
		res.repl.html("<object style=\"background:white;\" type=\"application/x-shockwave-flash\" data=\"/media/player_flv_maxi.swf\" height=" + this.clientHeight + " width=" + this.clientWidth + ">" +
				"<param name=\"movie\" value=\"/media/player_flv_maxi.swf\" /> "+
				"<param name=\"allowFullScreen\" value=\"false\" /> "+
				"<param name=\"FlashVars\" value=\"flv=" + res.cont.srcImage.substr(0, res.cont.srcImage.indexOf(res.cont.srcFlash.split(/\//g).shift())) + res.cont.srcFlash + "&amp;autoload=0" + (res.cont.hasImage() ? '&amp;startimage=' + res.cont.srcImage : '') + "&amp;bgcolor1=FFFFFF&amp;bgcolor2=FFFFFF&amp;showiconplay=1&amp;iconplaycolor=FFFFFF&amp;iconplaybgcolor=aeaeae&amp;iconplaybgalpha=70&amp;showplayer=never&amp;margin=0&amp;buffershowbg=0&amp;buffermessage=&amp;videobgcolor=ffffff" + (scale ? "&amp;width=" + res.repl.width() + "&amp;height=" + res.repl.height() : "") + "\" /> " +
			"</object>");
		});
}
