Trying to put 2 javaScript functions together

I am in need of help in getting this javascript in one funtion. I have looked and search and still have not been able to come to a conclusion on this. Any help would be greatly appreciated.

here are the 2 JS function i am trying to marry with out the javascript opening and closing tags:


{
if ( document.theForm.ToLB.value == "" )
{
alert ( "Please select header column from the list box. " );
return false;
}else

return true;
}


AND

function sendForm(form){
var sel = form.ToLB;
for ( var i = 0; i < sel.options.length; ++i )
{
sel.options[i].selected = true;
}
return true;
} 

function sendForm(form){
var sel = form.ToLB;
if ( document.theForm.ToLB.value == "" ) {
   alert ( "Please select header column from the list box. " );
   return false;
}
else return true;
for ( var i = 0; i < sel.options.length; ++i ) {
   sel.options[i].selected = true;
}
return true;
}

I tried this and it works when there is nothing in the box the thing is when I select the data from the list box and move it to the empty box then submit, it acts as if the box is still empty and it shouldn’t.

Can you show us the the HTML form that integrates with the scripting?

I finally fixed the problem with the following code and works like I needed.

    <script language="javascript">
		function sendForm(form)
			{
				var sel = form.ToLB;
				for ( var i = 0; i < sel.options.length; ++i ) 
				{
				sel.options[i].selected = true;
							}
			if ( document.theForm.ToLB.value == "" ) 
			{
			alert ( "Please select from the list box. " );
			return false;
					}
			else return true;
			}
	</script>