﻿
$(function(){
   //注册事件
  
    CateToggle();
    ShowFirstCateItem();
})

function ShowFirstCateItem()
{
 
    var  Cate=$(".sidebar_nav")   
    if(Cate)
    {
        $(".sidebar_nav ul").eq(0).show();
    }
}
function CateToggle()
{

$(".sidebar_nav .on").hover(function(){
$(".sidebar_nav .SubCateList").hide()

$(this).next("ul").eq(0).show()
},
function(){
     
})
}


//等比缩小图片
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;
             } 
        }
     }
 }



//获取URL参数
function GetUrlParms(ParamName,Default)    
{
   
     var query=location.search.substring(1);//获取查询串   
     var pairs=query.split("&");//在逗号处断开   
     for(var    i=0;i<pairs.length;i++)   
     {   
          var pos=pairs[i].indexOf('=');//查找name=value   
           if(pos==-1)   continue;//如果没有找到就跳过   
           var argname=pairs[i].substring(0,pos);//提取name   
           var value=pairs[i].substring(pos+1);//提取value 
           if(argname.toLowerCase()==ParamName.toLowerCase())
           {
                return value;
           } 
         
    }
     return Default;
}
