
function rgbtohex(str) {
   str = str.replace(/rgb\(|\)/g, "").split(",");
   str[0] = parseInt(str[0], 10).toString(16).toLowerCase();
   str[1] = parseInt(str[1], 10).toString(16).toLowerCase();
   str[2] = parseInt(str[2], 10).toString(16).toLowerCase();
   str[0] = (str[0].length == 1) ? '0' + str[0] : str[0];
   str[1] = (str[1].length == 1) ? '0' + str[1] : str[1];
   str[2] = (str[2].length == 1) ? '0' + str[2] : str[2];
   return ('#' + str.join(""));
}

function getcolor(em) {
var k = getstyle(em,"background-color");
if (!document.all) {k=rgbtohex(k);}

return k;
}

var isload=false;
function loadjs(){
    if (isload==false) {  
    loadnote();  
   
    var fl ="script/colorfx.js"	
    
    var rf=c('script')
    rf.setAttribute("language","javascript")
    rf.setAttribute("type","text/javascript")
    rf.setAttribute("src", fl)
        if (typeof rf!="undefined") {	       
           $$$("head")[0].appendChild(rf);    	
	    } 	   
	   isload=true;
	   
    }
}

function loadnote() {
var oB=c("div");
oB.id = "ldg";
oB.className="lgng";
var tT = document.createTextNode("loading...");
oB.appendChild(tT);
oB.style.display = "block";
$("hdd").appendChild(oB);				
}

function c(tag) {
return document.createElement(tag);
}

function fontunit(e) {
e = (e) ? e : ((window.event) ? window.event : "");
var o = getTargetElement(e); 
var unew = o.innerHTML;
x4.newunit=o.innerHTML;
x4.convertunit();

o.parentNode.parentNode.getElementsByTagName("span")[0].innerHTML = o.innerHTML;

}

function  fullscreen(evt) {
 evt = (evt) ? evt : ((window.event) ? window.event : "");
 var elem = getTargetElement(evt);
 
 if (evt.type=='click') {
 if (elem.parentNode.id=="up") {
 $("www").style.display = "none";
 var em = $("tabco2");
 em.style.left ="10px";
 em.style.top="-50px";
 $("ttt").removeChild($("tabco2"));
 document.body.appendChild(em);
 setunit(ut);
 $("tabco2").className = "tabco2p";
 $("tabco2").style.filter='alpha(opacity=85)'; // IE
 $("tabco2").style.opacity='0.85'; // FF
 $("down").style.display = "block";
  
 }
 else {
 $("www").style.display = "block";
 var em = $("tabco2");
 em.style.left ="20px";
 em.style.top="0px";
 document.body.removeChild($("tabco2"));
 $("ttt").appendChild(em);
 setunit(ut);
 $("tabco2").className = "tabco2r";
  $("tabco2").style.filter='alpha(opacity=100)'; // IE
 $("tabco2").style.opacity='1'; // FF
 $("up").style.display = "block";
 }
 
 elem.parentNode.style.display = "none";
 }
}


function setunit(u) {
if (u=="px") {
$("px").checked=true;
}
else if (u=="em") {
$("em").checked=true;
}
else if (u="%") {
$("%").checked=true;
}
}

function getfontSizeRadio() {
var u,v;
u= x4.unit;
v = x4.values.mid;
var obj = document.getElementsByTagName("body")[0];
vfont = v+u;
obj.style.fontSize = vfont;
var r = (u=="px") ? v/16 : (u=="%") ? v/100 : v;
return r;
}

function  getborder(obj) {
var w,c,s;
if (obj.currentStyle) {
w = obj.currentStyle.borderWidth;
c = obj.currentStyle.borderColor;
s = obj.currentStyle.borderStyle;
}
else
{
w = getComputedStyle(obj,'').getPropertyValue('border-left-width');
c = getComputedStyle(obj,'').getPropertyValue('border-left-color');
s = getComputedStyle(obj,'').getPropertyValue('border-left-style');
var bd = getComputedStyle(obj,'').getPropertyValue('border');
}

//alert("c = "+ c+"\n"+"w = " +w +"\n"+"s = " +s+"\n"+"border = "+bd);
return c + " " + w + " " + s;
}


function getstyle(elem, prop) {
		if(document.defaultView)
		{
			return document.defaultView.getComputedStyle(elem, null).getPropertyValue(prop);
		}
		else if(elem.currentStyle)
		{
			var prop = prop.replace(/-(\w)/gi, function($0,$1)
			{
				//return $0.charAt($0.length - 1).toUpperCase();
				return $1.toUpperCase();
			});
			return elem.currentStyle[prop];
		}
		else return null;
	}

function getbodymarginLeft() {
var obj = document.getElementsByTagName("body")[0];
var str = getstyle(obj,'margin-left');
return str;
}



function move(e){
e = (e) ? e : ((window.event) ? window.event : "");
if (d.className=='tabco2p') {
	d.style.left = dx + e.clientX - x  + "px";
	d.style.top  = dy + e.clientY - y  + "px";
	
}
	 
  return false; 
}

function down(e){
e = (e) ? e : ((window.event) ? window.event : "");
var temp = getTargetElement(e); 


if (temp.parentNode.className=="tabco2p") {
dragpoint = temp.parentNode;
d = dragpoint;
//d.style.cursor ="pointer";
dx = parseFloat(dragpoint.style.left+0);
dy = parseFloat(dragpoint.style.top+0);
x = e.clientX;
y = e.clientY; 

document.onmousemove = move;


}

else if (temp.parentNode.className=="ctx") {
dragpoint = temp.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode;
d = dragpoint;
dx = parseFloat(dragpoint.style.left+0);
dy = parseFloat(dragpoint.style.top+0);
x = e.clientX;
y = e.clientY; 
document.onmousemove = move;

}

else
d = null;

}

function up(){

document.onmousemove = null;
d=null;

dragpoint = null;

}

   
function $() {
	var elements = new Array();
	for (var i = 0; i < arguments.length; i++) {
		var element = arguments[i];
		if (typeof element == 'string')
			element = document.getElementById(element);
		if (arguments.length == 1)
			return element;
		elements.push(element);
	}
	return elements;
}


function $$$(tag) {return document.getElementsByTagName(tag);}

function unitconversion2(va, uf, ut) {

var wem = getstartValues("em",1);
var wpx = getstartValues("px",1);
if (uf=="em") {
return (ut=="em") ? va : (ut=="%") ? parseInt(va*100) : parseInt(va*16);
} else if (uf=="px") {
return (ut=="em") ? formatDecimals(va/16,2) : (ut=="px") ? va : parseInt(va/16*100);
} else if (uf=="%") {
return (ut=="%") ? va : (ut=="px") ? parseInt(va*16/100) : formatDecimals(va/100,2);
}

}


function getstartValues(u,g) {

if (u=="em") {
return (g==1) ? ww/16 : (g==2) ? 1.2 : (g==3) ? 0.5 : 1;
}
else if (u=="px") {
return (g==1) ? ww : (g==2) ? 20 : (g==3) ? 8 : 16;
}
else if (u=="%") {
return (g==1) ? 100 : (g==2) ? 2 : (g==3) ? 50 : 100;
}

}

function unitconversion(va, uf, ut) {

var wem = getstartValues("em",1);
var wpx = getstartValues("px",1);
if (uf=="em") {
return (ut=="em") ? va : (ut=="%") ? Math.ceil(va/wem*100) : parseInt(va*16);
} else if (uf=="px") {
return (ut=="em") ? formatDecimals(va/16,2) : (ut=="px") ? va : Math.ceil(va/wpx*100);
} else if (uf=="%") {
return (ut=="%") ? va : (ut=="px") ? parseInt(va*wpx/100) : formatDecimals(va*wem/100,2);
}

}


function movetabs() {
      
    this.b = function() {
    var d,dragpoint;
    var y,x,dy,dx;
 
    document.onmousedown = down;
	document.onmouseup = up;
    }
    
    
}

String.prototype.expandExponential = function() {return this.replace(/^([+-])?(\d+).?(\d*)[eE]([-+]?\d+)$/,function(x, s, n, f, c){var l = +c < 0, i = n.length + +c, x = (l ? n : f).length,c = ((c = Math.abs(c)) >= x ? c - x + l : 0),z = (new Array(c + 1)).join("0"), r = n + f;return  (l ? r = z + r : r += z).substr(0, i += l ? z.length : 0) + (i < r.length ? "." + r.substr(i) : "");});};
function formatDecimals(num,digits){if(digits<=0){return Math.round(num);}var tenToPower=Math.pow(10,digits);var cropped=String(Math.round(num*tenToPower)/tenToPower);cropped=String(cropped).expandExponential();if(cropped.indexOf(".")==-1){cropped+=".0";}var halves=cropped.split(".");var zerosNeeded=digits-halves[1].length;for(var i=1;i<=zerosNeeded;i++){cropped+="0";}return(cropped);}

function getTargetElement(evt) {
   return (evt.target) ? ((evt.target.nodeType == 3) ? evt.target.parentNode : evt.target) : evt.srcElement;
}


function tabEvent(evt) {
    evt = (evt) ? evt : ((window.event) ? window.event : "");
    if (evt) {
    var elem = getTargetElement(evt);
    var actContainer = (elem.tagName=='A') ? elem.parentNode.parentNode.parentNode.id : elem.parentNode.parentNode.id; 
    var tp = gettab(actContainer).position;
    var hvelem = (elem.tagName=='A') ? elem.parentNode : elem;
    var lielem =  (elem.tagName=='A') ? elem.parentNode.parentNode.getElementsByTagName('li') : elem.parentNode.getElementsByTagName('li');
   
    if ((evt.type == "mouseover") || (evt.type == "click")) {
     actIndex = getIndex(lielem,hvelem);
    if (actIndex==undefined) return;
    
    var uu=$$($$($(actContainer),('div'))[actIndex],('ul')).length;    
    
    if (tp!="p") {
     showContent(actContainer,actIndex);
    }
    else if (uu>0) {
    actoutindex =actIndex;
    showContent(actContainer,actIndex);    
     actnoli =false;
    } else if(uu==0) {
     actnoli =true;
     showContent(actContainer, gettab(actContainer).activetab1);}
    }
    if (evt.type=="mouseout") {    	
	       showContent(actContainer, gettab(actContainer).activetab1);
			if (actIndex!= gettab(actContainer).activetab1)  {   	 
    		var ee = $$($(actContainer),('div'));			    
			ee[actIndex].onmouseout = outEvent; 
			ee[actIndex].onmouseover = outEvent;}
	        
	    }	
	}
}

function outEvent(evt) {
evt = (evt) ? evt : ((window.event) ? window.event : "");
var elem = getTargetElement(evt);
var actContainer = (elem.tagName=='A') ? elem.parentNode.parentNode.parentNode.parentNode.id : elem.parentNode.id; 
var tp = gettab(actContainer).position;
    if (actoutindex==undefined) actoutindex = gettab(actContainer).activetab1;

    if ((evt.type == "mouseover") || (evt.type=="click")) {
        if ((actoutindex!= gettab(actContainer).activetab1) && (actnoli==false)) {
            showContent(actContainer,actoutindex)
        }
        else
            showContent(actContainer, gettab(actContainer).activetab1);
    }
    if (evt.type=="mouseout") {
        showContent(actContainer, gettab(actContainer).activetab1);       
    }
}


function getIndex(arry,elem) {
	for (var i=0; i < arry.length; i++) {
		if (arry[i] == elem) {
		return i;
		}
	}
}
 
function showContent(container,act) {
	
	var contDiv = new Array;
	var j =0;
	var tp = gettab(container).position;
	
	var contDiv0 = $$($(container),('div'));
	for(var i=0; i<contDiv0.length; i++){
		if (contDiv0[i].parentNode.id==container) {
			contDiv[j] = contDiv0[i];
			j = j+1;
		}	
	}
	
	if (document.all) { 		
	    contDiv[act].className = (tp=="r") ? "contentfloat" : (tp=="p") ? "contentmenu" : "content";	    
	} 	
	else {
	   
		if ((tp == "t")|| (tp=="r")||(tp=="l") ) {
			contDiv[act].className="contentfloat";		
		}
		
		else if (tp == "b"){
			contDiv[act].className="content";
		}	
		else contDiv[act].className="contentmenufloat";
	}	
	
	var vborder = getborder(contDiv[act]);
	var vbkcolor = getstyle(contDiv[act],'background-color');
		
	var tagul = getUL(container,tp);

	var tagula = $$(tagul,('a'));
	
	var tagulli = $$(tagul,('li'));
	for(var i=0; i<tagula.length; i++){
	    tagula[i].className="ula";
	}

	if (tp=="r") {
	
		for(var i=0; i<tagulli.length; i++){
	        tagulli[i].className="ulli";
	    }		
		tagul.className="ulfloat";
	} 
		
	if ((tp=="b")||(tp=="t") || (tp=="p")) {
	
		for(var i=0; i<tagulli.length; i++){
	        tagulli[i].className="ullifloat";
	    }	
	    
	        
	    tagul.className= (tp=="p") ? "ulnofloat" : "ulnofloatbt";
		
	}
		
	if (tp =="l") {
		
		for(var i=0; i<tagulli.length; i++){
		        tagulli[i].className="ulli";
		}		
		tagul.className = (document.all) ? "ulfloatie" : "ulfloat";
		if (ie6()) tagul.style.right = "-3px";
	}
	
	contDiv[act].style.display = "block";
	
	for(var i=0; i<contDiv.length; i++){	
		if (i != act) {
		contDiv[i].style.display = "none";
		}
	}
	
	if (tp == "p") {
	
		var contDivt = $$($(container),('div'));
		var in1 = gettab(container).activetab1;
		var in2 = gettab(container).activetab2;
		divullu2 =$$(contDivt[in1],'ul')[0];
		
		//set 2nd level active tab color
		$$(divullu2,'a')[in2].style.color = "green";
		
		for(var i=0; i<contDivt.length; i++){
			
			if ($$(contDivt[i],('ul')).length>0) {
				$$(contDivt[i],'ul')[0].className = "divul";
				var divulli = $$($$(contDivt[i],'ul')[0],'li');
				for(var j=0; j<divulli.length; j++){				
					divulli[j].className = "divulli";
					$$(divulli[j],('a'))[0].className = "divullia";											
				}					
			}		
		}
	}
	
	var actitem = tagulli[act];
	var actitema = $$(actitem,('a'))[0];
	if ((tp == "t") || (tp == "p")) {
			actitema.style.top ="1px";
			actitem.style.borderTop = vborder;	
				
		}
		else if (tp == "b") {
			actitema.style.top ="-1px";
			actitem.style.borderBottom = vborder;
	    }
	    else if (tp == "r") {
			actitema.style.left ="-1px";
	        actitem.style.borderRight = vborder;
	    }
	    else if (tp == "l") {			
			actitema.style.left ="1px";
			actitem.style.borderLeft = vborder;	    
	    }
	    	
	actitema.style.backgroundColor =vbkcolor;	
	var marginLeft_li = getstyle(actitem,'margin-left');	
	var marginBottom_li = getstyle(actitem,'margin-bottom');	
	var vbkcolor2 = getstyle(actitem,'background-color');
	
	for(var i=0; i<tagulli.length; i++){
		
	if (marginLeft_li=="0px") {			
			if ((tp == "t") || (tp == "p") || (tp == "b")) { 
			tagulli[i].style.borderLeft = (i==0) ? vborder : "#fff 0px";
			}					
	}
	
	if ( marginBottom_li=="0px") {	
			if ((tp == "r") || (tp == "l")) {
			tagulli[i].style.borderTop = (i==0) ? vborder : "#fff 0px";
			}	
	}
	
	if (i != act) {
			var a = $$(tagulli[i],'a')[0];
			a.style.top ="0px";	
			a.style.left ="0px";
			a.style.backgroundColor ="#cfcfcf";
			
			if ((tp == "t") || (tp == "p")) {				
				tagulli[i].style.borderTop = vborder;
			}
			else if (tp == "b") {						
				tagulli[i].style.borderBottom = vborder;
			}
			else if (tp == "r") {				
	            tagulli[i].style.borderRight = vborder;
	        }
	        else if (tp == "l") {				
				tagulli[i].style.borderLeft = vborder;		        
	        }			
		}
	}	
}

function ie6() {
var appVer = navigator.appVersion.toLowerCase();
var iePos = appVer.indexOf('msie');
if (iePos !=-1) {
is_minor = parseFloat(appVer.substring(iePos+5,appVer.indexOf(';',iePos)))
is_major = parseInt(is_minor);
}

var is_ie = ((iePos!=-1));
var is_ie6 = (is_ie && is_major == 6);
return is_ie6;
}



function $$(e,tag) {return e.getElementsByTagName(tag);}


function getUL(id,ttp) {
 if ((ttp=="t") || (ttp=="l") ||(ttp=="p")) {
	var ul = $$($(id),('ul'))[0];
	}
	else {
	var n = $$($(id),('ul')).length;
	var ul = $$($(id),('ul'))[n-1];

	}
return ul;
}


function bindEvent(container, e) {

var tp = gettab(container).position;
var ele = $$(getUL(container,tp),'li');
   for(var i=0; i<ele.length; i++){ 
		if (e=="click") { ele[i].onclick = tabEvent;}
		if (e=="mouseover") { ele[i].onmouseover = tabEvent;} 		
		if (tp=="p") ele[i].onmouseout = tabEvent;    
   }	
}

function Bindtabs(id,activetab1,eventType,position,activetab2) {
	
	this.id = id;
	this.activetab1 = activetab1;
	this.eventType = eventType;
	this.position = position;
	this.activetab2 = activetab2;
	this.c = function () {
	var actoutindex;
	var actnoli = false; 
	var fromli = false;
	
	showContent(this.id,this.activetab1,this.position);
	bindEvent(this.id,this.eventType);
	
	}
}

function gettab(id) {
return (id=="tabco2") ? t2 : (id=="tabco3") ? t3 : (id=="tabco4") ? t4 : t5;
}

function socialbkmk() {
var u = location.href;
var t = document.title;
location.href = 'http://www.pagecolumn.com/social_bookmark2.htm?pgcoluu='+u+'&pgcoltt='+t;
}
 
 Function.prototype.bind = function(obj) {
    var _method = this;
    return function() {
        return _method.apply(obj, arguments);
    };    
} 

function slider() {
this.style = {
 backgroundColor:"#828282"
,height:"4px"
,width:"300px"
,borderBottom:"#cfcfcf 1px solid"
,borderRight:"#cfcfcf 1px solid"
};
this.pointer = {
top: "0px"
,width:"14px"
,height:"14px"
,backgroundColor:"#008c00"
,isarrow: "up"
};
this.values = {
min:0
,mid:50
,max:100
,fontSize:"14px"
}
};

slider.prototype = { 

	init : function(settings) {
		
		for(var i in settings){
		    if (typeof(this[i])=="undefined") {
		        this[i] = settings[i];
		    }
		    else
		    for(var j in settings[i]){
    		     //if (typeof(this[i][j])=="undefined")
    		            this[i][j]=settings[i][j]; 
    		               		    
		     }				
		}
						
		this.createslider();
		this._event_docMouseMove = this._docMouseMove.bind(this);		
		this._event_docMouseUp = this._docMouseUp.bind(this);		
		this.point.onmousedown = this._mouseDown.bind(this);
		this.slider_bar.onclick = this._sliderClick.bind(this);
				 
	},
	//unitconversion(va, uf, ut)
	convertunit: function() {
	var uf = this.unit;
	var ut = this.newunit;
	this.unit = this.newunit;
	
	if (this.id == "font") {
	
	this.values.min = unitconversion2(this.values.min,uf,ut);
	this.values.mid = unitconversion2(this.values.mid,uf,ut);
	this.values.max = unitconversion2(this.values.max,uf,ut);
	}else{
	
	this.values.min = unitconversion(this.values.min,uf,ut);
	this.values.mid = unitconversion(this.values.mid,uf,ut);
	this.values.max = unitconversion(this.values.max,uf,ut);
	
	}
	
	this.nodemin.innerHTML = this.values.min+this.unit;
	this.nodemid.innerHTML = this.values.mid+this.unit;
	this.nodemax.innerHTML = this.values.max+this.unit;
	
	},
	
	createslider:function(){
		var $ = document.getElementById(this.id)
		$.appendChild(this.valuebox());
				
		this.slider_bar = this.sliderbar();		
		this.colorbar =  this.setcolorbar();		
		if (this.pointer.isarrow ==null) {
		this.point = this.setpoint();}
		else{
		this.point = this.arrows();
		}	
			
		this.slider_bar.appendChild(this.colorbar);
		this.slider_bar.appendChild(this.point);
		var div = document.createElement('div');
		div.style.clear="both";
		$.appendChild(div);
		$.appendChild(this.slider_bar);
		
		if (this.hassteparrows) {
		var divfloat = (document.all)  ? "styleFloat" : "cssFloat";
		this.slider_bar.style[divfloat] ="left";
		var step = this.steparrows();
		$.appendChild(step);
		
		this.addEvent(this.leftarrow,"mouseover",this.hightlight.bind(this));
        this.addEvent(this.leftarrow,"mouseout",this.hightlight.bind(this));
		this.addEvent(this.rightarrow,"mouseover",this.hightlight.bind(this));
        this.addEvent(this.rightarrow,"mouseout",this.hightlight.bind(this));
        if (document.all) {        
        if (this.fire) { 
		this.addEvent(this.leftarrow,"click",this.fire);
		this.addEvent(this.rightarrow,"click",this.fire);
		}
        this.addEvent(this.leftarrow,"click",this.setArrowClick.bind(this));
		this.addEvent(this.rightarrow,"click",this.setArrowClick.bind(this));
		}
		else{
		this.addEvent(this.leftarrow,"click",this.setArrowClick.bind(this));
		this.addEvent(this.rightarrow,"click",this.setArrowClick.bind(this));
		if (this.fire) { 
		this.addEvent(this.leftarrow,"click",this.fire);
		this.addEvent(this.rightarrow,"click",this.fire);
		}
		}
		
		}
	   
	},
	
	steparrows:function () {
	var div = this.divleft();
	div.style.marginLeft="15px";
	div.style.marginTop ="-5px";
	div.style.width = "50px";
	var divl = this.divleft();
	divl.style.width = "20px";	
	divl.style.marginRight = "5px";
	this.leftarrow = this.arrowleftright(18,18,"left","#cfcfcf");
	
	divl.appendChild(this.leftarrow);
	
	divr = this.divleft();
	divr.style.width = "25px";
	this.rightarrow = this.arrowleftright(18,18,"right","#cfcfcf")
	divr.appendChild(this.rightarrow);
	
	div.appendChild(divl);
	div.appendChild(divr);
	 
	return div;	
	},
	
	hightlight: function (e) {
    e = (e) ? e : ((window.event) ? window.event : "");
    var o = getTargetElement(e);

    var v = (o ==this.leftarrow)||(o==this.rightarrow) ? o : o.parentNode;
    var d = v.childNodes;
    if (e.type == "mouseover") {
        for (var i=0;i<d.length;i++) {
        d[i].style.backgroundColor = "#858585";
        }
    }
    else if (e.type == "mouseout") {
        for (var i=0;i<d.length;i++) {
        d[i].style.backgroundColor = "#cfcfcf";
        }
    }
     
    } ,
	divleft: function() {
	var div = document.createElement('div');
	var divfloat = (document.all)  ? "styleFloat" : "cssFloat";
	div.style[divfloat] ="left";
	
	return div;
	},
	
	valuebox:function () {
		var div = document.createElement('div');
		div.style.width = this.style.width;		
		div.style.fontSize =  this.values.fontSize;
		var min = div.cloneNode(false);
		this.nodemin = min;
		var divfloat = (document.all)  ? "styleFloat" : "cssFloat";
		min.style[divfloat] ="left";
		
		var mid = min.cloneNode(false);
		this.nodemid = mid;
		var max = document.createElement('div');
		max.style[divfloat]="right";
		this.nodemax = max;		
		min.innerHTML = this.values.min+this.unit;
		mid.innerHTML = this.values.mid+this.unit;
		max.innerHTML = this.values.max+this.unit;
		min.style.width = 2/5*parseInt(this.style.width)+"px";
		mid.style.width = 2/5*parseInt(this.style.width)+"px";
		
		div.appendChild(min);
		div.appendChild(mid);
		div.appendChild(max);
		return div;
	},
	
	sliderbar: function () {
		var div = document.createElement('div');		
		div.style.position = "relative";
		div.style.backgroundColor = this.style.backgroundColor;
		div.style.height = this.style.height;
		div.style.width = this.style.width;
		div.style.fintSize = "1px";		
		div.style.borderBottom = this.style.borderBottom;
		div.style.borderRight = this.style.borderRight;
		
		return div;
	},
	 
    arrowleftright:function (w,h,up,bkcl) {
    var par = document.createElement('div');
    par.style.width = w+"px";
    t0 = this.divnode();
    var l = parseInt(h/2);
    for (var i=l-1;i>0;i--) {
	    t = t0.cloneNode(false);   	
        t.style.backgroundColor = bkcl;
            	
	    if (up=="right") {
	        t.style.marginLeft = 0+"px";
	        t.style.marginRight =w/l*i+"px";}
    	
	    else{
	        t.style.marginRight = 0+"px";
	        t.style.marginLeft =w/l*i+"px";
	    }
	    par.appendChild(t);
	}
	
	for (var i=1;i<l+1;i++) {
	    t = t0.cloneNode(false);
        t.style.backgroundColor = bkcl;
    
	    if (up=="right") {
	        t.style.marginLeft = 0+"px";
	        t.style.marginRight =w/l*i+"px";}
    	
	    else{
	        t.style.marginRight = 0+"px";
	        t.style.marginLeft =w/l*i+"px";
	    }
	    par.appendChild(t);

	}
    return par;
},
    
    arrows: function () {
        var w =parseInt(this.pointer.width),h=parseInt(this.pointer.height);
        var par = this.setpoint();        
        par.style.backgroundColor = "transparent";
        par.style.top = parseInt(this.style.height)+"px";
        t0 = this.divnode();
        t0.style.backgroundColor =this.pointer.backgroundColor;
        par.appendChild(t0);
        for (var i=1;i<h;i++) {
            t = t0.cloneNode(false);
            t.style.backgroundColor = this.pointer.backgroundColor;
            t.style.marginLeft = 1/2*w/h*i+"px";
            t.style.marginRight = 1/2*w/h*i+"px";
            par.appendChild(t);

        }
        return this.reverseNodes(par);      

},

    divnode: function () {
        var o=document.createElement("div");
        o.style.height = "1px";
        o.style.overflow="hidden";
        return o;
    },

    reverseNodes: function (n) { 
       
        var kids = n.childNodes;
       
        var rekids = n.cloneNode(false);
        var numkids = kids.length;
        for(var i = numkids-1; i >= 0; i--) {       
         
            rekids.appendChild(kids[i]);
           
        }
     return rekids;
    },
	setcolorbar: function() {
	
		var div = document.createElement('div');	
		div.style.width= parseInt((this.values.mid-this.values.min)/(this.values.max-this.values.min)*parseInt(this.style.width)) + "px";
		div.style.backgroundColor = this.pointer.backgroundColor;
		div.style.height = this.style.height;
		div.style.overflow = "hidden";
		
		return div;
	},
	 setpoint: function() {
	 	
		var div = document.createElement('div');
		div.style.width = this.pointer.width;
		div.style.backgroundColor = this.pointer.backgroundColor;
		div.style.height = this.pointer.height;
		div.style.overflow = "hidden";		
		div.style.position = "absolute";		
		div.style.top = this.pointer.top;
		div.style.left= parseInt((this.values.mid-this.values.min)/(this.values.max-this.values.min)*parseInt(this.style.width)) - parseInt(this.pointer.width)/2  + "px";
		 return div;
	 },
	_sliderClick: function(e){
	e = (e) ? e : ((window.event) ? window.event : "");
	var o = getTargetElement(e);
	
	if (o!=this.point) {
	//alert(o.tagName)
	  this.setValuesClick(e);
	   if (this.fire)
		   this.addEvent(this.slider_bar, 'click', this.fire);
		   // this.addEvent(this.colorbar, 'click', this.fire);
		    
		    }
		    	
		this.noBubbleDefault();
	
	}, 
	_mouseDown: function(e) {
		
		if (document.all) {
		if (this.fire) 
		    this.addEvent(document, 'mousemove', this.fire);		
		this.addEvent(document, 'mousemove', this._event_docMouseMove);}
		else{
		this.addEvent(document, 'mousemove', this._event_docMouseMove);
		if (this.fire) 
		    this.addEvent(document, 'mousemove', this.fire);
		}
		
				
		this.addEvent(document, 'mouseup', this._event_docMouseUp);
		this.noBubbleDefault()
		
	},
	 _docMouseMove: function(e) {
		this.setValuesClick(e)	
		this.noBubbleDefault();
	   
},

_docMouseUp: function(e) {

this.removeEvent(document, 'mouseup', this._event_docMouseUp);
this.removeEvent(document, 'mousemove', this._event_docMouseMove);
if (this.fire) {
  this.removeEvent(document, 'mousemove', this.fire);}
this.noBubbleDefault();

},
setValuesClick: function(e){ 
	var x = e.clientX+document.documentElement.scrollLeft;	
	var offsetX = this.getPosition(this.slider_bar)[0];	
	//var x_x = x - offsetX - parseInt(this.pointer.width)/2
	var x_x = x - offsetX
    this.setPosition(x_x);	
 	
},

setArrowClick: function(e){

    e = (e) ? e : ((window.event) ? window.event : "");
	var o = getTargetElement(e);
	var step = (o==this.rightarrow)||(o.parentNode ==this.rightarrow) ? 1 : -1;
	var mid = this.values.mid + step; 
	if (mid>this.values.max) {
	mid = this.values.max;	
	}else if (mid<this.values.min) {
	mid = this.values.min;
	}
	
    var x_x = parseInt((mid - this.values.min)*parseInt(this.style.width)/(this.values.max - this.values.min));
    this.colorbar.style.width= x_x + "px"; 
    this.point.style.left = x_x - parseInt(this.pointer.width)/2 +"px";
    this.values.mid = mid;
    this.nodemid.innerHTML = mid+this.unit;
    
},

setPosition: function(x) {
    if (x>parseInt(this.style.width)) {
	 x = parseInt(this.style.width); 
    }	
	else if (x<0) {x = 0;this.point.style.left = x + "px";
	} 
				
	this.colorbar.style.width= x + "px"; 
 	this.point.style.left = x - parseInt(this.pointer.width)/2 +"px";
 	
 	var grossmid =  x/parseInt(this.style.width)*(this.values.max - this.values.min) + parseFloat(this.values.min);
 	
 	if ((this.unit=="em") &&(this.id=="font")) {
 	this.values.mid = formatDecimals(( x/parseInt(this.style.width)*(this.values.max - this.values.min) + this.values.min),2);
 	
 	}
 	else if (this.id=="gap") {
 	if (this.unit=="em") {
 	
 	this.values.mid = formatDecimals(grossmid,2);
 	}
 	else if (this.unit=="%") {
 	 this.values.mid = formatDecimals(( x/parseInt(this.style.width)*(this.values.max - this.values.min) + this.values.min),1);
 	}
 	else
 	this.values.mid = parseInt(grossmid);
 	 
 	}
 	
 	else
 	this.values.mid = parseInt( x/parseInt(this.style.width)*(this.values.max - this.values.min) + this.values.min)
 	
 	this.nodemid.innerHTML = this.values.mid+this.unit;
},

noBubbleDefault:function (e)
{
	if (e && e.stopPropagation) {
		e.stopPropagation();
		e.preventDefault();
		}
	else
		window.event.cancelBubble = true;	
        window.event.returnValue = false; // IE	
},

addEvent: function ( obj, type, fn ) {
  if ( obj.attachEvent ) {
    obj["e"+type+fn] = fn;
    obj[type+fn] = function() { obj["e"+type+fn]( window.event ); }
    obj.attachEvent( "on"+type, obj[type+fn] );
  } else
    obj.addEventListener( type, fn, false );
},
	
removeEvent : function( obj, type, fn ) {
      if ( obj.detachEvent ) {
        obj.detachEvent( "on"+type, obj[type+fn] );
		    obj[type+fn] = null;
      } else
        obj.removeEventListener( type, fn, false );
},


getPosition: function(el) {   
    var curLeft = 0,curTop = 0, s = this.getScrolls(el);   
  
    if (el.offsetParent) {   
        do {   
            curLeft += el.offsetLeft;          
            curTop += el.offsetTop;   
        } while (el = el.offsetParent);         
        return [ (curLeft - s[0]), (curTop - s[1]) ];   
    }   
},
 
getScrolls: function(el) {  
    var curX = 0, curY = 0;   
    do {   
        curX += el.scrollLeft;   
        curY += el.scrollTop;   
        if (el.nodeName == 'BODY')   
            break;   
    } while (el = el.parentNode);   
    return [curX, curY];   
}

}
