function submitForm(formId, action, checkBoxId, msg, question, target)
{
	var form;
	if(document.getElementById)
		form=document.getElementById(formId);
		
	else if(document.forms)
		form=document.forms(formId);
	
	if (checkBoxId != null)
	{
		if (! hasCheckBoxSelection(form, checkBoxId, msg))
			return;		
	}	
	
	if (action != null)	
		form.action = action;	
		
	if (question && !window.confirm(question))
		return;
		
	if(target)
		form.target=target;
		
	form.submit();
}


function hasCheckBoxSelection(form, checkBoxId, msg)
{		
	var selectedAny = false;
	var checkBoxes = form[checkBoxId];
	
	if (checkBoxes == null)
		return false;
		
	if (checkBoxes.length == null)
	{
		selectedAny = checkBoxes.checked;
	}
	else
	{
		for (var i=0; i< checkBoxes.length; i++)
			selectedAny = selectedAny || checkBoxes[i].checked;
	}
										
	if (!selectedAny && msg != null)	
		alert(msg);
											
	return selectedAny;
}

function autofitIframe(id){
	var scrollHeight = document.body.scrollHeight;
	var offsetHeight = document.body.offsetHeight;
	
	if (scrollHeight >= offsetHeight) // all but Explorer Mac
	{
		parent.document.getElementById(id).style.height=scrollHeight+"px";
	}
	else // Explorer Mac;
	     //would also work in Explorer 6 Strict, Mozilla and Safari
	{
		parent.document.getElementById(id).style.height=offsetHeight+"px";
	}
}