function calcRiskExposure(riskId){
	riskFactor = document.getElementById(document.getElementById("radioId"+riskId).value);
	if(riskFactor!=""){
		projectImpact = document.getElementById("projectImpact"+riskId);
		if(projectImpact.value>0){
			riskExposure = (100/64)*(riskFactor.value * (projectImpact.value));
			riskExposureField = document.getElementById("riskExposure"+riskId);
			riskExposureField.innerHTML = Math.round(riskExposure)+" RE";
		}
	}
}
function showDescription(descId){
	displayHolder = document.getElementById("discriptionLabel"+descId);
	if(displayHolder.style.display=="block"){
		displayHolder.style.display = "none";
	}
	else{
		displayHolder.style.display = "block";
	}
}
function showReason(descId){
	displayHolder0 = document.getElementById("desc_"+descId+"0");
	displayHolder1 = document.getElementById("desc_"+descId+"1");
	displayHolder2 = document.getElementById("desc_"+descId+"2");
	if(displayHolder0.style.display=="block"){
		displayHolder0.style.display = "none";
		displayHolder1.style.display = "none";
		displayHolder2.style.display = "none";
	}
	else{
		displayHolder0.style.display = "block";
		displayHolder1.style.display = "block";
		displayHolder2.style.display = "block";
	}
}
function setHiddenField(field,id){
	document.getElementById(field).value=id;	
}
function goTo(pId){
	window.location.href="./resolutionTechnique.php?rcId="+pId
}
function help(page){
	window.open("./common/help/helpTemplate.php?section="+page,'helpWindow',"height=300,width=500,status=no,toolbar=no,menubar=no,location=no");
}
function showRiskManagementReport(reportId){
	x=window.height;
	window.open("./printRiskManagementPlan.php?reportId="+reportId,'riskManagementReport',"height="+x+",width=700,status=no,toolbar=no,menubar=no,location=no,scrollbars=yes");
}
function validateForm(){
/*	var problems = document.forms["assesmentForm"].elements["riskExposure[]"];
	for (var j=0; j<problems.length; j++){
		var radioButtons = document.forms["assesmentForm"].elements['status'+j];
		for (var i=0; i<radioButtons.length; i++)	{
		  if (radioButtons[i].checked){
			if(document.forms["assesmentForm"].elements["riskExposure["+j+"]"].value==0){
				return(false);
			}
		  }
		  else{
			return(false);
		  }
		}
	}*/
	return(true);
}
function submitForm(){
	if(validateForm()){
			document.forms[0].submit();
	}
	else{
		if(confirm("We have noticed that you haven't filled out all the assesments on this page\nIf you chose to press \"OK\" the system will assume that all fields that have not\n been filled out should have the value zero(0)If this is not the case, please\n press \"Cancel\" and correct the values.\n\n Do you wish to proceede?")){
			document.forms[0].submit();
		}
	}
}
function signOut(){
	window.location.href="./signOut.php";
}
function addParticipant(type){
	if(type>0){
		window.location.href="./projectParticipant.php?type="+type;
	}
}
