//FUNCTIONS
function getkey(e) {
    if (window.event)
        return window.event.keyCode;
    else if (e)
        return e.which;
    else
        return null;
}

function fnGoToIndex() {
    window.history.back();
    //window.location.href="../resources_l.aspx";
}

function fnClickHere(filename)      // function to open Help Files.
{
    var topPos = window.screen.height / 4;
    var leftPos = window.screen.width / 4;
    var pageurl = "./HelpFile/" + filename;
    window.open(pageurl, '', "width=850,height=500,top=" + topPos + ",left=" + leftPos + ",toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=yes,scrollbars=yes");
}

function fnHelpFile_InsideFolder(condition)      // function to open Help Files from other folder(not in root like POLL).
{
    if (condition == 1)	// poll_home.aspx
    {
        filename = "SurveyHelp.htm";
    }
    if (condition == 2)	// Editpoll.aspx
    {
        filename = "SurveyHelp.htm";
    }
    if (condition == 3)	// LaunchPoll.aspx
    {
        filename = "SurveyHelp.htm";
    }
    if (condition == 4)	// AnalyzePoll.aspx
    {
        filename = "SurveyHelp.htm";
    }
    var pageurl = "../../t-help/" + filename;
    if (filename != "") {
        window.open(pageurl, '', "width=870,height=500,top=" + topPos + ",left=" + leftPos + ",toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=yes,scrollbars=yes");
    }
}

//Written By:Aniket
//Purpose: To implement Help Files..
function fnHelpFile(condition)      // function to open Help Files.
{
    var topPos = window.screen.height / 4;
    var leftPos = window.screen.width / 4;
    var pageurl = "./HelpFile/" + filename;
    window.open(pageurl, '', "width=850,height=500,top=" + topPos + ",left=" + leftPos + ",toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=yes,scrollbars=yes");
}

//Written By:Aniket
//Purpose: To implement Help Files..
function fnHelpFile(condition)      // function to open Help Files.
{
    var topPos = window.screen.height / 4;
    var leftPos = window.screen.width / 4 - 250;

    var filename = "";

    // SurveyHelp.htm is the same page as survey-tutorial.aspx and survey-tutorials.html but without header and footer.

    if (condition == 1)				//Survey Home Page
    {
        filename = "SurveyHelp.htm";
    }

    if (condition == 2)				//Survey Home Page -> Create New Survey
    {
        filename = "CreatingSurvey.html";
    }

    if (condition == 3)				//Survey Home Page -> Design Survey/Survey_Edit.aspx
    {
        filename = "DesignSurvey.html";
    }

    if (condition == 35)				//Survey Home Page -> Design Survey/AddLogo.aspx
    {
        filename = "AddLogo.html"; //"Design Survey.htm#AddALogo";
    }
    if (condition == 36)				//Survey Home Page -> Design Survey/AddSkipLogic.aspx
    {
        filename = "SurveyHelp.htm"; //"Design Survey.htm#CreateSkipLogic";
    }
    if (condition == 37)				//Survey Home Page -> Design Survey/MovePage.aspx
    {
        filename = "SurveyHelp.htm"; //"Design Survey.htm#PAGEFUNCITONSAddDeleteMoveCopy";
    }
    if (condition == 38)				//Survey Home Page -> Design Survey/MoveQuestion.aspx
    {
        filename = "SurveyHelp.htm"; //"Design Survey.htm#QuestionFuncitonsEditDeleteMoveCopy";
    }
    if (condition == 39)				//Survey Home Page -> Design Survey/AddQuestion.aspx & Survey_Design.aspx
    {
        filename = "Questiontypes.htm"; //"SurveyHelp.htm"; // "Design Survey.htm#AddQuestions";
    }
    if (condition == 331)				//Survey Home Page -> Design Survey/EditPade.aspx
    {
        filename = "SurveyHelp.htm"; //"Design Survey.htm#PAGEFUNCITONSAddDeleteMoveCopy";
    }
    if (condition == 332)				//Survey Home Page -> Survey Settings//-- >SpellChecker.aspx
    {
        filename = "SurveyHelp.htm"; //"Design Survey.htm#SpellCheck";
    }


    //*********************The Help files to be open through Survey Settings Section**************
    if (condition == 4)				//Survey Home Page -> Survey Settings//Survey_Settings.aspx
    {
        filename = "SurveySettings.html";
    }

    if (condition == 41)				//Survey Home Page -> Survey Settings//-- >EditSurveyTitle.aspx
    {
        filename = filename = "CreatingSurvey.html#EnterTitle"; //"SurveySettings.html#EditSurveyNameLanguage";
    }
    if (condition == 42)				//Survey Home Page -> Survey Settings//-- >AutoEndSurvey.aspx
    {
        filename = "CloseSurvey.html#AutoClose"; //"SurveySettings.html#AutomaticEndSurvey";
    }
    if (condition == 43)				//Survey Home Page -> Survey Settings//-- >Survey_WelcomeGreeting.aspx
    {
        filename = "webGreeting.html"; // "SurveySettings.html#ViewEditSurveyWebGreetings";
    }
    if (condition == 44)				//Survey Home Page -> Survey Settings//-- >Survey_ShareResult.aspx Manage Results Sharing options
    {
        filename = "PublishResult.html"; // "SurveySettings.html#ManageResultsSharing";
    }
    if (condition == 45)				//Survey Home Page -> Survey Settings//-- >Survey_NavigationProperties.aspx
    {
        filename = "NavigationAndNumbering.html"; // "SurveySettings.html#EditNavigationandNumbering";
    }
    if (condition == 46)				//Survey Home Page -> Survey Settings//-- > Trigger Your Survey Remotely
    {
        filename = "SurveySettings.html#TriggerYourSurveyRemotely";
    }
    if (condition == 47)				//Survey Home Page -> Survey Settings//-- >Survey_CompletionOption.aspx
    {
        filename = "surveyCompletion.html"; //"SurveySettings.html#ViewEditSurveyCompletionOptions";
    }
    if (condition == 48)				//Survey Home Page -> Survey Settings//-- >survey_InvitationEmail.aspx
    {
        filename = "SurveySettings.html#ViewEditSurveyInvitationEmail";
    }
    if (condition == 49)				//Survey Home Page -> Survey Settings//-- >survey_AutoReminder.aspx
    {
        filename = "sending_reminders.html#AutoReminders"; // "SurveySettings.html#SetupAutomaticReminders";
    }

    //*********************End*****************************

    if (condition == 5)				//Survey Home Page -> Survey_Launch.aspx
    {
        filename = "LaunchingYourSurvey.html";
    }

    if (condition == 51)				//Survey Home Page -> Survey Launch//-- >Survey_Responses.aspx
    {
        filename = "LaunchingYourSurvey.html#EmailStep1";
    }
    if (condition == 52)				//Survey Lome Page -> Survey Launch//-- >Survey_Responses.aspx
    {
        filename = "LaunchingYourSurvey.html#WebURLStep1";
    }
    if (condition == 53)				//Survey Home Page -> Survey Launch//-- >Survey_EmailAddress.aspx
    {
        filename = "SurveyHelp.htm"; // "LaunchingYourSurvey.html#EmailStep2";
    }
    if (condition == 54)				//Survey Home Page -> Survey Launch//-- >survey_InvitationEmail.aspx
    {
        filename = "LaunchingYourSurvey.html#EmailStep3";
    }
    if (condition == 55)				//Survey Home Page -> Survey Launch//-- >Survey_WelcomeGreeting.aspx
    {
        filename = "webGreeting.html"; // "LaunchingYourSurvey.html#EmailStep4";
    }
    if (condition == 56)				//Survey Home Page -> Survey Launch//-- >Survey_WelcomeGreeting.aspx
    {
        filename = "webGreeting.html"; //"LaunchingYourSurvey.html#WebURLStep2";
    }
    if (condition == 57)				//Survey Home Page -> Survey Launch//-- >Survey_CompletionOption.aspx
    {
        filename = "SurveyHelp.htm"; //"LaunchingYourSurvey.html#EmailStep5";
    }
    if (condition == 58)				//Survey Home Page -> Survey Launch//-- >Survey_Result.aspx
    {
        filename = "SurveyHelp.htm";
    }
    //*********************End*****************************

    if (condition == 6)				//Survey Home Page ->Survey_Manage.aspx
    {
        filename = "ManageSurvey.html";
    }

    if (condition == 7)				//Survey Home Page ->Survey_Analyze.aspx
    {
        filename = "Analyze_Result.html";
    }

    if (condition == 71)				//Survey Home Page -> Survey Analyze Activity//-- >Survey_ResultSummary.aspx
    {
        filename = "Analyze_Result.html#ResultSummary";
    }
    if (condition == 72)				//Survey Home Page -> Survey Analyze Activity//-- >Survey_IndividualResult.aspx
    {
        filename = "Analyze_Result.html#Individualresult";
    }
    if (condition == 73)				//Survey Home Page -> Survey Analyze Activity//-- >Survey_GraphChartPreview.aspx
    {
        filename = "Analyze_Result.html#GraphChart";
    }
    if (condition == 74)				//Survey Home Page -> Survey Analyze Activity//-- >Survey_CompareResult.aspx
    {
        filename = "Analyze_Result.html#CompareResult";
    }
    if (condition == 75)				//Survey Home Page -> Survey Analyze Activity//-- >Analyze_rptSaveAs.aspx
    {
        filename = "SurveyHelp.htm";
    }
    if (condition == 76)				//Survey Home Page -> Survey Analyze Activity//-- >Analyze_Charting.aspx
    {
        filename = "SurveyHelp.htm";
    }
    if (condition == 77)				//Survey Home Page -> Survey Analyze Activity//-- >Survey_GenerateReport.aspx
    {
        filename = "SurveyHelp.htm";
    }
    if (condition == 77)				//Survey Home Page -> Survey Analyze Activity//-- >survey_MagnifyGlass.aspx
    {
        filename = "SurveyHelp.htm";
    }
    if (condition == 78)				//Survey Home Page -> Survey Analyze Activity//-- >Survey_ListInvitedVaiMail.aspx
    {
        filename = "SurveyHelp.htm";
    }
    if (condition == 79)				//Survey Home Page -> Survey Analyze Activity//-- >EmailPDF.aspx
    {
        filename = "SurveyHelp.htm";
    }
    if (condition == 8)				//Resources
    {
        filename = "SurveyHelp.htm"; // "Resources.htm"; Here will be Resources.htm when create new design. for time being it is SurveyHelp.htm
    }

    if (condition == 9)				//My Account
    {
        filename = "MyAccount.html"; // "My Account.htm"; Here will be My Account.htm when create new design. for time being it is SurveyHelp.htm
    }

    if (condition == 91)				//My Account ->AccRegistration.aspx
    {
        filename = "MyAccount.html#ChangeMyUserInformation";
    }
    if (condition == 92)				//My Account ->EditEmailId.aspx
    {
        filename = "MyAccount.html#ChangeMyLoginEmailAddress";
    }
    if (condition == 93)				//My Account ->EditPassword.aspx
    {
        filename = "MyAccount.html#ChangeMyPassword";
    }
    if (condition == 94)				//My Account ->ViewInvoices.aspx
    {
        filename = "MyAccount.html#ViewMyInvoices";
    }
    if (condition == 95)				//My Account ->CancelSubscription.aspx
    {
        filename = "MyAccount.html#CancelMySubscription";
    }
    if (condition == 96)				//My Account ->EditCreditCardInfo.aspx
    {
        filename = "MyAccount.html#ChangeMyCCInfo";
    }
    if (condition == 97)				//My Account ->AccountView.aspx
    {
        filename = "SurveyHelp.htm"; // "MyAccount.html#UpgradeYourAccount";
    }
    if (condition == 98)				//My Account ->ConfirmSend.aspx
    {
        filename = "SurveyHelp.htm";
    }
    if (condition == 99)				//My Account ->InvoiceDetails.aspx
    {
        filename = "SurveyHelp.htm";
    }


    // ********** For Different Question Types ***************//

    if (condition == 101)				//Question_OneAnswerDrpDown.aspx
    {
        filename = "QuestionTypes.htm#ChoiceOneAnswerDropdownMenu";
    }
    if (condition == 102)				//Question_OneAnswerOption.aspx
    {
        filename = "QuestionTypes.htm#ChoiceOneAnswerOptionButtons";
    }
    if (condition == 103)				//Question_OneAnswerOption.aspx
    {
        filename = "QuestionTypes.htm#ChoiceMultipleAnswerCheckboxes";
    }
    if (condition == 104)				//Question_YesNoTrueFalse.aspx
    {
        filename = "QuestionTypes.htm#ChoiceYesNoTrueFalse";
    }
    if (condition == 105)				//Question_PointsBasedSingle.aspx
    {
        filename = "QuestionTypes.htm#PointsBasedQuestions";
    }
    if (condition == 106)				//Question_PointsBasedSingle.aspx
    {
        filename = "QuestionTypes.htm#PointsBasedQuestions";
    }
    if (condition == 107)				//Question_OpenEndedComment.aspx
    {
        filename = "QuestionTypes.htm#OpenEndedCommentsBox";
    }
    if (condition == 108)				//Question_OneLineOpenEndedComment.aspx
    {
        filename = "QuestionTypes.htm#OpenEndedOneCommentLine";
    }
    if (condition == 109)				//QuestionMultipleComments.aspx
    {
        filename = "QuestionTypes.htm#OpenEndedOneMoreCommentLines";
    }
    if (condition == 110)				//Question_MultipleDiffTypeComments.aspx
    {
        filename = "QuestionTypes.htm#OpenEndedOneMoreClineswDifTypeData";
    }
    if (condition == 111)				//Question_OpenEndedNumeric.aspx
    {
        filename = "QuestionTypes.htm#Numeric";
    }
    if (condition == 112)				//Question_OpenEndedRanking.aspx
    {
        filename = "QuestionTypes.htm#RankingofItems";
    }
    if (condition == 113)				//Question_MultipleTextBoxperRow.aspx
    {
        filename = "QuestionTypes.htm#RatingScaleOneAnswerperRow";
    }
    if (condition == 114)				//Question_MultipleTextBoxperRow.aspx
    {
        filename = "QuestionTypes.htm#MultipleOptionsPerRow";
    }
    if (condition == 115)				//Question_MultipleTextBoxperRow.aspx
    {
        filename = "QuestionTypes.htm#MatrixMultipleTextBoxesPerRow";
    }
    if (condition == 116)				//Question_Conjoint.aspx
    {
        filename = "QuestionTypes.htm#MatrixConjointAnalysisQuestion";
    }
    if (condition == 117)				//Question_SumValuesEquation.aspx
    {
        filename = "QuestionTypes.htm#SumofAllValuesEquals";
    }
    if (condition == 118)				//Question_ContactInfo.aspx
    {
        filename = "QuestionTypes.htm#ContactInformation";
    }
    if (condition == 119)				//Question_OtherMessages.aspx
    {
        filename = "QuestionTypes.htm#MessageDisplay";
    }
    if (condition == 120)				//Question_DisplayForm.aspx
    {
        filename = "QuestionTypes.htm#ImageDisplay";
    }
    if (condition == 121)				//Question_DateTIme.aspx
    {
        filename = "QuestionTypes.htm#DateTime";
    }

    // Email List

    if (condition == 301) // Email list/--> EmailList.aspx
    {
        filename = "SurveyHelp.htm";
    }
    if (condition == 302) // Email list/--> ViewEmaillist.aspx
    {
        filename = "SurveyHelp.htm";
    }
    if (condition == 303) // Email list/-->AdvancedEmailList.aspx --Modified by ABHAYG@ecotech on 14oct2009
    {
        filename = "AdvancedEmailList.html";
    }
    if (condition == 304) // Email list/--> CreateNewEmailList.aspx
    {
        filename = "SurveyHelp.htm";
    }
    if (condition == 305) // Email list/--> BasicEmailList.aspx
    {
        filename = "BasicEmailList.html";
    }
    if (condition == 306) // Email list/--> ImportAddressinEmailList.aspx & ImportAddress.aspx
    {
        filename = "ImportEmailListHelp.htm";
    }
    if (condition == 307) // Email list/--> ConfirmEmailAdd.aspx
    {
        filename = "SurveyHelp.htm";
    }
    if (condition == 308) // Email list/--> CopyList.aspx
    {
        filename = "SurveyHelp.htm";
    }
    if (condition == 309) // Email list/--> InvalidEmailList.aspx
    {
        filename = "SurveyHelp.htm";
    }

    // Registration
    if (condition == 401) // Registration/--> registration.aspx
    {
        filename = "SurveyHelp.htm";
    }
    if (condition == 402) // Registration/--> registration2.aspx
    {
        filename = "SurveyHelp.htm";
    }
    if (condition == 403) // Registration/--> registration3.aspx
    {
        filename = "SurveyHelp.htm";
    }
    if (condition == 404) // Registration/--> registration4.aspx
    {
        //filename = "Under Construction.htm";
        filename = "SurveyHelp.htm";
    }


    // Missing Help files
    // Add Criteria-Display Results that Match the Following Criteria /->AnalyzeCriteria.aspx 
    if (condition == 501) {
        filename = "SurveyHelp.htm";
    }
    // Manage Survey Libraries /->surveyLibrary.aspx
    if (condition == 502) {
        filename = "SurveyHelp.htm";
    }
    // Edit/Create Survey Presentation Style /->CustomThemes.aspx
    if (condition == 503) {
        filename = "presentation.html";
    }
    if (condition == 504)	// Survey_LaunchInformation.aspx
    {
        filename = "SurveyHelp.htm";
    }
    if (condition == 505) // ConfirmRem.aspx
    {
        filename = "SurveyHelp.htm";
    }
    if (condition == 506) // collaborate.aspx
    {
        filename = "SurveyHelp.htm";
    }
    if (condition == 507) // AutoEndFeature.aspx
    {
        filename = "SurveyHelp.htm";
    }
    if (condition == 508)	// ConfirmLaunch.aspx
    {
        filename = "SurveyHelp.htm";
    }
    if (condition == 509)	// FeatureRightErrorPage.aspx
    {
        filename = "SurveyHelp.htm";
    }
    if (condition == 510)	// HelpCenter.aspx
    {
        //filename = "Under Construction.htm";
        filename = "survey-tutorial.aspx";
    }
    if (condition == 511)	// Libraries.aspx
    {
        //filename = "Under Construction.htm";
        filename = "SurveyHelp.htm";
    }
    if (condition == 512)	// Tellafriend.aspx
    {
        //filename = "Under Construction.htm";
        filename = "SurveyHelp.htm";
    }
    if (condition == 513)	// Thanx.aspx
    {
        //filename = "Under Construction.htm";
        filename = "SurveyHelp.htm";
    }
    if (condition == 514)	// survey_home2.aspx
    {
        filename = "SurveyHelp.htm";
    }

    if (condition == 515)	// CVV Code Help File condition
    {						// This function and 515 Condition is called on EditCreditCardInfo and Registration3.aspx Page.
        filename = "CVVHelp.html";
    }

    //Added by ABHAYG@Ecotech 26Nov09 Purpose:Add new CreatingAnonymousSurveys help page :START
    if (condition == 608) {
        filename = "CreatingAnonymousSurveys.html";
    }
    //Added by ABHAYG@Ecotech 26Nov09 Purpose:Add new CreatingAnonymousSurveys help page :END

    //Added by pravinC@Ecotech 02Nov09 Purpose:Poll help

    //for the poll help
    //Added by pravinC@Ecotech 02Nov09 Purpose:Poll help
    if (condition == 601) {
        filename = "CreatePoll/Createpoll.html";
    }
    if (condition == 602) {
        filename = "LaunchPoll/LaunchPoll.html";
    }
    if (condition == 603) {
        filename = "Poll Language Pack/LanguagePack.html";
    }
    //commented by atulR@Ecotech 05Nov09 Purpose:Poll Analyze help
    if (condition == 604) {
        filename = "AnalyzePoll/AnalyzePoll.html";
    }
    if (condition == 605) {
        filename = "CreatePoll/Createpoll.html#PollSettings";
    }
    if (condition == 606) {
        filename = "CreatePoll/Createpoll.html#ManageRepeatVote";
    }
    if (condition == 607) {
        filename = "CreatePoll/Createpoll.html#PollResults";
    }
    //commented by pravinC@Ecotech 02Nov09 Purpose:Poll help
    //var pageurl = "./t-help/" + filename;
    if (filename.indexOf("/Poll") != -1) {
        var pageurl = "t-help/" + filename;
    }
    else {
        var pageurl = "./t-help/" + filename;
    }
    if (filename != "") {
        window.open(pageurl, '', "width=970,height=590,top=" + topPos + ",left=" + leftPos + ",toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=yes,scrollbars=yes");
    }
}

function fnHelpFileGLossery(condition)      // function to open Help Files.
{
    var topPos = window.screen.height / 4;
    var leftPos = window.screen.width / 4;
    var filename = "";

    // **** A starts **** //

    if (condition == 1)				//Abnormalities.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 2)				//Absorption_Costing.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 3)				//Acceptable_Quality_Level.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 4)				//Acceptance_Number.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 5)				//Acceptance_Sampling_Plan.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 6)				//Accessory_Planning.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 7)				//Accountability.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 8)				//Accuracy.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 9)				//Action_Plan.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 10)				//Activity.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 11)				//Activity_Based_Budgeting.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 12)				//Activity_Based_Costing.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 13)				//Activity_Model.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 14)				//Advanced_Product_Quality_Planning.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 15)				//Affinity_Diagram.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 16)				//Algorithm.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 17)				//Algorithm_Analysis.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 18)				//Alignment.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 19)				//Alpha_Risk.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 20)				//Alternate_Hypothesis.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 21)				//Analysis.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 22)				//Analysis_of_Variance.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 23)				//Anderson-Darling_Normality_Test.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 24)				//Andon.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 25)				//Anomaly.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 26)				//article_360Reviews_seg_I.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 27)				//article_business_seg_l.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 28)				//article_competitors_customers_seg_I.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 29)				//article_cust_satis_l.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 30)				//article_customer_service_seg_l.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 31)				//article_customerseg_seg_l.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 32)				//article_effective_surveys_seg_I.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 33)				//article_engaged_employee_seg_l.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 34)				//article_excellent_place _seg_l.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 35)				//article_premarketing_seg_l.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 36)				//article_product_priciung _seg_l.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 37)				//article_satis_loyalty_l.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 38)				//article_six_sigma_seg_l.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 39)				//Artisan_Process.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 40)				//A-Square.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 41)				//Assessment.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 42)				//Assignable_Cause.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 43)				//Assurance.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 44)				//Assured_Quality_Level.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 45)				//Attribute_Data.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 46)				//Attribute-Based_Cost_System.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 47)				//Audit.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 48)				//Authority.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 49)				//Autocorrelation.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 50)				//Availability.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 51)				//Average_Incoming_Quality.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 52)				//Average_Outgoing_Quality.aspx
    {
        filename = "Under Construction.htm";
    }

    $ // **** A completes **** //
    // **** B starts **** //

    if (condition == 53)				//B10_ Life.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 54)				//Back-Date.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 55)				//Balanced_Experiment.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 56)				//Balanced_Scorecard.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 57)				//Bar_Chart.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 58)				//Baseline.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 59)				//Baseline_Measures.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 60)				//Batch.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 61)				//Batch-and-Queue.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 62)				//Benchmarking.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 63)				//Best_Practice.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 64)				//Beta_Risk.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 65)				//Bias.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 66)				//Bimodal_Distribution.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 67)				//Black_Belt.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 68)				//Black_Noise.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 69)				//Block_Diagram.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 70)				//Blocking.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 71)				//Box_Cox_Transformation.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 72)				//Box_Plot.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 73)				//Brainstorming.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 74)				//Breakthrough_Objectives.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 75)				//Business_As_Usual.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 76)				//Business_process.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 77)				//Business_Process_Management_System.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 78)				//Business_Process_Reengineering .aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 79)				//Business_Risk_Management.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 80)				//Business_Value-Added.aspx
    {
        filename = "Under Construction.htm";
    }

    // **** B completes **** //
    // **** C starts **** //

    if (condition == 81)				//Calibration.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 82)				//Calibration_interval.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 83)				//Capability.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 84)				//Capability_Analysis.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 85)				//Capacity.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 86)				//Causality.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 87)				//Cause.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 88)				//Cause_&_Effect_Diagram.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 89)				//Cell.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 90)				//Center.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 91)				//Center_Points.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 92)				//Central_Limit_Theorem.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 93)				//Central_Tendency.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 94)				//Chaku-Chaku.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 95)				//Chaku-Chaku_Line.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 96)				//Change_Agent.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 97)				//Changeover.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 98)				//Characteristic.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 99)				//Charter.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 100)				//Chi-Square_Test.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 101)				//Circumstance.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 102)				//C-L+A76evel.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 103)				//Coefficient_of_Variation.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 104)				//Common_Cause.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 105)				//Competitive_Advantage.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 106)				//Concomitant_Variable.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 107)				//Concurrent_Engineering.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 108)				//Condition.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 109)				//Confidence_Interval.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 110)				//Confidence_Level .aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 111)				//Conformance.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 112)				//Consistency.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 113)				//Consumer's_Risk.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 114)				//Continuous_Flow .aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 115)				//Continuous_Flow_Production.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 116)				//Continuous_Improvement.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 117)				//Control.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 118)				//Control_Chart.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 119)				//Control_Limits.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 120)				//Control_Plan.aspx
    {
        filename = "Under Construction.htm";
    }
    // Help link not available
    if (condition == 121)				//Control_Point.aspx
    {
        filename = "Under Construction.htm";
    }
    // Help link not available
    if (condition == 122)				//COPIS.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 123)				//Corrective_action.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 124)				//Correlation.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 125)				//Cost_of_Conformance.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 126)				//Cost_of_Non-Conformance.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 127)				//Cost_of_Poor_Quality.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 128)				//Cost_of_Quality.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 129)				//Cost_Target.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 130)				//Crash.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 131)				//Critical_Customer_Requirement.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 132)				//Customer.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 133)				//Customer_Relationship_Management .aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 134)				//Cycle_Time.aspx
    {
        filename = "Under Construction.htm";
    }

    // **** C completes **** //
    // **** D starts **** //

    if (condition == 135)				//Dashboard.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 136)				//Data.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 137)				//Data_Analysis.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 138)				//Data_Corruption.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 139)				//Data_Integrity.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 140)				//Defect.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 141)				//Defects_per_Million_Opportunities.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 142)				//Defects_per_Unit.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 143)				//Define_ Measure Analyze_ Improve_ Control.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 144)				//Define_ Measure_ Analyze_ Design_ Verify.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 145)				//Degrees_of_Freedom.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 146)				//Deming_Cycle.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 147)				//Dependent_Variable.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 148)				//Deployment_Plan.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 149)				//Design_for_Six_Sigma .aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 150)				//Design_Optimization.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 151)				//Design_Risk.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 152)				//Detection.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 153)				//Deviation.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 154)				//Direct_Cost.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 155)				//Directive.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 156)				//Discrete_Data.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 157)				//Downstream.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 158)				//Dyads.aspx
    {
        filename = "Under Construction.htm";
    }

    // **** D completes **** //
    // **** E starts **** //

    if (condition == 159)				//E_I_Transducer.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 160)				//Effect.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 161)				//Effectiveness.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 162)				//Efficiency.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 163)				//Exit_Criteria.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 164)				//External_Customers .aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 165)				//External_Failure.aspx
    {
        filename = "Under Construction.htm";
    }

    // **** E completes **** //
    // **** F starts **** //

    if (condition == 166)				//F_test.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 167)				//Facilitate.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 168)				//Factor.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 169)				//Failure_Modes_and_Criticality_Analysis.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 170)				//Failure_Modes_and_Effects_Analysis.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 171)				//Feasibility.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 172)				//First-Time_Yield.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 173)				//Fishbone_Diagram.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 174)				//Five_Ss.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 175)				//Five_why_s.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 176)				//Fixed_Cost .aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 177)				//Flow.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 178)				//Flow_Chart.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 179)				//Force_Field_Analysis.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 180)				//Form.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 181)				//Fractional_Factorial.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 182)				//Frequency_Distribution.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 183)				//Full_Factorial.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 184)				//Five_why_s.aspx
    {
        filename = "Under Construction.htm";
    }

    // **** F completes **** //
    // **** G starts **** //

    if (condition == 185)				//Gantt_Chart.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 186)				//Gap_Analysis.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 187)				//glossary_index.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 188)				//Goal.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 189)				//Goals_ Roles_ Processes_ Interpersonal_Relationships.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 190)				//Green_Belt.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 191)				//Grenzplankostenrechnung_Costing.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 192)				//Groupthink.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 193)				//Gwilliam_Motivational_Model.aspx
    {
        filename = "Under Construction.htm";
    }

    // **** G completes **** //
    // **** H starts **** //
    if (condition == 194)				//Hanedashi.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 195)				//Hard_Savings.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 196)				//Hawthorne_Effect .aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 197)				//Hazard_Analysis.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 198)				//Hidden_Factory.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 199)				//Histogram.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 200)				//Histogram_Plot.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 201)				//Homogeneity_of_Variance.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 202)				//Horizontalization.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 203)				//Hoshin_Kanri.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 204)				//Hoshin_Planning.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 205)				//House_of_Quality.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 206)				//Human_Factors.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 207)				//Hurdle_Rate.aspx
    {
        filename = "Under Construction.htm";
    }

    // **** H completes **** //
    // **** I starts **** //

    if (condition == 208)				//Independent_Variable.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 209)				//Indicator.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 210)				//Indirect_Cost.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 211)				//Inferential_Statistics.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 212)				//Intangible_Benefits.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 213)				//Interaction.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 214)				//Internal_Customers .aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 215)				//Interrelationship_Digraph.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 216)				//Ishikawa_Diagram.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 217)				//ISO_9000.aspx
    {
        filename = "Under Construction.htm";
    }

    // **** I completes **** //
    // **** J starts **** //

    if (condition == 218)				//Judgment_Sampling.aspx
    {
        filename = "Under Construction.htm";
    }
    if (condition == 219)				//Just_In_Time_[Manufacturing].aspx
    {
        filename = "Under Construction.htm";
    }


    var pageurl = "../HelpFile/" + filename;
    if (filename != "") {
        window.open(pageurl, '', "width=600,height=500,top=" + topPos + ",left=" + leftPos + ",toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=yes,scrollbars=yes");
    }
}

function setmax(id, noOfChar) {
    var txtDec;

    txtDec = document.getElementById(id);

    if (txtDec.value.length >= noOfChar) {
        alert(txtDec.value.length);
        txtDec.value = txtDec.value.substring(0, noOfChar - 1);
    }

}

// Added by Keyur@Ecotech  Purpose : To change email validation.
function emailCheck(emailStr) {
    var reg = /^([A-Za-z0-9_\-\.\'])+\@([A-Za-z0-9_\-\.\'])+\.([A-Za-z]{2,10})$/;
    var address = emailStr;
    if (reg.test(address) == false) {
        return false;
    }
    return true;
}
function emailCheck_OLD(emailStr) {
    /* The following pattern is used to check if the entered e-mail address
    fits the user@domain format.  It also is used to separate the username
    from the domain. */
    var emailPat = /^(.+)@(.+)$/
    /* The following string represents the pattern for matching all special
    characters.  We don't want to allow special characters in the address. 
    These characters include ( ) < > @ , ; : \ " . [ ]    */
    var specialChars = "\\(\\)<>@,`';:~!#$%^&*+=|{}?\\\\\\\"\\.\\[\\]"
    /* The following string represents the range of characters allowed in a 
    username or domainname.  It really states which chars aren't allowed. */
    var validChars = "\[^\\s" + specialChars + "\]"
    /* The following pattern applies if the "user" is a quoted string (in
    which case, there are no rules about which characters are allowed
    and which aren't; anything goes).  E.g. "jiminy cricket"@disney.com
    is a legal e-mail address. */
    var quotedUser = "(\"[^\"]*\")"
    /* The following pattern applies for domains that are IP addresses,
    rather than symbolic names.  E.g. joe@[123.124.233.4] is a legal
    e-mail address. NOTE: The square brackets are required. */
    var ipDomainPat = /^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
    /* The following string represents an atom (basically a series of
    non-special characters.) */
    var atom = validChars + '+'
    /* The following string represents one word in the typical username.
    For example, in john.doe@somewhere.com, john and doe are words.
    Basically, a word is either an atom or quoted string. */
    var word = "(" + atom + "|" + quotedUser + ")"
    // The following pattern describes the structure of the user
    var userPat = new RegExp("^" + word + "(\\." + word + ")*$")
    /* The following pattern describes the structure of a normal symbolic
    domain, as opposed to ipDomainPat, shown above. */
    var domainPat = new RegExp("^" + atom + "(\\." + atom + ")*$")


    /* Finally, let's start trying to figure out if the supplied address is
    valid. */

    /* Begin with the coarse pattern to simply break up user@domain into
    different pieces that are easy to analyze. */
    var matchArray = emailStr.match(emailPat)
    if (matchArray == null) {
        /* Too many/few @'s or something; basically, this address doesn't
        even fit the general mould of a valid e-mail address. */
        alert("Email address field seems incorrect or blank.")
        return false
    }
    var user = matchArray[1]
    var domain = matchArray[2]

    // See if "user" is valid 
    if (user.match(userPat) == null) {
        // user is not valid
        //alert("The username doesn't seem to be valid.")
        alert("Email address field seems incorrect or blank.")
        return false
    }

    /* if the e-mail address is at an IP address (as opposed to a symbolic
    host name) make sure the IP address is valid. */
    var IPArray = domain.match(ipDomainPat)
    if (IPArray != null) {
        // this is an IP address
        for (var i = 1; i <= 4; i++) {
            if (IPArray[i] > 255) {
                //alert("Destination IP address is invalid!")
                alert("Email address field seems incorrect or blank.")
                return false
            }
        }
        return true
    }

    // Domain is symbolic name
    var domainArray = domain.match(domainPat)
    if (domainArray == null) {
        //alert("The domain name doesn't seem to be valid.")
        alert("Email address field seems incorrect or blank.")
        return false
    }

    /* domain name seems valid, but now make sure that it ends in a
    three-letter word (like com, edu, gov) or a two-letter word,
    representing country (uk, nl), and that there's a hostname preceding 
    the domain or country. */

    /* Now we need to break up the domain to get a count of how many atoms
    it consists of. */
    var atomPat = new RegExp(atom, "g")
    var domArr = domain.match(atomPat)
    var len = domArr.length
    if (domArr[domArr.length - 1].length < 2 ||
				domArr[domArr.length - 1].length > 3) {
        // the address must end in a two letter or three letter word.
        alert("The address must end in a three-letter domain, or two letter country.")
        return false
    }

    // Make sure there's a host name preceding the domain.
    if (len < 2) {
        var errStr = "This address is missing a hostname!"
        //alert(errStr)
        alert("Email address field seems incorrect or blank.")
        return false
    }

    // If we've gotten this far, everything's valid!
    return true;
}

function ValMenu(men) {
    var valMen;
    var menu = "[Contact.FirstName],[Contact.LastName],[Contact.Company],[Contact.EmailAddress],[Contact.LoginId],[Contact.Password],[Contact.LineOfBusiness],[Contact.Department],[Contact.Refferal],[Contact.SalesPerson],[Users.Owners_FirstName],[Users.Owners_LastName],[Users.Owners_LoginName],[Users.Password],[Users.CompanyName],[Users.Owners_Email],[Users.Function],[Users.PromoCode],[Users.AccountType],[Users.SubscriptionExpirationDate],[Users.Renewal],[Users.CreditCard],[Promocodes.Promocodes],[Promocodes.Expiry],[Promocodes.Codes],[Refferal.Name],[Refferal.Email],[Refferal.UserName],[Refferal.Password],[Survey.SurveyName],[Survey.SurveyCode],[Survey.SurveyLaunchDate],[Survey.SurveyLaunchTime],[Survey.LastSurveyLaunchDate],[Survey.LastSurveyLaunchTime],[Survey.NoOfResponses]";
    if (menu.indexOf(men) == -1) {
        return true;
    }
    else {
        return false;
    }

}

var whitespace = " \t\n\r ";

// function for checking empty filed

function isEmpty(str) {
    return ((str == null) || (str.length == 0))
}

// end of function

/******************* functions for help center **********/
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
    if (init == true) with (navigator) {
        if ((appName == "Netscape") && (parseInt(appVersion) == 4)) {
            document.MM_pgW = innerWidth; document.MM_pgH = innerHeight; onresize = MM_reloadPage;
        } 
    }
    else if (innerWidth != document.MM_pgW || innerHeight != document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_findObj(n, d) { //v4.01
    var p, i, x; if (!d) d = document; if ((p = n.indexOf("?")) > 0 && parent.frames.length) {
        d = parent.frames[n.substring(p + 1)].document; n = n.substring(0, p);
    }
    if (!(x = d[n]) && d.all) x = d.all[n]; for (i = 0; !x && i < d.forms.length; i++) x = d.forms[i][n];
    for (i = 0; !x && d.layers && i < d.layers.length; i++) x = MM_findObj(n, d.layers[i].document);
    if (!x && d.getElementById) x = d.getElementById(n); return x;
}

function MM_showHideLayers() {
    try {

        if (Math.abs(document.all["InstantHelp1_hidHelp"].value) == 1) {
            var i, p, v, obj, args = MM_showHideLayers.arguments;

            var ifrm = document.getElementById("DivShim");
            i = 0;

            if ((obj = MM_findObj(args[i])) != null) {
                v = args[i + 2];
                if (obj.style) {
                    obj = obj.style;
                    v = (v == 'show') ? 'visible' : (v == 'hide') ? 'hidden' : v;
                }
                {
                    obj.zIndex = 100;
                    obj.visibility = v;

                    if (v == 'visible' && args.length < 4) {
                        var evnt = args[1];
                        if (navigator.appName == "Microsoft Internet Explorer")
                            obj.left = document.body.scrollLeft + event.clientX
                        else
                            obj.left = evnt.pageX;


                        if (obj.left > "780px") {
                            obj.left = '740px';
                        }
                        if (navigator.appName == "Microsoft Internet Explorer") {
                            obj.top = document.body.scrollTop + event.clientY + 10;

                        }
                        else
                            obj.top = evnt.pageY;
                    }
                    try {
                        if (v == 'visible') {
                            ifrm.style.display = "block";

                            ifrm.style.left = obj.left;
                            ifrm.style.top = obj.top;
                            ifrm.style.width = obj.width;
                            ifrm.style.height = obj.height;
                            ifrm.style.zIndex = 90;

                        }
                        if (v == 'hidden')

                            ifrm.style.display = "none";
                    }
                    catch (e) { }
                }

            }

        }
    }
    catch (E) { }
}
/*************************** end ********************/


function removetab(str) {
    var i;
    var flag;
    var tab = '\t'
    var strTb;
    strTb = new String();
    strTb = str;
    str = trim(str);


    if (strTb.indexOf("@") != -1) {
        strTb = strTb.replace('\t', '');
    }
    for (i = 0; i < strTb.length; i++) {
        var c = strTb.charAt(i);

        if (tab.indexOf(c) != -1) {

            strTb = strTb.replace(c, '');

        }
    }

    strTb = trim(strTb);

    return strTb;
}

// function to check the whitespace

function isWhitespace(str) {
    var i;
    var flag

    // Is s empty?
    if (isEmpty(str)) return true;
    // Search through string's characters one by one
    // until we find a non-whitespace character.
    // When we do, return false; if we don't, return true.
    for (i = 0; i < str.length; i++) {
        // Check that current character isn't whitespace.
        var c = str.charAt(i);

        if (whitespace.indexOf(c) == -1)
            return false
    }
    // All characters are whitespace.
    return true;
}

// end of function
// to remove characters from money field


function fnRemoveComma(objValue) {
    var characters = ".0123456789"
    var tmp = "";
    var strMoney = "";
    var flag = 0;
    var lTag
    lTag = 0
    temp = (objValue.length)
    for (var i = 0; i < temp; i++) {
        tmp = objValue.substring(i, i + 1)
        if (characters.indexOf(tmp) != -1) {
            strMoney = strMoney + tmp;
        }

    }
    return strMoney;

}
//end function
//function to remove spaces from start and end of string
function trimString(str) {
    str = this != window ? this : str;
    return str.replace(/^\s+/g, '').replace(/\s+$/g, '');
}




// function to check all the entered values are characters only

function isAllCharacters(objValue) {
    var characters = "' -abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ./"
    var tmp
    var lTag
    lTag = 0
    temp = (objValue.length)
    for (var i = 0; i < temp; i++) {

        tmp = objValue.substring(i, i + 1)

        if (characters.indexOf(tmp) == -1) {
            lTag = 1
        }
    }
    if (lTag == 1)
        return false
    else
        return true
}

// end of function


// function for triming

function trim(pstrString) {
    var intLoop = 0;

    for (intLoop = 0; intLoop < pstrString.length; ) {
        if (pstrString.charAt(intLoop) == " ")
            pstrString = pstrString.substring(intLoop + 1, pstrString.length);
        else
            break;
    }

    for (intLoop = pstrString.length - 1; intLoop >= 0; intLoop = pstrString.length - 1) {
        if (pstrString.charAt(intLoop) == " ")
            pstrString = pstrString.substring(0, intLoop);
        else
            break;
    }
    return pstrString;
}

// function to check all the entered values are characters only

function isAlphaNumeric(objValue) {
    var characters = "'-abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
    var tmp
    var lTag
    lTag = 0
    temp = (objValue.length)
    for (var i = 0; i < temp; i++) {
        tmp = objValue.substring(i, i + 1)
        if (characters.indexOf(tmp) == -1) {
            lTag = 1
        }
    }
    if (lTag == 1)
        return false
    else
        return true

}
function isAlphaNumericWithSpace(objValue) {
    var characters = "' abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-"

    var tmp
    var lTag
    lTag = 0
    temp = (objValue.length)
    for (var i = 0; i < temp; i++) {
        tmp = objValue.substring(i, i + 1)
        if (characters.indexOf(tmp) == -1) {
            lTag = 1
        }
    }
    if (lTag == 1)
        return false
    else
        return true

}
function isAlphaNumeric1(objValue) {
    var characters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
    var tmp
    var lTag
    lTag = 0
    temp = (objValue.length)
    for (var i = 0; i < temp; i++) {
        tmp = objValue.substring(i, i + 1)
        if (characters.indexOf(tmp) == -1) {
            lTag = 1
        }
    }
    if (lTag == 1)
        return false
    else
        return true

}

function isValidImageName(objValue) {
    var characters = " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789~!@#$%^&*()_+=';.,}{[]\\\/-:"

    var tmp
    var lTag
    lTag = 0
    temp = (objValue.length)
    for (var i = 0; i < temp; i++) {
        tmp = objValue.substring(i, i + 1)
        if (characters.indexOf(tmp) == -1) {

            lTag = 1
        }
    }
    if (lTag == 1)
        return false
    else
        return true

}

function isValidImageName1(objValue) {
    var characters = " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789~!@#$%^&*()_+=';.,}{[]\\\/-: \"| ? > < `"

    var tmp
    var lTag
    lTag = 0
    temp = (objValue.length)
    for (var i = 0; i < temp; i++) {
        tmp = objValue.substring(i, i + 1)
        if (characters.indexOf(tmp) == -1) {

            lTag = 1
        }
    }
    if (lTag == 1)
        return false
    else
        return true

}

function isValidName(objValue) {
    var characters = " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@'"

    var tmp
    var lTag
    lTag = 0
    temp = (objValue.length)
    for (var i = 0; i < temp; i++) {
        tmp = objValue.substring(i, i + 1)
        if (characters.indexOf(tmp) == -1) {
            lTag = 1
        }
    }
    if (lTag == 1)
        return false
    else
        return true

}


function isValidFolderName(objValue) {
    var characters = " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-;_+=',.?[]"

    var tmp
    var lTag
    lTag = 0
    temp = (objValue.length)
    for (var i = 0; i < temp; i++) {
        tmp = objValue.substring(i, i + 1)
        if (characters.indexOf(tmp) == -1) {
            lTag = 1
        }
    }
    if (lTag == 1)
        return false
    else
        return true

}

function isValidCustomField(objValue) {
    var characters = " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-:_+=',.?[]"

    var tmp
    var lTag
    lTag = 0
    temp = (objValue.length)
    for (var i = 0; i < temp; i++) {
        tmp = objValue.substring(i, i + 1)
        if (characters.indexOf(tmp) == -1) {
            lTag = 1
        }
    }
    if (lTag == 1)
        return false
    else
        return true

}


// end of function

// function for checking if inputed value is a valid number

function isAllNumeric(objValue) {
    lTempLength = objValue.length
    lTempCounter = 0
    lTempString = trim(objValue)
    flag = false

    do {
        if (lTempString.charAt(lTempCounter) == " ") {
            flag = false
            break
        }
        else if (lTempString.charAt(lTempCounter) > 0 || lTempString.charAt(lTempCounter) < 9)
            flag = true
        else {
            flag = false
            break
        }
        lTempCounter = lTempCounter + 1
    }
    while (lTempCounter <= lTempLength)

    if (flag == true)
        return true
    else
        return false
}

// end of function		

// function for checking all entered valuea are numbers only with decimal values

function isWholePositiveNumber(obj) {
    flag = 0
    if (isNaN(obj)) {
        flag = 1;
    }

    if (flag == 0) {
        for (i = 0; i < obj.length; i++) {
            if (obj.charAt(i) == "-") {
                flag = 1;
            }
        }
    }

    if (flag == 1) {
        return false
    }
    else if (flag == 0) {
        return true
    }
}

// end of function

//-------------- email validation ------- 21 Oct 2008 Added By Keyur@Ecotech
function isValidEmail_New(str) {
    var at = "@"
    var dot = "."
    var lat = str.indexOf(at)
    var lstr = str.length
    var ldot = str.indexOf(dot)
    if (str.indexOf(at) == -1) {
        //alert("Invalid E-mail ID")
        return false
    }

    if (str.indexOf(at) == -1 || str.indexOf(at) == 0 || str.indexOf(at) == lstr) {
        //alert("Invalid E-mail ID")
        return false
    }

    if (str.indexOf(dot) == -1 || str.indexOf(dot) == 0 || str.indexOf(dot) == lstr) {
        //alert("Invalid E-mail ID")
        return false
    }

    if (str.indexOf(at, (lat + 1)) != -1) {
        //alert("Invalid E-mail ID")
        return false
    }

    if (str.substring(lat - 1, lat) == dot || str.substring(lat + 1, lat + 2) == dot) {
        //alert("Invalid E-mail ID")
        return false
    }

    if (str.indexOf(dot, (lat + 2)) == -1) {
        //alert("Invalid E-mail ID")
        return false
    }

    if (str.indexOf(" ") != -1) {
        //alert("Invalid E-mail ID")
        return false
    }
    return true
}
// end of function isValidEmail_New

//-------------- email validation -------
// New Email validation function.... Added by KEYUR@ECOTECH on 22 Jan 2009
function isValidEmail(emailStr) {
    var reg = /^([A-Za-z0-9_\-\.\'])+\@([A-Za-z0-9_\-\.\'])+\.([A-Za-z]{2,10})$/;
    if (reg.test(emailStr) == false) {
        emailStr = '';
        return false;
    }
    emailStr = '';
    return true;
}

// fuction which checks ' also.... Used in registration and login only....
function isValidEmail_apos(emailStr) {
    var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,10})$/;
    if (reg.test(emailStr) == false) {
        return false;
    }
    return true;
}

function isValidEmail_OLD(emailStr) {
    /* The following pattern is used to check if the entered e-mail address
    fits the user@domain format.  It also is used to separate the username
    from the domain. */
    var emailPat = /^(.+)@(.+)$/
    /* The following string represents the pattern for matching all special
    characters.  We don't want to allow special characters in the address. 
    These characters include ( ) < > @ , ; : \ " . [ ]    */
    //var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
    var specialChars = "\\(\\)<>@,`';:~!#$%^&*+=|{}?\\\\\\\"\\.\\[\\]"

    /* The following string represents the range of characters allowed in a 
    username or domainname.  It really states which chars aren't allowed. */
    var validChars = "\[^\\s" + specialChars + "\]"
    /* The following pattern applies if the "user" is a quoted string (in
    which case, there are no rules about which characters are allowed
    and which aren't; anything goes).  E.g. "sg cricket"@disney.com
    is a legal e-mail address. */
    var quotedUser = "(\"[^\"]*\")"
    /* The following pattern applies for domains that are IP addresses,
    rather than symbolic names.  E.g. sg@[123.124.233.4] is a legal
    e-mail address. NOTE: The square brackets are required. */
    var ipDomainPat = /^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
    /* The following string represents an atom (basically a series of
    non-special characters.) */
    var atom = validChars + '+'
    /* The following string represents one word in the typical username.
    For example, in sg.sg@somewhere.com, sg and sg are words.
    Basically, a word is either an atom or quoted string. */
    var word = "(" + atom + "|" + quotedUser + ")"
    // The following pattern describes the structure of the user
    var userPat = new RegExp("^" + word + "(\\." + word + ")*$")
    /* The following pattern describes the structure of a normal symbolic
    domain, as opposed to ipDomainPat, shown above. */
    var domainPat = new RegExp("^" + atom + "(\\." + atom + ")*$")


    /* Finally, let's start trying to figure out if the supplied address is
    valid. */

    /* Begin with the coarse pattern to simply break up user@domain into
    different pieces that are easy to analyze. */
    var matchArray = emailStr.match(emailPat)
    if (matchArray == null) {
        /* Too many/few @'s or something; basically, this address doesn't
        even fit the general mould of a valid e-mail address. */
        //alert("Email address seems incorrect (check @ and .'s)")
        return false
    }
    var user = matchArray[1]
    var domain = matchArray[2]

    // See if "user" is valid 
    if (user.match(userPat) == null) {
        // user is not valid
        return false
    }

    /* if the e-mail address is at an IP address (as opposed to a symbolic
    host name) make sure the IP address is valid. */
    var IPArray = domain.match(ipDomainPat)
    if (IPArray != null) {
        // this is an IP address
        for (var i = 1; i <= 4; i++) {
            if (IPArray[i] > 255) {
                //alert("Destination IP address is invalid!")
                return false
            }
        }
        return true
    }

    // Domain is symbolic name
    var domainArray = domain.match(domainPat)
    if (domainArray == null) {
        //alert("The domain name doesn't seem to be valid.")
        return false
    }

    /* domain name seems valid, but now make sure that it ends in a
    three-letter word (like com, edu, gov) or a two-letter word,
    representing country (uk, nl, no), and that there's a hostname preceding 
    the domain or country. */

    /* Now we need to break up the domain to get a count of how many atoms
    it consists of. */
    var atomPat = new RegExp(atom, "g")
    var domArr = domain.match(atomPat)
    var len = domArr.length
    if (domArr[domArr.length - 1].length < 2 ||
			    domArr[domArr.length - 1].length > 3) {
        // the address must end in a two letter or three letter word.
        //alert("The address must end in a three-letter domain, or two letter country.")
        return false
    }

    // Make sure there's a host name preceding the domain.
    if (len < 2) {
        var errStr = "This address is missing a hostname!"
        //alert(errStr)
        return false
    }

    // If we've gotten this far, everything's valid!
    return true;
}

// end of function

function fnIsAlphaNumericSpecial(objValue) {
    var characters = " *0123456789"
    var tmp
    var lTag
    lTag = 0
    temp = (objValue.length)
    for (var i = 0; i < temp; i++) {
        tmp = objValue.substring(i, i + 1)
        if (characters.indexOf(tmp) == -1) {
            lTag = 1
        }
    }
    if (lTag == 1)
        return false
    else
        return true
}

function fnIsAlphaNumericDecimal(objValue) {
    var characters = ".0123456789"
    var tmp
    var lTag
    lTag = 0
    temp = (objValue.length)
    for (var i = 0; i < temp; i++) {
        tmp = objValue.substring(i, i + 1)
        if (characters.indexOf(tmp) == -1) {
            lTag = 1
        }
    }
    if (lTag == 1)
        return false
    else
        return true
}

function fnIsAlphaNumericDecimalNegative(objValue) {
    var characters = "-.0123456789"
    var tmp
    var lTag
    lTag = 0
    temp = (objValue.length)
    for (var i = 0; i < temp; i++) {
        tmp = objValue.substring(i, i + 1)
        if (characters.indexOf(tmp) == -1) {
            lTag = 1
        }
    }
    if (lTag == 1 || isNaN(objValue))
        return false
    else
        return true
}
//end function
function isAllNumericWithSpace(objValue) {
    var characters = " 0123456789"
    var tmp = "";
    var strMoney = "";
    var flag = 0;
    var lTag
    lTag = 0
    temp = (objValue.length)
    for (var i = 0; i < temp; i++) {
        tmp = objValue.substring(i, i + 1)
        if (characters.indexOf(tmp) == -1) {
            lTag = 1
        }

    }
    if (lTag == 1)
        return false
    else
        return true
}

function isAllNumericWithOutSpace(objValue) {
    var characters = "0123456789"
    var tmp = "";
    var strMoney = "";
    var flag = 0;
    var lTag
    lTag = 0
    temp = (objValue.length)
    for (var i = 0; i < temp; i++) {
        tmp = objValue.substring(i, i + 1)
        if (characters.indexOf(tmp) == -1) {
            lTag = 1
        }

    }
    if (lTag == 1)
        return false
    else
        return true
}

function fnIsAlphaNumericPF(objValue) {
    var characters = " -0123456789"
    var tmp
    var lTag
    lTag = 0
    temp = (objValue.length)
    for (var i = 0; i < temp; i++) {
        tmp = objValue.substring(i, i + 1)
        if (characters.indexOf(tmp) == -1) {
            lTag = 1
        }
    }
    if (lTag == 1)
        return false
    else
        return true
}
function fnIsNumeric(objValue) {
    var characters = ".-0123456789"
    var tmp
    var lTag
    lTag = 0
    temp = (objValue.length)
    for (var i = 0; i < temp; i++) {
        tmp = objValue.substring(i, i + 1)
        if (characters.indexOf(tmp) == -1) {
            lTag = 1
        }
    }
    if (lTag == 1)
        return false
    else
        return true
}
//end function




// function to reset the form values
function fnReset(frmName) {
    eval("document." + frmName + ".reset()")
}

function TestString(S) {
    return /^([01]?[0-9]|[2][0-3])(:[0-5][0-9])?$/.test(S)
}


// function for checking if inputed value is a valid number
function IsPhone(InString) {
    var left, right;
    if (InString.length == 0) return (false);
    for (Count = 0; Count < InString.length; Count++) {
        TempChar = InString.substring(Count, Count + 1);
        if ("1234567890-+[](). ".indexOf(TempChar, 0) == -1)
            return (false);
    }

}

function isSpecialCharacter(objValue) {
    var characters = "'-abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789._@"
    var tmp;
    var lTag;
    lTag = 0;
    temp = (objValue.length);
    for (var i = 0; i < temp; i++) {
        tmp = objValue.substring(i, i + 1);
        if (characters.indexOf(tmp) == -1) {
            lTag = 1;
        }
    }
    if (lTag == 1)
        return false;
    else
        return true;

}
/*function to check integer number */
function fnIsNumericInteger(objValue) {
    var characters = "0123456789"
    var tmp
    var lTag
    lTag = 0
    temp = (objValue.length)
    for (var i = 0; i < temp; i++) {
        tmp = objValue.substring(i, i + 1)
        if (characters.indexOf(tmp) == -1) {
            lTag = 1
        }
    }
    if (lTag == 1)
        return false
    else
        return true
}
// function for checking if inputed value is a valid international phone number
/*to validate international phone*/
function IsInternationalPhone(InString) {
    var left, right;
    if (InString.length == 0) return (false);
    for (Count = 0; Count < InString.length; Count++) {
        TempChar = InString.substring(Count, Count + 1);
        if ("1234567890-+() ".indexOf(TempChar, 0) == -1)
            return (false);
    }

}
// function for checking if inputed value is a valid US phone number
/*to validate US phone*/
function IsUSPhone(str3) {
    var flag = 0;
    if (flag != 1) {

        if (str3.charAt(3) == "-" && str3.charAt(7) == "-") {
            str3 = strip("*() -./_\n\r\t\\", str3);
            if (str3.length == 10 && fnIsNumericInteger(str3) == true)
                flag = 1;

        }

    }
    if (flag != 1) {
        if (str3.length == 10) {
            if (fnIsNumericInteger(str3) == true)
                flag = 1;
        }
    }
    if (flag != 1) {
        if (str3.length == 13) {
            if (str3.charAt(0) == "(" && str3.charAt(4) == ")" && str3.charAt(8) == "-") {
                str3 = strip("*() -./_\n\r\t\\", str3);
                if (str3.length == 10 && fnIsNumericInteger(str3) == true) {
                    flag = 1;
                }
            }
        }
    }
    if (flag != 1) {
        if (str3.length == 14) {
            if (str3.charAt(0) == "(" && str3.charAt(4) == ")" && str3.charAt(9) == "-" && str3.charAt(5) == " ") {
                str3 = strip("*() -./_\n\r\t\\", str3);
                if (str3.length == 10 && fnIsNumericInteger(str3) == true) {
                    flag = 1;
                }

            }
        }

    }
    if (flag != 1) {
        if (str3.length == 12) {
            if (str3.charAt(3) == " " && str3.charAt(7) == " ") {

                str3 = strip("*() -./_\n\r\t\\", str3);
                if (str3.length == 10 && fnIsNumericInteger(str3) == true) {
                    flag = 1;

                }
            }
        }
    }
    if (flag == 0) {
        return false;
    }

    return true;

}
// To filter particular character from string 
function strip(filter, str) {
    var i, curChar;
    var retStr = '';
    var len = str.length;
    for (i = 0; i < len; i++) {
        curChar = str.charAt(i);
        if (filter.indexOf(curChar) < 0)
            retStr += curChar;
    }

    return retStr;
}
// To Stop & Redirecting Collaboratee to home page, after editing time completes(Edit Right-Collaboration).
function revokeRights() {
    alert('Oops your edit rights has been taken away!!!!!');
    location.href = 'Survey_home.aspx';
}

/* Routine for ToolTips */

// Function for New feature alert in the whole system
function fnNewFeatureMsg() {
    alert("This feature is coming soon!!!");
    return false;
}


/* FUNCTION TO CHECK IF THE POPUP BLOCKER SETTING FOR THE BROWSER IS ACTIVE*/
function IsPopupBlocker() {
    var topPos = window.screen.height + 1;
    var leftPos = window.screen.width + 1;

    var oWin = window.open("", "_", "width=1,height=1,top=" + topPos + ",left=" + leftPos + ",toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,alwaysLowered=yes");

    if (oWin == null || typeof (oWin) == "undefined") {
        document.location.href = "PopupMessage.aspx";
    }
    else {
        if (oWin.closed) document.location.href = "PopupMessage.aspx"; //alert("A popup blocker is preventing SurveyMethods from displaying certain screens. Please disable your popup blocker OR configure it to allow popups from surveymethods.com ");
        oWin.close();
    }
}
/*********** END ************/



/*FUNCTION ADDED BY VAIBHAV WHICH IS FOR "Home and Contact Us" Image Mouse Over Effect
Called on Body of Every Page.*/

function MM_preloadImages() { //v3.0
    var d = document; if (d.images) {
        if (!d.MM_p) d.MM_p = new Array();
        var i, j = d.MM_p.length, a = MM_preloadImages.arguments; for (i = 0; i < a.length; i++)
            if (a[i].indexOf("#") != 0) { d.MM_p[j] = new Image; d.MM_p[j++].src = a[i]; } 
    }
}

function MM_swapImgRestore() { //v3.0
    var i, x, a = document.MM_sr; for (i = 0; a && i < a.length && (x = a[i]) && x.oSrc; i++) x.src = x.oSrc;
}

function MM_findObj(n, d) { //v4.01
    var p, i, x; if (!d) d = document; if ((p = n.indexOf("?")) > 0 && parent.frames.length) {
        d = parent.frames[n.substring(p + 1)].document; n = n.substring(0, p);
    }
    if (!(x = d[n]) && d.all) x = d.all[n]; for (i = 0; !x && i < d.forms.length; i++) x = d.forms[i][n];
    for (i = 0; !x && d.layers && i < d.layers.length; i++) x = MM_findObj(n, d.layers[i].document);
    if (!x && d.getElementById) x = d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
    var i, j = 0, x, a = MM_swapImage.arguments; document.MM_sr = new Array; for (i = 0; i < (a.length - 2); i += 3)
        if ((x = MM_findObj(a[i])) != null) { document.MM_sr[j++] = x; if (!x.oSrc) x.oSrc = x.src; x.src = a[i + 2]; }
}

/*********** END ************/

//Added by ABHAYG on 22oct09 to active the selected tab
/*********** START ************/

function setActiveTab(id) {
    clearSubMenu();
    var menuObj = document.getElementById(id);
    if (menuObj != null) {
        menuObj.className = menuObj.className + ' mActive';
    }
}

function clearSubMenu() {
    var subMenu = document.getElementById('top_menu_main');
    if (subMenu != null) {
        var anc = subMenu.getElementsByTagName("m");
        var i;
        for (i = 0; i < anc.length; i++) {
            anc[i].className = '';
        }
    }
}

// on 22oct09 to show the glossary pages from resource.aspx link

/*********** END ************/
// functions for Matrix Question(Type-13/14/15) - Start
// Added on 01-04-2010.
//-------------------------------------------------------------------------------------//
//  Function to show tootip on column mouseover
function Showmsg(sender, eventArgs) {
    var grid = sender.get_id();
    var test = $find(grid);
    var gridId = test.get_id();
    JT_show_tool('', gridId, 217);
}
//  Function to hide tootip on column mouseout
function Hidemsg(sender, eventArgs) {
    hideTooltip();
}


//  Function adjusts textbox width in matrix grid as per it's the column width
//  when the grid is created.
function fnResizeTextboxWidth(sender, eventArgs) {
    // Get ID of grid.
    var grid = sender.get_id();

    var test = $find(grid);

    var MainGridIndex = 4;
    for (var mgIndex = 0; mgIndex < 3; mgIndex++) {

        if (MainGridIndex > 9) {
            var gridRowId = "ctl00_cphMain_RadGridTest_ctl00_ctl" + MainGridIndex + "_ucControl_";
        }
        else {
            var gridRowId = "ctl00_cphMain_RadGridTest_ctl00_ctl0" + MainGridIndex + "_ucControl_";
        }

        var gridId = test.get_id();
        var count;
        if (gridId.length == 50)

            count = 39;
        else
            count = 40;
        var ctrltype = gridId.substring(count, 0) + "hidControlType";
        ctrltype = document.getElementById(ctrltype);
        var tableView = $find(gridId).get_masterTableView();
        var numRows = tableView.get_dataItems().length;
        var numColS = tableView.get_columns().length;
        var gridColumnWidth = "";
        gridColumnWidth = tableView.get_columns()[0].get_element().offsetWidth + ".";
        for (var indCol = 0; indCol < numColS; indCol++) {
            var ColumnName = tableView.get_columns()[indCol].get_uniqueName();

            var ColIndex = 4;
            if (indCol != numColS - 1)
                gridColumnWidth = gridColumnWidth
                                          + tableView.get_columns()[indCol + 1].get_element().offsetWidth + ".";

            for (i = 0; i < numRows; i++) {
                if (ctrltype.value == "16")
                    strctrlID = "_drp";
                else
                    strctrlID = "_txt" + ColumnName;
                var val = gridId + "_ctl00_ctl0" + ColIndex + strctrlID;

                if (ColIndex > 9) {
                    val = gridId + "_ctl00_ctl" + ColIndex + strctrlID;

                }
                if ((ColumnName == 'Please Select' && ctrltype.value == '16') || (ColumnName != 'RowText' && ctrltype.value != '16')) {
                    //alert('in');
                    var txtId = document.getElementById(val);

                    if (txtId != null) {
                        //alert(txtId);
                        var w = tableView.get_columns()[indCol].get_element().offsetWidth;
                        w = (100 * (parseInt(w) - 10)) / parseInt(w);
                        txtId.style['width'] = w + "%";
                    }
                }
                ColIndex = ColIndex + 2;
            }
        }

        MainGridIndex = MainGridIndex + 2;
    }
    
}
//  Function adjusts textbox width in matrix grid as per it's the column width
//  when columns are resized.
function fnChangeColumnWidth(sender, eventArgs) {
    //document.getElementById('ctl00_cphMain_drpWidth').disabled = true;

    var grid = sender.get_id();
    var gridObj = document.getElementById(grid);
    var test = $find(grid);
    var MasterTableViewID = grid + "_ctl00";
    MasterTableViewID = grid.substring(0, 26);
    MasterTableViewID = MasterTableViewID + grid.substring(28, grid.length) + "_ctl00";
    MasterTableViewID = document.getElementById(MasterTableViewID);
    var MainGridIndex = 4;
    for (var mgIndex = 0; mgIndex < 3; mgIndex++) {

        if (MainGridIndex > 9) {
            var gridRowId = "ctl00_cphMain_RadGridTest_ctl00_ctl" + MainGridIndex + "_ucControl_";
        }
        else {
            var gridRowId = "ctl00_cphMain_RadGridTest_ctl00_ctl0" + MainGridIndex + "_ucControl_";
        }

        var SelcolIndex = eventArgs.get_gridColumn().get_element().cellIndex;
        var gridId = test.get_id();
        //if grid id is at greater than 10th position in reorder list then 
        //chk count before taking substring from the grid id.
        var count;
        if (gridId.length == 50)

            count = 39;
        else
            count = 40;
        //Display the div containing Save/Cancel button.
        //hdMastertblview = document.getElementById(hdMastertblview);
        //alert(hdMastertblview);
        var dvSaveCancelID = gridId.substring(count, 0) + "dvSaveCancel";
        var hidColWidth = gridId.substring(count, 0) + "hidGridColumnWidth";
        var flg = gridId.substring(count, 0) + "hidflag";
        var ctrltype = gridId.substring(count, 0) + "hidControlType";
        ctrltype = document.getElementById(ctrltype);
        flg = document.getElementById(flg);
        flg.value = "1";
        hidColWidth = document.getElementById(hidColWidth);
        dvSaveCancelID = document.getElementById(dvSaveCancelID);
        dvSaveCancelID.style['display'] = "block";
        var tableView = $find(gridId).get_masterTableView();
        var numRows = tableView.get_dataItems().length;
        var numColS = tableView.get_columns().length;
        var gridColumnWidth = "";
        var totalgridColumnWidth = "";
        gridColumnWidth = tableView.get_columns()[0].get_element().offsetWidth + ".";
        totalgridColumnWidth = gridColumnWidth;
        for (var indCol = 0; indCol < numColS; indCol++) {
            var ColumnName = tableView.get_columns()[indCol].get_uniqueName();
            SelcolIndex = SelcolIndex + 1;
            var ColIndex = 4;
            if (indCol != numColS - 1) {
                gridColumnWidth = gridColumnWidth
                                          + tableView.get_columns()[indCol + 1].get_element().offsetWidth + ".";
                totalgridColumnWidth = parseInt(totalgridColumnWidth) +
                                           parseInt(tableView.get_columns()[indCol + 1].get_element().offsetWidth);
            }
            var strctrlID;

            for (i = 0; i < numRows; i++) {

                if (ctrltype.value == '16')
                    strctrlID = "_drp";
                else
                    strctrlID = "_txt" + ColumnName;
                var val = gridId + "_ctl00_ctl0" + ColIndex + strctrlID;

                if (ColIndex > 9) {
                    val = gridId + "_ctl00_ctl" + ColIndex + strctrlID;

                }
                if ((ColumnName == 'Please Select' && ctrltype.value == '16') || (ColumnName != 'RowText' && ctrltype.value != '16')) {

                    var txtId = document.getElementById(val);
                    if (txtId != null) {

                        var w = tableView.get_columns()[indCol].get_element().offsetWidth;
                        w = (100 * (parseInt(w) - 10)) / parseInt(w);
                        txtId.style['width'] = w + "%";
                    }
                }
                ColIndex = ColIndex + 2;
            }

        }

        MainGridIndex = MainGridIndex + 2;
    }
    hidColWidth.value = gridColumnWidth + totalgridColumnWidth;
    MasterTableViewID.style.width = "100%";
    gridObj.style.width = "100%";
   
}

//  Function to enable page width div dropdown when resized col width is saved.
function enabledrpdown(element) {
    var obj1 = element.id;
    // Hide Save/Cancel btns.
    obj1 = obj1.substring(obj1.length - 15, 0);
    var btndiv = obj1 + 'dv1';
    btndiv = document.getElementById(btndiv);
    btndiv.style.display = 'none';
    // Make lblprocessing div visible.
    var objlbldiv = obj1 + 'dv';
    objlbldiv = document.getElementById(objlbldiv);
    objlbldiv.style.display = 'block';
    //window.setTimeout('objlbldiv.style.display = \'block\'', 1000);
    var i; var flag = 0;
    var cnt = document.getElementById('ctl00_cphMain_hidQuestionCount');
    cnt = cnt.value;
    //alert('cnt ' + cnt);
    for (i = 0; i < cnt; i++) {
        //alert('i ' + i);
        var obj = 'ctl00_cphMain_ReorderList1__rli' + i + '_ctl02_dvSaveCancel';
        var tempID = 'ctl00_cphMain_ReorderList1__rli' + i + '_ctl02_';
        obj = document.getElementById(obj);
        if (obj != null) {
            if (obj1 != tempID) {
                //alert('in I' + i);
                if (obj.style['display'] == "block") {
                    flag = 1; break;
                }

                else
                    flag = 0;
            }
        }
    } //end of for
    
//    if (flag == 1)
//        document.getElementById('ctl00_cphMain_drpWidth').disabled = true;
//    else
//        document.getElementById('ctl00_cphMain_drpWidth').disabled = false;
    
}
// functions for Matrix Question - End


/* Created by: atulr@ecotech: 6thApr2010
Purpose   : To change background color on mousehover. (especially on Survey_home) */
function stripe() {
    var ids = document.getElementsByTagName("ctl00_cphMain_dgrdSurvey"); //table
    for (k = 0; k < ids.length; k++) {
        var id = ids[k].id; alert(id);
        if (id) {
            var table = document.getElementById(id);
            var rows = table.getElementsByTagName("tr");
            for (i = 0; i < rows.length; i++) {
                if (rows[i].className == "") {
                    sRc = (i % 2 == 0) ? "dg_td" : "dg_td_alter";  //"even" : "odd";
                    rows[i].className = sRc;
                }

                if (rows[i].parentNode.nodeName == 'TBODY') {
                    rows[i].onmouseover = function() { this.className = 'ruled'; return false }
                    if (i % 2 == 0) {
                        rows[i].onmouseout = function() { this.className = "dg_td"; return false }
                    } else {
                        rows[i].onmouseout = function() { this.className = "dg_td_alter"; return false }
                    }
                }
            }
        }
    }
}

/* Created by: keyurv@ecotech: 12Apr2010
Purpose   : To validate editor content */
function fnValidateEditor(content) {
    var strReplaceAll = content;
    // = content.replace("<br />", "");
    var intIndexOfMatch = strReplaceAll.indexOf("&nbsp;");

    // Loop over the string value replacing out each matching
    // substring.
    while (intIndexOfMatch != -1) {
        // Relace out the current instance.
        strReplaceAll = strReplaceAll.replace("&nbsp;", " ")

        // Get the index of any next matching substring.
        intIndexOfMatch = strReplaceAll.indexOf("&nbsp;");
    }
    intIndexOfMatch = strReplaceAll.indexOf("iframe");
    while (intIndexOfMatch != -1) {
        // Relace out the current instance.
        strReplaceAll = strReplaceAll.replace("iframe", "")

        // Get the index of any next matching substring.
        intIndexOfMatch = strReplaceAll.indexOf("iframe");
    }
    intIndexOfMatch = strReplaceAll.indexOf(".js");
    while (intIndexOfMatch != -1) {
        // Relace out the current instance.
        strReplaceAll = strReplaceAll.replace(".js", "")

        // Get the index of any next matching substring.
        intIndexOfMatch = strReplaceAll.indexOf(".js");
    }

    content = trim(strReplaceAll);
    
    //alert(content); return false;
    return content;
}
/*************************************/

/* Created by: atulr@ecotech: 12Apr2010
Purpose   : To change background-color of DataGrid on mouseover. */
function setBackColor(clientID) {
    try {
        document.getElementById(clientID).style.backgroundColor = '#f0f0f1';
    }
    catch (e) { }
}
function removeBackColor(clientID) {
    try {
        document.getElementById(clientID).style.backgroundColor = '#ffffff';
    }
    catch (e) { }
}


