function openWindow(url)
{
    window.open(url, null, 'width=545, height=450, resizable=no,top=150, left=250');
}

function openFullWindow(url)
{
    window.open(url, "_blank", "toolbar=yes, location=yes, directories=yes, status=yes, menubar=yes, scrollbars=yes, resizable=yes, copyhistory=yes, width=800, height=600");
}

function ShowOrHide(id)
{
    document.getElementById(id).style.display =
        (document.getElementById(id).style.display == "none")? "" : "none";
}

function UnitSize(width, height)
{
	this.Height = this.Width = null;
	
	if (width)
		this.Width = width;
	if (height)
		this.Height = height;
		
	this.IsEmpty = function()
	{
		return (this.Height == null && this.Width == null);
	};
	
	this.Parse = function(s)
	{
		if (!s) return;
		var arr = s.split(",");
		
		this.Width = parseFloat(arr[0]);
		this.Height = parseFloat(arr[1]);		
	};
}

function OffsetLocation(x, y)
{
	this.X = this.Y = 0;
	this.IsEmpty = function()
	{
		return (this.X == 0 && this.Y == 0);
	};

	this.Parse = function(s)
	{
		if (!s)
			return;

		var arr = s.split(",");

		this.X = parseFloat(arr[0]);
		this.Y = parseFloat(arr[1]);
	};

	if (x)
		this.X = x;

	if (y)
		this.Y = y;
}

if (typeof(IS) == "undefined")
{
    var IS =
    {
        ie :null,
        moz:null
    }
}

IS.ie = /MSIE/.test(navigator.userAgent);
IS.moz = /Firefox/.test(navigator.userAgent);
IS.opera = !IS.ie && !IS.moz && /Opera/.test(navigator.userAgent);
IS.safari = /Safari/.test(navigator.userAgent);
IS.khtml = !IS.safari && /KHTML/.test(navigator.userAgent);
IS.mac = /Macintosh/.test(navigator.userAgent);
IS.chrome = /Chrome/.test(navigator.userAgent);

/* <ISPOSLIB> */

var ISPosLib =
	{
		getIeBox: function(el)
		{
			return this.ie && el.document.compatMode != "CSS1Compat";
		},

		getClientLeft: function(el)
		{
			if (IS.ie)
			{
				var r = el.getBoundingClientRect();
				return r.left - this.getBorderLeftWidth(this.getCanvasElement(el));
			}
			else
				return ISMoz.GetClientLeft(el);
		},

		getClientTop: function(el)
		{
			if (IS.ie)
			{
				var r = el.getBoundingClientRect();
				return r.top - this.getBorderTopWidth(this.getCanvasElement(el));
			}
			else
				return ISMoz.GetClientTop(el);
		},

		getLeft: function(el)
		{
			return this.getClientLeft(el) + this.getCanvasElement(el).scrollLeft;
		},

		getRight: function(el)
		{
			return this.getLeft(el) + this.getWidth(el);
		},

		getTop: function(el)
		{
			return this.getClientTop(el) + this.getCanvasElement(el).scrollTop;
		},

		getBottom: function(el)
		{
			return this.getTop(el) + this.getHeight(el);
		},

		getInnerLeft: function(el)
		{
			return this.getLeft(el) + this.getBorderLeftWidth(el);
		},

		getInnerRight: function(el)
		{
			return this.getRight(el) - this.getBorderRightWidth(el);
		},

		getInnerTop: function(el)
		{
			return this.getTop(el) + this.getBorderTopWidth(el);
		},

		getInnerBottom: function(el)
		{
			return this.getBottom(el) - this.getBorderBottomWidth(el);
		},

		getWidth: function(el)
		{
			var h = el.offsetWidth;

			if (h == 0)
			{
				h = el.style.pixelWidth;

				if (h == 0 || isNaN(h))
					h = parseFloat(el.style.width);

				if (h == 0 || isNaN(h))
					h = parseFloat(el.clientWidth);

				if (isNaN(h))
					h = 0;
			}

			return h;
		},

		getInnerWidth: function(el)
		{
			return this.getWidth(el) - this.getBorderLeftWidth(el) - this.getBorderRightWidth(el);
		},

		getHeight: function(el)
		{
			var h = el.offsetHeight;

			if (h == 0)
			{
				h = el.style.pixelHeight;

				if (h == 0 || isNaN(h))
					h = parseFloat(el.style.height);

				if (h == 0 || isNaN(h))
					h = parseFloat(el.clientHeight);

				if (isNaN(h))
					h = 0;
			}

			return h;
		},

		getInnerHeight: function(el)
		{
			return this.getHeight(el) - this.getBorderTopWidth(el) - this.getBorderBottomWidth(el);
		},

		getCanvasElement: function(el)
		{
			var doc = el.ownerDocument || el.document;

			if (doc.compatMode == "CSS1Compat")
				return doc.documentElement;

			else
				return doc.body;
		},

		getBorderLeftWidth: function(el)
		{
			if (IS.moz)
				return 0;

			return el.clientLeft;
		},

		getBorderRightWidth: function(el)
		{
			if (IS.moz)
				return 0;

			return this.getWidth(el) - el.clientLeft - el.clientWidth;
		},

		getBorderTopWidth: function(el)
		{
			if (IS.moz)
				return 0;

			return el.clientTop;
		},

		getBorderBottomWidth: function(el)
		{
			if (IS.moz)
				return 0;

			return this.getHeight(el) - el.clientTop - el.clientHeight;
		},

		getScreenLeft: function(el)
		{
			var doc = el.ownerDocument || el.document;
			var w = doc.parentWindow;
			return w.screenLeft + this.getBorderLeftWidth(this.getCanvasElement(el)) + this.getClientLeft(el);
		},

		getScreenTop: function(el)
		{
			var doc = el.ownerDocument || el.document;
			var w = doc.parentWindow;
			return w.screenTop + this.getBorderTopWidth(this.getCanvasElement(el)) + this.getClientTop(el);
		},

		getCurX: function()
		{
			if (event)
				return event.clientX + document.body.scrollLeft;
		},

		getCurY: function()
		{
			if (event)
				return event.clientY + document.body.scrollTop;
		},

		getLeftNonIE: function(el)
		{
			return ISMoz.GetLeft(el);
		},

		getTopNonIE: function(el)
		{
			return ISMoz.GetTop(el);
		}
	};

ISPosLib.ua = navigator.userAgent;
ISPosLib.opera = /opera[56789]|opera\/[56789]/i.test(ISPosLib.ua);
ISPosLib.ie = (!ISPosLib.opera) && /MSIE/.test(ISPosLib.ua);
ISPosLib.ie6 = ISPosLib.ie && /MSIE[6789]/.test(ISPosLib.ua);
ISPosLib.moz = !ISPosLib.opera && /gecko/i.test(ISPosLib.ua);

/* </ISPOSLIB> */


function GetWindowScrollTop()
{
    if (IS.ie || IS.moz || IS.opera)
        return document.documentElement.scrollTop;
    if (IS.safari || IS.chrome)
        return document.body.scrollTop;
}

function GetWindowScrollLeft()
{
    if (IS.ie || IS.moz || IS.opera)
        return document.documentElement.scrollLeft;
    if (IS.safari || IS.chrome)
        return document.body.scrollLeft;
}

function GetElementType(el)
{
    var cnt = 0;

    while (el != null && !el.attributes["eltype"] && cnt < 5)
        el = el.parentElement;

    if (el)
        return [el, el.attributes["eltype"].value];

    return [el, null];
}
