function openWin(url, target, width, height, scrollbars) {
  var r = window.open(url, target == null ? "_blank" : target, "width=" + (width == null ? 564 : width) + ", height=" + (height == null ? 528 : height)+ ", scrollbars=" + (scrollbars == null ? scrollbars : "yes") + ", toolbar=no, location=no, directories=no, status=no, menubar=no, resizable=no");
  r.focus();
}


function doQueryWa(str){
  var waUrl = "http://header.bosch.com.cn/web/site/wa_boschcomcn.jsp?lan=zh_CN";
  //location.href = waUrl + getFormQS("waForm");
  openWin(waUrl + '&searchKey=' + str, 'wa');
}
function doQueryWaE(str){
  var waUrl = "http://header.bosch.com.cn/web/site/wa_boschcomcn.jsp?lan=en";
  //location.href = waUrl + getFormQS("waForm");
  openWin(waUrl + '&searchKey=' + str, 'wa');
}
function addLoadEvent(func) {
  var oldonload = window.onload;
  if ( typeof window.onload != 'function'){
	window.onload = func;
  } else {
	window.onload = function() {
	  oldonload();
	  func();
	}
  }
}

function switchPart(i){
  if (document.getElementById("product_detail_1")!=null) {
	for(var j=1;j<5;j++){
	  if(j==i){
		if (document.getElementById("product_detail_"+j)!=null){
		document.getElementById("product_detail_"+j).style.display="";
		}
	  }else{
		if (document.getElementById("product_detail_"+j)!=null){
		document.getElementById("product_detail_"+j).style.display="none";
		}
	  }
	}
  }
}

function setTables() {
	var tables = document.getElementsByTagName("table");
	for (var i=0; i<tables.length; i++){
		var table = tables.item(i);
		if (table.className == "tb") {			
			var trs = table.getElementsByTagName("tr");
			setTrs(trs);
		}
	}	
}
function setTrs(trs){
	var odd = true
	for (var i=0; i<trs.length; i++){
		var tr = trs.item(i);
		setTr(tr,odd);
		if (odd == true) {
			odd = false;
		} else {
			odd = true;
		}
	}		
}
function setTr(tr,odd){
	var ths = tr.getElementsByTagName("th");
	var tds = tr.getElementsByTagName("td");
	if(odd!=true){
		for (var i=0; i<ths.length; i++){
			var th = ths.item(i);
			th.style.backgroundColor = "#ddd"			
		}
		for (var i=0; i<tds.length; i++){
			var td = tds.item(i);
			td.style.backgroundColor = "#ddd"			
		}		
	}
}