	var strError ;
	var boolError ;
	var boolIsConfirmed;
	///////////////////////////////////////////////////////////////
	// Code to make sure that a submit button is clicked only once.
	var submitcount=0; 
	function checkSubmit() 
	{ 
		if (submitcount == 0) 
		{ 
			submitcount++; return true; 
		} 
		else 
		{ 
			alert('This form has already been submitted.' );  
			return false; 
		} 
	} 
	////////////////////////////////////////////////////////////////


	function IsValidFullName(strControlName, strFieldName)
	{
		//var rgeExp = /^[a-z]*(\"")?[a-z]?*$/ ;
		var rgeExp = /^[a-zA-Z]{15}\w['']{1}\^[a-zA-Z]{15}\w['']{1}\^[a-zA-Z]{15}$/ ;
		return IsValidData(strControlName, strFieldName, rgeExp, 'Only letters and space allowed here', true) ;
	}
	
	
	
	// function to check minimum numeric value  
	var minval;
	function MinIntValue(strControlName, strFieldName,minval)
	{
	var flag;
	  flag=IsValidNumber(strControlName, strFieldName);
	  if (flag==false)
	  {
	  if (document.getElementById(strControlName).value <= minval)
	  
	  {	  
	  SetError(strFieldName, 'Value is less than minimum allowed') ;
  return true;
       }
	  }
	  else
	  return false;
	}
	
	
	
	// comparing two dates 
	function CompareDates (strstartdate,strenddate,strfieldname) {
   var value1,value2
   var date1, date2;
   var month1, month2;
   var year1, year2;
value1=document.getElementById(strstartdate).value;
value2=document.getElementById(strenddate).value;
   date1 = value1.substring (0, value1.indexOf ("/"));
   month1 = value1.substring (value1.indexOf ("/")+1, value1.lastIndexOf ("/"));
   year1 = value1.substring (value1.lastIndexOf ("/")+1, value1.length);

   date2 = value2.substring (0, value2.indexOf ("/"));
   month2 = value2.substring (value2.indexOf ("/")+1, value2.lastIndexOf ("/"));
   year2 = value2.substring (value2.lastIndexOf ("/")+1, value2.length);
var valid
   if (year1 > year2) valid= 1;
   else if (year1 < year2) valid= -1;
   else if (month1 > month2) valid= 1;
   else if (month1 < month2) valid= -1;
   else if (date1 > date2) valid= 1;
   else if (date1 < date2) valid= -1;
   else valid=0;

  if ((valid==1) || (valid==0)) 
  {
  SetError(strfieldname, 'should not exceed or equal to end date.') ;
  return false;
  }
  else
  {
  return true;
  }
} 









	function IsValEmail(strControlName, strFieldName)
	{   var stremail;
		stremail=document.getElementById(strControlName).value;
		if ( stremail.length > 0)
		{
		var rgeExp = /^[a-zA-Z0-9._-]+@([a-zA-Z0-9.-]+\.)+[a-zA-Z0-9.-]{2,4}$/ ;
		return IsValidData(strControlName, strFieldName, rgeExp, 'Invalid E-mail Id', false) ;
	    }
	}








//check max length
	function CheckMaxLength(strControlName, strFieldName,len)
	{  var getvalue
	getvalue=document.getElementById(strControlName).value;
		if (getvalue.length > len)
		{
			//SetError(strFieldName, 'Length exceeds maximum limit of '+ len ) ;
			return false ;
		}
		else
			return true ;	
	}
	////////////////////////////////////
	
	//check  min  length
	function CheckMinLength(strControlName, strFieldName,len)
	{  var getvalue
	getvalue=document.getElementById(strControlName).value;
		if (getvalue.length < len)
		{
			SetError(strFieldName, 'Length should be atleast of '+ len ) ;
			return false ;
		}
		else
			return true ;	
	}
	
	
	////////////////////////////////////////////
	function SetVStatus()
	{
		document.getElementById('vStatus').value = 'True' ;	
	}
	
	// Function to set JavaScript status.
	function SetJSStatus()
	{
		//document.Form1.navigator.value = navigator.appName ;
		if (navigator.javaEnabled() < 1) document.getElementById('boolJava').value = 'False' ;
		if (navigator.javaEnabled() == 1) document.getElementById('boolJava').value = 'True' ;
		//alert('value of boolJava : ' + document.getElementById('boolJava').value) ;
		//document.getElementById('boolJava').value;document.Form1.boolJava.value	
	}		
	
	// Function to set error message.
	function SetError(strFieldName, strErrorMsg)
	{
//		strError = strError + strFieldName + ': ' + strErrorMsg + '\n' ;
strError = strError + strFieldName + ': ' + strErrorMsg + '<BR>' ;
		boolError = true ;
	}
				
	// Function to display the consolidated error message.
	function DisplayError() {
		if (!(strError == null || strError == '')) 
		{
			document.getElementById('lblError').innerHTML=strError;		
			//alert(strError) ;
			strError = null ;
			return false ;
		}
		else
		{
			return true ;
		}
	}
	
	// Function to validate a control for valid value.
	// If boolMatch is true then match the expression, else don't match the expression.
	function IsValidData(strControlName, strFieldName, rgeExp, strErrorMsg, boolMatch)
	{
		if (boolMatch)
		{
			if (document.getElementById(strControlName).value.search(rgeExp) >= 0)
			{
				SetError(strFieldName, strErrorMsg) ;
				return false ;
			}
		}
		else
		{
			if (document.getElementById(strControlName).value.search(rgeExp) < 0)
			{
				SetError(strFieldName, strErrorMsg) ;
				return false ;
			}
		}
		return true ;
	}
	//function to check that weblink and pdf file field both not remain null
	function IsRequiredFile(strControlName1,strControlName2,strFieldName)
	{
		if (document.getElementById(strControlName1).value == '' & document.getElementById(strControlName2).value == '')
		{
			SetError(strFieldName, 'FileName cannot be Blank') ;
			return false ;
		}
		else
			return true ;	
	}
	
	//function to check that only one (weblink and pdf file) should be entered 
	function checkFile(strControlName1,strControlName2,strFieldName)
	{
		if (document.getElementById(strControlName1).value != '' & document.getElementById(strControlName2).value != '')
		{
			SetError(strFieldName, 'Both WebLink and Pdf File not Allowed.') ;
			return false ;
		}
		else
			return true ;	
	}
	
	
	// function to compare the values of textbox
	function compareNumericValuesText(strControlName1,strControlName2,strFieldName1,strFieldName2)
	{
	     
   //  if (!(IsValidNumber(strControlName1, strFieldName1)==true) and !(IsValidNumber(strControlName2, strFieldName2)==true)) 
    // {
   // alert("A");
         // if ((parseInt(document.getElementById(strControlName1).value) > 0) and parseInt((document.getElementById(strControlName2).value) > 0))
          //{
           // alert("b");
             
              if (parseInt(document.getElementById(strControlName1).value) > parseInt(document.getElementById(strControlName2).value))
              {
                SetError(strFieldName1, 'Cannot be greater than '+strFieldName2) ;
              }
          //}    
    // }
	}
	
// Function to validate a control for numeric value.
	function IsValidNumber(strControlName, strFieldName)
	{
		var rgeExp = /[^0-9]/ ;
		return IsValidData(strControlName, strFieldName, rgeExp, 'Non-numeric character(s) and space(s) are not allowed', true) ;
	}
	
	// Function to validate a control for numeric value with dots
	function IsValidNumberWithDot(strControlName, strFieldName)
	{
		var rgeExp =  /(^-?\d\d*\.\d*$)|(^-?\d\d*$)|(^-?\.\d\d*$)/;
		return IsValidData(strControlName, strFieldName, rgeExp, 'Non-numeric characters not allowed', false) ;
	}
	function IsValidNumberWithDot2(strControlName, strFieldName)
	{
		var rgeExp =  /(^-?\d\d*\\d*$)|(^-?\d\d*$)|(^-?\\d\d*$)/;
		return IsValidData(strControlName, strFieldName, rgeExp, 'Non-numeric characters not allowed', false) ;
	}
	// Function to validate a control for numeric value with space.
	function IsValidNumberwithSpace(strControlName, strFieldName)
	{
		var rgeExp = /[^0-9\ ]/ ;
		return IsValidData(strControlName, strFieldName, rgeExp, 'Non-numeric character(s) are not allowed', true) ;
	}
	
	//function to validate a hexadecimal color
	
	function IsValidhexacolor(strControlName, strFieldName)
	{
	//alert("a");
		//var rgeExp = /\^w*/ ;
		var rgeExp =/[^0-9\^a-f\^A-F]/;
		return IsValidData(strControlName, strFieldName, rgeExp, 'Non-numeric character(s) are not allowed', true) ;
	}
	

	
	//Function to validate weight or Fat Percentage at  my goals
	function IsValidWeightPercent(strControlName,strFieldName)
	{
		var tempwt;
		tempwt=document.getElementById(strControlName).value;
		if (tempwt.length>3) 
		 {
			if (tempwt.indexOf('.')== -1) 
				{  
				   if (strFieldName=="WT")
				    {
					  SetError('Weight','Enter Weight properly')
					  return false;
					}  
					 else if (strFieldName=="FP")
					 {
					   SetError('Percentage','Enter Percentage properly')
					   return false;
					 }   
				}
		   		
			else if (strFieldName=="WT" && tempwt.indexOf('.')>=4)
			{
			         SetError('Weight','Enter Weight properly')
					  return false;
			}
			else if (strFieldName=="FP" && tempwt.indexOf('.')>2)
			{
			         SetError('Percentage','Enter Percentage properly')
					  return false;
			}								
		}
	 else				
	    return true;
	}
	
	//Function to validate Food Measurment in Fod Module
	function IsValidFoodMesrmnt(strControlName,strFieldName)
	{
		var tempwt;
		tempwt=document.getElementById(strControlName).value;
		var tempwt_array=tempwt.split(".");		
		if (tempwt.length>4) 
		 {
			if (tempwt.indexOf('.')== -1) 
				{  
				  	  SetError(strFieldName,'Enter Weight properly')
					  return false;							
				}		   		
			else if (tempwt.indexOf('.')>4)
			{
			         SetError(strFieldName,'Enter Weight properly')
					 return false;
			}
			else if (tempwt.indexOf('.')!=-1 && tempwt_array[1].length>3)  									
			{			  
			         SetError(strFieldName,'More than three digits are not allowed after decimal')
					 return false;
			 }
		
		}
	 else				
	    return true;
	}
	
	// Function to check Password and verify password.
	function IsPasswordMatch(strPassControl,strVerifyPassControl,strFieldName)
	{
		if (document.getElementById(strPassControl).value==document.getElementById(strVerifyPassControl).value)
		{
		 return true;
		}
		else
		{
			SetError(strFieldName,'Password Mismatch') ;
			return false ;
		}
	}
	
	// Function to validate a control for valid E-mail.
	function IsValidEmail(strControlName, strFieldName)
	{
		var rgeExp = /^[a-zA-Z0-9._-]+@([a-zA-Z0-9.-]+\.)+[a-zA-Z0-9.-]{2,4}$/ ;
		return IsValidData(strControlName, strFieldName, rgeExp, 'Invalid E-mail Id', false) ;
	}
	
	// Function to validate a control for valid Minute/Second.
	function IsValidMinuteSecond(strControlName, strFieldName)
	{
		var rgeExp = /^[0-5]?[0-9]{1}$/ ;
		return IsValidData(strControlName, strFieldName, rgeExp, 'Invalid Minute/Second Entered', false) ;
	}
	
	// Function to validate a control for HTML tag
	function IsValidInput(strControlName, strFieldName)
	{
		var rgeExp = /[<;>]/ ;
		return IsValidData(strControlName, strFieldName, rgeExp, '"< or ; or >" character are not allowed', true) ;
	}
	// Function to validate a control for HTML tag
	function IsValInput(strControlName, strFieldName)
	{
		var rgeExp = /[>]/ ;
		return IsValidData(strControlName, strFieldName, rgeExp, '">" character not allowed here', true) ;
	}
	
	
	// Function to validate a more than 1 space
	function IsValspaceInput(strControlName, strFieldName)

	{
		var rgeExp = /[\s]{2}/ ;
		return IsValidData(strControlName, strFieldName, rgeExp, 'More than 1 space is not allowed', true) ;
	}
	
	
	// Function to validate a control for Single code
	function IsSingleCodeExists(strControlName, strFieldName)
	{
		var rgeExp = /[']/ ;
		return IsValidData(strControlName, strFieldName, rgeExp,'Single quote character not allowed here', true) ;
	}
	
	// checking expression for numbers
	function IsdigitExists(strControlName, strFieldName)
	{
		var rgeExp = /[0-9]/ ;
		return IsValidData(strControlName, strFieldName, rgeExp,'Can not have numbers', true) ;
	}
	
	
	// Function to validate a control for required value.
	function IsRequired(strControlName, strFieldName)
	{
		
		if (trimAll(document.getElementById(strControlName).value) == '')
		{
			//SetError(strFieldName, 'Cannot be empty') ;
			return false ;
		}
		else
			return true ;	
	}
	function IsDot(strControlName, strFieldName)
	{
		
		if (trimAll(document.getElementById(strControlName).value) == '.')
		{
			SetError(strFieldName, 'Single dot is not allowed') ;
			return false ;
		}
		else
			return true ;	
	}
	// Function to validate a control for minute less than or equal to 180
	function IsValidMinute(strControlName, strFieldName)
	{
		if (document.getElementById(strControlName).value >180)
		//if (document.getElementById(strControlName).value == '')
		{
			SetError(strFieldName, 'Time should be less than 180') ;
			//SetError(strFieldName, 'Cannot be blank') ;
			return false ;
		}
		else
			return true ;	
	}
	// Function to check no item selected in Change pLan
	function Notselected()
	{
	if (document.getElementById('cmbActvity1').selectedIndex == 0  && document.getElementById('cmbActivity2').selectedIndex == 0)
			{
			SetError('Activity','Please Select any activity') ;
			//SetError(strFieldName, 'Cannot be blank') ;
			return false ;
			}
			else
			return true ;	
	}
	// Function to validate a control for percentage less than or equal to 100
	function IsValidPercent(strControlName, strFieldName)
	{
		if (document.getElementById(strControlName).value >100)
		//if (document.getElementById(strControlName).value == '')
		{
			SetError(strFieldName, 'Percentage should be less than or equal to 100') ;
			//SetError(strFieldName, 'Cannot be blank') ;
			return false ;
		}
		else
			return true ;	
	}
	// Function to validate a control for RPE  less than 11 and not less than 0
	function IsValidRpe(strControlName, strFieldName)
	{
		if (document.getElementById(strControlName).value >10)
		//if (document.getElementById(strControlName).value == '')
		{
			SetError(strFieldName, 'RPE should be less than 10') ;
			//SetError(strFieldName, 'Cannot be blank') ;
			return false ;
		}
		else
			return true ;	
	}
	
	// Function to validate a listbox 
	function IsRequiredlist(strControlName, strFieldName)
	{
		if (document.getElementById(strControlName).length == 0)
		{
			SetError(strFieldName, 'Can not be empty') ;
			return false ;
		}
		else
			return true ;	
	}
	
	//Function to empty the listbox
	function EmptyList(strControlName)
	{
	  for (var i = document.getElementById(strControlName).options.length - 1; i>= 0; i--){
           document.getElementById(strControlName).options[i] = null;
           }
           document.getElementById(strControlName).selectedIndex = -1;
       return false;    
     }    
                   
	// Function to check particular item exists in list box or not 
	function IsExistInList(strListBox, strText,strChk)
	{
		var Temp = "";
		var TempFlag = "";
		for (Count = 0; Count < document.getElementById(strListBox).length; Count++)
		 {
			 if(Count!=parseInt(strChk))
		   {
		    Temp=document.getElementById(strListBox).options[Count].text;
			if (Temp.toUpperCase()==Trim(strText.toUpperCase()))
			{
			  TempFlag="t";
			 }	
		   }		
		}
		if (TempFlag=="t")
		{
		  SetError('Question List', 'Two or more Question can not be same') ;
		  return false;
		 }
		  else
		  return true;
	}
		
	// Function to check if any item is selected.
	function IsItemSelected(strControlName, strFieldName)
	{
		if (document.getElementById(strControlName).selectedIndex < 0)
					SetError(strFieldName, 'Select an item') ;
	}
	
	
	// Function to check if any item other than first is selected in combobox.
	function IsComboItemSelected(strControlName, strFieldName)
	{
	//alert("test1"+document.getElementById(strControlName).selectedIndex);
		if (document.getElementById(strControlName).selectedIndex < 1)
		
		return false;
					//SetError(strFieldName, 'Select a type') ;
	}
	
	//Function to check if any item is selected in template column of datagrid
	//function IsdgTemplateItemSelected(strControlName,intRowCount, strFieldName)
	//{
	//var dg=document.getElementById(strControlName)
	//var ddl=dg.Items(intRowCount).FindControl("ddlEat")
	//	if (ddl.selectedIndex < 0)
	//		SetError(strFieldName, 'Select an item') ;
//	}
	
	// Function to check if any item is selected is greater than 0.( used in CheckPriceQuote.aspx)
	function IsItemSelectedNew(strControlName, strFieldName)
	{
		if (document.getElementById(strControlName).selectedIndex < 1)
					SetError(strFieldName, 'Select an item') ;
	}
	
	
	// Function to check if any radiobutton of two is selected.
	function IsRbtnSelected(strControlName1, strControlName2,strFieldName)
	{
		if (!(document.getElementById(strControlName1).checked) && !(document.getElementById(strControlName2).checked))
					SetError(strFieldName, 'Select an item') ;
	}
	
	
	// function checking a radiobutton is checked, if checked then then value check in a textbox
	function IsRbtnandtxtSelected(strControlName1, strControlName2,strFieldName)
	{
		if (document.getElementById(strControlName1).checked==true)
		{
		     IsRequired(strControlName2,strFieldName);
		    IsValidNumber(strControlName2,strFieldName) ;
				CheckMaxLength(strControlName2,strFieldName,2);
				MinIntValue2(strControlName2,strFieldName,0);
	    }
	}
	
	// function checking a radiobutton is checked, if checked then then value check in a combobox
	function IsRbtnandcomboSelected(strControlName1, strControlName2,strFieldName)
	{
		if (document.getElementById(strControlName1).checked==true)
		{
		     IsComboItemSelected(strControlName2, strFieldName)
	    }
	}
	
	// Function to check if any radiobutton of three is selected.
	function IsRbtn3Selected(strControlName1, strControlName2,strControlName3,strFieldName)
	{
		if (!(document.getElementById(strControlName1).checked) && !(document.getElementById(strControlName2).checked) && !(document.getElementById(strControlName3).checked))
					SetError(strFieldName, 'Select an item') ;
	}
	
	function IsValidFile(strControlName, strFieldName)
	{
		var rgeExp = /\.pdf|\.doc|\.txt|\.html|\.htm|\.xls|\$/ ;
		return IsValidData(strControlName, strFieldName, rgeExp, 'Enter pdf file only', false) ;
	}
	
	//is valid image file
	function IsValidImageFile(strControlName, strFieldName)
	{
		if (document.getElementById(strControlName).value != '')
		{
			var rgeExp = /\.gif|\.bmp|\.jpg|\.jpeg|\.png|\.tiff|\$/ ;
			return IsValidData(strControlName, strFieldName, rgeExp, 'Upload image file only - .gif,.jpeg,.jpg,.png,.bmp', false) ;
			}
		else
		return true;
	}
	
	// is valid document file
	function IsValidDocFile(strControlName, strFieldName)
	{
		if (document.getElementById(strControlName).value != '')
		{var rgeExp = /\.doc$/ ;
		return IsValidData(strControlName, strFieldName, rgeExp, 'Upload doc file only - .doc', false) ;
		}
		else
		return true;
	}
	
	//is valid movie file
	function IsValidVideoFile(strControlName, strFieldName)
	{
		if (document.getElementById(strControlName).value != '')
		{var rgeExp = /\.avi|\.mpg|\.AVI|\.MPG|\.wmv|\.WMV|\$/ ;
		return IsValidData(strControlName, strFieldName, rgeExp, 'Upload video file only - .avi,.mpg', false) ;
		}
		else
		return true;
	}
	
	//is valid audio file
	function IsValidAudioFile(strControlName, strFieldName)
	{
		if (document.getElementById(strControlName).value != '')
		{var rgeExp = /\.wav|\.WAV|\$/ ;
		return IsValidData(strControlName, strFieldName, rgeExp, 'Upload Audio file only - .wav', false) ;
		}
		else
		return true;
	}
	
	// Function to replace a single quote with double quote.
	function SetQuotes(strControlName)
	{
		SetJSStatus() ;
		
		if (document.getElementById(strControlName) != null)
			document.getElementById(strControlName).value = 
					ReplaceAll(document.getElementById(strControlName).value) ;
	}
	
	// Function to replace all occurences of a string with another.
	function ReplaceAll( str ) {
		var i ;
		var strReturn = "" ;
		for (i=0; i<str.length; ++i)
			if (str.charAt(i) == "'")
			{
				strReturn = strReturn + "''" ;
			}
			else
			{
				strReturn = strReturn + str.charAt(i) ;
			}
		
		return strReturn ;
	}
		
	
	// Function to check whether selection criteria is selected(Article/Qt)
	function checkselection(strControlName1,strControlName2,strControlName3,strControlName4,strFieldName)
	{
	if (document.getElementById(strControlName1).selectedIndex ==0 & document.getElementById(strControlName2).selectedIndex==0 & document.getElementById(strControlName3).selectedIndex==0 & document.getElementById(strControlName4).value=='' )
	   {
	     SetError(strFieldName, 'Please Select a Search Criteria ') ;
	     return false ;
	   }
	   return true;
	}
	
//	// Function to replace all occurences of a string with another.
//	function ReplaceAll( str, from, to ) {
//		var idx = str.indexOf( from );
//
//		while ( idx > -1 ) {
//			str = str.replace( from, to ); 
//			idx = str.indexOf( from );
//		}
//
//		return str;
//	}
	
	function checktime(strControlName1,strControlName2,strFieldName)
	{
	if (document.getElementById(strControlName2).selectedIndex <= document.getElementById(strControlName1).selectedIndex)
	   {
	     SetError(strFieldName, 'should be greater than Start Time') ;
	     return false ;
	   }
	   return true;
	}
	// Function to check duplicte answer in survey(first argument name of control and second argument to check answerno which is greater than the answerno which have invoked this function and strFlag is to check whether this function is invoked at time of insertion of updation)
	function IsDuplicateAns(strControlName,strAnsNo)
	{
		var cntrl1;
		var cntrl2;
		if (document.getElementById(strControlName).value!=='' && document.getElementById(strControlName).id!== document.getElementById('txtAnsTxt1').id)	  
		{	
			cntrl1=document.getElementById(strControlName).value;
			cntrl2= document.getElementById('txtAnsTxt1').value;
			 if (Trim(cntrl1.toUpperCase())==Trim(cntrl2.toUpperCase())&& parseInt(strAnsNo)==1)
			{		
			  SetError('Answer Choice 1', 'Answer choice can not be same') ;
			  return false ;
			}
		}
		if (document.getElementById(strControlName).value!=='' && document.getElementById(strControlName).id!== document.getElementById('txtAnsTxt2').id)	  
		{	
			cntrl1=document.getElementById(strControlName).value;
			cntrl2= document.getElementById('txtAnsTxt2').value;
			if (Trim(cntrl1.toUpperCase())==Trim(cntrl2.toUpperCase())&& parseInt(strAnsNo)==1)
			{		
			  SetError('Answer Choice 2', 'Answer choice can not be same') ;
			  return false ;
			}
		}
		if (document.getElementById(strControlName).value!=='' && document.getElementById(strControlName).id!== document.getElementById('txtAnsTxt3').id)	  
		{	
			cntrl1=document.getElementById(strControlName).value;
			cntrl2= document.getElementById('txtAnsTxt3').value;
			if (Trim(cntrl1.toUpperCase())==Trim(cntrl2.toUpperCase()) && parseInt(strAnsNo)<=2)
			{		
			  SetError('Answer Choice 3', 'Answer choice can not be same') ;
			  return false ;
			}
		}
		if (document.getElementById(strControlName).value!=='' && document.getElementById(strControlName).id!== document.getElementById('txtAnsTxt4').id)	  
		{	
			cntrl1=document.getElementById(strControlName).value;
			cntrl2= document.getElementById('txtAnsTxt4').value;
			if (Trim(cntrl1.toUpperCase())==Trim(cntrl2.toUpperCase()) && parseInt(strAnsNo)<=3)
			{		
			  SetError('Answer Choice 4', 'Answer choice can not be same') ;
			  return false ;
			}
		}
		if (document.getElementById(strControlName).value!=='' && document.getElementById(strControlName).id!== document.getElementById('txtAnsTxt5').id)	  
		{	
			cntrl1=document.getElementById(strControlName).value;
			cntrl2= document.getElementById('txtAnsTxt5').value;
			if (Trim(cntrl1.toUpperCase())==Trim(cntrl2.toUpperCase()) && parseInt(strAnsNo)<=4)
			{		
			  SetError('Answer Choice 5', 'Answer choice can not be same') ;
			  return false ;
			}
		}
		if (document.getElementById(strControlName).value!=='' && document.getElementById(strControlName).id!== document.getElementById('txtAnsTxt6').id)	  
		{	
			cntrl1=document.getElementById(strControlName).value;
			cntrl2= document.getElementById('txtAnsTxt6').value;
			if (Trim(cntrl1.toUpperCase())==Trim(cntrl2.toUpperCase()) && parseInt(strAnsNo)<=5)
			{		
			  SetError('Answer Choice 6', 'Answer choice can not be same') ;
			  return false ;
			}
		}
			return true ;	
	}
	
	// Function to check duplicte answer in survey Edit(first argument name of control and second argument to check answerno which is greater than the answerno which have invoked this function and strFlag is to check whether this function is invoked at time of insertion of updation)
	function IsDuplicateAnsEdit(strControlName,strAnsNo)
	{
		var cntrl1;
		var cntrl2;
		if (document.getElementById(strControlName).value!=='' && document.getElementById(strControlName).id!== document.getElementById('txtEditAnsTxt1').id)	  
		{	
			cntrl1=document.getElementById(strControlName).value;
			cntrl2= document.getElementById('txtEditAnsTxt1').value;
			 if (Trim(cntrl1.toUpperCase())==Trim(cntrl2.toUpperCase())&& parseInt(strAnsNo)==1)
			{		
			  SetError('Answer Choice 1', 'Answer choice can not be same') ;
			  return false ;
			}
		}
		if (document.getElementById(strControlName).value!=='' && document.getElementById(strControlName).id!== document.getElementById('txtEditAnsTxt2').id)	  
		{	
			cntrl1=document.getElementById(strControlName).value;
			cntrl2= document.getElementById('txtEditAnsTxt2').value;
			if (Trim(cntrl1.toUpperCase())==Trim(cntrl2.toUpperCase())&& parseInt(strAnsNo)==1)
			{		
			  SetError('Answer Choice 2', 'Answer choice can not be same') ;
			  return false ;
			}
		}
		if (document.getElementById(strControlName).value!=='' && document.getElementById(strControlName).id!== document.getElementById('txtEditAnsTxt3').id)	  
		{	
			cntrl1=document.getElementById(strControlName).value;
			cntrl2= document.getElementById('txtEditAnsTxt3').value;
			if (Trim(cntrl1.toUpperCase())==Trim(cntrl2.toUpperCase()) && parseInt(strAnsNo)<=2)
			{		
			  SetError('Answer Choice 3', 'Answer choice can not be same') ;
			  return false ;
			}
		}
		if (document.getElementById(strControlName).value!=='' && document.getElementById(strControlName).id!== document.getElementById('txtEditAnsTxt4').id)	  
		{	
			cntrl1=document.getElementById(strControlName).value;
			cntrl2= document.getElementById('txtEditAnsTxt4').value;
			if (Trim(cntrl1.toUpperCase())==Trim(cntrl2.toUpperCase()) && parseInt(strAnsNo)<=3)
			{		
			  SetError('Answer Choice 4', 'Answer choice can not be same') ;
			  return false ;
			}
		}
		if (document.getElementById(strControlName).value!=='' && document.getElementById(strControlName).id!== document.getElementById('txtEditAnsTxt5').id)	  
		{	
			cntrl1=document.getElementById(strControlName).value;
			cntrl2= document.getElementById('txtEditAnsTxt5').value;
			if (Trim(cntrl1.toUpperCase())==Trim(cntrl2.toUpperCase()) && parseInt(strAnsNo)<=4)
			{		
			  SetError('Answer Choice 5', 'Answer choice can not be same') ;
			  return false ;
			}
		}
		if (document.getElementById(strControlName).value!=='' && document.getElementById(strControlName).id!== document.getElementById('txtEditAnsTxt6').id)	  
		{	
			cntrl1=document.getElementById(strControlName).value;
			cntrl2= document.getElementById('txtEditAnsTxt6').value;
			if (Trim(cntrl1.toUpperCase())==Trim(cntrl2.toUpperCase()) && parseInt(strAnsNo)<=5)
			{		
			  SetError('Answer Choice 6', 'Answer choice can not be same') ;
			  return false ;
			}
		}
			return true ;	
	}
	
	
	
	function LTrim(str)
	{
	 if (str==null){return null;}
	      for(var i=0;str.charAt(i)==" ";i++);
	          return str.substring(i,str.length);
	}
    function RTrim(str)
    {
	  if 
	  (str==null){return null;}
	     for(var i=str.length-1;str.charAt(i)==" ";i--);
	         return str.substring(0,i+1);
	}
     function Trim(str)
     { 
      return LTrim(RTrim(str));
     }
     //function to check date
   

    function checkDate(strcontrol1,strcontrol2,strcontrol3)
     {
        var monthLength = new Array(31,28,31,30,31,30,31,31,30,31,30,31);
	    var x = document.forms[0].elements;
	    var day = parseInt(document.getElementById('strcontrol1').value);
	    var month = parseInt(document.getElementById('strcontrol2').value);
	    var year = parseInt(document.getElementById('strcontrol3').value);

	  if (!day || !month || !year)
		return false;

	  if (year/4 == parseInt(year/4))
		 monthLength[1] = 29;

	  if (day > monthLength[month-1])
		return false;

	  monthLength[1] = 28;
    }
     // Function to evaluate the validation functions.
     function Evaluate(insFunction)
     {
		// Set up the variables.
		var boolResult = false ;
 		strError = '' ;
 		boolError = false ;
 		
 		// Check for Javascript in browser.
 		//SetJSStatus() ;
 		
 		// Run the validation function.
 		insFunction() ;
 		
 		// Call display function
 		DisplayError() ;
 		
 		// Return the boolean result
 		return !(boolError) ;
     }
     // Used in Popup Window of Biomarker
     function Evaluate1(insFunction)
     {
		// Set up the variables.
		var boolResult = false ;
 		strError = '' ;
 		boolError = false ;
 		
 		// Check for Javascript in browser.
 		//SetJSStatus() ;
 		
 		// Run the validation function.
 		insFunction() ;
 		if (!(strError == null || strError == '')) 
 		{
 		DisplayError();
 		}
 		else
 		{
 		//
 		//window.close("HealthSelectBiomarkers.aspx");
 		//self.close();
 		//window.opener.location.href="HealthMonitorStepNew1.aspx";
 		//window.close("HealthSelectBiomarkers.aspx")
 		}
		return !(boolError);
		
     }
     
// 	function CheckControl()
// 	{
// 		var boolResult = false ;
// 		strError = '' ;
// 		boolError = false ;
// 		
// 		SetJSStatus() ;
// 						
// 		// Call validation functions
// 		boolResult = IsRequired(strControlName, strFieldName) ;
// 		boolResult = IsValidInput(strControlName, strFieldName) ;
// 		boolResult = IsValidNumber(strControlName, strFieldName) ;
// 		
// 		boolResult = IsRequired('txtResult', 'Result Field') ;
// 		boolResult = IsValidInput('txtResult', 'Result Field') ;
// 		boolResult = IsValidNumber('txtResult', 'Result Field') ;
// 		
// 		// Call display function
// 		DisplayError() ;
// 		
// 		// Return the boolean result
// 		return !(boolError) ;
// 	}	


	// function to select atleast one checkbox from the given checkboxes
	function chkvalidate(chkbox1,chkbox2,chkbox3,chkbox4,strFieldName)
	{
	if (chkbox1.checked == 1)	
	;
	else		 
	{
	if(chkbox2.checked == 1) 
	;
	else
	{
	if(chkbox3.checked == 1)
	;
	else
	{if(chkbox4.checked == 1)
	;
	else	
			SetError(strFieldName, 'from the above criteria') ;		
		}
	}}}
	/// Function to validate Atleast 3 checkboxes ////
	function chkvalidateBio1(strControlName1,strFieldName)
	{
	var checkcount = 0;
	var chk1 =document.getElementById(strControlName1);
	 if (chk1.checked)	
	 {
		 checkcount= checkcount +1
	 }
	 if (checkcount != 0)
	 {	
	 SetError(strFieldName, 'Please check atleast 3 boxes');
			return false;
			}
	 }
	function chkvalidateBio(chkbox2,chkbox3,chkbox4,chkbox5,chkbox6,chkbox7,chkbox8,chkbox9,chkbox10,chkbox11,strFieldName)
	{
	 var checkcount = 0;
	 var chk2 =document.getElementById(chkbox2);
	 var chk3 =document.getElementById(chkbox3);
	 var chk4 =document.getElementById(chkbox4);
	 var chk5 =document.getElementById(chkbox5);
	 var chk6 =document.getElementById(chkbox6);
	 var chk7 =document.getElementById(chkbox7);
	 var chk8 =document.getElementById(chkbox8);
	 var chk9 =document.getElementById(chkbox9);
	 var chk10 =document.getElementById(chkbox10);
	 var chk11 =document.getElementById(chkbox11);
	 if (chk2.checked)	
	 {
	 checkcount= checkcount + 1
	 }
	 if (chk3.checked)	
	 {
	 checkcount= checkcount + 1
	 }
	 if (chk4.checked)	
	 {
	 checkcount= checkcount + 1
	 }
	 if (chk5.checked)	
	 {
	 checkcount= checkcount + 1
	 }
	 if (chk6.checked)	
	 {
	 checkcount= checkcount + 1
	 }
	 if (chk7.checked)	
	 {
	 checkcount= checkcount + 1
	 }
	 if (chk8.checked)	
	 {
	 checkcount= checkcount + 1
	 }
	 if (chk9.checked)	
	 {
	 checkcount= checkcount + 1
	 }
	 if (chk10.checked)	
	 {
	 checkcount= checkcount + 1
	 }
	 if (chk11.checked)	
	 {
	 checkcount= checkcount + 1
	 }
	 if (checkcount != 3)
	{
	SetError(strFieldName, 'Please check only 3 boxes') ;
	return false ;
	}
	}
	function ChkboxesTxtBoxes(chkbox,txtbox,strFieldName)
	{
	
	var chk =document.getElementById(chkbox);
	
	if (chk.checked)	
	 {
		IsRequired(txtbox,strFieldName);
		IsValidInput(txtbox,strFieldName);
		IsValidNumberWithDot(txtbox,strFieldName);
		IsDot(txtbox,strFieldName);
	}
	else
	return true ;	
	}
	
	//End
	// Function to validate a control for only text input 


	function IsValidText(strControlName, strFieldName)

{		var rgeExp = /[^a-zA-Z]/ ;	

return IsValidData(strControlName, strFieldName, rgeExp, 'Only Text allowed here', true) ;

	}
	
	// fuvtion to select some option from dropdown list i.e. not select 
	function IsSelectDropdown(strControlName, strFieldName)
	{
		
		if (document.getElementById(strControlName).value == '-Select-')
		{
			SetError(strFieldName, 'Select item') ;
			return false ;
		}
		else
			return true ;	
	}
	///when either a dropdown or text box to be selected with 1st preference on dropdown
	///by atul on 10-may-07
	function IsSelectDropdownOrText(strControlName, strControlName1, strFieldName)
	{
		
		if (document.getElementById(strControlName).value == '-Select-')
		{
			if (document.getElementById(strControlName1).value == '')
			{
				SetError(strFieldName, 'Select item') ;
				return false ;
			}
			else
				return true;
		}
		else
			return true ;	
	}
	
	function IsSelectDropdownActivity(strControlName, strControlName2,strFieldName,strControlName3,strFieldName1)
	{
		
		if (document.getElementById(strControlName).value != '-Select-')
		{
		
		if (document.getElementById(strControlName2).enabled = true)
		{
		
			if (document.getElementById(strControlName2).value == '-Select-')
			{
			SetError(strFieldName, 'Select item') ;
			return false ;
			}
			if (document.getElementById(strControlName3).value == '-Select-')
			{
			SetError(strFieldName1, 'Select item') ;
			return false ;
			}
		}
			
		}
		else
			return true ;	
	}
	
	///For Activity2--check Time2
	function IsSelectTime2(strControlName, strControlName2,strFieldName)
	{
		
		if (document.getElementById(strControlName).value != '-Select-')
		{
		IsRequired('txttime2', 'Time');
		IsValidInput('txttime2', 'Time');
		IsValidNumber('txttime2', 'Time');
		IsValidMinute('txttime2', 'Time');
		}
		else
			return true ;	
	}
	///For Activity2--check RPE2
	function IsSelectRPE2(strControlName, strControlName2,strFieldName)
	{
		if (document.getElementById(strControlName).value != '-Select-')
		{
		IsRequired('txtrpe2', 'RPE');
		IsValidInput('txtrpe2', 'RPE');
		IsValidNumber('txtrpe2', 'RPE');
		IsValidRpe('txtrpe2', 'RPE');
		}
		else
			return true ;	
	}
	// For Activity2--check RPE2
	function ProfileMatching(strControlName, strControlName2,strFieldName)
	{
	if (document.getElementById(strControlName2).enabled == true)
	{
		if (document.getElementById(strControlName).value == document.getElementById(strControlName2).value)
		{
		SetError(strFieldName, 'Cannot be same') ;
		return false ;
		}
		else
			return true ;	
	}
	}
	//function to allow only Image file


function IsValidImage(strControlName, strFieldName)	

{		var rgeExp = /\.gif$/ ;

		return IsValidData(strControlName, strFieldName, rgeExp, 'Enter gif file only', false) ;

	}

// function to check minimum numeric value  	
var minval;
	function MinIntValue(strControlName, strFieldName,minval)
	{	var flag;
	  flag=IsValidNumber(strControlName, strFieldName);
	  if (flag==true)
	  {	  if (document.getElementById(strControlName).value <= minval)

	  {	  SetError(strFieldName, 'Value must be greater than ' + minval) ;
  return true;       }	  }	  else	  return false;	}	



// function 2nd to check minimum numeric value  	

	
	function MinIntValue2(strControlName, strFieldName,minval)
	{
	if (document.getElementById(strControlName).value=="")
	return false;
	else
	{
			var flag;
	  
	  flag=IsValidNumber(strControlName, strFieldName);
	  if (flag==true)
	  {	  
	  	  if (document.getElementById(strControlName).value <= minval)

	  {	  SetError(strFieldName, 'Value must be greater than ' + minval) ;
  return true;       }	  }	  else	  return false;	}
  
  
  }	



// function to check Maximum numeric value  
	var maxval;
	function MaxIntValue(strControlName, strFieldName,maxval)
	{
	var flag;

	  flag=IsValidNumber(strControlName, strFieldName);



	  if (flag==true)	
  {	  if (document.getElementById(strControlName).value >= maxval)
	  
{	  SetError(strFieldName, 'Value is more than maximum('+ maxval +') not allowed') ;
  return true;
       }	  }	  else	  return false;	}
       
       
       // function to check Maximum numeric value 2  
	
	function MaxIntValue2(strControlName, strFieldName,maxval)
	{
	var flag;

	  flag=IsValidNumberWithDot(strControlName, strFieldName);



	  if (flag==true)	
  {	  if (document.getElementById(strControlName).value >= maxval)
	  
{	  SetError(strFieldName, 'Value exceeds of maximum limit ' + maxval) ;
  return true;
       }	  }	  else	  return false;	}
       
       
       
       //  For 3 Checkboxes : function to Select Atleast One Checkbox from the Given Checkboxes for 3 checkboxes


		function chkboxvalid(strControlName1,strControlName2,strControlName3,strControlName4,strFieldName)
	{
	var chk1 =document.getElementById(strControlName1);
	var chk2 =document.getElementById(strControlName2);
	var chk3 =document.getElementById(strControlName3);
	var chk4 =document.getElementById(strControlName4);
		
	
	if (chk1.checked)
	 {  
	return true ;	}
		
		else		 
	{
	
	if(chk2.checked)
	return true ;	
	else
	{
	if(chk3.checked)
	return true ;	
	else
	{if(chk4.checked)
	return true ;	
	else	
		SetError(strFieldName, 'Please select atleast one of the options') ;	
		return false ;	
		}
	}}}
	
	
	
	
	// Function to select a valid value from the dropdownlist box i.e. not select  
	function fordropdown(strControlName, strFieldName)
	{
		
		
		if (document.getElementById(strControlName).value == "-Select-" )
		{
			SetError(strFieldName, 'Cannot be unselected') ;
			return false ;
		}
		else
			return true ;	
	}
	
	 // Function to Not to put O into the given textbox
	 
	 function NotZero(strControlName, strFieldName)
	{
		
		
		if (document.getElementById(strControlName).value == '0' )
		{
			SetError(strFieldName, 'The value cannot be Zero') ;
			return false ;
		}
		else
			return true ;	
	}
	
	function trimAll(sString) 
	{
	while (sString.substring(0,1) == ' ')
	{
	sString = sString.substring(1, sString.length);
	}
	while (sString.substring(sString.length-1, sString.length) == ' ')
	{
	sString = sString.substring(0,sString.length-1);
	}
	return sString;
	}
	
	
	// Function to set error not to do from one profile to same profile 
	function forvalidMapping(strControlName1,strControlName2,strFieldName)
	{
		
		
		if (document.getElementById(strControlName1).value == document.getElementById(strControlName2).value )
		{
			SetError(strFieldName, 'It cannot be mapped') ;
			return false ;
		}
		else
			return true ;	
	}
	
	
	//fucntion to set error to compare the values of 2 dropdown list 
	
	function forValidTimes(strControlName1,strControlName2,strFieldName)
	
	{
	 	
		if (document.getElementById(strControlName1).value > document.getElementById(strControlName2).value )
		{
			SetError(strFieldName, 'Not valid') ;
			return false ;
		}
		else
			 { return true ;	}
	
	}
// to validate if any one of the two controls filled or not
	function oneRequired(strControlName1,strControlName2,strFieldName)
	{
		if (Trim(document.getElementById(strControlName1).value) == '' && Trim(document.getElementById(strControlName2).value) == '')
			{
				SetError(strFieldName, 'Provide Files') ;
				return false ;
			}
		else
			 { return true ;	}
			
	}
	  


// to validate a field
		function IsValidField(strControlName, strFieldName)
	{
		var rgeExp = /[<,;,>,']/ ;
		if (trimAll(document.getElementById(strControlName).value) == '')
		{
			SetError(strFieldName, 'Cannot be empty') ;
			return false ;
		}
		else
			return IsValidData(strControlName, strFieldName, rgeExp, '"< > ; or quote character are not allowed', true) ;

	}	
	
	
//  For 5  Checkboxes  : function to Select Atleast One Checkbox from the Given Checkboxes 
	
	
	function chkboxFive(strControlName1,strControlName2,strControlName3,strControlName4,strControlName5,strFieldName)
	{var chk1 =document.getElementById(strControlName1);
	var chk2 =document.getElementById(strControlName2);
	var chk3 =document.getElementById(strControlName3);
	var chk4 =document.getElementById(strControlName4);
	var chk5 =document.getElementById(strControlName5);
		
	
	if (chk1.checked)
	 
	return true ;	
		
		else		 
	{
	
	if(chk2.checked)
	return true ;	
	else
	{
	if(chk3.checked)
	return true ;	
	else
	{if(chk4.checked)
	return true ;	
	else
	{if(chk5.checked)
	return true ;	
	else	
		SetError(strFieldName, 'Please select atleast one checkbox from the above criteria') ;	
		return false ;	
		}
	}}}}
	
	
///////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////
	/////////For Nutrition Special Case////// 
	function HealthTextBox1(strControlName)
	{
		
		if (document.getElementById(strControlName).innerText=='BloodPressure')
		{
		IsValidInput('txtL1','Latest');
		IsValidNumberWithDot('txtL1','Latest');
		IsDot('txtL1','Latest');
		IsValidInput('txtLbp1','Latest');
		IsValidNumberWithDot('txtLbp1','Latest');
		IsDot('txtLbp1','Latest');
		//return true
		}
		else
		{
		IsValidInput('txtL1','Latest');
		IsValidNumberWithDot('txtL1','Latest');
		IsDot('txtL1','Latest');
		}
			
	}
	function HealthTextBox2(strControlName)
	{
		
		if (document.getElementById(strControlName).innerText=='BloodPressure')
		{
		IsValidInput('txtl2','Latest');
		IsValidNumberWithDot('txtl2','Latest');
		IsDot('txtl2','Latest');
		IsValidInput('txtLbp2','Latest');
		IsValidNumberWithDot('txtLbp2','Latest');
		IsDot('txtLbp2','Latest');
		//return true
		}
		else
		{
		IsValidInput('txtl2','Latest');
		IsValidNumberWithDot('txtl2','Latest');
		IsDot('txtl2','Latest');
		}
			
	}
	function HealthTextBox3(strControlName)
	{
		
		if (document.getElementById(strControlName).innerText=='BloodPressure')
		{
		IsValidInput('txtL3','Latest');
		IsValidNumberWithDot('txtL3','Latest');
		IsDot('txtL3','Latest');
		IsValidInput('txtLbp3','Latest');
		IsValidNumberWithDot('txtLbp3','Latest');
		IsDot('txtLbp3','Latest');
		//return true
		}
		else
		{
		IsValidInput('txtL3','Latest');
		IsValidNumberWithDot('txtL3','Latest');
		IsDot('txtL3','Latest');
		}
			
	}
	// Function to validate a control for required value.
	function IsRequiredField(id, fieldName, errorLblId)
	{
	    if (IsRequired(id,'') == false)
	    {
		    $get(errorLblId).innerHTML=fieldName + " cannot be empty.";
		    $get(id).focus();
		    return false;
	    }
	    return true;
	}
   function IsValidTextField(strControlName, strFieldName)

	{		
        //var rgeExp = /[^a-zA-Z]/ ;	
       // var rgeExp =/[^a-z ]/i; 
        var rgeExp =/[^a-zA-Z0-9\\s]/;
        
        return IsValidData(strControlName, strFieldName, rgeExp, 'Enter only alpha numeric text ', true) ;

	}
	
	
	function IsValidalphanumericwithspace(strControlName, strFieldName)

	{		
        //var rgeExp = /[^a-zA-Z]/ ;	
       // var rgeExp =/[^a-z ]/i; 
        var rgeExp =/[^a-zA-Z0-9\ ]/;
        return IsValidData(strControlName, strFieldName, rgeExp, 'Enter only alpha numeric text ', true) ;

	}
	 
    function IsConfirmed(strControlName,strControlName2)
	{
		
		if (document.getElementById(strControlName).value == 'True')
		{
		    var x;
		    x=window.confirm('You have either got too much or too little of one or more of the food categories. We suggest that you go back and check to ensure that you are shopping for the right quantities.Do you want to continue saving the list?');
		   if (x)
		   {
			strError = ' ' ;
			boolIsConfirmed=true;
			//return true;
		   }	
	       else
	       {
	         strError = 'error' ;
	         boolIsConfirmed=false;
	        // return false;
	       }  
		}
		//document.getElementById(strControlName2).value ='';
 		//return !(boolError) ;	
	}




        // Used for shopping list

        function Evaluate3(insFunction)
         {
		// Set up the variables.
		var boolResult = false ;
 		strError = '' ;
 		boolError = false ;
 		
 		// Check for Javascript in browser.
 		//SetJSStatus() ;
 		
 		// Run the validation function.
 		
 		insFunction() ;
 		
 		if(boolIsConfirmed==true)
 		 {
 		// Call display function
 		   DisplayError() ;
 		
 		// Return the boolean result
 		  return !(boolError) ;
 		}  
 		 else if (boolIsConfirmed==false && boolError==false)
 		 {
 		  //DisplayError() ;
 		   return (boolIsConfirmed) ;
 		 }  
 		else if (boolError==true)
 		 {
 		   DisplayError() ;
 		   return !(boolError) ;
 		 }
 		 
 	}
 function ConfirmCreateNewPlan()
 {
 return confirm('You are going to create a new plan. Click OK to continue.');
 }
 
 //Check whether popup is enabled or not
			function IsPopupBlocker()
			{
				var oWin = window.open("","testpopupblocker","width=100,height=50,top=5000,left=5000");
				if (oWin==null || typeof(oWin)=="undefined") 
				{
				return true;
				} 
				else 
				{
				oWin.close();
				return false;
				}
			}
			function CheckPopupBlocker()
				{
				if (IsPopupBlocker()) 
				{
				//document.write("You HAVE A POPUP BLOCKER");
				//alert("You HAVE A POPUP BLOCKER");
				document.getElementById("lblPopWarning").innerHTML="You have one or more pop-up blockers on your system - please turn these off to view the Balanced Living application - if you require help please email usersupport@mybalancedliving.co.uk.";
				} 
				else 
				{
				//document.write("Popup blocker NOT detected.");
				//alert("Popup blocker NOT detected.");
				//document.getElementById("lblError").innerHTML="Popup blocker NOT detected.";
				}

			}
			function fun()
			{
			s='rtrtr';
			document.getElementById('textBox1').innerHTML=s;
			}
			// Function to validate 3 controls for required value (height in cm or Feet/inch).
	function IsRequiredHeight(strControlName1,strControlName2,strControlName3, strFieldName)
	{
		var i;
		if (trimAll(document.getElementById(strControlName1).value) == ''&& trimAll(document.getElementById(strControlName2).value) == '' && trimAll(document.getElementById(strControlName3).value) =='' )
		{
			/*SetError(strFieldName, 'Cannot be empty') ;
			return false ;*/
		
		}
		else
		{
			if ((trimAll(document.getElementById(strControlName1).value) != '') && (trimAll(document.getElementById(strControlName2).value) != '' || trimAll(document.getElementById(strControlName3).value) !='' ))
			{
				SetError(strFieldName, 'You must enter in metric or imperial format') ;
				return false ;
			
			}
			else
			{
			if(trimAll(document.getElementById(strControlName1).value) != '')
			{
				IsValidNumber(strControlName1,'Height');
				if(trimAll(document.getElementById(strControlName1).value) != '' && trimAll(document.getElementById(strControlName1).value) >=1 && (trimAll(document.getElementById(strControlName1).value) < 25 || trimAll(document.getElementById(strControlName1).value) >250))
				{
				
				SetError(strFieldName, 'Must be greater than 25 and should not exceed 250 centimeters') ;
						return false ;
				
				
				
				}
			}
				else
				{
					//if((trimAll(document.getElementById(strControlName2).value) != '') && (trimAll(document.getElementById(strControlName2).value) < 1 || trimAll(document.getElementById(strControlName2).value) >8) && (trimAll(document.getElementById(strControlName3).value) == '' || trimAll(document.getElementById(strControlName3).value) >11))
					if(((trimAll(document.getElementById(strControlName2).value) == '' )|| (trimAll(document.getElementById(strControlName2).value) < 1 || trimAll(document.getElementById(strControlName2).value) >8)) || (trimAll(document.getElementById(strControlName3).value) >11))
					{
						IsValidNumber(strControlName2,'Height');
						IsValidNumber(strControlName3,'Height');
						SetError(strFieldName, 'Must be greater than 0 and should not exceed 8 feet and inches cannot be more than 11') ;
							return false ;
							
					}
					else
					
					{
						if(trimAll(document.getElementById(strControlName2).value) != '' )
						{
						
							i=IsValidNumber(strControlName2,'Height');
							if(i==1)
							{
							if(trimAll(document.getElementById(strControlName3).value) != '' )
								{
								IsValidNumber(strControlName3,'Height');
								}
							}
						}
						else
						{
							if(trimAll(document.getElementById(strControlName3).value) != '' )
							{
							IsValidNumber(strControlName3,'Height');
							}
							else
							{
							return true ;
							}
						}
					}
					
				}
					
				}
				
				
			}
			
		}
			
	
				// Function to validate 3 controls for required value (Weight in kg or stone/pound).
	function IsRequiredWeight(strControlName1,strControlName2,strControlName3, strFieldName)
	{
		var i;
		
		if (trimAll(document.getElementById(strControlName1).value) == ''&& trimAll(document.getElementById(strControlName2).value) == '' && trimAll(document.getElementById(strControlName3).value) =='' )
		{
			/*SetError(strFieldName, 'Cannot be empty') ;
			return false ;*/
		
		}
		else
		{
		
			if ((trimAll(document.getElementById(strControlName1).value) != '') && (trimAll(document.getElementById(strControlName2).value) != '' || trimAll(document.getElementById(strControlName3).value) !='' ))
			{
			
				SetError(strFieldName, 'You must enter in metric or imperial format') ;
				return false ;
			
			}
			else
			{
			if(trimAll(document.getElementById(strControlName1).value) != '')
			{
				IsValidNumberWithDot (strControlName1,'Weight');
				if(trimAll(document.getElementById(strControlName1).value) != '' && trimAll(document.getElementById(strControlName1).value) >=1 && (trimAll(document.getElementById(strControlName1).value) < 15 || trimAll(document.getElementById(strControlName1).value) >450))
				{
				IsValidNumberWithDot(strControlName1,'Weight');
				SetError(strFieldName, 'Must be greater than 15 and should not exceed 450 KG') ;
						return false ;
				}
				}
				else
				{
				if(((trimAll(document.getElementById(strControlName2).value) == '' )|| (trimAll(document.getElementById(strControlName2).value) < 1 || trimAll(document.getElementById(strControlName2).value) >70)) || (trimAll(document.getElementById(strControlName3).value) >13))
				{
				IsValidNumber(strControlName2,'Weight');
				IsValidNumber(strControlName3,'Weight');
				SetError(strFieldName, 'Must be greater than 1 and should not exceed 70 stone and Pounds cannot be more than 13') ;
					return false ;
					
				}
				else
				{
					if(trimAll(document.getElementById(strControlName2).value) != '' )
					{
					i=IsValidNumber(strControlName2,'Weight');
					if(i==1)
						{
						if(trimAll(document.getElementById(strControlName3).value) != '' )
							{
							IsValidNumber(strControlName3,'Weight');
							}
						}
					}
					else
					{
						if(trimAll(document.getElementById(strControlName3).value) != '' )
						{
						IsValidNumber(strControlName3,'Weight');
						}
						else
						{
						return true ;
						}
					}
				}
					
				}
				
				
			}
			
		}
			
	}
	//// For Video Unsecured Path
	
	function VideoUnSec()
	
		//var tit = titletxt + 'testpage' ;
		{
		var UnSecPath ;
		UnSecPath = 'HTTP://Localhost/PHAProject/';
		return UnSecPath ;
		
		//alert('sdfsdf');
		
		}
		
		/////////////////////////////
	// function to check if any of the dropdownlist is selected
	
	function  SelctAnyDropDownLst(strControlName1,strControlName2,strControlName3,strFieldName)
	
	{  
	if ( trimAll(document.getElementById(strControlName1).value)=='-Select-' )
	{ 
	    if ( trimAll(document.getElementById(strControlName2).value)=='-Select-' )
	     
	     {
	     if ( trimAll(document.getElementById(strControlName3).value)=='-Select-' )
	     {
	      SetError(strFieldName, 'Select atleast 1 option.' ) ;
	      return false; 
	      }
	        }
	        }
	        
	       return true;
	  
	
	
	}
	
		
	// Keep user from entering more than maxLength characters
function OnTextBox(controlname,fieldname) 
{        
      
    var e = document.getElementById(controlname);
   if (e.value !=null)
   {
    var value = e.value ;    
     
     if( value.length > 998)
     {           
          SetError(fieldname,'The length cannot be greater than 1000 characters. ');
         return false; 
         
     }
     else
    {     
    strError = ' ' ;  
	 return  true; 
      }    }
}





// Keep user from entering more than maxLength characters
function OnSaveButton(controlname,fieldname) 
{        
      
    var e = document.getElementById(controlname);
   if (e.value !=null)
   {
    var value = e.value ;    
    
     if( value.length > 998)
     {           
          SetError(fieldname,'The length cannot be greater than 1000 characters. ');
         return false; 
         
     }
  }   
}

/////Fucntion to check for require field for 3 TextBoxes

function RequireFor3TextBox(controlname1,controlname2,controlname3,fieldname )

{
   if (IsRequiredField(controlname1,'' )==false) 
   {
   if (IsRequiredField(controlname2,'' )==false) 
   
    {  
    if (IsRequiredField(controlname3,'' )==false) 
    { 
     SetError(fieldname,'Please specify atleast one of the Skills');  
     return false ; }
    }
    
   }
   
   return true;
   
   
}

function CheckPositiveNumber(id, fieldName, isRequired, autoFocus)
{
    var msg = '';
    if ($get(id).value=='')
	{
	    if( isRequired == true)
	    {
	        msg=msg+ fieldName + " cannot be empty"+"<br>";
		}
	}
	else if (IsValidNumberWithDot(id,'')==false)
	{
		msg=msg+fieldName + " should be numeric" +"<br>";
	}
	else if (parseInt($get(id).value)<0)
	{
		msg=msg+"Negative value not allowed in " + fieldName + "<br>";
	}
	if( msg != '' && autoFocus == true ) { $get(id).focus(); }
	return msg;
}
function CheckNumber(id, name, lblError, isOptional, noDecimal)
{
    if($get(id).value=='' && isOptional != true)
    {
	    $get(lblError).innerHTML=name + " cannot be empty";
	    $get(id).focus();
	    return false ;	
    }
    var validNumFunc = noDecimal == true ? IsValidNumberWithDot2 : IsValidNumberWithDot;
    if ($get(id).value!='' && validNumFunc(id,'')==false)
    {
	    $get(lblError).innerHTML=name + " should be Numeric";
	    $get(id).focus();
	    return false ;	
    }
    return true;
}
function CheckEmail(id, name, lblError)
{
    if (IsValEmail(id,'') == false)
    {
	    $get(lblError).innerHTML= name + " is not a valid e-mail address";
	    $get(id).focus();
	    return false;
    }
    return true;
}