﻿// JScript 文件
/*********************切换选项卡************************/
//function nTabs(tabObj,obj){
//	var tabList = document.getElementById(tabObj).getElementsByTagName("li");
//	for(i=0; i <tabList.length; i++)
//	{
//		if (tabList[i].id == obj.id)
//		{
//			document.getElementById(tabObj+"_Title"+i).className = "active"; 
//    		document.getElementById(tabObj+"_Content"+i).style.display = "";
//		}else{
//			document.getElementById(tabObj+"_Title"+i).className = "normal"; 
//			document.getElementById(tabObj+"_Content"+i).style.display = "none";
//		}
//	} 
//}
/********************************主页上调用 特价推荐&库存推荐************************************/

var DivTipSTYLE = "";
var offsetX = 0;
var	offsetY = 20;
var x = 0;
var y = 0;
    
    
function showImg(src,sprice,mprice,event)
{
   DivTipSTYLE = document.getElementById("dz");
	if(src=="") 
  {
    DivTipSTYLE.style.display = "none";   
    
  }
  else 
  {     document.onmousemove = function(event){moveToMouseLoc(event)};  
     var content ='<img src="' + src +'" style=" border:1px #cccccc solid; width:200px;"/><br>';                  
     DivTipSTYLE.innerHTML=content;      
     DivTipSTYLE.style.display='';
  }
}

function initToolTips(event,id)
{
    DivTipSTYLE = document.getElementById(id);
    document.onmousemove = function(event){moveToMouseLoc(event)};
}


function moveToMouseLoc(eTag)//获取鼠标当前坐标
{
    DivTipSTYLE = document.getElementById("dz");
    var event = window.event || eTag;  
	var posX,posY;      
  
  //判断当前浏览器
  if(navigator.userAgent.indexOf("MSIE")>0)   //IE6.0-7 or marthon
  {  
      if(screen.width == 800)  
      {
            posX = event.clientX + document.documentElement.scrollLeft - document.body.clientLeft+10;
  	        posY = event.clientY + document.documentElement.scrollTop- document.body.clientTop+5; 
      } 
      else if(screen.width == 1024) 
      {
           posX = event.clientX + document.documentElement.scrollLeft - document.body.clientLeft+10;
  	       posY = event.clientY + document.documentElement.scrollTop- document.body.clientTop+5; 
      } 
      else if(screen.width >=  1280) 
      {
           posX = event.clientX + document.documentElement.scrollLeft - document.body.clientLeft+10;
  	       posY = event.clientY + document.documentElement.scrollTop- document.body.clientTop+20; 
      }      
         
  }  
  
  if(isFirefox=navigator.userAgent.indexOf("Firefox")>0)  //firefox
  {  
      if(screen.width == 800)  
      {
            posX = event.pageX+5;
            posY = event.pageY+5; 
      } 
      else if(screen.width == 1024) 
      {
           posX = event.pageX+5;
           posY = event.pageY+5; 
      } 
      else if(screen.width >=  1280) 
      {
           posX = event.pageX+5-120;
           posY = event.pageY+5; 
      }           
           
  }
 
//  if(isopera=navigator.userAgent.indexOf("Opera")>0)return 3;//opera
//  if(isSafari=navigator.userAgent.indexOf("Safari")>0)return 4;  
//  if(isCamino=navigator.userAgent.indexOf("Camino")>0)return 5;
//  if(isMozilla=navigator.userAgent.indexOf("Gecko")>0)return 6;
     	   
  try{ 
     
    DivTipSTYLE.style.top= posY +"px";  
    DivTipSTYLE.style.left= posX +"px"; 
  
  }catch(E){}
  return true;
}




//图片等比缩放
function DrawImage(ImgD,FitWidth,FitHeight){
     var image=new Image();
     image.src=ImgD.src;
   
     if(image.width>0 && image.height>0){
         if(image.width/image.height>= FitWidth/FitHeight){
             if(image.width>FitWidth){
                 ImgD.width=FitWidth;
                 ImgD.height=(image.height*FitWidth)/image.width;
             }else{
                 ImgD.width=image.width; 
                ImgD.height=image.height;
             }
         } else{
             if(image.height>FitHeight){
                 ImgD.height=FitHeight;
                 ImgD.width=(image.width*FitHeight)/image.height;
             }else{
                 ImgD.width=image.width; 
                ImgD.height=image.height;
             } 
        }
        
     }
 }
