function privacyPolicy()
{
var action = "privacypolicy";
var URL =// contextPath + "/"+ 
action + ".do";
window.open(URL, '', 'scrollbars=yes, menubar=no, toolbar=no, resizeable=yes');
}
function privacyPolicyEage()
{
var action = "privacypolicyeage";
var URL =// contextPath + "/"+ 
action + ".do";
window.open(URL, '', 'scrollbars=yes, menubar=no, toolbar=no, resizeable=yes');
}

function check_length(StudentWriteToUsForm)
{
maxLen = 511; 
if (StudentWriteToUsForm.myTextArea1.value.length >= maxLen) {
var msg = "You have reached your maximum limit of characters allowed";
alert(msg);

}
}

function apply() {

	document.getElementById("errorPanel").innerHTML = "";
	
	var errorMsgs = new Array();
	var errorFlag = false;
	var errorIndex = 0;	
	
	var subject = document.StudentWriteToUsForm.subject.value;	
	var comment =document.StudentWriteToUsForm.comments.value;	
	var userrole=document.StudentWriteToUsForm.contactType.value;
	var name=document.StudentWriteToUsForm.name.value;
	var email=document.StudentWriteToUsForm.email.value;
	
	if(subject == 'null')
	{		
		errorMsgs[errorIndex] = "Please select what is your query about.";
		errorIndex = errorIndex + 1;
		errorFlag =true;
	}
	if(comment == '')
	{
		errorMsgs[errorIndex] = "Please enter Comments.";
		errorIndex = errorIndex + 1;
		errorFlag =true;
	}	
				
	if((document.StudentWriteToUsForm.contactMeBy[0].checked == false) && (document.StudentWriteToUsForm.contactMeBy[1].checked == false))
	{
		errorMsgs[errorIndex] = "Please select Contact Me By.";
		errorIndex = errorIndex + 1;
		errorFlag =true;
	}
	
	
	/*var answer = false;
	
	if (!errorFlag) {
		var alertMsg = "";
		
			alertMsg = "Are you sure to save?";
	
		 answer = confirm(alertMsg);
		
		
	}else{	*/
	document.getElementById("errors").style.display='none';
		var errorMsg = "";
		
		for (var i = 0; i < errorIndex; i++) {
			errorMsg = errorMsg + errorMsgs[i] + "<br/>";		
			
		document.getElementById("errorPanel").innerHTML = errorMsg;
		document.getElementById("errorPanel").setAttribute("class", "err");
		document.getElementById("errorPanel").focus();
		
	}
	
	
	//}
	if (!errorFlag) {
		document.forms[0].submit();
				}
			return;
	
}	
function applied() {

	document.getElementById("errorPanel").innerHTML = "";
	var errorMsgs = new Array();
	var errorFlag = false;
	var errorIndex = 0;	
	
	var subject = document.StudentWriteToUsForm.subject.value;	
	var comment = document.StudentWriteToUsForm.comments.value;		
	var name=document.StudentWriteToUsForm.name.value;
	var email=document.StudentWriteToUsForm.email.value;
	var phone=document.StudentWriteToUsForm.phoneNumber.value;
	
	
	
	if(name == '')
	{
		errorMsgs[errorIndex] = "Please enter your name.";
		errorIndex = errorIndex + 1;
		errorFlag =true;
	}	
	
	if (!isEmpty(name) && !isValidCNames(name) || valid(name) && !name == '')
	{
		errorMsgs[errorIndex] = "Please enter valid name.";
		errorIndex = errorIndex + 1;
		errorFlag = true;
	}	
	if(email == '' || !trim(email))
	{
		errorMsgs[errorIndex] = "Please enter your Email.";
		errorIndex = errorIndex + 1;
		errorFlag =true;
	}	
	/*if(phone == '')
	{
		errorMsgs[errorIndex] = "Please enter your Phone Number.";
		errorIndex = errorIndex + 1;
		errorFlag =true;
	}	*/	
	
	if(subject == 'null')
	{
	
		errorMsgs[errorIndex] = "Please select what is your query about.";
		errorIndex = errorIndex + 1;
		errorFlag =true;
	}
	if(comment == '' || !trim(comment))
	{
		errorMsgs[errorIndex] = "Please enter Comments.";
		errorIndex = errorIndex + 1;
		errorFlag =true;
	}	
	
	if(!isValidPhoneNumber(phone) && !isEmpty(phone))
	{
	  errorMsgs[errorIndex] = "Please enter Valid Phone Number.";
		errorIndex = errorIndex + 1;
		errorFlag =true;
	}
	if(!isEmpty(phone) && validphone(phone))
	{
	  errorMsgs[errorIndex] = "Please enter Valid Phone Number.";
		errorIndex = errorIndex + 1;
		errorFlag =true;
	}
	if(document.StudentWriteToUsForm.contactMeBy[1].checked == true && isEmpty(phone))
	{	
		
		errorMsgs[errorIndex] = "Please provide us your phone number.";
		errorIndex = errorIndex + 1;
		errorFlag =true;
	}	
			
	if((document.StudentWriteToUsForm.contactMeBy[0].checked == false) && (document.StudentWriteToUsForm.contactMeBy[1].checked == false))
	{
		errorMsgs[errorIndex] = "Please select Contact  By.";
		errorIndex = errorIndex + 1;
		errorFlag =true;
	}
	
	var x = isValidEmail(email);
	if (!isEmpty(email) && -1 != x) {
		errorMsgs[errorIndex] = emailError[x];
		errorIndex = errorIndex + 1;
		errorFlag = true;
	}
	
	
	var answer = false;
	
	/*if (!errorFlag) {
		var alertMsg = "";
		
			alertMsg = "Are you sure to save?";
	
		 answer = confirm(alertMsg);
		*/
		
	//}else{	
		document.getElementById("errors").style.display='none';
		var errorMsg = "";		
		
		for (var i = 0; i < errorIndex; i++) {
			errorMsg = errorMsg + errorMsgs[i] + "<br/>" ;		
			
		document.getElementById("errorPanel").style.display = "block";
		document.getElementById("errorPanel").innerHTML = errorMsg;
		document.getElementById("errorPanel").setAttribute("class", "err");
		document.getElementById("errorPanel").focus();
		
	}
	
	
	//}
	if (!errorFlag) {
	
		document.StudentWriteToUsForm.submit();
		
		}
			return;
	
}	

function queryApplied() {

	document.getElementById("errorPanel").innerHTML = "";
	var errorMsgs = new Array();
	var errorFlag = false;
	var errorIndex = 0;	
	
	var subject = document.StudentWriteToUsForm.subject.value;	
	var comment = document.StudentWriteToUsForm.comments.value;		
	var name=document.StudentWriteToUsForm.name.value;
	var email=document.StudentWriteToUsForm.email.value;
	var phone=document.StudentWriteToUsForm.phoneNumber.value;
	
	
	
	if(name == '')
	{
		errorMsgs[errorIndex] = "Please enter your name.";
		errorIndex = errorIndex + 1;
		errorFlag =true;
	}	
	
	if (!isEmpty(name) && !isValidCNames(name) || valid(name) && !name == '')
	{
		errorMsgs[errorIndex] = "Please enter valid name.";
		errorIndex = errorIndex + 1;
		errorFlag = true;
	}	
	if(email == '' || !trim(email))
	{
		errorMsgs[errorIndex] = "Please enter your Email.";
		errorIndex = errorIndex + 1;
		errorFlag =true;
	}	
	/*if(phone == '')
	{
		errorMsgs[errorIndex] = "Please enter your Phone Number.";
		errorIndex = errorIndex + 1;
		errorFlag =true;
	}	*/	
	
	if(subject == 'null')
	{
	
		errorMsgs[errorIndex] = "Please select what is your query about.";
		errorIndex = errorIndex + 1;
		errorFlag =true;
	}
	if(comment == '' || !trim(comment))
	{
		errorMsgs[errorIndex] = "Please enter Comments.";
		errorIndex = errorIndex + 1;
		errorFlag =true;
	}	
	
	if(!isValidPhoneNumber(phone) && !isEmpty(phone))
	{
	  errorMsgs[errorIndex] = "Please enter Valid Phone Number.";
		errorIndex = errorIndex + 1;
		errorFlag =true;
	}
	if(!isEmpty(phone) && validphone(phone))
	{
	  errorMsgs[errorIndex] = "Please enter Valid Phone Number.";
		errorIndex = errorIndex + 1;
		errorFlag =true;
	}
	if(document.StudentWriteToUsForm.contactMeBy[1].checked == true && isEmpty(phone))
	{	
		
		errorMsgs[errorIndex] = "Please provide us your phone number.";
		errorIndex = errorIndex + 1;
		errorFlag =true;
	}	
			
	if((document.StudentWriteToUsForm.contactMeBy[0].checked == false) && (document.StudentWriteToUsForm.contactMeBy[1].checked == false))
	{
		errorMsgs[errorIndex] = "Please select Contact  By.";
		errorIndex = errorIndex + 1;
		errorFlag =true;
	}
	
	var x = isValidEmail(email);
	if (!isEmpty(email) && -1 != x) {
		errorMsgs[errorIndex] = emailError[x];
		errorIndex = errorIndex + 1;
		errorFlag = true;
	}
	
	
	var answer = false;
	
	/*if (!errorFlag) {
		var alertMsg = "";
		
			alertMsg = "Are you sure to save?";
	
		 answer = confirm(alertMsg);
		*/
		
	//}else{	
		
		var errorMsg = "";		
		
		for (var i = 0; i < errorIndex; i++) {
			errorMsg = errorMsg + errorMsgs[i] + "<br/>" ;		
			
		document.getElementById("errorPanel").style.display = "block";
		document.getElementById("errorPanel").innerHTML = errorMsg;
		document.getElementById("errorPanel").setAttribute("class", "err");
		document.getElementById("errorPanel").focus();
		
	}
	
	
	//}
	if (!errorFlag) {
	
		document.StudentWriteToUsForm.submit();
		
		}
			return;
	
}	

function show(display) {
 
	if(display == "yes"){
	var answer = alert("Your request has been submitted.We shall get back to you.");			
		document.location="registrationHome.do";	
	}
}	
function clickCancel() {
 
	var answer = confirm("Are you sure you want to cancel?");
			if(answer)	{
		document.location="registrationHome.do";	
	}
}
function clickGuruCancel() {
 
	var answer = confirm("Are you sure you want to cancel?");
			if(answer)	{
		document.location="guruAllowedAndApprovedAction.do";	
	}
}

function clickCancelButton() {
	var answer = confirm("Are you sure you want to cancel?");	
	if (answer ) {		
		document.location="studmyeagespace.do";			
	}
}
function parentCancelButton() {
	var answer = confirm("Are you sure you want to cancel?");	
	if (answer ) {		
		document.location="userHome.do";			
	}
}

function showAlert(display) {
 var userrole=document.StudentWriteToUsForm.contactType.value;
	if(display == "yes" && userrole == "Student"){
	var answer = alert("Your request has been submitted.We shall get back to you.");			
		document.location="studmyeagespace.do";	
	}
	else if(display == "yes" && userrole == "Guru"){
	var answer = alert("Your request has been submitted.We shall get back to you.");			
		document.location="guruAllowedAndApprovedAction.do";	
	}
}
function openwindow(url)
{
window.open(url,"MyWindow","menubar=0,resizable=1,toolbar=0,status=0,scrollbars=yes")
}
