// JavaScript Document
function AutoScroll(obj){
        $(obj).find("ul:first").animate({
                marginTop:"-20px"
        },500,function(){
                $(this).css({marginTop:"0px"}).find("li:first").appendTo(this);
        });
}
$(document).ready(function(){
setInterval('AutoScroll("#tnotice")',3000)
});
function stmenu(a,c,act){
	
	var n;
	var m;
	var tm;
	var navlist;
	for(var i=1;i<=9;i++){
	   tm ="tjmenu"+i;
	   n = document.getElementById(tm);
	   tmlist="tjsite"+i;
	   m=document.getElementById(tmlist);
	   if(tm != a){	   	 
		 n.className="tjma";
		 m.style.display = "none";
	   }else{		
		n.className="tjmhover";
		m.style.display = "block";
	   }
	 }
	 var xmlHttp = createXMLHttpRequest();
	 var url="ajax.php?st="+act;
	 url=encodeURI(encodeURI(url));
	 xmlHttp.open("GET",url,true);
	 xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	 xmlHttp.onreadystatechange = function(){
	    if (xmlHttp.readyState<4){
		   document.getElementById(c).innerHTML ="<div id='loading'>数据载入中......</div>";
		}
		if(xmlHttp.readyState == 4 && xmlHttp.status == 200){
			document.getElementById(c).innerHTML =unescape(xmlHttp.responseText);
		}
	}
	xmlHttp.send(null);
}
function closetop(){
	document.getElementById("htop").style.display='none';
	document.getElementById("banner").style.marginTop='6px';
}
function Comparetime(temper){
 var str;
 var nowtime=new Date(nowdatetime.replace(/-/,"/")); 
 var ctime = new Date(temper.replace(/-/,"/"));
   if(nowtime>ctime){
	   return false;
   }else{
	   return true;
   }
}
function createXMLHttpRequest(){
var ret = null;
try {ret = new ActiveXObject('Msxml2.XMLHTTP')}
catch (e) {
try {ret = new ActiveXObject('Microsoft.XMLHTTP')}
        catch (ee) {ret = null}
}
if (!ret&&typeof XMLHttpRequest !='undefined') ret = new XMLHttpRequest();
return ret;
}
function showlayer(a){
	 var n;
	 var f;
	 var timeid;
	 var urlclass;
	 for(var i=1;i<=2;i++){
	   timeid ="kaitime"+i;
	   n = document.getElementById(timeid);
	   urlclass="urlclass"+i;
	   f=document.getElementById(urlclass);
	   if(timeid != a){
	   	 n.style.display = "none";
		 f.className="icptw";
	   }else{
		n.style.display = "block";
		f.className="icptw icphv";
	   }
	 }
}
function postDigg(ftype,aid){
	 var xmlHttp = createXMLHttpRequest();
	 var url="digg_ajax.php?action="+ftype+"&id="+aid+'&time='+Date.parse(new Date());
	 xmlHttp.open("GET",url,true);
	 xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	 xmlHttp.onreadystatechange = function(){
	  if(xmlHttp.readyState == 4 && xmlHttp.status == 200){
			if(xmlHttp.responseText=="1"){
			   alert("您已经投过票了！");	
			}else{		   
				document.getElementById("newdigg").innerHTML =unescape(xmlHttp.responseText);
			}
	  }
	}
	xmlHttp.send(null);
}
function copyToClipBoard() {
    var clipBoardContent = "";
    clipBoardContent += this.location.href;
    window.clipboardData.setData("Text", clipBoardContent);
    alert("复制成功，请粘贴到你的QQ/MSN上推荐给你的好友！");
}
function shownav(a,d,c){
	var tm,tn;
	var m,n;
	for(var i=0;i<=c;i++){	   	
	   tn ="nav"+i;
	   n = document.getElementById(tn);
	   tm="menu"+i;
	   m = document.getElementById(tm);
	   if(tn != a){	 
		 n.style.display = "none";
		 m.className='';
	   }else{	
		 n.style.display = "block";
		 m.className='cur';
	   }
	 }
}
function showls(a){
	 var m,n;
	 var mmenu,nlist;
	 for(var i=1;i<=2;i++){
	   mmenu ="lsmenu"+i;
	   m = document.getElementById(mmenu);
	   nlist="ilslist"+i;
	   n=document.getElementById(nlist);
	   if(mmenu != a){
	   	 n.style.display = "none";
		 m.className="";
	   }else{
		 n.style.display = "block";
		 m.className="lshover";
	   }
	 }
}

function htmlbody() {
    return (
document.documentElement.clientHeight <= document.body.clientHeight

&& document.documentElement.clientHeight != 0
)
? document.documentElement : document.body;
}
function scrollLeft() { return (!window.pageYOffset) ? htmlbody().scrollLeft : window.pageXOffset; }
function scrollTop() { return (!window.innerHeight) ? htmlbody().scrollTop : window.pageYOffset; }

function getleft(strobjs, strLeftType, strleft) {
    var temp_getleft = 0;
    if (strLeftType == "left") {
        temp_getleft = scrollLeft() * 1 + strleft * 1;
    } else if (strLeftType == "mid") {
        (strleft * 1 < 0)
		? temp_getleft = scrollLeft() * 1 + strleft * 1
		+ htmlbody().clientWidth * 1 / 2 - strobjs.offsetWidth * 1
		: temp_getleft = (scrollLeft() * 1 + strleft * 1 + htmlbody().clientWidth * 1 / 2);
    } else if (strLeftType == "right") {
        temp_getleft
			= scrollLeft() * 1 + htmlbody().clientWidth * 1
			- strleft * 1 - strobjs.offsetWidth * 1;
    }
    return temp_getleft;
}
function moveTips(strobj, theTop, theLeft, theLeftType) {
    var D = new Function('obj', 'return document.getElementById(obj);');
    var old, nowobj = D(strobj);
    var nowleft = nowobj.style.left.replace("px", "") * 1;
    var temp_left = getleft(nowobj, theLeftType, theLeft);
    var re_theTop = theTop;
    if (temp_left != nowleft) {
        (Math.abs(temp_left - nowleft) > 3 && Math.abs(temp_left - nowleft) < 600)
		? ((temp_left > nowleft) ? nowleft += Math.abs(temp_left - nowleft) / 5
		: nowleft -= Math.abs(temp_left - nowleft) / 5)
		: nowleft = temp_left;
        nowobj.style.left = nowleft + "px";
    }
    if (!openweb) { old = re_theTop; var openweb; };
    var pos, tt = 50;
    pos = scrollTop() * 1 - nowobj.offsetTop * 1 + re_theTop * 1;
    pos = nowobj.offsetTop + pos / 10;
    if (pos < re_theTop) pos = re_theTop;
    if (pos != old) { nowobj.style.top = pos + "px"; tt = 5; }
    old = pos;
    setTimeout("moveTips('" + strobj + "','" + theTop + "','" + theLeft + "','" + theLeftType + "')", tt);
}
