var common=window.common=function(args){};

common.fn=common.prototype={

/*
	事件绑定
	如:window.onload=fn; -> bind(window,'load',fn);
*/
bind:function(o,ev,fn){
	if (document.all){
		o.attachEvent('on'+ev,fn);////////////IE绑定上但是fn里this指向window
	}
	else{
		o.addEventListener(ev,fn,false);
	}
	return o;
},

/*
	给对象添加一个class
	如:addClass(document.getElementById('id'),'classA classB');
	可以以空格分隔添加多个class
*/
addClass:function (el,cls){
	var arrCls=cls.split(/[ ]+/);
	if(el.className){
		for(var i=0;i<arrCls.length;i++){
			if(el.className.indexOf(arrCls[i])>=0){
				cls=cls.replace(new RegExp('[ ]*'+arrCls[i]+'[ ]*'),' ');////////有缺陷
			}
		}
		el.className=[el.className].concat(cls).join(' ');
	}
	else{
		el.className=cls;
	}
},

/*
	移除对象上的一个class
*/
removeClass:function (el,cls){
	if(el.className){
		if(el.className.indexOf(cls)>=0){
			el.className=el.className.replace(new RegExp('[ ]*'+cls+'[ ]*','g'),' ');
		}
	}
},

/*
	添加/移除对象上的一个class
	没有就添加，有了就移除
*/
toggleClass:function (el,cls){
	if(!el.className||el.className.indexOf(cls)<0){
		addClass(el,cls);
	}
	else{
		removeClass(el,cls);
	}
},

/*
	显示/隐藏一个元素
	@el:Element
	@sh:Boolean true:show; false:hide; undefined:toggle.
*/
show:function(el,sh){
	var dis=el.style.display;
	if(sh==undefined){
		el.style.display=(dis!='none'?'none':'');
	}else{
		el.style.display=sh?'':'none';
	}
},

createFlash:function(idad, swfurl, wad, had, vs){
	var str = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="' + wad + '" height="' + had + '" id="' + idad + '" align="middle">';
	str += '<param name="allowScriptAccess" value="always">';
	str += '<param name="quality" value="high">';
	str += '<param name="movie" value="' + swfurl + '">';
	str += '<param name="wmode" value="opaque">';
	str += '<param name="flashvars" value="' + vs + '">';
	str += '<embed wmode="opaque" src="' + swfurl + '" flashvars="' + vs + '" quality="high" width="' + wad + '" height="' + had + '" name="' + idad + '" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">';
	str += '</object>';
	document.write(str);
},

onClose:function(){
	window.opener = null;
	window.close();   
}

}

common.extend=common.fn.extend=function(a,b){
	for(i in b)a[i]=b[i];
	return a;
};

common.extend(common,common.fn);

function writeFoot(){
	document.writeln('<style>');
	document.writeln('#ft{clear:both;margin:0;line-height:24px;border-top:1px solid #D78E6A;text-align:center}');
	document.writeln('#ft,#ft *{color:#77C;font-size:12px;font-family:Arial;white-space:nowrap}');
	document.writeln('</style>');
	document.writeln('<TABLE cellSpacing=0 cellPadding=0 width=776 border=0>');
	document.writeln('<TBODY>');
	document.writeln('<TR>');
	document.writeln('<TD width=776 height=32 background="img/bottom.jpg">');
	document.writeln('<TABLE cellSpacing=0 cellPadding=0 width="70%" border=0>');
	document.writeln('<TBODY>');
	document.writeln('<TR>');
	document.writeln('<TD width="15%">&nbsp;</TD>');
	document.writeln('<TD width="75%">');
	document.writeln('<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0><TBODY><TR><TD><DIV align=center class="f12"><A href="about.html"><FONT color=#000000>关于我们</FONT></A></DIV></TD><TD><DIV align=center class="f12"><A href="contact.html"><FONT color=#000000>联系方式</FONT></A></DIV></TD><TD><DIV align=center class="f12"><A href="payment.html"><FONT color=#000000>付款方式</FONT></A></DIV></TD><TD><DIV align=center class="f12"><A href="union1.html"><FONT color=#000000>立即加盟</FONT></A></DIV></TD></TR></TBODY></TABLE></TD><TD width="10%">&nbsp;</TD></TR></TBODY></TABLE>');
	document.writeln('</TD></TR>');
	document.writeln('<TR>');
	document.writeln('<TD width=776 bgColor=#ffffff height=84>');
	document.writeln('<TABLE width="100%" border=0 cellPadding=0 cellSpacing=0 class="f12"><TBODY><TR><TD width="20%">&nbsp;</TD><TD width="60%"><P align=center>中商机网（北京）电子商务技术有限公司 版权所有 </P><P align=center>联系电话：010-51286369 图文传真：010-67894063-606<BR>《中华人民共和国电信与因特网信息服务业务》经营许可证 <A href="http://www.miibeian.gov.cn/" target=_blank>京ICP证060865号</A><BR>Copyright &copy; 2004-2007 <FONT color=#ff0000>BJ51.COM</FONT> All Rights Reserved<BR></P></TD><TD width="20%">&nbsp;</TD></TR></TBODY></TABLE>');
	document.writeln('</TD></TR></TBODY></TABLE>');
}

(function(){
	function initQuery(){
		var query=document.getElementById('query');
		if(query){
			var queryTxt=query.getElementsByTagName('input')[0];
			queryTxt.onfocus=function(){
				if(this.value=='输入关键词'){
					this.value='';
					this.style.color='#000';
				}
			}
			queryTxt.onblur=function(){
				if(this.value==''){
					this.value='输入关键词';
					this.style.color='#999';
				}
			}
		}
	}
	common.bind(window,'load',initQuery);
})();


var newWindow = null
function windowOpener(loadpos){
	if (! newWindow || newWindow.closed){
		newWindow = window.open(loadpos,"get_current_price","resizable,scrollbars,dependent,width=450,height=550");
	}
	else{
		newWindow.focus();
	}
}