window.onload = function(e) {
  if(!e) {
    //window.attachEvent('onresize',minWidth);
	//minWidth();
  }
  removeOdds(document.documentElement);//      
  if(document.getElementById('vak')){
    detect_ul();
  }
}
function minWidth() {
  var body = document.getElementsByTagName('body')[0];
  var html = document.documentElement;
  if(html.clientWidth<990) {
    body.style.width = '990';
  }
  else {
    body.style.width = 'auto';
  }
}



/*    :    ,     */
function findOdds(node, arr) {
  var space = /^[^\u0021-\uffff]*$/g;
  if(node.nodeType == 3) {
    if(node.nodeValue.match(space)) {
      arr.push(node);
    }
  }
  else if(node.nodeType == 1) {
    for(var n = node.firstChild; n; n = n.nextSibling) {
      findOdds(n, arr);
    }
  }
}
/*
     removeOdds(node)     node    (      )
*/
function removeOdds(node) {
  var odds = new Array();
  findOdds(node, odds);
  for(var i = 0; i < odds.length; i++) {
    odds[i].parentNode.removeChild(odds[i]);
  }
}

function detect_ul(){
  var ul = document.getElementById('vak');
  var ul_array = ul.childNodes; 
  for (var i=0; i<ul_array.length; i++){
    ul_array[i].onclick = show_hide;
  }
}
 
function show_hide(){
  var ul = document.getElementById('vak');
  var ul_array = ul.childNodes;
  for (var i=0; i<ul_array.length; i++){
    ul_array[i].lastChild.className = 'display_none';
  }
  if(this.lastChild.className == 'display_none'){
    this.lastChild.className = 'display_blcok';
  }
  else{
    this.lastChild.className = 'display_none';
  }
}

function all_vak(){
  var ul = document.getElementById('vak');
  var ul_array = ul.childNodes;
  for (var i=0; i<ul_array.length; i++){
    ul_array[i].lastChild.className = 'display_block';
  }
}
