try{
	var thisDoc = top.document; //最顶层的页面
	var interTitle; //变换标题的计时器
	var titleFlag = true; //用于切换标题
	var oldTitle = thisDoc.title;
	var cWindow = null;
	top.aWindow = self;
	
	top.CloseMsgBox = function(obj,boxId){
		var d;
		top.aWindow.cWindow.document.getElementById("noticeW").src = "http://personal.120ask.com/notice/d.html?boxId="+boxId;
		RestoreTitle();
		if(window.ActiveXObject)
		{
			obj.detachEvent('onclick',RestoreTitle);
			//d = d || top.aWindow.document.createElement('div');   
			//d.appendChild(obj);   
			//d.innerHTML = '';
			obj.parentNode.removeChild(obj);
			obj.removeNode();
			
		}
		else
		{	
			obj.removeEventListener('click',RestoreTitle,false);
			obj.parentNode.removeChild(obj);
		}
	}
}
catch(e)
{
	//跨域
}

function CreateMsgBox(msgTitle,msgCont,msgLink,msgId,boxId){
	if(!msgTitle || !msgLink)
		return;
	if(thisDoc.readyState == "complete" || !thisDoc.readyState)
	{
		;
	}
	else
	{
		setTimeout(function(){CreateMsgBox(msgTitle,msgCont,msgLink,msgId,boxId);},1000);
	}

	var msgBox = thisDoc.createElement("div");
	var msgTitleBox;
	var msgContBox;
	msgBox.setAttribute("id","NewMsgBox"+boxId);
	msgBox.style.cssText = "z-index:"+(100-parseInt(boxId))+";overflow:hidden;text-align:center;width:281px;height:0px;font-size:12px;bottom:"+(parseInt(boxId))*27+"px;right:1px;position:fixed;_position:absolute; _margin-top:expression(document.documentElement.clientHeight-this.style.pixelHeight+document.documentElement.scrollTop);";
	if (msgCont != "")
	{
		msgTitleBox = '<div style="float:left;width:200px;height:18px;line-height:18px;padding-top:7px;text-align:left;font-weight:bold;margin-left:30px!important;margin-left:15px;overflow:hidden;"><a href="'+msgLink+'" target="_blank" onClick="CloseMsgBox(this.parentNode.parentNode.parentNode,'+boxId+')" style="font-size:12px;color:#333;text-decoration:none;">'+msgTitle+'</a></div><div style="float:right;width:33px;height:22px;margin-right:6px;cursor:pointer;" onClick="CloseMsgBox(this.parentNode.parentNode,'+boxId+')"></div>';
		msgContBox = '<div style="background:url(http://www.120ask.com/notice/img/bg.gif) repeat-x left bottom #fff;border:1px solid #5e8611;height:148px;"><div style="padding:12px;padding-right:6px;height:94px;overflow:hidden;"><p style="padding:0;margin:0;color:#2f4701;font-weight:bold;text-align:left;font-size:12px;">尊敬的会员您好：</p><p style="padding:0;padding-top:5px;margin:0;color:#2b3e06;text-align:left;font-size:12px;line-height:14px;">&nbsp;&nbsp;&nbsp;&nbsp;<a href="'+msgLink+'" target="_blank" onClick="CloseMsgBox(this.parentNode.parentNode.parentNode.parentNode.parentNode,'+boxId+')" style="font-size:12px;color:#2b3e06;text-decoration:none;">'+msgCont+'</a></p></div><div style="background:url(http://www.120ask.com/notice/img/line.gif) no-repeat center top;height:30px;line-height:30px;text-align:right;padding-right:25px;"><a href="'+msgLink+'" target="_blank" onClick="CloseMsgBox(this.parentNode.parentNode.parentNode.parentNode,'+boxId+')" style="color:#2f4701;font-size:12px;text-decoration:none;">查看>></a></div></div>';
		
	}
	else
	{
		msgTitleBox = '<div style="float:left;width:200px;height:18px;line-height:18px;padding-top:7px;text-align:left;font-weight:bold;margin-left:30px!important;margin-left:15px;overflow:hidden;"><a href="'+msgLink+'" target="_blank" onClick="CloseMsgBox(this.parentNode.parentNode.parentNode,'+boxId+')" style="font-size:12px;color:#333;text-decoration:none;">您有新的消息</a></div><div style="float:right;width:33px;height:22px;margin-right:6px;cursor:pointer;" onClick="CloseMsgBox(this.parentNode.parentNode,'+boxId+')"></div>';
		msgContBox = '<div style="background:url(http://www.120ask.com/notice/img/bg.gif) repeat-x left bottom #fff;border:1px solid #5e8611;height:148px;"><div style="padding:12px;padding-right:6px;height:94px;overflow:hidden;"><p style="padding:0;margin:0;color:#2f4701;font-weight:bold;text-align:left;font-size:12px;">尊敬的会员您好：</p><p style="padding:0;padding-top:5px;margin:0;color:#2b3e06;text-align:center;font-size:12px;line-height:14px;">您有一条新的消息，请点击查看<br /><a href="'+msgLink+'" target="_blank" onClick="CloseMsgBox(this.parentNode.parentNode.parentNode.parentNode.parentNode,'+boxId+')" style="font-size:12px;color:blue;text-decoration:underline;">'+msgTitle+ '</a></p></div><div style="background:url(http://www.120ask.com/notice/img/line.gif) no-repeat center top;height:30px;line-height:30px;text-align:right;padding-right:25px;"><a href="'+msgLink+'" target="_blank" onClick="CloseMsgBox(this.parentNode.parentNode.parentNode.parentNode,'+boxId+')" style="color:#2f4701;font-size:12px;text-decoration:none;">查看>></a></div></div>';
	}
	msgBox.innerHTML='<div style="background:url(http://www.120ask.com/notice/img/title.gif) no-repeat;width:281px;height:27px;overflow:hidden;;">'+msgTitleBox+'<div style="clear:both;font-size:0;height:0;"></div></div><div style="border:1px solid #5e8611;border-top:none;padding:1px;padding-top:0px;background:#b5fa2d;height:150px;">'+msgContBox+'</div>';
	thisDoc.body.appendChild(msgBox);
	RestoreTitle();
	interTitle = setInterval(function(){
		if(titleFlag)
		{
			thisDoc.title = "您有新的消息";
		}
		else
		{
			thisDoc.title = oldTitle;
		}
		titleFlag = !titleFlag;
	},1000)
	if(window.ActiveXObject)
	{
		thisDoc.getElementById("NewMsgBox"+boxId).attachEvent('onclick',RestoreTitle);
	}
	else
	{	
		thisDoc.getElementById("NewMsgBox"+boxId).addEventListener('click',RestoreTitle,false);
	}
	setTimeout(function(){ShowMsgBox(thisDoc.getElementById("NewMsgBox"+boxId))},100);
}

function ShowMsgBox(msgBox){
	var aa = setInterval(function(){
		if (parseInt(msgBox.style.height) >= 177)
		{
			msgBox.style.height = "179px";
			clearInterval(aa);
		}
		else
		{
			msgBox.style.height = (parseInt(msgBox.style.height)+3)+"px";
		}
	},40);
}



function RestoreTitle()
{
	clearInterval(interTitle);
	thisDoc.title = oldTitle;
}
