document.write('<div id="tagsmsgbox"></div>');
var ifshow=0;
var settimeoutshowtagsmsgbox=null;
var scroll_newsint=null;
var eventx=0;
var eventy=0;
var ifscroll=1;
var isshow=0;
var ifload=0;
var curtagid=null;
function fetchOffset(obj) {
var left_offset = obj.offsetLeft;
var top_offset = obj.offsetTop;
while((obj = obj.offsetParent) != null) {
  left_offset += obj.offsetLeft;
  top_offset += obj.offsetTop;
}
return { 'left' : left_offset, 'top' : top_offset };
}

function scroll_news(){ 
 $(function(){
	//if($("#tagsmsgbox").css("display")=="none")return false;
	var firstNode = $('#tagsscorllnews/li');
	if(typeof(firstNode)=="undefined")return false;
	firstNode.eq(0).fadeOut(1000,function(){                   
		   //$(this).clone().appendTo($(this).parent()).show('fast'); 
		   $(this).clone().appendTo($(this).parent()).fadeIn('slow');
		   $(this).remove(); 
		   if($("div.setheight").css("color")=="#FF9900"){
			   $("div.setheight").css("color","#FFCC00");
			   }else{
				   $("div.setheight").css("color","#FF9900");
				   }
	});
  }); 
 if(ifshow&&ifscroll)scroll_newsint=setTimeout("scroll_news()",2000);
} 
function hidetagsmsgbox(){
	 ifload=0;
	 if(!ifshow&&$("#tagsmsgbox").css("display")=="block"){
		 $("#tagsmsgbox").slideUp("slow");
		 if(settimeoutshowtagsmsgbox)clearTimeout(settimeoutshowtagsmsgbox);
		 if(scroll_newsint)clearTimeout(scroll_newsint);
		 }
	}
function showtagsmsgbox(){
	if(ifshow&&$("#tagsmsgbox").css("display")!="block")$("#tagsmsgbox").slideDown("slow");
	}
function searchnews(tagid){
	if(!ifload)return false;
    $("#tagsmsgbox").load("/inc/hottag.php?objid=0&tagid="+tagid,"",function(){
																							   $("#tagsmsgbox").slideDown(500);
																							    curtagid=tagid;
																								$("#tagsscorllnews//a").mouseover(function(){
																								ifshow=1;
																								ifscroll=0;
																								clearTimeout(scroll_newsint);
																								
																								})
																								$("#tagsscorllnews//a").mouseout(function(){
																								ifscroll=1;
																								scroll_newsint=setTimeout("scroll_news()",1000);})
                                                                                               $("#tagsmsgbox//.setheight").click(function(){
																																		  if($("#tagsscorllnews").get(0).className=="close"){
																																			  $("#tagsscorllnews").get(0).className="open";
																																			  $(this).html("&#53;");
																																			  $(this).attr("title","收拢");
																																			  }else{
																																				  $("#tagsscorllnews").get(0).className="close";
																																				  $(this).html("&#54;");
																																				  $(this).attr("title","全部展开");
																																				  }

																	  });					
																							 $("#tagsmsgbox").corner("tl tr 10px");
																			                 //$("#tagsscorllnews").corner("5px");
																							    if(scroll_newsint)clearTimeout(scroll_newsint);
																							    if($("#tagsscorllnews").html()!="")scroll_newsint=setTimeout("scroll_news()",1000);
																							   });
	}
$(".hottags").mouseover(function(){
								ifshow=1;
								var tagid=parseInt($(this).attr("urn"));
								if(typeof(tagid)=="undefined")return false;
								if(ie){ 
									eventx=documentobj.scrollLeft+event.clientX;
									eventy=documentobj.scrollTop+event.clientY+20;
									}else{ 
									eventx=window.pageXOffset+event.clientX; 
									eventy=window.pageYOffset+event.clientY; 
                                  }
								$("#tagsmsgbox").css({left:eventx+"px"});
								$("#tagsmsgbox").css({top:eventy+"px"});
								showtagsmsgbox();
								if(tagid!=curtagid){
										if(scroll_newsint)clearTimeout(scroll_newsint);
										$("#tagsmsgbox").html("正在搜索相关新闻……请稍后!");
										ifload=1;
										if(settimeoutshowtagsmsgbox)clearTimeout(settimeoutshowtagsmsgbox);
								        settimeoutshowtagsmsgbox=setTimeout("searchnews("+tagid+")",200);
								        }else{
											scroll_newsint=setTimeout("scroll_news()",2000);
											}
								})
$(".hottags").mouseout(function(){
								ifshow=0;
								setTimeout("hidetagsmsgbox()",500);	
								});
$("#tagsmsgbox").mouseover(function(){
								   ifshow=1;
								   })
$("#tagsmsgbox").mouseout(function(){
								   ifshow=0;setTimeout("hidetagsmsgbox()",500);	
                                  })

