// JavaScript Document
//============================================================================================================
//~ Checks to see if a required field is blank.  If so, an error message is displayed.
function ForceDataEntry(objField, strFieldName)
{
	// To find out the Value of the control
	var strFieldValue=trimAll(objField.value);
	if (IsEmpty(strFieldValue))
	{
		alert("You need to enter your " + strFieldName);
		objField.focus();
		return false;
	}
	return true;
}
//==============================================================================================================

//~ Checks to see if a DropDownList is empty. If so, an error message is displayed.
function ForceComboItems(ddlName, strDdlName)
{
	// To find out the Value of the control
	var ItemCount=ddlName.value;
	if (IsComboEmpty(ItemCount))
		{
			alert("First Select the " + strDdlName);
			ddlName.focus();
			return false;
		}
	return true;
}
//===============================================================================================================
//================================================================================================================
//~ Check whether a given string is empty or not.
function IsEmpty(strTxtBoxValue)
{   if ((strTxtBoxValue == null) || (strTxtBoxValue.length == 0))
	{
		return true;			//^ Returning True, if Empty Text Box found
	}	
}

//=====================================================================================================
//================================================================================================================
//~ Check whether a given DropDown value is empty or not.

function IsComboEmpty(ddlValue)
{   if  (ddlValue =="--Select--")
	{
		return true;			//^ Returning True, if Empty Text Box found
	}	
}

	
//===============================================================================================================
//================================================================================================================
//~ Check whether a given Email is Valid or not.
function IsEmailValid(objField, strFieldName)
{
	// To find out the Value of the control
	var strFieldValue=objField.value;
	if (IsEmpty(strFieldValue))
	{
		return true;
	}
	else
	{
	    var at="@"
		var dot="."
		var lat=strFieldValue.indexOf(at)
		var lstr=strFieldValue.length
		var ldot=strFieldValue.indexOf(dot)
		
		if (strFieldValue.indexOf(at)==-1)
		{
		    alert("Email should be in abc@xyz.com format");
		   objField.focus();
		   return false;
		}
		if (strFieldValue.indexOf(at) == -1 || strFieldValue.indexOf(at) == 0 || strFieldValue.indexOf(at) == lstr)
        {
		   alert("Email should be in abc@xyz.com format");
		   objField.focus();
		   return false;
		}
		if (strFieldValue.indexOf(dot)== lstr || strFieldValue.indexOf(dot)== -1 || strFieldValue.indexOf(dot)== 0  )
        {
		   alert("Email should be in abc@xyz.com format");
		   objField.focus();
		   return false
		}
		if ((ldot+1)  == lstr   )
        {
        
		    alert("Email should be in abc@xyz.com format");
		    objField.focus();
		    return false
		}
		 if (strFieldValue.indexOf(at,(lat+1))!= -1)
         {
		    alert("Email should be in abc@xyz.com format");
		    objField.focus();
		    return false;
		 }
		 if (strFieldValue.substring(lat-1,lat) == dot || strFieldValue.substring(lat+1,lat+2)== dot)
         {
		   alert("Email should be in abc@xyz.com format");
		   objField.focus();
		   return false;
		 }

		 if (strFieldValue.indexOf(dot,(lat+2))== -1)
         {
		    alert("Email should be in abc@xyz.com format");
		    objField.focus();
		    return false;
		 }
		// debugger;
		 if (lstr == strFieldValue.indexOf(dot)+2 || lstr == strFieldValue.indexOf(dot)+7)
          {
		       alert("Email should be in abc@xyz.com format");
		       objField.focus();
		       return false;
		       
		      }
		 if (strFieldValue.indexOf(" ")!= -1)
         {
		     alert("Email should be in abc@xyz.com format");
		     objField.focus();
		     return false;
		 }
		return true;
		}
	
	
}
//--------------------------------------------------------------------------------------------------------------------
 //===============================================================================================================
//~ Returns true if the string passed is a valid number
//~ no characters except a -ve sign at the begining is accepted
//~ otherwise, it displays an error message
function ForceNumericEntry(objField, strFieldName)
{
	var strFieldValue = new String(objField.value);
    var intLoopCounter = 0;

	for (intLoopCounter = 0; intLoopCounter < strFieldValue.length; intLoopCounter++)
		//if ((strFieldValue.charAt(intLoopCounter) < '0' || strFieldValue.charAt(intLoopCounter) > '9') && (strFieldValue.charAt(0) != '-'))
		
		if  ((strFieldValue.charAt(intLoopCounter) > '9') && (strFieldValue.charAt(0) != '-'))
		{
			alert(strFieldName + " must be a valid No ");
			objField.focus();
			return false;
		}
	return true;
}
//================================================================================

//==========================================================================================================
// Validates a Date Entered by User 
// Also Forces the User to stick to either "dd/MMM/yyyy" or "dd-MMM-yyyy" Date Formats.

	function isValidDate(objField,strDateName)
	{
     var strDateValue=trimAll(objField.value)
    
    // If Date is Blank, Don't Validate
    if (IsEmpty(strDateValue)) return true;
     
       
     var arr = [];
     arr['JAN'] = 0;
     arr['FEB'] = 1;
     arr['MAR'] = 2;
     arr['APR'] = 3;
     arr['MAY'] = 4;
     arr['JUN'] = 5;
     arr['JUL'] = 6;
     arr['AUG'] = 7;
     arr['SEP'] = 8;
     arr['OCT'] = 9;
     arr['NOV'] = 10;
     arr['DEC'] = 11;
     
     //^ Splitting the date using the divider "/"
     var arrDate = strDateValue.split('/');
     
     //^ If user did not use the divider "/" then,
     if (arrDate.length!=3)
     {
        //^ Splitting the date using the divider "-"
         arrDate = strDateValue.split('-');
     }
     
     // if splitting occured using the correct divider
     if (arrDate.length==3 && strDateValue.length==11)
     {
       //^ d stores date entered by user in Javascript Internal Date Format
       var d = new Date(arrDate[2], arr[arrDate[1].toUpperCase()], arrDate[0]);
     
       //Checking if the date entered is a valid Date or not
       if (!isNaN(d) && d.getFullYear()==arrDate[2] && d.getMonth()==arr[arrDate[1].toUpperCase()] && d.getDate()==arrDate[0])
       {
             return true;
       }
       else
       {
            alert(strDateName + " Valid Date Formats Are : DD-MMM-YYYY");
            objField.focus();
            return false;
       }
     }
     else
     {
        alert("Valid Date Formats Are :DD-MMM-YYYY");
        objField.focus();
        return false;
     }
}
//--------------------------------------------------------------------------------------
function getFileType(objField,strFile)
{

  sValue= objField.value;
  var aParts = sValue.split( "\\" );
  var iParts = aParts.length;
  if( iParts >= 1 )
  {
    var sFile = aParts[ iParts - 1 ];
    var aFile = sFile.split( "." );
    if( aFile.length == 2 )
    {
      sName = aFile[0];
      sExt = aFile[1];

		if(sExt=="txt")
		 {
			 alert("Not a supported File Format(File With .txt Extension not allowed)");
		 }
		 else
		 {
		 // not a supported file fomat
		return true;
		 }
     }
	 else
    {
      //not a valid file or blank
	  alert("Bad filespec should have one dot between name and extension");

    }
  }
  
 
}		
		
		
		




//--------------------------------------------------------------------------------------------
function greaterThanZero(objField, strNumber)
{
if(objField.value=="")
{
return true;
}
else if(objField.value==0)
{

alert(""+strNumber+" Should Be Greater than Zero")
objField.focus();
return false;
}
return true;
}


//=============================================================================================================
//=============================================================================================================

// Function for trim any string
function trimAll( strValue )
			 {				
				var objRegExp = /^(\s*)$/;
					      //check for all spaces
					if(objRegExp.test(strValue))
					 {
					strValue = strValue.replace(objRegExp, '');
					if( strValue.length == 0)
						return strValue;
					 }
				        //check for leading & trailing spaces
				    objRegExp = /^(\s*)([\W\w]*)(\b\s*$)/;
				    if(objRegExp.test(strValue)) 
				     {
					//remove leading and trailing whitespace characters
					strValue = strValue.replace(objRegExp, '$2');
				     }
				return strValue;
			 }


//==================================
function isDecimalValue(fieldName, fieldLabel)
{
    decallowed = 2;  // how many decimals are allowed?
    fieldValue = fieldName.value;
    
    if (isNaN(fieldValue) || fieldValue == "") 
    {
        alert(fieldLabel + " is not a valid number.");
        fieldName.select();
        fieldName.focus();
        return false;
    }
    else 
    {
        if (fieldValue.indexOf('.') == -1) fieldValue += ".";
            dectext = fieldValue.substring(fieldValue.indexOf('.')+1, fieldValue.length);
    
        if (dectext.length > decallowed)
        {
            alert (fieldLabel + " allows up to " + decallowed + " decimal places only.");
            fieldName.select();
            fieldName.focus();
            return false;
        }
        else 
        {
            return true;
        }
    }
}


//================================================================================================================================================================
function ValidateAdvertiseForm()
{
	//# Validating Company Name for blank
	if (!ForceDataEntry(document.Advertise.txtName,'Name')) return false;
	var name1=trimAll(document.Advertise.txtName.value);
	if(name1=="")
	{
	alert("You need to enter Name");
	document.Advertise.txtName.focus();
	return false;
	}
		//# Validating Company Name for blank
	if (!ForceDataEntry(document.Advertise.txtCompany,'Company Name')) return false;
	var company1=trimAll(document.Advertise.txtCompany.value);
	if(company1=="")
	{
	alert("You need to enter Company Name");
	document.Advertise.txtCompany.focus();
	return false;
	}
//# Validating Contact Person for blank
	if (!ForceDataEntry(document.Advertise.txtPhone,'Contact Ph No.')) return false;
	var Phone1=trimAll(document.Advertise.txtPhone.value);
	if(Phone1=="")
	{
	alert("You need to enter Contact Ph No.");
	document.Advertise.txtPhone.focus();
	return false;
	}
	if (!ForceNumericEntry(document.Advertise.txtPhone,'Contact Ph No.')) return false;
	if(!greaterThanZero(document.Advertise.txtPhone, 'Contact Ph No.')) return false;	
	//# Validating Contact Person for blank
	if (!ForceDataEntry(document.Advertise.txtEmail,'Contact E-mail')) return false;
	var email1=trimAll(document.Advertise.txtEmail.value);
	if(email1=="")
	{
	alert("You need to enter Contact E-mail");
	document.Advertise.txtEmail.focus();
	return false;
	}
	if (!IsEmailValid(document.Advertise.txtEmail,'Enter proper E-mail')) return false;		
	


}


//================================================================================================================================================================

function ValidateContactUs()
{
	//# Validating Company Name for blank
	var name1=trimAll(document.ContactUs.name.value);
	if(name1=="")
	{
	alert("You need to enter Name");
	document.ContactUs.name.focus();
	return false;
	}
	
	if (!ForceDataEntry(trimAll(document.ContactUs.name),'Name')) return false;
		
	var email1=trimAll(document.ContactUs.email.value);
	if(email1=="")
	{
	alert("You need to enter E-mail");
	document.ContactUs.email.focus();
	return false;
	}
	//# Validating Email Address for Blank
	if (!ForceDataEntry(document.ContactUs.email, 'E-mail')) return false;
	
	//# Validating Email Address for Valid Format
	if (!IsEmailValid(document.ContactUs.email,'Enter proper E-mail')) return false;
	if (!ForceNumericEntry(document.ContactUs.phone,'Phone')) return false;
	if(!greaterThanZero(document.ContactUs.phone, 'Phone')) return false;	
	var mobile1=trimAll(document.ContactUs.mobile.value);
	if(mobile1=="")
	{
	alert("You need to enter Mobile");
	document.ContactUs.mobile.focus();
	return false;
	}
	//# Validating Mobile No for blank
	if (!ForceDataEntry(document.ContactUs.mobile,'Mobile')) return false;
			
	//# Validating Mobile No for Numeric
	if (!ForceNumericEntry(document.ContactUs.mobile,'Mobile')) return false;
	if(!greaterThanZero(document.ContactUs.mobile, 'Mobile')) return false;	
}
//------------------------------------------------------------------------------------------------------------------
function ValidateFeedback()
{
	//# Validating Company Name for blank
	var name1=trimAll(document.feedback.name.value);
	if(name1=="")
	{
	alert("You need to enter Name");
	document.feedback.name.focus();
	return false;
	}
	
	if (!ForceDataEntry(trimAll(document.feedback.name),'Name')) return false;
		
	var email1=trimAll(document.feedback.email.value);
	if(email1=="")
	{
	alert("You need to enter E-mail");
	document.feedback.email.focus();
	return false;
	}
	//# Validating Email Address for Blank
	if (!ForceDataEntry(document.feedback.email, 'E-mail')) return false;
	
	//# Validating Email Address for Valid Format
	if (!IsEmailValid(document.feedback.email,'Enter proper E-mail')) return false;
	if (!ForceNumericEntry(document.feedback.phone,'Phone')) return false;
	if(!greaterThanZero(document.feedback.phone, 'Phone')) return false;	
	var mobile1=trimAll(document.feedback.mobile.value);
	if(mobile1=="")
	{
	alert("You need to enter Mobile");
	document.feedback.mobile.focus();
	return false;
	}
	//# Validating Mobile No for blank
	if (!ForceDataEntry(document.feedback.mobile,'Mobile')) return false;
			
	//# Validating Mobile No for Numeric
	if (!ForceNumericEntry(document.feedback.mobile,'Mobile')) return false;
	if(!greaterThanZero(document.feedback.mobile, 'Mobile')) return false;	
}


//=================================================================================================================

function ValidateContributeForm()
{
	//# Validating Company Name for blank
	if (!ForceDataEntry(document.contribute.txtName,'Name')) return false;
	var name1=trimAll(document.contribute.txtName.value);
	if(name1=="")
	{
	alert("You need to enter Name");
	document.contribute.txtName.focus();
	return false;
	}
		//# Validating Company Name for blank
	
//# Validating Contact Person for blank
	if (!ForceDataEntry(document.contribute.txtPhone,'Contact Ph No.')) return false;
	var Phone1=trimAll(document.contribute.txtPhone.value);
	if(Phone1=="")
	{
	alert("You need to enter Contact Ph No.");
	document.contribute.txtPhone.focus();
	return false;
	}
	if (!ForceNumericEntry(document.contribute.txtPhone,'Contact Ph No.')) return false;	
	if(!greaterThanZero(document.contribute.txtPhone, 'Contact Ph No.')) return false;	
	//# Validating Contact Person for blank
	if (!ForceDataEntry(document.contribute.txtEmail,'Contact E-mail')) return false;
	var email1=trimAll(document.contribute.txtEmail.value);
	if(email1=="")
	{
	alert("You need to enter Contact E-mail");
	document.contribute.txtEmail.focus();
	return false;
	}
	if (!IsEmailValid(document.contribute.txtEmail,'Enter proper E-mail')) return false;		
	
    //if (!ForceDataEntry(document.contribute.txtTitle,'Content Title')) return false;
	//var content1=trimAll(document.contribute.txtTitle.value);
	//if(content1=="")
	//{
	//alert("You need to enter Content Title");
	//document.contribute.txtTitle.focus();
	//return false;
	//}
	
	if(document.contribute.text.checked)
	{
	if(!ForceDataEntry(document.contribute.txtTitle1,'Text')) return false;
	}
	else
	{
	var file1=trimAll(document.contribute.File1.value);
	if(file1=="")
	{
	alert("Please browse file to upload");
	document.contribute.File1.focus();
	return false;
	}
	if(!getFileType(document.contribute.File1, 'Upload File' ) )return false;
	
	}
	
	


}

function ValidateContributeFormKW()
{
	//# Validating Company Name for blank
	if (!ForceDataEntry(document.contribute.txtName,'Name')) return false;
	var name1=trimAll(document.contribute.txtName.value);
	if(name1=="")
	{
	alert("You need to enter Name");
	document.contribute.txtName.focus();
	return false;
	}
		//# Validating Company Name for blank
	
//# Validating Contact Person for blank
	if (!ForceDataEntry(document.contribute.txtPhone,'Contact Ph No.')) return false;
	var Phone1=trimAll(document.contribute.txtPhone.value);
	if(Phone1=="")
	{
	alert("You need to enter Contact Ph No.");
	document.contribute.txtPhone.focus();
	return false;
	}
	if (!ForceNumericEntry(document.contribute.txtPhone,'Contact Ph No.')) return false;	
	if(!greaterThanZero(document.contribute.txtPhone, 'Contact Ph No.')) return false;	
	//# Validating Contact Person for blank
	if (!ForceDataEntry(document.contribute.txtEmail,'Contact E-mail')) return false;
	var email1=trimAll(document.contribute.txtEmail.value);
	if(email1=="")
	{
	alert("You need to enter Contact E-mail");
	document.contribute.txtEmail.focus();
	return false;
	}
	if (!IsEmailValid(document.contribute.txtEmail,'Enter proper E-mail')) return false;		
	
    //if (!ForceDataEntry(document.contribute.txtTitle,'Content Title')) return false;
	//var content1=trimAll(document.contribute.txtTitle.value);
	//if(content1=="")
	//{
	//alert("You need to enter Content Title");
	//document.contribute.txtTitle.focus();
	//return false;
	//}
	
	if(document.contribute.text.checked)
	{
	if(!ForceDataEntry(document.contribute.txtTitle1,'Question')) return false;
	if(!ForceDataEntry(document.contribute.txtTitle2,'Answer')) return false;
	}
	else
	{
	var file1=trimAll(document.contribute.File1.value);
	if(file1=="")
	{
	alert("Please browse file to upload");
	document.contribute.File1.focus();
	return false;
	}
	if(!getFileType(document.contribute.File1, 'Upload File' ) )return false;
	
	}
	
	


}

function ValidateContributeFormMMW()
{
	//# Validating Company Name for blank
	if (!ForceDataEntry(document.contribute.txtName,'Name')) return false;
	var name1=trimAll(document.contribute.txtName.value);
	if(name1=="")
	{
	alert("You need to enter Name");
	document.contribute.txtName.focus();
	return false;
	}
		//# Validating Company Name for blank
	
//# Validating Contact Person for blank
	if (!ForceDataEntry(document.contribute.txtPhone,'Contact Ph No.')) return false;
	var Phone1=trimAll(document.contribute.txtPhone.value);
	if(Phone1=="")
	{
	alert("You need to enter Contact Ph No.");
	document.contribute.txtPhone.focus();
	return false;
	}
	if (!ForceNumericEntry(document.contribute.txtPhone,'Contact Ph No.')) return false;	
	if(!greaterThanZero(document.contribute.txtPhone, 'Contact Ph No.')) return false;	
	//# Validating Contact Person for blank
	if (!ForceDataEntry(document.contribute.txtEmail,'Contact E-mail')) return false;
	var email1=trimAll(document.contribute.txtEmail.value);
	if(email1=="")
	{
	alert("You need to enter Contact E-mail");
	document.contribute.txtEmail.focus();
	return false;
	}
	if (!IsEmailValid(document.contribute.txtEmail,'Enter proper E-mail')) return false;		
	
//////if (!ForceDataEntry(document.contribute.txtTitle,'Content Title')) return false;
//////	var content1=trimAll(document.contribute.txtTitle.value);
//////	if(content1=="")
//////	{
//////	alert("You need to enter Content Title");
//////	document.contribute.txtTitle.focus();
//////	return false;
//////	}
	if(document.contribute.text.checked)
	{
	    if(!ForceDataEntry(document.contribute.txtTitle1,'Text')) return false;
	    if (document.contribute.txtTitle1.value.length != 4)
	    {
	        alert("Text Length should be 4 Characters");
    	    document.contribute.txtTitle1.focus();
	        return false;
	        
	    }
	}
	else
	{
	var file1=trimAll(document.contribute.File1.value);
	if(file1=="")
	{
	alert("Please browse file to upload");
	document.contribute.File1.focus();
	return false;
	}
	if(!getFileType(document.contribute.File1, 'Upload File' ) )return false;
	
	}
}

//--------------------------------------------------------------------------------------------------------------------

function ValidateInstallForm()
{
	//# Validating Company Name for blank
	if (!ForceDataEntry(document.Install.txtName,'Name')) return false;
	var name1=trimAll(document.Install.txtName.value);
	if(name1=="")
	{
	alert("You need to enter Name");
	document.Install.txtName.focus();
	return false;
	}
		//# Validating Company Name for blank
	if (!ForceDataEntry(document.Install.txtCompany,'Company Name')) return false;
	var company1=trimAll(document.Install.txtCompany.value);
	if(company1=="")
	{
	alert("You need to enter Company Name");
	document.Install.txtCompany.focus();
	return false;
	}
//# Validating Contact Person for blank
	if (!ForceDataEntry(document.Install.txtPhone,'Contact Ph No.')) return false;
	var Phone1=trimAll(document.Install.txtPhone.value);
	if(Phone1=="")
	{
	alert("You need to enter Contact Ph No.");
	document.Install.txtPhone.focus();
	return false;
	}
	if (!ForceNumericEntry(document.Install.txtPhone,'Contact Ph No.')) return false;	
	if(!greaterThanZero(document.Install.txtPhone, 'Contact Ph No.')) return false;
	
	//# Validating Contact Person for blank
	if (!ForceDataEntry(document.Install.txtEmail,'E-mail')) return false;
	var email1=trimAll(document.Install.txtEmail.value);
	if(email1=="")
	{
	alert("You need to enter E-mail");
	document.Install.txtEmail.focus();
	return false;
	}
	if (!IsEmailValid(document.Install.txtEmail,'Enter proper E-mail')) return false;		
    if (!ForceNumericEntry(document.Install.txtLocation,'No. of Location')) return false;		
    if(!greaterThanZero(document.Install.txtLocation, 'No. of Location')) return false;

}

function chkGender()
{
    if (document.ShowReadyReckoner.chkSelectAllGender.checked == true)
    {
        document.ShowReadyReckoner.chkMen.checked = true;
        document.ShowReadyReckoner.chkWomen.checked = true;
    }
    else
    {
        document.ShowReadyReckoner.chkMen.checked = false;
        document.ShowReadyReckoner.chkWomen.checked = false;
    }
}

function DeselectGender()
{
    if (document.ShowReadyReckoner.chkMen.checked == false || document.ShowReadyReckoner.chkWomen.checked == false)
        document.ShowReadyReckoner.chkSelectAllGender.checked = false;
}

function chkAudience()
{
    for (i=0;1==1;i++)
    {
        if (document.getElementById("chklstAudience_" + i) == null)
        {
            break;
        }
        else
        {
           if (document.ShowReadyReckoner.chkSelectAllAudience.checked == true)
           {
                document.getElementById("chklstAudience_" + i).checked = true;
           }
           else
           {
                document.getElementById("chklstAudience_" + i).checked = false;
           }
        }
    }
}

function DeselectAudience()
{
    for (i=0;1==1;i++)
    {
        if (document.getElementById("chklstAudience_" + i) == null)
        {
            break;
        }
        else
        {
            if (document.getElementById("chklstAudience_" + i).checked == false)
            {
                document.ShowReadyReckoner.chkSelectAllAudience.checked = false;
                break;
            }
        }
    }
}

function chkCategories()
{
    for (i=0;1==1;i++)
    {
        if (document.getElementById("chkLstHospitality_" + i) == null)
        {
            break;
        }
        else
        {
           if (document.ShowReadyReckoner.chkSelectAllCategories.checked == true)
           {
                document.getElementById("chkLstHospitality_" + i).checked = true;
                document.ShowReadyReckoner.chkHospitality.checked = true;
           }
           else
           {
                document.getElementById("chkLstHospitality_" + i).checked = false;
                document.ShowReadyReckoner.chkHospitality.checked = false;
           }
        }
    }
    ///////////////////////// By Chirnjeev Singh on 19/aug/2009 ...............................
    for (i=0;1==1;i++)
    {
        if (document.getElementById("ChkListEducational_" + i) == null)
        {
            break;
        }
        else
        {
           if (document.ShowReadyReckoner.chkSelectAllCategories.checked == true)
           {
                document.getElementById("ChkListEducational_" + i).checked = true;
                document.ShowReadyReckoner.ChkEducational.checked = true;
           }
           else
           {
                document.getElementById("ChkListEducational_" + i).checked = false;
                document.ShowReadyReckoner.ChkEducational.checked = false;
           }
        }
    }


    for (i=0;1==1;i++)
    {
        if (document.getElementById("chkLstCorporate_" + i) == null)
        {
            break;
        }
        else
        {
           if (document.ShowReadyReckoner.chkSelectAllCategories.checked == true)
           {
                document.getElementById("chkLstCorporate_" + i).checked = true;
                document.ShowReadyReckoner.chkCorporate.checked = true;
           }
           else
           {
                document.getElementById("chkLstCorporate_" + i).checked = false;
                document.ShowReadyReckoner.chkCorporate.checked = false;
           }
        }
    }
    
    for (i=0;1==1;i++)
    {
        if (document.getElementById("chkLstPersonalCare_" + i) == null)
        {
            break;
        }
        else
        {
           if (document.ShowReadyReckoner.chkSelectAllCategories.checked == true)
           {
                document.getElementById("chkLstPersonalCare_" + i).checked = true;
                document.ShowReadyReckoner.chkPersonalCare.checked = true;
           }
           else
           {
                document.getElementById("chkLstPersonalCare_" + i).checked = false;
                document.ShowReadyReckoner.chkPersonalCare.checked = false;
           }
        }
    }
    
    for (i=0;1==1;i++)
    {
        if (document.getElementById("chkLstHealthCare_" + i) == null)
        {
            break;
        }
        else
        {
           if (document.ShowReadyReckoner.chkSelectAllCategories.checked == true)
           {
                document.getElementById("chkLstHealthCare_" + i).checked = true;
                document.ShowReadyReckoner.chkHealthCare.checked = true;
           }
           else
           {
                document.getElementById("chkLstHealthCare_" + i).checked = false;
                document.ShowReadyReckoner.chkHealthCare.checked = false;
           }
        }
    }

    for (i=0;1==1;i++)
    {
        if (document.getElementById("chkLstRetail_" + i) == null)
        {
            break;
        }
        else
        {
           if (document.ShowReadyReckoner.chkSelectAllCategories.checked == true)
           {
                document.getElementById("chkLstRetail_" + i).checked = true;
                document.ShowReadyReckoner.chkRetail.checked = true;
           }
           else
           {
                document.getElementById("chkLstRetail_" + i).checked = false;
                document.ShowReadyReckoner.chkRetail.checked = false;
           }
        }
    }
}


function CheckHopitality()
{
     for (i=0;1==1;i++)
    {
        if (document.getElementById("chkLstHospitality_" + i) == null)
        {
            break;
        }
        else
        {
           if (document.ShowReadyReckoner.chkHospitality.checked == true)
           {
                document.getElementById("chkLstHospitality_" + i).checked = true;
           }
           else
           {
                document.getElementById("chkLstHospitality_" + i).checked = false;
                document.ShowReadyReckoner.chkSelectAllCategories.checked = false;
           }
        }
    }
}
 ///////////////////////// By Chirnjeev Singh on 19/aug/2009 ...............................
function CheckEducational()
{
     for (i=0;1==1;i++)
    {
        if (document.getElementById("ChkListEducational_" + i) == null)
        {
            break;
        }
        else
        {
           if (document.ShowReadyReckoner.ChkEducational.checked == true)
           {
                document.getElementById("ChkListEducational_" + i).checked = true;
           }
           else
           {
                document.getElementById("ChkListEducational_" + i).checked = false;
                document.ShowReadyReckoner.chkSelectAllCategories.checked = false;
           }
        }
    }
}
 ///////////////////////// By Chirnjeev Singh on 19/aug/2009 ...............................
function DeselectEducational()
{
    for (i=0;1==1;i++)
    {
        if (document.getElementById("ChkListEducational_" + i) == null)
        {
            break;
        }
        else
        {
            if (document.getElementById("ChkListEducational_" + i).checked == false)
            {
                document.ShowReadyReckoner.ChkEducational.checked = false;
                document.ShowReadyReckoner.chkSelectAllCategories.checked = false;
                break;
            }
        }
    }
}

function DeselectHospitality()
{
    for (i=0;1==1;i++)
    {
        if (document.getElementById("chkLstHospitality_" + i) == null)
        {
            break;
        }
        else
        {
            if (document.getElementById("chkLstHospitality_" + i).checked == false)
            {
                document.ShowReadyReckoner.chkHospitality.checked = false;
                document.ShowReadyReckoner.chkSelectAllCategories.checked = false;
                break;
            }
        }
    }
}

function CheckCorporate()
{
     for (i=0;1==1;i++)
    {
        if (document.getElementById("chkLstCorporate_" + i) == null)
        {
            break;
        }
        else
        {
           if (document.ShowReadyReckoner.chkCorporate.checked == true)
           {
                document.getElementById("chkLstCorporate_" + i).checked = true;
           }
           else
           {
                document.getElementById("chkLstCorporate_" + i).checked = false;
                document.ShowReadyReckoner.chkSelectAllCategories.checked = false;
           }
        }
    }
}

function DeselectCorporate()
{
    for (i=0;1==1;i++)
    {
        if (document.getElementById("chkLstCorporate_" + i) == null)
        {
            break;
        }
        else
        {
            if (document.getElementById("chkLstCorporate_" + i).checked == false)
            {
                document.ShowReadyReckoner.chkCorporate.checked = false;
                document.ShowReadyReckoner.chkSelectAllCategories.checked = false;
                break;
            }
        }
    }
}


function CheckPersonalCare()
{
     for (i=0;1==1;i++)
    {
        if (document.getElementById("chkLstPersonalCare_" + i) == null)
        {
            break;
        }
        else
        {
           if (document.ShowReadyReckoner.chkPersonalCare.checked == true)
           {
                document.getElementById("chkLstPersonalCare_" + i).checked = true;
           }
           else
           {
                document.getElementById("chkLstPersonalCare_" + i).checked = false;
                document.ShowReadyReckoner.chkSelectAllCategories.checked = false;
           }
        }
    }
}

function DeselectPersonalCare()
{
    for (i=0;1==1;i++)
    {
        if (document.getElementById("chkLstPersonalCare_" + i) == null)
        {
            break;
        }
        else
        {
            if (document.getElementById("chkLstPersonalCare_" + i).checked == false)
            {
                document.ShowReadyReckoner.chkPersonalCare.checked = false;
                document.ShowReadyReckoner.chkSelectAllCategories.checked = false;
                break;
            }
        }
    }
}

function CheckHealthCare()
{
     for (i=0;1==1;i++)
    {
        if (document.getElementById("chkLstHealthCare_" + i) == null)
        {
            break;
        }
        else
        {
           if (document.ShowReadyReckoner.chkHealthCare.checked == true)
           {
                document.getElementById("chkLstHealthCare_" + i).checked = true;
           }
           else
           {
                document.getElementById("chkLstHealthCare_" + i).checked = false;
                document.ShowReadyReckoner.chkSelectAllCategories.checked = false;
           }
        }
    }
}

function DeselectHealthCare()
{
    for (i=0;1==1;i++)
    {
        if (document.getElementById("chkLstHealthCare_" + i) == null)
        {
            break;
        }
        else
        {
            if (document.getElementById("chkLstHealthCare_" + i).checked == false)
            {
                document.ShowReadyReckoner.chkHealthCare.checked = false;
                document.ShowReadyReckoner.chkSelectAllCategories.checked = false;
                break;
            }
        }
    }
}


function CheckRetail()
{
     for (i=0;1==1;i++)
    {
        if (document.getElementById("chkLstRetail_" + i) == null)
        {
            break;
        }
        else
        {
           if (document.ShowReadyReckoner.chkRetail.checked == true)
           {
                document.getElementById("chkLstRetail_" + i).checked = true;
           }
           else
           {
                document.getElementById("chkLstRetail_" + i).checked = false;
                document.ShowReadyReckoner.chkSelectAllCategories.checked = false;
           }
        }
    }
}

function DeselectRetail()
{
    for (i=0;1==1;i++)
    {
        if (document.getElementById("chkLstRetail_" + i) == null)
        {
            break;
        }
        else
        {
            if (document.getElementById("chkLstRetail_" + i).checked == false)
            {
                document.ShowReadyReckoner.chkRetail.checked = false;
                document.ShowReadyReckoner.chkSelectAllCategories.checked = false;
                break;
            }
        }
    }
}


function chkRegion()
{
    if (document.ShowReadyReckoner.chkSelectAllRegion.checked == true)
    {
        document.ShowReadyReckoner.chkNorth.checked = true;
        document.ShowReadyReckoner.chkWest.checked = true;
        document.ShowReadyReckoner.chkSouth.checked = true;
        document.ShowReadyReckoner.chkEast.checked = true;
    }
    else
    {
        document.ShowReadyReckoner.chkNorth.checked = false;
        document.ShowReadyReckoner.chkWest.checked = false;
        document.ShowReadyReckoner.chkSouth.checked = false;
        document.ShowReadyReckoner.chkEast.checked = false;
    }

    CheckNorth();
    CheckWest();
    CheckSouth();
    CheckEast();
    
//////////    for (i=0;1==1;i++)
//////////    {
//////////        if (document.getElementById("chkLstEast_" + i) == null)
//////////        {
//////////            //alert("chklstAudience_" + i + " Not Found");
//////////            break;
//////////        }
//////////        else
//////////        {
//////////           if (document.ShowReadyReckoner.chkSelectAllRegion.checked == true)
//////////           {
//////////                document.getElementById("chkLstEast_" + i).checked = true;
//////////                document.ShowReadyReckoner.chkEast.checked = true;
//////////           }
//////////           else
//////////           {
//////////                document.getElementById("chkLstEast_" + i).checked = false;
//////////                document.ShowReadyReckoner.chkEast.checked = false;
//////////           }
//////////        }
//////////    }
}

function CheckNorth()
{
     for (i=2;1==1;i++)
    {
        if (document.getElementById("dgNorth_ctl0" + i + "_chkLstNorth") == null)
        {
            break;
        }
        else
        {
           if (document.ShowReadyReckoner.chkNorth.checked == true)
           {
                document.getElementById("dgNorth_ctl0" + i + "_chkLstNorth").checked = true;
                for (j=0;1==1;j++)
                {
                    if (document.getElementById("dgNorth_ctl0" + i + "_chkLstNorthCity_" + j) == null)
                    {
                        break;
                    }
                    else
                    {
                        document.getElementById("dgNorth_ctl0" + i + "_chkLstNorthCity_" + j).checked = true;
                    }
                }
           }
           else
           {
                document.getElementById("dgNorth_ctl0" + i + "_chkLstNorth").checked = false;
                document.ShowReadyReckoner.chkSelectAllRegion.checked = false;
                for (j=0;1==1;j++)
                {
                    if (document.getElementById("dgNorth_ctl0" + i + "_chkLstNorthCity_" + j) == null)
                    {
                        break;
                    }
                    else
                    {
                        document.getElementById("dgNorth_ctl0" + i + "_chkLstNorthCity_" + j).checked = false;
                    }
                }
           }
        }
    }
}

function SelectNorthCity(NorthCityCtr)
{
    
    for (j=0;1==1;j++)
    {
        if (document.getElementById("dgNorth_ctl0" + NorthCityCtr + "_chkLstNorthCity_" + j) == null)
        {
            break;
        }
        else
        {
            if (document.getElementById("dgNorth_ctl0" + NorthCityCtr + "_chkLstNorth").checked == true)
            {
                document.getElementById("dgNorth_ctl0" + NorthCityCtr + "_chkLstNorthCity_" + j).checked = true;
            }
            else
            {
                document.getElementById("dgNorth_ctl0" + NorthCityCtr + "_chkLstNorthCity_" + j).checked = false;
                document.ShowReadyReckoner.chkNorth.checked = false;
                document.ShowReadyReckoner.chkSelectAllRegion.checked = false;
            }
        }
    }
}


function DeSelectNorthCity(NorthCityCtr)
{
    document.getElementById("dgNorth_ctl0" + NorthCityCtr + "_chkLstNorth").checked = false;
    document.ShowReadyReckoner.chkNorth.checked = false;
    document.ShowReadyReckoner.chkSelectAllRegion.checked = false;
}



function CheckWest()
{
     for (i=2;1==1;i++)
    {
        if (document.getElementById("dgWest_ctl0" + i + "_chkLstWest") == null)
        {
            break;
        }
        else
        {
           if (document.ShowReadyReckoner.chkWest.checked == true)
           {
                document.getElementById("dgWest_ctl0" + i + "_chkLstWest").checked = true;
                for (j=0;1==1;j++)
                {
                    if (document.getElementById("dgWest_ctl0" + i + "_chkLstWestCity_" + j) == null)
                    {
                        break;
                    }
                    else
                    {
                        document.getElementById("dgWest_ctl0" + i + "_chkLstWestCity_" + j).checked = true;
                    }
                }
           }
           else
           {
                document.getElementById("dgWest_ctl0" + i + "_chkLstWest").checked = false;
                document.ShowReadyReckoner.chkSelectAllRegion.checked = false;
                for (j=0;1==1;j++)
                {
                    if (document.getElementById("dgWest_ctl0" + i + "_chkLstWestCity_" + j) == null)
                    {
                        break;
                    }
                    else
                    {
                        document.getElementById("dgWest_ctl0" + i + "_chkLstWestCity_" + j).checked = false;
                    }
                }
           }
        }
    }
}

function SelectWestCity(WestCityCtr)
{
    
    for (j=0;1==1;j++)
    {
        if (document.getElementById("dgWest_ctl0" + WestCityCtr + "_chkLstWestCity_" + j) == null)
        {
            break;
        }
        else
        {
            if (document.getElementById("dgWest_ctl0" + WestCityCtr + "_chkLstWest").checked == true)
            {
                document.getElementById("dgWest_ctl0" + WestCityCtr + "_chkLstWestCity_" + j).checked = true;
            }
            else
            {
                document.getElementById("dgWest_ctl0" + WestCityCtr + "_chkLstWestCity_" + j).checked = false;
                document.ShowReadyReckoner.chkWest.checked = false;
                document.ShowReadyReckoner.chkSelectAllRegion.checked = false;
            }
        }
    }
}


function DeSelectWestCity(WestCityCtr)
{
    document.getElementById("dgWest_ctl0" + WestCityCtr + "_chkLstWest").checked = false;
    document.ShowReadyReckoner.chkWest.checked = false;
    document.ShowReadyReckoner.chkSelectAllRegion.checked = false;
}




function CheckSouth()
{
     for (i=2;1==1;i++)
    {
        if (document.getElementById("dgSouth_ctl0" + i + "_chkLstSouth") == null)
        {
            break;
        }
        else
        {
           if (document.ShowReadyReckoner.chkSouth.checked == true)
           {
                document.getElementById("dgSouth_ctl0" + i + "_chkLstSouth").checked = true;
                for (j=0;1==1;j++)
                {
                    if (document.getElementById("dgSouth_ctl0" + i + "_chkLstSouthCity_" + j) == null)
                    {
                        break;
                    }
                    else
                    {
                        document.getElementById("dgSouth_ctl0" + i + "_chkLstSouthCity_" + j).checked = true;
                    }
                }
           }
           else
           {
                document.getElementById("dgSouth_ctl0" + i + "_chkLstSouth").checked = false;
                document.ShowReadyReckoner.chkSelectAllRegion.checked = false;
                for (j=0;1==1;j++)
                {
                    if (document.getElementById("dgSouth_ctl0" + i + "_chkLstSouthCity_" + j) == null)
                    {
                        break;
                    }
                    else
                    {
                        document.getElementById("dgSouth_ctl0" + i + "_chkLstSouthCity_" + j).checked = false;
                    }
                }
           }
        }
    }
}

function SelectSouthCity(SouthCityCtr)
{
    
    for (j=0;1==1;j++)
    {
        if (document.getElementById("dgSouth_ctl0" + SouthCityCtr + "_chkLstSouthCity_" + j) == null)
        {
            break;
        }
        else
        {
            if (document.getElementById("dgSouth_ctl0" + SouthCityCtr + "_chkLstSouth").checked == true)
            {
                document.getElementById("dgSouth_ctl0" + SouthCityCtr + "_chkLstSouthCity_" + j).checked = true;
            }
            else
            {
                document.getElementById("dgSouth_ctl0" + SouthCityCtr + "_chkLstSouthCity_" + j).checked = false;
                document.ShowReadyReckoner.chkSouth.checked = false;
                document.ShowReadyReckoner.chkSelectAllRegion.checked = false;
            }
        }
    }
}


function DeSelectSouthCity(SouthCityCtr)
{
    document.getElementById("dgSouth_ctl0" + SouthCityCtr + "_chkLstSouth").checked = false;
    document.ShowReadyReckoner.chkSouth.checked = false;
    document.ShowReadyReckoner.chkSelectAllRegion.checked = false;
}



// -Start of CheckEast Authored by Teja

function CheckEast()
{
     for (i=2;1==1;i++)
    {
        if (document.getElementById("dgEast_ctl0" + i + "_chkLstEast") == null)
        {
            break;
        }
        else
        {
           if (document.ShowReadyReckoner.chkEast.checked == true)
           {
                document.getElementById("dgEast_ctl0" + i + "_chkLstEast").checked = true;
                for (j=0;1==1;j++)
                {
                    if (document.getElementById("dgEast_ctl0" + i + "_chkLstEastCity_" + j) == null)
                    {
                        break;
                    }
                    else
                    {
                        document.getElementById("dgEast_ctl0" + i + "_chkLstEastCity_" + j).checked = true;
                    }
                }
           }
           else
           {
                document.getElementById("dgEast_ctl0" + i + "_chkLstEast").checked = false;
                document.ShowReadyReckoner.chkSelectAllRegion.checked = false;
                for (j=0;1==1;j++)
                {
                    if (document.getElementById("dgEast_ctl0" + i + "_chkLstEastCity_" + j) == null)
                    {
                        break;
                    }
                    else
                    {
                        document.getElementById("dgEast_ctl0" + i + "_chkLstEastCity_" + j).checked = false;
                    }
                }
           }
        }
    }
}

function SelectEastCity(EastCityCtr)
{
    
    for (j=0;1==1;j++)
    {
        if (document.getElementById("dgEast_ctl0" + EastCityCtr + "_chkLstEastCity_" + j) == null)
        {
            break;
        }
        else
        {
            if (document.getElementById("dgEast_ctl0" + EastCityCtr + "_chkLstEast").checked == true)
            {
                document.getElementById("dgEast_ctl0" + EastCityCtr + "_chkLstEastCity_" + j).checked = true;
            }
            else
            {
                document.getElementById("dgEast_ctl0" + EastCityCtr + "_chkLstEastCity_" + j).checked = false;
                document.ShowReadyReckoner.chkEast.checked = false;
                document.ShowReadyReckoner.chkSelectAllRegion.checked = false;
            }
        }
    }
}


function DeSelectEastCity(EastCityCtr)
{
    document.getElementById("dgEast_ctl0" + EastCityCtr + "_chkLstEast").checked = false;
    document.ShowReadyReckoner.chkEast.checked = false;
    document.ShowReadyReckoner.chkSelectAllRegion.checked = false;
}




// -End of CheckEast - Authored Teja















//function CheckEast()
//{
//     for (i=0;1==1;i++)
//    {
//        if (document.getElementById("chkLstEast_" + i) == null)
//        {
//            break;
//        }
//        else
//        {
//           if (document.ShowReadyReckoner.chkEast.checked == true)
//           {
//                document.getElementById("chkLstEast_" + i).checked = true;
//           }
//           else
//           {
//                document.getElementById("chkLstEast_" + i).checked = false;
//                document.ShowReadyReckoner.chkSelectAllRegion.checked = false;
//           }
//        }
//    }
//    
//    
//    for (i=0;1==1;i++)
//    {
//        if (document.getElementById("chkLstEastOther_" + i) == null)
//        {
//            break;
//        }
//        else
//        {
//           if (document.ShowReadyReckoner.chkEast.checked == true)
//           {
//                document.getElementById("chkLstEastOther_" + i).checked = true;
//           }
//           else
//           {
//                document.getElementById("chkLstEastOther_" + i).checked = false;
//                document.ShowReadyReckoner.chkSelectAllRegion.checked = false;
//           }
//        }
//    }
//}

//function DeselectEast()
//{
//    for (i=0;1==1;i++)
//    {
//        if (document.getElementById("chkLstEast_" + i) == null)
//        {
//            //alert("chklstAudience_" + i + " Not Found");
//            break;
//        }
//        else
//        {
//            if (document.getElementById("chkLstEast_" + i).checked == false)
//            {
//                document.ShowReadyReckoner.chkEast.checked = false;
//                document.ShowReadyReckoner.chkSelectAllRegion.checked = false;
//                break;
//            }
//        }
//    }
//    
//    for (i=0;1==1;i++)
//    {
//        if (document.getElementById("chkLstEastOther_" + i) == null)
//        {
//            //alert("chklstAudience_" + i + " Not Found");
//            break;
//        }
//        else
//        {
//            if (document.getElementById("chkLstEastOther_" + i).checked == false)
//            {
//                document.ShowReadyReckoner.chkEast.checked = false;
//                document.ShowReadyReckoner.chkSelectAllRegion.checked = false;
//                break;
//            }
//        }
//    }
//}

function chkSelectAge()
{
    if (document.ShowReadyReckoner.chkSelectAllAge.checked == true)
    {
        document.ShowReadyReckoner.chkAgeBelow18.checked = true;
        document.ShowReadyReckoner.chkAge1930.checked = true;
        document.ShowReadyReckoner.chkAge3140.checked = true;
        document.ShowReadyReckoner.chkAgeAbove40.checked = true;
    }
    else
    {
        document.ShowReadyReckoner.chkAgeBelow18.checked = false;
        document.ShowReadyReckoner.chkAge1930.checked = false;
        document.ShowReadyReckoner.chkAge3140.checked = false;
        document.ShowReadyReckoner.chkAgeAbove40.checked = false;
    }
}

function DeselectAge()
{
    if (document.ShowReadyReckoner.chkAgeBelow18.checked == false || document.ShowReadyReckoner.chkAge1930.checked == false || 
            document.ShowReadyReckoner.chkAge3140.checked == false || document.ShowReadyReckoner.chkAgeAbove40.checked == false)
        document.ShowReadyReckoner.chkSelectAllAge.checked = false;
}

function chkSelectProfile()
{
    if (document.ShowReadyReckoner.chkSelectAllProfile.checked == true)
    {
        document.ShowReadyReckoner.chkProfileSecA.checked = true;
        document.ShowReadyReckoner.chkProfileSecB.checked = true;
        document.ShowReadyReckoner.chkProfileSecC.checked = true;
    }
    else
    {
        document.ShowReadyReckoner.chkProfileSecA.checked = false;
        document.ShowReadyReckoner.chkProfileSecB.checked = false;
        document.ShowReadyReckoner.chkProfileSecC.checked = false;
    }
}

function DeselectProfile()
{
    if (document.ShowReadyReckoner.chkProfileSecA.checked == false || document.ShowReadyReckoner.chkProfileSecB.checked == false || 
            document.ShowReadyReckoner.chkProfileSecC.checked == false)
        document.ShowReadyReckoner.chkSelectAllProfile.checked = false;
}

function ValidateCost()
{
    if (!ForceDataEntry(document.ShowReadyReckoner.txtTotalCostPerDay,'Total Cost Per Day')) return false;
	if (!ForceNumericEntry(document.ShowReadyReckoner.txtTotalCostPerDay,'Total Cost Per Day')) return false;	

    if (!ForceDataEntry(document.ShowReadyReckoner.txtDiscount1,'Discount %')) return false;
	if (!ForceNumericEntry(document.ShowReadyReckoner.txtDiscount1,'Discount %')) return false;	

    if (!ForceDataEntry(document.ShowReadyReckoner.txtMinimumWeeks,'Minimum Week of Compaign')) return false;
	if (!ForceNumericEntry(document.ShowReadyReckoner.txtMinimumWeeks,'Minimum Week of Compaign')) return false;	

    if (!ForceDataEntry(document.ShowReadyReckoner.txtCompaignDiscount,'Discount % for Compaign')) return false;
	if (!ForceNumericEntry(document.ShowReadyReckoner.txtCompaignDiscount,'Discount % for Compaign')) return false;	

    if (!ForceDataEntry(document.ShowReadyReckoner.txtCompaignDiscount,'Discount % for Compaign')) return false;
	if (!ForceNumericEntry(document.ShowReadyReckoner.txtCompaignDiscount,'Discount % for Compaign')) return false;	
}
