var jakeboximage = function(){
  
  var DEFAULT = {
    width: "400",
    height: "300"
  };
  var TYPE = "jakeboximage";

  var _this;
  var _dom;

  function _main(cfg,display){
    _this = this;
    _createDom(cfg,display);
  };
  
  function _createDom(cfg,display){
	//create a unique id for this image using a ms timestamp
    var id = "jakeboximage" + Number(new Date());
	//set width to the cfg width if it is defined, else set it to the default width (in px)
    var width = getIfDefined(cfg.width,DEFAULT.width)+"px";
	//parse the defined height(so integer math can occur), and set it to the height
    var height = parseInt(getIfDefined(cfg.height,DEFAULT.height))+24+"px";
	//set the class of the object
    var cls = getIfDefined(cfg.cls,"");

	//Create a new div tag in which the swf will be embedded
    _dom = jq$("<div />").attr({"class":"media-slidedeckswf "+cls,"id": id}).css({
      "display": "block",
      "position":"absolute",
      "top":0,
      "left":0,
      "width":width,
      "height":height,
      opacity: 0
    })[0];
   
	//add the new div to the page
    jq$(display).append(_dom);
	//call the embedSwfObject using the new id, the swf url, and the object attributes
    _embedImage(id,cfg["media-url"],cfg);
  };


  function _embedImage(idOrEl, mediaUrl, cfg){
	
	//set the title if it's defined
	var _title = getIfDefined(cfg.title,"");
	
	//set the background image to itself or null if its not defined
	cfg.backgroundImage = (typeof cfg.backgroundImage!="undefined")?cfg.backgroundImage:null;
	
	//set the alt content to itself or null if its not defined
	cfg.alt = (typeof cfg.alt!="undefined")?cfg.alt:null;
	
	//add an anchor tag to this media element
	var _aDom = jq$(_dom).append('<a class="jakebox" href="'+mediaUrl+'" title="'+_title+'"><img class="jakebox" src="'+cfg.backgroundImage+'" width="'+cfg.width+'" height="'+cfg.height+'" alt="'+cfg.alt+'" /></a>');
	
	//initilaize the image with jakebox
	jakeboxInit(jq$(_aDom).children());
  };
  
  this.getType = function(){
    return TYPE;
  };
  
  this.getDom = function(){
    return _dom;
  };
  
  this.activate = function(){
   //animate the current _dom item to full opacity
   jq$(_dom).animate({opacity: 1});
  };
  
  this.deactivate = function(){
    //animate the current _dom item to full transparency
    jq$(_dom).animate({opacity: 0});
  };
  
  _main.apply(this, arguments);
}