function popupWin(theURL,winName,winW,winH) {
	var x_coord = (screen.width - winW) / 2;
	var y_coord = (screen.height - winH) / 2;
	var winProps = "height="+winH+",width="+winW+",scrollbars=yes,resizable=yes,status=yes";
  Win = window.open(theURL,winName,winProps);
	Win.window.moveTo(x_coord, y_coord);
	if (parseInt(navigator.appVersion) >= 4) { 
		Win.window.focus(); 
	}
}
/////////////////////////////////////////////////////////////////////////////////////////////////
function permit(val) {
	var permits = document.getElementById('permits');
	if(val == 'public') {
		permits.style.display = "";
	} else {
		permits.style.display = "none";
	}
}
/////////////////////////////////////////////////////////////////////////////////////////////////
function changeWidth(element,width) {
	var mySelect = document.getElementById(element);
	mySelect.style.width = width+"px";
}
/////////////////////////////////////////////////////////////////////////////////////////////////
function confirmButton(msg) {
	var check = confirm("Are you sure you want to "+msg+"?");
	if(check == true) {
		return true;
	} else {
		return false;
	}
}


/////////////////////////////////////////////////////////////////////////////////////////////////
function f_optionMove(s_from, s_to) {
	var e_from = document.forms['form1'].elements[s_from],
		e_to   = document.forms['form1'].elements[s_to];
		
	if (!e_from)
		return alert ("Error: selectbox with name '" + s_from + "' can't be found.");
	if (!e_to)
		return alert ("Error: selectbox with name '" + s_from + "' can't be found.");

	var n_moved = 0;
	for (var i = 0; i < e_from.options.length; i++) {
		if (e_from.options[i].selected) {
			e_to.options[e_to.options.length] = new Option(e_from.options[i].text, e_from.options[i].value);
			n_moved++;
		}
		else if (n_moved)
			e_from.options[i - n_moved] = new Option(e_from.options[i].text, e_from.options[i].value);
	}
	if (n_moved)
		e_from.options.length = e_from.options.length - n_moved;
	else
		alert("You haven't selected any options");
}

function f_optionMoveAll(s_from, s_to) {
	var e_from = document.forms['form1'].elements[s_from],
		e_to   = document.forms['form1'].elements[s_to];
		
	if (!e_from)
		return alert ("Error: selectbox with name '" + s_from + "' can't be found.");
	if (!e_to)
		return alert ("Error: selectbox with name '" + s_from + "' can't be found.");

	e_to.options.length = 0;
	for (var i = 0; i < e_from.options.length; i++)
			e_to.options[i] = new Option(e_from.options[i].text, e_from.options[i].value);
	e_from.options.length = 0;

}

function f_selectAll (s_select) {
	var e_select = document.forms['form1'].elements[s_select];
	for (var i = 0; i < e_select.options.length; i++)
			e_select.options[i].selected = true;
}
/////////////////////////////////////////////////////////////////////////////////////////////////
function deleteItem() {
	var check = confirm("Are you sure you want to delete this?");
	if(check == true) {
		return true;
	} else {
		return false;
	}
}
