$(function(){
//---------------------------------------------------------

 var ta=$("#nav>a");//导航栏a集合
 var fileName=document.location.pathname;//当前路径
 fileName=fileName=="/"?"index.asp":fileName.substr(fileName.lastIndexOf('/')+1); //取得文件名 
 
 var arr=new Array(ta.size()); //将当前导航栏栏目长度定义数组
 for(i=0;i<ta.size();i++){arr[i]=ta.eq(i).attr("href").replace("/","");}//取得每个连接href的值
 for(i in arr){
	 switch(fileName){
		 case arr[i]:Tab(i);//href值与文件名比较，如果相等，执行tab函数，使当前样式与当前文件名相符
		 break;
	 }
	 }

//<a>当前元素选中样式,class名为hover
 function Tab(n) {
  for(i=0;i<ta.length;i++){
   ta[i].className=i==n?"hover":"";
  }
 }
 

//alert($("#a_navigate").height())
//$(".i-pro-img>a>img").attr("style","width:160px;height:"+$(".i-pro-img>a>img").height()*(160/200)+"px");
//-----------------------------------------------
});
function removeElement(E){
         var Par = E.parentNode;
         if(Par){
                Par.removeChild(E);
         }
}

function AddFavorite(sURL, sTitle)
{
     try
     {
         window.external.addFavorite(sURL, sTitle);
     }
     catch (e)
     {
         try
         {
             window.sidebar.addPanel(sTitle, sURL, "");
         }
         catch (e)
         {
             //alert("加入收藏失败，请您手动添加");
         }
     }
}


function ReSizeImg(Img,width,height)
{
    var image=new Image(); 
    image.src=Img.src; 
    if(image.width>width||image.height>height) {
        w=image.width/width;
        h=image.height/height;
        if(w>h) {
            Img.width=width;
            Img.height=image.height/w;}else{
			Img.height=height;
            Img.width=image.width/h;}}}
			
