










function hideTimer(optional)
{ parent.show = false;
  if (optional != null)
  { document.getElementById('display').innerHTML='<a class="whiteLink" href="javascript:showTimer(\'v\');">Show</a>';
    top.timer.document.location.href = '/apa/hiddenVTimeCheck.do';
  }
  else
  { document.getElementById('display').innerHTML='<a class="whiteLink" href="javascript:showTimer();">Show</a>';
    top.timer.document.location.href = '/apa/hiddenQTimeCheck.do';
  }
}


function showTimer(optional)
{ parent.show = true;
  if (optional != null)
  { document.getElementById('display').innerHTML='<a class="whiteLink" href="javascript:hideTimer(\'v\');">Hide</a>';
    top.timer.document.location.href = 'viewall_timer.jsp';
  }
  else
  { document.getElementById('display').innerHTML='<a class="whiteLink" href="javascript:hideTimer();">Hide</a>';
    top.timer.document.location.href = 'test_timer.jsp';
  }
}


function popup(page)
{ newWindow = window.open(page,'Popup','width=400,height=500,scrollbars=yes,resizable=yes');
  newWindow.focus();
}

function privacyPopup()
{ newWindow = window.open('../jsp/privacy.jsp','Popup','width=400,height=500,scrollbars=yes,resizable=yes');
  newWindow.focus();
}

function popupReference(page)
{ newWindow = window.open(page,'Popup','width=400,height=500,scrollbars=yes,resizable=yes');
  alert("Please close the reference window when you're finished.");
  newWindow.focus();
}
function emailWindow()
{ sac = window.open('/apa/emailPopup.do','EmailPopup', 'width=400,height=140,resizable=yes');
  sac.focus();
}


function login(){
  if (document.loginForm.group_id.value != ""){ 
	if ((document.loginForm.member_id.value != "") && (document.loginForm.password.value != "")){ 
		window.open('/apa/jsp/get_group_pass.jsp', 'GroupPass', 'width=340,height=60,resizable=yes,scrollable=no');
    } else {
		document.loginForm.submit();
    }
  } else {
	document.loginForm.submit();
  }
}


function groupLogin() {
	window.open('/apa/jsp/get_group_pass.jsp', 'GroupPass', 'width=360,height=140,resizable=yes,scrollable=no');
}


function beginTest()
{ window.top.location.reload(true);
  window.open('/apa/beginTest.do','Assessment','width=750,height=550,resizable=yes,titlebar=no,fullscreen=yes');
}


function viewAll()
{ window.top.nav.location.href = '/apa/jsp/viewall_nav.jsp';
  window.top.body.location.href = '/apa/jsp/test_viewall.jsp';
}


function finishAssessment()
{ 
  self.close();
}


function openCompositePrintFriendly() {
 		window.open('../group_body.jsp?print=true','Print','width=750,height=550,scrollbars=yes,resizable=yes,toolbar=yes');
}


function openPrintFriendly(viewType) {
	if (viewType.length != "") {
		window.open('../results_body.jsp?print=true&groupView=1','Print','width=750,height=550,scrollbars=yes,resizable=yes,toolbar=yes');
	}else{
 		window.open('../results_body.jsp?print=true','Print','width=750,height=550,scrollbars=yes,resizable=yes,toolbar=yes');
 	}
}


function saveQuestion(action)
{ window.top.body.document.answerForm.show.value = parent.show;
  window.top.body.document.answerForm.FORWARD.value = action;
  window.top.body.document.answerForm.submit();
}


function validatePurchaseForm()
{ var fieldAlerts = "";
  
  window.top.body.document.purchaseRequestForm.quantity.value = window.top.body.document.purchaseRequestForm.myquantity.value;
  
  if ((window.top.body.document.purchaseRequestForm.blockType[0].checked == false) && (window.top.body.document.purchaseRequestForm.blockType[1].checked == false))
  { fieldAlerts = fieldAlerts + "  choose either Indiviual or Group\n";
  }
  
  if (!(window.top.body.document.purchaseRequestForm.quantity.value > 0) || (window.top.body.document.purchaseRequestForm.quantity.value == null))
  { fieldAlerts = fieldAlerts + "  Quantity must be greater than zero\n";
  }
  
  if (fieldAlerts != "")
  { alert("You must correct the following:\n" + fieldAlerts);
    return false;
  }
  else
  { return true;
  }
  return false;
}
