function changeImg(el,size){
  if ((typeof el != "undefined") && (typeof el != "null")){
    var a,i,b,str = '';
    if (el.src){
      b = el.src.split("/");
      if (b.length>0){
        for (i=0;i<b.length-1;i++){
            str += b[i]+"/";
        }
      }
      el.src = str+"sel_"+b[b.length-1];
    }
    setBar(size);
  }
}

function backImg(el){
  var a,i,b,str = '';
  if ((typeof el != "undefined") && (typeof el != "null")){
    if (el.src){
      b = el.src.split("/");
      if (b.length>0){
        for (i=0;i<b.length-1;i++){
            str += b[i]+"/";
        }
      }
      b[b.length-1] = b[b.length-1].replace(/sel_/,'');
      el.src = str+b[b.length-1];
    }
  }
}

function setSel(){
  var a,b;
  if (a = document.getElementById("sel_cat")){
    if (b = a.getAttribute("left_width")){
      setBar(b);
    }
  }
}

function setBar(size){
  size = parseInt(size);
  if (!isNaN(size)){
     if (a = document.getElementById("bar_left"))
        a.style.width = size+"px";
     if (a = document.getElementById("bar_right"))
        a.style.width = parseInt(900-size)+"px";
     if (a = document.getElementById("b_bar_left"))
        a.style.width = size+"px";
     if (a = document.getElementById("b_bar_right"))
        a.style.width = parseInt(900-size)+"px";
  }
}

function limitText(limitField, limitCount, limitNum) {
	if (limitField.value.length > limitNum) {
		limitField.value = limitField.value.substring(0, limitNum);
	} else {
		limitCount.value = limitNum - limitField.value.length;
	}
}
