﻿function ChangeImageSourceForLOC(site, loc)
{
    loc = (loc == '') ? 'en-US' : loc;
    //loc = site + '/' + loc;
    loc = loc.toLowerCase();
    site = site.toLowerCase();
    var allImages = document.getElementsByTagName("img");
    for(count = 0; count < allImages.length; count++)
    {
        if(allImages[count].src.indexOf(loc) == -1) 
        {
            if(allImages[count].src.toLowerCase().indexOf('images/') != -1) 
            {
                allImages[count].src = allImages[count].src.toLowerCase().replace('en-us', loc).replace('CloudServicesReady', site);
            }
            //else if(allImages[count].src.indexOf('Images/') != -1) 
            //{
            //    allImages[count].src = allImages[count].src.replace('en-US',loc);
            //}
        }
    }
    var allInputImages = document.getElementsByTagName("input");
    for(count = 0; count < allInputImages.length; count++)
    {
        if(allInputImages[count].type == "image")
        {
            if(allInputImages[count].src.indexOf(loc) == -1) 
            {
                if(allInputImages[count].src.toLowerCase().indexOf('images/') != -1) 
                {
                    allInputImages[count].src = allInputImages[count].src.toLowerCase().replace('en-us', loc).replace('CloudServicesReady', site);
                }
                //else if(allInputImages[count].src.indexOf('Images/') != -1) 
                //{
                //    allInputImages[count].src = allInputImages[count].src.replace('en-US',loc);
                //}
            }
        }
    }
}


//
function AllAnchorTitle()
{
    var allanchors = document.getElementsByTagName("a");
    for(count = 0; count < allanchors.length; count++)
    {
        if(allanchors[count].title == "")
        {
            if(allanchors[count].firstChild != null)
                allanchors[count].title = allanchors[count].firstChild.data;
        }
    }
}

function doClick(buttonName,e)
{
//the purpose of this function is to allow the enter key to 
//point to the correct button to click.
    var key;

     if(window.event)
          key = window.event.keyCode;     //IE
     else
          key = e.which;     //firefox

    if (key == 13)
    {
        //Get the button the user wants to have clicked
        var btn = document.getElementById(buttonName);
        if (btn != null)
        { //If we find the button click it
            btn.click();
            event.keyCode = 0
        }
    }
}






function ShowMessege(Buttonname)
{
    if (Buttonname.innerHTML == "Finalize Assessment")
    {
        return window.confirm('Do you want to Finalize the assessment?');
    }
    else
    {
        return window.confirm('Do you want to Reopen the assessment?');
    } 
}

//
function EnableNext()
{
    var imgbtnRegister = document.getElementById(document.getElementById('hdnNextButton').value);
    var src = document.getElementById(document.getElementById('hdnCheckBox').value);
    if (null != imgbtnRegister)
    {
        if (src == null && src == undefined )
            imgbtnRegister.disabled = false;
        else if (src.checked == true)
            imgbtnRegister.disabled = false;
        else
            imgbtnRegister.disabled = true;
    }
}

//
function Redirect(RedirectLocation)
{
    window.location = RedirectLocation;
}

//
function ValidateFax(src,args)
{
    var ValidChars = "0123456789-()";
    var fax = document.getElementById(document.getElementById('hdnFax').value).value;
    
    var strChar;
    var blnValid = true;
    var count = 0;
    for(count = 0; count < fax.length && blnValid == true; count++)
    {
        strChar = fax.charAt(count);
        if(ValidChars.indexOf(strChar) != -1)
            blnValid = true;
        else
            blnValid = false;
    }
    args.IsValid = blnValid;
}

function ValidateState(src,args)
{
    if ((document.getElementById('divUsState').style.display == "block") || (document.getElementById('divUsState').style.display == ""))
    {
        if (src.disabled == false)
        {
            src.errormessage = "Please select State.";
            if(rdddlState.GetText() != "-Select State-")
                args.IsValid = true;
            else
                args.IsValid = false;
        }
    }
    else
    {
        if (document.getElementById('rdtxtState') != null)
        {
            src.errormessage = "Please enter the State.";
            if (document.getElementById('rdtxtState').value == "")
                args.IsValid = false;
            else
                args.IsValid = true;
        }
    }
}

function YetToBeImplemented()
{
    alert('This Page is yet to be Implemented');
    return false;
}

function ValidateSpacesInPassword(src,args)
{
    var Password = document.getElementById(document.getElementById('hdnPassword').value).value
    if(Password.indexOf(' ') == -1)
        args.IsValid = true;
    else
        args.IsValid = false;
}

function ValidatePreAssessmentPage(src, args)
{
    var KPA = document.getElementById(document.getElementById('hdnKPA').value);
    var KSF = document.getElementById(document.getElementById('hdnKSF').value);
    if(KPA.firstChild.innerHTML.indexOf('-Select a KPA-') != -1)
    {
        src.errormessage = "Please Select KPA and then KSF to take an Assessment.";
        args.IsValid = false;
    }
    else
    {
        if(KSF.firstChild.innerHTML.indexOf('-Select a KSF-') != -1)
        {
            src.errormessage = "Please Select KSF to take an Assessment.";
            args.IsValid = false;
        }
        else
        {
            args.IsValid = true;
        }
    }
}

function ValidateAssessmentGroupname(src,args)
{
    var IDs = document.getElementById('hdnIDs').value;
    var rdtxtAssessmentGroupName = document.getElementById(IDs.split(',')[1]);
    var KPAText = document.getElementById(IDs.split(',')[2]).children[0].getElementsByTagName("input")[0].value;
    if ("-Select a KPA-" == KPAText)
    {
        src.errormessage = "Please select a KPA.";
        args.IsValid = false;
    }
    else
    {
        if (rdtxtAssessmentGroupName.value == "")
        {
            src.errormessage = "Please enter a name for the assessment group.";
            args.IsValid = false;
        }
        else
        {
            args.IsValild = true;
        }
    }
}
function CopyToHDNField(src)
{
    var IDs = document.getElementById('hdnIDs').value;
    document.getElementById(IDs.split(',')[0]).value = src.value;
}

function CopyFromRadioToHDNField(VALUE)
{
    var IDs = document.getElementById('hdnIDs').value;
    var AssessmentGroupName = VALUE + " [" + new Date().getDate() + "-" + new Date().toString().substring(4,7) + "-" + new Date().getFullYear() + "]";
    document.getElementById(IDs.split(',')[0]).value = AssessmentGroupName;
    document.getElementById(IDs.split(',')[1]).value = AssessmentGroupName;
}

function Toggler(anchorObject, Details, Plus, Minus, PlusClass, MinusClass)
{
    var DetailsObject = document.getElementById(Details);
    var status = DetailsObject.style.display;
    if( status == 'none' )
    {
        anchorObject.firstChild.data = Minus;
        anchorObject.className = MinusClass;
        anchorObject.title = Minus;
        DetailsObject.style.display = 'block';
    }
    else
    {
        anchorObject.firstChild.data = Plus;
        anchorObject.className = PlusClass;
        anchorObject.title = Plus;
        DetailsObject.style.display = 'none';
    }
}

// Whenever New Page is Added and is inherited from the MuralOSASiteMaster,
// switch case must be updated to take care of the menu items
function MenuContext()
{
    var Location = document.location.pathname.replace('/','').toLowerCase();
    if (Location.indexOf('.aspx') != -1)
    {
        switch(Location)
        {        
            case "assessmentgroupdetails.aspx":
                MenuPage();
                break;
            case "errorage.aspx":
                MenuPage();
                HighlightCurrent("smenu1");
                break;
            case "home.aspx":
                MenuPage();
                HighlightCurrent("smenu1");
                break;
            case "initialprofilesurvey.aspx":
                MenuPage();
                break;
            case "kpaassessmentreport.aspx":
                MenuPage();
                break;
            case "kpaselectforassessment.aspx":
                MenuPage();
                break;
            case "ksflevelview.aspx":
                NonMenuPage();
                break;
            case "ksfreport.aspx":
                MenuPage();
                break;
            case "login.aspx":
                NonMenuPage();
                break;
            case "logintoken.aspx":
                NonMenuPage();
                break;
            case "muralosahome.aspx":
                NonMenuPage();
                break;
            case "muralosaregistration.aspx":
                NonMenuPage();
                HighlightCurrent("smenu3");
                break;
            case "quickassessment.aspx":
                MenuPage();
                break;
            case "readonlyassesment.aspx":
                NonMenuPage();
                break;
            case "termsandconditions.aspx":
                NonMenuPage();
                break;
            case "errorpage.aspx":
                NonMenuPage();
                break;
            case "logintoken.aspx":
                NonMenuPage();
                break;
            case "forgotpassword.aspx":
                NonMenuPage();
                break;
            case "muralresources.aspx":
                MenuPage();
                HighlightCurrent("smenu6");
                break;
            case "muralselectedresource.aspx":
                MenuPage();
                HighlightCurrent("smenu6");
                break;
            case "supportingusers.aspx":
                MenuPage();
                break;
            case "delegation.aspx":
                MenuPage();
                break;
            case "inserthtmlcontent.aspx":
                NonMenuPage();
                break;
            case "AssignSurveys.aspx":
                NonMenuPage();
                break;
            case "uploaddocument.aspx":
                NonMenuPage();
                break;
            case "documents.aspx":
                MenuPage();
                HighlightCurrent("smenu2");
                break;
            default:
                NonMenuPage();
                HighlightCurrent("none");
                break;        
        }
    }
    else
    {
        NonMenuPage();
    }
}
function MenuPage()
{
    var smenu1 = document.getElementById('smenu1');
    var smenu2 = document.getElementById('smenu2');
    var smenu3 = document.getElementById('smenu3');
    var smenu5 = document.getElementById('smenu5');
    var smenu6 = document.getElementById('smenu6');
    try
    {
        smenu1.style.display = "block";
        smenu3.style.display = "block";
        smenu5.style.display = "block";
        smenu6.style.display = "block";
        
        if(document.location.pathname.indexOf('urvey') != -1)
        {
            if(smenu2.style.display != 'none')
            {
                smenu2.style.display = "block";
            }
            else
                smenu2.style.display = "none";
        }
        else
            smenu2.style.display = "block";
    }
    catch(e)
    {
    }
}
function NonMenuPage()
{
    var smenu1 = document.getElementById('smenu1');
    var smenu2 = document.getElementById('smenu2');
    var smenu3 = document.getElementById('smenu3');
    var smenu5 = document.getElementById('smenu5');
    var smenu6 = document.getElementById('smenu6');
    try
    {
        smenu1.style.display = "none";
        smenu2.style.display = "none";
        smenu3.style.display = "none";
        smenu5.style.display = "none";
        smenu6.style.display = "none";
    }
    catch(e)
    {
    }
}
function HighlightCurrent(menu)
{
    var smenu1 = document.getElementById('smenu1');
    var smenu2 = document.getElementById('smenu2');
    var smenu3 = document.getElementById('smenu3');
    var smenu5 = document.getElementById('smenu5');
    var smenu6 = document.getElementById('smenu6');
    try
    {
        switch(menu)
        {
            case "smenu1":
                smenu1.className = smenu1.className + " current-nav";
                smenu2.className = smenu2.className.replace('current-nav','');
                smenu3.className = smenu3.className.replace('current-nav','');
                smenu5.className = smenu5.className.replace('current-nav','');
                smenu6.className = smenu6.className.replace('current-nav','');
                break;
            case "smenu2":
                smenu1.className = smenu1.className.replace('current-nav','');
                smenu2.className = smenu2.className + " current-nav";
                smenu3.className = smenu3.className.replace('current-nav','');
                smenu5.className = smenu5.className.replace('current-nav','');
                smenu6.className = smenu6.className.replace('current-nav','');
                break;
            case "smenu3":
                smenu1.className = smenu1.className.replace('current-nav','');
                smenu2.className = smenu2.className.replace('current-nav','');
                smenu3.className = smenu3.className + " current-nav";
                smenu5.className = smenu5.className.replace('current-nav','');
                smenu6.className = smenu6.className.replace('current-nav','');
                break;
            case "smenu5":
                smenu1.className = smenu1.className.replace('current-nav','');
                smenu2.className = smenu2.className.replace('current-nav','');
                smenu3.className = smenu3.className.replace('current-nav','');
                smenu5.className = smenu5.className + " current-nav";
                smenu6.className = smenu6.className.replace('current-nav','');
                break;
            case "smenu6":
                smenu1.className = smenu1.className.replace('current-nav','');
                smenu2.className = smenu2.className.replace('current-nav','');
                smenu3.className = smenu3.className.replace('current-nav','');
                smenu5.className = smenu5.className.replace('current-nav','');
                smenu6.className = smenu6.className + " current-nav";
                break;
            case "none":
                smenu1.className = smenu1.className.replace('current-nav','');
                smenu2.className = smenu2.className.replace('current-nav','');
                smenu3.className = smenu3.className.replace('current-nav','');
                smenu5.className = smenu5.className.replace('current-nav','');
                smenu6.className = smenu6.className.replace('current-nav','');
                break;
        }
    }
    catch(e)
    {
    }
}
function ShowHideDYN(displayvalue)
{
    if(displayvalue == "none")
    {
		MenuPage();
        document.getElementById('DYK').style.display = displayvalue;
    }
    else if(displayvalue == "block")
    {
		NonMenuPage();
        document.getElementById('DYK').style.display = displayvalue;
    }
    else
    {
		NonMenuPage();
        document.getElementById('DYK').style.display = "none";
    }
}
function CriteriaWindow(URl,WindowName,width,height)
{
    var RadWindow = window.radopen(URl,WindowName);
//    var leftVal = (screen.width - width) / 2;
//    var topVal = (screen.height - height) / 2;
    RadWindow.setSize(width,height);
//    RadWindow.MoveTo(leftVal, topVal);
    return false;
}
function ResponseWindow(URl,WindowName,width,height)
{
    var RadWindow = window.radopen(URl,WindowName);
//    var leftVal = (screen.width - width) / 2;
//    var topVal = (screen.height - height) / 2;
    RadWindow.setSize(width,height);
//    RadWindow.MoveTo(leftVal, topVal);
    return false;
}
/* */
function centerUpdatePanel()
{
    centerElementOnScreen(document.getElementById('ctl00_rdAjaxLoadingPanel'));
}

function centerElementOnScreen(element)
{
    var scrollTop = document.body.scrollTop;
    var scrollLeft = document.body.scrollLeft;

    var viewPortHeight = document.body.clientHeight;
    var viewPortWidth = document.body.clientWidth;

    if (document.compatMode == "CSS1Compat")
    {
        viewPortHeight = document.documentElement.clientHeight;
        viewPortWidth = document.documentElement.clientWidth;

        scrollTop = document.documentElement.scrollTop;
        scrollLeft = document.documentElement.scrollLeft;
    }

    var topOffset = Math.ceil(viewPortHeight/2 - element.offsetHeight/2);
    var leftOffset = Math.ceil(viewPortWidth/2 - element.offsetWidth/2);

    var top = scrollTop + topOffset;
    var left = scrollLeft + leftOffset;

    element.firstChild.height = top + "px";
    element.firstChild.width = left + "px";
 }
/* */
function PlaceLoadingImage()
{
    var ctl = document.getElementById('ctl00_rdAjaxLoadingPanel');
    if ((ctl != null) && (ctl != undefined))
    {
        centerElementOnScreen(ctl);
    }
}
function ToggleVisibilityNewAssessmentMenu(ShowHide)
{
    if((document.getElementById('smenu2') != null) && (document.getElementById('smenu2') != undefined))
        document.getElementById('smenu2').style.display = ShowHide;
}

function LoadLOCjs(LOC)
{
    var HEAD = document.getElementsByTagName("head")[0];
    for(count = 0; count < HEAD.children.length; count++)
    {
        if (HEAD.children[count].nodeName == "SCRIPT" )
        {
            HEAD.children[count].src.replace('en-US',LOC);
        }
    }
}
function HelpWindow(URl,WindowName,width,height)
{
    var RadWindow = window.radopen(URl,WindowName);
//    var leftVal = (screen.width - width) / 2;
//    var topVal = (screen.height - height) / 2;
    RadWindow.setSize(width,height);
//    RadWindow.MoveTo(leftVal, topVal);
    return false;
}
function KWHelpWindow(URl,WindowName,width,height)
{    
    var RadWindow = window.radopen(URl,WindowName);
//   var leftVal = (screen.width - width) / 2;
//    var topVal = (screen.height - height) / 2;
    RadWindow.setSize(width, height);
    RadWindow.center();    
//    RadWindow.MoveTo(leftVal, topVal);
    return false;
}

function KWHelpWindow_Close(WindowName)
{
    var oManager = GetRadWindowManager();
    var KWHelpWindow = oManager.getWindowByName(WindowName);
    KWHelpWindow.close();
    return false;
}
function UploadDocumentWindow(URl,WindowName,width,height)
{
    var RadWindow = window.radopen(URl,WindowName);
    var leftVal = (screen.width - width) / 2;
    var topVal = (screen.height - height) / 2;
    if (RadWindow != undefined)
    {
        RadWindow.setSize(width,height);
        RadWindow.MoveTo(leftVal, topVal);
    }
    return false;
}
function OpenPopup(src)
{
    window.open(src,'HTMLContent','status=true,toolbar=no,menubar=no,ontop=true,scrollbars=yes,width=770,height=640,resizable=no');
    return false;
}

function OpenUploadPopup(src)
{
    window.open(src,'HTMLContent','status=true,toolbar=no,menubar=no,ontop=true,scrollbars=yes,width=590,height=320,resizable=no');
    return false;
}

function RefreshParent()
{
    try
    {
        window.opener.parent.location.reload();
    }
    catch(e)
    {
    }
}
function MaxLength(txt,maxLen)
{
    if(txt.value.length > (maxLen-1)) 
    {
        txt.value = txt.value.substr(0,maxLen);
        return false;
    }
}
function ValidateTitle(src, args)
{
    var ValidChars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789() ';
    var Title = document.getElementById(document.getElementById('hdnIDs').value.split(',')[0]).value;
    var strChar;
    var FindList = '';
    for(i = 0; i < Title.length; i++)
    {
        strChar = Title.charAt(i);
        if(ValidChars.indexOf(strChar) == -1)
            FindList = FindList + '0';
        else
            FindList = FindList + '1';
    }
    if(FindList.indexOf('0') != -1)
        args.IsValid = false;
    else
        args.IsValid = true;
}
function ValidateTags(src, args)
{
    var ValidChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789() ";
    var Tags = document.getElementById(document.getElementById('hdnIDs').value.split(',')[1]).value;
    var strChar;
    var FindList = '';
    if(Tags.split(',').length > 1)
    {
        for(j = 0; j < Tags.split(',').length; j++)
        {
            for(i = 0; i < Tags.split(',')[j].length; i++)
            {
                strChar = Tags.split(',')[j].charAt(i);
                if(ValidChars.indexOf(strChar) == -1)
                    FindList = FindList + '0';
                else
                    FindList = FindList + '1';
            }
        }
    }
    else
    {
        for(i = 0; i < Tags.length; i++)
        {
            strChar = Tags.charAt(i);
            if(ValidChars.indexOf(strChar) == -1)
                FindList = FindList + '0';
            else
                FindList = FindList + '1';
        }
    }
    if(FindList.indexOf('0') != -1)
        args.IsValid = false;
    else
        args.IsValid = true;
}
function ValidateFileUpload(src, args)
{
    if(document.getElementById(document.getElementById('hdnIDs').value.split(',')[2]).value != '')
        args.IsValid = true;
    else
        args.IsValid = false;
}

function RefreshParentAndCloseUploadDocumentPage(SDFID)
{
    try
    {
        if(window.opener.parent.location.href.indexOf('?') == -1)
            window.opener.parent.location.href = window.opener.parent.location.href + "?SDFID=" + SDFID;
        else
        {
            if(window.opener.parent.location.href.indexOf('?SDFID=') == -1)
                window.opener.parent.location.href = window.opener.parent.location.href + "&SDFID=" + SDFID;
            else
                window.opener.parent.location.href = window.opener.parent.location.href.split('?')[0] + "?SDFID=" + SDFID;
        }
        window.close();
    }
    catch(e)
    {
    }
}
function ValidateFileUploadExtensions(control, errormsg, commaseperatedextensions)
{
    commaseperatedextensions = commaseperatedextensions.toLowerCase();
    var Actual = document.getElementById(control.id);
    var filename = Actual.value.split("\\")[Actual.value.split("\\").length - 1];
    if (filename.indexOf('.') != -1)
    {
        var actualextension = filename.split('.')[1];
        var extensions = commaseperatedextensions.split(',');
        for(count = 0 ;count < extensions.length; count++ )
        {
            if (actualextension == extensions[count])
                return true;
        }
        ReplaceClonedControlAndAlert(Actual, errormsg);
    }
    else
    {
        ReplaceClonedControlAndAlert(Actual, errormsg);
    }
}
function ReplaceClonedControlAndAlert(control, errormsg)
{
    var Replace = control.cloneNode(false);
    Replace.onchange= control.onchange;
    Replace.value = '';
    control.parentNode.replaceChild(Replace, control);
    alert(errormsg);
}

function ChangePasswordOption(srcvalue)
{
    var PWDs = document.getElementById('hdnPWDCPWD').value;
    var PasswordVAlidators = document.getElementById('hdnPasswordValidators').value;
    if(srcvalue.checked)
    {
        document.getElementById(PWDs.split(',')[0]).disabled = false;
        document.getElementById(PWDs.split(',')[0]).value = '';
        document.getElementById(PWDs.split(',')[1]).disabled = false;
        document.getElementById(PWDs.split(',')[1]).value = '';
        ValidatorEnable(document.getElementById(PasswordVAlidators.split(',')[0]), true);
        ValidatorEnable(document.getElementById(PasswordVAlidators.split(',')[1]), true);
        ValidatorEnable(document.getElementById(PasswordVAlidators.split(',')[2]), true);
        ValidatorEnable(document.getElementById(PasswordVAlidators.split(',')[3]), true);
    }
    else
    {
        if ((document.getElementById(PWDs.split(',')[0])) != null || (document.getElementById(PWDs.split(',')[0]) != undefined))
        {
            document.getElementById(PWDs.split(',')[0]).disabled = true;
            document.getElementById(PWDs.split(',')[0]).value = '';
        }
        if ((document.getElementById(PWDs.split(',')[1])) != null || (document.getElementById(PWDs.split(',')[1]) != undefined))
        {
            document.getElementById(PWDs.split(',')[1]).disabled = true;
            document.getElementById(PWDs.split(',')[1]).value = '';
        }
        try
        {
            ValidatorEnable(document.getElementById(PasswordVAlidators.split(',')[0]), false);
        }
        catch(ex)
        {
        }
        try
        {
            ValidatorEnable(document.getElementById(PasswordVAlidators.split(',')[1]), false);
        }
        catch(ex)
        {
        }
        try
        {
            ValidatorEnable(document.getElementById(PasswordVAlidators.split(',')[2]), false);
        }
        catch(ex)
        {
        }
        try
        {
            ValidatorEnable(document.getElementById(PasswordVAlidators.split(',')[3]), false);
        }
        catch(ex)
        {
        }
    }
}

function ChangePasswordOnLoad()
{
    if(document.getElementById(document.getElementById('hdnChangePassword').value) != null)
    {
        document.getElementById(document.getElementById('hdnChangePassword').value).checked = false;
        ChangePasswordOption(document.getElementById(document.getElementById('hdnChangePassword').value));
    }
}

function ValidateCommunicationPrefernce(src, args)
{
    var CheckBox1 = document.getElementById(document.getElementById('hdnCheckBoxes').value.split(',')[0]).checked;
    var CheckBox2 = document.getElementById(document.getElementById('hdnCheckBoxes').value.split(',')[1]).checked;
    if (CheckBox1 || CheckBox2)
        args.IsValid = true;
    else
        args.IsValid = false;
}

function EnableCorrespondingValidators(src, number)
{
    var ValidatorsID = document.getElementById('hdnValidators' + number.toString()).value;
    try
    {
        ValidatorEnable(document.getElementById(ValidatorsID.split(',')[0]), false);
        //ValidatorEnable(document.getElementById(ValidatorsID.split(',')[0]), src.checked);
    }
    catch(ex)
    {
    }
    try
    {
        ValidatorEnable(document.getElementById(ValidatorsID.split(',')[1]), src.checked);
    }
    catch(ex)
    {
    }
    try
    {
        ValidatorEnable(document.getElementById(ValidatorsID.split(',')[2]), false);
        //ValidatorEnable(document.getElementById(ValidatorsID.split(',')[2]), src.checked);
    }
    catch(ex)
    {
    }
    var txtIDs = document.getElementById('hdntxtOption' + number.toString() + 'Address').value;
    var Mode;
    if (src == null || src == undefined)
        Mode = false;
    else
        Mode = src.checked;
    try
    {
        document.getElementById(txtIDs.split(',')[0]).disabled = !Mode;
        document.getElementById(txtIDs.split(',')[1]).disabled = !Mode;
    }
    catch(ex)
    {
    }
}

function EnableCorrespondingValidatorsInitially()
{
    var CheckBoxesID = document.getElementById('hdnCheckBoxes').value;
    EnableCorrespondingValidators(document.getElementById(CheckBoxesID.split(',')[0]), 1);
    EnableCorrespondingValidators(document.getElementById(CheckBoxesID.split(',')[1]), 2);
}

function PasswordValidatorsInitially()
{
    if ((document.getElementById('ChangePassword') != null) && (document.getElementById('ChangePassword') != undefined))
    {
//        ChangePasswordOption(false);
//        ChangePasswordOption(true);
//        ChangePasswordOption(false);
        ChangePasswordOption(document.getElementById('ChangePassword').checked);
    }
        //ChangePasswordOption(document.getElementById('ChangePassword'));
}

function ValidateVerticalSelection(src, args)
{
    var found = '';
    var CheckBoxList = document.getElementById(document.getElementById('hdnCheckBoxList').value).getElementsByTagName("input");
    for(var count = 0; count < CheckBoxList.length; count++)
    {
        if ((CheckBoxList[count].type == "checkbox") && CheckBoxList[count].checked)
            found = found + '1';
    }
    if(found.indexOf('1') != -1)
        args.IsValid = true;
    else
        args.IsValid = false;
}
function ToggleAssessmentDetails(anchorObject,Details,Plus,Minus)
{
    var DetailsObject = document.getElementById(Details);
    var status = DetailsObject.style.display;
    if( status == 'none' )
    {
        anchorObject.firstChild.data = Minus;

        anchorObject.title = Minus;
        DetailsObject.style.display = 'block';
    }
    else
    {
        anchorObject.firstChild.data = Plus;

        anchorObject.title = Plus;
        DetailsObject.style.display = 'none';
    }
}
function ShowReportGenMsg()
{
    return confirm('Generating Report may take few seconds..\nClick ok to continue.');
}
function ChanePhaseId1(acountid)
{
   
    var phases = document.getElementById('phases').value;
    var dropdown = document.getElementById(phases.split(',')[0]);
//    if(dropdown.value != '')
//        window.open('Report.aspx?PID=' + dropdown.value);
    if (dropdown.value != '')
    {
        if (ShowReportGenMsg())
        {
            document.getElementById('report').innerHTML = "<iframe height=\"0px\" weight=\"0px\" src=\"Report.aspx?PID=" + dropdown.value + "&AID=" + acountid + "\"></iframe>";
        }
        else
        {
            dropdown.selectedIndex = 0;
        }
        
    }
}
function ChanePhaseId2()
{
    var phases = document.getElementById('phases').value;
    var dropdown = document.getElementById(phases.split(',')[1]);
//    if(dropdown.value != '')
//        window.open('Report.aspx?PID=' + dropdown.value);
    if (dropdown.value != '')
    {
        if (ShowReportGenMsg())
        {
            document.getElementById('report').innerHTML = "<iframe height=\"0px\" weight=\"0px\" src=\"Report.aspx?PID=" + dropdown.value + "&AID=" + acountid + "\"></iframe>";
        }
        else
        {
            dropdown.selectedIndex = 0;
        }        
    }
}
function MSFTAccountManager(itemvalue)
{
    var txtAccountManagerName = document.getElementById(document.getElementById('hdntxtAccountManagerName').value);
    var rfvAccountManagerName = document.getElementById(document.getElementById('hdnrfvAccountManagerName').value);
    if(itemvalue == 'true')
    {
        txtAccountManagerName.disabled = false;
        ValidatorEnable(rfvAccountManagerName, true);
    }
    else
    {
        txtAccountManagerName.disabled = true;
        ValidatorEnable(rfvAccountManagerName, false);
    }
}

function ScrollUp()
{
    window.scroll(0,0);
}
function LogOutInFrame(src)
{
    if(window.top!=window)
    {
        if( (null != document.getElementById(src)) && (undefined != document.getElementById(src)))
            document.getElementById(src).style.display = 'none';
    }
}
function LinksWithCampaign()
{
    if (window.location.search.toLowerCase().indexOf('campaign') != -1)
    {
        var allanchors = document.getElementsByTagName("a");
        for (count = 0; count < allanchors.length; count++)
        {
            if (allanchors[count].href.toLowerCase().indexOf('quickregistration') != -1)
            {
                if (allanchors[count].href.toLowerCase().indexOf('campaign') == -1)
                {
                    allanchors[count].href = allanchors[count].href + window.location.search;
                }
            }
        }
    }
}
