﻿//*************************************** Commen Functions START *******************************************
// Function to convert first character into Upper Case
    // Added by Damanpreet as on 10-Dec-2007
    function firstupper(obj)
    {
		try
		{
			var txt=obj.value;
			var str1=txt.substring(0, 1);
			str1=str1.toUpperCase();
			var str2=txt.substring(1, txt.length);
			obj.value=str1+str2;
		}
		catch(ex)
		{

		}
    }
    //End of convert Function
//End of convert Function
//Function created by Damanpreet on 1st July 2008
//This is called on SessionExpired.aspx
function GiveSpace()  
{
    try
    {
        HandleAppPageControlsResize('UpperSpace',470,'',470,'',460,'',470,'',470,'');
        HandleAppPageControlsResize('LowerSpace',390,'',280,'',280,'',400,'',400,'');
    }
    catch(err)
    {
        
    }
}
//Not in use
    //This is a dynamic resizable iframe script... It resizes the iframe every time a new link within that iframe
    //is clicked
    //This function is created by Damanpreet Kaur
    //Called from :-- EngagementHelthcare\BpMenuControls.aspx.cs OnLoad event ,EngagementHealth\Default.aspx.cs OnLoad event
    //Ref :--Build # 23.<AceDesc>Task #239 Create Broker's Portal Informational Website.
    function SetIFrameHeightOnRunTime(iFRame) 
    {
        var iframeElement = null;
        var intHeight;
        iframeElement = document.getElementById(iFRame); 
        if(document.all) 
         {
        SetControlHeight(iframeElement,0);
        } 
        try
        {
            if(document.all) 
            {
               intHeight = document.frames(iFRame).document.body.scrollHeight; 
            }
            else
            {  
               intHeight= iframeElement.contentDocument.body.clientHeight; 
            }
            SetControlHeight(iframeElement,intHeight);            
        }
        catch(ex)
        {
            alert('SetIFrameHeightOnRunTime--'+ex);
        }
    }
    //Function written by Damanpreet on June 9 2008
//To redirct form contactus.aspx to default.aspx and set the src of IFrame
//Ref :--Build # 23.<AceDesc>Task #77  	Move engagementhealth.com to Rackspace.
    /*function RedirectToDefault(Page,SrcFrom)
    {    
        try
        {
            var _src=SrcFrom;    
            var _page = Page;            

            parent.location.href ='';     
            window.location = "Default.aspx?PageName="+_page+"&Src="+_src;  
            
            document.documentElement.scrollTop = 0;
        }
        catch(ex)
        {
        alert(ex);
        } 
    }*/
    //Function written by Damanpreet on June 10 2008
    //To redirect to contat us page on click of link in IFrame
    //Called From :--HTMLPages\aboutus.htm ,HTMLPages\sitemap.htm
    //Ref :--Build # 23.<AceDesc>Task #77  	Move engagementhealth.com to Rackspace.
    function RedirectToContactUs()
    {  
        try
        {     
         parent.location.href = "../contactus.aspx";
         }
         catch(ex)
         {
            alert('RedirectToContactUs--'+ex); 
         }
    }
//This function is created by Damanpreet on May 28 2008
//This will show and hide the div according to requirnment
//Called From :-- EngagementHelthcare\BpMenuControls.aspx 
//Ref :--Build # 23.<AceDesc>Task #239 Create Broker's Portal Informational Website. 
//Modified by :-- Damanpreet Kaur
//Modified on :-- 12 June 2008
//To have the dynamic Eh News on News and Events page
function ShowNewsText(HiddenFieldNewsId)
{           
    var _HiddenFieldNewsId = document.getElementById(HiddenFieldNewsId);  
    var _HiddenFieldNewsIdValue = _HiddenFieldNewsId.value     
    try
    {       
        document.documentElement.scrollTop = 0;
        window.location = "BpEhNewsText.aspx?NewsId="+_HiddenFieldNewsIdValue; 
    }
    catch(ex)
    {
        alert('ShowNewsText--'+ex);
    }
}
   /*THIS IS THE VALIDATION FOR THE LEAD FORM*/
//Ref :--Build # 23.<AceDesc>Task #77  	Move engagementhealth.com to Rackspace.
function ValidateForm(LabelMessage)
{
    try
    {
        var _LabelMessage = document.getElementById(LabelMessage);
        var _TextBoxName = document.getElementById('ContactUs1_TextBoxName');
        var _TextBoxCompany = document.getElementById('ContactUs1_TextBoxCompany');
        var _TextBoxEmail = document.getElementById('ContactUs1_TextBoxEmail');
        var _TextBoxComments = document.getElementById('ContactUs1_TextBoxComments');
        
        var _TextBoxJobTitle = document.getElementById('ContactUs1_TextBoxJobTitle');
        var _TextBoxAddress1 = document.getElementById('ContactUs1_TextBoxAddress1');
        var _TextBoxAddress2 = document.getElementById('ContactUs1_TextBoxAddress2');
        var _TextBoxCity = document.getElementById('ContactUs1_TextBoxCity');
        var _TextBoxState = document.getElementById('ContactUs1_TextBoxState');
        var _TextBoxCountry = document.getElementById('ContactUs1_TextBoxCountry');
        var _TextBoxHowDid = document.getElementById('ContactUs1_TextBoxHowDidYouHear');
        var _TextBoxFind = document.getElementById('ContactUs1_TextBoxDidYouFind');
        
        var _TextBoxZipCode = document.getElementById('ContactUs1_TextBoxZipCode');
        var _TextBoxPhone = document.getElementById('ContactUs1_TextBoxPhone');
        var _TextBoxFax = document.getElementById('ContactUs1_TextBoxFax');
        //var _TextBoxComments = document.getElementById('ContactUs1_TextBoxComments');


	//Modified By Jagdish on 21 Aug 2009 as per task # 6
        //Added radio button tag to validate redirection of page
        //----------------------------------------------------------------
        var _RadioButtonListUserChoices1 = document.getElementById('ContactUs1_RadioButtonListUserChoices_0');
        var _RadioButtonListUserChoices2 = document.getElementById('ContactUs1_RadioButtonListUserChoices_1');
        //----------------------------------------------------------------
        

        if(_LabelMessage !=null)
         {
        SetLabelValue(_LabelMessage,"",true);

         }

            if(_TextBoxName !=null)
          {

	    if (trim(_TextBoxName.value) =="")
	    {
	    SetLabelValue(_LabelMessage,"Please enter your Name.",true);	
	    _TextBoxName.focus();
	    document.documentElement.scrollTop = 0;
	    return false;
	    }
	    else if (trim(_TextBoxName.value) !="")
	    {            
            if (AllowSpecialCharacters(trim(_TextBoxName.value)) == false)
            {            
            SetLabelValue(_LabelMessage,"The username contains illegal characters.",true);	
            _TextBoxName.focus();
            document.documentElement.scrollTop = 0;
            return false; 
            }
            }
         }


               if(_TextBoxCompany !=null)
           {

	    if (trim(_TextBoxCompany.value) =="")
	    {
	    SetLabelValue(_LabelMessage,"Please enter your Company Name.",true);	
	    _TextBoxCompany.focus();
	    document.documentElement.scrollTop = 0;
	    return false;
	    }
	    else if (trim(_TextBoxCompany.value) !="")
	    {
            var ValidCompanyName = AllowSpecialCharacters(trim(_TextBoxCompany.value));
            if(ValidCompanyName==false)
            {           
                SetLabelValue(_LabelMessage,"Please enter valid Company Name.",true);	
                _TextBoxCompany.focus();
                document.documentElement.scrollTop = 0;
                return false;
            }
            else
            {
                var ValidCompanyName1 = FirstCharacterAlphabet(trim(_TextBoxCompany.value)); 
                if(ValidCompanyName1==false)
                {
                    SetLabelValue(_LabelMessage,"First character should be Alphabet in Company Name.",true);	
                    _TextBoxCompany.focus();
                    document.documentElement.scrollTop = 0;
                    return false;
                
                } 
            }
        } 

   }


            if(_TextBoxEmail !=null)
             {
      
	       if(!check_email(trim(_TextBoxEmail.value)))
	        {
	        SetLabelValue(_LabelMessage,"Please make sure your Email Address is Correct",true);	    
		    _TextBoxEmail.focus();
		    document.documentElement.scrollTop = 0;
		    return false;
     	        }	
             }


  
       if(_TextBoxJobTitle !=null)
         {

	    if(trim(_TextBoxJobTitle.value) != '')
	    {
	        if(isValidName(trim(_TextBoxJobTitle.value)))
	        {
                SetLabelValue(_LabelMessage,"Please make sure you entered Correct Job Title.",true);	    
                _TextBoxJobTitle.focus();
                document.documentElement.scrollTop = 0;
                return false;
	        }
	    }
        }


        if(_TextBoxAddress1 !=null)
          {

	    if(trim(_TextBoxAddress1.value) != '')
	    {
	        if(isValidName(trim(_TextBoxAddress1.value)))
	        {
                SetLabelValue(_LabelMessage,"Please make sure you entered Correct Address.",true);	    
                _TextBoxAddress1.focus();
                document.documentElement.scrollTop = 0;
                return false;
	        }
 	    }  
         }


          if(_TextBoxAddress2 !=null)
          {

	    if(trim(_TextBoxAddress2.value) != '')
	     {
	        if(isValidName(trim(_TextBoxAddress2.value)))
	        {
                SetLabelValue(_LabelMessage,"Please make sure you entered Correct Address.",true);	    
                _TextBoxAddress2.focus();
                document.documentElement.scrollTop = 0;
                return false;
	        }
	     }
          }
           

    
             if(_TextBoxCity !=null)
          {
  
	    if(trim(_TextBoxCity.value) != '')
	     {
	        if(isValidName(trim(_TextBoxCity.value)))
	        {
                SetLabelValue(_LabelMessage,"Please make sure you entered Correct City.",true);	    
                _TextBoxCity.focus();
                document.documentElement.scrollTop = 0;
                return false;
	        }
	     }
          }

               
             if(_TextBoxState !=null)
           {
              
	    if(trim(_TextBoxState.value) != '')
	    {
	        if(isValidName(trim(_TextBoxState.value)))
	        {
                SetLabelValue(_LabelMessage,"Please make sure you entered Correct State.",true);	    
                _TextBoxState.focus();
                document.documentElement.scrollTop = 0;
                return false;
	        }
	    } 
          } 


         if(_TextBoxZipCode !=null)

         {       
	    if(trim(_TextBoxZipCode.value) != '')
	    {
	        if(!validateUSZip(trim(_TextBoxZipCode.value)))
	        {
                SetLabelValue(_LabelMessage,"Please make sure you entered Correct Zipcode.",true);	    
                _TextBoxZipCode.focus();
                document.documentElement.scrollTop = 0;
                return false;
	        }
	    }
         }

            
         if(_TextBoxCountry !=null)

         {      
	    if(trim(_TextBoxCountry.value) != '')
	    {
	        if(isValidName(trim(_TextBoxCountry.value)))
	        {
                SetLabelValue(_LabelMessage,"Please make sure you entered Correct Country.",true);	    
                _TextBoxCountry.focus();
                document.documentElement.scrollTop = 0;
                return false;
	        }
	    }

	}

             
         if(_TextBoxPhone !=null)

         {
	    if(trim(_TextBoxPhone.value) != '')
	    {
	        if(PhoneFormatCheckWithExt('ContactUs1_TextBoxPhone'))
	        {
                SetLabelValue(_LabelMessage,"Please make sure your Phone number is Correct.",true);	    
                _TextBoxPhone.focus();
                document.documentElement.scrollTop = 0;
                return false;
	        }
	    }
         }

                 
         if(_TextBoxFax!=null)

         {
	    if(trim(_TextBoxFax.value) != '')
	    {
	        if(PhoneFormatCheckWithExt('ContactUs1_TextBoxFax'))
	        {
                SetLabelValue(_LabelMessage,"Please make sure your Fax number is Correct.",true);	    
                _TextBoxFax.focus();
                document.documentElement.scrollTop = 0;
                return false;
	        }
	    }
	}

              if(_TextBoxHowDid !=null)

         {
	    if(trim(_TextBoxHowDid.value) != '')
	    {
	        if(AllowNumericAndAlphabets(trim(_TextBoxHowDid.value)))
	        {
                SetLabelValue(_LabelMessage,"How did you find... contains invalid characters.",true);	    
                _TextBoxHowDid.focus();
                document.documentElement.scrollTop = 0;
                return false;
	        }
	    }
	}


       if(_TextBoxFind!=null)

         {

	    if(trim(_TextBoxFind.value) != '')
	    {
	        if(AllowNumericAndAlphabets(trim(_TextBoxFind.value)))
	        {
                SetLabelValue(_LabelMessage,"Find the information... -contains invalid characters.",true);	    
                _TextBoxFind.focus();
                document.documentElement.scrollTop = 0;
                return false;
	        }
	    }
	}


	//Modified By Jagdish on 21 Aug 2009 as per task # 6
        //Added radio button tag to validate redirection of page
        //----------------------------------------------------------------
        if(_RadioButtonListUserChoices1 != null && _RadioButtonListUserChoices2 != null)
	    {
	        if(_RadioButtonListUserChoices1.checked == false && _RadioButtonListUserChoices2.checked == false) 
	        {
	            SetLabelValue(_LabelMessage,"Please choose your choice.",true);	    
                _RadioButtonListUserChoices1.focus();
                document.documentElement.scrollTop = 0;
                return false;
            }   
	    }
        //----------------------------------------------------------------


	      if(_TextBoxComments !=null)

         { 

          if (trim(_TextBoxComments.value) =="")
	    {
	    SetLabelValue(_LabelMessage,"Please let us know why you would like for us to contact you.",true);	
	    _TextBoxComments.focus();
	    document.documentElement.scrollTop = 0;
	    return false;
	    }
//	    else if (trim(_TextBoxComments.value) !="")
//	    {            
//            if (!AllowValidChars(trim(_TextBoxComments.value)))
//            {            
//            SetLabelValue(_LabelMessage,"Comments contains illegal characters.",true);	
//            _TextBoxName.focus();
//            document.documentElement.scrollTop = 0;
//            return false; 
//            }
//        }
      }
	    return true;
	}
	catch(ex)
	{	   
	    alert('ValidateForm--'+ex);
	     return false;
	}
}   
function check_email(e) {
	ok = "1234567890qwertyuiop[]asdfghjklzxcvbnm.@-_QWERTYUIOPASDFGHJKLZXCVBNM";
	for(i=0; i < e.length ;i++){
		if(ok.indexOf(e.charAt(i))<0) return (false);	
	}
	if (document.images) {
		re = /(@.*@)|(\.\.)|(^\.)|(^@)|(@$)|(\.$)|(@\.)/;
		re_two = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
		if (!e.match(re) && e.match(re_two)) return (-1);
	}
}
function isEmailAddress (string) {
  var addressPattern = /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/;
  return addressPattern.test(string);
}
function validateUSZip(strValue) {
	var objRegExp  = /(^(?!0{5})(\d{5})(?!-?0{4})(-?\d{4})?$)/;
	
	return objRegExp.test(strValue);
}
// allow only letters, numbers, and underscores
function isValidName (string) {
  var NamePattern = /\W/;
  return NamePattern.test(string);
}
// allow only letters and numbers
function isValidPassword (string) {
  var PasswordPattern = /[\W_]/;
  return PasswordPattern.test(string);
}

function isValidPhone(strng) {
var stripped = strng.replace(/[\(\)\.\-\ ]/g, '');
//strip out acceptable non-numeric characters
return isNaN(parseInt(stripped))
}
  //This function is created by Damanpreet Kaur
  //This fuction is used to validate the Login.ascx control
  //Ref :--Build # 23.<AceDesc>Task #239 Create Broker's Portal Informational Website.  
     function ValidateBpUser(username, userPassword, errorLabel)
        {
        try
        {          
            var _ErrorLabel = document.getElementById(errorLabel); //document.getElementById('BpLoginControl1_LabelError');
            var TxtBoxUserName= document.getElementById(username);
             var TxtBoxPswrd = document.getElementById(userPassword);
             
            SetLabelValue(_ErrorLabel,"",true);
            if(trim(TxtBoxUserName.value) == "")
            {   
                SetLabelValue(_ErrorLabel,"Enter User ID",true);                
                TxtBoxUserName.focus();
                return false;
            }
            else if (trim(TxtBoxUserName.value) !="")
            {
                
                // allow only letters, numbers, and underscores
                if (isValidName(trim(TxtBoxUserName.value)))
                {
                //error = "The username contains illegal characters.\n";
                SetLabelValue(_ErrorLabel,"Invalid User ID",true);	
                TxtBoxUserName.focus();
                document.documentElement.scrollTop = 0;
                return false; 
                }
            }
            if(trim(TxtBoxPswrd.value) == "")
            {
                SetLabelValue(_ErrorLabel,"Enter Password",true);  
                TxtBoxPswrd.focus();
                return false;
            }
           else if (trim(TxtBoxPswrd.value) !="")
            {                
                if ((TxtBoxPswrd.value.length < 5) || (TxtBoxPswrd.value.length > 14)) {
                SetLabelValue(_ErrorLabel,"Invalid Password",true);  
                TxtBoxPswrd.focus();
                return false;
                }                
                else if (isValidPassword(trim(TxtBoxPswrd.value)))
                {                
                SetLabelValue(_ErrorLabel,"Invalid Password",true);	
                TxtBoxPswrd.focus();
                document.documentElement.scrollTop = 0;
                return false; 
                }
            }
             if(TxtBoxUserName.value.indexOf('<')>=0)
             {
                 SetLabelValue(_ErrorLabel,"Invalid User ID",true); 
                 TxtBoxUserName.focus();
                return false;
             }
            
             if(TxtBoxUserName.value.indexOf('>')>=0)
             {
                SetLabelValue(_ErrorLabel,"Invalid User ID",true); 
                TxtBoxUserName.focus();
                return false;
             }
             
             if(TxtBoxPswrd.value.indexOf('<')>=0)
             {
                SetLabelValue(_ErrorLabel,"Invalid Password",true); 
                TxtBoxPswrd.focus();
                return false;
             }
              if(TxtBoxPswrd.value.indexOf('>')>=0)
             {
                SetLabelValue(_ErrorLabel,"Invalid Password",true); 
                TxtBoxPswrd.focus();
                return false;
             }            
             return true;
             
         }
         catch(ex)
         {
            alert('ValidateBpUser--'+ex);
            return false;
         }
        }
/*******************************************************************/
//Written by Damanpreet on May 09 2008 
//AscDesc :--Task #216 --Size of Pages are not consistent on higher resolution
//For resizing of BPForgetPassword.aspx
        function BP_setFrameSizeofForgetPassword()
        {    
            try
            {    
                HandleAppPageControlsResize('TDMainFrame',115,'',115,'',110,'',113,'',120,'');               
            }
            catch(ex)
            {                
            }      
        } 
  /*******************************************************************/
  
        // Function Created by Devinder on 11/2/07. it is used on BPApplication page
        // onresize
        function setFrameSize()
        {
          try
          {
          
                var AppMainTable=document.getElementById("AppMainTable");
                var MainFrame= document.getElementById("MainFrame");   //iframe  in AppMainTable table
               
                HandleAppPageControlsResize('AppMainTable',90,'',100,'',100,'',100,'','','');               
                HandleAppPageControlsResize('MainFrame',80,160,80,160,80,150,100,160,110,167);   
                
                if(window.frames[0] != null)
                {
                     
                    window.frames[0].BaseBodyLoad();
                }             
                
         }
         catch(ex)
         {          
         }
       }
           // Function Created by Devinder on 11/2/07. it is used on BPApplication page       
    function onLoadsetFrameSize()
    {
        try
        { 
            var MainFrame= document.getElementById("MainFrame"); //iframe  in AppMainTable table
            var AppMainTable=document.getElementById("AppMainTable");

            HandleAppPageControlsResize('AppMainTable',90,'',100,'',100,'',100,'','','');               
            HandleAppPageControlsResize('MainFrame',80,160,80,160,80,150,100,160,110,167);     
        }
        catch(ex) 
        {           
        }
    }  
         // Created by Devinder.  Called from BasePages\BrokerPortal.aspx
    function BaseBodyLoad()
    {
        try
        {
       
        //HandleBasePageControlsResize(ControlId,IE6Heigth,IE6Width,IE7Height,IE7Width,firefoxHeight,firefoxWidth,WinSafariHeight,WinSafariWidth,MacSafariHeight,MacSafariWidth)      


            HandleBasePageControlsResize('BPMainTable',90,'',100,160,130,'',120,'','',''); //iframe  in AppMainTable table
            //*********************Overview**************************************************/
            HandleBasePageControlsResize('DivBPOverview',170,'','','',130,'','','','','');   //IE6
            HandleBasePageControlsResize('DivNewsReleases',435,180,435,180,445,'',475,'',475,'');//IE6
            //*********************ProposalListing**************************************************/
            HandleBasePageControlsResize('DivProposalListingGrid',200,180,200,180,210,180,220,180,240,180);//IE6
            //*********************ContractsListing**************************************************/    
            HandleBasePageControlsResize('DivContractsListingGrid',200,180,200,180,210,180,220,180,240,180); //IE6
             //*********************Message Control **************************************************/            
            BP_setMessageControlHeight(); //IE6
             //*********************Alerts Control **************************************************/ 
            //BP_setAlertControlHeight(); //IE6
            HandleBasePageControlsResize('divAlertsControl',135,180,130,190,150,180,160,210,60,210); //IE6       
            HandleBasePageControlsResize('Alerts1_TextBoxMessage',455,'',460,'',460,'',480,'',392,''); //IE6
            //*********************My Account**************************************************/
            HandleBasePageControlsResize('DivBPMyAccount',135,180,140,'',160,180,160,180,'',180); //IE6
            //*********************FAQ**************************************************/      
            HandleBasePageControlsResize('DivFAQ',135,180,140,'',160,180,170,180,210,180); //IE6
            //*********************Instruction**************************************************/
            HandleBasePageControlsResize('DivInstruction',135,180,140,'',160,180,170,'',180,''); //IE6
            //*********************Commissions**************************************************/         
            HandleBasePageControlsResize('DivCommition',135,180,140,'',160,180,170,'',200,'');  //IE6           
            //*********************Overview**************************************************/
            HandleBasePageControlsResize('DivSalesCollateralListingGrid',200,180,200,180,210,180,180,180,240,180);//IE6
            //*********************Overview**************************************************/
            HandleBasePageControlsResize('DivNewBrokerRegistration',130,180,140,180,160,180,180,180,170,180);//IE6
            
             
                  
            //         ////////////////     PROPOSAL DETAIL     ///////////////////
            HandleBasePageControlsResize('DivProposalSumary',160,180,190,'',205,180,200,180,230,'');  //IE6    
            HandleBasePageControlsResize('BPProposalDetail1_TabContainerProposalDetail_TabPanel1_TrendSaving_TrSavings',160,180,190,180,200,180,200,180,'',200);  //IE6      
            HandleBasePageControlsResize('DivProductServices',160,180,190,180,205,180,200,180,'',200);     //IE6   
            HandleBasePageControlsResize('DivEHFee',160,180,190,180,205,180,220,200,'',200);       //IE6 
            HandleBasePageControlsResize('divAppendixA',190,185,190,200,205,180,200,190,'','');     //IE6   
            HandleBasePageControlsResize('divAppendixB',190,185,190,200,205,180,200,190,'','') ; //IE6 
            //         ////////////////     PROPOSAL DETAIL END /////////////////// 
                    
            /////////////////////////     STEPS              ////////////////////
            HandleBasePageControlsResize('DivStepOne',        160,180,160,'',     180,'',        200,180,    220,''); //IE6      
            HandleBasePageControlsResize('DivPlanInfoA',      180,180,155,180,    180,180,       200,180,   220,180); //IE6     
            HandleBasePageControlsResize('DivPlanInfoB',      180,180,155,'',     180,180,       200,180,   220,180); //IE6     
            HandleBasePageControlsResize('DivPlanNormaitive', 180,180,155,'',     180,180,       200,180,   220,180); //IE6     
            HandleBasePageControlsResize('DivPlanStepTwoA',   180,180,160,180,    180,180,       200,180,   220,'');  //IE6    
            HandleBasePageControlsResize('DivPlanStepTwoB',   180,180,155,'',     180,180,       200,180,   220,'');  //IE6    
            HandleBasePageControlsResize('DivPlanStepThree',  180,180,155,'',     180,180,       200,180,   220,'');  //IE6    
            HandleBasePageControlsResize('DivPlanThreeA',     160,180,155,180,    180,180,       200,180,   220,'');//IE6      
            HandleBasePageControlsResize('DivPlanStepFour',   180,180,155,'',     180,180,       200,180,   220,180); //IE6     
            HandleBasePageControlsResize('DivPlanStepFiveA',  180,180,155,'',     180,180,       200,180,   220,'');  //IE6    
            HandleBasePageControlsResize('DivPlanStepFiveB',  180,180,155,180,    180,180,       200,180,   220,'');//IE6      
            //        /////////////////              STEPS END            /////////////////////
            
        }
        catch(ex)
        {
          
        }
    }     
       
    function BP_setAlertControlHeight()  
    {
        if (document.getElementById("Alerts1_TextBoxMessage") == null)
        {
            return;
        }  
        try
        {
            if (GetCurrentWindowHeight() > 450)
            {   
                HandleBasePageControlsResize('divAlertsControl',120,180,130,190,150,180,160,210,60,'');        
                HandleBasePageControlsResize('Alerts1_TextBoxMessage',450,'',460,'',460,'',480,'',392,'');                
            }
            else
            {
                SetControlHeight(document.getElementById("divAlertsControl"),430)
                SetControlHeight(document.getElementById("Alerts1_TextBoxMessage"),130)
            }
        }
        catch(err)
        {
           
        }
    } 
    
    function BP_setMessageControlHeight()  
    {
        if (document.getElementById("DivCommonMessage") == null)
        {
            return;
        }    
        try
        {               
            if(GetCurrentWindowHeight() > 450)
            {
                HandleBasePageControlsResize('DivCommonMessage',180,180,180,'',200,200,210,180,'',200); 
                HandleBasePageControlsResize('Div_SentMessages',180,180,180,'',200,210,210,180,'',200); 
                HandleBasePageControlsResize('Div_Compose',180,180,180,'',200,200,210,210,180,200); 
                HandleBasePageControlsResize('Messages1_TabContainerMessages_TabPanelInbox_TextBoxDiscription',500,'',500,'',500,'',550,'',500,'');             
                HandleBasePageControlsResize('Messages1_TabContainerMessages_TabPanelSentMessages_TextBoxSentMessageDiscription',500,'',500,'',550,'',500,'',500,'');
                HandleBasePageControlsResize('Messages1_TabContainerMessages_TabPanelCompose_TextBoxComposeMessage',460,'',460,'',500,'',550,'',500,'');
            }
            else
            {
                SetControlHeight(document.getElementById("DivCommonMessage"),420)
            }
        }    
        catch(err)
        {
           
        }
    } 
    
    
       //***********************************First Time Login Pages resizing*********************************//
       
       //On Resize
    function BPFirstTimeOnResize()
    {
        try
        {
            //var UserAgent = navigator.userAgent.toLowerCase();             
            var MainFrame= document.getElementById("MainFrame"); //iframe  in AppMainTable table
            var AppMainTable=document.getElementById("AppMainTable");      
            HandleAppPageControlsResize('AppMainTable',120,100,120,100,110,'',120, '', 130 ,'');               
            HandleAppPageControlsResize('MainFrame',   120,20, 100,20, 110,'',90,'',140,'');
        }
        catch(ex)
        {
           
        }
    } 
       
       // On Load
    function BPFirstTimeOnLoad()
    {
        try
        {
            var MainFrame= document.getElementById("MainFrame"); //iframe  in AppMainTable table
            var AppMainTable=document.getElementById("AppMainTable");
            //HandleAppPageControlsResize(ControlId,IE6Heigth,IE6Width,IE7Height,IE7Width,firefoxHeight,firefoxWidth,WinSafariHeight,WinSafariWidth,MacSafariHeight,MacSafariWidth);      
            HandleAppPageControlsResize('MainFrame',100,'',100,'',95,'',120,'',140,'');      
            HandleAppPageControlsResize('AppMainTable',100,'',100,'',95,'',90,'',140,'');
        }
        catch(ex)
        {
          
        }
    } 
       
      //OnPageResize
      //OnPageLoad
      // Created By Devinder . Called from BasePages\BrokerPortalFirstTimeLogin.aspx  
    function BaseFirstTimeLoginOnLoad()
    {
        try
        {
            //HandleBasePageControlsResize(ControlId,IE6Heigth,IE6Width,IE7Height,IE7Width,firefoxHeight,firefoxWidth,WinSafariHeight,WinSafariWidth,MacSafariHeight,MacSafariWidth);
            HandleBasePageControlsResize('BPMainTable',             160,'',100,'',97,'', 160,'',160,''); //iframe  in AppMainTable table   
            HandleBasePageControlsResize('DivBrokerRegistration',   220,'',200,'',175,'',220,'',220,'');
            HandleBasePageControlsResize('DivBrokerAggrement',      220,'',220,'',180,'',220,'',220,'');
            HandleBasePageControlsResize('DivFirstTimeLogin',       220,'',200,'',175,'',220,'',220,'');
            HandleBasePageControlsResize('DivRegistrationComplete', 220,'',220,'',220,'',220,'',260,'');
            HandleBasePageControlsResize('DivInstruction',          220,'',220,'',175,'',220,'',220,'');
        }
        catch(ex)
        {
          
        }       
    }
    
    // Function Created by Devinder on April 3,2008.
    function OpenBPPrintProposalScreen(ProposalID)
    {
        var pagePopup=window.open("../RDL/BrokerProposal.aspx?ProposalId=" + ProposalID);
        if(pagePopup==null)
        {
          alert('Popup blocker has blocked your popup.Please allow this website in your popup blocker'); 
        }
        
    }
    
  //***********************************First Time Login Pages resizing*********************************//
  //Function created by Manjeet on Fab 18, 2007
  //Purpose: To Open BP Help Manuals
        function OpenBPHelpDocs(PageName)
        {
            try
            {
                var pagename='../HelpManuals/BP/'+PageName ;
                var options="resizable=yes,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,left=50,top=100,height=500,width=700"   ;
                var client= window.open(pagename ,"Help",options);
                
                if(client==null)
                {
                      alert('Popup blocker has blocked your popup.Please allow this website in your popup blocker'); 
                }
                else
                {
                    if (window.focus) 
                    {
                        client.focus() ;
                    }
                }
            }
            catch(ex)
            {
                
            }
        }
             
//Created by Manjeet as on 20-12-2007 to open the PlanDescriptionPDF.aspx page
function OpenNewWindow(ArgumentId)
{
    try
    {
        var msAttributes1 ="status=no,toolbar=no,menubar=no,location=no,statusbar=yes,scroll=yes,scrollbars=yes,resizable=yes"
        var retValue=window.open("../BrokerPortal/SalesCollateralPDF.aspx?ArgumentId=" + ArgumentId,"Test",msAttributes1);
        if(retValue==null)
        {
              alert('Popup blocker has blocked your popup.Please allow this website in your popup blocker');         
        }
    }
    catch(ex)
    {
       
    }
}  

    //Build # 23.<AceDesc>Task #239 Create Broker's Portal Informational Website
    //Created by Damanpreet as on May 28 2008 to open the SalesCollateralPDF.aspx page
    //This will be called from BpMenuToolsAndResources.ascx.cs onClick of the name of 
    //Document to open that Document in new window.
    function OpenNewWindowFromBpMenuToolsAndResources(ArgumentId,BindText)
    {
        try
        {
            var msAttributes1 ="status=no,toolbar=no,menubar=no,location=no,statusbar=yes,scroll=yes,scrollbars=yes,resizable=yes"
            var retValue=window.open("BrokerPortal/SalesCollateralPDF.aspx?ArgumentId=" + ArgumentId,"Test",msAttributes1);
            if(retValue==null)
            {
                  alert(BindText);         
            }
        }
        catch(ex)
        {
           
        }
    }         
        function ManageUnderwriting(ctr)
        {
            try
            {
                if(ctr.id=='ProposalStepFiveA1_RadioButtonProposalBased')
                {
                  document.getElementById("ButtonStepNext").value='Next';
                }
                else if(ctr.id=='ProposalStepFiveA1_RadioButtonProposalWithout')
                {
                  document.getElementById("ButtonStepNext").value='Finish';
                }
                
            
            }
            catch(Ex)
            {
            
            }
        }
        
        function SwapBGColorOnHover(Control, BGColor)
        {     
            try
            {
                document.getElementById(Control).style.backgroundColor = BGColor;         
            }
            catch(exception)
            {
                
            }
        }
        
        
        function OpenPageFromApplicationPage(PageName)
        {
            try
            {
                frames['MainFrame'].location.href = 'BasePages/BrokerPortal.aspx?PageName=' + PageName ;
            }
            catch(exception)
            {
              
            }
        }
       
       
        function OpenPageWithQueryStringFromApplicationPage(PageName,QueryString)
        {
            try
            {
                frames['MainFrame'].location.href = 'BasePages/BrokerPortal.aspx?PageName=' + PageName + "&" + QueryString ;    
            }
            catch(exception)
            {
           
            }
        }
        
        
        function OpenPage(PageName)
        {
            try
            {
                location.href = 'BrokerPortal.aspx?PageName=' + PageName ;
            }
            catch(exception)
            {
                
            }
        }
        
        function CheckCompositeParIndex(ProposalID,MinParIndex,MaxParIndex,UserParticipatory,Control)
        {
            try
            {
            
                var SmokeFreeInc=document.getElementById("ProposalStepFiveB1_TextBoxSmokeFreeIncentive").value;
            var CorePreventionProgInc=document.getElementById("ProposalStepFiveB1_TextBoxCorePreventionProgram").value;
            var TargetRiskProgInc=document.getElementById("ProposalStepFiveB1_TextBoxTargetedRiskProgram").value;
            var LabelCompositePARValueIndex=document.getElementById("ProposalStepFiveB1_LabelCompositePARValueIndex")
            
            ValidDecimal(Control);
                               
            if(SmokeFreeInc!='' && CorePreventionProgInc!='' && TargetRiskProgInc!='')
            {
                //Function in AjaxScript.js
                 GetCompositeParIndex(ProposalID,SmokeFreeInc,CorePreventionProgInc,TargetRiskProgInc,MinParIndex,MaxParIndex,UserParticipatory);
            }
             
                
            }
            catch(ex)
            {
               
            }
        //(ProposalID,SmokeFreeInc,CorePreventionProgInc,TargetRiskProgInc)
        }
        
        function OpenPageWithQueryString(PageName, QueryString)
        {
            try
            {
                location.href = "BrokerPortal.aspx?PageName=" + PageName + "&" + QueryString ;                
            }
            catch(exception)
            {
               
            }
        }
        
    function SetEnglishCulture()
    {  
        try
        {  
            document.getElementById("HiddenCulture").value="en-Us";
        }
        catch(ex)
        {
        
        }
    }
    
    function SetSpanishCulture()
    {
        try
        {
            document.getElementById("HiddenCulture").value="es-mx";
        }
        catch(ex)
        {
            
        }
    }
    //********************************
 //Function to validate Date created by Damanpreet on Dec 14 2007
 function isValidDate(dateStr) { 
// Checks for the following valid date formats:
// MM/DD/YY   MM/DD/YYYY   MM-DD-YY   MM-DD-YYYY
try {

var datePat = /^(\d{1,2})(\/|-)(\d{1,2})\2(\d{4})$/; // requires 4 digit year

var matchArray = dateStr.match(datePat); // is the format ok?
if (matchArray == null) {
alert(dateStr + " Date is not in a valid format.")
return false;
}
month = matchArray[1]; // parse date into variables
day = matchArray[3];
year = matchArray[4];
if (month < 1 || month > 12) { // check month range
alert("Month must be between 1 and 12.");
return false;
}
if (day < 1 || day > 31) {
alert("Day must be between 1 and 31.");
return false;
}
if ((month==4 || month==6 || month==9 || month==11) && day==31) {
alert("Month "+month+" doesn't have 31 days")
return false;
}
if (month == 2) { // check for february 29th
var isleap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));
if (day>29 || (day==29 && !isleap)) {
alert("February " + year + " doesn't have " + day + " days");
return false;
   }
}
return true;
}
catch(ex)
{

}
}
 
 //Function to calculate date diffrence 
 //Created by Damanpreet on Dec 13 2007
 function dateDiff(EHStartDate) { 
try {
date1 = new Date();
date2 = new Date();
diff  = new Date();

//if (isValidDate(PlanStartDate.value) ) { // Validates first date 
//date1temp = new Date(PlanStartDate.value );
//date1.setTime(date1temp.getTime());
//}
//else return false; // otherwise exits

if (isValidDate(EHStartDate.value)) { // Validates second date 
date2temp = new Date(EHStartDate.value);
date2.setTime(date2temp.getTime());
}
else return false; // otherwise exits

// sets difference date to difference of first date and second date
if(date2.getTime()< date1.getTime())
{
return false;
}
else{

diff.setTime(Math.abs(date2.getTime() - date1.getTime()));
}
timediff = diff.getTime();


return days = Math.floor(timediff / (1000 * 60 * 60 * 24));
}
catch(ex)
{

}
}
//**********************************************************************

 
 
    
    
  
//Function to convert Numeric to currency Format
//By Damanpreet on Dec 17 2007  
function formatCurrency(num) {
try
{
num = num.toString().replace(/\$|\,/g,'');
if(isNaN(num))
num = "0";
sign = (num == (num = Math.abs(num)));
num = Math.floor(num*100+0.50000000001);
cents = num%100;
num = Math.floor(num/100).toString();
if(cents<10)
cents = "0" + cents;
for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
num = num.substring(0,num.length-(4*i+3))+','+
num.substring(num.length-(4*i+3));
return (((sign)?'':'-') + '$' + num + '.' + cents);
}
catch(ex)
{
    
}
}
  
   
 //Without $ sign  
 //Function to convert Numeric to currency Format
 //By Damanpreet on Dec 17 2007   
fmtMoney = function( n, c, d, t )
{
    var m = ( c = Math.abs( c ) + 1 ? c : 2, d = d || ",", t = t || ".", /(\d+)(?:(\.\d+)|)/.exec( n + "" ) ), x = m[1].length % 3;
    return ( x ? m[1].substr( 0, x ) + t : "" ) + m[1].substr( x ).replace( /(\d{3})(?=\d)/g, "$1" + t ) + ( c ? d + ( +m[2] ).toFixed( c ).substr( 2 ) : "" );
};

//Use
//fmtMoney( NumericValue, 2, '.', ',' );
//Defaults:
//float ploint cutoff = 2 decimal places
//decimal separator = ','
//thousands separator = '.'

//Function to check special Characters in Company Name
//Created by Damanpreet on Jan 07 2008
function AllowSpecialCharacters(str)
{
    try
    {
    var checkOK = "~!@#%^*+={}<>?'";
    var checkStr = str;
    var allValid = true;
    var allNum = "";
    for (i = 0; i< checkStr.length; i++)
    {
        ch = checkStr.charAt(i);        
        for (j = 0; j < checkOK.length; j++)
        {        
            if (ch == checkOK.charAt(j))
            {
                allValid = false;
                break;
            }
            if (j == checkOK.length-1)
            {
                break;
            }
        }
        if(allValid==false)
        {
            break;
        }
    }
    if (!allValid)
    return (false);
    }
    catch(ex)
    {
     
    }
}



//Function to validate Decimal values
//Created by Damanpreet on Jan 07 2008
function checkDecimals(fieldValue,Right,Left)
{
try
{
if (isNaN(fieldValue) || fieldValue == "") {

return false;

}
else {
if (fieldValue.indexOf('.') == -1) fieldValue += ".";

dectext = fieldValue.substring(0,fieldValue.indexOf('.'));

if (dectext.length > Right)
{
return false;
      }
else {
if (fieldValue.indexOf('.') == -1) fieldValue += ".";
dectext = fieldValue.substring(fieldValue.indexOf('.')+1, fieldValue.length);

if (dectext.length > Left)
{
return false;
      }
else {
return true;
      }}
   }
   }
   catch(ex)
   {
   
   }
}
//Function to check First Character Alphabet in Company Name,ProposalName,PLan Name etc
//Created by Damanpreet on Jan 07 2008
function FirstCharacterAlphabet(str)
{
    try
    {    
    var checkStr = str;
    var allValid = true;
    var allNum = "";
    if( checkStr.length>0)
    {
        var chr=checkStr.substring(0, 1);
       // ch = checkStr.charAt(1);
       if ((chr >= "a" && chr <= "z") || (chr >= "A" && chr <= "Z"))        
          {
                allValid = true;                
          } 
       else
       {
                allValid = false;
       }
    }
    if (!allValid)
    return (false);
    }
    catch(ex)
    {
      
    }
}

function ReplaceAll(strValue,oldch,newchar)
{
  var objRegExp = eval("/" + oldch + "/g"); 
  return strValue.replace(objRegExp,newchar);
}


 //*************************************** Commen Function End *******************************************
 //*************************************** Broker Agreement Function Starts ******************************
 //This function is moved from BrokerAggreement.ascx by Damanpreet on 26 May 2008
 //Modified by Damanpreet on 26 May 2008 for Task # 250  ----Suggestion: Licence Aggrement: Scrolling down to Accept Agreement
   function DisableEnableButton(CheckBoxControll,ButtonObject)
     {
      var ButtonId=document.getElementById(ButtonObject);
      if(CheckBoxControll.checked == true)
      {
      ButtonId.disabled=false;          
      }
      if(CheckBoxControll.checked == false)
      {
       ButtonId.disabled=true;      
      }
      }
      function ValidationBrokerAgreement(checkBoxAccept,LabelMessage,Message)
     {  
      try    
        {
     
         SetLabelValue(document.getElementById(LabelMessage),"",true);
     
          if(document.getElementById(checkBoxAccept).checked==true)
            {
               return true;
            }
            else
            {
                 SetLabelValue(document.getElementById(LabelMessage),Message,true);
                 document.getElementById('DivBrokerAggrement').scrollTop=10000;
                 return false;
            }        
     }
     
       catch(ex)
       {
          //alert('ValidationBrokerAgreement--'+ex);
          return false;
       }        
     }  
//*************************************** Broker Agreement Function Ends *******************************************
// Created by:Devinder
// Created Date:30 April 2008
// Purpose : This function Opens the div as model popup
//Modified By :Damanpreet Kaur
//Modified Date :27 May 2008
//Purpose : BP Task #243 --	Save As: Default cursor should on 'Enter New Proposal Name' (Mozilla FFox)
//Modified the  DivControl style. 
function ShowDivASModelPopupForSaveAssign(DivControlName,left,top)
{
    try
    {
    
        var   UpdatePanel1=document.getElementById('UpdatePanel1');
        
        //var divCover=null;
        
        //divCover=document.getElementById('DivCoverBasePage');
        
        
//        if(divCover==null)
//        {            
//            divCover= document.createElement("div");
//            
//            divCover.id="DivCoverBasePage";
//            divCover.style.display='none';
//            if(UpdatePanel1!=null)
//            {
//                UpdatePanel1.appendChild(divCover);
//            }
//            else
//            {
//                document.body.appendChild(divCover); 
//            }                  
//        }    

//         divCover.style.cssText = 'position:absolute;z-index: 100;width:98%;left:1px;top:1px;filter: alpha(opacity=50);-moz-opacity: .5;background:#ccc;padding:5px;';
//          divCover.style.display='block';
//       
//          SetControlHeight(divCover,parent.document.body.scrollHeight-90);
                 
        var DivControlToPopup=document.getElementById(DivControlName); 

        if(DivControlToPopup!=null)
        {
            DivControlToPopup.style.cssText = 'position:absolute;z-index: 315;left:'+left+'px;top:'+top+'px;display:block;overflow:auto;';           
        }        
    }
    catch(ex)
    {
        alert('ShowDivASModelPopupForSaveAssign'+ex);
    }
}
//*******************Proposal Details Save As and Assing Proposal button functions  STARTS*************************//
/*     Task #221--Add Save As to Proposal Details
       Task #222--Add Assigned Button to Proposal Details    */

// Created by:DamanPreet kaur
// Created Date:02 May 2008
// Purpose : This function shows the Save As or Assign Proposal window on ProposalDetails page
//Modified by : Damanpreet Kaur
//Modified on : 13 May 2008
//Purpose : To set default focus on control
//Modified by : Damanpreet Kaur
//Modified on : To default the name of the new proposal to "Copy of [Proposal Name]"(Task #222(BP)).
    function ShowSaveASorAssignProposal(hidePanelAssignProposal,left,top,control,ProposalName)
    {
        try
        {   
            ShowDivASModelPopupForSaveAssign(hidePanelAssignProposal,60,50);
            var TxtBxNewProposalName = document.getElementById('BPProposalDetail1_TextBoxNewProposalName');
            if(TxtBxNewProposalName != null)
            {
                TxtBxNewProposalName.value='Copy of '+ProposalName;             
            }
            var dropDwBrokerList =document.getElementById('BPProposalDetail1_DropDownListBrokersList');            
            if(dropDwBrokerList != null)
            {             
                 dropDwBrokerList.value = -1;                
            }
            control.focus();
            
            return false;
        }
        catch(ex)
        {            
            return false;
        }
    } 
   
    
// Created by:DamanPreet kaur
// Created Date:02 May 2008
// Purpose : This function shows the Confirm Message window on on ProposalDetails page
//Modified by : Damanpreet Kaur
//Modified on : 13 May 2008
//Purpose : To set default focus on button
function ConfirmChangeOfBroker(hidePanelAssignProposal,ConfirmControl,DropDownBrokerList,ButtonConfirmYes)
{
    try
    {  
        var _DropDownAssignTarp=document.getElementById(DropDownBrokerList); 
        var TarpID=_DropDownAssignTarp.options[_DropDownAssignTarp.selectedIndex].value
        if(TarpID == -1)
        {  
         return false
        }
        else
        {
            HideDivASModelPopup(hidePanelAssignProposal);
            ShowDivASModelPopupForSaveAssign(ConfirmControl,60,50);
            ButtonConfirmYes.focus();
            return false;
        }
    }
    catch(ex)
    {       
        return false;
    }
}


// Created by:DamanPreet kaur
// Created Date:02 May 2008
// Purpose : This function shows the Confirm Message window on Mon ProposalDetails page
//Modified by : Damanpreet Kaur
//Modified on : 13 May 2008
//Purpose : To fix bug #1,3,4,5 on Task # 221 --in BP 2.0
function ConfirmSaveAsProposal(hidePanelSaveAsProposal,ConfirmControl,TextBoxProposalName,ButtonConfirmYes)
{
    try
    {        
        var _TextBoxProposalName=document.getElementById(TextBoxProposalName);
        var NewProposalName= trim(_TextBoxProposalName.value);  
            if (trim(NewProposalName) == "")
            {                
                return false
            }
            else
            {
                var validProposalName = AllowSpecialCharacters(trim(NewProposalName)); 
                if(validProposalName==false)
                {                    
                    return false
                }
                else
                {
                    var validProposalName1 = FirstCharacterAlphabet(trim(NewProposalName)); 
                    if(validProposalName1==false)
                    {                       
                        return false
                    }
                    else
                    {
                        HoldDate=new Date();
                        var HoldDate1 = HoldDate.getDate();
                        var HoldMonth = (HoldDate.getMonth()+1);
                        var HoldYear  = HoldDate.getYear();

                        // Y2K compliant
                        if (HoldYear < 1000) HoldYear +=1900;
                        _TextBoxProposalName.value = trim(_TextBoxProposalName.value) + ' '  + HoldMonth + "-" + HoldDate1 + "-" + HoldYear ;
                        HideDivASModelPopup(hidePanelSaveAsProposal);
                        ShowDivASModelPopupForSaveAssign(ConfirmControl,60,50);                      
                        ButtonConfirmYes.focus();
                        return false;
                    }
                }  
            }        
           /* else
            {
                HideDivASModelPopup(hidePanelSaveAsProposal);
                ShowDivASModelPopup(ConfirmControl,60,50);
                return false;
            }*/
    }
    catch(ex)
    {       
        return false;
    }
}
// Created by:DamanPreet kaur
// Created Date:02 May 2008
// Purpose : This function shows the cancel Confirm Message window on ProposalDetails page
function CloseAllDivOnCancel(HidePanel,MsgPanel)
{
    try
    {
         HideDivASModelPopup(HidePanel);
         HideDivASModelPopup(MsgPanel);
         return false;
    }
    catch(ex)
    {
        return false;
    }
}
// Created by:DamanPreet kaur
// Created Date:02 May 2008
// Purpose : This function will hide the Confirm Message window on ProposalDetails page
function ConfirmSaveAsorAssignProposal(ConfirmControl)
{
    try
    { 
        HideDivASModelPopup(ConfirmControl);      
        return true;       
    }
    catch(ex)
    {
        return false;
    }
}
 
//*******************Proposal Details Save As and Assing Proposal button functions  ENDS*************************//

//*************************************** Proposal Detail Step 3 START *******************************************

function ValidationStepThree(SpouseYes,SpouseNo,LabelMessage,Message)
 {
     
     try    
     {
        SetLabelValue(document.getElementById(LabelMessage),"",true);
        if(document.getElementById(SpouseYes).checked==true)
        {
            return true;
        }
        if(document.getElementById(SpouseNo).checked==true)
        {
            return true;
        }
        
        SetLabelValue(document.getElementById(LabelMessage),Message,true);
        document.documentElement.scrollTop = 0;
        return false;
       
    }
    catch(ex)
    {
   
    return false;
    }
}

function ShowHideControl(RadioButton)
        {
        try
        {
          //dropTemplates,gridTemplates
            var dropTemplates=document.getElementById('ProposalStepThree1_DropDownWageBandTemplateName'); 
            var gridTemplates=document.getElementById('ProposalStepThree1_GridViewBandsListing'); 
            
           
           
            //if (RadioButton.value=='RadioButtonProposalsIncludeWageBandingNO')
             if (RadioButton.value=='RadioButtonProposalsIncludeWageBandingYes')
            {
                // Display the controls
               // dropTemplates.style.display="block";
                //gridTemplates.style.display="block";
               
//                 dropTemplates.style.visibility="visible";
//                gridTemplates.style.visibility="visible";
                
                dropTemplates.style.display = 'block'
                gridTemplates.style.display = 'block'
               
                document.getElementById("ProposalStepThree1_HiddenIncludeWageBandState").value="block";
            }
            
            //if (RadioButton.value=='RadioButtonProposalsIncludeWageBandingYes')
            if (RadioButton.value=='RadioButtonProposalsIncludeWageBandingNO')
            {
                // Hide the controls
                //dropTemplates.style.display="none";
//                 dropTemplates.style.visibility="hidden";
//                gridTemplates.style.visibility="hidden";
                
                dropTemplates.style.display = 'none'
                gridTemplates.style.display = 'none'
                
                document.getElementById("ProposalStepThree1_HiddenIncludeWageBandState").value="none";
            }
            }
            catch(ex)
           {
               
           }
        }

//*************************************** Proposal Detail Step 3 END *******************************************

//*************************************** Proposal Detail Step 3A START *******************************************

// Created By Devinder  on 26 Dec 07
function CalulateTotalNumbersInGrid(control,TableNormativeData,LabelTotalNumberInGrid)
{
    try
    {
    ValidInteger(control);
    var childInputs = document.getElementById(TableNormativeData).getElementsByTagName("input");
    var count=0;
    var val;
    for(var i=0;i<childInputs.length;i++)
    {
        if(childInputs[i].value!='')
        {
        val=ReplaceAllOccurances(childInputs[i].value,',','');;
            count=count+parseInt(val);
        }
    }
    SetLabelValue(document.getElementById(LabelTotalNumberInGrid),formatNumber(count,0,',' , ' ',' ','','-',''),true);
    }
    catch(ex)
    {
      
    }
}

//Function created by Damanpreet on Dec 27 2007
function ValidationStepThreeA()
{
    try
    {        
        var StrLocalizedMessage="";
        var controlvalue1;
        var controlvalue2;

        //Modified by Damanpreet on Dec 06 2007
        var LabelTotNoOfEmployeesFromGrid= document.getElementById('ProposalStepThreeA2_LabelTotalEmpInGrid');
        var LabelTotNoOfEmployeesFromGridValue = GetLabelValue(LabelTotNoOfEmployeesFromGrid);
        var LabelTotNoOfEmployees= document.getElementById('ProposalStepThreeA2_LabelTotalEmpInMedGroup');
        var LabelTotNoOfEmployeesValue = GetLabelValue(LabelTotNoOfEmployees);
               
        controlvalue1=ReplaceAllOccurances(LabelTotNoOfEmployeesValue,",","");
        controlvalue2=ReplaceAllOccurances(LabelTotNoOfEmployeesFromGridValue,",","");
        
//        if (parseInt(LabelTotNoOfEmployeesValue)!=parseInt(LabelTotNoOfEmployeesFromGridValue))
        if (parseInt(trim(controlvalue1))!=parseInt(trim(controlvalue2)))
        {    
            StrLocalizedMessage ="*" + "Please enter in the numbers in the chart so they equal the number specified previously.";
        }

        if (StrLocalizedMessage != "")
        {
            var LabelError=document.getElementById("ProposalStepThreeA2_LabelMessage");
            SetLabelValue(LabelError,StrLocalizedMessage,true); 
            document.documentElement.scrollTop = 0;
            return false;
        }
        else
        {
            return true;
        }
    }
    catch(ex)
    {
       
    }
}

//*************************************** Proposal Detail Step 3A END *******************************************


//*************************************** Plan Information Step One -- A *******************************************


// Created By Sanjeev  on 27 Dec 07
function CalulateTotalEmployeeEnrolled(TableNormativeData,LabelTotalNumberInGrid,HdnFldTotalEmpEnrolled,TextBoxPereviousEnrollment1,LabelCalculatEnrolledRate1,HiddenFieldNumberOfEligibleEmployees1)
{
    try
    {
    var childInputs = document.getElementById(TableNormativeData).getElementsByTagName("input");   
    
    var count=0;    
    var childInputValue=0;
    
    for(var i=0;i<childInputs.length;i++)
    {
    var temp =childInputs[i].value;
     if(childInputs[i].id.indexOf('TextBoxEmpEnrolled')>0)
      {
        if(childInputs[i].value!='')
        {
           childInputValue=childInputs[i].value;
           childInputValue=ReplaceAll(childInputValue,",",""); 
           count=count+parseInt(childInputValue); 
           //count=count+parseInt(childInputs[i].value);
        }
      }
    }
     
     SetLabelValue(document.getElementById(LabelTotalNumberInGrid),formatNumber(count,0,',' , ' ',' ','','-',''),true);
     //SetLabelValue(document.getElementById(HdnFldTotalEmpEnrolled),count,true);
     document.getElementById(HdnFldTotalEmpEnrolled).value=count;
     
     var Rate = document.getElementById(TextBoxPereviousEnrollment1);
     var TotEmpEnrolled = document.getElementById(HiddenFieldNumberOfEligibleEmployees1);
    // Set Value
     SetLabelValue(document.getElementById(LabelCalculatEnrolledRate1),formatNumber(Math.round((ReplaceAll(Rate.value,",","")*ReplaceAll(TotEmpEnrolled.value,",",""))/100),0,',' , ' ',' ','','-',''),true);
   }
   catch(ex)
   {
   
   }
   }
   
   
   function CalulateTotalAnnualCostForPlanIformationStepOne(TableNormativeData,LabelTotalNumberInGrid,HdnFldTotalAnualCost)
{
try
{
    var childInputs = document.getElementById(TableNormativeData).getElementsByTagName("input");
    var count=0;
    var childInputValue=0;
    
    for(var i=0;i<childInputs.length;i++)
    {
    var temp =childInputs[i].value;
     if(childInputs[i].id.indexOf('TextBoxTotalAnualCost')>0)
      {
        if(childInputs[i].value!='')
        {
           //count=count+parseInt(childInputs[i].value);
           childInputValue=childInputs[i].value;
           childInputValue=ReplaceAll(childInputValue,",",""); 
           count=count+parseFloat(childInputValue);
        }
      }
    } 
   // var Label1= document.getElementById(LabelTotalNumberInGrid);
   
  
   // SetLabelValue(Label1,count);
     SetLabelValue(document.getElementById(LabelTotalNumberInGrid),formatNumber(count,2,',','.','$','','',''),true);
     //SetLabelValue(document.getElementById(HdnFldTotalAnualCost),count,true);
     document.getElementById(HdnFldTotalAnualCost).value=count;
   }
   catch(ex)
   {
      
   }
   }
   
   function CalculateTotalAnnualCostForPlanIformationStepOneB(TableNormativeData,LabelTotalNumberInGrid,HdnFldTotalAnualCost)
   {
    try
     {
        var childInputs = document.getElementById(TableNormativeData).getElementsByTagName("input");
        var count=0;
       var childInputvalue=0;
        
        
        for(var i=0;i<childInputs.length;i++)
        {
            // ValidDecimal(childInputs[i]);
             var temp =childInputs[i].value;
            
             if(childInputs[i].id.indexOf('TextBoxTotalAnualCost')>0)
              {
                if(childInputs[i].value!='')
                {
                   //ValidDecimal(childInputs[i]);  
                   childInputvalue=ReplaceAll(childInputs[i].value,",","");
                   count=count+parseFloat(childInputvalue);
                }
              }
            
        }
        var CountWithDollorSign='';
        if(count>0)
        {
         CountWithDollorSign="$"+count;
        } 
       // var Label1= document.getElementById(LabelTotalNumberInGrid);
       
       
       // SetLabelValue(Label1,count);
         //SetLabelValue(document.getElementById(LabelTotalNumberInGrid),CountWithDollorSign,true);---- commented by manjeet
         SetLabelValue(document.getElementById(LabelTotalNumberInGrid),formatNumber(count,2,',','.','$','','',''),true); /*--- Wriiten by Manjeet*/
         //SetLabelValue(document.getElementById(HdnFldTotalAnualCost),count,true);
        
         document.getElementById(HdnFldTotalAnualCost).value=count;
   }
   catch(ex)
   {
  
   }
   }
   
   //Created by Manjeet as on 27-12-2007
   //Purpose : Get Multiplication on Plan Information Step 1 Page
function GetMultiplication(HFEligibleEmployee,EnrolmentRate,LabelCalculation,NumberOfPlans)
{ 
try
{
   
    var _HFEligibleEmployee=document.getElementById(HFEligibleEmployee).value;
    var _EnrolmentRate=document.getElementById(EnrolmentRate).value;
    var _Output=document.getElementById(LabelCalculation);
    var _NumberOfPlans=document.getElementById(NumberOfPlans).value;
    if(_NumberOfPlans>1)
    {
       //The following if condition is written by Pradeep
       if(isNaN(_EnrolmentRate)==false && _EnrolmentRate>0 && _EnrolmentRate<=100 )
       {
            var Calculation=((_HFEligibleEmployee) * (ReplaceAll( _EnrolmentRate,",","")))/100;
            Calculation=Math.round(Calculation)
            //SetLabelValue(_Output,Calculation,true);
            SetLabelValue(_Output,formatNumber(Calculation,0,',' , ' ',' ','','-',''),true);
        }
        else
        {
         Calculation='';
         SetLabelValue(_Output,formatNumber(Calculation,0,',' , ' ',' ','','-',''),true);
        }
        
    }
   // document.getElementById(LabelCalculation).innerText=Calculation.value; 
   }
   catch(ex)
   {
  
   }
}



//******** Following two function created by Manjeet as on 08 January, 2008 for ProposalStep information One ***********//
//*****************************************************************************************************//

function AlertMsgA()
{
    try
    { 
        var hiddenValue=document.getElementById('PlanInformationStepOne1_HiddenFieldNumberOfPlan'); 
        var PlanNumbers=document.getElementById('PlanInformationStepOne1_TextBoxNumberOfPlan');
        //The following if condition is aded by Pradeep On 4/3/2008
        if(isNaN(PlanNumbers.value)==false && PlanNumbers.value.indexOf('.')<0)
        {
            if(PlanNumbers.value=='' || PlanNumbers.value=='0')
            {
              
                PlanNumbers.value='1';
              //  return true;
            }
            if(hiddenValue.value!=PlanNumbers.value && hiddenValue.value!='0')
            {
                alert('All your current plan information is being deleted. You can now enter information for the new plan(s).');
                return true;
            }
        }
    }
    catch(ex)
    {
     
    }
}
 
 
 
function CheckEmptyA(TableNormativeData)
{
    try
    {
   
    if(ValidatePlanInformationStepOneA()==false)
    {
        return false;
    }         
     var number=document.getElementById('PlanInformationStepOne1_TextBoxNumberOfPlan');       
     var count=0;
     var LabelErrorMessage=document.getElementById('PlanInformationStepOne1_LabelMessage');
     var ErrorMessage='';
     var PlanNameCheck=false;
     var EmpEnrolledCheck=false;
     var TotalAnualCostCheck=false;
     if(TableNormativeData!=null)
     {
        
         if (number.value>1)
         {
            if(document.getElementById('PlanInformationStepOne1_TableDynamic')==null)
            {
                return false;
            }
            if (document.getElementById('PlanInformationStepOne1_TableDynamic').rows.length-1 !=number.value)
            {
                return false;
            }
         
            var childInputs = document.getElementById(TableNormativeData).getElementsByTagName("input");
            for(var i=0;i<childInputs.length;i++)
            {
               if(childInputs[i].id.indexOf('TextBoxPlanName')>0)
                  {
                    if(childInputs[i].value!='')
                    {                        
                    }
                    else
                    {
                      PlanNameCheck=true;
                    }
                  }
                  
                  if(childInputs[i].id.indexOf('TextBoxEmpEnrolled')>0)
                  {
                    if(childInputs[i].value!='')
                    {                        
                    }
                    else
                    {
                      EmpEnrolledCheck=true;
                    }
                  }
                  
                  if(childInputs[i].id.indexOf('TextBoxTotalAnualCost')>0)
                  {
                    if(childInputs[i].value!='')
                    {                        
                    }
                    else
                    {
                      TotalAnualCostCheck=true;
                    }
                  }
            }
            if(PlanNameCheck==true)
            {
                ErrorMessage='* Please fill all the plan name';
            }
            if(EmpEnrolledCheck==true)
            {
                ErrorMessage=ErrorMessage+'\n* Please fill all the employee enrolled';
            }
            if(TotalAnualCostCheck==true)
            {
                 ErrorMessage=ErrorMessage+'\n* Please fill all the total annual cost';
            }
            //if(ErrorMessage!='')
            //{
            //      SetLabelValue(LabelErrorMessage,ErrorMessage,true);
            //      return false;
            //}
            //*************CheckTotalEmpEnrolled();*************
            
             var hiddenValue=document.getElementById('PlanInformationStepOne1_HiddenFieldNumberOfEligibleEmployees'); 
             var EnrollmentRate=document.getElementById('PlanInformationStepOne1_TextBoxPereviousEnrollment'); 
             var TotalEmpEnrolled=document.getElementById('PlanInformationStepOne1_HiddenFieldTotalEmpEnrolled'); 
             
             var Calc = Math.round((hiddenValue.value* ReplaceAll(EnrollmentRate.value,",",""))/100);
             
             if(Calc!=TotalEmpEnrolled.value)
             {
                ErrorMessage=ErrorMessage+'\n* Total Employees Enrolled from Grid must match the number of eligible employees * enrollment rate';
                //return false;
             }
             
             
             
             var CostInTextBox=document.getElementById('PlanInformationStepOne1_TextBoxProposalsEstimatedTotalPlanCost'); 
             var TotalTotAnnualCost=document.getElementById('PlanInformationStepOne1_HiddenFieldTotalAnnualCost');        
          
             var CostInTextBoxValue=CostInTextBox.value;
             CostInTextBoxValue=ReplaceAll(CostInTextBoxValue,",","");
             if(TotalTotAnnualCost.value!=CostInTextBoxValue*1)
             {
                ErrorMessage=ErrorMessage+'\n* The sum of the total annual cost from the grid must match the total annual cost (at the top)';
                //return false;
             }  
            if(ErrorMessage!='')
            {
                  SetLabelValue(LabelErrorMessage,ErrorMessage,true);
                  document.documentElement.scrollTop = 0;
                  return false;
            }          
            //***************************************************
        }
        else //if (number.value<=1)
        {
            if(document.getElementById('PlanInformationStepOne1_TextBoxPlanName')==null)
            {
                return false;
            }
        }
    }
    else
    {
        return false;
    }
    }
    catch(ex)
    {
      
    }
}

//Created by Manjeet as on 04-01-2008
//Purpose: To Validate Plan Information Step 1 Page
function ValidatePlanInformationStepOneA()
{
    try 
    {
        //Page_ClientValidate();
        var control ;
        var controlvalue;
        var strLocalizedErrorMessage="";
        control = document.getElementById('PlanInformationStepOne1_TextBoxProposalsEstimatedTotalPlanCost');    
        controlvalue=trim(control.value);
        controlvalue=ReplaceAll(controlvalue,",","");
        if (trim(control.value) == "" ||trim(control.value)==0.00)
        {
            strLocalizedErrorMessage=strLocalizedErrorMessage + "* Please enter Proposals Estimated Total Plan Cost.";
        }
        else if(checkDecimals(controlvalue,14,2)==false)
        {
            strLocalizedErrorMessage=strLocalizedErrorMessage + "\n* Please Enter Valid Estimated Total Plan Cost."
        }
        control = document.getElementById('PlanInformationStepOne1_TextBoxPereviousEnrollment'); 
        controlvalue=trim(control.value);
        controlvalue=ReplaceAll(controlvalue,",",""); 
        if (trim(control.value) == "")
        {
            strLocalizedErrorMessage=strLocalizedErrorMessage + "\n* Please enter Enrollment Rate.";
        } 
        else if((controlvalue==0)||(controlvalue>100))
        {
            strLocalizedErrorMessage=strLocalizedErrorMessage + "\n* Enrollment Rate should be greater than 0 and less than equal to 100."
        }
       /* else if((checkDecimals(trim(control.value),3,2)==false)||(trim(control.value)>100))
        {
            strLocalizedErrorMessage=strLocalizedErrorMessage + "\n* Please Enter Valid Enrollment Rate."
        }*/
        control = document.getElementById('PlanInformationStepOne1_DropDownListTrendRate');  
        if(control.selectedIndex==0)
        {       
            strLocalizedErrorMessage=strLocalizedErrorMessage + "\n* Please select trend rate that will be applied to future years.";
        }
        control = document.getElementById('PlanInformationStepOne1_TextBoxPlanName');
        var number=document.getElementById('PlanInformationStepOne1_TextBoxNumberOfPlan');   
        if(number.value<=1)
        {
            if(control!=null)
            {
                if (trim(control.value) == "")
                {   
                    strLocalizedErrorMessage=strLocalizedErrorMessage + "\n* Please enter Plan Name.";
                }
            }
            else
            {
            
                return false;
            }
         }
         /************************************/   
            
        if (strLocalizedErrorMessage != "")
        {
            var LabelError=document.getElementById("PlanInformationStepOne1_LabelMessage");
            SetLabelValue(LabelError,strLocalizedErrorMessage,true); 
            document.documentElement.scrollTop = 0;
            return false;
        }
        else
        {
            return true;
        }
    }
    catch(ex)
    { 
    
    }
}
   
   //*************************************** Plan Information Step One -- B start*******************************************
   
   // This function is used to ge multiplication of  enrollment rate and
   //number of elligible employee.It also validate Enrollment rate field .which is used in PlanInformationStepOneB
   //written by Pradeep
   function GetMultiplicationOfEnrollmentRateAndNumberOfEmpForPlanInformationStepOneB(HFEligibleEmployee,EnrolmentRate,LabelCalculation,NumberOfPlans)
    {
      try
        {
          
            ValidDecimalAndEnrollmentRateForPlanInfoStepOneB(EnrolmentRate);
            var _HFEligibleEmployee=document.getElementById(HFEligibleEmployee).value;
            var _EnrolmentRate=document.getElementById(EnrolmentRate).value;
            var _Output=document.getElementById(LabelCalculation);
            var _NumberOfPlans=document.getElementById(NumberOfPlans).value;
            var strLocalizedErrorMessage="";
        
            if(_NumberOfPlans>1)
            {
                if(_EnrolmentRate!="")
                {
                    
                   if(isNaN(_EnrolmentRate)==false && _EnrolmentRate>0 && _EnrolmentRate<=100 )
                      {
                        var Calculation=Math.round(((_HFEligibleEmployee) * (ReplaceAll( _EnrolmentRate,",","")))/100);
                        SetLabelValue(_Output,formatNumber(Calculation,0,',' , ' ',' ','','-',''),true);
                      }
                      else
                      {
                      var Calculation='';
                      SetLabelValue(_Output,formatNumber(Calculation,0,',' , ' ',' ','','-',''),true);
                      }
                  
                }
                
            }
    
        }
      catch(ex)
       {
     
       }
   }
//This function check the input value is decimal number or not and
//input value is greater than 0 and less than 100 which is used in
//PlanInfrmationStepOneB screen 
//Created by Pradeep
function ValidDecimalAndEnrollmentRateForPlanInfoStepOneB(EnrollmentRateId)
 {
    var control=document.getElementById(EnrollmentRateId);
   
    var  ErrorMessage="";
    try
    {
            // ValidDecimal(control);
            if(control.value<0 || control.value>100)
            {
                    
                    control.value='';
                    ErrorMessage = ErrorMessage + "<BR>* Enrollment Rate should be greater than 0 and less than equal to 100.";
                    if(ErrorMessage!="")
                        {
                          LabelError=document.getElementById('PlanInformationStepOneB1_LabelErrorMessage');
                          SetLabelValue(LabelError,ErrorMessage,true);
                          document.documentElement.scrollTop = 0;
                          
                        }
            }
            else
            {
                  ErrorMessage="";
                  LabelError=document.getElementById('PlanInformationStepOneB1_LabelErrorMessage');
                  SetLabelValue(LabelError,ErrorMessage,true);
           }
           ValidDecimal(control);
          
        
        
    }
    catch(ex)
        {
      
        }   
    
 }
 
   //The following function calculate total number of employee enrolled
   //which is used in PlanInformationStepOneB screen.
   //Created By Pradeep
   function CalculateTotalEmployeeEnrolledForPlanInformationStepOneB(TableNormativeData,LabelTotalNumberInGrid,HiddenFieldTotalEmpEnrolled)
    {
      try
        {
            var childInputs = document.getElementById(TableNormativeData).getElementsByTagName("input");
          
            var count=0;
            var childInputvalue=0;
            
            for(var i=0;i<childInputs.length;i++)
            {
            var temp =childInputs[i].value;
             if(childInputs[i].id.indexOf('TextBoxEmpEnrolled')>0)
              {
                if(childInputs[i].value!='')
                {
                   childInputvalue= ReplaceAll(childInputs[i].value,",","")
                   count=count+parseInt(childInputvalue);
                }
              }
            }
            document.getElementById(HiddenFieldTotalEmpEnrolled).value=count;
             
             SetLabelValue(document.getElementById(LabelTotalNumberInGrid),formatNumber(count,0,',' , ' ',' ','','-',''),true);
             
        }
      catch(ex)
        {
     
        }
    }
    //this function shows alert message if user change number of plan
    //Written by Pradeep

   function AlertMessageForPlanInfoStepOneB()
        {
                    
           try
           {
           
            
                var hiddenValue=document.getElementById('PlanInformationStepOneB1_HiddenFieldNumberOfPlan'); 
                var PlanNumbers=document.getElementById('PlanInformationStepOneB1_TextBoxNoOfPlan');
                var  ErrorMessage="";
                              
                if(isNaN(PlanNumbers.value)==false && PlanNumbers.value.indexOf('.')<0)
                {
                    if(PlanNumbers.value=='' || PlanNumbers.value=='0')
                    {
                      
                        PlanNumbers.value='1';
                       // return true;
                    }
                    if(hiddenValue.value!=PlanNumbers.value && PlanNumbers.value!=0 && hiddenValue.value!=0)
                    {
                        alert('All your current plan information is being deleted. You can now enter information for the new plan(s).');
                       
                       return true;
                    }
                }
               
           }
          catch(ex)
           {
       
           }
        }
        
           
           //This function is used to validate PlanInformationStepOneB
           //written by Pradeep
           function ValidatePlanInfoForStepOneB(TableNormativeData,LabelErrorMessage)
            {
              
              var ErrorMessage="";
              try
              {
                 
                  var DropDownValue=document.getElementById('PlanInformationStepOneB1_DroDownListLastKnownCast'); 
                  if(DropDownValue.value=='0')
                  {
                    ErrorMessage=ErrorMessage + "* Please select cost year";
                    
                  }
                  //------Start----TextBoxLastKnownCost
                  var TextBoxAnnualCost=document.getElementById('PlanInformationStepOneB1_TextBoxLastKnownCost');
                  if(TextBoxAnnualCost.value!='' && TextBoxAnnualCost.value!=0.00)
                  {
                    
                        if(checkDecimals(ReplaceAll(trim(TextBoxAnnualCost.value),",",""),14,2)==false)
                        {
                          
                           ErrorMessage=ErrorMessage + "\n* Please enter valid  total annual plan cost.";
                        }
                    
                  }
                  else
                  {
                  
                        ErrorMessage=ErrorMessage + "\n* Please fill total annual plan cost";
                  }
                  //-End--------
                 
                  //---------StartFor---------TextBoxAnnualEnrolmentRate
                 
                  var TextBoxEnrollmentRate=document.getElementById('PlanInformationStepOneB1_TextBoxAnnualEnrolmentRate')
                 
               
                  if (trim(TextBoxEnrollmentRate.value) == "")
                    {
                        ErrorMessage=ErrorMessage + "\n* Please enter enrollment rate.";
                    } 
                  else if( ReplaceAll((trim(TextBoxEnrollmentRate.value)),",","")==0||ReplaceAll((trim(TextBoxEnrollmentRate.value)),",","")>100)
                    {
                        ErrorMessage=ErrorMessage + "\n* Enrollment rate should be greater than 0 and less than equal to 100."
                    }
                    //Following line aded by Pradeep on 6/3/2008 to check decimall 
                  else if(checkDecimals(ReplaceAll(trim(TextBoxEnrollmentRate.value),",",""),3,2)==false)
                    {
                        ErrorMessage=ErrorMessage + "\n* Please enter valid enrollment rate.";
                    }
                   //---------EndFor---------TextBoxAnnualEnrolmentRate
                 
                 
                   //------StartFor----DropDownTrendRateValue
                  var DropDownTrendRateValue=document.getElementById('PlanInformationStepOneB1_DropDownListFutureTrendRate');  
                  if(DropDownTrendRateValue.value=='0.00')
                    {
                          
                        ErrorMessage=ErrorMessage + "\n* Please select trend rate that will be applied to future years.";
                    }
                  //------EndFor----DropDownTrendRateValue
                  //Check For NoOfPlan should not be 0
                
                  var NoOfPlan=document.getElementById('PlanInformationStepOneB1_TextBoxNoOfPlan');
                  if(NoOfPlan.value=='0')
                    {
                        ErrorMessage=ErrorMessage + "\n* Number of plan can't be 0";
                    }
                 
            
                  var childInputs = document.getElementById(TableNormativeData).getElementsByTagName("input");
                  var count=0;
                      
                  var number=document.getElementById('PlanInformationStepOneB1_TextBoxNoOfPlan'); 
                
                  //Written By Pradeep to handle validation in case of plan number is 1
                  if(number.value=='1')
                   {
                 
                    //var TextBox=document.getElementById('<% = TextBoxPlanName.ClientID %>');
                     var TextBox=document.getElementById('PlanInformationStepOneB1_TextBoxPlanName');
                 
                      if(TextBox==null)
                      {
                      
                        return false;
                      }
                 
                  if(TextBox.value=='')  //Condition also changed accordingly
                  {
                    
                   ErrorMessage=ErrorMessage + "\n* Please fill plan name";
                  }
                 }
                
                 if(number.value=='')
                 {
                 
                  
                  ErrorMessage=ErrorMessage + "\n* Please enter no of plan";
                 }
                 
                 
                
                  var  CheckErrorMsgForTotalEmpEnrolled=0;
                  var CheckErrorMsgForTotalTextBoxPlanName=0;
                  var CheckErrorMsgForTotalAnnualCost=0;
                  var CheckErrorMsgForValidPlaname=0;
                  var CheckErrorMsgForFirstCharAlphabet=0;
                
                
                 if (number.value>1)
                 {
                    // Code Added By Devinder
                    if(document.getElementById('PlanInformationStepOneB1_TableDynamic')==null)
                    {
                         return false;
                    }
                    if (document.getElementById('PlanInformationStepOneB1_TableDynamic').rows.length-1 !=number.value)
                    {                         
                          return false;
                    }
                 
                               
                    for(var i=0;i<childInputs.length;i++)
                    {
                      
                       if(childInputs[i].id.indexOf('TextBoxPlanName')>0)
                          {
                            if(childInputs[i].value!='')
                            {                        
                                //----------
                                       var ValidCompanyName = AllowSpecialCharacters(trim(childInputs[i].value));
                                       if(ValidCompanyName==false)
                                         {
                                        
                                          //ErrorMessage=ErrorMessage + "\n* Please enter valid CompanyName";
                                          CheckErrorMsgForValidPlaname=CheckErrorMsgForValidPlaname+1;
                                         }
                                       else
                                        {
                                            var ValidCompanyName1 = FirstCharacterAlphabet(trim(childInputs[i].value)); 
                                            if(ValidCompanyName1==false)
                                            {
                                                
                                                //ErrorMessage=ErrorMessage + "\n*First character should be Alphabet in Company Name" ;
                                                CheckErrorMsgForFirstCharAlphabet=CheckErrorMsgForFirstCharAlphabet+1;
                                            } 
                                        }
                                //---------
                            }
                            else
                            {
                              
                              //CountTotalTextBoxPlanName=CountTotalTextBoxPlanName+1;
                              CheckErrorMsgForTotalTextBoxPlanName=CheckErrorMsgForTotalTextBoxPlanName+1;
                              
                            }
                          }
                        
                          
                          if(childInputs[i].id.indexOf('TextBoxEmpEnrolled')>0)
                          {
                            
                            if(childInputs[i].value!='')
                            {                        
                            }
                            else
                            {
                              
                             
                              //CheckTotalEmpEnrolled=CheckTotalEmpEnrolled+1;
                              CheckErrorMsgForTotalEmpEnrolled=CheckErrorMsgForTotalEmpEnrolled+1;
                             
                            }
                          }
                         // if(CheckTotalEmpEnrolled>0)
                         // {
                         // ErrorMessage=ErrorMessage + "\n* Please fill all the employee enrolled!";
                          //}
                          
                          
                          if(childInputs[i].id.indexOf('TextBoxTotalAnualCost')>0)
                          {
                            if(childInputs[i].value!='')
                            {                        
                            }
                            else
                            {
                              
                              
                             CheckErrorMsgForTotalAnnualCost=CheckErrorMsgForTotalAnnualCost+1;
                             
                            }
                          }
                          
                    }
                    if( CheckErrorMsgForTotalTextBoxPlanName>0)
                    {
                     ErrorMessage=ErrorMessage + "\n* Please fill  plan name for all plan";
                    }
                  
                    if(CheckErrorMsgForTotalEmpEnrolled>0)
                     {
                         ErrorMessage=ErrorMessage + "\n* Please fill employee enrolled  for all plan";
                     }
                    if(CheckErrorMsgForTotalAnnualCost>0)
                      {
                       ErrorMessage=ErrorMessage + "\n* Please fill  total annual cost for all plan";
                      }
                      
                    //----Following braces is added by Pradeep
                   
                    
                    
                    //*************CheckTotalEmpEnrolled();*************
                    
                    // var hiddenValue=document.getElementById('<% = HiddenFieldNumberOfEligibleEmployees.ClientID %>'); 
                     var hiddenValue=document.getElementById('PlanInformationStepOneB1_HiddenFieldNumberOfEligibleEmployees');
                     //var EnrollmentRate=document.getElementById('<% = TextBoxAnnualEnrolmentRate.ClientID %>'); 
                     var EnrollmentRate=document.getElementById('PlanInformationStepOneB1_TextBoxAnnualEnrolmentRate'); 
                     //var TotalEmpEnrolled=document.getElementById('<% = HiddenFieldTotalEmpEnrolled.ClientID %>');
                     var TotalEmpEnrolled=document.getElementById('PlanInformationStepOneB1_HiddenFieldTotalEmpEnrolled');  

                     var Calc = Math.round((hiddenValue.value* ReplaceAll(EnrollmentRate.value,",",""))/100);
                     
                     
                     if(Calc!= ReplaceAll(TotalEmpEnrolled.value,",",""))
                     {
                        //document.getElementById('<% = LabelErrorMessage.ClientID %>').innerHTML="* Total Employees Enrolled from Grid must match the number of eligible employees * enrollment rate";
                        //return false;
                        ErrorMessage=ErrorMessage + "\n* Total employees enrolled from grid must match the number of eligible employees * enrollment rate";
                     }
                   
                     
                     
                     
                     
                     //var TotalTotAnnualCost=document.getElementById('<% = HiddenFieldTotalAnnualCost.ClientID %>'); 
                     var TotalTotAnnualCost=document.getElementById('PlanInformationStepOneB1_HiddenFieldTotalAnnualCost'); 
                        
                     //var CostInTextBox=document.getElementById('<% = TextBoxLastKnownCost.ClientID %>');
                     var CostInTextBox=document.getElementById('PlanInformationStepOneB1_TextBoxLastKnownCost');
                    
                     if(TotalTotAnnualCost.value!= ReplaceAll( CostInTextBox.value,",","")*1)
                     {
                       
                       // document.getElementById('<% = LabelErrorMessage.ClientID %>').innerHTML="* The sum of the total annual cost from the grid must match the total annual cost (at the top)";
                       // return false;
                       ErrorMessage=ErrorMessage + "\n* The sum of the total annual cost from the grid must match the total annual cost (at the top)";
                     }            
                    //***************************************************
                }
                if(ErrorMessage!="")
                {
               
                 //LabelError=document.getElementById('<% = LabelErrorMessage.ClientID %>');
                 LabelError=document.getElementById('PlanInformationStepOneB1_LabelErrorMessage');
                 SetLabelValue(LabelError,ErrorMessage,true);
                 //document.getElementById('<% = LabelErrorMessage.ClientID %>').innerHTML=ErrorMessage;
                 document.documentElement.scrollTop = 0;
                 return false;
                }
                else
                {
                
                 return true;
                }
           }
          catch(ex)
          {
                
          }
      }
      
      //*****************Function for set cost year for Plan Information step oneB***********
     //This function set the cost year in labels on selection
     //of cost year from dropdown.
    function SetCostYearForPlanInformationStepOneB(DropDown, Label1, Label2)
    {    
        try
        {
            var DisplayLabel=document.getElementById(Label1);
            var DisplayText;
            if(document.getElementById(DropDown).selectedIndex==0)
            {
                DisplayText="____?";
            }
            else
            {
                DisplayText=document.getElementById(DropDown).options[document.getElementById(DropDown).selectedIndex].text+"?";
            }
            SetLabelValue(DisplayLabel,DisplayText,true); 
            DisplayLabel=document.getElementById(Label2);
            SetLabelValue(DisplayLabel,DisplayText,true);
                       
        }
        catch(exception)
        {
       
        }
    }
///*****************************End>>> Function for PlanInformationStepOneB

//************************Start Function for the BP MYAccount*************

//The following function validate Phone number and Fax number on click of update button  and used
 //in BPMyAccount.ascx written by Pradeep on 27/2/08
function ValidateBPMyAccount(TextBoxPhoneNumberClientID,TextBoxFaxNumberClientId,TextBoxFirstNameClientId,TextBoxLastNameClientId,LabelMessage)
 {
   try
       {
         
          PhoneFormatCheckWithExt(TextBoxPhoneNumberClientID);
          flag=PhoneFormatCheck(TextBoxFaxNumberClientId);
          firstupper(document.getElementById(TextBoxFirstNameClientId));
          firstupper(document.getElementById(TextBoxLastNameClientId));
          SetLabelValue(document.getElementById(LabelMessage),"",true);
          
     
       }
   catch(ex)
    {
   
    } 


 }
 
 //************************End Function for the BP MYAccount*************
 //Written By Pradeep on 10/03/2008
 //The following function validate all the fields to the page.
 
 function CheckSecurityQuestionForBPMyAccount(TextBoxPhoneNumberClientID,TextBoxFaxNumberClientId,TextBoxFirstNameClientId,TextBoxLastNameClientId,LabelMessage,DropDownQuestion1,DropDownQuestion2,DropDownQuestion3,BindText1,BindText2,BindText3)
        {
            //Call asp validation on page force fully                                                                                                                                                         
            Page_ClientValidate(); 
            //validate phone,fax,first name,last name and clear the message.                                       
            ValidateBPMyAccount(TextBoxPhoneNumberClientID,TextBoxFaxNumberClientId,TextBoxFirstNameClientId,TextBoxLastNameClientId,LabelMessage) 
            var ErrorMessage="";
                
            var DropDownFirstQuestion=document.getElementById(DropDownQuestion1);
            var DropDownSecondQuestion=document.getElementById(DropDownQuestion2);
            var DropDownThirdQuestion=document.getElementById(DropDownQuestion3);
            var LabelErrorMessageObj=document.getElementById(LabelMessage);
            try
            {
                if(DropDownFirstQuestion==null || DropDownSecondQuestion==null || DropDownThirdQuestion==null)
                {
                    return true;
                }
                
                if(DropDownFirstQuestion.selectedIndex==0)
                {
                   
                    ErrorMessage=ErrorMessage+"Select Security Question 1";
                   
                }
                if(DropDownSecondQuestion.selectedIndex==0)
                {
                    
                    ErrorMessage=ErrorMessage+"\nSelect Security Question 2";
                    
                }
                if(DropDownThirdQuestion.selectedIndex==0)
                {
                    ErrorMessage=ErrorMessage+"\nSelect Security Question 3";
                }
                if(ErrorMessage!="")
                {
                 SetLabelValue(LabelErrorMessageObj,ErrorMessage,true);
                 return false;
                }
                else
                {
                 return true;
                }
             }
                
            catch(e)
            {
            
            }
        }

 //the following function was written by Ankur in Html side of brokerRegistration.ascx
 //shifted here by Pradeep on 5/3/2008
 function ValidateBrokerRegistration(firstname,lastname,cityname,businessfax,businessphone)
   {  
       var flag=false;
       firstupper(document.getElementById(firstname));
       firstupper(document.getElementById(lastname));
       firstupper(document.getElementById(cityname));
       flag= PhoneFormatCheck(businessfax);
       flag= PhoneFormatCheckWithExt(businessphone);
         if(flag==true)
         {
           return true;
       
         }
        else
        {
          return false;   
        }
 
  }
  //the following function was written by Ankur in Html side of NewbrokerRegistration.ascx
 //shifted here by Pradeep on 6/3/2008
  function ValidateNewRegistration(firstname,lastname,cityname,agentname,businessphone,LabelMessage)
{  

       var flag=false;
      firstupper(document.getElementById(firstname));
      firstupper(document.getElementById(lastname));
       firstupper(document.getElementById(cityname));
       firstupper(document.getElementById(agentname));
       flag= PhoneFormatCheckWithExt(businessphone);
       SetLabelValue(document.getElementById(LabelMessage),"",true);
     if(flag==true)
     {
     
       return true;
   
     }
    else
    {
      return false;   
    }
 
}
    
    


           
           

//*************************************** Proposal Detail Step 4 START *******************************************
//Used in Step 4 and 5A
 function ValidationStepFour(SpouseYes,SpouseNo,LabelMessage,Message)
 {
    
     try    
     {
    
        SetLabelValue(document.getElementById(LabelMessage),"",true);
        if(document.getElementById(SpouseYes).checked==true)
        {
            return true;
        }
        if(document.getElementById(SpouseNo).checked==true)
        {
            return true;
        }
        
        SetLabelValue(document.getElementById(LabelMessage),Message,true);
        
      
        
        
        if(document.getElementById('DivPlanStepFiveA')!=null)
        {
           document.getElementById('DivPlanStepFiveA').scrollTop=10000; 
            
        }
        //document.documentElement.scrollTop = 0;
        if(navigator.appName == "Netscape")
        {
         
         // parent.document.documentElement.clientHeight+ "px";
        
        }        
        
        return false;
       
    }
    catch(ex)
    {
 
    return false;
    }
}

//*************************************** Proposal Detail Step 4 END ******************************************* 
//*************************************** FAQ START *******************************************  
    
 
//Function created by Damanpreet on 03rd Dec 2007 to Show the Selected Answer in FAQ Grid    
//function ShowSelectedAnswer(LabelQuestion,LabelAnswer,ImageButtonBlock ,ImageButtonNone)
function ShowSelectedAnswer(LabelQuestion,LabelAnswer)
{
    try
    {
        var grid = document.getElementById('FAQ1_GridViewFAQs');
        var LabelQuestion = document.getElementById(LabelQuestion);
        var LabelAnswer = document.getElementById(LabelAnswer);

        if(LabelQuestion!=null)
        {   
            if(LabelAnswer.style.display == 'block')
            {        
              LabelAnswer.style.display ='none';   
             
              return false;               
            }             
            else
            {
                LabelAnswer.style.display ='block';        
            }
        }
        else
        {
          
        }    
    }
    catch(ex)
    {
   
    }
}

 //*************************************** FAQ END ******************************************* 
 


//Code added by manjeet for Appendix A & B Tab on Proposal Details page
//As on 24 December, 2007
function StopDropDownPostBackAtIndexZero(DropDownId)
{
    try
    {
    var DropDown=document.getElementById(DropDownId);
    if(DropDown.selectedIndex==0)
    {
        return false;
    }
    return true;
    }
    catch(ex)
    {
      
    }
}

/************************************************Five B start********************************************************/
//Created by Manjeet as on 08-01-2008
//Purpose: Validate Plan information Step 2
function ValidateStepFiveB()
{
    try 
    {
        //Page_ClientValidate();
        var control ;
        var strLocalizedErrorMessage="";
        control = document.getElementById('ProposalStepFiveB1_TextBoxSmokeFreeIncentive');    
        if (trim(control.value) == "")
        {
            strLocalizedErrorMessage=strLocalizedErrorMessage + "* Please enter Smoke Free Program Incentive.";
        }
        /*if(checkDecimals(trim(control.value),10,4)==false)
        {
            strLocalizedErrorMessage=strLocalizedErrorMessage + "\n* Please Enter Valid Smoke Free Program Incentive."
        }*/
        control = document.getElementById('ProposalStepFiveB1_TextBoxCorePreventionProgram');  
        if (trim(control.value) == "")
        {
            strLocalizedErrorMessage=strLocalizedErrorMessage + "\n* Please enter Core Prevention Program Incentive.";
        } 
        /*if(checkDecimals(trim(control.value),10,4)==false)
        {
            strLocalizedErrorMessage=strLocalizedErrorMessage + "\n* Please Enter Valid Core Prevention Program Incentive."
        }*/
        control = document.getElementById('ProposalStepFiveB1_TextBoxTargetedRiskProgram');  
        if (trim(control.value) == "")
        {
            strLocalizedErrorMessage=strLocalizedErrorMessage + "\n* Please enter Targeted Risk Program Incentive.";
        } 
       /* if(checkDecimals(trim(control.value),10,4)==false)
        {
            strLocalizedErrorMessage=strLocalizedErrorMessage + "\n* Please Enter Valid Targeted Risk Program Incentive."
        }*/
        if (strLocalizedErrorMessage != "")
        {
            var LabelError=document.getElementById("ProposalStepFiveB1_LabelMessage");
            SetLabelValue(LabelError,strLocalizedErrorMessage,true); 
            document.documentElement.scrollTop = 0;
            
            return false;
        }
        else
        {
            
            return true;
        }
    }
    catch(ex)
    { 
       
    }
}

/************************************************Five B END********************************************************/



 
/* function ShowSaveASProposal(DivControlName,left,top)
 {
    ShowDivASModelPopup(DivControlName,left,top);
    return false;
 }*/
 
 function HideSaveASProposal(DivControlName)
 {
    HideDivASModelPopup(DivControlName);
    return false;
 }
           
           
//*************************************** Proposal Detail Step 1 START *****************************************
    //To validate Proposal Wizard Step One
    //Created BY Damanpreet 
    function ValidationStepOne()
    {
  
        try 
        {
            var control ;
            var control1;
            var controlvalue;
            //var Str="";
            var strLocalizedErrorMessage="";
            control = document.getElementById('ProposalStepOne1_TextBoxProposalsCompanyName');    
            if (trim(control.value) == "")
            {       
                strLocalizedErrorMessage=strLocalizedErrorMessage + "\n* "+ GetLocalizeDataByKey('HiddenLocalizeData','PleaseenterCompanysName');
            }
            else
            {
                var ValidCompanyName = AllowSpecialCharacters(trim(control.value)); 
                if(ValidCompanyName==false)
                {                    
                    strLocalizedErrorMessage=strLocalizedErrorMessage + "\n* " + GetLocalizeDataByKey('HiddenLocalizeData','PleaseentervalidCompanyName');
                }
                else
                {
                    var ValidCompanyName1 = FirstCharacterAlphabet(trim(control.value)); 
                    if(ValidCompanyName1==false)
                    {                        
                        strLocalizedErrorMessage=strLocalizedErrorMessage + "\n* First character should be Alphabet in Company Name" ;
                    } 
                } 
            }

            control = document.getElementById('ProposalStepOne1_TextBoxProposalName');    
            if (trim(control.value) == "")
            {                
                strLocalizedErrorMessage = "* " +GetLocalizeDataByKey('HiddenLocalizeData','PleaseenterProposalName');
            }
            else
            {
                var validProposalName = AllowSpecialCharacters(trim(control.value)); 
                if(validProposalName==false)
                {                    
                    strLocalizedErrorMessage=strLocalizedErrorMessage + "<BR>* "+ GetLocalizeDataByKey('HiddenLocalizeData','PleaseentervalidProposalName');
                }
                else
                {
                    var validProposalName1 = FirstCharacterAlphabet(trim(control.value)); 
                    if(validProposalName1==false)
                    {                       
                        strLocalizedErrorMessage=strLocalizedErrorMessage + "\n* First character should be Alphabet in Proposal Name" ;
                    }
                }  
            }


            var rdo1 = document.getElementById('ProposalStepOne1_RadioButtonProposalsPlanTypeASO');
            var rdo2 = document.getElementById('ProposalStepOne1_RadioButtonProposalsPlanTypeFullyInsured');

            if(rdo1.checked != true)
            {   
                if(rdo2.checked != true)
                {                     
                    strLocalizedErrorMessage=strLocalizedErrorMessage + "<BR>* "+GetLocalizeDataByKey('HiddenLocalizeData','Pleaseenterthecompanysplan');
                }          
            }


            control = document.getElementById('ProposalStepOne1_TextBoxProposalsPlanStartDate');    
            if (trim(control.value) == "")
            {
                strLocalizedErrorMessage=strLocalizedErrorMessage + "<BR>* " + GetLocalizeDataByKey('HiddenLocalizeData','PleaseenterPlanStartDate');
            }
            //Modified by Damanpreet on April 16 2008 to have group medical plan start date greater then 45 days from current date
           /* if(trim(control.value) != "")
            { 
                SetDateFormat(control);                       

                var daysdiffrence = dateDiff(control);
                if(daysdiffrence < 45)
                {
                    strLocalizedErrorMessage=strLocalizedErrorMessage + "\n* " +"Group medical plan Start Date should be greater than 45 days as compare to current Date.";
                }
            }*/

            control = document.getElementById('ProposalStepOne1_TextBoxProposalsNoOfEligibleEmp');    
            if (trim(control.value) == "" )
            {
                strLocalizedErrorMessage=strLocalizedErrorMessage + "<BR>* " + GetLocalizeDataByKey('HiddenLocalizeData','PleaseenterNumberofEligibleemployees');
            }
            if (trim(control.value) == 0)
            {
                strLocalizedErrorMessage=strLocalizedErrorMessage + "<BR>* Number of Eligible employees should be greater than 0.";
            }
            controlvalue = ReplaceAllOccurances(control.value,",","");
            if(isNaN(trim(controlvalue))==true)
            {
                strLocalizedErrorMessage=strLocalizedErrorMessage + "<BR>* " + GetLocalizeDataByKey('HiddenLocalizeData','PleaseentervalidNumberofEligibleemployees');
            }

            control = document.getElementById('ProposalStepOne1_TextBoxProposalsNoOfFaci');    
            if (trim(control.value) == "")
            {
                strLocalizedErrorMessage=strLocalizedErrorMessage + "<BR>* " +GetLocalizeDataByKey('HiddenLocalizeData','PleaseenterNumberoffacilities');
            }
            
            controlvalue = ReplaceAllOccurances(control.value,",","");
            if(isNaN(trim(controlvalue))==true)            
            {
                strLocalizedErrorMessage=strLocalizedErrorMessage + "<BR>* " +GetLocalizeDataByKey('HiddenLocalizeData','PleaseentervalidNumberoffacilities');
            }

            control = document.getElementById('ProposalStepOne1_TextBoxRemoteEmployees');    
            if (trim(control.value) == "")
            {
                strLocalizedErrorMessage=strLocalizedErrorMessage + "<BR>* " +GetLocalizeDataByKey('HiddenLocalizeData','PleaseenterRemoteEmployees');
            }

            controlvalue = ReplaceAllOccurances(control.value,",","");
            if(isNaN(trim(controlvalue))==true)
            {
                strLocalizedErrorMessage=strLocalizedErrorMessage + "<BR>* " +GetLocalizeDataByKey('HiddenLocalizeData','PleaseentervalidNumberoffacilities');
            }
            if(document.getElementById('ProposalStepOne1_DropDownListProposalsGAFId').value == "0")
            {
                strLocalizedErrorMessage=strLocalizedErrorMessage + "\n* " +GetLocalizeDataByKey('HiddenLocalizeData','LocationOfOffice');
            }


            rdo1 = document.getElementById('ProposalStepOne1_RadioButtonEHProgramStartBeforePlanYearYes');
            rdo2 = document.getElementById('ProposalStepOne1_RadioButtonEHProgramStartBeforePlanYearNo');

            if(rdo2.checked != true)
            {
                if(rdo1.checked == true)
                { 
                    control = document.getElementById('ProposalStepOne1_TextBoxEHStartDate'); 
                    control1 = document.getElementById('ProposalStepOne1_TextBoxProposalsPlanStartDate');    
                    if (trim(control.value) == "")
                    {        
                        strLocalizedErrorMessage=strLocalizedErrorMessage + "\n* " + GetLocalizeDataByKey('HiddenLocalizeData','PleaseenterEHStartDate');
                    } 
                    
                    if(trim(control.value) != "")
                    { 
                        SetDateFormat(control);                       

                        var daysdiffrence = dateDiff(control);
                        if(daysdiffrence < 45)
                        {
                            strLocalizedErrorMessage=strLocalizedErrorMessage + "\n* " +GetLocalizeDataByKey('HiddenLocalizeData','BasicCorePreventionProgramStartDate');
                        }
                    }
                    
                   /* if(trim(control.value) != "")
                    { 
                        //Modified by Damanpreet on April 16 2008 to have eh start date less the group medical plan start date
                        SetDateFormat(control);                       
                        SetDateFormat(control1);
                        
                        var daysdiffrence = dateDiff(control);
                        var daysdiffrence1 = dateDiff(control1);
                        
                        if(daysdiffrence1 < daysdiffrence)
                        {
                            strLocalizedErrorMessage=strLocalizedErrorMessage + "\n* " +"EH Plan Start date should be less then group medical plan Start Date.";
                        }
                    }*/
                }
                else if(rdo1.checked != true)
                {
                    strLocalizedErrorMessage=strLocalizedErrorMessage + "\n* If you want to Start Before PlanYear, Please select the option";
                }
            }


            rdo1 = document.getElementById('ProposalStepOne1_RadioButtonQuoteOrActuarialEstimateYes');
            rdo2 = document.getElementById('ProposalStepOne1_RadioButtonQuoteOrActuarialEstimateNo');

            if(rdo1.checked != true)
            {   
                if(rdo2.checked != true)
                { 
                    strLocalizedErrorMessage=strLocalizedErrorMessage + "\n* " +GetLocalizeDataByKey('HiddenLocalizeData','Pleaseselectactuarialestimatefortheannualplancost');
                }  
                else
                {
                    rdo3 = document.getElementById('ProposalStepOne1_RadioButtonUseNormativeDataYes');
                    rdo4 = document.getElementById('ProposalStepOne1_RadioButtonUseNormativeDataNo');
                    if(rdo3.checked != true)
                    {   
                        if(rdo4.checked != true)
                        { 
                            strLocalizedErrorMessage=strLocalizedErrorMessage + "\n* " +GetLocalizeDataByKey('HiddenLocalizeData','Pleaseselecttotalannualcostforanypreviousplanyear');
                        }  
                    } 
                }       
            }

            if (strLocalizedErrorMessage != "")
            {
                var LabelError=document.getElementById("ProposalStepOne1_LabelMessage");
                SetLabelValue(LabelError,strLocalizedErrorMessage,true); 
                document.documentElement.scrollTop = 0;               
                return false;
            }
            else
            {
                return true;
            }
        }
        catch(ex)
        { 
        
        }
    }
    
    //To hide and show the Div in Proposal Wizard Step One
    //Created BY Damanpreet
    function HideNShow(status,TACntrl1,TACntrl2,TACntrl3)
    {  
        try
        {           
            var control1,control2,control3; 
            
            control1 = document.getElementById(TACntrl1); 
            control2 = document.getElementById(TACntrl2);           
            control3 = document.getElementById(TACntrl3);           

            if(status == "Y")
            {       
                control1.style.display ='none';                
                control2.style.display ='none'; 
                control3.style.display ='none';               
            }

            if(status == "N")
            {     
                control1.style.display ='block';               
                control2.style.display ='block';
                control3.style.display ='block';                
            }
        }
        catch(ex)
        {
       
        }
    }   
    //Function to set default Proposal Name on Change of CompanyName
    //Created by Damanpreet on Dec 17 2007
    function SetDefaultProposalName(TxtCompanyName,TxtProposalName)
    {
        try
        {   
            HoldDate=new Date();
            var HoldDate1 = HoldDate.getDate();
            var HoldMonth = (HoldDate.getMonth()+1);
            var HoldYear  = HoldDate.getYear();

            // Y2K compliant
            if (HoldYear < 1000) HoldYear +=1900;

            if(TxtCompanyName != null)
            {
                if(trim(TxtCompanyName.value) != '')
                {
                    if(trim(TxtProposalName.value) == '')
                    {
                        //Defaults to Company Name + [date... e.g. 23-07-2008]
                        TxtProposalName.value = trim(TxtCompanyName.value) + ' '  + HoldMonth + "-" + HoldDate1 + "-" + HoldYear ;
                        TxtCompanyName.value = trim(TxtCompanyName.value) 
                        return false;
                    }
                }
            }
            else
            {
            
            }
        }
        catch(ex)
        {
          
        }
    }
//*************************************** Proposal Detail Step 1 END *******************************************
//*************************************** Proposal Detail Step 2A and 2B start *******************************************

    //To Alert the user on change of Final Annual cost in Proposal Wizard Step Two
    //Created BY Damanpreet
    function ChangeFinalAnnualCost(TxtTotalAnnualCost,HiddenPreviousTotalAnnualCost,HiddenFinalAnnualCost,LabelNoOfPlans)
    {
    try
    {    
        var TotalAnnualCost =TxtTotalAnnualCost;
        var PreviousTotalAnnualCost =document.getElementById(HiddenPreviousTotalAnnualCost);
        var FinalAnnualCost = document.getElementById(HiddenFinalAnnualCost);
        var NoOfPlans = document.getElementById(LabelNoOfPlans);
        var CountOfNoOfPlans =  GetLabelValue(NoOfPlans);
        var StrLocalizedMessage="";
        var trimTotalAnnualCostvalue =TotalAnnualCost.value;
        var trimPreviousTotalAnnualCostvalue =PreviousTotalAnnualCost.value;
        var trimFinalAnnualCostvalue =FinalAnnualCost.value;
    
        ValidDecimal(TotalAnnualCost); 
         trimTotalAnnualCostvalue = ReplaceAllOccurances(trimTotalAnnualCostvalue,",","");   
            trimTotalAnnualCostvalue = ReplaceAllOccurances(trimTotalAnnualCostvalue,"$",""); 
            for(var i=0;i<trimTotalAnnualCostvalue.length;i++)
              {               
                if(trimTotalAnnualCostvalue.charAt(i)=='$' )
                {
                    trimTotalAnnualCostvalue = trimTotalAnnualCostvalue.replace("$","");            
                }              
             }  
         trimPreviousTotalAnnualCostvalue = ReplaceAllOccurances(trimPreviousTotalAnnualCostvalue,",","");
            trimPreviousTotalAnnualCostvalue = ReplaceAllOccurances(trimPreviousTotalAnnualCostvalue ,"$","");
            for(var i=0;i<trimPreviousTotalAnnualCostvalue.length;i++)
              {               
                if(trimPreviousTotalAnnualCostvalue.charAt(i)=='$' )
                {
                    trimPreviousTotalAnnualCostvalue = trimPreviousTotalAnnualCostvalue.replace("$","");            
                }              
             }
          trimFinalAnnualCostvalue = ReplaceAllOccurances(trimFinalAnnualCostvalue,",","");     
            trimFinalAnnualCostvalue = ReplaceAllOccurances(trimFinalAnnualCostvalue,"$","");  
            for(var i=0;i<trimFinalAnnualCostvalue.length;i++)
              {               
                if(trimFinalAnnualCostvalue.charAt(i)=='$' )
                {
                    trimFinalAnnualCostvalue = trimFinalAnnualCostvalue.replace("$","");            
                }              
             }           
        var CountOfNoOfPlansvalue = ReplaceAllOccurances(trim(CountOfNoOfPlans),",",""); 
            CountOfNoOfPlansvalue = ReplaceAllOccurances(trim(CountOfNoOfPlansvalue),"$","");
            for(var i=0;i<CountOfNoOfPlansvalue.length;i++)
              {               
                if(CountOfNoOfPlansvalue.charAt(i)=='$' )
                {
                    CountOfNoOfPlansvalue = CountOfNoOfPlansvalue.replace("$","");            
                }              
             }        
        if(NoOfPlans != null)
        {
            if(trim(CountOfNoOfPlansvalue) > 1 )
            {
                if(TotalAnnualCost != null ||FinalAnnualCost !=null)
                {
                    if(parseFloat(trimTotalAnnualCostvalue)!=parseFloat(trimPreviousTotalAnnualCostvalue))
                    {     
                        if(parseFloat(trimTotalAnnualCostvalue) > parseFloat(trimPreviousTotalAnnualCostvalue))
                        {
                            var diffTotalAnnualCost = parseFloat(trimTotalAnnualCostvalue) - parseFloat(trimPreviousTotalAnnualCostvalue);
                            var NewFinalAnnualCost = parseFloat(trimFinalAnnualCostvalue) + parseFloat(diffTotalAnnualCost);                
                            NewFinalAnnualCost = formatNumber(NewFinalAnnualCost,2,',' , '.','$','','-','')
                        }
                        if(parseFloat(trimTotalAnnualCostvalue) < parseFloat(trimPreviousTotalAnnualCostvalue))
                        {
                            var diffTotalAnnualCost = parseFloat(trimPreviousTotalAnnualCostvalue) - parseFloat(trimTotalAnnualCostvalue);
                            var NewFinalAnnualCost = parseFloat(trimFinalAnnualCostvalue) - parseFloat(diffTotalAnnualCost);   
                            NewFinalAnnualCost = formatNumber(NewFinalAnnualCost,2,',' , '.','$','','-','')
                        }
                        StrLocalizedMessage = "Changing the plan cost will change the total annual cost for the company to" +" "+ NewFinalAnnualCost +" .";
                    }
                    TotalAnnualCost.value = formatNumber(trimTotalAnnualCostvalue,2,',' , '.','$','','-','') 
                    if (StrLocalizedMessage != "")
                    {        
                        alert(StrLocalizedMessage);
                        return false;
                    }
                }
           } 
              TotalAnnualCost.value = formatNumber(trimTotalAnnualCostvalue,2,',' , '.','$','','-','') 
        }
     }
     catch(ex)
     {
     
     }     
    }


//    function getTotalPlanCostDerivedfromGrid(R1,R2,R3,R4,LBProposalTotPlanCost)
//Function modified by Damanpreet on Dec 17 2007
// function getTotalPlanCostDerivedfromGrid(EETotal,R1,EESpouseTotal,R2,EEChildTotal,R3,FamilyTotal,R4,LBProposalTotPlanCost,LblTotalEmployeesEnteredInGridCount,HiddenFieldTotAnnCost,HiddenFieldNumOfEnrEmp)

//Function modified by Damanpreet on Feb 04 2008 acc to visio 19
// To have the Total Plan cost,Percentage onblur of Textboxes
 function getTotalPlanCostDerivedfromGrid(EEEmp,EETotal,EESpouse,EESpouseTotal,EEChild,EEChildTotal,Family,FamilyTotal,LBProposalTotPlanCost,LblTotalEmployeesEnteredInGridCount,HiddenFieldTotAnnCost,HiddenFieldNumOfEnrEmp,
                                          TxtBxEEOnlyEmpContr,TxtBxEESpouseEmpContr,TxtBxEEChildEmpContr,TxtBxFamilyEmpContr,LblEEOnlyEmployeePerc,LblEESpouseEmployeePerc,LblEEChildEmployeePerc,LblFamilyEmployeePerc,control)
    {
    try
    { 

        if(control == EEEmp || control == EESpouse || control == EEChild || control == Family )
        {
            ValidInteger(control);
        }
        else
        {
            ValidDecimal(control);
        }
        
        var Sum = 0;
        var SumTemp1 = 0;
        var SumTemp2 = 0;
        var SumTemp3 = 0;
        var SumTemp4 = 0;
       // var control ;
       // control = document.getElementById(TBProposalTotPlanCost);  
        
        var EEEmpvalue = ReplaceAllOccurances(trim(EEEmp.value),",","");
        for(var i=0;i<EEEmpvalue.length;i++)
        {               
            if(EEEmpvalue.charAt(i)=='$' )
            {
            EEEmpvalue = EEEmpvalue.replace("$","");            
            }              
        }  
        var EESpousevalue = ReplaceAllOccurances(trim(EESpouse.value),",","");
        for(var i=0;i<EESpousevalue.length;i++)
        {               
            if(EESpousevalue.charAt(i)=='$' )
            {
            EESpousevalue = EESpousevalue.replace("$","");            
            }              
        }  
        var EEChildvalue = ReplaceAllOccurances(trim(EEChild.value),",","");
        for(var i=0;i<EEChildvalue.length;i++)
        {               
            if(EEChildvalue.charAt(i)=='$' )
            {
            EEChildvalue = EEChildvalue.replace("$","");            
            }              
        }  
        var Familyvalue = ReplaceAllOccurances(trim(Family.value),",","");
        for(var i=0;i<Familyvalue.length;i++)
        {               
            if(Familyvalue.charAt(i)=='$' )
            {
            Familyvalue = Familyvalue.replace("$","");            
            }              
        }  
/***************************************************/

        var EETotalvalue = ReplaceAllOccurances(trim(EETotal.value),",","");
        for(var i=0;i<EETotalvalue.length;i++)
        {               
            if(EETotalvalue.charAt(i)=='$' )
            {
            EETotalvalue = EETotalvalue.replace("$","");            
            }              
        }  
        var EESpouseTotalvalue = ReplaceAllOccurances(trim(EESpouseTotal.value),",","");
        for(var i=0;i<EESpouseTotalvalue.length;i++)
        {               
            if(EESpouseTotalvalue.charAt(i)=='$' )
            {
            EESpouseTotalvalue = EESpouseTotalvalue.replace("$","");            
            }              
        }  
        var EEChildTotalvalue = ReplaceAllOccurances(trim(EEChildTotal.value),",","");
        for(var i=0;i<EEChildTotalvalue.length;i++)
        {               
            if(EEChildTotalvalue.charAt(i)=='$' )
            {
            EEChildTotalvalue = EEChildTotalvalue.replace("$","");            
            }              
        }  
        var FamilyTotalvalue = ReplaceAllOccurances(trim(FamilyTotal.value),",","");
        for(var i=0;i<FamilyTotalvalue.length;i++)
        {               
            if(FamilyTotalvalue.charAt(i)=='$' )
            {
            FamilyTotalvalue = FamilyTotalvalue.replace("$","");            
            }              
        } 
/**********************************************/
        var TxtBxEEOnlyEmpContrvalue = ReplaceAllOccurances(trim(TxtBxEEOnlyEmpContr.value),",","");
        for(var i=0;i<TxtBxEEOnlyEmpContrvalue.length;i++)
        {               
            if(TxtBxEEOnlyEmpContrvalue.charAt(i)=='$' )
            {
            TxtBxEEOnlyEmpContrvalue = TxtBxEEOnlyEmpContrvalue.replace("$","");            
            }              
        }  
        var TxtBxEESpouseEmpContrvalue = ReplaceAllOccurances(TxtBxEESpouseEmpContr.value,",","");
        for(var i=0;i<TxtBxEESpouseEmpContrvalue.length;i++)
        {               
            if(TxtBxEESpouseEmpContrvalue.charAt(i)=='$' )
            {
            TxtBxEESpouseEmpContrvalue = TxtBxEESpouseEmpContrvalue.replace("$","");            
            }              
        }  
        var TxtBxEEChildEmpContrvalue = ReplaceAllOccurances(TxtBxEEChildEmpContr.value,",","");
        for(var i=0;i<TxtBxEEChildEmpContrvalue.length;i++)
        {               
            if(TxtBxEEChildEmpContrvalue.charAt(i)=='$' )
            {
            TxtBxEEChildEmpContrvalue = TxtBxEEChildEmpContrvalue.replace("$","");            
            }              
        }  
        var TxtBxFamilyEmpContrvalue = ReplaceAllOccurances(TxtBxFamilyEmpContr.value,",","");
        for(var i=0;i<TxtBxFamilyEmpContrvalue.length;i++)
        {               
            if(TxtBxFamilyEmpContrvalue.charAt(i)=='$' )
            {
            TxtBxFamilyEmpContrvalue = TxtBxFamilyEmpContrvalue.replace("$","");            
            }              
        }   
       
        var LabelEEOnlyEmployeePerc = document.getElementById(LblEEOnlyEmployeePerc);
        var LabelEESpouseEmployeePerc = document.getElementById(LblEESpouseEmployeePerc);
        var LabelEEChildEmployeePerc = document.getElementById(LblEEChildEmployeePerc);
        var LabelFamilyEmployeePerc = document.getElementById(LblFamilyEmployeePerc);
        /*****************************************/
           
        if(parseFloat(TxtBxEEOnlyEmpContrvalue) > 0 && TxtBxEEOnlyEmpContrvalue != "" && parseFloat(EETotalvalue) > 0 && EETotalvalue != "")
        {
            var LblEEOnlyEmployeePercvalue = ((100 * parseFloat(TxtBxEEOnlyEmpContrvalue))/parseFloat(EETotalvalue))
            //LabelEEOnlyEmployeePerc.value = formatNumber(LblEEOnlyEmployeePercvalue,2,',' , '.','','%','-','')
            SetLabelValue(LabelEEOnlyEmployeePerc,formatNumber(LblEEOnlyEmployeePercvalue,2,',' , '.','','%','-',''),true)   
        }
        else
        {
            SetLabelValue(LabelEEOnlyEmployeePerc,"0.00%",true)   
        }
        if(parseFloat(TxtBxEESpouseEmpContrvalue) > 0 && TxtBxEESpouseEmpContrvalue != "" && parseFloat(EESpouseTotalvalue) > 0 && EESpouseTotalvalue != "")
        {
            var LblEESpouseEmployeePercvalue = ((100 * parseFloat(TxtBxEESpouseEmpContrvalue))/parseFloat(EESpouseTotalvalue))
             SetLabelValue(LabelEESpouseEmployeePerc,formatNumber(LblEESpouseEmployeePercvalue,2,',' , '.','','%','-',''),true)
        }
        else
        {
            SetLabelValue(LabelEESpouseEmployeePerc,"0.00%",true)   
        }
        if(parseFloat(TxtBxEEChildEmpContrvalue) > 0 && TxtBxEEChildEmpContrvalue != "" && parseFloat(EEChildTotalvalue) > 0 && EEChildTotalvalue != "")
        {
            var LblEEChildEmployeePercvalue = ((100 * parseFloat(TxtBxEEChildEmpContrvalue))/parseFloat(EEChildTotalvalue))
            SetLabelValue(LabelEEChildEmployeePerc,formatNumber(LblEEChildEmployeePercvalue,2,',' , '.','','%','-',''),true)
        }
        else
        {
            SetLabelValue(LabelEEChildEmployeePerc,"0.00%",true)   
        }
        if(parseFloat(TxtBxFamilyEmpContrvalue) > 0 && TxtBxFamilyEmpContrvalue != "" && parseFloat(FamilyTotalvalue) > 0  && FamilyTotalvalue != "")
        {
            var LblFamilyEmployeePercvalue = ((100 * parseFloat(TxtBxFamilyEmpContrvalue))/parseFloat(FamilyTotalvalue))
            SetLabelValue(LabelFamilyEmployeePerc,formatNumber(LblFamilyEmployeePercvalue,2,',' , '.','','%','-',''),true)
        }
        else
        {
            SetLabelValue(LabelFamilyEmployeePerc,"0.00%",true)   
        }         

        /*****************************************/ 
        
//        EEEmpvalue = ReplaceAllOccurances(EEEmp.value,"$","");
//        EESpousevalue = ReplaceAllOccurances(EESpouse.value,"$","");
//        EEChildvalue = ReplaceAllOccurances(EEChild.value,"$","");
//        Familyvalue = ReplaceAllOccurances(Family.value,"$","");
//        
//        EETotalvalue = ReplaceAllOccurances(EETotalvalue,"$","");
//        EESpouseTotalvalue = ReplaceAllOccurances(EESpouseTotalvalue,"$","");
//        EEChildTotalvalue = ReplaceAllOccurances(EEChildTotalvalue,"$","");
//        FamilyTotalvalue = ReplaceAllOccurances(FamilyTotalvalue,"$","");

        //First Row
            if(isNaN(trim(EEEmpvalue))== false && trim(EEEmpvalue)!= "")
          { 
           SumTemp1 = parseFloat(SumTemp1) + (12 * parseFloat(EEEmpvalue)) ;          
          } 
           if(isNaN(trim(EETotalvalue))== false && trim(EETotalvalue)!= "")
          { 
           SumTemp1 = parseFloat(SumTemp1) * parseFloat(EETotalvalue) ;          
          }         
          
           if(isNaN(trim(EESpousevalue))== false && trim(EESpousevalue)!= "")
          { 
           SumTemp2 = parseFloat(SumTemp2) + (12 * parseFloat(EESpousevalue)) ;           
          }
          if(isNaN(trim(EESpouseTotalvalue))== false && trim(EESpouseTotalvalue)!= "")
          { 
           SumTemp2 = parseFloat(SumTemp2) * parseFloat(EESpouseTotalvalue);
          }           
          
          if(isNaN(trim(EEChildvalue))==false && trim(EEChildvalue)!= "")
          { 
           SumTemp3 = parseFloat(SumTemp3) + (12 * parseFloat(EEChildvalue)) ;
          } 
          if(isNaN(trim(EEChildTotalvalue))== false && trim(EEChildTotalvalue)!= "")
          { 
           SumTemp3 = parseFloat(SumTemp3) * parseFloat(EEChildTotalvalue);
          }           
          
           if(isNaN(trim(Familyvalue))==false && trim(Familyvalue)!= "")
          { 
           SumTemp4 = parseFloat(SumTemp4) + (12 * parseFloat(Familyvalue)) ;
          }           
          if(isNaN(trim(FamilyTotalvalue))== false && trim(FamilyTotalvalue)!= "")
          { 
           SumTemp4 = parseFloat(SumTemp4) * parseFloat(FamilyTotalvalue);          
          }
          
                    //TBProposalTotPlanCost.value = Sum.toFixed(2); 
           //SetLabelValue(LBProposalTotPlanCost,Sum.toFixed(2))   
           
           Sum = parseFloat(SumTemp1) + parseFloat(SumTemp2) + parseFloat(SumTemp3) + parseFloat(SumTemp4);
           
          
           
           var HiddenFieldTotAnnCostId = document.getElementById(HiddenFieldTotAnnCost);
           HiddenFieldTotAnnCostId.value =Sum; //Math.round(Sum);
           if(Sum == 0)
           {
                SetLabelValue(document.getElementById(LBProposalTotPlanCost),'$0.00',true) 
           }
           else
           {
                SetLabelValue(document.getElementById(LBProposalTotPlanCost),formatNumber(Sum,2,',' , '.','$','','-',''),true) 
           }  

           //************************************
           var SumTotEmpIngrid = 0;
            var control ;     
          
           
            var TextBoxProposalsEEOnlyEmployees=EEEmp;//EEEmp;
            var TextBoxProposalsEESpouseEmployees=EESpouse;//EESpouse;
            var TextBoxProposalsEEChildEmployees=EEChild;//EEChild;
            var TextBoxProposalsFamilyEmployees=Family;//Family;
            
            var EEOnlyEmployeesvalue = ReplaceAllOccurances(TextBoxProposalsEEOnlyEmployees.value,",","");//EEEmp;
            var EESpouseEmployeesvalue = ReplaceAllOccurances(TextBoxProposalsEESpouseEmployees.value,",","");//EESpouse;
            var EEChildEmployeesvalue = ReplaceAllOccurances(TextBoxProposalsEEChildEmployees.value,",","");//EEChild;
            var FamilyEmployeesvalue = ReplaceAllOccurances(TextBoxProposalsFamilyEmployees.value,",","");//Family;
            
            var LabelProposalTotEmpIngrid= document.getElementById( LblTotalEmployeesEnteredInGridCount);
           
             if(isNaN(trim(EEOnlyEmployeesvalue))== false && trim(EEOnlyEmployeesvalue)!= "")
              { 
               SumTotEmpIngrid = parseFloat(SumTotEmpIngrid) + parseFloat(EEOnlyEmployeesvalue) ;              
              }          
               if(isNaN(trim(EESpouseEmployeesvalue))== false && trim(EESpouseEmployeesvalue)!= "")
              { 
               SumTotEmpIngrid = parseFloat(SumTotEmpIngrid) + parseFloat(EESpouseEmployeesvalue) ;           
              }
              
              if(isNaN(trim(EEChildEmployeesvalue))==false && trim(EEChildEmployeesvalue)!= "")
              { 
               SumTotEmpIngrid = parseFloat(SumTotEmpIngrid) + parseFloat(EEChildEmployeesvalue) ;
              }
               if(isNaN(trim(FamilyEmployeesvalue))==false && trim(FamilyEmployeesvalue)!= "")
              { 
               SumTotEmpIngrid = parseFloat(SumTotEmpIngrid) + parseFloat(FamilyEmployeesvalue) ;
              }             
              
               var HiddenFieldNumOfEnrEmpId = document.getElementById(HiddenFieldNumOfEnrEmp);
            
              HiddenFieldNumOfEnrEmpId.value = Math.round(SumTotEmpIngrid);   
              
            if(Math.round(SumTotEmpIngrid) == 0)
            {
            SetLabelValue(LabelProposalTotEmpIngrid,'0',true) 
            }
            else
            {
            SetLabelValue(LabelProposalTotEmpIngrid,formatNumber(Math.round(SumTotEmpIngrid),0,',' , ' ','','','-',''),true)
            }  
              
           // SetLabelValue(LabelProposalTotEmpIngrid,formatNumber(Math.round(SumTotEmpIngrid),0,',' , ' ','','','-',''),true)
              
            
           //************************************
        }
        catch(ex)
        {
         
        }
    } 
    
    //To validate Proposal Wizard Step Two A and Two B
    //Created BY Damanpreet
    function ValidationStepTwoAandTwoB(EEEmId,EEOnlyEmpContId,EEOnlyTotalContId,EESpouseEmpId,EESpouseEmpContId,EESpouseTotalContId,
                            EEChildEmpId,EEChildEmpContId,EEChildTotalContId,FamilyEmpId,FamilyEmplContId,FamilyTotalContId,
                            LabelTotPlanCostFromGrid,LabelTotEnrEmyFromGrid,LabelErrorMessage,TxtTotPlanCost,LabelTotEnrEmy)
{
    try
    {        
        var StrLocalizedMessage = "";
        var StrLocalizedMessageValue = "";
        var EEEmp=EEEmId;        
        var EEOnlyEmpCont = EEOnlyEmpContId;
        var EEOnlyTotalCont = EEOnlyTotalContId;
        var EESpouseEmp = EESpouseEmpId;
        var EESpouseEmpCont = EESpouseEmpContId;
        var EESpouseTotalCont = EESpouseTotalContId;
        var EEChildEmp = EEChildEmpId;
        var EEChildEmpCont = EEChildEmpContId;
        var EEChildTotalCont = EEChildTotalContId;
        var FamilyEmp = FamilyEmpId;
        var FamilyEmplCont = FamilyEmplContId;
        var FamilyTotalCont = FamilyTotalContId;  
        
        var EEEmpvalue = ReplaceAllOccurances(EEEmp.value,",","");        
        var EEOnlyEmpContvalue = ReplaceAllOccurances(EEOnlyEmpCont.value,",","");   
        var EEOnlyTotalContvalue = ReplaceAllOccurances(EEOnlyTotalCont.value,",","");   
        var EESpouseEmpvalue = ReplaceAllOccurances(EESpouseEmp.value,",","");   
        var EESpouseEmpContvalue = ReplaceAllOccurances(EESpouseEmpCont.value,",","");   
        var EESpouseTotalContvalue = ReplaceAllOccurances(EESpouseTotalCont.value,",","");   
        var EEChildEmpvalue = ReplaceAllOccurances(EEChildEmp.value,",","");   
        var EEChildEmpContvalue = ReplaceAllOccurances(EEChildEmpCont.value,",","");   
        var EEChildTotalContvalue = ReplaceAllOccurances(EEChildTotalCont.value,",","");   
        var FamilyEmpvalue = ReplaceAllOccurances(FamilyEmp.value,",","");   
        var FamilyEmplContvalue = ReplaceAllOccurances(FamilyEmplCont.value,",","");   
        var FamilyTotalContvalue = ReplaceAllOccurances(FamilyTotalCont.value,",","");
        
        var BindTextEmployee ="Monthly $ Employee Contribution for Employee Only";
        var BindTextTotalEmployee ="Monthly Total Contribution for  Employee Only";
        var BindTextSpouse ="Monthly $ Employee Contribution for Employee + Spouse";
        var BindTextTotalSpouse ="Monthly Total Contribution for Employee + Spouse";

        var BindTextChild ="Monthly $ Employee Contribution for Employee +  Child(ren)";
        var BindTextTotalChild ="Monthly Total Contribution for Employee +  Child(ren)";
        var BindTextFamily ="Monthly $ Employee Contribution for Family";
        var BindTextTotalFamily ="Monthly Total Contribution for Family";        
       
        var LabelProposalTotEnrEmyFromGrid= document.getElementById(LabelTotEnrEmyFromGrid);
        var LabelProposalTotEnrEmyFromGridValue = GetLabelValue(LabelProposalTotEnrEmyFromGrid);
        var LabelProposalTotEnrEmy=document.getElementById(LabelTotEnrEmy);// document.getElementById('ProposalStepTwoA2_TextBoxTotalEmployeesEnteredForPlansValue');
        var LabelProposalTotEnrEmyValue = GetLabelValue(LabelProposalTotEnrEmy); //TextBoxProposalTotEnrEmy.value;

        var LabelProposalTotPlanCostFromGrid= document.getElementById(LabelTotPlanCostFromGrid);
        var LabelProposalTotPlanCostFromGridValue = GetLabelValue(LabelProposalTotPlanCostFromGrid);
        var TextBoxProposalTotPlanCost=TxtTotPlanCost;// document.getElementById('ProposalStepTwoA2_TextBoxTotalAnnualCostValue');
        var TextBoxProposalTotPlanCostValue = TextBoxProposalTotPlanCost.value;
        
        if(EEEmp != null && EEOnlyEmpContId != null && EEOnlyTotalContId != null && EESpouseEmpId != null && EESpouseEmpContId != null && EESpouseTotalContId != null && EEChildEmpId != null && EEChildEmpContId != null && EEChildTotalContId != null && FamilyEmpId != null && FamilyEmplContId != null && FamilyTotalContId != null )
        {
            if(EEEmpvalue == "" || EEOnlyEmpContvalue == "" || EEOnlyTotalContvalue == "" || EESpouseEmpvalue == "" || EESpouseEmpContvalue == "" || EESpouseTotalContvalue == "" || EEChildEmpvalue == "" || EEChildEmpContvalue == "" || EEChildTotalContvalue == "" || FamilyEmpvalue == "" || FamilyEmplContvalue == "" || FamilyTotalContvalue == "" )
            {
               StrLocalizedMessage=StrLocalizedMessage + "\n* All fields in grid are required." +"(If you don´t know, use an estimate or enter '0'.)";
            }
            if (StrLocalizedMessage != "")
            {
                var LabelError=document.getElementById(LabelErrorMessage);
                SetLabelValue(LabelError,StrLocalizedMessage,true); 
                return false;
            }
        }        
        if(EEEmp != null || EEOnlyEmpContId != null || EEOnlyTotalContId != null || EESpouseEmpId != null || EESpouseEmpContId != null || EESpouseTotalContId != null || EEChildEmpId != null || EEChildEmpContId != null && EEChildTotalContId != null || FamilyEmpId != null || FamilyEmplContId != null || FamilyTotalContId != null )
        {            

            for(var i=0;i<LabelProposalTotPlanCostFromGridValue.length;i++)
            {
                if(LabelProposalTotPlanCostFromGridValue.charAt(i)==',' )
                {
                    LabelProposalTotPlanCostFromGridValue=  LabelProposalTotPlanCostFromGridValue.replace(",","");            
                } 
                if(LabelProposalTotPlanCostFromGridValue.charAt(i)=='$' )
                {
                    LabelProposalTotPlanCostFromGridValue=  LabelProposalTotPlanCostFromGridValue.replace("$","");            
                }              
            }
            for(var i=0;i<TextBoxProposalTotPlanCostValue.length;i++)
            {
                if(TextBoxProposalTotPlanCostValue.charAt(i)==',' )
                {
                    TextBoxProposalTotPlanCostValue=  TextBoxProposalTotPlanCostValue.replace(",","");            
                } 
                if(TextBoxProposalTotPlanCostValue.charAt(i)=='$' )
                {
                    TextBoxProposalTotPlanCostValue=  TextBoxProposalTotPlanCostValue.replace("$","");            
                }              
            }
        /********************************/  
            if(trim(EEEmpvalue) != '')
            {           
                if(isNaN(trim(EEEmpvalue))==true)
                {       
                    StrLocalizedMessage=StrLocalizedMessage + "<BR>* Please enter valid # of Employees in each Tier";
                }
                else if(checkDecimals(trim(EEEmpvalue),7,0)==false)
                {
                    StrLocalizedMessage=StrLocalizedMessage + "<BR>* Please enter valid # of Employees in each Tier";
                }
            }            
            StrLocalizedMessageValue = CheckEmployeeContibution(EEOnlyEmpContvalue,EEOnlyTotalContvalue,BindTextEmployee,BindTextTotalEmployee) 
            
             StrLocalizedMessage = StrLocalizedMessage + StrLocalizedMessageValue;       
            /********************************/ 
            if(trim(EESpouseEmpvalue) != '')
            {
                if(isNaN(trim(EESpouseEmpvalue))==true)
                {       
                    StrLocalizedMessage=StrLocalizedMessage + "<BR>* Please enter valid # of Employee + Spouse in each Tier";
                }
                else if(checkDecimals(trim(EESpouseEmpvalue),7,0)==false)
                {
                    StrLocalizedMessage=StrLocalizedMessage + "<BR>* Please enter valid # of Employee + Spouse in each Tier";
                }
            }            
            StrLocalizedMessageValue = CheckEmployeeContibution(EESpouseEmpContvalue,EESpouseTotalContvalue,BindTextSpouse,BindTextTotalSpouse)
            StrLocalizedMessage = StrLocalizedMessage + StrLocalizedMessageValue;
            /********************************/    
            if(trim(EEChildEmpvalue) != '')
            {
                if(isNaN(trim(EEChildEmpvalue))==true)
                {       
                    StrLocalizedMessage=StrLocalizedMessage + "<BR>* Please enter valid # of Employee + Child(ren) in each Tier";
                }
                else if(checkDecimals(trim(EEChildEmpvalue),7,0)==false)
                {
                    StrLocalizedMessage=StrLocalizedMessage + "<BR>* Please enter valid # of Employee + Child(ren) in each Tier";
                }
            }        
            
            StrLocalizedMessageValue = CheckEmployeeContibution(EEChildEmpContvalue,EEChildTotalContvalue,BindTextChild,BindTextTotalChild)
            StrLocalizedMessage = StrLocalizedMessage + StrLocalizedMessageValue;
            /********************************/ 
            if(trim(FamilyEmpvalue) != '')
            {  
                if(isNaN(trim(FamilyEmpvalue))==true)
                {       
                    StrLocalizedMessage=StrLocalizedMessage + "<BR>* Please enter valid # of Family in each Tier";
                }
                else if(checkDecimals(trim(FamilyEmpvalue),7,0)==false)
                {
                    StrLocalizedMessage=StrLocalizedMessage + "<BR>* Please enter valid # of Family in each Tier";
                }  
            }    
            
            StrLocalizedMessageValue = CheckEmployeeContibution(FamilyEmplContvalue,FamilyTotalContvalue,BindTextFamily,BindTextTotalFamily)
            StrLocalizedMessage = StrLocalizedMessage + StrLocalizedMessageValue; 
            /********************************/  
            if(trim(TextBoxProposalTotPlanCostValue) != '')
            { 
                if(isNaN(trim(TextBoxProposalTotPlanCostValue))==true)
                {       
                    StrLocalizedMessage=StrLocalizedMessage + "<BR>* Please enter valid Total cost for Plan";
                }
                else if(checkDecimals(trim(TextBoxProposalTotPlanCostValue),14,4)==false)
                {
                    StrLocalizedMessage=StrLocalizedMessage + "<BR>* Please enter valid Total cost for Plan";
                }  
            }         
            if (StrLocalizedMessage != "")
            {
            var LabelError=document.getElementById(LabelErrorMessage);
            SetLabelValue(LabelError,StrLocalizedMessage,true); 
            return false;
            }            
        }            
        if(parseFloat(TextBoxProposalTotPlanCostValue)!=parseFloat(LabelProposalTotPlanCostFromGridValue))
        {    
                StrLocalizedMessage="* The total of the monthly total contribution by tier does not add up to the total annual cost of the plan. Please make sure that both of these numbers are the same.\n";
        }
        
            for(var i=0;i<LabelProposalTotEnrEmyValue.length;i++)
            {
                if(LabelProposalTotEnrEmyValue.charAt(i)==',' )
                {
                    LabelProposalTotEnrEmyValue=  LabelProposalTotEnrEmyValue.replace(",","");            
                }                              
            }
            for(var i=0;i<LabelProposalTotEnrEmyFromGridValue.length;i++)
            {
                if(LabelProposalTotEnrEmyFromGridValue.charAt(i)==',' )
                {
                    LabelProposalTotEnrEmyFromGridValue=  LabelProposalTotEnrEmyFromGridValue.replace(",","");            
                }                             
            }
        
        if (parseFloat(LabelProposalTotEnrEmyValue)!=parseFloat(LabelProposalTotEnrEmyFromGridValue))
        {           
            StrLocalizedMessage=StrLocalizedMessage + "\n* The total of the number of employees by tier does not add up to the total enrolled in the plan. Please make sure that both of these numbers are the same.";
        }

        if (StrLocalizedMessage != "")
        {
            var LabelError=document.getElementById(LabelErrorMessage);
            SetLabelValue(LabelError,StrLocalizedMessage,true); 
            document.documentElement.scrollTop = 0;
            return false;
        }    
       
        else
        {
            return true;
        }
    }
    catch(ex)
    {
     
        return false;
    }
}

//*************************************** Proposal Detail Step 2A and 2B END *******************************************
function CheckEmployeeContibution(Contvalue,TotalContvalue,BindText,BindTextTotal)
{
    try
    {
        var StrLocalizedMessageValue = "";
        if(trim(Contvalue) != '')
        { 
        if(isNaN(trim(Contvalue))==true)
        {       
            StrLocalizedMessageValue = StrLocalizedMessageValue + "<BR>* Please enter valid " + BindText;
        }
        else if(checkDecimals(trim(Contvalue),14,4)==false)
        {
            StrLocalizedMessageValue = StrLocalizedMessageValue + "<BR>* Please enter valid " + BindText;
        }
        }           
        if(trim(TotalContvalue) != '')
        {
        if(isNaN(trim(TotalContvalue))==true)
        {       
            StrLocalizedMessageValue = StrLocalizedMessageValue + "<BR>* Please enter valid " + BindTextTotal;
        }
        else if(checkDecimals(trim(TotalContvalue),14,4)==false)
        {
            StrLocalizedMessageValue = StrLocalizedMessageValue + "<BR>* Please enter valid " + BindTextTotal;
        }
        } 
        if(parseFloat(Contvalue) > parseFloat(TotalContvalue))
        {
        StrLocalizedMessageValue = StrLocalizedMessageValue + "<BR>* " + BindText + " can not be Greater the " +  BindTextTotal;
        }
        return StrLocalizedMessageValue;
    }
    catch(ex)
    {
      
    }
}
//*************************************** Proposal Detail Step 2 Normative start *******************************************
    function ValidateHiddenButton(TxtBxPlanNameID ,TxtBxCostPerEmployeeID ,TxtBxEnrollmentRateID,DropDownListTrendRateID,HiddenFieldCostPerEmployeeID ,HiddenFieldEnrollmentRateID, HiddenFieldFutureTrendRateID , HiddenFieldPlanNameID )
    {
        try
        {
            var strLocalizedErrorMessage = "";
            var AvrAnnualCost, EnrollmentRate;
            var LabelError=document.getElementById('ProposalStepTwoNormative1_LabelMessage');            

            var TxtBxPlanName=TxtBxPlanNameID; 
            var TxtBxPlanNamevalue = ReplaceAllOccurances(TxtBxPlanName.value,",",""); 
             
            var TxtBxCostPerEmployee=TxtBxCostPerEmployeeID;            
            ValidDecimal(TxtBxCostPerEmployee); 
            var TxtBxCostPerEmployeevalue = ReplaceAllOccurances(TxtBxCostPerEmployee.value,",","");              
            
            var TxtBxEnrollmentRate=TxtBxEnrollmentRateID; 
            ValidDecimal(TxtBxEnrollmentRate);
            var TxtBxEnrollmentRatevalue = ReplaceAllOccurances(TxtBxEnrollmentRate.value,",","");  

            var HiddenFieldPlanName=document.getElementById(HiddenFieldPlanNameID); 
            var HiddenFieldPlanNamevalue = ReplaceAllOccurances(HiddenFieldPlanName.value,",","");  
            var HiddenFieldCostPerEmployee=document.getElementById(HiddenFieldCostPerEmployeeID); 
            
            ValidDecimal(HiddenFieldCostPerEmployee);
            
            var HiddenFieldCostPerEmployeevalue = ReplaceAllOccurances(HiddenFieldCostPerEmployee.value,",","");  
            var HiddenFieldEnrollmentRate=document.getElementById(HiddenFieldEnrollmentRateID); 
            
            ValidDecimal(HiddenFieldEnrollmentRatevalue);
            var HiddenFieldEnrollmentRatevalue = ReplaceAllOccurances(HiddenFieldEnrollmentRate.value,",","");  
            var HiddenFieldFutureTrendRate=document.getElementById(HiddenFieldFutureTrendRateID); 
            var HiddenFieldFutureTrendRatevalue = ReplaceAllOccurances(HiddenFieldFutureTrendRate.value,",",""); 

            var  DropDownListTrendRate=DropDownListTrendRateID;

            for(var i=0;i<TxtBxCostPerEmployeevalue.length;i++)
            {               
                if(TxtBxCostPerEmployeevalue.charAt(i)=='$' )
                {
                TxtBxCostPerEmployeevalue = TxtBxCostPerEmployeevalue.replace("$","");            
                }              
            }   

            for(var i=0;i<TxtBxEnrollmentRatevalue.length;i++)
            {               
                if(TxtBxEnrollmentRatevalue.charAt(i)=='%' )
                {
                    TxtBxEnrollmentRatevalue = TxtBxEnrollmentRatevalue.replace("%","");            
                }              
            }   

            /*****************************************/
           
            if ((trim(TxtBxCostPerEmployeevalue) <= 0))
            {
                strLocalizedErrorMessage = strLocalizedErrorMessage + "<BR>* Average Annual Cost Per Employee should be greater than 0.";
            }
            if (trim(TxtBxEnrollmentRatevalue) != "")
            {                
                if ((trim(TxtBxEnrollmentRatevalue) <= 0) || (trim(TxtBxEnrollmentRatevalue) > 100))
                {
                strLocalizedErrorMessage = strLocalizedErrorMessage + "<BR>* Enrollment Rate should be greater than 0 and less than equal to 100.";
                }
            }
            //control = document.getElementById('ProposalStepTwoNormative1_DropDownListTrendRate');  

            if(DropDownListTrendRate.selectedIndex==0)
            {       
            //Str =  Str + "\n* Please select trend rate.";
            strLocalizedErrorMessage=strLocalizedErrorMessage + "\n* Please select Trend rate.";
            }

            if (strLocalizedErrorMessage != "")
            {
                
                SetLabelValue(LabelError,strLocalizedErrorMessage,true); 
                document.documentElement.scrollTop = 0;
                TxtBxPlanName.focus();
                return false;
            }    
            /*****************************************/
            else
            {
                SetLabelValue(LabelError,"",true); 
                if (TxtBxPlanNamevalue != "" && TxtBxCostPerEmployeevalue != "" && TxtBxCostPerEmployeevalue != "0" && DropDownListTrendRate.selectedIndex !=0)
                {
                    if (parseFloat(trim(TxtBxCostPerEmployeevalue)) != parseFloat(trim(HiddenFieldCostPerEmployeevalue)) || parseFloat(trim(TxtBxEnrollmentRatevalue)) != parseFloat(trim(HiddenFieldEnrollmentRatevalue)) || DropDownListTrendRate.options[DropDownListTrendRate.selectedIndex].value != trim(HiddenFieldFutureTrendRatevalue) || trim(TxtBxPlanNamevalue) != trim(HiddenFieldPlanNamevalue))
                    {
                        return true;
                    }
                    else
                    {
                        TxtBxPlanName.focus();
                        return false;                                            
                    }
                }
                else
                {
                    return true;
                }
            }
        }
        catch(ex)
        {
         
        }
}

//To validate Proposal Wizard Step Two Normative
//Created BY Damanpreet
function ValidationStep2Normative()
{
    try 
    {
        var control ;
        var control1;
        var controlvalue1;
        var controlvalue2;
        //var Str="";
        var strLocalizedErrorMessage="";
        var BindTextEmployee ="Monthly $ Employee Contribution for Employee Only";
        var BindTextTotalEmployee ="Monthly Total Contribution for  Employee Only";
        var BindTextSpouse ="Monthly $ Employee Contribution for Employee + Spouse";
        var BindTextTotalSpouse ="Monthly Total Contribution for Employee + Spouse";

        var BindTextChild ="Monthly $ Employee Contribution for Employee +  Child(ren)";
        var BindTextTotalChild ="Monthly Total Contribution for Employee +  Child(ren)";
        var BindTextFamily ="Monthly $ Employee Contribution for Family";
        var BindTextTotalFamily ="Monthly Total Contribution for Family";   
        
        control = document.getElementById('ProposalStepTwoNormative1_TextBoxPlanName');    
            if (trim(control.value) == "")
            {
                strLocalizedErrorMessage=strLocalizedErrorMessage + "\n* Please enter Plan Name.";
            }
            else
            {
//                var validPlanName = AllowSpecialCharacters(trim(control.value));   
//                //var validPlanName= AllowValidChars(trim(control.value));
//                if(validPlanName==false)
//                {
//                    strLocalizedErrorMessage=strLocalizedErrorMessage + "\n* Please enter valid Plan Name.";
//                }
//                else
//                {
//                    var validPlanName1 = FirstCharacterAlphabet(trim(control.value)); 
//                    if(validPlanName1==false)
//                    {                   
//                        strLocalizedErrorMessage=strLocalizedErrorMessage + "\n* First character should be Alphabet in Plan Name" ;
//                    }
//                } 
            }
            
        
            control = document.getElementById('ProposalStepTwoNormative1_TextBoxCostPerEmployee');  
            if (trim(control.value) == "")
            {
                strLocalizedErrorMessage=strLocalizedErrorMessage + "<BR>* Please enter Average Annual Cost Per Employee";
            } 
            else
            {
                controlvalue1 = ReplaceAllOccurances(trim(control.value),",","");
               // controlvalue2 = ReplaceAllOccurances(controlvalue1,"$","");
                for(var i=0;i<controlvalue1.length;i++)
                {
                    if(controlvalue1.charAt(i)==',' )
                    {controlvalue1=  controlvalue1.replace(",","");} 
                    if(controlvalue1.charAt(i)=='$' )
                    {controlvalue1=  controlvalue1.replace("$","");}              
                }
                if(isNaN(trim(controlvalue1))==true)
                {       
                    strLocalizedErrorMessage=strLocalizedErrorMessage + "<BR>* Please enter valid Average Annual Cost Per Employee";
                }
                else if((trim(controlvalue1) <= 0))
                {
                    strLocalizedErrorMessage=strLocalizedErrorMessage + "<BR>* Average Annual Cost Per Employee should be greater than 0."
                }
                else if(checkDecimals(trim(controlvalue1),10,2)==false)
                {
                    strLocalizedErrorMessage=strLocalizedErrorMessage + "<BR>* Please enter valid Average Annual Cost Per Employee";
                }
            } 
            controlvalue1 = "";
            control = document.getElementById('ProposalStepTwoNormative1_TextBoxEnrollmentRate');  
            if (trim(control.value) == "")
            {
                strLocalizedErrorMessage=strLocalizedErrorMessage + "<BR>* Please enter Enrollment Rate.";
            } 
            else
            {
                controlvalue1 = ReplaceAllOccurances(control.value,",","");
                if(isNaN(trim(controlvalue1))==true)
                //if(isNaN(trim(control.value))==true)
                {       
                    strLocalizedErrorMessage=strLocalizedErrorMessage + "<BR>* Please enter Valid Enrollment Rate.";
                }
                else if((trim(controlvalue1) <= 0)||(trim(controlvalue1)>100))
                {
                    strLocalizedErrorMessage=strLocalizedErrorMessage + "<BR>* Enrollment Rate should be greater than 0 and less than equal to 100."
                }
                else if(checkDecimals(trim(controlvalue1),3,2)==false)
                {
                    strLocalizedErrorMessage=strLocalizedErrorMessage + "<BR>* Please enter Valid Enrollment Rate.";
                }
            }
        control = document.getElementById('ProposalStepTwoNormative1_DropDownListTrendRate');  

        if(control.selectedIndex==0)
        {       
        //Str =  Str + "\n* Please select trend rate.";
        strLocalizedErrorMessage=strLocalizedErrorMessage + "\n* Please select Trend rate.";
        }
        
        var strLocalizedErrorMessage1 = "";
        var controlMonthly = document.getElementById('ProposalStepTwoNormative1_TextBoxProposalsEEOnlyEmployeeContribution'); 
        var controlFamily = document.getElementById('ProposalStepTwoNormative1_LabelProposalsEEOnlyTotalContribution'); 
        var MonthlyCont=controlMonthly;
        var MonthlyContvalue = ReplaceAllOccurances(MonthlyCont.value,",","");
        var TotalCont=controlFamily;
        var TotalContvalue = GetLabelValue(TotalCont);
        var TotalContvalue = ReplaceAllOccurances(TotalContvalue,",","");
        
        var strLocalizedErrorMessage1 = CheckEmployeeContibution(trim(MonthlyContvalue),trim(TotalContvalue),BindTextEmployee,BindTextTotalEmployee)
        strLocalizedErrorMessage=strLocalizedErrorMessage + strLocalizedErrorMessage1;
        
        
        var controlMonthly = document.getElementById('ProposalStepTwoNormative1_TextBoxProposalsEESpouseEmployeeContribution'); 
        var controlFamily = document.getElementById('ProposalStepTwoNormative1_LabelProposalsEESpouseTotalContribution');         
        var MonthlyCont=controlMonthly;
        var MonthlyContvalue = ReplaceAllOccurances(MonthlyCont.value,",","");
        var TotalCont=controlFamily;
        var TotalContvalue = GetLabelValue(TotalCont);
        var TotalContvalue = ReplaceAllOccurances(TotalContvalue,",","");
        var BindTextMonthly ="Monthly $ Employee Contribution";
        var BindTextTotal ="Monthly Total Contribution";        
        var strLocalizedErrorMessage1 = CheckEmployeeContibution(trim(MonthlyContvalue),trim(TotalContvalue),BindTextSpouse,BindTextTotalSpouse)
        strLocalizedErrorMessage=strLocalizedErrorMessage + strLocalizedErrorMessage1;
        
        var controlMonthly = document.getElementById('ProposalStepTwoNormative1_TextBoxProposalsEEChildEmployeeContribution'); 
        var controlFamily = document.getElementById('ProposalStepTwoNormative1_LabelProposalsEEChildTotalContribution');         
        var MonthlyCont=controlMonthly;
        var MonthlyContvalue = ReplaceAllOccurances(MonthlyCont.value,",","");
        var TotalCont=controlFamily;
        var TotalContvalue = GetLabelValue(TotalCont);
        var TotalContvalue = ReplaceAllOccurances(TotalContvalue,",","");
        var BindTextMonthly ="Monthly $ Employee Contribution";
        var BindTextTotal ="Monthly Total Contribution";
        var strLocalizedErrorMessage1 = CheckEmployeeContibution(trim(MonthlyContvalue),trim(TotalContvalue),BindTextChild,BindTextTotalChild)
        strLocalizedErrorMessage=strLocalizedErrorMessage + strLocalizedErrorMessage1;
        
        var controlMonthly = document.getElementById('ProposalStepTwoNormative1_TextBoxProposalsFamilyEmployeeContribution'); 
        var controlFamily = document.getElementById('ProposalStepTwoNormative1_LabelProposalsFamilyTotalContribution');        
        var MonthlyCont=controlMonthly;
        var MonthlyContvalue = ReplaceAllOccurances(MonthlyCont.value,",","");
        var TotalCont=controlFamily;
        var TotalContvalue = GetLabelValue(TotalCont);
        var TotalContvalue = ReplaceAllOccurances(TotalContvalue,",","");
        
        var strLocalizedErrorMessage1 = CheckEmployeeContibution(trim(MonthlyContvalue),trim(TotalContvalue),BindTextFamily,BindTextTotalFamily)
        strLocalizedErrorMessage=strLocalizedErrorMessage + strLocalizedErrorMessage1;
        
        if (strLocalizedErrorMessage != "")
        {
            var LabelError=document.getElementById("ProposalStepTwoNormative1_LabelMessage");

            SetLabelValue(LabelError,strLocalizedErrorMessage,true); 
            //ShowErrorMsg(Str);
            document.documentElement.scrollTop = 0;
            return false;
        }
        else
        {
            return true;
        }
    }
    catch(ex)
    { 
 
    return false;
    
    }
}

//Function created by Damanpreet on April 22 2008 acc to Task #228  --	Step Two - % Does not immediately calculate
// To have the Percentage on onblur of Textboxes
 function GetPercentageEmployeeContributionForNormative(TxtBxEEOnlyEmpContr,TxtBxEESpouseEmpContr,TxtBxEEChildEmpContr,TxtBxFamilyEmpContr,
                                           LblEETotal,LblEESpouseTotal,LblEEChildTotal,LblFamilyTotal,
                                           LblEEOnlyEmployeePerc,LblEESpouseEmployeePerc,LblEEChildEmployeePerc,LblFamilyEmployeePerc,control)
    {
        try
        { 

            if(control == TxtBxEEOnlyEmpContr || control == TxtBxEESpouseEmpContr || control == TxtBxEEChildEmpContr || control == TxtBxFamilyEmpContr )
            {
                ValidDecimal(control);
            }        
            var LabelError=document.getElementById("ProposalStepTwoNormative1_LabelMessage");
            SetLabelValue(LabelError,"",true);     
            
            var LabelEETotal=document.getElementById(LblEETotal);
            var LabelEETotalvalue = GetLabelValue(LabelEETotal);
            var LabelEETotalvalue = ReplaceAllOccurances(LabelEETotalvalue,",","");
            
            var LabelEESpouseTotal=document.getElementById(LblEESpouseTotal);
            var LabelEESpouseTotalvalue = GetLabelValue(LabelEESpouseTotal);
            var LabelEESpouseTotalvalue = ReplaceAllOccurances(LabelEESpouseTotalvalue,",","");
            
            var LabelEEChildTotal=document.getElementById(LblEEChildTotal);
            var LabelEEChildTotalvalue = GetLabelValue(LabelEEChildTotal);
            var LabelEEChildTotalvalue = ReplaceAllOccurances(LabelEEChildTotalvalue,",","");
            
            var LabelFamilyTotal=document.getElementById(LblFamilyTotal);
            var LabelFamilyTotalvalue = GetLabelValue(LabelFamilyTotal);
            var LabelFamilyTotalvalue = ReplaceAllOccurances(LabelFamilyTotalvalue,",","");       
            
            var TxtBxEEOnlyEmpContrvalue = ReplaceAllOccurances(trim(TxtBxEEOnlyEmpContr.value),",","");
            for(var i=0;i<TxtBxEEOnlyEmpContrvalue.length;i++)
            {               
                if(TxtBxEEOnlyEmpContrvalue.charAt(i)=='$' )
                {
                TxtBxEEOnlyEmpContrvalue = TxtBxEEOnlyEmpContrvalue.replace("$","");            
                }              
            }  
            var TxtBxEESpouseEmpContrvalue = ReplaceAllOccurances(TxtBxEESpouseEmpContr.value,",","");
            for(var i=0;i<TxtBxEESpouseEmpContrvalue.length;i++)
            {               
                if(TxtBxEESpouseEmpContrvalue.charAt(i)=='$' )
                {
                TxtBxEESpouseEmpContrvalue = TxtBxEESpouseEmpContrvalue.replace("$","");            
                }              
            }  
            var TxtBxEEChildEmpContrvalue = ReplaceAllOccurances(TxtBxEEChildEmpContr.value,",","");
            for(var i=0;i<TxtBxEEChildEmpContrvalue.length;i++)
            {               
                if(TxtBxEEChildEmpContrvalue.charAt(i)=='$' )
                {
                TxtBxEEChildEmpContrvalue = TxtBxEEChildEmpContrvalue.replace("$","");            
                }              
            }  
            var TxtBxFamilyEmpContrvalue = ReplaceAllOccurances(TxtBxFamilyEmpContr.value,",","");
            for(var i=0;i<TxtBxFamilyEmpContrvalue.length;i++)
            {               
                if(TxtBxFamilyEmpContrvalue.charAt(i)=='$' )
                {
                TxtBxFamilyEmpContrvalue = TxtBxFamilyEmpContrvalue.replace("$","");            
                }              
            }   
           
            var LabelEEOnlyEmployeePerc = document.getElementById(LblEEOnlyEmployeePerc);
            var LabelEESpouseEmployeePerc = document.getElementById(LblEESpouseEmployeePerc);
            var LabelEEChildEmployeePerc = document.getElementById(LblEEChildEmployeePerc);
            var LabelFamilyEmployeePerc = document.getElementById(LblFamilyEmployeePerc);
            /*****************************************/
            
            var BindTextEmployee ="Monthly $ Employee Contribution for Employee Only";
            var BindTextTotalEmployee ="Monthly Total Contribution for  Employee Only";
            var BindTextSpouse ="Monthly $ Employee Contribution for Employee + Spouse";
            var BindTextTotalSpouse ="Monthly Total Contribution for Employee + Spouse";

            var BindTextChild ="Monthly $ Employee Contribution for Employee +  Child(ren)";
            var BindTextTotalChild ="Monthly Total Contribution for Employee +  Child(ren)";
            var BindTextFamily ="Monthly $ Employee Contribution for Family";
            var BindTextTotalFamily ="Monthly Total Contribution for Family"; 
            var BindTextMonthly ="Monthly $ Employee Contribution";
            var BindTextTotal ="Monthly Total Contribution";
            var strLocalizedErrorMessage ="";
            
            var strLocalizedErrorMessage1 = CheckEmployeeContibution(trim(TxtBxEEOnlyEmpContrvalue),trim(LabelEETotalvalue),BindTextEmployee,BindTextTotalEmployee)
            strLocalizedErrorMessage=strLocalizedErrorMessage + strLocalizedErrorMessage1;
            
            var strLocalizedErrorMessage1 = CheckEmployeeContibution(trim(TxtBxEESpouseEmpContrvalue),trim(LabelEESpouseTotalvalue),BindTextSpouse,BindTextTotalSpouse)
            strLocalizedErrorMessage=strLocalizedErrorMessage + strLocalizedErrorMessage1;
            
            var strLocalizedErrorMessage1 = CheckEmployeeContibution(trim(TxtBxEEChildEmpContrvalue),trim(LabelEEChildTotalvalue),BindTextChild,BindTextTotalChild)
            strLocalizedErrorMessage=strLocalizedErrorMessage + strLocalizedErrorMessage1;
            
            var strLocalizedErrorMessage1 = CheckEmployeeContibution(trim(TxtBxFamilyEmpContrvalue),trim(LabelFamilyTotalvalue),BindTextFamily,BindTextTotalFamily)
            strLocalizedErrorMessage=strLocalizedErrorMessage + strLocalizedErrorMessage1;
            
            if (strLocalizedErrorMessage != "")
            {
            

            SetLabelValue(LabelError,strLocalizedErrorMessage,true);             
            document.documentElement.scrollTop = 0;
            return false;
            }
            else
            {   
                strLocalizedErrorMessage = ""
                if(parseFloat(TxtBxEEOnlyEmpContrvalue) > 0 && TxtBxEEOnlyEmpContrvalue != "" && parseFloat(LabelEETotalvalue) > 0 && LabelEETotalvalue != "")
                {
                    var LblEEOnlyEmployeePercvalue = ((100 * parseFloat(TxtBxEEOnlyEmpContrvalue))/parseFloat(LabelEETotalvalue))            
                    SetLabelValue(LabelEEOnlyEmployeePerc,formatNumber(LblEEOnlyEmployeePercvalue,2,',' , '.','','%','-',''),true)   
                }
                else
                {
                    SetLabelValue(LabelEEOnlyEmployeePerc,"0.00%",true)   
                }
                if(parseFloat(TxtBxEESpouseEmpContrvalue) > 0 && TxtBxEESpouseEmpContrvalue != "" && parseFloat(LabelEESpouseTotalvalue) > 0 && LabelEESpouseTotalvalue != "")
                {
                    var LblEESpouseEmployeePercvalue = ((100 * parseFloat(TxtBxEESpouseEmpContrvalue))/parseFloat(LabelEESpouseTotalvalue))
                     SetLabelValue(LabelEESpouseEmployeePerc,formatNumber(LblEESpouseEmployeePercvalue,2,',' , '.','','%','-',''),true)
                }
                else
                {
                    SetLabelValue(LabelEESpouseEmployeePerc,"0.00%",true)   
                }
                if(parseFloat(TxtBxEEChildEmpContrvalue) > 0 && TxtBxEEChildEmpContrvalue != "" && parseFloat(LabelEEChildTotalvalue) > 0 && LabelEEChildTotalvalue != "")
                {
                    var LblEEChildEmployeePercvalue = ((100 * parseFloat(TxtBxEEChildEmpContrvalue))/parseFloat(LabelEEChildTotalvalue))
                    SetLabelValue(LabelEEChildEmployeePerc,formatNumber(LblEEChildEmployeePercvalue,2,',' , '.','','%','-',''),true)
                }
                else
                {
                    SetLabelValue(LabelEEChildEmployeePerc,"0.00%",true)   
                }
                if(parseFloat(TxtBxFamilyEmpContrvalue) > 0 && TxtBxFamilyEmpContrvalue != "" && parseFloat(LabelFamilyTotalvalue) > 0  && LabelFamilyTotalvalue != "")
                {
                    var LblFamilyEmployeePercvalue = ((100 * parseFloat(TxtBxFamilyEmpContrvalue))/parseFloat(LabelFamilyTotalvalue))
                    SetLabelValue(LabelFamilyEmployeePerc,formatNumber(LblFamilyEmployeePercvalue,2,',' , '.','','%','-',''),true)
                }
                else
                {
                    SetLabelValue(LabelFamilyEmployeePerc,"0.00%",true)   
                } 
            }        
        }
        catch(ex)
        {
           
        }
    } 


//*************************************** Proposal Detail Step 2 Normative end *******************************************

//*************************************** Functions not in use START *******************************************
//Not in use
//Created by Daman Preet to open the Support Number Page
function OpenPopUpForMoreCompanyTiers()
{
    try
    {
        var msAttributes1 ="Top=0,left=170,height=500,width=680,status=no,toolbar=no,menubar=no,location=no,statusbar=yes,scroll=no,scrollbars=no,resizable=no"
        var retValue=window.open("../CompanyWithMoreTiers.aspx","Test",msAttributes1);
        if(retValue==null)
        {
            alert('Popup blocker has blocked your popup.Please allow this website in your popup blocker');        
        }
    }
    catch(ex)
    {
      
    }
    return false;
}


//Not in Use
function CheckNumeric(CntrolName, Controlmsg)
{
    try
    {
        var LabelError=document.getElementById("ProposalStepOne1_LabelMessage");
        if(isNaN(trim(CntrolName.value))== true)
        {
         
         SetLabelValue(LabelError,"* Please enter numeric value in"  + Controlmsg + ".",true); 
            //ShowErrorMsg("* Please enter numeric value in"  + Controlmsg + ".");
            CntrolName.focus();
            return false;            
        }
        else
        {
           SetLabelValue(LabelError,"",true);
        }
    }
    catch(ex)
    {
   
    }
}  
//Not in use
 function ShowErrorMsg(msg)
{
try
{
 var LabelError=document.getElementById("ProposalStepOne1_LabelMessage");
 SetLabelValue(LabelError,msg,true);
   //document.getElementById("ProposalStepOne1_LabelMessage").innerText = msg;   
   }
   catch(ex)
   {
  
   }
}
 //Not in use   
    function ShowErrorMsgStepTwo(msg,LabelMessage)
    {
    try
    {
    SetLabelValue(LabelMessage,msg,true);
       //LabelMessage.innerText = msg;   
       }
       catch(ex)
       {
       
       }
    }
   
   //Not in use
    function getTotalEmployeesEnteredinGridColumnOne(R1,R2,R3,R4,LBProposalTotEmpIngrid)
    {
     try
        { 
            var Sum = 0;
            var control ;
           // control = document.getElementById(TBProposalTotEmpIngrid);   
            
           // var TextBoxProposalsEEOnlyEmployees=document.getElementById(R1);
            //var TextBoxProposalsEESpouseEmployees=document.getElementById(R2);
            //var TextBoxProposalsEEChildEmployees=document.getElementById(R3);
           // var TextBoxProposalsFamilyEmployees=document.getElementById(R4);
           // var TextBoxProposalTotEmpIngrid=document.getElementById(TBProposalTotEmpIngrid);
           /* if(document.getElementById(LBProposalTotEmpIngrid))
            {
           
            }
            else
            {
               
            }*/
          
          
            var TextBoxProposalsEEOnlyEmployees=R1;
            var TextBoxProposalsEESpouseEmployees=R2;
            var TextBoxProposalsEEChildEmployees=R3;
            var TextBoxProposalsFamilyEmployees=R4;
            var LabelProposalTotEmpIngrid= document.getElementById( LBProposalTotEmpIngrid);
           
             if(isNaN(trim(TextBoxProposalsEEOnlyEmployees.value))== false && trim(TextBoxProposalsEEOnlyEmployees.value)!= "")
              { 
               Sum = parseInt(Sum) + parseInt(TextBoxProposalsEEOnlyEmployees.value) ;
              
              }          
               if(isNaN(trim(TextBoxProposalsEESpouseEmployees.value))== false && trim(TextBoxProposalsEESpouseEmployees.value)!= "")
              { 
               Sum = parseInt(Sum) + parseInt(TextBoxProposalsEESpouseEmployees.value) ;           
              }
              
              if(isNaN(trim(TextBoxProposalsEEChildEmployees.value))==false && trim(TextBoxProposalsEEChildEmployees.value)!= "")
              { 
               Sum = parseInt(Sum) + parseInt(TextBoxProposalsEEChildEmployees.value) ;
              }
               if(isNaN(trim(TextBoxProposalsFamilyEmployees.value))==false && trim(TextBoxProposalsFamilyEmployees.value)!= "")
              { 
               Sum = parseInt(Sum) + parseInt(TextBoxProposalsFamilyEmployees.value) ;
              }
              SetLabelValue(LabelProposalTotEmpIngrid,Sum,true)
              //TextBoxProposalTotEmpIngrid.value = Sum; 
         }
         catch(ex)
         {
           
         }
    }
  //Not in use  
function getTotalEmployeesEnrolled(NumOfEmp,Enrolment,LBWEmyEnrolled)
{
    try
    {
    
        var Sum = 0;
        var control ;
        //control = document.getElementById(TBWEmyEnrolled);   
        if(isNaN(trim(Enrolment.value))== false && trim(Enrolment.value)!= "")
        { 
        Sum = parseInt(Sum) + parseFloat(Enrolment.value) ;          
        }  
        if(isNaN(trim(NumOfEmp.value))== false && trim(NumOfEmp.value)!= "")
        { 
        Sum = parseFloat(Sum) * parseInt(NumOfEmp.value) ;          
        }
       SetLabelValue(document.getElementById(LBWEmyEnrolled),Sum,true)
       
    }
    catch(ex)
    {
      
    }
} 

//Not in use
//Function created by Damanpreet on 03rd Dec 2007 to Hide the Selected Answer in FAQ Grid 
//function HideSelectedAnswer(LabelQuestion,LabelAnswer,ImageButtonBlock ,ImageButtonNone)
function HideSelectedAnswer(LabelQuestion,LabelAnswer)
{
    try
    {
        var grid = document.getElementById('FAQ1_GridViewFAQs');
        var LabelQuestion = document.getElementById(LabelQuestion);
        var LabelAnswer = document.getElementById(LabelAnswer);
         
       if(LabelQuestion!=null)
        {                     
            LabelAnswer.style.display ='none'; 
            return false;   
        } 
        else
        {
       
        }  
        return false; 
    }
    catch(ex)
    {
        
    }
}

//Not in use
//Function created by Damanpreet to return the Enrolleeid of Selected Radio Button in Search Grid    
function ShowAllAnswers(LabelExpandAll ,LabelCollapseAll)
{
    try
    {   
        var LblExpandAll = document.getElementById(LabelExpandAll);
        var LblCollapseAll = document.getElementById(LabelCollapseAll); 
        var grid = document.getElementById('FAQ1_GridViewFAQs');
        for (i=00; i < document.getElementById('FAQ1_GridViewFAQs').rows.length-1; i++) 
        {
            rownum=i+2;
            if(i<8)
            {
                row="0" + rownum;
            }
            else
            {
            row=rownum;
            } 
            LabelQuestion = "FAQ1_GridViewFAQs_ctl"+row+"_LabelQuestion" ;
            LabelAnswer = "FAQ1_GridViewFAQs_ctl"+row+"_LabelAnswer";                    
            
            if(document.getElementById(LabelQuestion) != null)
            {                                 
                document.getElementById(LabelAnswer).style.display ='block';  
                
               if(document.all)
               {
                document.getElementById(LabelAnswer).runtimeStyle.setAttribute("width","750px"); 
               }
               else
               {
               document.getElementById(LabelAnswer).style.width="750px";               
               }                           
            }                        
        }
        LblCollapseAll.style.display ='block';  
        LblExpandAll.style.display ='none';  
        return false; 
    }
    catch(ex)
    {
      
    }
}

//Not in use
//Function created by Damanpreet
function HideAllAnswers(LabelExpandAll ,LabelCollapseAll)
{
    try
    {   
        var LblExpandAll = document.getElementById(LabelExpandAll);
        var LblCollapseAll = document.getElementById(LabelCollapseAll);  
        var grid = document.getElementById('FAQ1_GridViewFAQs');
        for (i=00; i < document.getElementById('FAQ1_GridViewFAQs').rows.length-1; i++) 
        {
            rownum=i+2;
            if(i<8)
            {
                row="0" + rownum;
            }
            else
            {
            row=rownum;
            } 
            LabelQuestion = "FAQ1_GridViewFAQs_ctl"+row+"_LabelQuestion" ;
            LabelAnswer = "FAQ1_GridViewFAQs_ctl"+row+"_LabelAnswer";                    
                      
            if(document.getElementById(LabelQuestion) != null)
            {                                            
                document.getElementById(LabelAnswer).style.display ='none';   
           }          
        }
        LblCollapseAll.style.display ='none';  
        LblExpandAll.style.display ='block';     
        return false; 
    }
    catch(ex)
    {
     
    }
}

//Not in use
//Function to Validate Step 2-B 
//Modified by Damanpreet on Dec 17 2007

//Not in Use commented by Damanpreet on Jan 10 2008
  /*  function ValidationStepTwoB()
    {
        try
        {    
            var StrLocalizedMessage="";   
            //Modified by Damanpreet on Dec 06 2007
            var LabelProposalTotPlanCostFromGrid= document.getElementById('ProposalStepTwoB1_LabelProposalTotPlanCost');
            var LabelProposalTotPlanCostFromGridValue = GetLabelValue(LabelProposalTotPlanCostFromGrid);                                                                     
            var TextBoxProposalTotPlanCost= document.getElementById('ProposalStepTwoB1_TextBoxLastKnownTotalAnnualCostValue');
            var TextBoxProposalTotPlanCostValue = TextBoxProposalTotPlanCost.value;

            for(var i=0;i<LabelProposalTotPlanCostFromGridValue.length;i++)
            {
                if(LabelProposalTotPlanCostFromGridValue.charAt(i)==',' )
                {
                    LabelProposalTotPlanCostFromGridValue=  LabelProposalTotPlanCostFromGridValue.replace(",","");            
                } 
                if(LabelProposalTotPlanCostFromGridValue.charAt(i)=='$' )
                {
                    LabelProposalTotPlanCostFromGridValue=  LabelProposalTotPlanCostFromGridValue.replace("$","");            
                }              
            }
            for(var i=0;i<TextBoxProposalTotPlanCostValue.length;i++)
            {
                if(TextBoxProposalTotPlanCostValue.charAt(i)==',' )
                {
                    TextBoxProposalTotPlanCostValue=  TextBoxProposalTotPlanCostValue.replace(",","");            
                } 
                if(TextBoxProposalTotPlanCostValue.charAt(i)=='$' )
                {
                    TextBoxProposalTotPlanCostValue=  TextBoxProposalTotPlanCostValue.replace("$","");            
                }              
            }  
            if (parseInt(TextBoxProposalTotPlanCostValue)!=parseInt(LabelProposalTotPlanCostFromGridValue))
            {
                //Commented by Pradeep for Localization
                //Str=Str +  "The amount specified in the grid does not equal the 'Total Annual Plan Cost'. You must either change the Total Annual Plan Cost or enter values in the Monthly Total Contribution that equal that number."
                StrLocalizedMessage=StrLocalizedMessage + "\n*" + GetLocalizeDataByKey('HiddenLocalizeData','TotalPlanCost');
            } 
            //Modified by Damanpreet on Dec 06 2007
            var LabelProposalTotEnrEmyFromGrid= document.getElementById('ProposalStepTwoB1_LabelProposalTotEmpIngrid');
            var LabelProposalTotEnrEmyFromGridValue = GetLabelValue(LabelProposalTotEnrEmyFromGrid);
            var TextBoxProposalTotEnrEmy= document.getElementById('ProposalStepTwoB1_TextBoxTotalEmployeesEnteredForPlansValue');
            var TextBoxProposalTotEnrEmyValue = TextBoxProposalTotEnrEmy.value;

            if (parseInt(TextBoxProposalTotEnrEmyValue)!=parseInt(LabelProposalTotEnrEmyFromGridValue))
            {           
                StrLocalizedMessage=StrLocalizedMessage + "\n*" + GetLocalizeDataByKey('HiddenLocalizeData','EnrolledEmployee');
            }

            if (StrLocalizedMessage != "")
            {
                var LabelError=document.getElementById("ProposalStepTwoB1_LabelMessage");
                SetLabelValue(LabelError,StrLocalizedMessage,true); 
                return false;
            }
            else
            {
                return true;
            }
        }
        catch(ex)
        {
         
        }  
    }*/
    
     //Not in use
   function SetCostYear(DropDown, Label1, Label2, Label3)
    {     
        try
        {
            var DisplayLabel=document.getElementById(Label1);
            var DisplayText;
            if(document.getElementById(DropDown).selectedIndex==0)
            {
                DisplayText="____";
            }
            else
            {
                DisplayText=document.getElementById(DropDown).options[document.getElementById(DropDown).selectedIndex].text;
            }
       
            SetLabelValue(DisplayLabel,DisplayText,true); 
            DisplayLabel=document.getElementById(Label2);
            SetLabelValue(DisplayLabel,DisplayText,true);
            DisplayLabel=document.getElementById(Label3); 
            SetLabelValue(DisplayLabel,DisplayText,true); 
            
        }
        catch(exception)
        {
      
        }
    }
    
    /* Comented by Pradeep As it is not in use
function CheckEmptyForPlanInformationstepOneB(TableNormativeData,LabelErrorMessage)
            {
            
                   var DropDownValue=document.getElementById('<% = DroDownListLastKnownCast.ClientID %>'); 
                  if(DropDownValue.value=='0')
                  {
                 
                    document.getElementById('<% = LabelErrorMessage.ClientID %>').innerHTML="* Please select cost year!";                  
                    return false;
                 }
                  var DropDownTrendRateValue=document.getElementById('<% = DropDownListFutureTrendRate.ClientID %>'); 
                  if(DropDownTrendRateValue.value=='0.00')
                  {
                    
                    document.getElementById('<% = LabelErrorMessage.ClientID %>').innerHTML="* Please select trend rate";
                                 
                    return false;
                  }
                  //Check For NoOfPlan should not be 0
                 var NoOfPlan=document.getElementById('<% = TextBoxNoOfPlan.ClientID %>');
                 if(NoOfPlan.value=='0')
                 {
                  document.getElementById('<% = LabelErrorMessage.ClientID %>').innerHTML="* Number of plan can't be 0";
                  return false;
                 }
                 
            
                var childInputs = document.getElementById(TableNormativeData).getElementsByTagName("input");
                var count=0;
                
                 var number=document.getElementById('<% = TextBoxNoOfPlan.ClientID %>'); 
                
                 //Written By Pradeep to handle validation in case of plan number is 1
                 if(number.value=='1')
                 {
                 
                  var TextBox=document.getElementById('<% = TextBoxPlanName.ClientID %>');
                  if(TextBox.value!='')
                  {
                   
                  }
                  else
                  {
                    document.getElementById('<% = LabelErrorMessage.ClientID %>').innerHTML="* Please fill plan name";
               
                   return false;
                  }
                 }
                 //------Start----TextBoxLastKnownCost
                 if(document.getElementById('<% = TextBoxLastKnownCost.ClientID %>').value!='')
                 {
                 }
                 else
                 {
                  document.getElementById('<% = LabelErrorMessage.ClientID %>').innerHTML="* Please fill total annual plan cost";
           
                   return false;
                 }
                 //-End--------
                 //---------Start---------
                 if(document.getElementById('<% = TextBoxAnnualEnrolmentRate.ClientID %>').value!='')
                 {
                 }
                 else
                 {
                  document.getElementById('<% = LabelErrorMessage.ClientID %>').innerHTML="* Please fill total annual enrollment rate ";
               
                   return false;
                 }
                 //----------End------
                 
                 if (number.value>1)
                 {
                    for(var i=0;i<childInputs.length;i++)
                    {
                       if(childInputs[i].id.indexOf('TextBoxPlanName')>0)
                          {
                            if(childInputs[i].value!='')
                            {                        
                            }
                            else
                            {
                              document.getElementById('<% = LabelErrorMessage.ClientID %>').innerHTML="* Please fill all the plan name";
                            
                              return false;
                            }
                          }
                          
                          if(childInputs[i].id.indexOf('TextBoxEmpEnrolled')>0)
                          {
                            if(childInputs[i].value!='')
                            {                        
                            }
                            else
                            {
                            
                              document.getElementById('<% = LabelErrorMessage.ClientID %>').innerHTML="* Please fill all the employee enrolled";
                              return false;
                            }
                          }
                          
                          if(childInputs[i].id.indexOf('TextBoxTotalAnualCost')>0)
                          {
                            if(childInputs[i].value!='')
                            {                        
                            }
                            else
                            {
                             
                              document.getElementById('<% = LabelErrorMessage.ClientID %>').innerHTML="* Please fill all the total annual cost";
                              return false;
                            }
                          }
                    }
                    
                    
                    //*************CheckTotalEmpEnrolled();*************
                    
                     var hiddenValue=document.getElementById('<% = HiddenFieldNumberOfEligibleEmployees.ClientID %>'); 
                     var EnrollmentRate=document.getElementById('<% = TextBoxAnnualEnrolmentRate.ClientID %>'); 
                     var TotalEmpEnrolled=document.getElementById('<% = HiddenFieldTotalEmpEnrolled.ClientID %>'); 

                     var Calc = Math.round((hiddenValue.value*EnrollmentRate.value)/100);
                 
                    
                     
                     if(Calc!=TotalEmpEnrolled.value)
                     {
                 
                        document.getElementById('<% = LabelErrorMessage.ClientID %>').innerHTML="* Total Employees Enrolled from Grid must match the number of eligible employees * enrollment rate";
                        return false;
                     }
                
                     
                     
                     
                     
                     var TotalTotAnnualCost=document.getElementById('<% = HiddenFieldTotalAnnualCost.ClientID %>'); 
                        
                     var CostInTextBox=document.getElementById('<% = TextBoxLastKnownCost.ClientID %>');
                    
                     if(TotalTotAnnualCost.value!=CostInTextBox.value*1)
                     {
                       // alert('The sum of the total annual cost from the grid must match the total annual cost (at the top)');
                        document.getElementById('<% = LabelErrorMessage.ClientID %>').innerHTML="* The sum of the total annual cost from the grid must match the total annual cost (at the top)";
                        return false;
                     }            
                    //***************************************************
                }
           }*/
           
           //Written By Pradeep

/*function ValidateNameFieldForPlanInformationStepOneB(TextBox,LabelObject)
{
 //try
 //{
  
   //var TextBoxValue=TextBox.value;
   var TextBoxValue=document.getElementById(TextBox).value;
  // var TextBoxValue=TextBox.value;
   var Message="Plan name must start from character";
   //if(TextBoxValue!=null)
   //{
     var FirstCharacter=TextBoxValue.substring(0,1);
     var LabelErrorMessage=document.getElementById(LabelObject);
     if((FirstCharacter< "a" || "z" <FirstCharacter)&& (FirstCharacter< "A" || "Z" <FirstCharacter) )
     {
      alert('Plan name must start from character');
      //SetLabelValue(LabelErrorMessage,Message,true)
     }
   //}
  
 //}
 //catch()
   //{
   //}
}*/

//*****************************************************************************************************//

//Not in use
 // Function that could be used to round a number to a given decimal points. Returns the answer
// Arguments :  number - The number that must be rounded
//	decimal_points : The number of decimal points that should appear in the result
// Author Manjeet Singh Lotay as on January 08, 2008

function roundNumber(number,decimal_points) {
	if(!decimal_points) return Math.round(number);
	if(number == 0) {
		var decimals = "";
		for(var i=0;i<decimal_points;i++) decimals += "0";
		return "0."+decimals;
	}

	var exponent = Math.pow(10,decimal_points);
	var num = Math.round((number * exponent)).toString();
	return num.slice(0,-1*decimal_points) + "." + num.slice(-1*decimal_points)
}
//*****************************************************************************************************//

 //*************************************** Functions not in use END ******************************************* 
 
 //Created function to open new PDF file in new window.
 	function OpenPDFFIle()
 	{
   		try
    		{
		     var FileName = 'EngagementHealth_Overview_one_page_903170.pdf';
         	   var msAttributes1 ="status=no,toolbar=no,menubar=no,location=no,statusbar=yes,scroll=yes,scrollbars=yes,resizable=yes"			
                  var retValue=window.open("../Download.aspx?q=" + FileName,"Test",msAttributes1);
//		 var retValue=window.open("../PDF/" + FileName,"Test",msAttributes1);
		if(retValue==null)
       		{
  		       alert('Popup blocker has blocked your popup.Please allow this website in your popup blocker');          
     		 }

		}
	 	catch(ex)
 	        {
		      
	        }
	 }

