function $(id){return document.getElementById(id)?document.getElementById(id):null;}

function i(ur,w,h){
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+w+'" height="'+h+'"> ');
	document.write('<param name="movie" value="' + ur + '">');
	document.write('<param name="quality" value="high"> ');
	document.write('<param name="wmode" value="transparent"> '); 
	document.write('<param name="menu" value="false"> ');
	document.write('<embed src="' + ur + '" wmode="transparent" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+w+'" height="'+h+'"></embed> ');
	document.write('</object> ');
}

function wDate(){
	var today = new Date();
	var yy=today.getFullYear();
	var mm=today.getMonth()+1;
	var dd=today.getDate();
	var isnDays="星期日|星期一|星期二|星期三|星期四|星期五|星期六|星期日".split("|");
	if(mm<10){mm="0"+mm}
	if(dd<10){dd="0"+dd}
	document.write("今天是：" + yy + "年" + mm + "月" + dd + "日&nbsp;" + isnDays[today.getDay()]);
}

function bookmark(title){
	var url="http://"+document.location.hostname+"/";
	if(window.sidebar){
		window.sidebar.addPanel(title, url,"");
	}else if(window.opera && window.print){
		var mbm = document.createElement('a');
		mbm.setAttribute('rel','sidebar');
		mbm.setAttribute('href',url);
		mbm.setAttribute('title',title);
		mbm.click();
	}else if(document.all){
		window.external.AddFavorite( url, title);
	}
}

function getPosition(e){
	var x = e.offsetLeft;
	var y = e.offsetTop;
	while(e = e.offsetParent){x += e.offsetLeft; y += e.offsetTop;}
	return {"x": x, "y": y};
}

function s(){
	if(!$("key").value){$("search_err").innerHTML='<font color=red>请输入搜索关键词：</font>';$("key").focus();return;}
	switch($("search_type").value){
	case "products":
		self.location="products.asp?key=" + $("key").value;
		break;
	case "news":
		self.location="news.asp?key=" + $("key").value;
		break;
	}
}
function show_list(obj){
	var div = obj.getElementsByTagName("div");
	if(!div.length)return;
	if(div[0].style.display == 'none'){
		div[0].style.display = '';
		var xy = getPosition(obj);
		div[0].style.left = xy.x + 'px';
		xy = getPosition(obj.parentNode);
		div[0].style.top = xy.y + 40 + 'px';
	} else{
		div[0].style.display = 'none';
	}
}
