﻿// JScript File

// Global Functions 
// Created By Devinder Pal singh
function ShowPopup(url,left,top,width,height)
{ 

   try
   {
          
       var DivPopup=parent.document.getElementById('DivPopup');
        DivPopup.style.display='block';
        

        
        
        var iFramePopup=parent.document.getElementById('iFramePopup');
        iFramePopup.src= url;
        iFramePopup.style.display='block';
        iFramePopup.style.width=width+"px";
        iFramePopup.style.height=height+"px";
        iFramePopup.style.top=top+"px";
        iFramePopup.style.left=left+"px"; 
        
        var DivCoverAll=parent.document.getElementById('DivCoverAll');
        DivCoverAll.style.display='block';
        
        if (window.navigator.appVersion.indexOf('MSIE 6.0')>0)
        {
            //alert(document.documentElement.offsetHeight);
            
            DivCoverAll.runtimeStyle.setAttribute("height",parent.document.documentElement.offsetHeight+"px");
           
        }
   }
   catch(ex)
   {
   alert(ex);
   }
}
//Open Page
//Created By Sudhendu Tripathi
//Created Date 07/11/2007

function ShowRecurrencePage(hiddenName,RadioButtonRecurr)
    { 
        var PCID_PCName_DTime=document.getElementById(hiddenName).value;
//        alert(PCID_PCName_DTime);
//        alert(RadioButtonRecurr);
        //var Recurrval="RadioButtonListRecurrence_0";
         
        if(document.getElementById('RadioButtonListRecurrence_0').checked == true)
        {alert(document.getElementById('RadioButtonListRecurrence_0').value);
            PCID_PCName_DTime += "&OpenRecSeries=" + document.getElementById('RadioButtonListRecurrence_0').value;       
        }
        else if(document.getElementById('RadioButtonListRecurrence_1').checked == true)
        {alert( document.getElementById('RadioButtonListRecurrence_1').value);
            PCID_PCName_DTime += "&OpenRecSeries=" + document.getElementById('RadioButtonListRecurrence_1').value;
        }
        alert(PCID_PCName_DTime);
        OpenPageWithQueryString('Manage Calls',PCID_PCName_DTime);
       
        //ar_PCID_PCName_DTime=ar_PCID_PCName_DTime.split('&');
        //var PCID=ar_PCID_PCName_DTime[0];
        //var PCName=ar_PCID_PCName_DTime[1];        
        //var DatenTime = ar_PCID_PCName_DTime[2];  
        //var CultureOfDate = ar_PCID_PCName_DTime[3];  
        //alert(PCID_PCName_DTime);
        //OpenPageWithQueryString('Manage Calls','PCIDRec=' + ar_PCID_PCName_DTime[1]  );
        //OpenPageWithQueryString('Manage Calls','PCID=' + PCID + '&PCName=' + PCName + '&SelectedDateTime=' + DatenTime + '&CultureOfDate=' + CultureOfDate);
        return false;
    }
function ClosePopup()
{
    
     try
     {
        var DivPopup=parent.document.getElementById('DivPopup');
        DivPopup.style.display='none';
        
        var DivCoverAll=parent.document.getElementById('DivCoverAll');
        DivCoverAll.style.display='none'; 
        
         var iFramePopup=parent.document.getElementById('iFramePopup');
        if(iFramePopup!=null)
        {
            iFramePopup.src= '';
        }
        
     }
     catch(ex)
     {
     }
}



var RefreshCalled;
function PopupWindow(url) 
{
    var w = screen.availWidth, h = screen.availHeight;
    w=w-30;
    h=h-30;
    var l = (w)/2, t = (h)/2;
    location.href="RegistrationProcess.aspx";
    //window.open(url,"Registration","location=0,screenY=" + t + ",screenX=" + l +",toolbar=0,scrollbars=1,resizable=1,fullscreen=0, top=0, left=0,width=" + w + ", height=" + h);
    return false;
}
function OpenPopupWindow(url) 
{
    var w = screen.availWidth, h = screen.availHeight;
    w=w-30;
    h=h-30;
    var l = (w)/2, t = (h)/2;
   // location.href=url;
    window.open(url,'welcome','width=300,height=200,menubar=no,status=yes,location=no,toolbar=no,scrollbars=yes,resizable=1');
   // window.open(url,"ProgramDescription","location=0,screenY=" + t + ",screenX=" + l +",toolbar=0,scrollbars=1,resizable=1,fullscreen=0, top=0, left=0,width=" + w + ", height=" + h);
    return false;
}




function OpenNewPopupWindow(url,title)
{
    window.open(url,title,'width=600,height=300,menubar=no,status=yes,location=no,toolbar=no,scrollbars=yes,resizable=1');
}

//Created By - Pralyankar
function Next()
{
    __doPostBack("Page_Load", '');
}

function NextClicked(pageEvent)
{
    //document.getElementById("ctl00_ContentPlaceHolder1_HiddenFieldAction").value = pageEvent;
}

//-----------------------------------

function keypressHtmlTag(event)
{
    try
    {
        if(window.event)
        {
            if(event.keyCode==60 || event.keyCode==62) 
            { 
                event.returnValue=false;
                return false;
            } 
            else 
            {
                return true;
            } 
        }
        else if(event.which) 
        {
           if(event.which==60 || event.which==62) 
           { 
                event.returnValue=false;
                return false;
           } 
           else 
           { 
                return true;
           } 
        }
    }
    catch( exception  )
    {
        return false;
    }

}


// Function used in " SchedulingControl.ascx to show tick sign on selected cell. 
//Created by Vikramjeet on 21-june-07" 
function ChangeCellBackGroundOld(ClickedCellid,HdnPrevSelectedCellid)
{
    var PrevCellid=document.getElementById(HdnPrevSelectedCellid).value;
    if(PrevCellid != "-1")
    {   
        document.getElementById(PrevCellid).background='';    
    } 
    document.getElementById(ClickedCellid).background = 'App_Themes/Theme/images/Checked.gif';
    document.getElementById(HdnPrevSelectedCellid).value = ClickedCellid;
}


//Created By - Pralyankar
function Left(str, n){
	if (n <= 0)
	    return "";
	else if (n > String(str).length)
	    return str;
	else
	    return String(str).substring(0,n);
}

//Created By - Pralyankar
function Right(str, n){
    if (n <= 0)
       return "";
    else if (n > String(str).length)
       return str;
    else {
       var iLen = String(str).length;
       return String(str).substring(iLen, iLen - n);
    }
}


// Get Text of new language
// Created By Pralyankar
function GetLanguageMessage(PageID, ControlID, OriginalText, HiddenFieldID)
{
    try
    {
        // String Will be Seprated by '##Row##', '##Col##'
        var ArrayTable = document.getElementById(HiddenFieldID).value.split('##row##');

        // Find Text
        for (var i=0;i < ArrayTable.length; i++)
        {
            var ArrcolInfo = ArrayTable[i].split('##col##');
            if ( ArrcolInfo[0] == PageID && ArrcolInfo[1] == ControlID)
            {
                return ArrcolInfo[2];
            }
        }            
        return OriginalText;
    }
    catch(exception)
    {
    }
}


    function HistroyItemClicked1(Control, PageIndex, CommonProperties)
    {
          document.getElementById("HiddenPageName").value = Control;
          document.getElementById("HiddenPageIndex").value = PageIndex;
          document.getElementById("CommonProperties").value = CommonProperties;
        __doPostBack(Control,'');
    }

    function HistroyItemClicked(Control, PageIndex)
    {
        try
        {
            document.getElementById("HiddenPageName").value = Control;
            document.getElementById("HiddenPageIndex").value = PageIndex;
            __doPostBack(Control,'');
        }
        catch(exception)
        {
            //alert('HistroyItemClicked ---> '+exception);
        }
    }
// Open page
// Created By Pralyankar
function OpenNewPage(Control, PageName)
{
    try
    {
        var HiddenPageName = "HiddenPageName";
        document.getElementById(HiddenPageName).value = PageName;
        __doPostBack(Control, PageName);
    }
    catch(exception)
    {
    }
}


function OpenNewPageWithQueryString(PageName,QueryString)
{
    try
    {
        var HiddenPageName = "HiddenPageName";
        document.getElementById(HiddenPageName).value = PageName;
        __doPostBack(Control, PageName);
    }
    catch(exception)
    {
    }
}


// cancel Button Click
// Created By Pralyankar
function CancelClick()
{
    try
    {   if(document.getElementById('HiddenFieldEvents'))  // Line added by Vikramjeet on 13-Aug-07
        {
        document.getElementById('HiddenFieldEvents').value = "Cancel";
        return true;
        }
    }
    catch(exception)
    {
    }
}

function ClearLabel(controlName)
{
    try
    { 
        Page_ClientValidate();  // Line added by devinder on 16 Aug 2007
        if(document.getElementById(controlName))  // Line added by Vikramjeet on 13-Aug-07
        {
            document.getElementById(controlName).innerHTML = "";
            return true;
        }
    }
    catch(exception)
    {
    }
}

// Open page with Query string
// Created By Pralyankar
function OpenPageWithQueryString(PageName, QueryString)
{
    try
    {
       // alert(PageName); 
        document.getElementById("HiddenPageName").value = PageName;
        document.getElementById("hdQueryString").value = QueryString;           
        __doPostBack('ButtonNavigate',PageName);
    }
    catch(exception)
    {
        //alert(exception);
    }
}


    //Method for toolbar Button clicked
    function ButtonClick(Control)
    {
        try
        {
        if(Control == 'ButtonRefresh')
        {
            RefreshCalled = true;
        }
        //---- Written By Pralyankar -----
        window.frames[0].OpenNewPage(Control, Control);
        //--------------------------------

        //document.getElementById("HiddenPageName").value = Control;
        //__doPostBack(Control,'');        
        }
        catch(exception)
        {
            //alert(exception);
        }
    }
    
//Creted By Sanvir on Jan 03, 2008
/*Functiion for formatting Phone Number*/
//Called From Registration Participant OfficePhone -- Blur Event,
// Prevention Profile My Account OfficePhone -- Blur Event
//NewBrokerRegistration.ascx -- onblur Event
//The following function is used in BPMyAccount Page.
function PhoneFormatCheckWithExt(TextBoxClientID)
{  
    //_GlobalTextBox will use to hold TextBox whose value has to format in Phone Number
    var _GlobalTextBox=document.getElementById(TextBoxClientID);
    _GlobalTextBox.value=_GlobalTextBox.value.replace(/^\s+/,'').replace(/\s+$/,'');//To Trim the Value
    if(_GlobalTextBox.value.length<=0)//If No value in the field 
    {
        return;
    }
    //ExtStartIndex will be used to store the index from where "ext" text will start if present in the string
    //BeforeExtString will be used to store text which will actually be formatted
    //ExtString will store the extension
    var ExtStartIndex,ExtString="",BeforeExtString="";
    ExtStartIndex=_GlobalTextBox.value.search(/ext/i);
    BeforeExtString = _GlobalTextBox.value;
    //Follwing code will execute if "ext" will be in the String
    if(ExtStartIndex>=0)
    {
        ExtString=_GlobalTextBox.value.substring(ExtStartIndex);
        BeforeExtString = _GlobalTextBox.value.substring(0,ExtStartIndex);
    }
    BeforeExtString=BeforeExtString.replace(/[^0-9]/g,'');//To reremove any extra character from the Before string except Numeric
    if(ExtString.length>0)
    {
         ExtString=BeforeExtString.substring(10) + " " + ExtString;
    }
    else
    {
        ExtString=BeforeExtString.substring(10);// + " " + ExtString;
    }
    BeforeExtString=BeforeExtString.substring(0,10);//Beforstring will store first 10 Integer
    if(BeforeExtString.length<=4)
    {
        BeforeExtString = BeforeExtString.replace(/([0-9]{1})/, "()-$1");
    }
    else if(BeforeExtString.length>4 && BeforeExtString.length<=7)
    {
        BeforeExtString = BeforeExtString.replace(/([0-9]{3})([0-9]{4})/, "() $1-$2");

        BeforeExtString = BeforeExtString.replace(/([0-9]{2})([0-9]{4})/, "() $1-$2");

        BeforeExtString = BeforeExtString.replace(/([0-9]{1})([0-9]{4})/, "() $1-$2");
    }
    else if(BeforeExtString.length>7 && BeforeExtString.length<=10)
    {
        BeforeExtString = BeforeExtString.replace(/([0-9]{3})([0-9]{3})([0-9]{4})/, "($1) $2-$3");

        BeforeExtString = BeforeExtString.replace(/([0-9]{2})([0-9]{3})([0-9]{4})/, "($1) $2-$3");

        BeforeExtString = BeforeExtString.replace(/([0-9]{1})([0-9]{3})([0-9]{4})/, "($1) $2-$3");
    }
    else
    {
        BeforeExtString = BeforeExtString.replace(/([0-9]{3})([0-9]{3})([0-9]{4})([0-9]{5})/, "($1) $2-$3 $4");

        BeforeExtString = BeforeExtString.replace(/([0-9]{3})([0-9]{3})([0-9]{4})([0-9]{4})/, "($1) $2-$3 $4");

        BeforeExtString = BeforeExtString.replace(/([0-9]{3})([0-9]{3})([0-9]{4})([0-9]{3})/, "($1) $2-$3 $4");

        BeforeExtString = BeforeExtString.replace(/([0-9]{3})([0-9]{3})([0-9]{4})([0-9]{2})/, "($1) $2-$3 $4");

        BeforeExtString = BeforeExtString.replace(/([0-9]{3})([0-9]{3})([0-9]{4})([0-9]{1})/, "($1) $2-$3 $4");
    }
    //If Extension exist then add this with formatted Text 
    if(ExtString.length>0)
    {
        _GlobalTextBox.value = BeforeExtString + " " + ExtString;
    }
    else
    {
        _GlobalTextBox.value = BeforeExtString;
    }
    _GlobalTextBox.value=_GlobalTextBox.value.replace(/^\s+/,'').replace(/\s+$/,'');//To Trim the Value
}
//Used in MyAccount.ascx
function PhoneFormatCheck(TextBoxClientID)
{  
    //alert('111');
    var _GlobalTextBox=document.getElementById(TextBoxClientID);

    _GlobalTextBox.value = _GlobalTextBox.value.replace(/[^0-9]/g,'');

    if(_GlobalTextBox.value.length<=4)
    {
        _GlobalTextBox.value = _GlobalTextBox.value.replace(/([0-9]{1})/, "()-$1");
    }
    else if(_GlobalTextBox.value.length>4 && _GlobalTextBox.value.length<=7)
    {
        _GlobalTextBox.value = _GlobalTextBox.value.replace(/([0-9]{3})([0-9]{4})/, "() $1-$2");

        _GlobalTextBox.value = _GlobalTextBox.value.replace(/([0-9]{2})([0-9]{4})/, "() $1-$2");

        _GlobalTextBox.value = _GlobalTextBox.value.replace(/([0-9]{1})([0-9]{4})/, "() $1-$2");
    }
    else if(_GlobalTextBox.value.length>7 && _GlobalTextBox.value.length<=10)
    {
        _GlobalTextBox.value = _GlobalTextBox.value.replace(/([0-9]{3})([0-9]{3})([0-9]{4})/, "($1) $2-$3");

        _GlobalTextBox.value = _GlobalTextBox.value.replace(/([0-9]{2})([0-9]{3})([0-9]{4})/, "($1) $2-$3");

        _GlobalTextBox.value = _GlobalTextBox.value.replace(/([0-9]{1})([0-9]{3})([0-9]{4})/, "($1) $2-$3");
    }
    else
    {
        _GlobalTextBox.value = _GlobalTextBox.value.replace(/([0-9]{3})([0-9]{3})([0-9]{4})([0-9]{5})/, "($1) $2-$3 $4");

        _GlobalTextBox.value = _GlobalTextBox.value.replace(/([0-9]{3})([0-9]{3})([0-9]{4})([0-9]{4})/, "($1) $2-$3 $4");

        _GlobalTextBox.value = _GlobalTextBox.value.replace(/([0-9]{3})([0-9]{3})([0-9]{4})([0-9]{3})/, "($1) $2-$3 $4");

        _GlobalTextBox.value = _GlobalTextBox.value.replace(/([0-9]{3})([0-9]{3})([0-9]{4})([0-9]{2})/, "($1) $2-$3 $4");

        _GlobalTextBox.value = _GlobalTextBox.value.replace(/([0-9]{3})([0-9]{3})([0-9]{4})([0-9]{1})/, "($1) $2-$3 $4");
    }

}
 // Added by Vikramjeet on 23 july 07 -- commented by viks
 // this will be called by PreventionProfile\\CorePreventionProgram.ascx
 // this function is wriiten to stop extra call for activate of CorePreventionProgram.ascx because when we 
 // click on link (Health Screening) and these link are Linkbutton and normally link button postback our page
 // when we return false then postback will not be fired.
 /*function GetNextPageName(PageName,ParticipantProgramStepId)
 {
   OpenPageWithQueryString(PageName,ParticipantProgramStepId);
    return false;// to stop post back of page
 }*/
 
 
 
 
  
  function GetLocalizeDataByKey(HiddenFieldName,key)
  {
  
  var localizeData='';
  //var HiddenFieldKeyPairValue="key#COL#Value#ROW#key1#COL#Value1#ROW#key1#COL#Value1"
   var HiddenFieldKeyPairValue=document.getElementById(HiddenFieldName).value;
    // String Will be Seprated by '##Row##', '##Col##'
        //   var ArrayTable = document.getElementById(HiddenFieldID).value.split('##row##');
 //alert(HiddenFieldKeyPairValue);
            var ArrayTable=HiddenFieldKeyPairValue.split('#ROW#');
            
            for (var i=0;i < ArrayTable.length; i++)
            {    
                var ArrcolInfo = ArrayTable[i].split('#COL#');
                if(ArrcolInfo[0]==key)
                {
                    localizeData=ArrcolInfo[1];
                    break;
                } 
            }            
          return localizeData;
  
  }
  
  
  
  
  
  ///////////////////For Security Questions Dropdowns//////////////////////////////////////
    
        Array.prototype.remove=function(s)
        {
            for(i=0;i<this .length;i++)
            {
                if(s==this[i]) this.splice(i, 1);
            }
        }
       
        function addOption(selectbox,text,value )
        {
            try
            {
          //  alert('adop');
            var optn = document.createElement("OPTION");
            optn.text = text;
            optn.value = value;
           
           if (document.all)
               selectbox.options.add(optn);
           else
                selectbox.options[selectbox.options.length] = optn;

            //selectbox.options.add(optn);
            }
            catch(ex)
            {
            alert('addOption'+ex);
            }
        }

        //Called from Registration Participant control JS(ascx)--Sanvir Kumar Apr 02,2008
        function selectedOption(selectbox,selectedValue)
        {
        
       // alert('in');
            try
            {
                for(var i=0;i<selectbox.length;i++)
                {
                    if(selectbox.options[i].value==selectedValue) 
                    {
                       // alert(selectbox.options[i].value);
                        selectbox.selectedIndex =i;
                       // alert(selectbox.options[i].value);
                    }
                }
            }
            catch(e)
            {
            alert(e);
            }
        }
       
       
       function FillDistinctQuestions(DropFirstQuestion,DropSecondQuestion,DropThirdQuestion,GlobalQuestion,SelectQuestionText)
       { 
         
         try
         {
        // alert('enter');
            var DropFirstQuestion=document.getElementById(DropFirstQuestion);
            var DropSecondQuestion=document.getElementById(DropSecondQuestion);
            var DropThirdQuestion=document.getElementById(DropThirdQuestion);
            
            var FirstSelectedValue = DropFirstQuestion.options[DropFirstQuestion.selectedIndex].value ;
            var SecondSelectedValue = DropSecondQuestion.options[DropSecondQuestion.selectedIndex].value ;
            var ThirdSelectedValue = DropThirdQuestion.options[DropThirdQuestion.selectedIndex].value ;
               
            var TextValue;
            var SecondValue;
            var ThirdValue; 
         
        
            // Fill First Question DropDown Start    
            var FilteredQuestion=GlobalQuestion.split("|");
                
            if(DropSecondQuestion.selectedIndex!=0)
            {
                TextValue=DropSecondQuestion.options[DropSecondQuestion.selectedIndex].text+";"+DropSecondQuestion.options[DropSecondQuestion.selectedIndex].value;
                FilteredQuestion.remove(TextValue );
            }
            
            if(DropThirdQuestion.selectedIndex!=0)
            {
                TextValue=DropThirdQuestion.options[DropThirdQuestion.selectedIndex].text+";"+DropThirdQuestion.options[DropThirdQuestion.selectedIndex].value;
                FilteredQuestion.remove(TextValue);
            }
           
            DropFirstQuestion.length =0;
            
            addOption(DropFirstQuestion,SelectQuestionText,"0");
            for(var i=0;i<FilteredQuestion.length;i++)
            {
              var QuestionAnswers=FilteredQuestion[i].split(";");
              addOption(DropFirstQuestion,QuestionAnswers[0],QuestionAnswers[1]);
            }
            selectedOption(DropFirstQuestion,FirstSelectedValue);
            // Fill Fist Question DropDown End
         
         
         
            // Fill Second Question DropDown Start    
            var FilteredQuestion=GlobalQuestion.split("|");
                
            if(DropFirstQuestion.selectedIndex!=0)
            {
                TextValue=DropFirstQuestion.options[DropFirstQuestion.selectedIndex].text+";"+DropFirstQuestion.options[DropFirstQuestion.selectedIndex].value;
                FilteredQuestion.remove(TextValue );
            }
            if(DropThirdQuestion.selectedIndex!=0)
            {
                TextValue=DropThirdQuestion.options[DropThirdQuestion.selectedIndex].text+";"+DropThirdQuestion.options[DropThirdQuestion.selectedIndex].value;
                FilteredQuestion.remove(TextValue);
            }
           
            DropSecondQuestion.length =0;
            
            addOption(DropSecondQuestion,SelectQuestionText,"0");
            for(var i=0;i<FilteredQuestion.length;i++)
            {
              var QuestionAnswers=FilteredQuestion[i].split(";");
              addOption(DropSecondQuestion,QuestionAnswers[0],QuestionAnswers[1]);
            }
            
            selectedOption(DropSecondQuestion ,SecondSelectedValue );
            // Fill Second Question DropDown End
            
            
            
            // Fill Third Question DropDown Start    
            var FilteredQuestion=GlobalQuestion.split("|");
            
            if(DropFirstQuestion.selectedIndex!=0)
            {
                TextValue=DropFirstQuestion.options[DropFirstQuestion.selectedIndex].text+";"+DropFirstQuestion.options[DropFirstQuestion.selectedIndex].value;
                FilteredQuestion.remove(TextValue );
            }    
            if(DropSecondQuestion.selectedIndex!=0)
            {
                TextValue=DropSecondQuestion.options[DropSecondQuestion.selectedIndex].text+";"+DropSecondQuestion.options[DropSecondQuestion.selectedIndex].value;
                FilteredQuestion.remove(TextValue );
            }
            
           
            DropThirdQuestion.length =0;
            
            addOption(DropThirdQuestion,SelectQuestionText,"0");
            for(var i=0;i<FilteredQuestion.length;i++)
            {
           
              var QuestionAnswers=FilteredQuestion[i].split(";");
              addOption(DropThirdQuestion,QuestionAnswers[0],QuestionAnswers[1]);
            }
           selectedOption(DropThirdQuestion,ThirdSelectedValue);
            // Fill Third Question DropDown End
            
           
            return;
          //   QuestionAnswers=FilteredQuestion.split("|");
    }
    catch(e)
    {
        alert(e);
    }
            
       }
       
        function CheckMobilePhoneSecurityQuestion(DropQuestion1,DropQuestion2,DropQuestion3,LabelPreferencesError,BindText1,BindText2,BindText3,TextBoxMobile, CheckMobile, ErrorMessage)
        {
         
            var TxtBoxMobile=document.getElementById(TextBoxMobile);
            var ChkMobile=document.getElementById(CheckMobile);
            var LblError=document.getElementById(LabelPreferencesError);
           
            try
            {
                if(TxtBoxMobile==null || ChkMobile==null || LblError==null)
                {
                    return true;
                }
                PhoneFormatCheck(TextBoxMobile);
                SetLabelValue(LblError,"");
                
                if((ChkMobile.checked==true ) && (TxtBoxMobile.value.length==0 ))
                {  
                    SetLabelValue(LblError,ErrorMessage);
                    return false;
                }
                return CheckSecurityQuestion(DropQuestion1,DropQuestion2,DropQuestion3,LabelPreferencesError,BindText1,BindText2,BindText3);
                //return true;//returnBool;
            }
            catch(e)
            {
                alert(e);
            }
        }
       
  ////////////////////////////////////////////////////////////////////////////////////////
   function CheckSecurityQuestion(DropQuestion1,DropQuestion2,DropQuestion3,LabelPreferencesError,BindText1,BindText2,BindText3)
        {
            var DropFirstQuestion=document.getElementById(DropQuestion1);
            var DropSecondQuestion=document.getElementById(DropQuestion2);
            var DropThirdQuestion=document.getElementById(DropQuestion3);
            var LabelPreferencesErrorObj=document.getElementById(LabelPreferencesError);
            var ErrorMessage="";
            var returnBool=true;
            
      //  alert('in');
        
        
            try
            {
                if(DropFirstQuestion==null || DropSecondQuestion==null || DropThirdQuestion==null)
                {
                    return true;
                }
                SetLabelValue(LabelPreferencesErrorObj,"");
                if(DropFirstQuestion.selectedIndex==0)
                {
                   // LabelPreferencesErrorObj.innerText=BindText1;// "Select Security Question 1";
                   // SetLabelValue(LabelPreferencesErrorObj,BindText1,true);
                    ErrorMessage =BindText1;
                    //alert(LabelPreferencesErrorObj.innerText);
                  
                    //return false;
                    returnBool=false;
                }
                if(DropSecondQuestion.selectedIndex==0)
                {
                    //LabelPreferencesErrorObj.innerText= BindText2;// "Select Security Question 2";
                    if(ErrorMessage.length>0)
                    {
                        ErrorMessage += "\n";
                    }
                    ErrorMessage += BindText2;
                    returnBool=false;
                    //SetLabelValue(LabelPreferencesErrorObj,BindText2);
                    //return false;
                    //ErrorMessage=ErrorMessage +  BindText2 + "\n";
                   // return false;
                    //returnBool=false;
                }
                if(DropThirdQuestion.selectedIndex==0)
                {
                    //LabelPreferencesErrorObj.innerText= BindText3;// "Select Security Question 3";
                    if(ErrorMessage.length>0)
                    {
                        ErrorMessage += "\n";
                    }
                    ErrorMessage += BindText3;
                    returnBool=false;
                    //SetLabelValue(LabelPreferencesErrorObj,BindText3);
                    //return false;
                    // ErrorMessage=ErrorMessage +  BindText3 ;
                    //return false;
                    //returnBool=false;
                }
                //SetLabelValue(LabelPreferencesErrorObj,ErrorMessage);
                if(returnBool==false)
                {
                    SetLabelValue(LabelPreferencesErrorObj,ErrorMessage,true);
                }
                return returnBool;//returnBool;
            }
            catch(e)
            {
                alert(e);
            }
        }
      
      
        function CheckSecurityQuestionReg(DropQuestion1,DropQuestion2,DropQuestion3,BindText1,BindText2,BindText3,LabelSecurity1,LabelSecurity2,LabelSecurity3)
        {
            Page_ClientValidate(); 
            var DropFirstQuestion=document.getElementById(DropQuestion1);
            var DropSecondQuestion=document.getElementById(DropQuestion2);
            var DropThirdQuestion=document.getElementById(DropQuestion3);
            //var LabelPreferencesErrorObj=document.getElementById(LabelPreferencesError);
            var LabelSecurityQuestion1=document.getElementById(LabelSecurity1);
            var LabelSecurityQuestion2=document.getElementById(LabelSecurity2);
            var LabelSecurityQuestion3=document.getElementById(LabelSecurity3);
            var returnFlag=1;
            
      //  alert('in');
        
        
            try
            {
                SetLabelValue(LabelSecurityQuestion1,"");
                SetLabelValue(LabelSecurityQuestion2,"");
                SetLabelValue(LabelSecurityQuestion3,"");
               // LabelSecurityQuestion1.innerText="";
              //  LabelSecurityQuestion2.innerText="";
              //  LabelSecurityQuestion3.innerText="";
             
                if(DropFirstQuestion==null || DropSecondQuestion==null || DropThirdQuestion==null)
                {
                    return true;
                }
               
                if(DropFirstQuestion.selectedIndex==0)
                { 
                    SetLabelValue(LabelSecurityQuestion1,BindText1);
                    //LabelSecurityQuestion1.innerHTML=BindText1;// "Select Security Question 1";
                    //alert(LabelPreferencesErrorObj.innerText);
                    returnFlag=0;//return false;
                }
                if(DropSecondQuestion.selectedIndex==0)
                { 
                    SetLabelValue(LabelSecurityQuestion2,BindText2);
                   // LabelSecurityQuestion2.innerText= BindText2;// "Select Security Question 2";
                    returnFlag=0;//return false;
                }
                if(DropThirdQuestion.selectedIndex==0)
                { 
                    SetLabelValue(LabelSecurityQuestion3,BindText3);
                    //LabelSecurityQuestion3.innerText= BindText3;// "Select Security Question 3";
                    returnFlag=0;//return false;
                }
                if(returnFlag==0)
                {
                    return false;
                }
                return true;
            }
            catch(e)
            {
            alert(e);
            }
            
        }
        //Added By Sanvir on May 7, 2008-> Called from Registration Password to attach event in security questions driopdowns
        function CheckSecurityQuestionDropDown(DropQuestion,LabelSecurity,BindText)
        {
          //  Page_ClientValidate(); 
            var DropFirstQuestion=document.getElementById(DropQuestion);
            //var DropSecondQuestion=document.getElementById(DropQuestion2);
           // var DropThirdQuestion=document.getElementById(DropQuestion3);
            //var LabelPreferencesErrorObj=document.getElementById(LabelPreferencesError);
            var LabelSecurityQuestion=document.getElementById(LabelSecurity);
            //var LabelSecurityQuestion2=document.getElementById(LabelSecurity2);
            //var LabelSecurityQuestion3=document.getElementById(LabelSecurity3);
            var returnFlag=1;
            
      //  alert('in');
        
        
            try
            {
                SetLabelValue(LabelSecurityQuestion,"");
                //SetLabelValue(LabelSecurityQuestion2,"");
                //SetLabelValue(LabelSecurityQuestion3,"");
               // LabelSecurityQuestion1.innerText="";
              //  LabelSecurityQuestion2.innerText="";
              //  LabelSecurityQuestion3.innerText="";
             
                if(DropFirstQuestion==null)// || DropSecondQuestion==null || DropThirdQuestion==null)
                {
                    return true;
                }
               
                if(DropFirstQuestion.selectedIndex==0)
                { 
                    SetLabelValue(LabelSecurityQuestion,BindText);
                    //LabelSecurityQuestion1.innerHTML=BindText1;// "Select Security Question 1";
                    //alert(LabelPreferencesErrorObj.innerText);
                    returnFlag=0;//return false;
                }                
                if(returnFlag==0)
                {
                    return false;
                }
                return true;
            }
            catch(e)
            {
           // alert(e);
            }
            
        }
      
      