// Ver 4.1.051109 mod activesite

function download(file) {

	setTimeout('window.open("' + file + '", "_parent")', 0);

}

function deleteAction(str, action) {

	if (str) 
		var yes = window.confirm(str)
	else 
		var yes = window.confirm(adm_delete);

        if (yes) 
		if (action) 
			applyAction(action)
		else 
			applyAction("delete");

}

function applyAction(action, actionclass, form) {

	if (!form) form = mainform;
	if (actionclass) form.actionclass.value = actionclass;

	form.action.value = action;

	if (form.fireEvent("onsubmit"))
		form.submit();

}

function setFValue(element, value, form) {

	if (!form) form = mainform;
	if (form[element]) form[element].value = value;

}

function openWindow(url, name, width, height) {

	if (!width) width = 640;
	if (!height) height = 480;

	window.open(url, name, 'width=' + width + ',height=' + height + ',scrollbars=no');

}

function openModalWindow(url, name, width, height) {

	if (!width) width = 640;
	if (!height) height = 480;

	window.showModalDialog(url, name, 'dialogWidth:' + width + 'px; dialogHeight:' + height + 'px; scroll:no');

}

function scrollTo(id, top) {

	if (document.getElementById(id))
		document.getElementById(id).scrollTop = top;

}

function checkElement(el, param, value, n) {

	if (el[param] == value) return el;

	if (n == 0) return;

	if (el.parentElement)
		return checkElement(el.parentElement, param, value, n - 1);

	return false;

}

function checkInnerElement(el, param, value) {

	if (el[param] == value) return el;

	if (el.children.length > 0)
		return checkInnerElement(el.children[0], param, value);

	return false;

}

function goHome() {

	window.top.location = url_home;

}

// OnLoad processor

var onloadprocess = new Array();
var firstonload = true;

function pushOnLoadProcess(process) {

	if (firstonload) {
	
		firstonload = false;
		if (document.body.onload) pushOnLoadProcess(document.body.onload);
		document.body.onload = onLoad;

	}

	onloadprocess[onloadprocess.length] = process;

}

function onLoad() {

	var i;

	for (i = 0; i < onloadprocess.length; i++)
		setTimeout(onloadprocess[i], 0);

}

// Mouse

var mousex;
var mousey;

function imouse() {  

	mousex = event.x + document.body.scrollLeft;
	mousey = event.y + document.body.scrollTop;

}

document.onmousemove = imouse;

