//title提示框
var pltsPop=null;
var pltsoffsetX = 10; // 弹出窗口位于鼠标左侧或者右侧的距离；3-12 合适
var pltsoffsetY = 15; // 弹出窗口位于鼠标下方的距离；3-12 合适
var pltsPopbg="#FFFFEE"; //背景色
var pltsPopfg="#111111"; //前景色
var pltsTitle="";
document.write('<div id=pltsTipLayer style="display: none;position: absolute; z-index:10001"></div>');
function pltsinits()
{
document.onmouseover = plts;
document.onmousemove = moveToMouseLoc;

}
function plts()
{ var o=event.srcElement;
if(o.alt!=null && o.alt!=""){o.dypop=o.alt;o.alt=""};
if(o.title!=null && o.title!=""){o.dypop=o.title;o.title=""};
pltsPop=o.dypop;
if(pltsPop!=null&&pltsPop!=""&&typeof(pltsPop)!="undefined")
{
 pltsTipLayer.style.left=-1000;
 pltsTipLayer.style.display='';
 var Msg=pltsPop.replace(/\n/g,"<br>");
 Msg=Msg.replace(/\0x13/g,"<br>");
 var re=/\{(.[^\{]*)\}/ig;
 if(!re.test(Msg))pltsTitle="<font color=#ffffff>简介</font>";
 else{
  re=/\{(.[^\{]*)\}(.*)/ig;
  pltsTitle=Msg.replace(re,"$1")+" ";
  re=/\{(.[^\{]*)\}/ig;
  Msg=Msg.replace(re,"");
  Msg=Msg.replace("<br>","");}
  var attr=(document.location.toString().toLowerCase().indexOf("list.php")>0?"nowrap":"");
 var content =
 '<table style="FILTER:alpha(opacity=90) shadow(color=#bbbbbb,direction=135);" id=toolTipTalbe border=0><tr><td width="100%"><table class=tableBorder7 cellspacing="1" cellpadding="0" style="width:100%">'+
 '<tr id=pltsPoptop ><th height=18 valign=bottom class=th1 ><b><p id=topleft align=left><font color=#ffffff>↖</font>'+pltsTitle+'</p><p id=topright align=right style="display:none">'+pltsTitle+'<font color=#ffffff>↗</font></b></th></tr>'+
 '<tr><td "+attr+" class=tablebody7 style="padding-left:14px;padding-right:14px;padding-top: 6px;padding-bottom:6px;line-height:135%">'+Msg+'</td></tr>'+
 '<tr id=pltsPopbot style="display:none"><th height=18 valign=bottom class=th1><b><p id=botleft align=left><font color=#ffffff>↙</font>'+pltsTitle+'</p><p id=botright align=right style="display:none">'+pltsTitle+'<font color=#ffffff>↘</font></b></th></tr>'+
 '</table></td></tr></table>';
 pltsTipLayer.innerHTML=content;
 toolTipTalbe.style.width=Math.min(pltsTipLayer.clientWidth,document.documentElement.clientWidth/2.2);
 moveToMouseLoc();
 return true;
}
else
{
 pltsTipLayer.innerHTML='';
 pltsTipLayer.style.display='none';
 return true;
}
}

function moveToMouseLoc()
{
 if(pltsTipLayer.innerHTML=='')return true;
 var MouseX=event.clientX;
 var MouseY=event.clientY;
 //window.status=event.y;
 var popHeight=pltsTipLayer.clientHeight;
 var popWidth=pltsTipLayer.clientWidth;

 if(MouseY+pltsoffsetY+popHeight>document.documentElement.clientHeight)
 {
   popTopAdjust=-popHeight-pltsoffsetY*1.5;
   pltsPoptop.style.display="none";
   pltsPopbot.style.display="";
 }
  else
 {
   popTopAdjust=0;
   pltsPoptop.style.display="";
   pltsPopbot.style.display="none";
 }
 if(MouseX+pltsoffsetX+popWidth>document.documentElement.clientWidth)
 {
  popLeftAdjust=-popWidth-pltsoffsetX*2;
  topleft.style.display="none";
  botleft.style.display="none";
  topright.style.display="";
  botright.style.display="";
 }
 else
 {
  popLeftAdjust=0;
  topleft.style.display="";
  botleft.style.display="";
  topright.style.display="none";
  botright.style.display="none";
 }
 pltsTipLayer.style.left=MouseX+pltsoffsetX+document.documentElement.scrollLeft+popLeftAdjust;
 pltsTipLayer.style.top=MouseY+pltsoffsetY+document.documentElement.scrollTop+popTopAdjust;
 return true;
}
pltsinits();

//图片最大限制
function resizepic(thispic,width,height)
{
	if(typeof(width) != "undefined"){
		if(thispic.width>width) thispic.width=width;
	}
	if(typeof(height) != "undefined"){
		if(thispic.height>height) thispic.height=height;
	}
}
//无级缩放图片大小
function bbimg(o)
{
  var zoom=parseInt(o.style.zoom, 10)||100;
  zoom+=event.wheelDelta/12;
  if (zoom>0) o.style.zoom=zoom+'%';
  return false;
}
//双击鼠标滚动屏幕的代码
var currentpos,timer;
function initialize()
{
timer=setInterval ("scrollwindow ()",30);
}
function sc()
{
clearInterval(timer);
}
function scrollwindow()
{
currentpos=document.documentElement.scrollTop;
window.scroll(0,++currentpos);
if (currentpos !=document.documentElement.scrollTop)
sc();
}
document.onmousedown=sc
document.ondblclick=initialize

//更改字体大小
var status0='';
var curfontsize=10;
var curlineheight=18;
function fontZoomA(){
  if(curfontsize>8){
    document.getElementById('fontzoom').style.fontSize=(--curfontsize)+'pt';
	document.getElementById('fontzoom').style.lineHeight=(--curlineheight)+'pt';
  }
}
function fontZoomB(){
  if(curfontsize<64){
    document.getElementById('fontzoom').style.fontSize=(++curfontsize)+'pt';
	document.getElementById('fontzoom').style.lineHeight=(++curlineheight)+'pt';
  }
}

var seltimes=0;
var pid1=0;
var pid2=0;
function compare(cbox){
	if(cbox.checked==false){
		if(seltimes!=0) seltimes=seltimes-1;
        if(pid2!=0) pid2=0;
        else pid1=0;
	}else{
		seltimes=seltimes+1;
		if(pid1!=0) pid2=cbox.value;
		else pid1=cbox.value;
    }
	if(seltimes==2){		
		window.open('/product/compare.php?pid1='+pid1+'&pid2='+pid2);
		seltimes=seltimes-1;
		cbox.checked=false;
		pid2=0;
	}
	if(seltimes==3){
		alert("只能选择两种产品进行比较！");
		seltimes=seltimes-1;
		return (cbox.checked=false);
	}
}

function buy(url){
	cartwin=window.open(url,'cart','menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=1,resizable=0,width=570,top=0,left=0,height=200');
	cartwin.focus();
}

//忽略所有错误，没有黄叹号...
function killErrors() { 
 return true; 
}
window.onerror = killErrors;
window.onerror=true;
