//浏览器识别
var TheBrowser = {
'isIE' : (navigator.userAgent.indexOf('MSIE') >= 0) && (navigator.userAgent.indexOf('Opera') < 0),
'isIE6' : (document.all && !window.XMLHttpRequest) ,
'isIE7' : (document.all && window.XMLHttpRequest) ,
'isFirefox' : navigator.userAgent.indexOf('Firefox') >= 0,
'isOpera' : navigator.userAgent.indexOf('Opera') >= 0
};
function $(s){
return document.getElementById(s);
}
//建立事件绑定
function addEvent(el,eventType,fn){
if(el.addEventListener){
el.addEventListener(eventType,fn,false);
}else if(el.attachEvent){
el.attachEvent("on" + eventType,fn);
}else{
el["on"+eventType]=fn;
}
}
function trim(inputString) {
return inputString.replace(/^[\s]+/,"").replace(/[\s]+$/,"");
}
function drawImageByStandard(im,x,y) {
y = y || 99999;
im.removeAttribute("width");
im.removeAttribute("height");
if( im.width/im.height > x/y  && im.width >x ){
im.height = im.height * (x/im.width)
im.width = x
im.parentNode.style.height = im.height * (x/im.width) + 'px'
}else if( im.width/im.height <= x/y && im.height >y){
im.width = im.width * (y/im.height)
im.height = y
im.parentNode.style.height = y + 'px'
}
im.style.visibility = 'visible'
}
//获取屏幕和页面的宽高，并以数组形式返回
function getSize() {
var xScroll, yScroll;
if (window.innerHeight && window.scrollMaxY) {
xScroll = document.body.scrollWidth;
yScroll = window.innerHeight + window.scrollMaxY;
} else if (document.body.scrollHeight > document.body.offsetHeight){      // all but Explorer Mac
xScroll = document.body.scrollWidth;
yScroll = document.body.scrollHeight;
} else {      // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
xScroll = document.body.offsetWidth;
yScroll = document.body.offsetHeight;
}
var windowWidth, windowHeight;
if (self.innerHeight) {      // all except Explorer
windowWidth = self.innerWidth;
windowHeight = self.innerHeight;
} else if (document.documentElement && document.documentElement.clientHeight) {      // Explorer 6 Strict Mode
windowWidth = document.documentElement.clientWidth;
windowHeight = document.documentElement.clientHeight;
} else if (document.body) {      // other Explorers
windowWidth = document.body.clientWidth;
windowHeight = document.body.clientHeight;
}
// for small pages with total height less then height of the viewport
if(yScroll < windowHeight){
pageHeight = windowHeight;
y = pageHeight;
} else {
pageHeight = yScroll;
y = pageHeight;
}
if(xScroll < windowWidth){
pageWidth = windowWidth;
} else {
pageWidth = xScroll;
}
arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight)
return arrayPageSize;
}
//重写insertAdjacentHTML函数 开始
if (!document.all) {
HTMLElement.prototype.insertAdjacentHTML = function (sWhere, sHTML) {
var df;
var r = this.ownerDocument.createRange();
switch (String(sWhere).toLowerCase()) {
case "beforebegin":
r.setStartBefore(this);
df = r.createContextualFragment(sHTML);
this.parentNode.insertBefore(df, this);
break;
case "afterbegin":
r.selectNodeContents(this);
r.collapse(true);
df = r.createContextualFragment(sHTML);
this.insertBefore(df, this.firstChild);
break;
case "beforeend":
r.selectNodeContents(this);
r.collapse(false);
df = r.createContextualFragment(sHTML);
this.appendChild(df);
break;
case "afterend":
r.setStartAfter(this);
df = r.createContextualFragment(sHTML);
this.parentNode.insertBefore(df, this.nextSibling);
break;
}
};
}
//重写insertAdjacentHTML函数 结束
//事件冒泡终止函数
function cancelBubble(e){
e = e || window.event;e.cancelBubble=true
}
//获取当前的样式属性值
function getCurrentStyle(obj, prop) {
if (obj.currentStyle) {
return obj.currentStyle[prop];
}
else if (window.getComputedStyle) {
prop = prop.replace (/([A-Z])/g, "-$1");
prop = prop.toLowerCase ();
return window.getComputedStyle (obj, "").getPropertyValue(prop);
}
return null;
}
//通过classname获取节点
function getElementsByClassName(cls,elm,pobj) {
cls = cls.replace(',','\\b.*\\b')
var arrCls =[];
var rexCls = new RegExp('\\b' + cls + '\\b','img');
var lisElm = pobj.getElementsByTagName(elm);
for (var i=0; i<lisElm.length; i++ ){
var evaCls = lisElm[i].className;
if( rexCls.test(evaCls) ){
arrCls.push(lisElm[i]);
rexCls.test(evaCls)
}
}
return arrCls;
}
/*
*函数名：getPreviousSibling:    获取上一个节点
*@param o:              参数节点；
*@return: 参数节点的上一个节点，如果为空返回 null；
*/
function getPreviousSibling(o){
var r = o.previousSibling
while( r && r.nodeType !=1 ){
r = r.previousSibling
}
return r
}
/*
*函数名：getNextSibling:    获取下一个节点
*@param o:              参数节点；
*@return: 参数节点的下一个节点，如果为空返回 null；
*/
function getNextSibling(o){
var r = o.nextSibling
while( r && r.nodeType !=1 ){
r = r.nextSibling
}
return r
}
/*
获得指定className的最近上层
*/
function getParentByClassName(classname,obj){
classname = classname.replace(',','\\b.*\\b')
var rg = new RegExp('\\b'+classname+'\\b','ig')
var pn = obj.parentNode;
while( !rg.test(pn.className) ){
var tg = pn.tagName ? pn.tagName.toLowerCase() : ''
if( tg == 'body' ||  tg == '' || pn.parentNode && !pn.parentNode.tagName ){
return null;
}
pn = pn.parentNode;
}
return pn;
}
/*
*函数名：getLastElementChild:    获取父级元素的最后一个element子元素；
*@param obj:    父级元素；
*@type Object
*@return: 最后一个类型为element的子元素；
*/
function getLastElementChild(obj){
var objChilds /*父元素的所有子元素*/ = obj.childNodes;
for(var i=objChilds.length-1;i>=0;i--){
if(objChilds[i].nodeType == 1){
return objChilds[i];
break;
}
}
return null;
}
/*
*函数名：getFirstElementChild:   获取父级元素的第一个element子元素；
*@param obj:    父级元素；
*@type Object
*@return: 第一个类型为element的子元素；
*/
function getFirstElementChild(obj){
var objChilds /*父元素的所有子元素*/ = obj.childNodes;
for(var i=0;i<objChilds.length;i++){
if(objChilds[i].nodeType == 1){
return objChilds[i];
break;
}
}
return null;
}
/*
获得指定className的最近上层
*/
function getParentByClassName(classname,obj){
classname = classname.replace(',','\\b.*\\b')
var rg = new RegExp('\\b'+classname+'\\b','ig')
var pn = obj.parentNode;
while( !rg.test(pn.className) ){
var tg = pn.tagName ? pn.tagName.toLowerCase() : ''
if( tg == 'body' ||  tg == '' || pn.parentNode && !pn.parentNode.tagName ){
return null;
}
pn = pn.parentNode;
}
return pn;
}
function swInitialize(nm,m,psy,psx){
var ula = $(nm+'_a')
var ulb = $(nm+'_b')
var lisa = ula.getElementsByTagName('li')
var lisb = ulb.getElementsByTagName('dd')
var flag =  psy == undefined && psx == undefined ? false : true
if(flag){
ula.style.backgroundPosition = (psx ? psx : 0) +'px -'+ (psy ? psy : 0) +'px'
}
var i
ulb.setAttribute('curr_li',m)
for(i=0; i<lisb.length; i++){
if(i != m)
lisb[i].className = 'dn'
else{
lisb[i].className = ''
}
}
for(i=0; i<lisa.length; i++){
lisa[i].setAttribute('num',i)
if(i == m){
lisa[i].className += ' hov'
}else{
lisa[i].className = ''
}
lisa[i].onmouseover = function(){
var c = parseInt(ulb.getAttribute('curr_li'))
if(flag){
ula.style.backgroundPosition =  '0 -' + (this.getAttribute('num') * 40 + psy) + 'px'
}
lisa[c].className = lisa[c].className.replace(/\s*hov\s*/g,' ')
this.className += ' hov'
lisb[c].className = 'dn'
var n = this.getAttribute('num')
lisb[n].className = ''
ulb.setAttribute('curr_li',n)
}
}
}
//<![CDATA[
window.onerror=function(){return true;}
function validstr(str) // 验证用户名
{ var s,i,j; s=" +=|'#&<>%*`^/\\\";,."; str1=str.value.toString();
if (str.value.length <1){alert("昵称不能为空！");str.focus(); return false;}
for (i=0; i<str1.length; i++)
{	for(j=0;j<s.length;j++)
{if (str1.charAt(i) == s.charAt(j))
{	alert("名字中不能包含特殊字符: +=|'#&<>%*`^/\\\";,.空格.");
str.focus(); return false;
}}}return true;
}
function OnLogin(n) // 登录聊天室
{
if(!validstr(login.user))return ;
login.submit() ;
}
//右侧内容切换
function show_it(n){
var n;
if(n == 0){
//alert(n);
document.getElementById("right_1").style.display = "";
document.getElementById("right_2").style.display = "";
document.getElementById("right_3").style.display = "";
document.getElementById("right_4").style.display = "";
document.getElementById("right_1b").style.display = "none";
document.getElementById("right_2b").style.display = "none";
document.getElementById("right_3b").style.display = "none";
}else{
//alert(n);
document.getElementById("right_1").style.display = "none";
document.getElementById("right_2").style.display = "none";
document.getElementById("right_3").style.display = "none";
document.getElementById("right_4").style.display = "none";
document.getElementById("right_1b").style.display = "";
document.getElementById("right_2b").style.display = "";
document.getElementById("right_3b").style.display = "";
}
}
function olImg() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=olImg.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function show_div(div_id,obj){
var  t_id = document.getElementById(div_id);
var  t_num = document.getElementById(obj);
if (t_id.style.display == ""){
t_id.style.display = "none";
t_num.style.background = "url('http://img.china.alibaba.com/images/cn/home/070215/left_menu_title_down.gif') no-repeat 5px 0px";
}else{
t_id.style.display = "";
t_num.style.background = "url('http://img.china.alibaba.com/images/cn/home/070215/left_menu_title_up.gif') no-repeat 5px 0px";
}
}
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_findObj(n, d) { //v4.01
var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_showHideLayers() { //v6.0
var i,p,v,obj,args=MM_showHideLayers.arguments;
for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
obj.visibility=v; }
}
function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function slideLine(ul, delay, speed, lh) {
var slideBox = (typeof ul == 'string')?document.getElementById(ul):ul;
//add by alineo
var slideBox2 = (typeof ul == 'string')?document.getElementById(ul):ul;
for(var i=0;i<slideBox2.childNodes.length;i++){
if(slideBox2.childNodes[i].nodeType==1){
if(slideBox2.childNodes[i].tagName == "UL")
slideBox2 = slideBox2.childNodes[i];
break;
}
}
var delay = delay||1000, speed=speed||20, lh = lh||20;
var tid = null, pause = false;
var start = function() {
tid=setInterval(slide, speed);
}
var slide = function() {
if (pause) return;
slideBox.scrollTop += 2;
if (slideBox.scrollTop % lh == 0) {
clearInterval(tid);
slideBox2.appendChild(slideBox2.getElementsByTagName('li')[0]);
slideBox.scrollTop = 0;
setTimeout(start, delay);
}
}
slideBox.onmouseover=function(){pause=true;}
slideBox.onmouseout=function(){pause=false;}
setTimeout(start, delay);
}
function show_menu(obj_s,obj){
var  s_id = document.getElementById(obj_s);
var  sc_id = document.getElementById(obj);
s_id.style.display = "";
sc_id.className = "ahv";
}
function hide_menu(obj_h,obj){
var  h_id = document.getElementById(obj_h);
var  hc_id = document.getElementById(obj);
h_id.style.display = "none";
hc_id.className = "alk";
}
function closeNotice(){
try{
document.getElementById('alinotice').style.display='none';
if(moveBox){
if(document.getElementById('alitalk_chk_show').style.marginTop == "0px"||document.getElementById('alitoolbar_chk_show').style.marginTop == "0px"){
moveBox=null;
moveBox = new MoveBox(document.getElementById('menu_list'));
initMoveBox(moveBox,true)
}else if(document.getElementById('alitalk_chk_show').style.marginTop == "-45px"&&document.getElementById('alitoolbar_chk_show').style.marginTop == "-45px"){
moveBox=null;
moveBox = new MoveBox(document.getElementById('menu_list'));
initMoveBox(moveBox,true);
}
}else{
moveBox = new MoveBox(document.getElementById('menu_list'));
initMoveBox(moveBox,true)
}
}catch(e){
}
}
function clickTime()
{
var thistime = new Date();
var years = thistime.getYear();
var days = thistime.getDay();
var hours = thistime.getHours();
var minutes = thistime.getMinutes();
var seconds = thistime.getSeconds();
var lastDate = new Date(thistime.getYear(), thistime.getMonth(), thistime.getDate(),hours,5*parseInt(minutes/5));
if(hours>17||hours<9){
document.getElementById("mainbody").parentNode.className="row11";
if(hours>=18){
document.getElementById("mainbody").innerHTML = "下次更新时间是明日9:00";
}else{
document.getElementById("mainbody").innerHTML = "下次更新时间是今日9:00";
}
document.getElementById("lastTime").innerHTML="上次更新时间18:00";
}else{
document.getElementById("mainbody").parentNode.className="row1";
minutes = 4 - minutes % 5;
seconds = 59 - seconds;
var smin = lastDate.getMinutes();
if(smin<10)smin="0"+smin;
document.getElementById("lastTime").innerHTML="上次更新时间"+(lastDate.getHours())+":"+smin;
if(minutes == 0 && seconds == 0){
//window.location.reload();
document.getElementById('timeIframe').src='http://page.china.alibaba.com/paimai/searchhomepage.html?iframe_delete=true';
}else{
if(minutes<10)minutes="0"+minutes;
if(seconds<10)seconds="0"+seconds;
thistime = minutes + ":" + seconds;
document.getElementById("mainbody").innerHTML = thistime;
}
}
setTimeout("clickTime()",1000);
}
//]]>
function checkforms(idName) {
var keywords = document.getElementById(idName).value;
if ((keywords == "") || (keywords == "输入关键字") || (keywords == "请输入产品名称！")) {
alert("请输入关键字！");
document.getElementById(idName).focus();
return false;
}
}
/*
* 函数说明：去除头尾空格
* 参数：	字符串
* 返回值：	无
* 时间：2005-5-12
*/
function trim(inputString) {
return inputString.replace(/^ +/,"").replace(/ +$/,"");
}
/*
* 函数说明：取cookie值
* 参数：	cookie字段名
* 返回值：	cookie值
* 时间：2005-5-12
*/
function getCookie(sName) {
var aCookie = document.cookie.split("; ");
for (var i=0; i < aCookie.length; i++)
{
var aCrumb = aCookie[i].split("=");
if (sName == aCrumb[0])
return unescape(aCrumb[1]);
}
return null;
}
/*
* 函数说明：取历史记录
* 参数：	sKwId:显示的容器id,nNum:显示搜索记录的个数
* 时间：2007-11-20
*/
function getHistoryWords(sKwId,nNum){
var keys_str = getCookie('h_keys');
if (keys_str != null) {
var keys_array = keys_str.split("#");
if (keys_array.length >= 3) {
var strlen = 0;
var str = "<strong>最近搜索记录：</strong>";
for (var i = 0; i < keys_array.length && i < nNum; i++) {
var key = keys_array[i];
if(key.indexOf("[") != -1 && key.indexOf("]") != -1) {
// 兼容老的cookie格式
key = key.substring(0, key.length - 3);
}
strlen = strlen + key.length;
if (strlen < nNum*6) {
str += " <a target=_blank href=http://search.china.alibaba.com/selloffer/" + encodeURI(key) + ".html class=textwhite onMouseDown=\"return aliclick(this,'?tracelog=ui_homepage_searchbuy');\">" + key + "</a> ";
}
}
document.getElementById(sKwId).innerHTML=str;
}
}
}
/*
* 函数说明：限制页面内容中图片和表格的大小
* 参数：	nNum被限制的表格/图片的最大宽度
* 时间：2007-11-28 yaosl
*/
function ResizeContent(nNum){
var myContent,oldWidth;
var maxWidth=nNum;
var array=new Array(2);
array[0]= "img";
array[1]= "table";
for (n = 0; n < array.length; n++){
var detailImg = document.getElementsByTagName(array[n]);
for (i = 0; i < detailImg.length; i++) {
myContent = detailImg[i];
if (myContent.width > maxWidth) {
oldWidth = myContent.width;
myContent.width = maxWidth;
myContent.height = myContent.height * (maxWidth / oldWidth);
}
}
}
}
//图片滚动列表 mengjia 070927
var Speed_1 = 10; //速度(毫秒)
var Space_1 = 20; //每次移动(px)
var PageWidth_1 = 116 * 3; //翻页宽度
var interval_1 = 7000; //翻页间隔
var fill_1 = 0; //整体移位
var MoveLock_1 = false;
var MoveTimeObj_1;
var MoveWay_1="right";
var Comp_1 = 0;
var AutoPlayObj_1=null;
function GetObj(objName){if(document.getElementById){return eval('document.getElementById("'+objName+'")')}else{return eval('document.all.'+objName)}}
function AutoPlay_1(){clearInterval(AutoPlayObj_1);AutoPlayObj_1=setInterval('ISL_GoDown_1();ISL_StopDown_1();',interval_1)}
function ISL_GoUp_1(){if(MoveLock_1)return;clearInterval(AutoPlayObj_1);MoveLock_1=true;MoveWay_1="left";MoveTimeObj_1=setInterval('ISL_ScrUp_1();',Speed_1);}
function ISL_StopUp_1(){if(MoveWay_1 == "right"){return};clearInterval(MoveTimeObj_1);if((GetObj('ISL_Cont_1').scrollLeft-fill_1)%PageWidth_1!=0){Comp_1=fill_1-(GetObj('ISL_Cont_1').scrollLeft%PageWidth_1);CompScr_1()}else{MoveLock_1=false}
AutoPlay_1()}
function ISL_ScrUp_1(){if(GetObj('ISL_Cont_1').scrollLeft<=0){GetObj('ISL_Cont_1').scrollLeft=GetObj('ISL_Cont_1').scrollLeft+GetObj('List1_1').offsetWidth}
GetObj('ISL_Cont_1').scrollLeft-=Space_1}
function ISL_GoDown_1(){clearInterval(MoveTimeObj_1);if(MoveLock_1)return;clearInterval(AutoPlayObj_1);MoveLock_1=true;MoveWay_1="right";ISL_ScrDown_1();MoveTimeObj_1=setInterval('ISL_ScrDown_1()',Speed_1)}
function ISL_StopDown_1(){if(MoveWay_1 == "left"){return};clearInterval(MoveTimeObj_1);if(GetObj('ISL_Cont_1').scrollLeft%PageWidth_1-(fill_1>=0?fill_1:fill_1+1)!=0){Comp_1=PageWidth_1-GetObj('ISL_Cont_1').scrollLeft%PageWidth_1+fill_1;CompScr_1()}else{MoveLock_1=false}
AutoPlay_1()}
function ISL_ScrDown_1(){if(GetObj('ISL_Cont_1').scrollLeft>=GetObj('List1_1').scrollWidth){GetObj('ISL_Cont_1').scrollLeft=GetObj('ISL_Cont_1').scrollLeft-GetObj('List1_1').scrollWidth}
GetObj('ISL_Cont_1').scrollLeft+=Space_1}
function CompScr_1(){if(Comp_1==0){MoveLock_1=false;return}
var num,TempSpeed=Speed_1,TempSpace=Space_1;if(Math.abs(Comp_1)<PageWidth_1/2){TempSpace=Math.round(Math.abs(Comp_1/Space_1));if(TempSpace<1){TempSpace=1}}
if(Comp_1<0){if(Comp_1<-TempSpace){Comp_1+=TempSpace;num=TempSpace}else{num=-Comp_1;Comp_1=0}
GetObj('ISL_Cont_1').scrollLeft-=num;setTimeout('CompScr_1()',TempSpeed)}else{if(Comp_1>TempSpace){Comp_1-=TempSpace;num=TempSpace}else{num=Comp_1;Comp_1=0}
GetObj('ISL_Cont_1').scrollLeft+=num;setTimeout('CompScr_1()',TempSpeed)}}
function picrun_ini(){
GetObj("List2_1").innerHTML=GetObj("List1_1").innerHTML;
GetObj('ISL_Cont_1').scrollLeft=fill_1>=0?fill_1:GetObj('List1_1').scrollWidth-Math.abs(fill_1);
GetObj("ISL_Cont_1").onmouseover=function(){clearInterval(AutoPlayObj_1)}
GetObj("ISL_Cont_1").onmouseout=function(){AutoPlay_1()}
AutoPlay_1();
}
//首页显示隐藏层
function ShowDivInfo(id){
var HidDiv = document.getElementById(id);
HidDiv.style.display="block";
}
function HidDivInfo(id){
var HidDiv = document.getElementById(id);
HidDiv.style.display="none";
}
function setHomepage(href)//设为首页全兼容方法
{
if (document.all)
{
if(href){
document.body.style.behavior='url(#default#homepage)';
document.body.setHomePage(href);
}else{
document.body.style.behavior='url(#default#homepage)';
document.body.setHomePage(location.href);
}
}
else if (window.sidebar)
{
if(window.netscape)
{
try
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
}
catch (e)
{
alert( "该操作被浏览器拒绝，如果想启用该功能，请在地址栏内输入 about:config,然后将项 signed.applets.codebase_principal_support 值该为true" );
}
}
var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components. interfaces.nsIPrefBranch);
if(href){prefs.setCharPref('browser.startup.homepage',href);}
else{
prefs.setCharPref('browser.startup.homepage',location.href);}
}
}
//加入收藏
function addFav(){
try{
var title = document.title;
var url = window.location.href;
if (window.sidebar) {
window.sidebar.addPanel(title, url, '');
}else if( window.external ) {
window.external.AddFavorite(url, title);
}
}catch(e){}
try{
aliclick(this,'?tracelog=head_ft_click');
}catch(e){}
}
//用户挽留浮出部门开关
function closeCustomLeave(o){
while(o.parentNode.className != 'customleave'){
o = o.parentNode;
}
o.parentNode.style.display = 'none';
//alert(XDragDropCtrl.followFloat);
//SCROLLTOP += 1;
document.documentElement.scrollTop += 1;
XDragDropCtrl.followFloat(9);
}
//根据元素id得到值
function getElementValueById(id){
var element = document.getElementById(id);
var elementValue = "";
if(null != element)
{
elementValue = element.value;
}
return elementValue;
}
//设置元素的值
function setElementValue(id,resultValue){
var element = document.getElementById(id);
if(null != element)
{
element.value = resultValue;
return true;
}
return false;
}
//显示或隐藏该元素
function showTheElement(id,status){
var element = document.getElementById(id);
if(null != element){
if("none" == status || "" == status){
element.style.display = status;
return true;
}
}
return false;
}
function boxShowHide(box1, box2){
var boxNode1 = document.getElementById(box1+"_body");
var boxNode2 = document.getElementById(box2+"_body");
if(null != boxNode1 && null != boxNode2){
boxNode1.style.display="";
boxNode2.style.display="none";
}
var titleNode1 = document.getElementById(box1+"_title");
var titleNode2 = document.getElementById(box2+"_title");
if(null != titleNode1 && null != titleNode2){
titleNode1.style.display="";
titleNode2.style.display="none";
}
}
var TAOBAO_URL = "";
var TAOBAO_QRY = "";
// 连接URL参数
function appendUrl(url, param, value){
if(""!=value && null!=value){
url += url.length>0? "&": "?";
url += param+"="+value;
}
return url;
}
// 提交查询请求
function formSearch1OnSubmit(form){
form.action = getElementValueById("searchFangType1");
if(getElementValueById("fang.keyword1")=="请输入地段关键字"){
setElementValue("fang.keyword1", "");
}
url = "";
url = appendUrl(url, "option.key", getElementValueById("fang.keyword1"));
url = appendUrl(url, "city", getElementValueById("city1"));
url=getElementValueById("searchFangType1")+url;
window.open(url);
return false;
}
//********************************************
//				 餐饮代码
//********************************************
var CATE_QUERY_URL="http://alibaba.koubei.com/search/searchstore.html?option.category=4";
//餐饮提交1
function cateformSubmit(formtag){
var url = CATE_QUERY_URL;
if (formtag==1){
if(getElementValueById("search_key1")=="店名、菜系、菜名"){
url = appendUrl(url, "option.key", "");
}else{
url = appendUrl(url, "option.key", (getElementValueById("search_key1") ) );
}
url = appendUrl(url, "city", getElementValueById("search_select_cityname1"));
}else if (formtag==2){
if(getElementValueById("search_key2")=="店名、菜系、菜名"){
url = appendUrl(url, "option.key", "");
}else{
url = appendUrl(url, "option.key", (getElementValueById("search_key2")));
}
url = appendUrl(url, "city", getElementValueById("search_select_cityname2"));
}
window.open(url);
return false;
}
//股票搜索
function submit_form()
{
var f = document.getElementById('quote_form')
var s = document.getElementById('s')
var ss = document.getElementById('ss')
//var o = document.getElementById('quote_channel').value
//var src = document.getElementById('quote_src')
var base = 'http://cn.finance.yahoo.com/le'
var url = new Array('','ta','h','gsgg','cwbg','mb')
var sv = ss.value.replace(/^s+$/, '')
f.action = base
//if (o != 0)
// {
/*if (ss.value.length < 2 || ss.value.length > 10 || ss.value=='请输入单支股票代码')
{
ss.value = '请输入单支股票代码'
return
}*/
//}
// src.value = url[o]
if((ss.value == "请输入A股、H股代码")||(ss.value == "")){
window.open("http://info.china.alibaba.com/news/subject/v5003495-s5024381.html");
}
else{
s.value = ss.value
f.submit()
}
}
function addBookmark()
{
if (document.all)
{
window.external.addFavorite(document.location.href,document.title);
}
else if (window.sidebar)
{
window.sidebar.addPanel(document.title,document.location.href,'');
}
}
function aliclick(u, param) {
d = new Date();
if(document.images) {
var img_aliclick = new Image();
img_aliclick.src="http://stat.china.alibaba.com/tracelog/click.html" + param + "&time=" + d.getTime();
}
return true;
}
function etcclick(u, param) {
d = new Date();
if(document.images) {
var img_etc_aliclick = new Image();
img_etc_aliclick.src="http://stat.china.alibaba.com/etclistquery.html" + param + "&time=" + d.getTime();
}
return true;
}
function aliclickType(u, param){
var urlTxt = window.location.href;
if(urlTxt){
var urlType = urlTxt.substring(urlTxt.lastIndexOf('/')+1,urlTxt.lastIndexOf('.'));
}
aliclick(u, param+'_'+urlType);
}
function eeclick(u, param) {
d = new Date();
if (document.images) {
(new Image()).src = "http://stat.china.alibaba.com/ee.html" + param + "&time=" + d.getTime();
}
return true;
}
function getSize() {
var xScroll, yScroll;
if (window.innerHeight && window.scrollMaxY) {
xScroll = document.body.scrollWidth;
yScroll = window.innerHeight + window.scrollMaxY;
} else if (document.body.scrollHeight > document.body.offsetHeight){      // all but Explorer Mac
xScroll = document.body.scrollWidth;
yScroll = document.body.scrollHeight;
} else {      // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
xScroll = document.body.offsetWidth;
yScroll = document.body.offsetHeight;
}
var windowWidth, windowHeight;
if (self.innerHeight) {      // all except Explorer
windowWidth = self.innerWidth;
windowHeight = self.innerHeight;
} else if (document.documentElement && document.documentElement.clientHeight) {      // Explorer 6 Strict Mode
windowWidth = document.documentElement.clientWidth;
windowHeight = document.documentElement.clientHeight;
} else if (document.body) {      // other Explorers
windowWidth = document.body.clientWidth;
windowHeight = document.body.clientHeight;
}
// for small pages with total height less then height of the viewport
if(yScroll < windowHeight){
pageHeight = windowHeight;
y = pageHeight;
} else {
pageHeight = yScroll;
y = pageHeight;
}
if(xScroll < windowWidth){
pageWidth = windowWidth;
} else {
pageWidth = xScroll;
}
arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight)
return arrayPageSize;
}
function floatObj(a,b,c){
this.obj = typeof(a) == 'object' ? a : document.getElementById(a);
this.f = b || 0;
this.firstScroll = this.lastScroll = -c || 0;
this.itvl = null;
this.speed = .6
if (document.documentElement && document.documentElement.scrollTop)
this.diffY = document.documentElement.scrollTop;
else if (document.body)
this.diffY = document.body.scrollTop
else
{/*Netscape stuff*/}
if(this.f == 2){
this.firstScroll = this.lastScroll = this.obj.offsetHeight - getSize()[3] - this.diffY
}
this.originTop = this.obj.offsetTop;
this.sideFloat = function(){
var diffY;
if (document.documentElement && document.documentElement.scrollTop)
diffY = document.documentElement.scrollTop;
else if (document.body)
diffY = document.body.scrollTop
else
{/*Netscape stuff*/}
if(this.f == 1){
var percent= diffY - this.originTop > 0 ? this.speed*(diffY - this.originTop - this.lastScroll) : 0
}else if(this.f == 2){
var percent=this.speed*(- this.lastScroll  + this.firstScroll + getSize()[3] + diffY - this.obj.offsetHeight);
}else{
var percent=this.speed*(diffY - this.lastScroll);
}
percent = percent>0 ? Math.ceil(percent) : percent=Math.floor(percent)
this.obj.style.top = this.obj.style.top == "" ? "0px" : this.obj.style.top
this.obj.style.top = parseInt(this.obj.style.top) + percent + "px"
if(this.f ==2 ){
this.lastScroll += percent;
}else{
this.lastScroll += percent;
}
};
this.close = function () {
clearInterval(this.itvl);
this.obj.style.display = "none";
};
}
// 淇浠锋牸琛屾儏鍥捐〃鏍峰紡
function MArr(a) {
this.items = [];
this.length = a.length;
for (var i = 0; i < a.length; i ++)
this.items.push(a[i]);
}
MArr.prototype.each = function (f) {
for (var i = 0; i < this.length; i ++)
f.apply(f, [i, this.length, this.items[i]]);
};
MArr.$ = function (a) {
return new MArr(a);
};
function adjustPriceTable() {
var ob = document.getElementById("newsdetail-content-text"),
tabs = ob.getElementsByTagName("table"),
tabs_wsbj = [];
for (var i = 0; i < tabs.length; i ++) {
if (tabs[i].className.match(/\bwsbj\b/))
tabs_wsbj.push(tabs[i]);
}
MArr.$(tabs_wsbj).each(adjustPriceTable2);
}
function adjustPriceTable2(i, l, tb) {
var trs = tb.getElementsByTagName("tr");
/*if (
trs.length < 2 ||
(trs[0].getElementsByTagName("td")[0].innerHTML.match(/涓績鍩庡競浠婃棩.+?浠锋牸琛屾儏/)) ||
(trs.length < 5 && trs[1].getElementsByTagName("td").length < 3)
) return;*/
var colgroup = tb.getElementsByTagName("colgroup"), j;
for (j = 0; j <  colgroup.length; j ++)
tb.removeChild(colgroup[j]);
//tb.className = "jghq_tb";
tb.setAttribute("cellspacing", "0");
tb.setAttribute("cellSpacing", "0");
tb.setAttribute("cellpadding", "0");
tb.setAttribute("bgcolor", "#ffffff");
tb.setAttribute("border", "0");
tb.setAttribute("width", "99%");
trs[0].className = "head";
var headTds = trs[0].getElementsByTagName("td");
headTds[0].style.borderLeft = "0";
if (headTds.length > 0) headTds[headTds.length - 1].style.width = "5em";
if (trs[1]) trs[1].className = "bd0";
var _adjTr = function (i, l, tr) {
MArr.$(tr.getElementsByTagName("td")).each(_adjTd);
},
_adjTd = function (i, l, td) {
var s = td.innerHTML.replace(/^\s+/, "").replace(/\s+$/, "").replace(/<br[^>]*>/ig, "");
if (s.length == 0) {
s = "&nbsp;"
}
td.innerHTML = s;
};
MArr.$(trs).each(_adjTr);
tb.style.visibility = "visible";
}
function addLoadEvent(f) {
if (document.addEventListener) {
window.addEventListener("DOMContentLoaded", f, false);
} else {
window.attachEvent("onload", f);
}
}
addLoadEvent(adjustPriceTable);
