/*
* RTL Jetpack feature v1.0
* By CIAvash: http://potatozone.com
*/

jetpack.statusBar.append({
  html: 'RTL<input type="checkbox">',
  width: 48,
  onReady: function(widget){
      function hoverzz(event){
      $(event.target).addClass("hoverz");
      }
      function clickz(event){
      $(event.target).css("direction", "rtl").css("text-align", "right");
      }
      function unhoverz(event){
      $(event.target).removeClass("hoverz");
      }
      $("input", widget).click(function(){
      if( this.checked ){
      $(jetpack.tabs.focused.contentDocument).find("head").append("<style type='text/css'>.hoverz{border:1px dashed green;</style>}");
      jetpack.notifications.show( "Select Element!" );
      $(jetpack.tabs.focused.contentDocument).find("body").bind('mouseover', hoverzz).bind('click', clickz).bind('mouseout', unhoverz);
    }
    else $(jetpack.tabs.focused.contentDocument).find("body").unbind('mouseover', hoverzz).unbind('click', clickz).unbind('mouseout', unhoverz);
    });
  }
});