/**
 * 导航菜单
 *
*/
function menuFix() {
  var sfEls = document.getElementById("nav").getElementsByTagName("li");
  for(var i=0;i<sfEls.length;i++) {
		var ulss=sfEls[i].getElementsByTagName("ul");	
	}
  for (var i=0; i<sfEls.length; i++) {
    sfEls[i].onmouseover=function() {
			var _self = this;
      setTimeout(function(){_self.className+=(_self.className.length>0? " ": "") + "show";}, 10);
    }
    sfEls[i].onmouseout=function() {
			var _self = this;
			setTimeout(function(){_self.className=_self.className.replace(new RegExp("( ?|^)show\\b"), "");}, 10);      
			//$(this).find('ul').slideUp();
    }
  }
}
window.onload=menuFix;


$(function(){
    $('#key').keypress( function(e) {
      var c = e.keyCode;
      if(c == 13) {
        $('#btnForKey').trigger('click');
      }
    } );
    $('#btnForKey').click(function() {
        var key = $('#key').val();
        if(! key) {
            $('#key').focus();
            return;
        } else {
            location = _BASE_URI + _LOCALE + '/parts/search/key/' + encodeURI(key);
        }
    });
    //alert($('#sidenav>li>ul>li.selected').parents('li').size());
    $('#sidenav>li>ul>li.selected').parents('li:first').addClass("show");
	$('#sidenav>li>ul').each(function(i){
		$(this).prev('a').toggle(function() {
				$(this).parent().addClass("show")
			}, function() {
				$(this).parent().removeClass("show")
			});
	});
})





/**/
function MenuToggle(e)
{
   aTags = new Array('ul','div');
   oTargetArray = new Array();
   oParent = e.parentNode ;
     for(i = 0 ; i < aTags.length; i++) 
	 {
	    oTargetArray.push(oParent.getElementsByTagName(aTags[i]));
	}
   
   for (i = 0 ; i < oTargetArray.length;i++)
   {
     oTarget = oTargetArray[i];
     // alert(oTarget[0].tagName);
    if(typeof oTarget[0] != 'undefined')
   {
   
  if(oTarget[0].style.display != 'block'  ){
   oTarget[0].style.display = 'block';
   oTarget[0].parentNode.className = "hadChild list";}
   else{
   oTarget[0].style.display = 'none';
   oTarget[0].parentNode.className = "hadChild";
   return false;}
   }
}  
return true;
}






function ShowDiv(ObjID) {
	for(var i=1;i<10;i++) {
		if(document.getElementById("title_"+i)) {
			document.getElementById("title_"+i).className=(ObjID==i)?"cur":"";
			document.getElementById("divshow_"+i).style.display=(ObjID==i)?"block":"none";
		} else return;
	}
}

$(function(){
  $('.click_1').toggle(function() {
    $('.table1').show();
      }, function() {
    $('.table1').hide();
      }).focus(function() {
        if(this.blur)this.blur();
      });
});


function debug(o) {
  var name = '__debug_message_container__';
  var s = '';
  if(typeof o == 'object') {
    for(a in o) {
      s += a + ': ' + o[a] + '<br />';
    }
  } else {
    s += o.toString();
  }
  if(document.getElementById(name)) {
    var obj = document.getElementById(name);
  } else {
    var obj = document.createElement('div');
    obj.id = name;
    obj.style.backgroundColor = '#FFFFFF';
    obj.style.border = 'solid 2px #F00';
    obj.style.margin = '1em';
    obj.style.padding = '.5em';
    obj.style.fontSize = '1.2em';
    obj.style.lineHeight = '160%';
    document.body.appendChild(obj);
  }
  obj.innerHTML = s;
}

String.prototype.trim = function() { return this.replace(/(^\s*)|(\s*$)/g,""); }