function togglePanel() {
  var panel = document.getElementById('panelMore');
  var panelControl = document.getElementById('morePanel');
  var panelBtn = panelControl.getElementsByTagName('a')[0];
  panelBtn.blur();

  if (panel.style.display == '' || panel.style.display == 'none') {
          panel.style.display = 'block';
          panelBtn.style.backgroundImage = 'url(/images/arrow_up_gray.gif)';
          panelBtn.firstChild.data = 'Òþ²Ø';
  } else {
          panel.style.display = 'none';
          panelBtn.style.backgroundImage = 'url(/images/arrow_down_gray.gif)';
          panelBtn.firstChild.data = '¸ü¶à';
  }
}
function initPanel() {
  document.getElementById('morePanel').getElementsByTagName('a')[0].onclick = togglePanel;
}

function dropMenu(btn, menu) {
	btn.className = 'active';
}
function hideMenu(btn, menu) {
	btn.className = '';
}

function showMenu(obj){
  if(obj.style.display!="block"){
    obj.style.display="block"
  }
}
function hiddenMenu(obj){
  if(obj.style.display!="none"){
    obj.style.display="none"
  }
}

function setAttributeById(ctlid, attrname, attrvalue) {
  if(document.getElementById(ctlid).setAttribute) {
    document.getElementById(ctlid).setAttribute(attrname, attrvalue)
  }
}

function set_attribute(ctl, attrname, attrvalue) {
  if(ctl.setAttribute) {
    ctl.setAttribute(attrname, attrvalue)
  }
}

function setClassNameById(ctlid, param_512_value) {
  if(document.getElementById(ctlid)) {
    document.getElementById(ctlid).className=param_512_value
  }
}

function getClassNameById(ctlid) {
  return document.getElementById(ctlid).className
}

function getValueById(ctlid) {
  return document.getElementById(ctlid).value
}

function limitImageW(param_objImg,param_355_width) {
  if(param_objImg.width) {
    if(param_objImg.width>param_355_width) {
      param_objImg.width = param_355_width
    }
  }
}

function limitImageH(param_objImg,param_355_height) {
  if(param_objImg.height) {
    if(param_objImg.height>param_355_height) {
      param_objImg.height = param_355_height
    }
  }
}

function limitImage(param_objImg,param_355_length) {
  if(param_objImg.width&&param_objImg.height) {
    if(param_objImg.width>=param_objImg.height) {
      limitImageW(param_objImg,param_355_length);
    } else {
      limitImageH(param_objImg,param_355_length);
    }
  }
}

function limitImageWH(param_objImg,param_355_width,param_355_height) {
  limitImageW(param_objImg,param_355_width);
  limitImageH(param_objImg,param_355_height);
}

function setDisplayById(ctlid, param_512_dispaly) {
  if(document.getElementById(ctlid)) {
    document.getElementById(ctlid).style.display = param_512_dispaly
  }
}

function switchDisplayById(ctlid) {
  if(document.getElementById(ctlid).style.display=="none") {
    document.getElementById(ctlid).style.display="block"
  } else {
    document.getElementById(ctlid).style.display="none"
  }
}

function toggle(){
  for(var i=0;i<arguments.length;i++){
    var element=$(arguments[i])
    element.style.display=element.style.display=='none'?'block':'none'
  }
  return false
}

function remove_node(node){
  if(node.removeNode) {
    node.removeNode(true)
  } else{
    for(var i=node.childNodes.length-1;i>=0;i--) {
      remove_node(node.childNodes[i])
    }
    node.parentNode.removeChild(node)
  }
  return null;
}

function add_hidden_input(formo,name,value) {
  var hiddeno = create_hidden_input(name,value)
  formo.appendChild(hiddeno)
}

function create_hidden_input(name,value){
  var new_input=document.createElement('input')
  new_input.name=name
  new_input.id=name
  new_input.value=value
  new_input.type='hidden'
  return new_input
}

function setFocusById(ctlid) {
  document.getElementById(ctlid).focus()
}

function set_foucs(ctl) {
  ctl.focus()
}

function selectAllText(ctlid) {
  document.getElementById(ctlid).select()
}

function has_checked_by_name(param_aform, ctrlname) {
  for(var i=0;i<param_aform.elements.length;i++) {
    if(param_aform.elements[i].name==ctrlname) {
      if(param_aform.elements[i].checked==true) {
        return true;
      }
    }
  }

  return false;
}
