// JavaScript Document
$(document).ready(function(){
	if((document.documentElement.clientWidth<=1024))  
	$("#top_menurp").addClass("top_menurp_s");
	else if((document.documentElement.clientWidth>=1024))
	$("#top_menurp").addClass("top_menurp_b");
	
	$(".plist2_cate_h li:last-child").css({ "background": "none" });
	$("#l_catog_1p li:last-child a").css({ "height": "33px","over-flow":"hidden" });
	
	$(".article_list li:even").addClass("arlist_ebg")
		/*产品图切换*/
	 $("#p_timglist li img").mouseover(function(){
  		var oldsrc = $(this).attr("lit");
		var oldsrc2 = $(this).attr("litb");
  		$("#t_bigimg img").attr("src",oldsrc);
		$("#bigImg").attr("src",oldsrc);
		$(".bigimg").attr("src",oldsrc2);
		$("#t_bigimg img").attr("jqimg",oldsrc);
		$("#l_bigimg a").attr("href",oldsrc);
		$("#bigImg").css("opacity","0.5");
		$("#bigImg").fadeTo(1000,1);
 	});
	
	$("#top_menurp").blur( function () { $(this).stop().animate( { height: 30}, 2000); } );
	
	
	 $("#top_menurp").hover(
  function () {
   $(".tp_a",this).stop().animate( { height: 200}, 100);
  },
  function () {
	 
	  $(".tp_a",this).stop().animate( { height: 30}, 2000);
	   
  });
	
var despace = "/Public/Home/space.gif";
  $("#plist_d li").hover(
  function () {
   	$(this).addClass("pli_bg");
  },
  function () {
    $(this).removeClass("pli_bg");
	$("#demotip img").attr("src",despace);
  });
  
  $("#plist_d li img").hover(
  function () {
	 $("#demotip img").attr("src",despace);
   	 var oldsrc = $(this).attr("b_pimg");
  	$("#demotip img").attr("src",oldsrc);
	
  },
  function () {
$("#demotip img").attr("src",despace);
    $("#demotip").hide();
	
  });
  
});



//添加收藏

//图片按比例缩放
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;
    if(image.width/image.height>= iwidth/iheight){
        if(image.width>iwidth){  
        ImgD.width=iwidth;
        ImgD.height=(image.height*iwidth)/image.width;
        }else{
        ImgD.width=image.width;  
        ImgD.height=image.height;
        }
        ImgD.alt=image.width+"×"+image.height;
        }
    else{
        if(image.height>iheight){  
        ImgD.height=iheight;
        ImgD.width=(image.width*iheight)/image.height;        
        }else{
        ImgD.width=image.width;  
        ImgD.height=image.height;
        }
        ImgD.alt=image.width+"×"+image.height;
        }
    }
}
