function autoimg(){
    var imgwidth=$('.imgauto').width(),
    //设定初始值
    width=100,
    height=100,
    bili=width/height,
    nn=imgwidth/bili;
   // if (imghight>nn){
        $('.imgauto').attr("height",nn+"px");
       // $('.imgauto').attr("width",nn*bili+"px");
   // }
}
function tBox(){
	//h = $(window).height();
	var t = $(document).scrollTop();
	if(t > 150){
		$(".tbox").fadeIn(300);
	}else{
		$(".tbox").fadeOut(300);
	}
}
function AddFavorite(){
var title = window.parent.document.title;
var url = window.parent.location;
                var ua = navigator.userAgent.toLowerCase();
                if (ua.indexOf("msie 8") > -1) {
                    external.AddToFavoritesBar(url, title, ''); //IE8
                } else {
                    try {
                        window.external.addFavorite(url, title);
                    } catch (e) {
                        try {
                            window.sidebar.addPanel(title, url, ""); //firefox
                        } catch (e) {
                            alert("加入收藏失败，请使用Ctrl+D进行添加");
                        }
                    }
                }
            return false;
}
function SetHome(url) {
	if (document.all) {
		document.body.style.behavior = 'url(#default#homepage)';
		document.body.setHomePage(url);
	} else {
		alert("操作失败，请您手动在浏览器里设置!");
	}
}

$(function(){	
	$('.tab-tle .tab-item').bind('mouseenter mouseleave',function(){
		$('.tab-tle .tab-item .data_detail').hide();
		$(this).find(".data_detail").show();
		$(this).siblings().removeClass('cur').end().addClass('cur');
		$(this).parent().next('.tab-tcon').find('.tab-item').hide().eq($(this).index()).show();	
	}).eq(0).trigger('mouseenter');
	
	$(".img-info").live('mouseover',function(){
		$(this).find(".img-title").stop(true).animate({bottom:0},'fast');									
	}).live('mouseout',function(){
		$(this).find(".img-title").stop(true).animate({bottom:-25},'fast');									
	});
	
	$(".prolist ul li").bind('mouseover',function(){
		$(this).find(".img-l").stop(true).animate({right:0});									
	}).bind('mouseout',function(){
		$(this).find(".img-l").stop(true).animate({right:-500});									
	});
	
	/*$("#main-nav li").hover(function(){
		var $subMenu=$(this).find(".sub-menu");
		if($subMenu.length){
			$(this).find(".m1").toggleClass("mover");
			$subMenu.toggle();
		}
	});*/
	var $subMenu;
	$("#main-nav .nav-item").hover(function(){
			$subMenu=$(this).find(".sub-menu");
			if($subMenu.length){
				$(this).find(".m1").addClass("mover");
				$subMenu.show();
			}
		},function(){
			if($subMenu.length){
				$(this).find(".m1").removeClass("mover");
				$subMenu.hide();
			}
	});
	$("#gotop").click(function(){
		$(document).scrollTop(0);	
	})
	$(window).scroll(function(e){
		tBox();		
	})
	
	$("#keywords").focus(function(e){
		$("#keywords_prompt").hide();
	}).blur(function(e){$("#keywords_prompt").show();});
});