var inputtime = 0;
var blinkswitch = 0;
var blinktitle = document.title;
var blinkid = 0;
getHdCookie = function(name){
	var arr = document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));
	if(arr != null) return unescape(arr[2]); return null;
}
function blinkNewMsg(){var now = new Date();var nowtime = now.getTime();if(nowtime - inputtime > 5000){document.title = blinkswitch % 2 ? "【　　　】 - "+blinktitle  : "【新消息】 - "+blinktitle ;}blinkswitch++;}


function stopBlinkNewMsg()
{
	
		clearInterval(blinkid);
		//blinkid = 0;
		document.title = blinktitle;
  
}

loadLogin=function(logintype,tagid)
{	
	if(tagid !=null)
	{
		var ele=document.getElementById(tagid);
		if(ele!=null&&ele!="undefined")
		{
			if(getHdCookie ('hduser')==null){
			ele.innerHTML="<li><a href=\"http://service.hudong.com/\" target=\"_blank\" >帮助</a></li><li><a href=\"http://www.hudong.com/tour/tour_1.html\" target=\"_blank\" >快速了解</a>|</li><li></a><a href=\"http://www.hudong.com/user/register/userRegister.jsp\">注册</a>|</li><li><a href=\"http://www.hudong.com/user/login/userLogin.jsp\" onclick=\"var date=new Date();date.setTime(date.getTime()+24*3600*1000);document.cookie=\'nextURL=\'+encodeURIComponent(document.location.href)+\';expire=\'+date.toGMTString()+\';path=/;domain=.hudong.com;\'\" >登录</a>|</li>";
			}else{
				if(logintype!='0')
				{
					logintype=logintype || (document.getElementById('logintype')==null?1:document.getElementById('logintype').value);
				}else
				{
					logintype=0;
				}
				if(document.getElementById('commonLoginAction')!=null){
					document.getElementById('commonLoginAction').parentNode.removeChild(document.getElementById('commonLoginAction'));
				}
				var head=document.getElementsByTagName('head').item(0); 
				var script=document.createElement('script'); 
				var usermsg = document.getElementById('usermsgcnt');
				var usermsgcnt=(usermsg==null?'0':usermsg.value);
				script.src='http://apps.hudong.com/commonlogin.wiki?Action=showLoginPage&type='+logintype+'&tagId='+tagid+'&usermsgcnt='+usermsgcnt+'&t='+Math.random(); 
				script.type='text/javascript';
				script.id="commonLoginAction";
				head.appendChild(script);
			}
		}
		
	}
	if(logintype=='1'&&logintype!=null)
	{
		setTimeout('loadLogin('+logintype+',"'+tagid+'")', 30000);
	}
	
}

