var isChanged = false;

function carefulClose()
{
	if (isChanged)
	{
		if (confirm("Close without saving?"))
		{
			self.close();
		}
		else
		{
			return void(0);
		}
	}
	else
	{
		self.close();
	}
}

function carefulSubmit()
{
	if (isChanged)
	{
		if (! confirm("Close without saving?"))
		{
			return false;
		}
	}
}

function carefulLink(h)
{
	if (isChanged)
	{
		if (! confirm("Close without saving?  If you click OK, you will loose data. To save your work, click Cancel, scroll down to the bottom of this page, and hit the Save button. "))
		{
			return void(0);
		}
	}
	
	self.location = h;
}

function spsFormChanged()
{
	isChanged = true;
}

var remote = null;
function rs(n,u,w,h) {
  remote = window.open(u, n, 'width=' + w + ',height=' + h +',resizable=yes,scrollbars=yes');
  if (remote != null) {
    if (remote.opener == null)
      remote.opener = self;
    window.name = 'Popup';
    remote.location.href = u;
  }
}

function toggleField(field)
{
	var d = document.getElementById(field);
	var i = document.getElementById(field + "_img");

	if (d != null)
	{
		if (d.style.display == "block")
		{
			d.style.display = "none";
			if (i != null)
			{
				i.src = "/sps/icons/info.gif";
			}
		}
		else
		{
			d.style.display = "block";
			if (i != null)
			{
				i.src = "/sps/icons/info_hi.gif";
			}
		}
	}
}

function toggleFieldSet(field, state)
{
	var d = document.getElementById(field);
	var i = document.getElementById(field + "_img");

	if (d != null)
	{
		if (state)
		{
			d.style.display = "block";
			if (i != null)
			{
				i.src = "/sps/icons/info_hi.gif";
			}
		}
		else
		{
			d.style.display = "none";
			if (i != null)
			{
				i.src = "/sps/icons/info.gif";
			}
		}
	}
}


if (document.images)	{
}

function rollon (imgName)	{
	if (document.images)	{
		document.images[imgName].src = "/images/banner/subbanner_" + imgName + "_on.gif";
	}
}

function rolloff (imgName)	{
	if (document.images)	{
		document.images[imgName].src = "/images/banner/subbanner_" + imgName + ".gif";
	}
}

