// Request based methods
function requestAction(action) {
	document.defaultform.action.value=action;
	document.defaultform.submit();
}

function closeWorking() {
	//opener.Working.close();
}

function openWorking() {
	//Working=window.open('working.html','Working','scrollbars=no,resizable=no,width=300,height=200');
}

function goHome() {
	window.location.href="http://www.boldsystems.org";
}

function refreshPage() {
	window.location.replace(unescape(window.location.pathname));
}

function refreshParentAndClose() {
	opener.refreshPage();
	window.close();
}

function popup(url,width,height) {
	Popup=window.open(url,"",'scrollbars=yes,resizable=yes,width='+width+',height='+height);
	Popup.focus();
}	

function popupWithSize(page,width,height) {
	Popup=window.open(page,"popup",'scrollbars=yes,resizable=yes,width='+width+',height='+height);
}

function openRecord(type,recordid,projectcode) {
		var valid=true;
		var action;
		if (type=='specimen') { action="doOpenSpecimenRecord";}
		else if (type=='sequence') { action="doOpenSequenceRecord"; }
		else {
			alert ('Record type must be specified');
			valid=false;
		}
		
		if(valid && recordid>0 && projectcode!==undefined){
			Popup=window.open('/pcontr.php?action='+action+'&selectedrecordid='+recordid+'&selectedrecordtype='+type+'&project_code='+projectcode,'Popup'+recordid,'scrollbars=yes,resizable=yes,width=705,height=600');
			Popup.focus();
		}else if (valid && recordid>0) {
			Popup=window.open('/pcontr.php?action='+action+'&selectedrecordid='+recordid+'&selectedrecordtype='+type,'Popup'+recordid,'scrollbars=yes,resizable=yes,width=705,height=600');
			Popup.focus();
		}
}

function alertErrors(errorstr) {
	alert(errorstr);	
}
