$(document).ready(function(){

	function disableBack() { window.history.forward() }

        window.onload = disableBack();
        window.onpageshow = function(evt) { if (evt.persisted) disableBack() }

	$('#submitbuttondsp').click(function() {
		var icero = 0;
		$("select").each(function(){
			rspt = $(this).val();
			if(rspt == "") 
			{
				icero = icero + 1;
			}			
		});
		
		if( icero >= 4 ) {
			alert('The Questionnaire has many "Unknown" items.\nPlease answer each item.');
			return false
		} else {
			$('#DspScoreAddForm').submit();
		}

	});	

	$('#submiteditdsp').click(function() {
		var icero = 0;
		$("select").each(function(){
			rspt = $(this).val();
			if(rspt == "") {
				icero = icero + 1;
			}			
		});
		
		if( icero >= 4 ) {
			alert('The Questionnaire has many "Unknown" items.\nPlease answer each item.');
			return false
		} else {
			$('#DspScoreEditForm').submit();
		}

	});	
	//Patient
	$('#submitbuttonadddsp').click(function() {
		var icero = 0;
		$("select").each(function(){
			rspt = $(this).val();
			if(rspt == "") {
				icero = icero + 1;
			}			
		});
		
		if( icero >= 4 ) {
			alert('The Questionnaire has many "Unknown" items.\nPlease answer each item.');
			return false
		} else {
			$('#DspScoreAddDspForm').submit();
		}

	});	  
  
});