function ipmap_del(k)
{
	var ip = document.getElementsByName('data[ip][' + k + ']');
	var ipname = document.getElementsByName('data[ipname][' + k + ']');
	if(ip && ipname)
	{
		ip[0].value = "";
		ipname[0].value = "";
	}
}

function setFocus(elName)
{
	var el = document.getElementById(elName);
	if(el)
	{
		el.focus();
	}
}

function submitForm(form)
{
	el = document.getElementById(form);
	if(el.submit)
	{
		el.submit();
	}
}

function changeStyle(el, className)
{
	el.className = className;
} // changeStyle

function pop(theURL,w,h,name,feat)
{
	var l = (screen.width - w) / 2;
	var t = (screen.height - h) / 2;

	if(!feat)
	{
		feat = 'fullscreen=0,toolbar=0,status=0,scrollbars=1,menubar=0,location=0,resizable=0,channelmode=0,directories=0';
	}

	feat += ',width=' + w + ',height=' + h + ',top=' + t +',left=' + l;

	window.open(theURL, name, feat);
} // pop

function checkAll(form, what)
{
	for (var i = 0; i < form.elements.length; i++)
	{
		var e = form.elements[i];
		if(e.type == 'checkbox')
		{
			e.checked = form[what.name].checked;
		}
	}
} // checkAll

function resizeWindowFrom(referer)
{
	var el = document.getElementById(referer);

	if(el && el.clientHeight && el.clientWidth)
	{
	  var nw = el.clientWidth + 24;
		var nh = el.clientHeight + 80;

		if(nh > screen.availHeight * 0.9)
		{
			nh = screen.availHeight * 0.9;
		}

		if(nw > screen.availWidth * 0.9)
		{
			nw = screen.availWidth * 0.9;
		}

	  window.resizeTo(nw, nh);
	  window.moveTo((screen.width - nw) / 2, (screen.height - nh) / 2);
	}
}

