// JavaScript Document
/*
 CLEditor Advanced Table Plugin v1.0.0
 http://premiumsoftware.net/cleditor
 requires CLEditor v1.2.2 or later

 Copyright 2010, Sergio Drago
 Dual licensed under the MIT or GPL Version 2 licenses.

 Based on Chris Landowski's Table Plugin v1.0.2
*/
(function(c){c.cleditor.buttons.table={name:"table",image:"table.gif",title:"Insert Table",command:"inserthtml",popupName:"table",popupClass:"cleditorPrompt",popupContent:'<table cellpadding=0 cellspacing=0><tr><td style="padding-right:6px;">Cols:<br /><input type=text value=4 size=12 /></td><td style="padding-right:6px;">Rows:<br /><input type=text value=4 size=12 /></td></tr><tr><td style="padding-right:6px;">Cell Spacing:<br /><input type=text value=2 size=12 /></td><td style="padding-right:6px;">Cell Padding:<br /><input type=text value=2 size=12 /></td></tr><tr><td style="padding-right:6px;">Border:<br /><input type=text value=1 size=12 /></td><td style="padding-right:6px;">Style (CSS):<br /><input type=text size=12 /></td></tr></table><br /><input type=button value=Submit  />',
buttonClick:function(l,d){c(d.popup).children(":button").unbind("click").bind("click",function(){var j=d.editor,a=c(d.popup).find(":text"),e=parseInt(a[0].value),f=parseInt(a[1].value),g=parseInt(a[2].value),h=parseInt(a[3].value),i=parseInt(a[4].value),k=a[5].value;if(parseInt(e)<1||!parseInt(e))e=0;if(parseInt(f)<1||!parseInt(f))f=0;if(parseInt(g)<1||!parseInt(g))g=0;if(parseInt(h)<1||!parseInt(h))h=0;if(parseInt(i)<1||!parseInt(i))i=0;var b;if(e>0&&f>0){b="<table border="+i+" cellpadding="+h+" cellspacing="+
g+(k?' style="'+k+'"':"")+">";for(y=0;y<f;y++){b+="<tr>";for(x=0;x<e;x++)b+="<td>"+x+","+y+"</td>";b+="</tr>"}b+="</table><br />"}b&&j.execCommand(d.command,b,null,d.button);a[0].value="4";a[1].value="4";a[2].value="2";a[3].value="2";a[4].value="1";a[5].value="";j.hidePopups();j.focus()})}};c.cleditor.defaultOptions.controls=c.cleditor.defaultOptions.controls.replace("rule ","rule table ")})(jQuery);
