/* This compressed file is part of Xinha. For uncompressed sources, forum, and bug reports, go to xinha.org */
/* This file is part of version 0.96beta2 released Fri, 20 Mar 2009 11:01:14 +0100 */
function dragTableCols(h){this.table=document.getElementById(h);var b=this.table.rows[0].cells;this.ths=b;var a=this;var g;for(var d=0;d<this.table.rows.length;d++){for(var e=0;e<this.table.rows[d].cells.length;e++){g=this.table.rows[d].cells[e];g._i=e;dragTableCols.addEvent(g,"mousemove",function(c){a.cellMouseMove(c)});dragTableCols.addEvent(g,"mouseover",function(i){i=i?i:window.event;var c=i.target||i.srcElement;c._pos=dragTableCols.getElementTopLeft(c)})}}function f(){a.drag=false;a._col=null;document.body.style.cursor=""}dragTableCols.addEvent(document.body,"mousemove",function(c){a.bodyMouseMove(c)});dragTableCols.addEvent(document.body,"mouseup",f)}dragTableCols.prototype.cellMouseMove=function(d){d=d?d:window.event;var b=d.target||d.srcElement;if(typeof dragTableCols=="undefined"){return}if(!b._pos){b._pos=dragTableCols.getElementTopLeft(b);return}if(b.tagName.toLowerCase()!="td"&&b.tagName.toLowerCase()!="th"){return}var a=this;function c(g){g=g?g:window.event;a.drag=true;a.startX=b._pos.left+b.offsetWidth;a._col=b;var f=b.offsetWidth;a.startWidth=(b.width)?parseInt(b.width,10):b.offsetWidth;b.style.width=a.startWidth+"px";a.offset=b.offsetWidth-f;b.style.width=a.startWidth-a.offset+"px"}if(b._pos.left+b.offsetWidth-dragTableCols.getPageX(d)<5&&b!=b.parentNode.cells[b.parentNode.cells.length-1]){b.style.cursor="e-resize";dragTableCols.addEvent(b,"mousedown",c)}else{b.style.cursor="";dragTableCols.removeEvent(b,"mousedown",c)}};dragTableCols.prototype.bodyMouseMove=function(c){if(!this.drag){return true}c=c?c:window.event;var a=dragTableCols.getPageX(c);var d=a-this.startX;document.body.style.cursor=(d<0)?"e-resize":"w-resize";var b=this.startWidth+d-this.offset;this._col.style.width=((b>10)?b:10)+"px";return true};dragTableCols.addEvent=function(c,b,a){if(c.addEventListener){c.addEventListener(b,a,true)}else{if(c.attachEvent){c.attachEvent("on"+b,a)}else{return false}}};dragTableCols.removeEvent=function(c,b,a){if(c.addEventListener){c.removeEventListener(b,a,true)}else{if(c.detachEvent){c.detachEvent("on"+b,a)}else{return false}}};dragTableCols.getElementTopLeft=function(a){var c=0;var b=0;if(a.offsetParent){c=a.offsetLeft;b=a.offsetTop;while(a=a.offsetParent){c+=a.offsetLeft;b+=a.offsetTop}}return{top:b,left:c}};dragTableCols.getPageX=function(a){if(a.pageX){return a.pageX}else{if(document.documentElement&&document.documentElement.scrollTop){return document.documentElement.scrollLeft+a.clientX}else{if(document.body){return document.body.scrollLeft+a.clientX}}}};