self.name = "main";

function getAbsoluteOffsetTop(obj)
{
	var top = obj.offsetTop;
	var parent = obj.offsetParent;
	while (parent != document.body) {
		top += parent.offsetTop;
		parent = parent.offsetParent;
	}
	return top;
}

function getAbsoluteOffsetLeft(obj)
{
	var left = obj.offsetLeft;
	var parent = obj.offsetParent;
	while (parent != document.body) {
		left += parent.offsetLeft;
		parent = parent.offsetParent;
	}
	return left;
}

function getObj(id)
{
	if (document.all) { return document.all[id]; }
	else { return document.getElementById(id); }
}

function changePropById(objId, propName, propValue)
{
	var obj = getObj(objId);
	if (obj && (propName.indexOf("style.")==-1 || obj.style))
	{
		if (propValue == true || propValue == false)
			eval("obj."+propName+"="+propValue);
		else
			eval("obj."+propName+"='"+propValue+"'");
	}
}

function changePropsByTagId(tagName, tagId, propName, propValue)
{
	var elems = document.getElementsByTagName(tagName);
	for (var i = 0; i < elems.length; i++)
	{
		if (elems[i].id && elems[i].id.indexOf(tagId) == 0)
		{
			changePropById(elems[i].id, propName, propValue);
		}
	}
}

function copyit(theField)
{
	var tempval = eval("document."+theField);
	tempval.focus();
	tempval.select();
	therange=tempval.createTextRange();
	therange.execCommand("Copy");
}

function popupForm(form, newWidth, newHeight)
{
	var width = newWidth || '300';
	var height = newHeight || '150';
	if (!window.focus) return true;
	day = new Date();
	id = day.getTime();
	window.open('', id, 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=' + width + ',height=' + height);
	form.target = id;
}

function popupWindow(URL, newWidth, newHeight)
{
	var width = newWidth || '300';
	var height = newHeight || '150';
	day = new Date();
	id = day.getTime();
	window.open(URL, id, 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=' + width + ',height=' + height);
}

function restoreProfile()
{
	var agree=confirm("Are you sure you want to reset your profile?!");
	if (agree)
	{
		window.location='index.php?act=pmp&CODE=04';
	}
	return false;
}
