/* x_win.js compiled from X 4.0 with XC 0.27b. Distributed by GNU LGPL. For copyrights, license, documentation and more visit Cross-Browser.com */
function xWinClass(clsName, winName, w, h, x, y, loc, men, res, scr, sta, too)
{
	var thisObj = this;
	var e='',c=',',xf='left=',yf='top='; 
	this.n = name;
	if (document.layers) 
	{
		xf='screenX='; 
		yf='screenY=';
	}
	
	this.f = (w?'width='+w+c:e)+(h?'height='+h+c:e)+(x>=0?xf+x+c:e)+(y>=0?yf+y+c:e)+'location='+loc+',menubar='+men+',resizable='+res+',scrollbars='+scr+',status='+sta+',toolbar='+too;
	this.opened = function() {return this.w && !this.w.closed;};
	this.close = function() {if(this.opened()) this.w.close();};
	this.focus = function() {if(this.opened()) this.w.focus();};
	this.load = function(sUrl) 
				{
					if (this.opened()) 
						this.w.location.href = sUrl;
					else 
						this.w = window.open(sUrl,this.n,this.f);
					this.focus();
					return false;
				};
	
	function onClick() 
	{
		return thisObj.load(this.href);
	}

	xGetElementsByClassName(clsName, document, '*', bindOnClick);

	function bindOnClick(e) 
	{
		e.onclick = onClick;
	}
}

function xWindow(name, w, h, x, y, loc, men, res, scr, sta, too)
{
	var e='',c=',',xf='left=',yf='top='; 
	this.n = name;
	if (document.layers) 
	{
		xf='screenX='; 
		yf='screenY=';
	}
	this.f = (w?'width='+w+c:e)+(h?'height='+h+c:e)+(x>=0?xf+x+c:e)+(y>=0?yf+y+c:e)+'location='+loc+',menubar='+men+',resizable='+res+',scrollbars='+scr+',status='+sta+',toolbar='+too;
	this.opened = function() {return this.w && !this.w.closed;};
	this.close = function() {if(this.opened()) this.w.close();};
	this.focus = function() {if(this.opened()) this.w.focus();};
	this.load = function(sUrl) 
				{
					if (this.opened()) 
						this.w.location.href = sUrl;
					else 
						this.w = window.open(sUrl,this.n,this.f);
					this.focus();
					return false;
				};
}

var xChildWindow = null;
	
function xWinOpen(sUrl)
{
	var features = "left=0,top=0,width=600,height=500,location=0,menubar=0," +"resizable=1,scrollbars=1,status=0,toolbar=0";
	if (xChildWindow && !xChildWindow.closed) 
	{
		xChildWindow.location.href  = sUrl;
	}
	else 
	{
		xChildWindow = window.open(sUrl, "myWinName", features);
	}
	xChildWindow.focus();
	return false;
}

var xWinScrollWin = null;

function xWinScrollTo(win,x,y,uTime) 
{
	var e = win;
	if (!e.timeout) e.timeout = 25;
	var st = xScrollTop(e, 1);
	var sl = xScrollLeft(e, 1);
	e.xTarget = x; 
	e.yTarget = y; 
	e.slideTime = uTime; 
	e.stop = false;
	e.yA = e.yTarget - st;
	e.xA = e.xTarget - sl; 
	e.B = Math.PI / (2 * e.slideTime); 
	e.yD = st;e.xD = sl; 
	var d = new Date(); 
	e.C = d.getTime();
	if (!e.moving) 
	{
		xWinScrollWin = e;
		_xWinScrollTo();
	}
}

function _xWinScrollTo() 
{
	var e = xWinScrollWin || window;
	var now, s, t, newY, newX;
	now = new Date();
	t = now.getTime() - e.C;
	
	if (e.stop) 
	{ 
		e.moving = false; 
	}
	else if (t < e.slideTime) 
		{
			setTimeout("_xWinScrollTo()", e.timeout);
			s = Math.sin(e.B * t);
			newX = Math.round(e.xA * s + e.xD);
			newY = Math.round(e.yA * s + e.yD);
			e.scrollTo(newX, newY);
			e.moving = true;
		}  
		else 
		{
			e.scrollTo(e.xTarget, e.yTarget);
			xWinScrollWin = null;
			e.moving = false;
		}  
}