
function open_window(aPage,aWidth,aHeight,aScrolling) {		
	
	var lLeft = screen.width / 2 - (aWidth / 2);
	var lTop  = screen.height / 2 - (aHeight / 2);
	
	OpenWin = window.open(aPage, "window", "toolbar=no,menubar=no,location=no,scrollbars=" + aScrolling +  ",resizable=no,width=" + aWidth + ",height=" + aHeight + ",left=" + lLeft + ",top=" + lTop + "");
}

function close_window(aReload) {
	if (!aReload) 
		self.opener.document.location = self.opener.document.location;
	window.close();	
}

function check_it(aForm,aCheckbox,aDBField) {			
	var lCheckbox = document.forms[aForm].elements[aCheckbox];		
	var lDBField =  document.forms[aForm].elements[aDBField];						
	if (lCheckbox.checked) {		
		lCheckbox.value = 1;
		lDBField.value = 1;
		
		
	} else {
		lCheckbox.value = 0;
		lDBField.value = 0;
		
	}
}

function check_delete(form, href, id, id_type, name) {
	
	if(confirm("Are you sure you wish to delete " + id + " - " + name + "?")) {
		form.action = href + "?" + id_type + "id=" + id + "&name=" + name + "";
		form.submit();
	}

}


function check_pos_filled(form, id, name, flag) {
	
	if(flag == 1) {
		message = "Add " + name + " to the positions filled list?"
	} else {
		message = "Re-Advertise " + name + "?"
	}
	
	if(confirm(message)) {
		form.action = "pos_filled.php?vacancyId=" + id + "&flag=" + flag + "";
		form.submit();
	}
	
}


