function MineCheck (myForm) {
	if (myForm.from.value=="") {
		alert('Please select to date');
		myForm.from.focus();
		return;
	}
	if (myForm.to.value=="") {
		alert('Please select from date');
		myForm.to.focus();
		return;
	}
	myForm.elements[0].value = "showReservationsFromTo";
	myForm.submit();
}

function selectAll(myForm) {
	for (i = 0; i < myForm.elements.length; i++)
		if (myForm.elements[i].name=='id[]') myForm.elements[i].checked = myForm.sample.checked;
};//end selectAll

function changeAction(myForm, action) {
	myForm.elements[0].value = action;
	if (action.indexOf('delete') == -1) myForm.submit();
	else if (confirm('Do you want to delete selected items?')) myForm.submit();
};//end changeAction

function checkSelected(myForm, element) {
	i = 0;
	flag = false;
	while (i<myForm.elements.length && !flag) {
		if (myForm.elements[i].name==element && myForm.elements[i].checked==true) flag=true;
		i++;
	}
	if (!flag) alert('You did not select any items to delete or update.');
	return flag;
};//end checkSelected

function popUp(name, url, width, height, toolbar, menubar, statusbar, scrollbar, resizable) {
  var wint = (screen.height - height) / 2;
  var winl = (screen.width - width) / 2;
  toolbar_str = toolbar ? 'yes' : 'no';
  menubar_str = menubar ? 'yes' : 'no';
  statusbar_str = statusbar ? 'yes' : 'no';
  scrollbar_str = scrollbar ? 'yes' : 'no';
  resizable_str = resizable ? 'yes' : 'no';
  window.open(url, name, 'left='+winl+',top='+wint+',width='+width+',height='+height+',toolbar='+toolbar_str+',menubar='+menubar_str+',status='+statusbar_str+',scrollbars='+scrollbar_str+',resizable='+resizable_str);
}
