var c1=new Array();c1["a"]=document.createElement("TABLE");c1["b"]=document.createElement("TD");c1["c"]=document.createElement("TR");c1["d"]=document.createElement("TBODY");c1["e"]=document.createElement("THEAD");c1["f"]=document.createElement("TFOOT");c1["g"]=document.createElement("SPAN");c1["h"]=document.createElement("INPUT");c1["i"]=document.createElement("SELECT");c1["j"]=document.createElement("A");
function initSmartTables(){c2=SmartTables;for(var i=0;i<c2.length;i++){if(c2[i].p8){c2[i].f3();c2[i].f30();}}}
function SmartTable(p1,p2,p16,p17){this.p1=p1;this.p3=SmartTables.length;this.p2=p2;this.p5=false;this.p6=false;this.p15=false;this.p4=20;this.p7=0;this.p8=true;var a=new Array();this.p9=a;a=new Array();this.p10=a;a=new Array();this.p11=a;this.p12=false;a=new Array(p2.length);this.p13=a;a=new Array();this.p14=a;var x=this.p2.length;var i=x;do{y=x-i;this.p13[y]=".";this.p14[y]="a";}while(--i)this.p16=p16;if(p17==null)p17="smt";this.setStyle(p17);a=new Array();this.p18=a;this.p19=false;this.p20="";this.p21=0;this.p22="c";this.p23=0;this.p24="";this.p25="c";this.p26=false;this.p27=" | ";}
sp=SmartTable.prototype;sp.f1=f1;sp.f2=f2;sp.f3=f3;sp.f4=f4;sp.f5=f5;sp.f6=f6;sp.f7=f7;sp.f8=f8;sp.f12=f12;sp.f13=f13;sp.f14=f14;sp.f9=f9;sp.f15=f15;sp.f10=f10;sp.f16=f16;sp.f11=f11;sp.f17=f17;sp.f18=f18;sp.f19=f19;sp.f20=f20;sp.f21=f21;
function f3(){var a=this.f8();a.cellPadding=3;a.cellSpacing=0;a.className=this.p28;for(var i=0;i<this.p13.length;i++){if(this.p13[i]!="."){this.p12=true;break;}}if(this.p12){this.f22=f23;}else{this.f22=f22;}if(!this.p15&&!this.p5){this.f30=f19;}if(this.p5&&!this.p15){this.f30=f24;}if(this.p15&&this.p5){this.f30=f25;this.f26=f26;this.f24=f24;}if(this.p15&&!this.p5){this.f30=f27;}if(this.p15||this.p6){this.f28=f28;}else{this.f28=f29;}}
function f7(){var a=this.f8();for(var i =0;i<a.childNodes.length;i++){if(a.childNodes[i].tagName=="TBODY")return a.childNodes[i];}var tb=c1["d"].cloneNode(false);a.appendChild(tb);return tb;}
function f8(){var a=document.getElementById(this.p1);if(a==null){a=c1["a"].cloneNode(false);document.body.appendChild(a);a.id=this.p1;}return a;}
function f20(){return this.f8().tFoot;}
function f21(){return this.f8().tHead;}
function filterHelp(){alertStr="Include Search: \n Only display rows containing the entered value in the selected column\n\nExclude Search: \n Only display rows that do not contain the entered value in the selected column\n\nGo Back: \n Clears filter values and shows all rows again \n\n Important! Make sure you select something from 'In Column' to do your search \n";alert(alertStr);}
function f16(a){this.p24=this.f12();this.p23=this.f13();this.p25=a;if(this.p20==this.p24&&this.p21==this.p23&&this.p22==this.p25){return false;}else{return true;}}
function f1(a){if(this.f12()==""&&a!="c"){alert("no filter value entered");}else if(a=="c"&&this.p22!="c"){this.p26=true;this.p19=false;this.p24="";this.p23=0;this.f14("");this.f9(0);this.f30();this.p26=false;this.p20=this.p24;this.p21=this.p23;this.p22=this.p25=a;}else if(this.f16(a)){this.p19=true;this.p26=true;if(this.f18()){this.f30();this.p20=this.p24;this.p21=this.p23;this.p22=this.p25;}else{alert("No results with that filter");this.f14(this.p20);this.f9(this.p21);this.p24=this.p20;this.p23=this.p21;this.p25=this.p22;if(this.p18.length==0)this.p19=false;}this.p26=false;}}
function f14(x){var a=document.getElementById("table"+this.p3+"_filterText");a.value=x;}
function f9(x){var a=document.getElementById("table"+this.p3+"_filterSelect");a.options.selectedIndex=x;}
function f12(){var a=document.getElementById("table"+this.p3+"_filterText").value;a+="";return a;}
function f13(){var a=document.getElementById("table"+this.p3+"_filterSelect");return a.options[a.options.selectedIndex].value;}
function f10(v){var a=false;if(this.p25=="b"){a=v.indexOf(this.p24)==-1;}else if(this.p25=="a"){a=v.indexOf(this.p24)>-1;}return a}
function f18(){var a=new Array();var b=0;var c=this.p23;var d=this.p16.length;var e=parseInt(d/8);var f=d%8;var i=d-f-1;var p16=this.p16;if(f>0){do{g=i+f;if(this.f10(p16[g][c]+"")){a[b++]=g;}}while(--f)}do{if(this.f10(p16[i--][c]+"")){a[b++]=(i+1);}if(this.f10(p16[i--][c]+"")){a[b++]=(i+1);}if(this.f10(p16[i--][c]+"")){a[b++]=(i+1);}if(this.f10(p16[i--][c]+"")){a[b++]=(i+1);}if(this.f10(p16[i--][c]+"")){a[b++]=(i+1);}if(this.f10(p16[i--][c]+"")){a[b++]=(i+1);}if(this.f10(p16[i--][c]+"")){a[b++]=(i+1);}if(this.f10(p16[i--][c]+"")){a[b++]=(i+1);}}while(--e)if(a.length==0){return false;}else{a.reverse();this.p18=a;return true;}}
function f29(){var a=c1["e"].cloneNode(false);b=c1["c"].cloneNode(false);b.className=this.p31+"HeaderRow";var c=this.p2.length;var i=c;do{g=c-i;var h=c1["b"].cloneNode(false);h.innerHTML=this.p2[g];h.className=this.p10[g];h.noWrap=true;b.appendChild(h);}while(--i)a.appendChild(b);return a;}
function f28(){var a=c1["e"].cloneNode(false);if(this.p15){a.appendChild(this.f15());}var b=c1["c"].cloneNode(false);b.className=this.p31+"HeaderRow";var c=this.p2.length;var i=c;p2=this.p2;d=this.p10;do{var g=c-i;var h=c1["b"].cloneNode(false);h.className=d[g];h.noWrap=true;if(this.p6){var l=c1["j"].cloneNode(false);l.href="Javascript:c2["+this.p3+"].f5("+g+");";l.innerHTML=p2[g];l.className=d[g];h.appendChild(l);}else{h.innerHTML=this.p2[g];}b.appendChild(h);}while(--i)a.appendChild(b);return a;}
function f15(){var a=c1["c"].cloneNode(false);var b=c1["b"].cloneNode(false);b.className=this.p30;b.colSpan=this.p2.length;var d=c1["g"].cloneNode(false);d.innerHTML="Rows w/ Value";var c=c1["h"].cloneNode(false);c.type="text";c.id="table"+this.p3+"_filterText";c.size="10";c.value=this.p24;c.className=this.p30;var e=c1["g"].cloneNode(false);e.innerHTML="In Column";var f=c1["i"].cloneNode(false);f.id="table"+this.p3+"_filterSelect";f.className=this.p30;var g=this.p2.length;var i=g;do{j=g-i;f.options[j]=new Option(this.p2[j],j);if(j==this.p23)f.options[j].selected=true;}while(--i)var k=c1["j"].cloneNode(false);k.className=this.p30;k.innerHTML="Exclude Search";k.href="javascript:c2["+this.p3+"].f1('b')";var l=c1["j"].cloneNode(false);l.className=this.p30;l.innerHTML="Include Search";l.href="javascript:c2["+this.p3+"].f1('a')";var m=c1["j"].cloneNode(false);m.className=this.p30;m.innerHTML="Go Back";m.href="javascript:c2["+this.p3+"].f1('c')";var n=c1["j"].cloneNode(false);n.innerHTML="help";n.style.textDecoration="none";n.style.fontSize=b.style.fontSize;n.href="javascript:filterHelp()";b.appendChild(d);b.appendChild(c);b.appendChild(e);b.appendChild(f);b.appendChild(k);b.appendChild(l);b.appendChild(m);b.appendChild(n);a.appendChild(b);return a;}
function f2(a,b){if(!b){var l=c1["j"].cloneNode(false);l.className=this.p32+"footerRow";l.href="javascript:c2["+this.p3+"].f30("+a+");";return l;}else{return c1["g"].cloneNode(false);}}
function f4(a){if(a==null||a==""||a<0||a>this.f7().rows.length){a=this.p9["a"]!=null?this.p9["a"]:0;}var b=this.p4;var c=this.p19?this.p18.length:this.p16.length;var d=false;var e=false;f=this.f8().tFoot;if(!this.p5&&f!=null){return false;}if(this.p5&&c>b){e=true;if(this.p26){d=true;e=false;}if(f==null||f.rows.length==1){d=true;e=false;}}else if(this.p5&&f!=null&&f.rows.length==2){f.removeChild(f.rows[1]);}if(f==null){f=c1["f"].cloneNode(false);var r=c1["c"].cloneNode(false);var t=c1["b"].cloneNode(false);t.innerHTML="";t.colSpan=this.p2.length;t.className=this.p32+"footerRow";r.appendChild(t);f.appendChild(r);this.f8().appendChild(f);}if(!this.p5){return false;}var g=c%b;var h=c-g;var j=h/b;k=a==h?j:a/b;if(d){r=c1["c"].cloneNode(false);var l=new Array();var i=j;do{index=j-i;m=(index*b==a);l[index]=this.f2(index*b,m);}while(--i)if(g>0){m=a==h;l[l.length]=this.f2(h,m);}var n=c1["g"].cloneNode(false);n.innerHTML=this.p27;t=c1["b"].cloneNode(false);t.className=this.p32+"FooterRow";t.colSpan=this.p2.length;var length=l.length;var i=length;var tempSpan=document.createElement("SPAN");do{index=length-i;l[index].id=this.p29+"PageLink_"+this.p3+"_"+index;l[index].innerHTML=index+1;t.appendChild(l[index]);if(index<length-1)t.appendChild(n.cloneNode(true));}while(--i)r.appendChild(t);if(f.childNodes[1]==null){f.appendChild(r);}else{f.replaceChild(r,f.childNodes[1])}}if(e){var o=this.p29+"PageLink_"+this.p3+"_"+this.p7;var p=document.getElementById(o);var q=this.f2(this.p7*this.p4,false);q.innerHTML=this.p7+1;q.id=o;p.parentNode.replaceChild(q,p);var o=this.p29+"PageLink_"+this.p3+"_"+k;var v=document.getElementById(o);q=this.f2(k*this.p4,true);q.innerHTML=k+1;q.id=o;v.parentNode.replaceChild(q,v);}this.p7=k;}
function f5(a){this.f6(a,0,this.p16.length-1);for(var f=0;f<this.p14.length;f++){if(f!=a)this.p14[f]="a";}if(this.p14[a]=="a"){this.p14[a]="b";}else{this.p14[a]="a";this.p16.reverse();}if(this.p19){this.f18();}this.f30();}
function f6(a,b,c){var v=this.p16;var p,l,h,t;if(c-b==1){if(v[b][a]>v[c][a]){t=v[b];v[b]=v[c];v[c]=t;}return;}p=v[parseInt((b+c)/ 2)];v[parseInt((b+c)/ 2)]=v[b];v[b]=p;l=b+1;h=c;do{while(l<=h&&v[l][a]<=p[a]){l++;}while(v[h][a]>p[a]){h--;}if(l<h){t=v[l];v[l]=v[h];v[h]=t;}}while(l<h)v[b]=v[h];v[h]=p;if(b<h-1){this.f6(a,b,h-1);}if(h+1<c){this.f6(a,h+1,c);}}
function f11(){var a=this.f8();if(a.tHead==null){a.createTHead();a.replaceChild(this.f28(),a.tHead);}var b=this.f7();a.replaceChild(this.p37,b);b.className=this.p36;this.f4(this.p9["a"]);a.tHead.className=this.p28;a.tFoot.className=this.p28;}
function f25(a){if(!this.p19){this.f24(a);}else{this.f26(a);}}
function f24(a){this.p9["a"]=a;if(a==null||a<0||a=="")a=0;var b=this.p16.length-a<this.p4? this.p16.length-a:this.p4;this.p37=c1["d"].cloneNode(false);var c=a;var d=0;do{var e=this.f17(c,d);this.p37.appendChild(e);d++;c++;}while(d<b)this.f11();}
function f26(a){if(a==null||a<0||a=="")a=0;this.p9["a"]=a;var b=this.p18.length-a<this.p4?this.p18.length-a:this.p4;this.p37=c1["d"].cloneNode(false);var c=a;var d=0;do{var e=this.f17(this.p18[c],d);this.p37.appendChild(e);d++;c++;}while(d<b)this.f11();}
function f27(){this.p37=c1["d"].cloneNode(false);if(this.p19){var a=this.p18.length;var b=a%8;var c=(a-b)/8;var d=0;if(c>0){do{this.p37.appendChild(this.f17(this.p18[d],d++));this.p37.appendChild(this.f17(this.p18[d],d++));this.p37.appendChild(this.f17(this.p18[d],d++));this.p37.appendChild(this.f17(this.p18[d],d++));this.p37.appendChild(this.f17(this.p18[d],d++));this.p37.appendChild(this.f17(this.p18[d],d++));this.p37.appendChild(this.f17(this.p18[d],d++));this.p37.appendChild(this.f17(this.p18[d],d++));}while(--c)}if(b>0){d=a-b;do{this.p37.appendChild(this.f17(this.p18[d],d++));}while(--b)}this.f11();}else{this.f19();}}
function f19(){this.p37=c1["d"].cloneNode(false);var a=this.p16.length;var b=a%8;var c=(a-b)/8;var i=a-b-1;var p16=this.p16;var d=0;if(c>0){do{this.p37.appendChild(this.f17(d,d++));this.p37.appendChild(this.f17(d,d++));this.p37.appendChild(this.f17(d,d++));this.p37.appendChild(this.f17(d,d++));this.p37.appendChild(this.f17(d,d++));this.p37.appendChild(this.f17(d,d++));this.p37.appendChild(this.f17(d,d++));this.p37.appendChild(this.f17(d,d++));}while(--c)}if(b>0){d=a-b;do{this.p37.appendChild(this.f17(d,d++));}while(--b)}this.f11();}
function f17(a,c){var r=c1["c"].cloneNode(false);r.name="smartRow"+a;var s=c%2==0?"RowEven":"RowOdd";r.className=this.p34+s;var l=this.p2.length;var i=l;do{var t=this.f22(a,l-i,s);r.appendChild(t);}while(--i)return r;}
function f23(rowNum,a,style){var currentRow=this.p16[rowNum];var colNum=a;var theCell=c1["b"].cloneNode(false);theCell.align="left";theCell.noWrap=true;theCell.className=this.p11[a]+style;if(this.p13[a]!="."){eval(this.p13[a]);}else{theCell.innerHTML=this.p16[rowNum][a];}return theCell;}
function f22(a,b,c){var d=c1["b"].cloneNode(false);d.align="left";d.noWrap=true;d.className=this.p11[b]+c;var e=c1["g"].cloneNode(false);e.innerHTML=this.p16[a][b];d.appendChild(e);return d;}

/**
**********************************************************
THE PUBLIC API
These functions are for setting and modifying options 
**********************************************************
*/

/**
function setStyle()
@param s:  the string that is the root value of the styles to apply to this table.  See readme.txt
*/
	function setStyle(s){
		this.setHeaderStyle(s);
		this.setHeaderLinkStyle(s);
		this.setRowStyle(s);
		this.setDataRowLinkStyle(s + "RowLink");
		this.setFooterRowStyle(s);
		this.setFilterStyle(s + "Filter");
		for(var i=0;i<this.p2.length;i++){
			this.p10[i] = s + "HeaderRow";
		}
		for(var i=0;i<this.p2.length;i++){
    		this.p11[i] = s;
		}
        this.setTableStyle(s + "Table");
        this.setTableBodyStyle(s + "Table");
        this.p29 = s;
	}

/*************
*  the following methods take the FULL name of the style rule, not just the root, as is done with setStyle
*************/
	function setFilterStyle(s){
			this.p30 = s;
	}
	function setHeaderStyle(s){
		this.p31 = s;
	}
	function setFooterRowStyle(s){
				 this.p32 = s;
	}
	function setHeaderLinkStyle(s){
		this.p33 = s;
	}
	function setDataRowLinkStyle(s){
		this.p35 = s;
	}
	function setTableStyle(s){
		this.p28 = s;
	}
    function setTableBodyStyle(s){
         this.p36 = s;
    }

/*
function setRowStyle(s)
Each row will alternate with root + "RowOdd" and root + "RowEven";
Each datacell in each row will also have these styles applied.
*/
	function setRowStyle(s){
		this.p34 = s;
	}

	function setColumnHeaderStyle(a,b){
		var i = this.p2.length;;
		if(typeof(a) == "string"){
			do{
				if(this.p2[i] == a) this.p10[i] = b;
			}
			while(--i);
		}
		else if (typeof(a) == "number"){
			this.p10[a] = b;
		}
	}

	function setDataCellStyle(a,b){
		var i = this.p2.length;
		if(typeof(a) == "string"){
			do{
				if(this.p2[i] == a) this.p11[i] = b;
			}
			while(--i);
		}
		else if (typeof(a) == "number"){
			this.p11[a] = b;
		}
	}

/*
function setRenderer
@param colNumber
@param renderingString

colNumber is the column that will use the renderer
renderer is a string that will be evaluated with "eval()" method at the time it is generated.
The renderer contract is that it will always expect  a DOM element of type TD as one of its parameters.
See the default renderers for a good example.
*/
function setRenderer(colNumber,renderingString){
	this.p13[colNumber] = renderingString;
}

/*
function removeRenderer
@param colNumber
Resets a custom renderer back to the default of simply showing the string value data in the table cell. 
*/
function removeRenderer(colNumber){
	this.p13[colNumber] = ".";
}

/*
function setFiltering()
@param b:  boolean true or false
Turns filtering on or off
*/
function setFiltering(b){
	this.p15 = b;
}

/*
function setSort()
@param b:  boolean true or false
Turns sorting on or off
*/
function setSort(b){
	this.p6 = b;
}

/*
function setPaginate()
@param b:  boolean true or false
Turns paginating on or off
*/
function setPaginate(b){
	this.p5 = b;
}

/*
function setPaginateRows()
@param number  
resets the number of rows to display per page if pagination is turned on.  The Default is 20.
*/
function setPaginateRows(number){
	this.p4 = number;
}

/*
function getRow
@param id: the index of the row
returns a reference to a given row in the table's array of rows data
*/

function getRow(rowId){
	return this.p16[rowId];
}

/*
function addRow
@param row:  an array of strings should be same length as the standard rows array for this table.
*/    
function addRow(rowArray){
	this.p16[this.p16.length] = rowArray;
}

/*
function remake()
A shortcut method of reconfiguring and then re-making a table, usually only used if you 
are modifying exiting table options on the fly based on user actions
*/
function remake(){
	this.f3();
	this.f30();
}

/*
function setRowData
@param array
resets the row data on an existing table. Be careful when using this method 
because you may break your table if you try to do something before reconfiguring
*/
function setRowData(rowsArray){
	this.p16 = rowsArray;
}

/*
function setColumnNames
@param array
resets the column names on an existing table
be careful when using this method because you may break your table 
if you try to do something before reconfiguring
DO NOT replace the column names with an array that is longer than the current one,
unless you have already set up the rowData array to handle more columns.
*/
function setColumnNames(columnNamesArray){
	this.p2 = columnNamesArray;
}

/*
function setTableId
@param id
resets the HTML Table id on an existing table.  Be careful when using this method 
because you may break your table if you try to do something before reconfiguring
*/

function setTableId(HTMLTableId){
	this.p1 = HTMLTableId;
}

/*
function setActive()
function setInactive()

Sets the table to active or inactive.  
The default state on creationg is active, so this only needs to be called on an inactive table.

Inactive tables are not generated by the initSmartTables function.  This lets you create smart tables
that aren't generated at first, you can generate them later based on user actions.
*/
function setActive(){
	this.p8 = true;
}
function setInactive(){
	this.p8 = false;
}
sp.setRenderer = setRenderer;
sp.removeRenderer = removeRenderer;
sp.setStyle = setStyle;
sp.setHeaderStyle = setHeaderStyle;
sp.setHeaderLinkStyle = setHeaderLinkStyle;
sp.setTableStyle = setTableStyle;
sp.setRowStyle = setRowStyle;
sp.setDataRowLinkStyle = setDataRowLinkStyle;
sp.setColumnHeaderStyle = setColumnHeaderStyle;
sp.setFooterRowStyle = setFooterRowStyle;
sp.setDataCellStyle = setDataCellStyle;
sp.setFilterStyle = setFilterStyle;
sp.setTableBodyStyle = setTableBodyStyle;
sp.setSort = setSort;
sp.setFiltering = setFiltering;
sp.setPaginate = setPaginate;
sp.setPaginateRows = setPaginateRows;
sp.getRow = getRow;
sp.addRow = addRow;
sp.remake = remake;
sp.setRowData = setRowData;
sp.setColumnNames = setColumnNames;
sp.setTableId = setTableId;
sp.setActive = setActive;
sp.setInactive = setInactive;