/*
Developer Formater
http://wordpress.org/extend/plugins/devformatter/
Developer Formatter system to WordPress. Powered by <a href="http://qbnz.com/highlighter/">GeSHi</a> server-side highlight system.
Version: 2009.0.1.21
Author: Gilberto Saraiva
Author URI: http://gsaraiva.projects.pro.br/

Copyright (c) 2009 Gilberto Saraiva
Released under the GNU General Public License (GPL)
http://www.gnu.org/licenses/gpl.txt
*/
devfmt_credits = function(){
  window.open('http://wordpress.org/extend/plugins/devformatter/');
}

devfmt_getCode = function(ABase, AIdent){
  code = "";
  jQuery(ABase).parent().parent().parent().parent().find("pre." + AIdent + "").each(function(){
    code += this[((document.all)? "innerText" : "textContent")] + "\n";
  });
  return code;
}

devfmt_createTools = function(AIdent){
  jQuery("." + AIdent + "block table.devcodetools").each(function(){
    jQuery(this).find("td:eq(0)")
      .css("cursor", "pointer")
      .attr("title", "Show Plain " + jQuery(this).attr("title") + " Code")
      .click(function(){
        devfmt_showPlainText(devfmt_getCode(this, AIdent));
      });
  });
}

devfmt_showPlainText = function(ACode){
  with(window.open("about:blank", "_blank", "location=0,resizable=1,menubar=0,scrollbars=0,top=0,left=0,width=600,height=350")){
    document.write("<body style=\"padding:0;margin:0;\"><textarea style=\"width:100%;height:100%\" wrap=\"off\">" + ACode + "</textarea></body>");
    document.close();
  }
}

/*
  ZeroClipboard Flash 10 clipboard wrapper
  Simple Set Clipboard System
  Author: Joseph Huckaby
*/
ZeroClipboard = {
	dispatch: function(id, eventName, args){
    if(eventName == 'load'){
      EmbedObj = jQuery("embed#ZeroClipboard" + id)[0];
      jQuery(EmbedObj).attr("title", "Double-click to copy");
      EmbedObj.setText(devfmt_getCode(jQuery(EmbedObj).parent()[0], "devcode"));
    }
	}
}
