	/*
	//this function validates the start & end  dates and months
	function Validate(objStartDate,objEndDate,objStartMonth,objEndMonth,objStartYear,objEndYear)
	{
		startdate = eval(objStartDate + ".value");
		enddate = eval(objEndDate + ".value");		
		startmonth = eval(objStartMonth + ".value");
		endmonth = eval(objEndMonth + ".value");
		
		startYear = eval(objStartYear + ".value");
		endYear = eval(objEndYear + ".value");
		
		if(Number(startYear) > Number(endYear))
		{
			alert("Starting Year should be less than the Ending Year !");
			//eval(objStartYear).focus();
			return false;
		}
		
		if(Number(endmonth) < Number(startmonth) && (Number(startYear) >= Number(endYear)) )
		{
			alert("Ending Month should be greater than Starting Month !");
			eval(objEndMonth).focus();
			return false;
		}		
		
		if(Number(endmonth) == Number(startmonth) && (Number(startYear) >= Number(endYear)))
		{
			if(Number(enddate) < Number(startdate))
			{
				alert("To Date should be greater than From Date !");
				eval(objEndDate).focus();
				return false;
			}
		}	
		
		if ((startmonth==4 || startmonth==6 || startmonth==9 || startmonth==11) && startdate==31) 
		{
			alert("From Month doesn't have 31 days!")
			eval(objStartDate).focus();
			return false
		}
		
		if ((endmonth==4 || endmonth==6 || endmonth==9 || endmonth==11) && enddate==31) 
		{
			alert("To Month doesn't have 31 days!")
			eval(objEndDate).focus();
			return false
		}

		if (startmonth == 2) 
		{ // check for february 29th for starting month
			var today = new Date()
    		var year = today.getYear()
			var isleap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));
			if (startdate>29 || (startdate==29 && !isleap)) 
			{
				alert("February " + year + " doesn't have " + startdate + " days!");
				eval(objStartDate).focus();
				return false;
			}
			
			/*if (enddate>29 || (enddate==29 && !isleap)) 
			{
				alert("February " + year + " doesn't have " + enddate + " days!");
				eval(objEndDate).focus();
				return false;
			}*/ /*
		}
		if(endmonth == 2)
		{	 // check for february 29th for the end month
			var today = new Date()
    		var year = today.getYear()
			var isleap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));
			if (enddate>29 || (enddate==29 && !isleap)) 
			{
				alert("February " + year + " doesn't have " + enddate + " days!");
				eval(objEndDate).focus();
				return false;
			}			
		}
		return true;
	} */
	
	//this function validates the start & end  dates and months
	function Validate(objStartDate,objEndDate,objStartMonth,objEndMonth,objStartYear,objEndYear)
	{
		startdate = eval(objStartDate + ".value");
		enddate = eval(objEndDate + ".value");		
		startmonth = eval(objStartMonth + ".value");
		endmonth = eval(objEndMonth + ".value");
		
		startYear = eval(objStartYear + ".value");
		endYear = eval(objEndYear + ".value");
		
		if(Number(startYear) > Number(endYear))
		{
			alert("Starting Year should be less than the Ending Year !");
			//eval(objStartYear).focus();
			return false;
		}
		
		if(Number(endmonth) < Number(startmonth) && (Number(startYear) >= Number(endYear)) )
		{
			alert("Ending Month should be greater than Starting Month !");
			eval(objEndMonth).focus();
			return false;
		}		
		
		if(Number(endmonth) == Number(startmonth) && (Number(startYear) >= Number(endYear)))
		{
			if(Number(enddate) < Number(startdate))
			{
				alert("To Date should be greater than From Date !");
				eval(objEndDate).focus();
				return false;
			}
		}	
		
		if ((startmonth==4 || startmonth==6 || startmonth==9 || startmonth==11) && startdate==31) 
		{
			alert("From Month doesn't have 31 days!")
			eval(objStartDate).focus();
			return false
		}
		
		if ((endmonth==4 || endmonth==6 || endmonth==9 || endmonth==11) && enddate==31) 
		{
			alert("To Month doesn't have 31 days!")
			eval(objEndDate).focus();
			return false
		}

		if (startmonth == 2) 
		{ // check for february 29th for starting month
			//var today = new Date()
    		//var year = today.getYear()
			var year = startYear;

			var isleap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));
			if (startdate>29 || (startdate==29 && !isleap)) 
			{
				alert("February " + year + " doesn't have " + startdate + " days!");
				eval(objStartDate).focus();
				return false;
			}
		}
		if(endmonth == 2)
		{	 // check for february 29th for the end month
			//var today = new Date()
    		//var year = today.getYear()
			var year = endYear;

			var isleap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));
			if (enddate>29 || (enddate==29 && !isleap)) 
			{
				alert("February " + year + " doesn't have " + enddate + " days!");
				eval(objEndDate).focus();
				return false;
			}			
		}
		return true;
		return false;
	}	
	
function populate(objyear,objmonth,objday)
{
	var t = objday.options[objday.selectedIndex].value
	var yearval = objyear; //pass as 2004
	timeA = new Date(yearval, objmonth.options[objmonth.selectedIndex].value,1);
	timeDifference = timeA - 86400000;
	timeB = new Date(timeDifference);
	var daysInMonth = timeB.getDate();
	if(objday.options.length>0)
	{
		for (var i = 0; i < objday.length; i++)
		{
			objday.options[0] = null;
		}
	}
	for (var i = 0; i < daysInMonth; i++)
	{
		if(i<9)
		{	
			v = i+1;
			objday.options[i] = new Option("0"+v,v);
		}
		else
			objday.options[i] = new Option(i+1,i+1);
			
	}
	if ((t != "") && (t!= 0))
	{	
		objday.options[t-1].selected = true;
	}
}




	function ValidateNewUser()
	{	
		if(!document.form1.usertypedonar.checked && !document.form1.usertypechairp.checked)
		{
			alert("Please select user type !");
			document.form1.usertypedonar.focus();
			return false;
		}
		if(document.form1.usertypedonar.checked)
		{
			if(document.form1.desig.value == "All")
			{
				alert("Please select designation for donor site !");
				document.form1.desig.focus();
				return false;
			}
		}
		if(document.form1.usertypechairp.checked)
		{
			if(document.form1.desigCP.value == "All")
			{
				alert("Please select designation for coordinator site !");
				document.form1.desigCP.focus();
				return false;
			}
		}

		userLength = document.form1.txtUserName.value.length;

		if(trim(document.form1.txtUserName.value) == "")
		{
			alert("Please specify Username !");
			document.form1.txtUserName.focus();
			return false;
		}

		passLength = document.form1.txtPassword.value.length;

		if(trim(document.form1.txtPassword.value) == "")
		{
			alert("Please specify Password !");
			document.form1.txtPassword.focus();
			return false;
		}

		if(document.form1.txtConfirmPassword.value == "")
		{
			alert("Please specify Confirm Password !");
			document.form1.txtConfirmPassword.focus();
			return false;
		}
		if((document.form1.txtPassword.value != "" && document.form1.txtConfirmPassword.value != "") && (document.form1.txtPassword.value != document.form1.txtConfirmPassword.value))
		{
			alert("Password and Confirm Password are not same!");
			document.form1.txtConfirmPassword.focus();
			return false;
		}

		if(trim(document.form1.txtName.value) == "")
		{
			alert("Please specify the Name !");
			document.form1.txtName.focus();
			return false;
		}
	
		if(trim(document.form1.txtPrimaryEmail.value) == "")
		{
			alert("Please specify Primary Email Address !");
			document.form1.txtPrimaryEmail.focus();
			return false;
		}
		
		//if((document.form1.txtPrimaryEmail.value != "") && (fnValidEmail(document.form1.txtPrimaryEmail.value) == false))
		if((document.form1.txtPrimaryEmail.value != "") && (checkemail(document.form1.txtPrimaryEmail) == false))
		{			
			//alert("Please specify valid email address !");
			document.form1.txtPrimaryEmail.focus();
			return false;
		}
		//if((document.form1.txtSecondaryEmail.value != "") && (fnValidEmail(document.form1.txtSecondaryEmail.value) == false))
		if((document.form1.txtSecondaryEmail.value != "") && (checkemail(document.form1.txtSecondaryEmail) == false))
		{			
			//alert("Please specify valid email address !");
			document.form1.txtSecondaryEmail.focus();
			return false;
		}				
		return true;
	}//function
	
	
	//validate existing user (on edit)
	function ValidateUser()
	{	
		if(!document.form1.usertypedonar.checked && !document.form1.usertypechairp.checked)
		{
			alert("Please select user type !");
			document.form1.usertypedonar.focus();
			return false;
		}
		if(document.form1.usertypedonar.checked)
		{
			if(document.form1.desig.value == "All")
			{
				alert("Please select designation for donor site !");
				document.form1.desig.focus();
				return false;
			}
		} 
		
		if(document.form1.usertypechairp.checked)
		{
			if(document.form1.desigCP.value == "All")
			{
				alert("Please select designation for coordinator site !");
				document.form1.desigCP.focus();
				return false;
			}
		}

		if(trim(document.form1.txtName.value) == "")
		{
			alert("Please specify the Name !");
			document.form1.txtName.focus();
			return false;
		}
		
		if(trim(document.form1.txtPrimaryEmail.value) == "")
		{
			alert("Please specify Primary Email Address !");
			document.form1.txtPrimaryEmail.focus();
			return false;
		}
		if((document.form1.txtOldPassword.value != "") || (document.form1.txtNewPassword.value != "") || (document.form1.txtConfirmPassword.value != ""))
		{
			 if(document.form1.txtOldPassword.value == "")
			{
				alert("Please specify Old Password !");
				document.form1.txtConfirmPassword.focus();
				return false;
			}
			if(document.form1.txtConfirmPassword.value == "")
			{
				alert("Please specify Confirm Password !");
				document.form1.txtConfirmPassword.focus();
				return false;
			}
			if(document.form1.txtNewPassword.value == "")
			{
				alert("Please specify New Password !");
				document.form1.txtNewPassword.focus();
				return false;
			}
			if(document.form1.txtNewPassword.value != document.form1.txtConfirmPassword.value)
			{
				alert("New Password and Confirm Password are not same!");
				document.form1.txtNewPassword.focus();
				return false;
			}
			if(document.form1.txtOldPassword.value == document.form1.txtNewPassword.value)
			{
				alert("Old Password and New Password can not be same!");
				document.form1.txtOldPassword.focus();
				return false;
			}
		}
		
		//if((document.form1.txtPrimaryEmail.value != "") && (fnValidEmail(document.form1.txtPrimaryEmail.value) == false))
		if((document.form1.txtPrimaryEmail.value != "") && (checkemail(document.form1.txtPrimaryEmail) == false))
		{			
			//alert("Please specify valid email address !");
			document.form1.txtPrimaryEmail.focus();
			return false;
		}
		//if((document.form1.txtSecondaryEmail.value != "") && (fnValidEmail(document.form1.txtSecondaryEmail.value) == false))
		if((document.form1.txtSecondaryEmail.value != "") && (checkemail(document.form1.txtSecondaryEmail) == false))
		{			
			//alert("Please specify valid email address !");
			document.form1.txtSecondaryEmail.focus();
			return false;
		}		
		return true; 
	}//function
	
	function fnValidEmail(sEmail) 
	{ 
	   var rgemail =/^\w+([\_\.])?\w+\@\w+\.\w+(\.\w+)?$/i; 
	   var result = rgemail.test(sEmail); 
	   return result; 
	}
	
	function fnValidUSPhoneNumber(phone) 
	{ 
	   var rgphone = /^\d{3}\-\d{3}\-\d{4}$/; 
	   var result = rgphone.test(phone); 
	   return result; 
	}

	function PhoneNumberOnly(e)
	{
		// This function will allow to type only numbers and hyphen(-).
		if(window.event) 
		{ // if browser is Internet explorer
			key = e.keyCode; 
			if (key==45) 
				return true;
			else
			{
				if(key <48||key>57)
				return false;
			}
		}
		else if(e.which)
		{	// if browser is Netscape or mozilla
			key = e.which; 
			if (key==45) 
				return true;
			else
			{
				if(key <48||key>57)
				return false;
			}
		}
		else
		 {
			// no event, so pass through
			return true;
		}
	}

	function NumbersOnly(e)
	{
		// This function will allow to type only numbers.

		if(window.event) 
		{ // if browser is Internet explorer
			key = e.keyCode; 
			if(key == 8 || key ==9 || key == 46)
				return true;
			if(key <48||key>57)
			return false;		
		}
		else if(e.which)
		{	// if browser is Netscape or mozilla
			key = e.which; 			
			if(key == 8 || key ==9 || key == 46)
				return true;
				
			if(key <48||key>57)
			return false;		
		}
		else
		 {
			// no event, so pass through
			return true;
		}
	}
	
	function FloatsOnly(e)
	{
		// This function will allow to type only numbers.				
		
		if(window.event) 
		{ // if browser is Internet explorer
			key = e.keyCode; 
			if (window.event.shiftKey) 
			{
				key=key+16;
			}

		}
		else if(e.which)
		{	// if browser is Netscape or mozilla
			key = e.which; 
			if (e.modifiers & Event.SHIFT_MASK) 
			{
				key=key+16;
			}

		}
		else
		 {
			// no event, so pass through
			return true;
		}
//		alert("key="+key);
					
		if((key >=48 && key<=57) || (key >= 96 && key <= 105) || key == 110 || key==8 || key ==9 || key==46 || key==16 || key==35 || key==36 || (key >= 37 && key <= 40) || key==190 || key == 13)
			return true;
		else
		{
			return false;		
		}	
	}
	
	function ValidateFaxNumber(e)
	{
		// This function will allow to type only numbers.
		 
		if(window.event) 
		{ // if browser is Internet explorer
			key = e.keyCode; 						
			if((key<45) || (key > 46 && key <48)||key>57)
			return false;		
		}
		else if(e.which)
		{	// if browser is Netscape or mozilla
			key = e.which; 
			if(key <48||key>57)
			return false;		
		}
		else
		 {
			// no event, so pass through
			return true;
		}
	} 
	
	function noSpace(e)
	{
		// This function will allow to type only numbers.
		 
		if(window.event) 
		{ // if browser is Internet explorer
			key = e.keyCode; 	 
			if(key == 32)
				return false;
		}
		else if(e.which)
		{	// if browser is Netscape or mozilla
			key = e.which; 
			if(key =32)
				return false;		
		} 
	} 
	
	function putFocus(control,user)
	{
		con=eval(control+"."+user);

		if(con)
		{
			if((con !="undefined") || (con !=""))
			{
				con.focus();
			}
		}
	}
	
	
	function checkemail(field)
	{
	var emailStr = new String();
	emailStr=field.value;
	if(emailStr!='')
		{
		var emailPat=/^(.+)@(.+)$/;
		var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]";
		var validChars="\[^\\s" + specialChars + "\]";
		var quotedUser="(\"[^\"]*\")";
		var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
		var atom=validChars + '+';
		var word="(" + atom + "|" + quotedUser + ")";
		var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
		var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");
		var matchArray=emailStr.match(emailPat);
		if (matchArray==null) {
			alert("Email address seems incorrect (check @ and .'s)");
			field.focus();
			field.select();
			return false;
		}
		var user=matchArray[1];
		var domain=matchArray[2];
	
		if (user.match(userPat)==null) {
			alert("Please enter valid email address !");
			field.focus();
			field.select();
	
			return false;
		}
		var IPArray=domain.match(ipDomainPat);
		if (IPArray!=null)
			{
			for (var i=1;i<=4;i++)
				{
				if (IPArray[i]>255)
					{
					alert("Destination IP in the Email Address address is invalid !");
					field.focus();
					field.select();
					return false;
					}
				}
			return true;
			}
	
		var domainArray=domain.match(domainPat);
		if (domainArray==null)
			{
			alert("The domain name in the Email Address doesn't seem to be valid.");
			field.focus();
			field.select();
			return false;
			}
		var atomPat=new RegExp(atom,"g");
		var domArr=domain.match(atomPat);
		var len=domArr.length;
		if (domArr[domArr.length-1].length<2 ||
			domArr[domArr.length-1].length>3)
			{
		   // the address must end in a two letter or three letter word.
			alert("The Email address must end in a three-letter domain, or two letter country.");
			field.focus();
			field.select();
			return false;
			}
	
		if (len<2)
			{
			var errStr="The Email address is missing a hostname!";
			alert(errStr);
			field.focus();
			field.select();
			return false
			}
		}
	return true;
	}
	
	//function to validate the search text boxes values 
	 function ValidateSearch(totalQues,srno)
	 {		 
		for(i=srno;i<totalQues;i++)
		{	//check if any response is greater than 5
			
			txtval = eval("document.form1.SQUES"+i).value;				 
			if(isNaN(txtval))
			{
				alert("Please enter numeric value !");
				eval("document.form1.SQUES"+i).focus();
				return false;					
			}
			if(txtval > 5)
			{
				alert("Please enter value less than 5");
				eval("document.form1.SQUES"+i).focus();
				return false;					
			}//if								
		}//for	  					
		return true;
	 }
	 
	  //function to clear the search textboxes
	function ClearValues(totQues,srno,formname)
	{
		for(i=srno;i<=totQues;i++)
		{
			eval("document.form1.SQUES"+i).value = ""
			eval("document.form1.SCOMPARE"+i).options.selectedIndex = "0";
		}
		
		//clear all the demo graphic check boxes if selected
		for(i=0;i<document.form1.elements.length;i++)
		{
			if(eval("document." + formname +".elements[i]").type == "checkbox")
				eval("document."+ formname +".elements[i]").checked = false;
		}

			
		//clear search and comparison values of avg column
		document.form1.SAVG.value = ""
		document.form1.SAVGCOMPARE.options.selectedIndex = "0";
		if(document.form1.SURVEY)
		{
			document.form1.SURVEY.value = ""
			document.form1.SURCOMPARE.options.selectedIndex = "0";
		}
		//set the focus on  the first question text
		eval("document.form1.SQUES"+srno).focus();
	
	}//function
	
 function checkparameter(noOfques)
  {
  	totalQues=noOfques+5;
  	srno=6;
  	for(i=srno;i<=totalQues;i++)
		{	//check if any response is greater than 5
			txtval = eval("document.form1.SQUES"+i).value;				 
			if(isNaN(txtval))
			{
				alert("Please enter numeric value !");
				eval("document.form1.SQUES"+i).focus();
				return false;					
			}
			if(txtval > 5)
			{
				alert("Please enter value less than 5");
				eval("document.form1.SQUES"+i).focus();
				return false;					
			}//if								
		}//for	  		
  	
  	if(document.form1.SAVG)
  	{
	  	Avgval=document.form1.SAVG.value
	  
	  	if(isNaN(Avgval))
			{
				alert("Please enter numeric value !");
				document.form1.SAVG.focus();
				return false;					
			}
		if(Avgval > 5)
			{
				alert("Please enter AVG value less than 5");
				document.form1.SAVG.focus();
				return false;					
			}//if	
  	}
  	return true;
  }	
  
	function checkLoyaltyQuestions()
	{
		for(i=0;i<document.form1.elements.length;i++)
		{
			if(document.form1.elements[i].name == 'questions1[]')
			{
				if(document.form1.elements[i].checked == true)
					return true;
			}
		}
		alert("Please select atleast One question ");
		return false;
	}

function ValNUserFD()
	{	
		if(document.form1.txtUser.value == "")
		{
			alert("Please specify User Id!");
			document.form1.txtUser.focus();
			return false;
		}	
			
		if (isNaN(document.form1.txtUser.value) == true)
		{
			alert("Please specify numberic User Id!");
			document.form1.txtUser.focus();
			return false;
		}
		
		if (Number(document.form1.txtUser.value) <=0)
		{
			alert("Please specify valid User Id!");
			document.form1.txtUser.focus();
			return false;
		}
		
		if(document.form1.txtUserName.value == "")
		{
			alert("Please specify the User Name !");
			document.form1.txtUserName.focus();
			return false;
		}
		/*
		var str=document.form1.txtUserName.value;
		var len = str.length;
		if (len <5 || len >10)
		{
			alert("Please check length of User Name \n It should be greater then 5 characters and less then 10 characters!");
			document.form1.txtUserName.focus();
			return false;
		}
		*/
		if(document.form1.txtPassword.value == "")
		{
			alert("Please specify Password!");
			document.form1.txtPassword.focus();
			return false;
		}
		if(document.form1.txtConfirmPassword.value == "")
		{
			alert("Please specify Password!");
			document.form1.txtConfirmPassword.focus();
			return false;
		}
		if((document.form1.txtPassword.value != "" && document.form1.txtConfirmPassword.value != "") && (document.form1.txtPassword.value != document.form1.txtConfirmPassword.value))
		{
			alert("Password and Confirm Password are not same!");
			document.form1.txtConfirmPassword.focus();
			return false;
		}
		/*
		var str1=document.form1.txtPassword.value;
		var len1 = str1.length;
		if (len1 <5 || len1 >10)
		{
			alert("Please check length of Password \n It should be greater then 5 characters and less then 10 characters!");
			document.form1.txtPassword.focus();
			return false;
		}
		*/
		if(document.form1.txtName.value == "")
		{
			alert("Please specify the Name !");
			document.form1.txtName.focus();
			return false;
		}
		if((document.form1.txtPrimaryEmail.value != "") && (checkemail(document.form1.txtPrimaryEmail) == false))
		{			
			//alert("Please specify valid email address !");
			document.form1.txtPrimaryEmail.focus();
			return false;
		}
		if((document.form1.txtSecondaryEmail.value != "") && (checkemail(document.form1.txtSecondaryEmail) == false))
		{			
			//alert("Please specify valid email address !");
			document.form1.txtSecondaryEmail.focus();
			return false;
		}				
		return true;
	}//function
	
	
	function ValEditUserFD()
	{	
		
		if(document.form1.txtUserName.value == "")
		{
			alert("Please specify the Name !");
			document.form1.txtUserName.focus();
			return false;
		}
		/*
		var str=document.form1.txtUserName.value;
		var len = str.length;
		if (len <5 || len >10)
		{
			alert("Please check length of Name \n It should be greater then 5 characters and less then 10 characters!");
			document.form1.txtUserName.focus();
			return false;
		}
		*/
		if((document.form1.txtNewPassword.value != "" && document.form1.txtConfirmPassword.value != "") && (document.form1.txtNewPassword.value != document.form1.txtConfirmPassword.value))
		{
			alert("Password and Confirm Password are not same!");
			document.form1.txtConfirmPassword.focus();
			return false;
		}
		/*
		if(document.form1.txtNewPassword.value != "")
		{
			var str1=document.form1.txtNewPassword.value;
			var len1 = str1.length;
			if (len1 <5 || len1 >10)
			{
				alert("Please check length of Password \n It should be greater then 5 characters and less then 10 characters!");
				document.form1.txtNewPassword.focus();
				return false;
			}
		}
		*/
		if(document.form1.txtName.value == "")
		{
			alert("Please specify the Name !");
			document.form1.txtName.focus();
			return false;
		}
		if((document.form1.txtPrimaryEmail.value != "") && (checkemail(document.form1.txtPrimaryEmail) == false))
		{			
			//alert("Please specify valid email address !");
			document.form1.txtPrimaryEmail.focus();
			return false;
		}
		if((document.form1.txtSecondaryEmail.value != "") && (checkemail(document.form1.txtSecondaryEmail) == false))
		{			
			//alert("Please specify valid email address !");
			document.form1.txtSecondaryEmail.focus();
			return false;
		}				
		return true;
	}//function

	function hideDiv(divID,todo)
	{
		if(todo == "hide")
		{
			document.getElementById("TRQUES_"+divID).style.display = "none";
			document.getElementById("TRANSWERS_"+divID).style.display = "none"; 
		}
		else
		{
			document.getElementById("TRQUES_"+divID).style.display = "";
			document.getElementById("TRANSWERS_"+divID).style.display = ""; 		
		}
	}

	Array.prototype.in_array = function ( obj ) {
		var len = this.length;
		for ( var x = 0 ; x <= len ; x++ ) {
			if ( this[x] == obj ) return true;
		}
		return false;
	}

	function close_company(checkVar)
	{
		divEle = "DIV_GROUP_"+checkVar;
		document.getElementById(divEle).innerHTML = "";
	}

	function add_company(numVar)
	{
		nextVar = numVar + 1;
		nextVar1 = nextVar + 1;
		/*//alert(nextVar);
		nextDiv = "DIV_GROUP_"+nextVar;
		newHtml="<br><table class='displaytext' width='70%' border='0' cellspacing='1' cellpadding='1'>";
		newHtml+="  <tr><td width='25%'>&nbsp;Company name:</td><td width='75%'>&nbsp;<input type=field name=group_company_"+nextVar+"[] size='20'></td></tr>";
		newHtml+="	<tr><td>&nbsp;Contact name:</td><td>&nbsp;<input type=field name=group_company_"+nextVar+"[] size='20'></td></tr>";
		newHtml+="	<tr><td>&nbsp;Phone#:</td><td>&nbsp;<input type=field name=group_company_"+nextVar+"[] size='20'></td></tr>  ";
		newHtml+="  <tr><td>&nbsp;Email:</td><td>&nbsp;<input type=field name=group_company_"+nextVar+"[] size='20'></td> </tr>";
		newHtml+="  <tr><td colspan='2'><a href='javascript:add_company("+nextVar+");'>Refer Another Company.</a></td></tr>";
		newHtml+="  </table><BR><DIV ID='DIV_GROUP_"+nextVar1+"'></DIV>";
		
		document.getElementById(nextDiv).innerHTML = newHtml;
		totalCount = document.getElementById("total_sponsors_group").value;
		document.getElementById("total_sponsors_group").value = parseInt(totalCount) + parseInt(1);
		*/
		 totalCount = document.getElementById("total_sponsors_group").value;
		 document.getElementById("total_sponsors_group").value = parseInt(totalCount) + parseInt(1);
		 document.getElementById("link_div_"+numVar).style.display = "none"; 
		 document.getElementById("DIV_GROUP_"+nextVar).style.display = ""; 
	}

	/*
	function close_div(divt)
	{
		document.getElementById(divt).style.display="none";
	}

	function add_more_teammember(divEle)
	{
		allready = document.getElementById(divEle).innerHTML;
		count_m = document.getElementById("team_member_count").value;

		// alert(count_m);
		newhtml = "<DIV id='div_"+count_m+"'><BR><img src='images/spacer.gif' border='0' height='6'><BR><input size='40' class='input' name=QUES28[] type='field'><a href=javascript:close_div('div_"+count_m+"')>Close</a></div>";
		//alert(allready+newhtml);
		addhtml = allready+newhtml;
		document.getElementById(divEle).innerHTML = addhtml;

		document.getElementById("team_member_count").value =  parseInt(count_m) + 1;       
	} 
	*/


	function Validate_New()
	{

		EMAIL1 = document.getElementById("referral_mail1").value;
		
		if(EMAIL1 && fnValidEmail(EMAIL1) == false)
		{
			alert("Please enter correct referral email.");
			document.getElementById("referral_mail1").focus();
			return false;    
		}

		EMAIL2 = document.getElementById("referral_mail2").value;
		
		if(EMAIL2 && fnValidEmail(EMAIL2) == false)
		{
			alert("Please enter correct referral email.");
			document.getElementById("referral_mail2").focus();
			return false;    
		}
		
		EMAIL3 = document.getElementById("referral_mail3").value;
		
		if(EMAIL3 && fnValidEmail(EMAIL3) == false)
		{
			alert("Please enter correct referral email.");
			document.getElementById("referral_mail3").focus();
			return false;    
		}
		
		EMAIL4 = document.getElementById("referral_mail4").value;
		
		if(EMAIL4 && fnValidEmail(EMAIL4) == false)
		{
			alert("Please enter correct referral email.");
			document.getElementById("referral_mail4").focus();
			return false;    
		}
		
		return true;
	}

	function Validate_cp()
	{
		flag = "1";

		//Ques. having radio buttons
		var arrRadio = new Array(13,34,12,41,14,18,22,23,19,20,21,25,26,29,35,36,37,38,50,40,43,44,45); //24,

		// Ques No. in DB 24,
		var arrQuestions = new Array(0,1,2,3,8,9,10,16,13,34,12,41,14,18,22,23,19,20,21,25,26,29,35,36,37,38,50,40,42,43,44,45,47);

		// Ques No. on survey page
		var arrQuestionsNo = new Array(0,"Your Name.","Title.","Organization/Sponsor Name.","Phone Number.","E-mail.","Fax Number.","Projected donations.",1,2,3,4,5,6,7,8,9,10,11,"12.A","12.B",13,"14.A","14.B","14.C","14.D",15,16,17,18,19,20,21,22);
		
		cnt = arrQuestions.length;

		for(i=1; i<cnt; i++)
		{
			//For radio buttons
			if(arrRadio.in_array(arrQuestions[i]))
			{
				flag="0";
				val = eval("document.frm.QUES"+arrQuestions[i]+".length");

				for(j=0;j<val;j++)
				{
					ans = eval("document.frm.QUES"+arrQuestions[i]+"["+j+"].checked");
		 
					if(ans == true)
					{
						flag = "1";                
					}  
				}
			 
				if(flag=="0")
				{
					alert("Please select atleast one response for Question NO "+ arrQuestionsNo[i]); 
					eval("document.frm.QUES" +arrQuestions[i]+ "[0].focus()");
					return false;   
				}
			}
			else
			{
				if(arrQuestions[i] == 7)
				{
					var msg = "";

					if(document.frm.month.value == "")
					{
						msg += "Please select Month\n";
					}
					if(document.frm.day.value == "")
					{
						msg += "Please select Day\n";
					}
					if(document.frm.year.value == "")
					{
						msg += "Please select Year\n";
					}
					if(document.frm.hour.value == "" || document.frm.minute.value == "")
					{
						msg += "Please select Time\n";
					}
					
					if(msg)
					{
						alert(msg);
						document.frm.month.focus();	
						return false;
					}
					else
					{
						flag = 1;
					}
				}
				else if(arrQuestions[i] == 30 || arrQuestions[i] == 31 || arrQuestions[i] == 32)
				{
					if(document.frm.QUES29[1].checked)
					{
						if(eval("document.frm.QUES" +arrQuestions[i]+ ".value") == "" || eval("document.frm.QUES" +arrQuestions[i]+ ".value") == 0)
						{
							alert("Please enter response for Question NO "+ arrQuestionsNo[i]);
							eval("document.frm.QUES" +arrQuestions[i]+ ".focus()");
							return false;
						}
					}
				}
				else
				{	
					//For other values
					if(eval("document.frm.QUES" +arrQuestions[i]+ ".value") == "" || eval("document.frm.QUES" +arrQuestions[i]+ ".value") == 0)
					{
						alert("Please enter response for Question : "+ arrQuestionsNo[i]);
						eval("document.frm.QUES" +arrQuestions[i]+ ".focus()");
						return false;
					}
				}
			}
		}

		if(flag=="0")
		{
			return false;
		}
		else
		{
			return true;
		}
	}//function

	/**
	* @desc Function () - This function is used to show/hide combo box
	* @param form frm, int ques, visib  
	*/ 
	function OpenHide_Div(frm,ques,visib)
	{ 
		var str=ques;
		var subs=str.substring(4);
		var subs="QUES"+subs;

		var btn = frm[subs];       
		var valid;

		for (var x=0; x < btn.length; x++)
		{
			valid = btn[x].checked;     
		  
			if (valid) 
			{	
				if(visib=='1')
				{
					document.getElementById(ques).style.display = 'block'; 
				}
				else if(visib=='0')
				{
					document.getElementById(ques).style.display = "none";
				}
				
				break;
			}
		}
	}
	/* End of function OpenHide_Div */ 

	function Open_EditableOf(fieldName, divStyle)
	{
		/* divStyle can be block or inline */
		if(document.getElementById(fieldName).style.display == 'none')
		{
			document.getElementById(fieldName).style.display = divStyle;
		}
		else if(document.getElementById(fieldName).style.display == divStyle)
		{
			document.getElementById(fieldName).style.display = 'none';
		}
	}

	/**
	*	Function to validate form while entering new drive
	*/

	function ValidateNewDrive()
	{	
		var msg = "";

		if(document.frm.month.value == "")
		{
			msg += "Please select Month\n";
		}
		if(document.frm.day.value == "")
		{
			msg += "Please select Day\n";
		}
		if(document.frm.year.value == "")
		{
			msg += "Please select Year\n";
		}
		if(document.frm.hour.value == "")
		{
			msg += "Please select Hours\n";
		}
		if(document.frm.minute.value == "")
		{
			msg += "Please select Minutes\n";
		}
		
		if(msg)
		{
			alert(msg);
			document.frm.month.focus();	
			return false;
		}
		else
		{
			flag = 1;
		}
		
		if(document.frm.drive_name.value == "")
		{
			alert("Please specify drive name.");
			document.frm.drive_name.focus();
			return false;
		}
		if(document.frm.organization_name.value == "")
		{
			alert("Please specify organization name.");
			document.frm.organization_name.focus();
			return false;
		}		
		if(document.frm.organization_location.value == "")
		{
			alert("Please specify organization location.");
			document.frm.organization_location.focus();
			return false;
		}
		if(document.frm.organization_type.value == "")
		{
			alert("Please specify organization type.");
			document.frm.organization_type.focus();
			return false;
		}

		if(document.frm.organization_employees.value == "")
		{
			alert("Please specify organization employees.");
			document.frm.organization_employees.focus();
			return false;
		}
		if(document.frm.chairperson_name.value == "")
		{
			alert("Please specify chairperson name.");
			document.frm.chairperson_name.focus();
			return false;
		}
		if(document.frm.chairperson_title.value == "")
		{
			alert("Please specify chairperson title.");
			document.frm.chairperson_title.focus();
			return false;
		}
		if(document.frm.chairperson_phone.value == "")
		{
			alert("Please specify chairperson phone.");
			document.frm.chairperson_phone.focus();
			return false;
		}
		if(document.frm.chairperson_mail.value == "")
		{
			alert("Please specify chairperson mail.");
			document.frm.chairperson_mail.focus();
			return false;
		}
		if((document.frm.chairperson_mail.value != "") && (checkemail(document.frm.chairperson_mail) == false))
		{			
			//alert("Please specify valid email address !");
			document.frm.chairperson_mail.focus();
			return false;
		}
		if(document.frm.chairperson_phone.value == "")
		{
			alert("Please specify chairperson phone.");
			document.frm.chairperson_phone.focus();
			return false;
		}
		if(document.frm.rd_name.value == "")
		{
			alert("Please select DRDIRECTOR name.");
			document.frm.rd_name.focus();
			return false;
		}	
		if(document.frm.crm_name.value == "")
		{
			alert("Please select DRM name.");
			document.frm.crm_name.focus();
			return false;
		}	
		if(document.frm.crr_name.value == "")
		{
			alert("Please select AR name.");
			document.frm.crr_name.focus();
			return false;
		}		
		if(document.frm.rcm_name.value == "")
		{
			alert("Please select CM name.");
			document.frm.rcm_name.focus();
			return false;
		}
		/*if(document.frm.teamleader_name.value == "")
		{
			alert("Please select Team Leader name.");
			document.frm.teamleader_name.focus();
			return false;
		}		
		if(document.frm.chargeperson_name.value == "")
		{
			alert("Please select chargeperson name.");
			document.frm.chargeperson_name.focus();
			return false;
		}*/
		if(document.frm.projected_donations.value == "")
		{
			alert("Please specify projected donations.");
			document.frm.projected_donations.focus();
			return false;
		}
		
		return true;
	}//function

	function trim(stringToTrim) {
		return stringToTrim.replace(/^\s+|\s+$/g,"");
	}
	function ltrim(stringToTrim) {
		return stringToTrim.replace(/^\s+/,"");
	}
	function rtrim(stringToTrim) {
		return stringToTrim.replace(/\s+$/,"");
	}

	// Give string object the trim method.
	String.prototype.trim = function(){
		return( this.replace(new RegExp("^([\\s]+)|([\\s]+)$", "gm"), "") );
	}
	
	// Give string object the left trim method.
	String.prototype.leftTrim = function(){
		return( this.replace(new RegExp("^[\\s]+", "gm"), "") );
	}
	
	// Give string object the right trim method.
	String.prototype.rightTrim = function(){
		return( this.replace(new RegExp("[\\s]+$", "gm"), "") );
	}