// JavaScript Document
function addFav(){
    window.external.AddFavorite(location.href,document.title);
}

function CopyUrl(){
    var clipBoardContent=''; 
    clipBoardContent += window.location;
    window.clipboardData.setData("Text",clipBoardContent);
    alert("产品详细信息的地址已经复制成功啦~~ 直接在QQ、MSN等上面粘贴发给你的好友们查看啦~~");
}

function startmarquee(lh,speed,delay,obj) {  
var p=false; 
var t; 
var o=document.getElementById(obj); 
o.innerHTML+=o.innerHTML; 
o.style.marginTop=0; //o的属性，设置或获取对象的上边距宽度
o.onmouseover=function(){p=true;} 
o.onmouseout=function(){p=false;} 

function start(){ 
t=setInterval(scrolling,speed); //给前面定义的变量t赋值=自动（滚动，速度）
if(!p) o.style.marginTop=parseInt(o.style.marginTop)-1+"px"; //当P为空，属性o的上边距宽度为数字[把变量o上边距宽度转为integer类型，其中parseInt功能为转换]
}

function scrolling(){ //“滚动”函数
if(parseInt(o.style.marginTop)%lh!=0){ //如果对象o的上边距宽度为空，则为0（parseInt为转换作用）
o.style.marginTop=parseInt(o.style.marginTop)-1+"px"; //上边距宽度为数字[把变量o上边距宽度转为integer类型，其中parseInt功能为转换]
if(Math.abs(parseInt(o.style.marginTop))>=o.scrollHeight/2) o.style.marginTop=0; //如果计算出来的上边距宽度大于或者等于滚动的高度除以2 则o的上边距宽度为0
}else{ 
clearInterval(t); //指定T为空
setTimeout(start,delay);//指定暂停时间(开始，延迟)
}
}

//新的开始，不包含在前面的如果里面
setTimeout(start,delay); //指定暂停时间(开始，延迟)
}


//滑动按钮效果
/*
  modtag - 按钮ID
  modcontent - 要显示的块
  modk       - 当前第几个按钮
  toltal     - 总多少按钮
  class1     - 选中状态样式
  class2     - 未选中状态样式
  moretag    - 更多按钮
  moreurl    - 更多链接地址
*/
function SwitchModTag(modtag,modcontent,modk,toltal,class1,class2,moretag,moreurl) {
    for(i=0; i <=toltal; i++) {
      if (i==modk) {
		if(moreurl!=""){document.getElementById(moretag).href=moreurl;document.getElementById(moretag).innerHTML="更多 >>"}//else{document.getElementById(moretag).innerHTML=""}
        document.getElementById(modtag+i).className=class1;document.getElementById(modcontent+i).style.display="block";}
      else {
        document.getElementById(modtag+i).className=class2;document.getElementById(modcontent+i).style.display="none";}
    }
  }
  
  
function ReSizeImg(Img,width,height)
{ 
    var image=new Image(); 
    image.src=Img.src; 
    width=340;//预先设置的所期望的宽的值
    height=254;//预先设置的所期望的高的值
    if(image.width>width||image.height>height)    //现有图片只有宽或高超了预设值就进行js控制
    {
        w=image.width/width;
        h=image.height/height;		
        if(w>h)
        {
            //比值比较大==>宽比高大
            //定下宽度为width的宽度
            Img.width=width;
            //以下为计算高度
            Img.height=image.height/w;			
        }
        else
        {
            //高比宽大
            //定下宽度为height高度
            Img.height=height;
            //以下为计算高度
            Img.width=image.width/h;			
        }	
    }
}  