//-------------for in=article page & in=upload page--------
	function showOpt(objThis, strID, strID2, boolS) {
	  var str1 = "&#9654;", str2 = "&#9664;";
	  if(boolS==true) { str1 = "&#9700;", str2 = "&#9699;"; };
    var opt = $id(strID).style;
    if(opt.display == "none") {
      opt.display = ""; objThis.innerHTML = str2;
      if(strID2) $id(strID2).style.display = "none";
    } else {
      opt.display = "none"; objThis.innerHTML = str1;
      if(strID2) $id(strID2).style.display = "";
    }
  }

  function setCurrentTime(strName) {
    var theDate = new Date();
    theDate = theDate.getFullYear() + "-" + (theDate.getMonth() + 1) + "-" + theDate.getDate() + " " + theDate.getHours() + ":" + theDate.getMinutes() + ":" + theDate.getSeconds();
    $name(strName)[0].value = theDate;
  }

  function selectAllCheckbox(objThis, strName) {
  	objThis = objThis.checked;
  	strName = $name(strName);
    for(var i=0; i<strName.length; i++) strName[i].checked = objThis;
  }
//-------------for in=category page--------------------
	function showCatChild(objThis, strName) {
		var objName;
		objThis = objThis.parentNode;
		for(var obj=objThis.nextSibling; obj!=null; obj=obj.nextSibling) {
			if(obj.nodeName.toLowerCase()!="tr") continue;
	 		objName = obj.getAttribute("name");
	 		if(strName=="all") {
  		  obj.style.display = "";
	 	  } else if(objName==strName) {
	 	  	obj.style.display = (obj.style.display=="none") ? "" : "none";
	    }
    }
  }
//-------------for in=template page------------------------
  function showSkinFileOption(strSelectName, strThisValue, objItem) {
    var opt = $name(strSelectName)[0];
    var arr = objItem[strThisValue];
    if(!opt || !arr) return;
    opt.length = 0;
    for(var i=0; i<arr.length; i++) opt.options[opt.length] = new Option(arr[i], arr[i]);
  }
//-------------for in=upload page------------------------
  function getSelectOptionText(obj) {
    this.arr = [];
    for(var i=0; i<obj.length; i++)  if(obj[i].selected) this.arr.push(obj[i].text);
    this.arr.splice(0, this.arr.length - 1);
    return this.arr[0] || "";
  }

  function showFileOnChange(strValue, strID, strURL) {
    var obj = $id(strID);
    if(!obj || !strValue) return;
    strURL = strURL ? (strURL + strValue.replace(/ \(\S+?\)/g, "")) : strValue;
    strValue = (strValue = strURL.split(/\./g))[strValue.length - 1];
    strValue = ubb.getFileTypeByName(strValue);
    obj.innerHTML = ubb.getObjStrByType(strValue, strURL, obj.clientWidth, obj.clientHeight);
  }

  function insertFileToUBB(objSelect, strName) {
    var obj = parent.$name(strName)[0];
    if(!obj || !objSelect) return;
    var oURL = [], opt, str, re = / \((\S+?)\)$/g;
    for(var i=0; i<objSelect.length; i++) {
      opt = objSelect.options[i];
      if(opt.selected) {
        opt = opt.text;
        if(opt.match(re)) {
          str = "[album=" + RegExp.$1.replace(/\*/g, ",").replace(/k/ig, "") + "][" + opt.replace(re, "") + "][\/album]";
        } else {
          str = opt.split(/\./g);
          str = ubb.getFileTypeByName(str[str.length - 1]);
          if(!str || str=="") str = "[file][" + opt + "][/file]";
            else if(str=="doc" || str=="zip" || str=="exe") str = "[file=" + str + "][" + opt + "][/file]";
            else if(str=="img") str = "[img][" + opt + "][/img]";
          else str = "[media][" + opt + "][/media]";        
        }
        oURL[oURL.length] = str;
      }
    }
    ubb.getFocus(obj);
    ubb.insert(oURL.join("\n"));
  }
//-------------------------------------