jQuery(function($) {
	//搜索框
	var keyWord = $("input#s");
	if (keyWord.val().length >= 1 ) keyWord.prev("label").hide();
	keyWord.focus(function(){ keyWord.prev("label").hide(); })
	keyWord.blur(function(){
		if (keyWord.val() == "") {
			keyWord.val("");
			keyWord.prev("label").show();
		}
	})
	//主菜单下拉
	$("#nav li").hover(
		function () { $(this).children("ul").slideDown(100); },
		function () { $(this).children("ul").slideUp(100); }
	);

  //附件图标
　$(".zwbeta a[href$=.doc]").addClass("doc");
  $(".zwbeta a[href$=.exe]").addClass("exe");
  $(".zwbeta a[href$=.xls]").addClass("xls");
  $(".zwbeta a[href$=.pdf]").addClass("pdf");
  $(".zwbeta a[href$=.ppt]").addClass("ppt");
  $(".zwbeta a[href$=.rar]").addClass("rar");
  $(".zwbeta a[href$=.swf]").addClass("swf");
  $(".zwbeta a[href$=.txt]").addClass("txt");
  $(".zwbeta a[href$=.mp3], .zwbeta a[href$=.wma],.zwbeta a[href$=.flv]").addClass("music");
  $(".zwbeta a[href$=.zip], .zwbeta a[href$=.7z]").addClass("zip"); 
  $(".zwbeta a[href^=http://www.rayfile.com]").addClass("rayfile"); 
  $(".zwbeta a[href^=http://www.dbank.com]").addClass("dbank");  
  $(".zwbeta a[href^=http://d.namipan.com]").addClass("nami"); 
  $(".zwbeta a[href^=http://u.115.com]").addClass("115wp"); 
  $(".zwbeta a[href^=qvod://]").addClass("qvod");
  $(".zwbeta a[href^=thunder://]").addClass("thunder");  
  $(".zwbeta a[href^=Flashget://]").addClass("Flashget");  
  $(".zwbeta a[href^=qqdl://]").addClass("cjxf");  
  $(".zwbeta a[href^=ed2k://]").addClass("ed2k"); 
	//赞助我
	$("#sponsor").html($("#sponsor-me").attr("title"));
	$("#sponsor-me").attr("title","");
	$("#sponsor-me").hover(
		function () {
			$("#sponsor").slideDown(200);
			$("#sponsor").attr("style","display:block;");//这一行是为了解决 jQuery IE8 bug
		},
		function () { $("#sponsor").fadeOut(200); }
	);
	//页面载入中...
  $('.list em a , .list li a , #contentWz li a ').click(function(){
    $(this).text('页面载入中……');
    window.location = $(this).attr('href');
    });
	//列表隔行换色
	$(".list li:odd").addClass("odd");

	//初始化选项卡
	$("#choice ul:first").idTabs();
	$("#side-cmt ul:first").idTabs();
	$("#column-nav ul:first").idTabs();


	//鼠标经过tips效果
	$("#container a").mouseover(function(tips){
		this.tipsTxt = this.title;
		this.tipsTxt = (this.tipsTxt.length>50?this.tipsTxt.toString().substring(0,50)+"...":this.tipsTxt);
		if (this.tipsTxt){
				this.tipsUrl = this.href;
				this.title = "";
				var tips = "<div id='tips'><p>"+this.tipsTxt+"</p><p><em>"+this.tipsUrl+"</em>"+"</p></div>";
				$('body').append(tips);
				$('#tips').css({"opacity":"0.8"})
			}
		}).mouseout(function(){
			this.title=this.tipsTxt;
			$('#tips').remove()
		}).mousemove(function(tip){
			$('#tips').css({"top":(tip.pageY+22)+"px","left":(tip.pageX-10)+"px"
		});
	});
	//鼠标经过tips效果结束
	//滑动到顶部
	$('#to-top').click(function() { $('html,body').animate({ scrollTop: 0 }, 1000); }); 
});
//响应框输入字数统计
$(function(){
    var $comment = $('#txaArticle');
    var $str  =  $('#str');
    var time;
    $comment.focus(function(){
        time = window.setInterval( substring,100 );
    });   
    function substring() {
        var val = $comment.val();
        var length = val.length;
        if( $str.html() != (length) ){
            if(length==0){
                $("#wordcount")[0].firstChild.nodeValue = "您已输入0";
                $str.html(length);
            }else{
                $("#wordcount")[0].firstChild.nodeValue = "您已输入";
                $str.html(length);
            }
        }
    }
});
//闪动联系我
function showContact() {
	for (i = 0; i < 5; i++) {
		$("#contact").fadeOut(200);
		$("#contact").fadeIn(100);
	}
}

