        var markerHTML = "|";
        var minWidth = 100;
        var classeLeft = null;
        var classeRight = null;
        var startingX = 0;
        var currentX = 0;
        var stylesheet=0;

        function installTable() {
        	//alert("installTable");
        	document.body.onmouseup = columnMouseUp;
            document.body.onmousemove = columnMouseMove;           
        }
        function hasClass (obj, className) {
        	if (typeof obj == 'undefined' || obj==null || !RegExp) { return false; }
        	var re = new RegExp("(^|\\s)" + className + "(\\s|$)");
        	if (typeof(obj)=="string") {
        		return re.test(obj);
        		}
        	else if (typeof(obj)=="object" && obj.className) {
        		return re.test(obj.className);
        		}
        	return false;
        }
        function getWidth(classe) {
            
                newWidth = parseInt(classe.style.width);
                //alert("classe "+classe+" style "+classe.style+" "+newWidth);
                if (isNaN (newWidth)) {
                    newWidth = 100;
                }
            
            return newWidth;
        }
        function findClass(nom,col){
        	//alert("findClass "+nom+" "+col);
        	for(var k=0;k<document.styleSheets.length;k++){
        		var stylesheet=document.styleSheets[k];
        		var rule=findClassInStyleSheet(nom,stylesheet);
        		//alert("findClass result rule "+rule);
        		if(rule!=null){
        			/*if(rule.style.width==null){
        				rule.style.width=col.currentStyle.width+"px"
        				alert("findClass return rule width null"+rule);
        			}*/
        			return rule;
        		}
        	}
 
	        	//alert("addClass "+col);
	        	//alert("findClass current style "+col.width+" offset "+col.nodeName+" "+col.offsetWidth);
	       /* 	if(stylesheet.insertRule!=null) //FF W3C
	        		stylesheet.insertRule(nom+" {width:"+col.offsetWidth+"px !important;  maxWidth:  "+col.offsetWidth+"px !important; overflow: hidden; background-color:yellow;  }",rules.length);
	        	else //IE
	        		
	        		stylesheet.addRule(nom,"width:"+col.offsetWidth+"px !important; maxWidth: "+(col.offsetWidth-100)+"px !important;  overflow: hidden; background-color:yellow;");
	        	//alert("init "+rules[rules.length-1].style.width+"    offset "+col.offsetWidth);
	        	var rules=null;
	        	if(stylesheet.cssRules!=null)
	        		rules=stylesheet.cssRules;
	        	else
	        		rules=stylesheet.rules;
	        	return rules[rules.length-1];*/

        	
        }
        function findClassInStyleSheet(nom,stylesheet){
        	//alert("findClassInStyleSheet "+nom+" "+stylesheet+" "+stylesheet.href);
        	var rules=null;
        	if(stylesheet.cssRules!=null)
        		rules=stylesheet.cssRules;
        	else
        		rules=stylesheet.rules;
        	//alert("findClassInStyleSheet rules "+nom+" "+rules+" "+rules.length);
        	for(var i=0;i<rules.length;i++){
        		
        		if(rules[i].type==rules[i].IMPORT_RULE && rules[i].styleSheet!=null){
        		//	alert("sheet "+stylesheet.href+" rules "+i+" "+rules[i].type+" "+rules[i].selectorText);	
        			var rule=findClassInStyleSheet(nom,rules[i].styleSheet);
        			//alert("result rule "+rule);
        			if(rule!=null)
        				return rule;
        		}
        		else if(rules[i].type==rules[i].STYLE_RULE && rules[i].selectorText.toUpperCase()==nom.toUpperCase()){        			        			
        			//alert("foundClass "+rules[i].selectorText);
        			return rules[i];
        		}
        	}
        	return null;
        }
        function columnMouseDown(col,event,left,right,offsetX,offsetY) {
        	//alert("mouseDown "+col);
            if (!event) {
                event = window.event;
            }
            document.onselectstart=new Function("return false");
         document.body.onmouseup = columnMouseUp;
          document.body.onmousemove = columnMouseMove;           
           
            
            startingX = event.clientX;
            currentX = startingX;
            //alert("col "+col+" parent "+col.parentNode);
            dragingColumn=col;
            classeLeft = findClass(left,col.parentNode);
          //  next=findNextNode(col);
            classeRight= findClass(right,col);
           // alert("mouseDown "+startingX+" "+currentX+" "+dragingColumn);
            //alert("classeLeft "+classeLeft+" "+classeRight+" "+classeRight);
            return true;
        }
        function findNextNode(col) {
        	next=col.parentNode.parentNode.nextSibling;     
            for(;next!=null;next=next.nextSibling){
            	//alert("next "+next.nodeName.toUpperCase());
            	if(next.nodeName.toUpperCase()=="TH")
            		break;
            }
            for (k = 0; k < next.childNodes.length; k++) {
            	if(next.childNodes[k].nodeName.toUpperCase()=="DIV")
            		return next.childNodes[k];
            }
        	return null;
        }
        function columnMouseUp () {
        	//alert("mouseUP "+classeLeft)
            if (classeLeft != null) {
               // dragingColumn.parentNode.style.width = getNewWidth ();
            	document.onselectstart=null;
                classeLeft = null;
	            document.onselectstart=null;	
            }
           document.body.onmouseup  = null;
           document.body.onmousemove = null;     
			return true;
        }

        function columnMouseMove(event) {
        	//alert("mouseMove");
            if (!event) {
                event = window.event;
            }
            if (classeLeft != null) {
			    currentX = event.clientX;
		    
                newLeftWidth=getWidth(classeLeft);
                newLeftWidth += currentX - startingX;
               // alert(" classeLeft "+classeLeft+" style "+classeLeft.style+" "+newWidth);            
                newRightWidth=getWidth(classeRight);
                newRightWidth +=startingX - currentX;
                if(newRightWidth<minWidth){
                	newLeftWidth-=(minWidth-newRightWidth);
                	newRightWidth=minWidth;
                }
                if(newLeftWidth<minWidth){
                	newRightWidth-=(minWidth-newLeftWidth);
                	newLeftWidth=minWidth;
                }

                if(classeLeft.style.setProperty!=null){ //Firefox
	                classeLeft.style.setProperty("width",newLeftWidth+"px","important");
	                classeLeft.style.setProperty("max-width",newLeftWidth+"px","important");;
	                classeRight.style.setProperty("width",newRightWidth+"px","important");
	                classeRight.style.setProperty("max-width",newRightWidth+"px","important");
                }
                else //IE
                {
              	 classeLeft.style.width=newLeftWidth+"px";
                	 classeLeft.style.maxWidth=newLeftWidth+"px";
                	// classeRight.style.backgroundColor="blue";
                	 classeRight.style.width=newRightWidth+"px";
                	 classeRight.style.maxWidth=newRightWidth+"px";
                	 
                }
                	
                
             //  dragingColumn.parentNode.innerHTML=startingX +" "+ currentX +" "+newLeftWidth +" "+newRightWidth;
                //dragingColumn.parentNode.style.width=newidth+"px";
                //dragingColumn.parentNode.style.maxWidth=newidth+"px";
                startingX = currentX;
			} 
			
			return true;
        }


