1 // Set expiration date for cookies
3 date.setTime(date.getTime()+(365*24*60*60*1000));
4 var expiration = date.toGMTString();
7 function hideColumns(){
8 valCookie = YAHOO.util.Cookie.get("showColumns", function(stringValue){
9 return stringValue.split("/");
12 $("#showall").attr("checked","").parent().removeClass("selected");
13 for( i=0; i<valCookie.length; i++ ){
14 if(valCookie[i] != ''){
15 index = valCookie[i] - 2;
16 $("#itemst td:nth-child("+valCookie[i]+"),#itemst th:nth-child("+valCookie[i]+")").toggle();
17 $("#checkheader"+index).attr("checked","").parent().removeClass("selected");
23 function hideColumn(num) {
24 $("#hideall,#showall").attr("checked","").parent().removeClass("selected");
25 valCookie = YAHOO.util.Cookie.get("showColumns", function(stringValue){
26 return stringValue.split("/");
28 // set the index of the table column to hide
29 $("#"+num).parent().removeClass("selected");
30 var hide = Number(num.replace("checkheader","")) + 2;
31 // hide header and cells matching the index
32 $("#itemst td:nth-child("+hide+"),#itemst th:nth-child("+hide+")").toggle();
33 // set or modify cookie with the hidden column's index
36 for( $i=0; $i<valCookie.length; $i++ ){
37 if (hide == valCookie[i]) {
44 var cookieString = valCookie.join("/");
45 YAHOO.util.Cookie.set("showColumns", cookieString, {
50 YAHOO.util.Cookie.set("showColumns", hide, {
56 // Array Remove - By John Resig (MIT Licensed)
57 // http://ejohn.org/blog/javascript-array-remove/
58 Array.prototype.remove = function(from, to) {
59 var rest = this.slice((to || from) + 1 || this.length);
60 this.length = from < 0 ? this.length + from : from;
61 return this.push.apply(this, rest);
64 function showColumn(num){
65 $("#hideall").attr("checked","").parent().removeClass("selected");
66 $("#"+num).parent().addClass("selected");
67 valCookie = YAHOO.util.Cookie.get("showColumns", function(stringValue){
68 return stringValue.split("/");
70 // set the index of the table column to hide
71 show = Number(num.replace("checkheader","")) + 2;
72 // hide header and cells matching the index
73 $("#itemst td:nth-child("+show+"),#itemst th:nth-child("+show+")").toggle();
74 // set or modify cookie with the hidden column's index
77 for( i=0; i<valCookie.length; i++ ){
78 if (show == valCookie[i]) {
84 var cookieString = valCookie.join("/");
85 YAHOO.util.Cookie.set("showColumns", cookieString, {
91 function showAllColumns(){
92 $("#selections").checkCheckboxes();
93 $("#selections span").addClass("selected");
94 $("#itemst td:nth-child(2),#itemst tr th:nth-child(2)").nextAll().show();
95 YAHOO.util.Cookie.remove("showColumns");
96 $("#hideall").attr("checked","").parent().removeClass("selected");
98 function hideAllColumns(){
99 $("#selections").unCheckCheckboxes();
100 $("#selections span").removeClass("selected");
101 $("#itemst td:nth-child(2),#itemst th:nth-child(2)").nextAll().hide();
102 $("#hideall").attr("checked","checked").parent().addClass("selected");
103 var cookieString = allColumns.join("/");
104 YAHOO.util.Cookie.set("showColumns", cookieString, {
109 $(document).ready(function() {
111 $("#itemst").tablesorter({
113 headers: {0:{sorter: false}}
115 $("#selectallbutton").click(function(){
116 $("#itemst").checkCheckboxes();
119 $("#clearallbutton").click(function(){
120 $("#itemst").unCheckCheckboxes();
123 $("#selections input").change(function(e){
124 var num = $(this).attr("id");
125 if(num == 'showall'){
128 } else if(num == 'hideall'){
132 if($(this).attr("checked")){