var notify_title_color=0;
var notify_title_acton=null;
var notify_lastScrollX = 0;
var notify_lastScrollY = 0;
var notify_min_left=-164;
var notify_max_left=0;
var notify_out_ing=false;
var notify_in_ing=false;
function Notify_AddItem(text,num,url)
{
	var cssName = ((url=='' || url==null)?"itemTr":"itemSelectTr");
	var newrow = document.getElementById("notify_docInfo").insertRow();
	var newcell = newrow.insertCell(0);
	newcell.className = cssName;
	newcell.innerText = text;
	newcell.width='80%';
	newcell = newrow.insertCell(1);
	newcell.className = cssName;
	newcell.innerText = num;
	newcell.width='20%';
	if(url!='')newrow.onclick=function(){window.location=url};
}

function Notify_AddUserInfo(info)
{
	var newrow = document.getElementById("notify_userInfo").insertRow();
	var newcell = newrow.insertCell(0);
	newcell.className="itemTr";
	newcell.innerHTML=info;
}
function Notify_SetUserName(text)
{
	document.getElementById("notify_title").innerHTML=text;
}
function Notify_ChangeContent(isDocInfo)
{
	if(isDocInfo){
		document.getElementById("notify_docTr").style.display="";
		document.getElementById("notify_userTr").style.display="none";
	}else{
		document.getElementById("notify_docTr").style.display="none";
		document.getElementById("notify_userTr").style.display="";
	}
}
function Notify_SetFlash(isFlash)
{
	if(isFlash==null || isFlash)
		notify_title_acton=setInterval('Notify_Flash()',500);
	else if(notify_title_acton!=null){
		clearInterval(notify_title_acton);
		document.getElementById("notify_title").style.color="#FFFFFF";
	}
}
function Notify_Flash()
{
	if(notify_title_color==0){
		document.getElementById("notify_title").style.color="#00FF00";
		notify_title_color=1;
	}else if(notify_title_color==1){
		document.getElementById("notify_title").style.color="#FFFFFF";
		notify_title_color=0;
	}
}
function Notify_HeartBeat()
{
  var diffY = document.body.scrollTop;
  var diffX = document.body.scrollLeft;
  if(diffY != notify_lastScrollY) {
    percent = .1 * (diffY - notify_lastScrollY);
    if(percent > 0) percent = Math.ceil(percent);
    else percent = Math.floor(percent);
    document.all.notify_floater.style.pixelTop += percent;
    notify_lastScrollY = notify_lastScrollY + percent;
  }
  if(diffX != notify_lastScrollX) {
     percent = .1 * (diffX - notify_lastScrollX);
     if(percent > 0) percent = Math.ceil(percent);
     else percent = Math.floor(percent);
     document.all.notify_floater.style.pixelLeft += percent;
     notify_lastScrollX = notify_lastScrollX + percent;
  }    
}
function Notify_SetPos(isOut)
{
	var obj = document.getElementById("notify_floater");
	var currLeft=obj.style.pixelLeft;
	var speed=0.1;
	var percent;
	if(isOut && currLeft<=notify_max_left && !notify_in_ing){
		notify_out_ing=true;
		percent = speed * (notify_max_left-obj.style.pixelLeft);
		if(percent > 0) percent = Math.ceil(percent);
		else percent = Math.floor(percent);
		obj.style.pixelLeft+=percent;
		if(percent!=0){setTimeout('Notify_SetPos(true)',1);;Notify_SetArrow(true);}
		else notify_out_ing=false;
	}
	if(!isOut && currLeft>=notify_min_left && !notify_out_ing){
		notify_in_ing=true;
		percent = speed * (notify_min_left-obj.style.pixelLeft);
		if(percent > 0) percent = Math.ceil(percent);
		else percent = Math.floor(percent);
		obj.style.pixelLeft+=percent;
		if(percent!=0){setTimeout('Notify_SetPos(false)',1);Notify_SetArrow(false);}
		else notify_in_ing=false;
	}
	return true;
}
function Notify_ClickTitle()
{
	var obj = document.getElementById("notify_floater");
	if(obj.style.pixelLeft>=0)Notify_SetPos(false);
	else Notify_SetPos(true);
}
function Notify_SetArrow(isOut)
{
	var obj1=document.getElementById("notify_arrow");
	//var obj2=document.getElementById("notify_arrow2");
	if(isOut){
		obj1.innerText = "l";
		//obj2.style.filter = "flipH()";
	}else{
		obj1.innerText = "m";
		//obj2.style.filter = "";
	}
}
function Notify_SetInitPos()
{
	document.getElementById("notify_floater").style.pixelLeft = notify_min_left;
	document.getElementById("notify_floater").style.pixelTop = parseInt(document.body.clientHeight)/3;
}
window.setInterval("Notify_HeartBeat()",1);

