
//.ready 等dom完全载入再执行，相当于放到body结束后，以确保找到元素
$(document).ready(function() {

    //主菜单
    $("#menu li").prepend("<span></span>"); //Throws an empty span tag right before the a tag

	$("#menu li").each(function() { //For each list item...
		var linkText = $(this).find("a").html(); //Find the text inside of the a tag
		$(this).find("span").show().html(linkText); //Add the text in the span tag
	}); 

	$("#menu li").hover(function() {	//On hover...
		$(this).find("span").stop().animate({ 
			marginTop: "-40" //Find the span tag and move it up 40 pixels
		}, 250);
	} , function() { //On hover out...

	$(this).find("span").stop().animate({
			marginTop: "0" //Move the span back to its original state (0px)
		}, 250);
	});	
});


//公告
function notice(){
    var box=document.getElementById("notice"),can=true;
    box.innerHTML+=box.innerHTML;
    box.onmouseover=function(){can=false};
    box.onmouseout=function(){can=true};
    new function (){
        var stop=box.scrollTop%18==0&&!can;
        if(!stop)box.scrollTop==parseInt(box.scrollHeight/2)?box.scrollTop=0:box.scrollTop++;
        setTimeout(arguments.callee,box.scrollTop%18?10:1500);
    };
}


//Card List
function nTabs(thisObj,Num){
    if(thisObj.className == "active") return;
    
    var tabObj = thisObj.parentNode.id;
    var tablist = document.getElementById(tabObj).getElementsByTagName("li");

    for(i=0; i <tablist.length; i++)
    {
        if (i == Num)
        {
            thisObj.className = "active"; 
            document.getElementById(tabObj+"_Content"+i).style.display = "block";
        }else{
            tablist[i].className = "normal"; 
            document.getElementById(tabObj+"_Content"+i).style.display = "none";
        }
    } 
}
