function survey(surveyid,surveytitle)
{
	document.getElementById('default_ques').style.visibility="hidden";
	//$("#default_ques").hide();
	 
	process		=	'loadEvent';
	output		=	'text';
	url			=	getURL() + "/survey/?act=SL&survey_id="+surveyid+"&survey_title="+surveytitle;
	responseHandler	=	"processEventResponsesample";
	ajaxPostRequest(url, "");		
	return false;	
}
//------------------------------------------------------------------------------------------------------------------------------------------
function processEventResponsesample(responseText)
{
	document.getElementById('ques_choices').innerHTML = responseText;
}
//------------------------------------------------------------------------------------------------------------------------------------------
function show_identity()
{
  var row=document.getElementById('showname');
  if(row.style.display=='none')
  {
    row.style.display='';  
  }
  else 
    row.style.display='none';   
}
//------------------------------------------------------------------------------------------------------------------------------------------	
function validateSurveyForm()
{
	frm = document.surveyForm;
	var noofquestion = frm.no_of_questions.value;
	//alert(noofquestion);
	var surveyId    = frm.survey_id.value;
	//alert(surveyId);
	var surveyTitle = frm.survey_title.value;
	
	//alert(surveyTitle);
	//var noofoption =frm.numofoption.value;
	//alert(noofoption);
	
	for(var i=1;i<=noofquestion;i++)
	{
	   if(document.getElementById('anstype_'+i).value=="Radio Button")
	   {
	      var numOption = document.getElementById('numofoption_'+i).value;
		   // alert(j+','+i);
		   if(numOption==4)
		   {
				if((document.getElementById('option_1_'+i).checked==false) && (document.getElementById('option_2_'+i).checked==false)&&(document.getElementById('option_3_'+i).checked==false)&&(document.getElementById('option_4_'+i).checked==false)&&(document.getElementById('option_5_'+i).checked==false) )
				{
					 alert("Please select any one option on question number "+i);
					 return false;
				}
				else
				{
				   if(document.getElementById('option_5_'+i).checked==true)
				   {
					   if(document.getElementById('others_val_'+i).value=='')
					   {
						   alert("You have selected ('Others') option for question number "+i+". Please add details");
						   document.getElementById('others_val_'+i).focus();
						   return false;
					   }
				   }
				}
		   }
		   else if(numOption==3)
		   {
			  if((document.getElementById('option_1_'+i).checked==false) && (document.getElementById('option_2_'+i).checked==false)&&(document.getElementById('option_3_'+i).checked==false)&&(document.getElementById('option_5_'+i).checked==false))
				{
					 alert("Please select any one option on question number "+i);
					 return false;
				} 
				else
				{
				   if(document.getElementById('option_5_'+i).checked==true)
				   {
					   if(document.getElementById('others_val_'+i).value=='')
					   {
						   alert("You have selected ('Others') option for question number "+i+". Please add details");
						   document.getElementById('others_val_'+i).focus();
						   return false;
					   }
				   }
				}
		   }
		   else if(numOption==2)
		   {
			   if((document.getElementById('option_1_'+i).checked==false) && (document.getElementById('option_2_'+i).checked==false)&&(document.getElementById('option_5_'+i).checked==false))
				{
					 alert("Please select any one option on question number "+i);
					 return false;
				} 
				else
				{
				   if(document.getElementById('option_5_'+i).checked==true)
				   {
					   if(document.getElementById('others_val_'+i).value=='')
					   {
						  alert("You have selected ('Others') option for question number "+i+". Please add details");
						   document.getElementById('others_val_'+i).focus();
						   return false;
					   }
				   }
				}
		   }
		   else if(numOption==1)
		   {
			   
			   if((document.getElementById('option_1_'+i).checked==false)&&(document.getElementById('option_5_'+i).checked==false) )
				{
					 alert("Please select any one option on question number "+i);
					 return false;
				}
				else
				{
				   if(document.getElementById('option_5_'+i).checked==true)
				   {
					   if(document.getElementById('others_val_'+i).value=='')
					   {
						   alert("You have selected ('Others') option for question number "+i+". Please add details");
						   document.getElementById('others_val_'+i).focus();
						   return false;
					   }
				   }
				}
		   }
	  
	   }
	   else
	   {
		 if(document.getElementById('text_'+i).value=="")  
		 {
			 alert("Please answer questions number "+i);  
			 return false;
		 }
	   }
	}
	if(document.getElementById('identity').checked==true)
	{
	    
		var emailval= frm.user_email.value;
		if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(frm.user_email.value))
		{
		  return true;
		}
		alert("Invalid E-mail Address! Please re-enter.");
		return false;	
		
	}
	
	return true;
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------
function getOtherOptions(questiono)
{
	document.getElementById('othersVal_'+questiono).style.display="block"; 
}
//---------------------------------------------------------------------------------------------------------------------------------------------------
function getOptions(questiono)
{
	document.getElementById('othersVal_'+questiono).style.display="none"; 
}
//-----------------------------------------------------------------------------------------------------------------------------------------------------

