function MobileWidget(widget, id, win) {
  this.widget = widget;
  this.id = id;
  this.win = win;
  
  this.showBack = null;
  this.hideBack = null;
  
  this.widget.transitioned = function() {
    if (this.isFront) {
      document.getElementById("WidgetFlip").src = "mobile/images/mobile/flipIcon.png";
    }
    else {
      document.getElementById("WidgetFlip").src = "mobile/images/mobile/flipIconBack.png";        
    }
  }
  this.front = win.document.getElementById("front");
  if (!this.front) {
    this.front = win.document.getElementById("Front");
    if (!this.front) {
      this.front = win.document.getElementById("wdgtFront");
    }
  }
  
  this.getResizeToFit = function() {
    if (MobileWidget.onDevice) {
      return {
          width: window.screen.availWidth - 5, 
          height: window.screen.availHeight - 50};
      }
    var element = document.getElementById("InnerPhone");
    if (element) {
      return {
        width: element.clientWidth, 
        height: element.clientHeight - 50};
    }
    return {width:240, height:280};  
  }
  
  this.getMaxWidth = function() {
    return window.screen.availWidth;
  }
  
  this.setTitle = function(title) {
    widgetsHelper.storeWidgetKey(this.id, "title", title);
  }
  
  this.removeFrontEvents = function(front) {
    try {
      if (front) {
        //top.alert(front.onmousemove);
        front.removeAttributeNode("onmousemove");
        front.removeAttributeNode("onmouseout");
        front.removeAttributeNode("onmousewheel");
      }
    }
    catch (e) {
      
    }  
  }
}

MobileWidget.onDevice = true;
