function window_onload(){if(document.getElementById('consul_ad')){document.getElementById('consul_info').innerHTML='<iframe id="consultationiframe" name="consultationiframe" height="667" onload="var isIE=!!window.ActiveXObject;if(isIE && !window.XMLHttpRequest){this.height=this.document.body.scrollHeight/2;} this.height=consultationiframe.document.body.scrollHeight;return true;" src="'+document.getElementById('consul_ad').innerHTML+'" style="width:100%; border:none;overflow: hidden;"></iframe>';}
if(document.getElementById('brandjs')){document.getElementById('brandjs').innerHTML=brandjs;}
if(document.getElementById('goodsbottom')){document.getElementById('goodsbottom').innerHTML=goodsbottom;}
if(document.getElementById('goodsrec')){document.getElementById('goodsrec').innerHTML=BoughtRec;}
StartScroll('tonlai_margin');StartScroll('tools_history');}
function href(url){window.location.href=url;}
function href_onblur(xmlHttp,parameter,Unsuccessful){window.location.href=parameter[0];}
function getEventObject(W3CEvent) {return W3CEvent || window.event;}
function getPointerPosition(e) {e=e || getEventObject(e);var x=e.pageX || (e.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft));var y=e.pageY || (e.clientY + (document.documentElement.scrollTop || document.body.scrollTop));return { 'x':x,'y':y };}
function setOpacity(elem,level) {if(elem.filters) {elem.style.filter='alpha(opacity=' + level * 100 + ')';} else {elem.style.opacity=level;}
}
function css(elem,prop) {for(var i in prop) {if(i=='opacity') { setOpacity(elem,prop[i]);} else { elem.style[i]=prop[i];}
}
return elem;}
var magnifier={m : null,
init:function(magni){var m=this.m=magni || { cont : null, img : null, mag : null, scale : 15
}
css(m.img,{ 'position' : 'absolute', 'width' : (m.cont.clientWidth * m.scale) + 'px', 'height' : (m.cont.clientHeight * m.scale) + 'px' })
if (window.XMLHttpRequest) {css(m.mag,{ 'display' : 'none', 'width' : m.cont.clientWidth + 'px', 'height' : m.cont.clientHeight + 'px', 'position' : 'absolute', 'left' : m.cont.offsetLeft + m.cont.offsetWidth + 10 + 'px', 'top' : m.cont.offsetTop + 'px' })
} else {css(m.mag,{ 'display' : 'none', 'width' : m.cont.clientWidth + 'px', 'height' : m.cont.clientHeight + 'px', 'position' : 'absolute', 'left' : m.cont.offsetLeft + m.cont.offsetWidth + 25 + 'px', 'top' : m.cont.offsetTop + 'px' })
}
var borderWid=m.cont.getElementsByTagName('div')[0].offsetWidth - m.cont.getElementsByTagName('div')[0].clientWidth;css(m.cont.getElementsByTagName('div')[0],{ 'display' : 'none', 'width' : m.cont.clientWidth / m.scale - borderWid + 'px', 'height' : m.cont.clientHeight / m.scale - borderWid + 'px', 'opacity' : 0.5 })
m.img.src=m.cont.getElementsByTagName('img')[0].src;m.cont.style.cursor='crosshair';m.cont.onmouseover=magnifier.start;},
start:function(e){if(document.all){ magnifier.createIframe(magnifier.m.img);}
this.onmousemove=magnifier.move;this.onmouseout=magnifier.end;},
move:function(e){var pos=XmouseCoords(e,0,document.getElementById('main').scrollTop);this.getElementsByTagName('div')[0].style.display='';css(this.getElementsByTagName('div')[0],{ 'top' : Math.min(Math.max(pos.y - this.offsetTop - parseInt(this.getElementsByTagName('div')[0].style.height) / 2,0),this.clientHeight - this.getElementsByTagName('div')[0].offsetHeight) + 'px', 'left' : Math.min(Math.max(pos.x - this.offsetLeft - parseInt(this.getElementsByTagName('div')[0].style.width) / 2,0),this.clientWidth - this.getElementsByTagName('div')[0].offsetWidth) + 'px' })
magnifier.m.mag.style.display='';css(magnifier.m.img,{'top' : - (parseInt(this.getElementsByTagName('div')[0].style.top) * magnifier.m.scale) + 'px',
'left' : - (parseInt(this.getElementsByTagName('div')[0].style.left) * magnifier.m.scale) + 'px'
})
},
end:function(e){this.getElementsByTagName('div')[0].style.display='none';magnifier.removeIframe(magnifier.m.img);magnifier.m.mag.style.display='none';},
createIframe:function(elem){var layer=document.createElement('iframe');layer.tabIndex='-1';layer.src='javascript:false;';elem.parentNode.appendChild(layer);layer.style.width=elem.offsetWidth + 'px';layer.style.height=elem.offsetHeight + 'px';},
removeIframe:function(elem){var layers=elem.parentNode.getElementsByTagName('iframe');while(layers.length >0){ layers[0].parentNode.removeChild(layers[0]);}
}
}
function StartScroll(name){var objScroll=document.getElementById(name);var DivScroll=objScroll.getElementsByTagName('div')[0];if(objScroll.parentNode.offsetHeight < DivScroll.offsetHeight){var div=document.createElement("div");div.innerHTML=DivScroll.innerHTML;objScroll.appendChild(div);}
}
function guen_dong_1(tonlai_margin,top){o=document.getElementById(tonlai_margin);if(parseInt(o.scrollHeight) + parseInt(o.style.marginTop) - o.parentNode.offsetHeight > 0){o.style.marginTop=parseInt(o.style.marginTop)-top+"px";}else{o.style.marginTop='0px';o.style.marginTop=parseInt(o.style.marginTop)-top+"px";}
}
function guen_dong_2(tonlai_margin,top){o=document.getElementById(tonlai_margin);if(parseInt(o.style.marginTop) < 0 ){o.style.marginTop=parseInt(o.style.marginTop)+top+"px";}else{var DivScroll=o.getElementsByTagName('div')[0];o.style.marginTop=-parseInt(DivScroll.offsetHeight) + 'px';o.style.marginTop=parseInt(o.style.marginTop)+top+"px";}
}
function UserMonitor_send(fang){o=document.getElementById('pictures_send');if(fang=='left'){if(parseInt(o.scrollWidth) - 72 + parseInt(o.style.marginLeft) > 0){o.style.marginLeft=parseInt(o.style.marginLeft)-72+"px";}
}
if(fang=='right'){if(parseInt(o.style.marginLeft) + 72 <= 0){o.style.marginLeft=parseInt(o.style.marginLeft)+72+"px";}
}
}
function MM_findObj(n, d) {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() {var i=0,p,v,obj,args=MM_showHideLayers.arguments;if ((obj=document.getElementById(args[0]))!=null) {v=args[2];if (obj.style) {obj=obj.style;v=(v=='show')?'visible':(v=='hide')?'hidden':v;}
obj.visibility=v;}
}
function collect(goodsId,url)
{if(url != ''){addNumber("GET",url+'&id='+goodsId,true,collectResponse);}else{addNumber("GET",'user.php?act=collect&id='+goodsId,true,collectResponse);}
}
function collectResponse(xmlHttp,parameter,Unsuccessful)
{if(Unsuccessful != 'Unsuccessful'){alert(xmlHttp.responseText);}
}

