var isOpera = (navigator.appName == 'Opera');
var isIE = (navigator.appName.indexOf('Microsoft') >= 0);
var isNetscape = (navigator.appName == 'Netscape');
var errorsHeap = new Object();

	errorsHeap.heap = Array();
	errorsHeap.addError = function (errorText)
	{
		if (errorText != '')
			this.heap.push(errorText);
	}
	
	errorsHeap.outAll = function ()
	{
		if (this.heap.length > 0)
		{
			alert(this.heap.join('\n\n'));
			this.heap.length = 0;
		}
	}

function dubiousEmlProtection (to, dmn, obj)
{
    document.write('<a href="mailto:'+to+'@'+dmn+'">'+obj+'</a>');
}

function holdValue (hInput, hValue, allowSubmitBlock, doClear, unactiveClass, activeClass)
{
	if (!unactiveClass) unactiveClass = 'unactive';
	if (!activeClass) activeClass = 'field';
	
	hInput.className = unactiveClass;
	hInput.value = hValue;
	hInput.onfocus = function ()
	{
		if (hInput.value == hValue && doClear) 
			hInput.value = ''; 
		hInput.className = activeClass;
	}
	hInput.onblur = function ()
	{
		if (hInput.value == '' || hInput.value == hValue) 
		{
			hInput.className = unactiveClass;
			hInput.value = hValue;
		}
	}
	if (allowSubmitBlock) hInput.form.onsubmit = function ()
	{
		if (hInput.value == hValue) return false;
	}
}

function getObject (objId)
{
	if (document.getElementById)
		return document.getElementById(objId);
	else if (document.all)
		return document.all[objId];
	else return false;
}

function isNotEmpty (myForm)
{
	var flag = true;
	for (var i = 1, length = isNotEmpty.arguments.length; i < length; i += 2)
	{
		if (myForm[isNotEmpty.arguments[i]].value.length == 0)
		{
			errorsHeap.addError(isNotEmpty.arguments[(i+1)]);
			flag = false;
		}
	}
	errorsHeap.outAll();
	
	return flag;
}

function setClass (theObject, newClassName)
{
	theObject = (theObject.style ? theObject : getObject(theObject));
	theObject.className = newClassName;
}

function showMe (myId)
{
	var theObject = (myId.style ? myId : getObject(myId));
	if (theObject.style.display != "block")
		theObject.style.display = "block";
}

function hideMe (myId)
{
	var theObject = (myId.style ? myId : getObject(myId));
	if (theObject.style.display != "none")
		theObject.style.display = "none";
}

function placeMe (myId, toY, toX)
{
	var theObject = (myId.style ? myId : getObject(myId));
	
	if (toY != undefined) theObject.style.top = toY + 'px';
	if (toX != undefined)
	{
		if (toX < 0) 
			theObject.style.right = -toX + 'px';
		else
			theObject.style.left = toX + 'px';
	}
	showMe(theObject);
}
