// JavaScript Document

function $(obj){return document.getElementById(obj);}
var _pdiv;
var _time;
var _step=2;

function AutoHeight()
{
	try
	{
		if($("profile_right").offsetHeight<$("profile").offsetHeight)
			$("profile_right").style.height=$("profile").offsetHeight+"px";
	}catch(e){}
	PTdiv();
}

function PTdiv()
{
	_pdiv=document.createElement("div");
	_pdiv.className="pdiv";
	_pdiv.onmouseover=function(){stopHide();}
	_pdiv.onmouseout=function(){startHide();}
	document.body.appendChild(_pdiv);
}

function Ajax()
{
	var _req = !!0;
	try{_req=new XMLHttpRequest;}catch(e){try {_req=new ActiveXObject("MSXML2.XMLHTTP");}catch(e2){try {_req=new ActiveXObject("Microsoft.XMLHTTP");}catch(e3){_req=false;}}}
	if (!_req) return;
	this.send = function(_url,_content,_callback,_method,_isasync)
	{
		var Url      = _url||"";
		var Content  = _content||"";
		var Callback = _callback;
		var Method   = _method||"GET";
		var IsAsync  = _isasync==null?true:_isasync;
		_req.open (Method,Url,IsAsync);
		if(Method=="POST")_req.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		_req.onreadystatechange = function()
		{
			if(_req.readyState==4&&Callback)
			{
				Callback(_req.status==200?_req:null);
			}
		};
		_req.send(Method=="POST"?Content:"");
	}
	this.get = function(_url,_callback)
	{
		this.send(_url,"",_callback,"GET");
	}
	this.post = function(_url,_content,_callback)
	{
		this.send(_url,_content,_callback,"POST");
	}
}

function setMenu(id)
{
	stopHide();
	var ajax=new Ajax();
	_pdiv.style.left=event.clientX+10+"px";
	_pdiv.style.top=event.clientY+document.documentElement.scrollTop+10+"px";
	ajax.get("PList.asp?id="+id+"&r="+Math.random(),showMenu);
}

function showMenu(e)
{
	_data=e.responseText;
	if(_data=="")
	{
		_pdiv.style.display="none";
		return;
	}
	_pdiv.innerHTML=_data;
	_pdiv.style.display="block";
	
}

function startHide()
{
	_time=setTimeout(hideMenu,5000);
}

function stopHide()
{
	clearTimeout(_time);
}

function hideMenu()
{
	_pdiv.style.display="none";
}

function scrollDiv()
{
	var obj=$("PList");
	obj.scrollLeft+=_step;
	if(obj.scrollLeft>=250 || obj.scrollLeft<=0)
		_step=-_step;
}
