﻿$(document).ready(
function()
{
  if(Number(document.body.clientWidth)<=1200)
  {
    $("#qqcontent").hide();
    $("#qq1content").hide();
  }
  $(window).resize(
     function()
     {
        if(Number(document.body.clientWidth)<=1200)
          {
            $("#qqcontent").hide();
            $("#qq1content").hide();
          }
          else
          { 
            $("#qqcontent").show();
            $("#qq1content").show();
          }
          
          
     }
   );
   window.onscroll = function (){ 
    var obj = document.getElementById("qqcontent");
    var obj1 = document.getElementById("qq1content");
    obj.style.top = (document.documentElement.scrollTop + 50)  + "px"; 
    obj1.style.top = (document.documentElement.scrollTop + 50)  + "px"; 
   }
   var obj = document.getElementById("qqcontent");
   var obj1 = document.getElementById("qq1content");
    obj.style.top = (document.documentElement.scrollTop + 50)  + "px"; 
    obj1.style.top = (document.documentElement.scrollTop + 50)  + "px"; 
   $("#closebtn_").click(function(){$("#qqcontent").hide();});
   $("#closebtn1_").click(function(){$("#qq1content").hide();});
  init();
  $("#adddivcontentcontent img").mouseover(function(){stopscroll = true;});
  $("#adddivcontentcontent img").mouseout(function(){stopscroll = false;});
  $("#adddivcontentcontent img").each(
   function()
   {
     DrawImage(this,106,101);
   }
  );

}
);

var stopscroll = false;
var stopscroll_right = true;
var speed_ = 3;
function init()
{
 setInterval("scrollLeft()",100);
}
function scrollLeft(){
  if(stopscroll==true) return;
  preLeft = $("#adddivcontentcontent").scrollLeft();
  $("#adddivcontentcontent").scrollLeft($("#adddivcontentcontent").scrollLeft() + speed_);
  if(preLeft >= $("#adddivcontentcontent").scrollLeft())
  {
     $("#adddivcontentcontent").scrollLeft(1);
  }
}
var flag=false;
function DrawImage(ImgD,iwidth,iheight){
    //参数(图片,允许的宽度,允许的高度)
    var image=new Image();
    image.src=ImgD.src;
    if(image.width>0 && image.height>0){
    flag=true;
    ImgD.height=iheight;
    iwidth=iheight*image.width/image.height;
    ImgD.width=iwidth; 
    ImgD.alt=image.width+"×"+image.height;
    }
} 

//图片高度：image..height
//图片宽度：image..width
//显示高度固定：iheight=101
//显示宽宽度计算公式：iwidth=iheight*image.width/image.height
