// JavaScript Document
function close_msgbox(){
	document.getElementById('div_msg_box').style.display="none";
	document.getElementById('div_msg_box2').style.display="none";
}

function submit_survery(){
	
	stream_id=document.getElementById('stream_id').value;
	survey_id=document.getElementById('survey_id').value;
	
	var rad_val="";

		for (var i=0; i < document.surveyForm.survey.length; i++)
		   {
		   if (document.surveyForm.survey[i].checked){
			  rad_val = document.surveyForm.survey[i].value;
		   }
		}
	if (rad_val!=""){
		str = stream_id +"|"+ rad_val +"|"+survey_id;
		send_data(str,5,'survey_div');
	}else{
		alert("You must select at least one answer");	
	}
}


function submit_question(){
	
	stream_id=document.getElementById('stream_id').value;
	courses_id=document.getElementById('courses_id').value;
	chapter_id=document.getElementById('chapter_id').value;
	question_id=document.getElementById('question_id').value;
	question_type=document.getElementById('question_type').value;
	var rad_val="";
	
	//str = stream_id+"|"+ courses_id +"|"+ chapter_id +"|"+ question_id +"|"+ question_type +"|"+
	if (question_type=="1"){
		if (document.getElementById('answer').value==""){
			alert("Answer cannot be empty");
		}else{
		str = stream_id+"|"+ courses_id +"|"+ chapter_id +"|"+ question_id +"|"+ question_type +"|"+ document.getElementById('answer').value;
		//alert(str);
		send_data(str,6,'question_div');
		}
	}else{
		
			// radio 
			for (var i=0; i < document.question_form.answer.length; i++){
			   if (document.question_form.answer[i].checked){
				  rad_val = document.question_form.answer[i].value;
			   }
			}
			
			if (rad_val!=""){
				str = stream_id+"|"+ courses_id +"|"+ chapter_id +"|"+ question_id +"|"+ question_type +"|"+ rad_val;
				//alert(str);
				send_data(str,6,'question_div');
			}else{
				alert("You must select at least one answer");	
			}
		
	}
	

		
	
}

function p_login(){
send_data(document.getElementById('p_email').value+"|"+document.getElementById('p_pass').value,10,'pending_application_div');

}

function p_forgot(){
	show_data('p_email',22,'pending_application_div');
}
