////validation_functions.js starts here

function Trim(nStr){return nStr.replace(/(^\s*)|(\s*$)/g, "");}
function fnPaste(){event.returnValue=false;}

function isNull(obj, divid, msg)	{
	if(msg!="Password"){obj1=Trim(obj.value);}
	else{obj1=obj.value;}	
	if (obj1=="")	{
		obj.focus();
		obj.style.borderColor="red";
		document.getElementById(divid).style.display = "block"
		document.getElementById(divid).innerHTML ="<font color='#FF0000'>Please enter your "+msg+"</font>";
		obj.onblur = function () {
			if(this.value!=""){
				this.style.borderColor="#cacaca";
			}
		};
		return true;
	} else {
		document.getElementById(divid).style.display = "none"
		document.getElementById(divid).innerHTML ="";
		return false;
	}
}
function isNullNew(obj, divid, msg)	{
	if(msg!="Password"){obj1=Trim(obj.value);}
	else{obj1=obj.value;}	
	if (obj1=="")	{
		obj.focus();
		obj.style.borderColor="red";
		document.getElementById(divid).style.display = "block"
		document.getElementById(divid).innerHTML ="<font color='#FF0000'>Please "+msg+"</font>";
		obj.onblur = function () {
			if(this.value!=""){
				this.style.borderColor="#cacaca";
			}
		};
		return true;
	} else {
		document.getElementById(divid).style.display = "none"
		document.getElementById(divid).innerHTML ="";
		return false;
	}
}

function isNullTestVariableCheckBox(obj, divid, msg)	{
	if(msg!="Password"){obj1=Trim(obj.value);}
	else{obj1=obj.value;}	
	if (obj1=="")	{
		obj.focus();
		obj.style.borderColor="red";
		document.getElementById(divid).style.display = "none"
		//document.getElementById(divid).innerHTML ="<font color='#FF0000'>Please enter your "+msg+"</font>";
		obj.onblur = function () {
			if(this.value!=""){
				this.style.borderColor="#cacaca";
			}
		};
		return true;
	} else {
		document.getElementById(divid).style.display = "none"
		document.getElementById(divid).innerHTML ="";
		return false;
	}
}
function isNullLst(obj, divid, msg)	{
	if(msg!="Password"){obj1=Trim(obj.value);}
	else{obj1=obj.value;}	
	if (obj1=="")	{
		obj.style.borderColor="red";
		document.getElementById(divid).style.display = "block"
		document.getElementById(divid).innerHTML ="<font color='#FF0000'>Please select your "+msg+"</font>";
		obj.onblur = function () {
			if(this.value!=""){
				this.style.borderColor="#cacaca";
			}
		};
		return true;
	} else {
		document.getElementById(divid).style.display = "none"
		document.getElementById(divid).innerHTML ="";
		return false;
	}
}


function isNull_photo(obj, divid, msg)	{
	if(msg!="Password"){obj1=Trim(obj.value);}
	else{obj1=obj.value;}	
	if (obj1=="")	{
		obj.style.borderColor="red";
		document.getElementById(divid).style.display = "block"
		document.getElementById(divid).innerHTML ="<font color='#FF0000'>Please upload your "+msg+"</font>";
		obj.onblur = function () {
			if(this.value!=""){
				this.style.borderColor="#cacaca";
			}
		};
		return true;
	} else {
		document.getElementById(divid).style.display = "none"
		document.getElementById(divid).innerHTML ="";
		return false;
	}
}



function isNull_cp(obj,divid,msg)	{
	if(msg!="Password"){obj1=Trim(obj.value);}
	else{obj1=obj.value;}	
	if (obj1=="")	{
		obj.style.borderColor="red";
		document.getElementById(divid).style.display = "block"
		document.getElementById(divid).innerHTML ="<font color='#FF0000'>Please confirm your "+msg+"</font>";
		obj.onblur = function () {
			if(this.value!=""){
				this.style.borderColor="#cacaca";
			}
		};
		return true;
	} else {
		document.getElementById(divid).style.display = "none"
		document.getElementById(divid).innerHTML ="";
		return false;
	}
}


function isNull_noFocus(obj,divid,msg)
{
	if(msg!="Password"){obj1=Trim(obj.value);}
	else{obj1=obj.value;}	
	if (obj1=="")	{
		document.getElementById(divid).style.display="block";
		document.getElementById(divid).innerHTML ="<font color='#FF0000'>Please enter the "+msg+"</font>";
		return true;
	} else {
		document.getElementById(divid).innerHTML ="";
		document.getElementById(divid).style.display="none";
		return false;
	}
}
function isNull_noFocusFB(obj,divid,msg)
{
	if(msg!="Password"){obj1=Trim(obj.value);}
	else{obj1=obj.value;}	
	if (obj1=="")	{
		document.getElementById(divid).style.display="block";
		document.getElementById(divid).innerHTML ="Please "+msg;
		return true;
	} else {
		document.getElementById(divid).innerHTML ="";
		document.getElementById(divid).style.display="none";
		return false;
	}
}

function isNull_about(obj,divid,msg)	{
	if(msg!="Password"){obj1=Trim(obj.value);}
	else{obj1=obj.value;}	
	if (obj1=="")	{
		obj.style.borderColor="red";
		document.getElementById(divid).style.display = "block"
		document.getElementById(divid).innerHTML ="<font color='#FF0000'>Please enter "+msg+"</font>";
		obj.onblur = function () {
			if(this.value!=""){
				this.style.borderColor="#cacaca";
			}
		};
		return true;
	} else {
		document.getElementById(divid).style.display = "none"
		document.getElementById(divid).innerHTML ="";
		return false;
	}
}

function notChecked1(obj,divid,msg)	{
    obj.style.borderColor="red";
    checked = false;
	if(obj.length)	{
		for(i=0;i<obj.length;i++)	{
			if(obj[i].checked)
			{checked = true;break;}
		}
	}
	else if(obj.checked)
		checked = true;
	if(!(checked))
	{alert("Please Select Atleast One Record");return true;
	document.getElementById(divid).innerHTML ="Please Select Atleast One Record";}
}

function fnChkAlpha(obj,divid,msg)	{
	exp = (/(^([a-z]|[A-Z]|["."]|[\s])*$)/);
	if (!exp.test(obj.value))	{
		obj.style.borderColor="red";
		document.getElementById(divid).innerHTML ="Please enter only alphabets in "+msg;
		obj.focus();
		return true;
	} else {
		document.getElementById(divid).innerHTML ="";
		return false;
	}
}	

function isNulltinymce(obj,divid,msg)	{
	if(msg!="Password"){obj1=Trim(obj.value);}
	else{obj1=obj.value;}	
	if (obj1=="")	{
		obj.style.borderColor="red";
		document.getElementById(divid).style.display="block";
		document.getElementById(divid).innerHTML="Please enter the "+msg;
		obj.onblur = function () {
			if(this.value!=""){
				this.style.borderColor="#cacaca";
			}
		};
		return true;
	} else {
		document.getElementById(divid).style.display = "none";
		document.getElementById(divid).innerHTML ="";
		return false;
	}
}

function fnChkAlphaNum(obj,msg)	{
	exp = (/(^([a-z]|[A-Z]|[0-9])*$)/);
	if (!exp.test(obj.value))	{
		alert("Please enter only alphanumeric in "+msg);
		obj.focus();
		return true;
	}	else
		return false;
}

function notEmail(obj, divid, msg)	{
	var exp=/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/;
	if (!exp.test(obj.value))	{
		obj.style.borderColor="red";
		document.getElementById(divid).style.display = "block";
		document.getElementById(divid).innerHTML ="Please enter valid "+msg;
		obj.focus();
		obj.onblur = function () {
			if(exp.test(this.value)){
				this.style.borderColor="#cacaca";
			}
		};
		obj.focus();
		return true;
	} else {
		document.getElementById(divid).style.display = "none";
		document.getElementById(divid).innerHTML ="";
		return false;
	}
}


function notEmailreg(obj, divid, msg)	{
	var exp=/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/;
	if (!exp.test(obj.value))	{
		obj.style.borderColor="red";
		document.getElementById(divid).style.display = "block";
		document.getElementById(divid).innerHTML ="Please enter valid "+msg;
		obj.focus();
		obj.onblur = function () {
			if(exp.test(this.value)){
				this.style.borderColor="#cacaca";
			}
		};
		obj.focus();
		return true;
	} else {
		fngetmail(obj.value);
		document.getElementById(divid).style.display = "none";
		document.getElementById(divid).innerHTML ="";
		return false;
	}
}

function not_Email(obj, divid, msg)	{
	var exp=/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/;
	if (!exp.test(obj.value))	{
		obj.style.borderColor="red";
		document.getElementById(divid).style.display = "block";
		document.getElementById(divid).innerHTML ="Please enter valid "+msg;
		obj.focus();
		obj.onblur = function () {
			if(exp.test(this.value)){
				this.style.borderColor="#cacaca";
			}
		};
		obj.focus();
		return true;
	} else {
		document.getElementById(divid).innerHTML ="";
		return false;
	}
}



function notValideEmail(obj, divid, msg)	{
	if(msg!="Password"){obj1=Trim(obj.value);}
	else{obj1=obj.value;}	
	if (obj1=="")	{
		obj.style.borderColor="red";
		document.getElementById(divid).style.display = "block"
		document.getElementById(divid).innerHTML ="<font color='#FF0000'>Please enter the "+msg+"</font>";
		obj.onblur = function () {
			if(this.value!=""){
				this.style.borderColor="#cacaca";
			}
		};
		return true;
	} else {
		var exp=/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/;
		if (!exp.test(obj.value))	{
			obj.style.borderColor="red";
			document.getElementById(divid).innerHTML ="Please enter valid "+msg;
			obj.onblur = function () {
				if(exp.test(this.value)){
					this.style.borderColor="#cacaca";
				}
			};
			obj.focus();
			return true;
		} else {
			document.getElementById(divid).innerHTML ="";
			document.getElementById(divid).style.display = "none"	
			return false;
		}
	}
}

function is_valid_url(obj, divid, msg)	{
	var exp=/^(ht|f)tps?:\/\/[a-z0-9-\.]+\.[a-z]{2,4}\/?([^\s<>\#%"\,\{\}\\|\\\^\[\]`]+)?$/;
	if (!exp.test(obj.value))	{
		obj.style.borderColor="red";
		document.getElementById(divid).innerHTML ="Please enter valid "+msg;
		obj.focus();
		obj.onblur = function () {
			if(exp.test(this.value)){
				this.style.borderColor="#cacaca";
			}
		};
		obj.focus();
		return true;
	} else {
		document.getElementById(divid).innerHTML ="";
		return false;
	}
} 

function isSame1(obj1,obj2)	{
	if((Trim(obj1.value))!=(Trim(obj2.value)))	{
		obj2.style.borderColor="red";
		obj2.focus();
		obj2.onblur = function () {
			if(this.value!=""){
				this.style.borderColor="#cacaca";
			}
		};
		return true;
	} else {
		return false;
	}	
}	

function isNullHidden(obj,msg)	{
	if (obj.value=="")	{
		alert("Please enter the " +msg);
		return true;
	}	else
		return false;
}

function fnChkAlphaNumeric(obj,msg)	{
	var Alpha = /[a-zA-Z|]/;
	var Num = /[\d]/;
	if (!(Alpha.test(obj.value) && Num.test(obj.value)))	{
		alert("Please enter only alphanumeric in "+msg);
		obj.focus();
		return true;
	} else
		return false;
}

function notZipcode(obj,msg)	{
	exp = /[a-zA-Z|\d]-{1}/;
	if (!exp.test(obj.value))	{
		alert("Please enter valid "+msg);
		obj.focus();
		return true;
	}
	else
		return false;
}

function notChecked(obj, divid, msg)	{
	checked = false;
	if(obj.length)	{
		for(i=0;i<obj.length;i++)	{
			if(obj[i].checked)
				{checked = true;break;}
		}
	}
	else if(obj.checked)
		checked = true;

	if(!(checked))	{
		if(checked==false)	{
			document.getElementById(divid).style.display="block"
			document.getElementById(divid).innerHTML ="<font color='#FF0000'>Please select the "+msg+"</font>";
			return  true;
		} else {
			document.getElementById(divid).innerHTML ="";
			document.getElementById(divid).style.display= "none";
			return false;
		}
	}
}

function notCheckedRadio(inputcontrols, divid, msg)	{
	myOption = -1;
	var rdo_length = inputcontrols.length;
	for (i=rdo_length-1; i > -1; i--) {
		if (document.test_form.rdo1[i].checked==false) {
			myOption = i; i = -1;
		}
	}
	if (myOption == -1)	{
		document.getElementById(divid).style.display="block"
		document.getElementById(divid).innerHTML ="<font color='#FF0000'>Please select the "+msg+"</font>";
		return  true;
	} else {
		document.getElementById(divid).innerHTML ="";
		document.getElementById(divid).style.display= "none";
		return false;
	}
}

function notSelected(obj, divid, msg)	{
	if ((obj.options[obj.selectedIndex].value)=="")	{
		var c=obj.options[obj.selectedIndex].value;
		document.getElementById(divid).style.display= "block";
		document.getElementById(divid).innerHTML ="<font color='#FF0000'>Please select the "+msg+"</font>";
		return true;
	} else {
		document.getElementById(divid).innerHTML ="";
		document.getElementById(divid).style.display= "none";
		return false;
	}
}
function notSelectedFB(obj, divid, msg)	{
	if ((obj.options[obj.selectedIndex].value)=="")	{
		var c=obj.options[obj.selectedIndex].value;
		document.getElementById(divid).style.display= "block";
		document.getElementById(divid).innerHTML ="<font color='#FF0000'>Please "+msg+"</font>";
		return true;
	} else {
		document.getElementById(divid).innerHTML ="";
		document.getElementById(divid).style.display= "none";
		return false;
	}
}
function notSelectedc(obj, divid, msg)	{
	if ((obj.options[obj.selectedIndex].value)=="")	{
		var c=obj.options[obj.selectedIndex].value;
		document.getElementById(divid).style.display= "block";
		document.getElementById(divid).innerHTML ="<font color='#FF0000'>Please select your "+msg+"</font>";
		return true;
	} else {
		document.getElementById(divid).innerHTML ="";
		document.getElementById(divid).style.display= "none";
		return false;
	}
}

function notSelected_new(obj, divid, msg)	{
	if ((obj.options[obj.selectedIndex].value)=="")	{
		var c=obj.options[obj.selectedIndex].value;
		document.getElementById(divid).style.display= "block";
		document.getElementById(divid).innerHTML ="<font color='#FF0000'>Please select "+msg+"</font>";
		return true;
	} else {
		document.getElementById(divid).innerHTML ="";
		document.getElementById(divid).style.display= "none";
		return false;
	}
}
function notImageFile(obj, divid, msg)	{
	var exp = /^.+\.(jpg|gif|jpeg|JPG|JPEG|GIF)$/;
	if (!exp.test((obj.value).toLowerCase()))	{
		document.getElementById(divid).style.display= "block";
		obj.style.borderColor="red";
		document.getElementById(divid).innerHTML ="Please choose jpg or gif file for "+msg;
		obj.focus();
		return true;
	} else {
		document.getElementById(divid).innerHTML ="";
		return false;
	}
}


function notreportfile(obj, divid, msg)	{ 
	var exp = /^.+\.(jpg|gif|jpeg|JPG|JPEG|GIF|DOC|doc|TXT|txt|XLS|xls|PDF|pdf)$/;
	if (!exp.test((obj.value).toLowerCase()))	{
		obj.style.borderColor="red";
		document.getElementById(divid).innerHTML ="Please choose jpg or gif or txt or doc or pdf file for "+msg;
	
		obj.focus();
		return true;
	} else {
		document.getElementById(divid).innerHTML ="";
		return false;
	}
}
 
function notDocFile(obj,msg) {
	if(Trim(obj.value)!="") {
		var exp = /^.+\.(DOC|doc|TXT|txt)$/;
		if (!exp.test((obj.value).toLowerCase())) {
			alert("Please choose doc or txt file for "+msg);
			obj.value="";
			obj.focus();
			return true;
		} else
			return false;	
	}
	else
		return false;
}

function notPdfDocFile(obj,msg) {
	var exp = /^.+\.(pdf|doc|PDF|DOC)$/;
	if (!exp.test((obj.value).toLowerCase())) {
		alert("Please choose pdf or doc file for "+msg);
		obj.value="";
		obj.focus();
		return true;
	}
	else
		return false;
}

function notPdfFile(obj,msg) {
	var exp = /^.+\.(pdf|PDF)$/;
	if (!exp.test((obj.value).toLowerCase())) {
		alert("Please choose pdf file for "+msg);
		obj.value="";
		obj.focus();
		return true;
	} else
		return false;
}

function notPrice(obj,msg) {
	exp = /^[\d]*[\.]{0,1}[\d]{1,2}$/;
	if (!exp.test(obj.value)) {
		alert("Please enter valid "+msg);
		obj.focus();
		return true;
	} else
		return false;
}

function fnChkNum2(obj,msg) {
	exp = /^[\d]/;
	if (!exp.test(obj.value)) {
		obj.style.borderColor="red";
		obj.focus();
		obj.onblur = function () {
			if(exp.test(this.value)){
				this.style.borderColor="#cacaca";
			}
		};
		obj.focus();
		return true;
	} else
		return false;
}

function fnChkFolderName()	{
	if (((window.event.keyCode < 48) || (window.event.keyCode > 57)) && ((window.event.keyCode < 65) || (window.event.keyCode > 90)) && ((window.event.keyCode < 97) || (window.event.keyCode > 122)) && (window.event.keyCode != 95)) {
		alert("Only Alphabets(A-Z, a-z), Numbers(0-9) and Underscore(_) are allowed");
		window.event.keyCode = 0;
	}
}

function isLen(obj,siz,msg)	{
	if(msg!="Password")	{
		obj1=Trim(obj.value);
	} else {
		obj1=obj.value;
	}	
	if(obj1!="") {
		var strLen=obj.value;
		if(strLen.length < siz) {
			alert(msg+" should be atleast " + siz + " characters");
			obj.focus();
			return true;  
		} 
	} else {
		return false;
	}	
}

function isSame(obj1,obj2,msg1,msg2) {
	if((Trim(obj1.value))==(Trim(obj2.value))) {
		alert(msg1+" is matched with the "+msg2);
		obj2.focus();
		return true;
	} else {
		return false;
	}	
}	
	
function isNotSame(obj1,obj2,msg1) {
	if((Trim(obj1.value))!=(Trim(obj2.value))) {
		alert(msg1+" does not match");
		obj2.focus();
		return true;
	} else {
		return false;
	}	
}

function isCorrect(obj1,obj2,msg1,msg2) {
	if((Trim(obj1.value)) > (Trim(obj2.value))) {
		alert(msg1+" should be less than "+msg2);
		obj2.focus();
		return true;
	} else {
		return false;
	}	
}	
	
function isNullEditor(obj,str) {
	if (Trim(obj.value)=="") {
		alert("Please enter the " + str);
		return true;
	} else
		return false;
}

function isTxtareaNull(obj,msg) {
	if(Trim(obj.innerText) == "") {
		alert("Please enter " + msg);
		obj.focus();
		return true;
	} else
		return false;
}

function isTxtareaLen(obj,msg) {
	if(obj.innerHTML.length > 255 ) {
		alert("Please enter below 256 characters in " + msg);
		obj.focus();
		return true;
	} else
		return false;
}

function fnShowDate(obj,msg)  {
	var retdate=window.showModalDialog("includes/calender.htm","","dialogHeight: 219px; dialogWidth: 273px;  center: Yes; help: No; resizable: No; status: No;titlebar:No");
	obj.value=retdate;
}
	
function isNullMulti(obj,msg) {
	if (Trim(obj.value)=="") {
		alert("Please select the " + msg);
		obj.focus();
		return true;
	} else
		return false;
}

function isNullCbo(obj,msg) {
	if (Trim(obj.value)=="") {
		obj.style.borderColor="red";
		obj.focus();
		obj.onblur = function () {
			if(this.value!=""){
				this.style.borderColor="#cacaca";
			}
		};
		obj.focus();
		return true;
	} else
		return false;
}

function fnChkNum(obj) {
	exp1 = /[^0-9]/;
	if (exp1.test(obj.value)) {
		alert("Only  numbers(0-9) are allowed");
		obj.value = "";
		obj.focus();
		return true;
	}
}

function fnChkNum(obj,divid,msg) {
	exp = /^[\d]/;
	if (!exp.test(obj.value)) {
		obj.style.borderColor="red";
		document.getElementById(divid).innerHTML ="Please enter only numeric in "+msg;
		obj.focus();
		obj.onblur = function () {
			if(exp.test(this.value)){
				this.style.borderColor="#cacaca";
			}
		};
		obj.focus();
		return true;
	} else {
		document.getElementById(divid).innerHTML ="";
		return false;
	}
}

function isPassword(obj) { 
	if ((obj.value.length)<4) {
		alert("Password should have atleast 4 characters");
		obj.focus();
		return true;
	}
	exp=/[^a-zA-Z0-9]/;
	if(exp.test(obj.value)) {
		alert("Special characters not accepted");
		obj.focus();
		return true;
	}
	else
		return false;
}

function isNullAndLength(obj, divid, msg, word_limit) {
	if(msg!="Password"){obj1=Trim(obj.value);}
	else{obj1=obj.value;}	
	if (obj1!="")	{
		var str = obj.value;
		var strLength = str.length;
		if(strLength>word_limit)	{
			obj.style.borderColor="red";
			document.getElementById(divid).style.display = "block"
			document.getElementById(divid).innerHTML ="<font color='#FF0000'>Please enter the "+msg+"</font>";
			obj.focus();
			obj.onblur = function () {
				if(this.value!=""){
					this.style.borderColor="#cacaca";
				}
			};
			return true;
		} else {
			document.getElementById(divid).style.display = "none"
			document.getElementById(divid).innerHTML ="";
			return false;
		}
	}
}

function fnisphone(obj,divid,msg)	{
	exp = (/(^([0-9]|[(]|[)]|[-]|[ ])*$)/);
	if (!exp.test(obj.value))	{ 
		obj.style.borderColor="red";
		document.getElementById(divid).style.display = "block";
		document.getElementById(divid).innerHTML ="Please enter only numeric in "+msg;
		obj.focus();
		obj.onblur = function () {
			if(exp.test(this.value)){
				this.style.borderColor="#cacaca";
			}
		};
		obj.focus();
		return true;
	} else {
		document.getElementById(divid).style.display = "none";
		document.getElementById(divid).innerHTML ="";
		return false;
	}
}






////validation_functions.js Ends here


















// Edit Customer validation function

function fnquestion(i) {
	var isValid = true;
	divrate='divrate'+i;
	if(notSelected(document.getElementById('cmbrate'+i),divrate,"Rate E-coach for this Answer")){isValid = false};
	return isValid;
}

// Change Password validation Function

function fnchange_password() {
	var isValid = true;
	
	if(isNull(document.getElementById('txtOldPassword'),"divOldPassword","Old Password")){isValid = false};
	if(isNull(document.getElementById('txtNewPassword'),"divNewPassword","New Password")){isValid = false};
	if(isNull(document.getElementById('txtConfirmPassword'),"divConfirmPassword","Confirm Password")){isValid = false};

	return isValid;
}

// Confirm Password Function

function fnConfirmPassword() {
	var	obj1 = document.change_password_form.txtNewPassword;
	var	obj2 = document.change_password_form.txtConfirmPassword;

	if (Trim(obj2.value)=="")
	{
		obj2.style.borderColor="red";
		document.getElementById("divConfirmPassword").innerHTML ="Please enter the Confirm Password";
		obj2.focus();
		obj2.onblur = function () {
			if(this.value!=""){
				this.style.borderColor="#cacaca";
			}
		};
		return true;
	} else {
		if((Trim(obj1.value))!=(Trim(obj2.value)))
		{
			obj2.style.borderColor="red";
			document.getElementById("divConfirmPassword").innerHTML ="New Password doesn't match with Confirm Password.";
			obj2.focus();
			obj2.onblur = function () {
				if(this.value!=""){
					this.style.borderColor="#cacaca";
				}
			};
			return true;
		} else {
			document.getElementById("divConfirmPassword").innerHTML ="";
			return false;
		}
	}
}


 //--------------------------------------------------------------------------------------//
// Common Functions for the pages

function fnIsNull(Field_id, divid, Msg) {
	
	if(isNull(document.getElementById(Field_id),divid,Msg)){return false};
}

function fnIsNull_arr(Field_id, divid, Msg) {
	if(isNull(Field_id,divid,Msg)){return false};
}

function fnIsNullMob(Field_id, divid, Msg) {
	document.getElementById("msgccode_tr").style.display="";
	if(isNull(document.getElementById(Field_id),divid,Msg)){return false};
}

function fnIsAlphabet(Field_id, divid, Msg) {
	if(isNull(document.getElementById(Field_id),divid,Msg)){return false};
	if(fnChkAlpha(document.getElementById(Field_id),divid,Msg)){return false};
}

function fnIsNumeric(Field_id, divid, Msg, Required) {
	if(Trim(Required)=="1") {
		if(isNull(document.getElementById(Field_id),divid,Msg)){return false};
	}
	if(Trim(document.getElementById(Field_id).value)!="") {
		if(fnChkNum(document.getElementById(Field_id),divid,Msg)){return false};
	}
}

function fnIsEmail(Field_id, divid, Msg) {
	if(isNull(document.getElementById(Field_id),divid,Msg)){return false};
	if(notEmailreg(document.getElementById(Field_id),divid,Msg)){return false};
}

function fnIsWebsites(Field_id, divid, Msg, Required) {
	if(Trim(Required)=="1") {
		if(isNull(document.getElementById(Field_id),divid,Msg)){return false};	
	}
	if(Trim(document.getElementById(Field_id).value)!="") {
		if(is_valid_url(document.getElementById(Field_id),divid,Msg)){return false};
	}
}

function fncmbChange(Field_id, divid, Msg) {
	if(notSelectedc(document.getElementById(Field_id),divid,Msg)){return false};
}

function fnIsImg(Field_id, divid, Msg) {
	if(isNull(document.getElementById(Field_id),divid,Msg)){return false};
	if(notImageFile(document.getElementById(Field_id),divid,Msg)){return false};
}
function fnIsDocPdfFile(Field_id, divid, Msg, Required) {
	if(Trim(Required)=="1") {
		if(isNull(document.getElementById(Field_id),divid,Msg)){return false};
	}
	if(Trim(document.getElementById(Field_id).value)!="") {
		if(notDocPdfFile(document.getElementById(Field_id),divid,Msg)){return false};
	}
}

function fnIsVideo(Field_id, divid, Msg, Required) {
	if(Trim(Required)=="1") {
		if(isNull(document.getElementById(Field_id),divid,Msg)){return false};
	}
	if(Trim(document.getElementById(Field_id).value)!="") {
		if(notVideoFile(document.getElementById(Field_id),divid,Msg)){return false};
	}
}

function fnIsDocPdfFileedit(Field_id, Hidfield_id, divid, Msg, Required) {
	if(Trim(Required)=="1") {
		if(isNull(document.getElementById(Hidfield_id),divid,Msg)){return false};
	}
	if(Trim(document.getElementById(Field_id).value)!="") {
		if(notDocPdfFile(document.getElementById(Field_id),divid,Msg)){return false};
	}
}

function fnIsImgedit(Field_id, Hidfield_id, divid, Msg) {
	if(Trim(document.getElementById(Hidfield_id).value)!="") {
		if(notImageFile(document.getElementById(Field_id),divid,Msg)){return false};
	}
}

function fnIsVideoedit(Field_id, Hidfield_id, divid, Msg) {
	if(document.getElementById(Field_id).value!="") {
		if(notVideoFile(document.getElementById(Field_id),divid,Msg)){return false};
	}
}

//


//***** Learner registration 

/*function fnlogin(Field_id, divid, Msg) {
	var isValid = true;
	if(isNull(document.frmLogin.txtuname,"msguname","User Name")){isValid = false};
	if(isNull(document.frmLogin.txtpword,"msgpass","Password")){isValid = false};
	
	if(isValid==true)
	{
		login();
		return false;
	}
	else
		return isValid;
}
*/
function fnlogin(Field_id, divid, Msg) {
	var isValid = true;
	var username=document.frmLogin.txtuname.value;
	var site="";
	if(isNull(document.frmLogin.txtuname,"msguname","User Name")){isValid = false};
	if(isNull(document.frmLogin.txtpword,"msgpass","Password")){isValid = false};
	if(username!="")
	{
		with (username)
		{
			apos=username.indexOf("@");
			dotpos=username.lastIndexOf(".");
			if (apos<1||dotpos-apos<2)
				{site="meta";}
			else 
				{site="imeta";}
		}
	}
	if(isValid==true && site=="imeta")
	{
		login();
		return false;
	}
	if(isValid==true && site=="meta")
	{
		metalogin();
		return false;
	}
	if(isValid==false)
		return isValid;
}
function fnloginNew(Field_id, divid, Msg) {
	
	var isValid = true;
	var username=document.frmLogin.txtuname.value;
	var site="";
	var Cnt=0;
	var DisplayMsg="";
	if(document.frmLogin.txtuname.value==''){isValid = false;Cnt=Cnt+1;DisplayMsg='Please enter your Username';};
	if(document.frmLogin.txtpword.value==''){isValid = false;Cnt=Cnt+1;DisplayMsg='Please enter your Password';};
	if(Cnt==2)
		DisplayMsg='Please enter your Username and Password';
	if(username!="")
	{
		 
		with (username)
		{
			apos=username.indexOf("@");
			dotpos=username.lastIndexOf(".");
			if (apos<1||dotpos-apos<2)
				{site="meta";}
			else 
				{site="imeta";}
		}
	}
	 
	if(isValid==true && site=="imeta")
	{
		 
		document.getElementById('loader').style.display="";
		document.getElementById('loginfailmessage').innerHTML="";
		login();
		return false;
	}
	if(isValid==true && site=="meta")
	{
		document.getElementById('loader').style.display="";
		document.getElementById('loginfailmessage').innerHTML="";
		metalogin();
		return false;
	}
	if(isValid==false)
	{
		document.getElementById('loader').style.display="none";
		document.getElementById('loginfailmessage').innerHTML="";
		document.getElementById('loginfailmessage').innerHTML="<font color=#cc0000>"+DisplayMsg+"</font>";
		return isValid;
	}
}



/*function validate_email(field,alerttxt)
{
with (field)
  {
  apos=value.indexOf("@");
  dotpos=value.lastIndexOf(".");
  if (apos<1||dotpos-apos<2)
    {alert(alerttxt);return false;}
  else {return true;}
  }
}
*/


function fnRegistration() {
	var isValid = true;
	if(isNull(document.FrmRegistration.txtfname,"msgfname","first name")){isValid = false};
	if(isNull(document.FrmRegistration.txtlname,"msglname","last name")){isValid = false};
	if(isNull(document.FrmRegistration.txtdob,"msgdob","date of birth")){isValid = false};
	if(notSelected(document.FrmRegistration.txtcountrycode,"msgccode","country code")){isValid = false};
	if(isNull(document.FrmRegistration.txtmobile,"msgmobile","Mobile No")){isValid = false};
	if(document.FrmRegistration.txtmobile.value!=""){ 
	    if(fnisphone(document.FrmRegistration.txtmobile,"msgmobile","Mobile No")){isValid = false};
	    
	}
	var mob=document.FrmRegistration.txtmobile.value;
	var moblen=mob.length;
	if(moblen<10){
	  document.getElementById("msgmobile").style.display="block";
	  document.getElementById("msgmobile").innerHTML="Please enter 10 digits for mobile number"; 
	  return false;
	 }
		// Is student	
	if(document.FrmRegistration.hidOccupation.value==1) {
		if(isNull(document.FrmRegistration.txtStudying,"divStudying","department of study")){isValid = false};
		if(isNull(document.FrmRegistration.txtCollege,"divCollege","college")){isValid = false};
		if(isNull(document.FrmRegistration.txtLocationc,"divLocationc","college location")){isValid = false};
	}
	// Is Working
	if(document.FrmRegistration.hidOccupation.value==2) {
		if(isNull(document.FrmRegistration.txtdesignation,"msgdesig","designation")){isValid = false};
		if(isNull(document.FrmRegistration.txtEducation,"divEducation","education")){isValid = false};
		if(isNull(document.FrmRegistration.txtLocationo,"divLocationo","office location")){isValid = false};
			 
	}
	// Is others
	if(document.FrmRegistration.hidOccupation.value==3) {
		if(isNull(document.FrmRegistration.txtothers,"divtxtothers","occupation")){isValid = false};
		if(isNull(document.FrmRegistration.txtLocation,"divLocation","location")){isValid = false};
		}
	if(isNull(document.FrmRegistration.txtCityTown,"divCityTown","city / town")){isValid = false};
	if(isNull(document.FrmRegistration.txtRegionState,"divRegionState","region / state")){isValid = false};
	if(notSelectedc(document.FrmRegistration.cmbCountry,"divCountry","country")){isValid = false};
	
	//if(isNull_about(document.FrmRegistration.txtaboutyourself,"divaboutyourself"," any other info about yourself")){isValid = false};
	if(document.getElementById('txtaboutyourself').value!=""){
	   no_words = document.getElementById('txtaboutyourself').value.split(" ");
	   count=no_words.length;
	   if(count>200){
		 document.getElementById('divaboutyourself').style.display="block";
		 document.getElementById('divaboutyourself').innerHTML="Your information contains more than 200 words. Please rephrase your information";
		 document.getElementById('txtaboutyourself').focus();
		 return false;
		}else{
		 document.getElementById('divaboutyourself').style.display="none";
		}

	}
	if(document.getElementById('txthidphoto').value==1){
	// if(isNull(document.FrmRegistration.txtfile,"divphoto","photo")){isValid = false};
	 if(isNull_photo(document.FrmRegistration.txtfile,"divphoto","photo")){isValid = false};
	  if(document.FrmRegistration.txtfile.value!=""){
		    //document.getElementById('divphoto').style.display="block";
		   if(notImageFile(document.FrmRegistration.txtfile,"divphoto","photo")){isValid = false};
	  }
	}
 



return isValid;
}



function fneventRegistration() {
	var isValid = true;
	var name=document.frmTransaction.name.value;
	
	if(isNull(document.frmTransaction.name,"msgname","name")){isValid = false};
   	if(isNull(document.frmTransaction.address,"msgaddress","address")){isValid = false};
    if(isNull(document.frmTransaction.city,"msgcity","city")){isValid = false};
	if(isNull(document.frmTransaction.state,"msgstate","state / province")){isValid = false};
	if(isNull(document.frmTransaction.postal_code,"msgpostal_code","zip / postal_code")){isValid = false};
    if(notSelected(document.frmTransaction.country,"msgcountry","country")){isValid = false};
	if(isNull(document.frmTransaction.email,"msgemail","email")){isValid = false};
	if(document.frmTransaction.email.value!=""){
	 if(not_Email(document.frmTransaction.email,"msgemail","email")){isValid = false};
	}
	if(document.frmTransaction.maildup.value!=""){
	 document.getElementById("mailerror").style.display="block";
	 document.getElementById("mailerror").innerHTML="You have been already registered with us.please use an different valid email ID";
	 return false;
	}
	if(isNull(document.frmTransaction.phone,"msgnumber","mobile number")){isValid = false};
	if(document.frmTransaction.phone.value!=""){ 
	 if(fnisphone(document.frmTransaction.phone,"msgnumber","mobile number")){isValid = false};
	}
	if(document.frmTransaction.evetype.value=="Public"){
	 if(isNull(document.frmTransaction.txtpublic,"msgpublic","public")){isValid = false};
	 document.getElementById("description").value=document.frmTransaction.txtpublic.value;
	}
	
	if(document.frmTransaction.evetype.value=="txtcollege"){
	 if(isNull(document.frmTransaction.txtcollege,"msgcollege","college name")){isValid = false};
	 document.getElementById("description").value=document.frmTransaction.txtcollege.value;
	}
	
	if(notCheckeddeclare(document.frmTransaction.chkdeclare,"msgdeclare","agree to the Declaration.")){isValid = false};
	
	if(notCheckeddeclare(document.frmTransaction.chkagree,"msgagree","agree to the Terms and Conditions and  Cancellation & Refund Policy.")){isValid = false};	
	
	if(document.frmTransaction.evetype.value=="cmbcollege"){
	 if(notSelected(document.frmTransaction.cmbcollege,"msgcmbcollege","college name")){isValid = false};
	 var college=document.frmTransaction.cmbcollege.value;
	 document.getElementById("description").value=college;
	 if(document.frmTransaction.cmbcollege.value!=""){
	   if(confirm("On program completion, a certificate will be issued to "+name+" of "+college+". Are you sure you have entered correct details? ")) {
	     }else{
	      return false;
	   }
	}
	}
	 

	
	
	document.frmTransaction.ship_name.value=document.frmTransaction.name.value;
   	document.frmTransaction.ship_address.value=document.frmTransaction.address.value;
    document.frmTransaction.ship_city.value=document.frmTransaction.city.value;
	document.frmTransaction.ship_state.value=document.frmTransaction.state.value;
	document.frmTransaction.ship_postal_code.value=document.frmTransaction.postal_code.value;
    document.frmTransaction.ship_country.value=document.frmTransaction.country.value;
    document.frmTransaction.ship_phone.value=document.frmTransaction.phone.value;
	
	return isValid;
}


function fnofflineRegistration() {
	
	var isValid = true;
	var name=document.frmbankTransaction.name.value;
	
	if(isNull(document.frmbankTransaction.name,"msgname","name")){isValid = false};
   	if(isNull(document.frmbankTransaction.address,"msgaddress","address")){isValid = false};
    if(isNull(document.frmbankTransaction.city,"msgcity","city")){isValid = false};
	if(isNull(document.frmbankTransaction.state,"msgstate","state / province")){isValid = false};
	if(isNull(document.frmbankTransaction.postal_code,"msgpostal_code","zip / postal_code")){isValid = false};
    if(notSelected(document.frmbankTransaction.country,"msgcountry","country")){isValid = false};
	if(isNull(document.frmbankTransaction.email,"msgemail","email")){isValid = false};
	if(document.frmbankTransaction.email.value!=""){
	 if(not_Email(document.frmbankTransaction.email,"msgemail","email")){isValid = false};
	}
	if(document.frmbankTransaction.maildup.value!=""){
	 document.getElementById("mailerror").style.display="block";
	 document.getElementById("mailerror").innerHTML="You have been already registered with us.please use an different valid email ID";
	 return false;
	}
	if(isNull(document.frmbankTransaction.phone,"msgnumber","mobile number")){isValid = false};
	if(document.frmbankTransaction.phone.value!=""){ 
	 if(fnisphone(document.frmbankTransaction.phone,"msgnumber","mobile number")){isValid = false};
	}
	if(document.frmbankTransaction.evetype.value=="Public"){
	 if(isNull(document.frmbankTransaction.txtpublic,"msgpublic","college name")){isValid = false};
	 
	}
	
	if(document.frmbankTransaction.evetype.value=="txtcollege"){
	 if(isNull(document.frmbankTransaction.txtcollege,"msgcollege","college name")){isValid = false};
	 
	}
	
	if(document.frmbankTransaction.evetype.value=="cmbcollege"){
	 if(notSelected(document.frmbankTransaction.cmbcollege,"msgcmbcollege","college name")){isValid = false};
	 /*var college=document.frmbankTransaction.cmbcollege.value;
	 if(document.frmbankTransaction.cmbcollege.value!=""){
	   if(confirm("On program completion, a certificate will be issued to "+name+" of "+college+". Are you sure you have entered correct details?")) {
	     }else{
	      return false;
	   }
	}*/
	}
	 
	if(notChecked(document.frmbankTransaction.rdpayment,"msgrdpayment","payment mode")){isValid = false};
	 
	if(document.frmbankTransaction.paymd.value=="chq"){
	 if(isNull(document.frmbankTransaction.txtcheque,"msgcheque","cheque number")){isValid = false};
	 if(isNull(document.frmbankTransaction.txtbank,"msgbank","bank name")){isValid = false};
	 if(isNull(document.frmbankTransaction.txtbranch,"msgbranch","branch name")){isValid = false};
	}
	
	if(document.frmbankTransaction.paymd.value=="dd"){
	 if(isNull(document.frmbankTransaction.txtdd,"msgdd","dd number")){isValid = false};
	 if(isNull(document.frmbankTransaction.txtbank,"msgbank","bank name")){isValid = false};
	 if(isNull(document.frmbankTransaction.txtbranch,"msgbranch","branch name")){isValid = false};

	}
	
	if(document.frmbankTransaction.paymd.value=="po"){
	 if(isNull(document.frmbankTransaction.txtpo,"msgpo","po number")){isValid = false};
	}
	
	
	if(notCheckeddeclare(document.frmbankTransaction.chkdeclare,"msgdeclare","agree to the Declaration.")){isValid = false};
	
	if(notCheckeddeclare(document.frmbankTransaction.chkagree,"msgagree","agree to the Terms and Conditions and  Cancellation & Refund Policy.")){isValid = false};	

    if(document.frmbankTransaction.evetype.value=="cmbcollege"){
	// if(notSelected(document.frmbankTransaction.cmbcollege,"msgcmbcollege","college name")){isValid = false};
	 var college=document.frmbankTransaction.cmbcollege.value;
	 if(document.frmbankTransaction.cmbcollege.value!=""){
	   if(confirm("On program completion, a certificate will be issued to "+name+" of "+college+". Are you sure you have entered correct details?")) {
	     }else{
	      return false;
	   }
	}
	}
	return isValid;
}

function fnaddobserver() {
	
	var isValid = true;
	
	if(isNull(document.frmaddobserver.name1,"msgname1","Observer Name")){isValid = false};
   	if(isNull(document.frmaddobserver.email1,"msgemail1","Observer Email Id")){isValid = false};
    if(document.frmaddobserver.email1.value!=""){
	 if(not_Email(document.frmaddobserver.email1,"msgemail1","Observer Email Id")){isValid = false};
	}
	if(isNull(document.frmaddobserver.txtphoneISD1,"msgphoneISD1","Observer ISD Number")){isValid = false};
	if(isNull(document.frmaddobserver.txtphoneSTD1,"msgphoneSTD1","Observer STD Number")){isValid = false};
	if(isNull(document.frmaddobserver.txtphone1,"msgphone1","Observer Phone Number")){isValid = false};
    
	if(document.frmaddobserver.name2.value!="" || document.frmaddobserver.email2.value!="" || document.frmaddobserver.txtphoneISD2.value!="" || document.frmaddobserver.txtphoneSTD2.value!="" || document.frmaddobserver.txtphone2.value!=""){
	 if(document.frmaddobserver.email2.value==document.frmaddobserver.email1.value){
	  alert("Please use an different observer");
	  document.frmaddobserver.email2.focus();
	  return false;
	 }
		
		if(isNull(document.frmaddobserver.name2,"msgname2","Observer Name")){isValid = false};
		if(isNull(document.frmaddobserver.email2,"msgemail2","Observer Email Id")){isValid = false};
		if(document.frmaddobserver.email2.value!=""){
		 if(not_Email(document.frmaddobserver.email2,"msgemail2","Observer Email Id")){isValid = false};
		}
		if(isNull(document.frmaddobserver.txtphoneISD2,"msgphoneISD2","Observer ISD Number")){isValid = false};
		if(isNull(document.frmaddobserver.txtphoneSTD2,"msgphoneSTD2","Observer STD Number")){isValid = false};
		if(isNull(document.frmaddobserver.txtphone2,"msgphone2","Observer Phone Number")){isValid = false};

	}else{
	  document.frmaddobserver.name2.style.borderColor="#cacaca";
	  document.frmaddobserver.email2.style.borderColor="#cacaca";
	  document.frmaddobserver.txtphoneISD2.style.borderColor="#cacaca";
	  document.frmaddobserver.txtphoneSTD2.style.borderColor="#cacaca";
	  document.frmaddobserver.txtphone2.style.borderColor="#cacaca";
	  document.getElementById('msgname2').style.display="none";
	  document.getElementById('msgemail2').style.display="none";
	  document.getElementById('msgphoneISD2').style.display="none";
	  document.getElementById('msgphoneSTD2').style.display="none";
	  document.getElementById('msgphone2').style.display="none";
	}
	
	if(document.frmaddobserver.name3.value!="" || document.frmaddobserver.email3.value!="" || document.frmaddobserver.txtphoneISD3.value!="" || document.frmaddobserver.txtphoneSTD3.value!="" || document.frmaddobserver.txtphone3.value!=""){
	 
		if(document.frmaddobserver.email1.value==document.frmaddobserver.email3.value){
	      alert("Please use an different observer");
	      document.frmaddobserver.email3.focus();
	      return false;
	    }
		
		if(document.frmaddobserver.email2.value==document.frmaddobserver.email3.value){
	      alert("Please use an different observer");
	      document.frmaddobserver.email3.focus();
	      return false;
	    }
		if(isNull(document.frmaddobserver.name3,"msgname3","Observer Name")){isValid = false};
		if(isNull(document.frmaddobserver.email3,"msgemail3","Observer Email Id")){isValid = false};
		if(document.frmaddobserver.email3.value!=""){
		 if(not_Email(document.frmaddobserver.email3,"msgemail3","Observer Email Id")){isValid = false};
		}
		if(isNull(document.frmaddobserver.txtphoneISD3,"msgphoneISD3","Observer ISD Number")){isValid = false};
		if(isNull(document.frmaddobserver.txtphoneSTD3,"msgphoneSTD3","Observer STD Number")){isValid = false};
		if(isNull(document.frmaddobserver.txtphone3,"msgphone3","Observer Phone Number")){isValid = false};

	}else{
	 
	 document.frmaddobserver.name3.style.borderColor="#cacaca";
	 document.frmaddobserver.email3.style.borderColor="#cacaca";
	 document.frmaddobserver.txtphoneISD3.style.borderColor="#cacaca";
	 document.frmaddobserver.txtphoneSTD3.style.borderColor="#cacaca";
	 document.frmaddobserver.txtphone3.style.borderColor="#cacaca";
	 document.getElementById('msgname3').style.display="none";
	 document.getElementById('msgemail3').style.display="none";
	 document.getElementById('msgphoneISD3').style.display="none";
	 document.getElementById('msgphoneSTD3').style.display="none";
	 document.getElementById('msgphone3').style.display="none";
	}
	
	
	if(document.frmaddobserver.name4.value!="" || document.frmaddobserver.email4.value!="" || document.frmaddobserver.txtphoneISD4.value!="" || document.frmaddobserver.txtphoneSTD4.value!="" || document.frmaddobserver.txtphone4.value!=""){
	 
		if(document.frmaddobserver.email1.value==document.frmaddobserver.email4.value){
	      alert("Please use an different observer");
	      document.frmaddobserver.email4.focus();
	      return false;
	    }
		
		if(document.frmaddobserver.email2.value==document.frmaddobserver.email4.value){
	      alert("Please use an different observer");
	      document.frmaddobserver.email4.focus();
	      return false;
	    }
		
		if(document.frmaddobserver.email3.value==document.frmaddobserver.email4.value){
	      alert("Please use an different observer");
	      document.frmaddobserver.email4.focus();
	      return false;
	    }
		
		if(isNull(document.frmaddobserver.name4,"msgname4","Observer Name")){isValid = false};
		if(isNull(document.frmaddobserver.email4,"msgemail4","Observer Email Id")){isValid = false};
		if(document.frmaddobserver.email4.value!=""){
		 if(not_Email(document.frmaddobserver.email4,"msgemail4","Observer Email Id")){isValid = false};
		}
		if(isNull(document.frmaddobserver.txtphoneISD4,"msgphoneISD4","Observer ISD Number")){isValid = false};
		if(isNull(document.frmaddobserver.txtphoneSTD4,"msgphoneSTD4","Observer STD Number")){isValid = false};
		if(isNull(document.frmaddobserver.txtphone4,"msgphone4","Observer Phone Number")){isValid = false};

	}else{
	 
	 document.frmaddobserver.name4.style.borderColor="#cacaca";
	 document.frmaddobserver.email4.style.borderColor="#cacaca";
	 document.frmaddobserver.txtphoneISD4.style.borderColor="#cacaca";
	 document.frmaddobserver.txtphoneSTD4.style.borderColor="#cacaca";
	 document.frmaddobserver.txtphone4.style.borderColor="#cacaca";
	 document.getElementById('msgname4').style.display="none";
	 document.getElementById('msgemail4').style.display="none";
	 document.getElementById('msgphoneISD4').style.display="none";
	 document.getElementById('msgphoneSTD4').style.display="none";
	 document.getElementById('msgphone4').style.display="none";
	}
	
	return isValid; }
	
function fnloginaddobserver() {
	  
	 
	var isValid = true;
	
	if(isNull(document.frmaddobserver.name1,"msgname1","Observer Name")){isValid = false};
   	if(isNull(document.frmaddobserver.email1,"msgemail1","Observer Email Id")){isValid = false};
  
   if(document.frmaddobserver.email1.value!=""){
		
	  if(document.frmaddobserver.customerid.value=="27"){
	  var emailid=document.frmaddobserver.email1.value.toLowerCase();
	  var validmail=emailid.split("@");
	  if(validmail[1]!=""){
		  var secondpart=validmail[1];
		  if(secondpart!="cognizant.com"){
		   document.getElementById("msgemail1").style.display="block"; 	 
		   document.getElementById("msgemail1").innerHTML="You can choose an Observer from your organization only.";
		   //alert("Please choose an Observer from your Organisation.");
		   document.frmaddobserver.email1.focus();
		   return false;
		  }
	  }
	 }
	}
	if(document.frmaddobserver.email1.value!=""){
	 if(not_Email(document.frmaddobserver.email1,"msgemail1","Observer Email Id")){isValid = false};
	}
	if(isNull(document.frmaddobserver.txtphoneISD1,"msgphoneISD1","Observer ISD Number")){isValid = false};
	if(isNull(document.frmaddobserver.txtphoneSTD1,"msgphoneSTD1","Observer STD Number")){isValid = false};
	if(isNull(document.frmaddobserver.txtphone1,"msgphone1","Observer Phone Number")){isValid = false};
    return isValid; }


// ieupdate.js starts here

var bo_ns_id = 0;

function startIeFix(){
  if(isIE()){
    document.write('<div id="bo_ns_id_' + bo_ns_id + '"><!-- ');
  }
}

function endIeFix(){
  if(isIE()){
    document.write('</div>');
    var theObject = document.getElementById("bo_ns_id_" + bo_ns_id++);
    var theCode = theObject.innerHTML;
    theCode = theCode.substring(4 ,9+theCode.indexOf("</object>"))
    document.write(theCode);
  }
}

function isIE(){
  // only for Win IE 6+
  // But not in Windows 98, Me, NT 4.0, 2000
  var strBrwsr= navigator.userAgent.toLowerCase();
  if(strBrwsr.indexOf("msie") > -1 && strBrwsr.indexOf("mac") < 0){
    if(parseInt(strBrwsr.charAt(strBrwsr.indexOf("msie")+5)) < 6){
      return false;
    }
    if(strBrwsr.indexOf("win98") > -1 ||
       strBrwsr.indexOf("win 9x 4.90") > -1 ||
       strBrwsr.indexOf("winnt4.0") > -1 ||
       strBrwsr.indexOf("windows nt 5.0") > -1)
    {
      return false;
    }
    return true;
  }else{
    return false;
  }
}

// ieupdate.js ends here

//*****Demo  Learner registration 

function fnloginDemo(Field_id, divid, Msg) {
	var isValid = true;
	/*if(isNull(document.frmLogin.txtuname,"msguname","User Name")){isValid = false};
	if(isNull(document.frmLogin.txtpword,"msgpass","Pin")){isValid = false};*/
	
	
	var Cnt=0;
	var DisplayMsg="";
	if(document.frmLogin.txtuname.value==''){isValid = false;Cnt=Cnt+1;DisplayMsg='Please enter your Username';};
	if(document.frmLogin.txtpword.value==''){isValid = false;Cnt=Cnt+1;DisplayMsg='Please enter your PIN';};
	if(Cnt==2)
		DisplayMsg='Please enter your Username and PIN';
	
	if(isValid==true )
	{
		document.getElementById('loader').style.display="";
		document.getElementById('loginfailmessage').innerHTML="";
		login();
		return false;
	}
	if(isValid==false)
	{
		document.getElementById('loader').style.display="none";
		document.getElementById('loginfailmessage').innerHTML="";
		document.getElementById('loginfailmessage').innerHTML="<font color=#cc0000>"+DisplayMsg+"</font>";
		return isValid;
	}
	
	
	
	/*if(isValid==true)
	{
		login();
		return false;
	}
	else
		return isValid;*/
}


