﻿// JScript File
function PerformKeywordSearch(SearchFieldId)
{
    var searchField = document.getElementById(SearchFieldId);
    if ( searchField.value )
    {
        document.location = "/SearchResult.aspx?Keywords=" + escape(searchField.value);
    }
}

function CheckRequiredInput()
{
    debugger;
    //alert(TextEditorClientId);
    return false;
}

// this is used to count RadEditor text's character counting algorithm
function getCharacterCount(txt)
{
    var charCount = 0;
    txt = txt.replace(/^\s+|\s+$/g,"");

    for ( var i = 0; i < txt.length; i++ )
    {
        if ( IsValidChar(txt.substring(i,i+1)) )
            charCount++;
    }
    return charCount;
}

// valid character set for RadEditor's character count
function IsValidChar(s)
{
    var valid = " 1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ@$%^*\r\n";
    return ( valid.indexOf(s) != -1 );
}

// this is used to count RadEditor text's word counting algorithm
function getWordCount(txt)
{
    var wordCount = 0;
    var words = txt.split(" ");
    for ( var i = 0; i < words.length; i++ )
    {
        if (words[i].length > 0)
            wordCount++;
    }
    return wordCount;
}
