  

    /**
    * enterkeyHandler:This function is used to submit the form when enter key is pressed from the keyboard
    * Parameters : event  : event occured
    *              frm    : document form name
    *              url    : the parameter to be passed to the calling validate function
    * Return Value: Shall not return any value
    * Compatibility: Internet Explorer v6.0; Mozilla v5.0; Netscape V7.1;
    **/
    function enterKeyHandler(event,frm,url)
    {
        var key;
        var ENTER_KEY = 13;
        if(window.event)
        {
             key = window.event.keyCode;     //IE
        }
        else
        {
             key = event.which;
        }
        if(key == ENTER_KEY)
           {
           is_valid = searchValidate(url);
           if(is_valid)
           {
               frm.submit();
           }   
           else
           {
               return false;
           } 
           }
        else
        {
            return true;
        }  
    }


    /**
    * enterkeyHandler:This function is used to submit the form when enter key is pressed from the keyboard
    * Parameters : event  : event occured
    *              frm    : document form name
    *              url    : the parameter to be passed to the calling validate function
    * Return Value: Shall not return any value
    * Compatibility: Internet Explorer v6.0; Mozilla v5.0; Netscape V7.1;
    **/
    function viewEnterKeyHandler(event,frm,url)
    {
        var key;
        var ENTER_KEY = 13;
        if(window.event)
        {
             key = window.event.keyCode;     //IE
        }
        else
        {
             key = event.which;
        }
        if(key == ENTER_KEY)
           {
              getRadioButtonValue(url);
              return false;
           }
    }

        function updateHiddenFields()
        {
             var view_story_type=document.search_news_frm.view_story_type.value;
	     var chapter_name=document.search_news_frm.chapter_name.value;
	     var id_chapter=document.search_news_frm.id_chapter.value;
	     document.search_news_frm.view_story_type.value=document.news_summary.view_story_type.value;
             document.search_news_frm.chapter_name.value=document.news_summary.chapter_name.value;
             document.search_news_frm.id_chapter.value=getradioval(document.news_summary.chapter_global);
             submitForm();
        }
        /** 
        * submitForm: This function is used to change the form action when advanced search is required
        * Parameters : no parameters
        * Return Value: Shall not return any value
        * Compatibility: Internet Explorer v6.0; Mozilla v5.0; Netscape V7.1;
        **/
        function submitForm()
        {   
            var site_map_left= 'false'
            try{
               site_map_left=document.news_summary.site_map_left.value;
            }
            catch(e)
            {}

            if(site_map_left=='true')
            {
                var abs_url=document.news_summary.abs_url.value;
                var url =abs_url+"/viewNewsPagePT?from_view_advancesearch="+"&site_map_left="+site_map_left;
            }
            else
            {
                var url =portal_url+"/NM/searchnews/advancedSearchNewsPT";
            }
            
            document.search_news_frm.action = url;
            document.search_news_frm.submit();
        }

        /** 
        * getFormAsString() a 'private' method used by the retrieveURL() method.
        * Parameters : formName    :   The name of the form
        * Return Value: return all the form elements with there values
        * Compatibility: Internet Explorer v6.0; Mozilla v5.0; Netscape V7.1;
        **/
        function getFormAsString(formName)
        {
            //Setup the return String
            returnString ="";
            //Get the form values
            formElements=document.forms[formName].elements;
            //loop through the array, building up the url
            //in the format '/strutsaction.do&name=value'
            for(var i=formElements.length-1;i>=0; --i )
            {
                //we escape (encode) each value
                var delim = "&";
                if (i == formElements.length-1)
                {
                    delim = "";
                }
            returnString+= delim +escape(formElements[i].name)+"="+encodeURI(formElements[i].value);
           }
            return returnString;
        } 

        /** 
        * getBatchResult : This function is used to call the ajax method makeGETRequest() to 
        *                   get the next/previous batch results
        * Parameters : url    :   The url to be used to get the result
        * Return Value: Shall not return any value
        * Compatibility: Internet Explorer v6.0; Mozilla v5.0; Netscape V7.1;
        **/
        function getBatchResult(url)
        {
            var edit_display = document.getElementById('edit_message_slot');
            edit_display.innerHTML = '';
            var profile_display_slot_id = 'display_slot';
            document.getElementById('message_slot').innerHTML = '';
            makeGETRequest(url, profile_display_slot_id);
        }


        /** 
        * showSearchResult : This function is used to call the ajax method makePOSTRequest() to display
        *                   the search result, the ajax method calls the result page 
        *                   and display it in the display_slot
        * Parameters : url    :   The url to be used to locate the displayEventsListPT
        * Return Value: Shall not return any value
        * Compatibility: Internet Explorer v6.0; Mozilla v5.0; Netscape V7.1;
        **/
        function showSearchResult(url)
        {   
            var profile_display_slot_id = 'display_slot';
            var poststr = getFormAsString("search_news_frm");
            makePOSTRequest(url, poststr,profile_display_slot_id);
        }

        /** 
        * searchValidate : This function is used to validate the form elements and  
        *                   to call the function to display the search result
        * Parameters : url    :   The url to be sent to the search result function
        * Return Value: Shall not return any value
        * Compatibility: Internet Explorer v6.0; Mozilla v5.0; Netscape V7.1;
        **/
        function searchValidate(url)
        {
            document.search_news_frm.keyword.value = trim(document.search_news_frm.keyword.value);
            if(document.search_news_frm.keyword.value=='')
            {   
                alert(ERR_TGS028_001);
                document.search_news_frm.keyword.focus();
            }
            else
            {
                showSearchResult(url);
            }
        }

        /** 
        * changeNewsStatus : This function is used to call the ajax method makeGETRequest() to change
        *                   the status of the member and display the search result
        * Parameters : url    :   The url to be used to locate the changeNewsStatusPY;
        *              div_id :   The slot id where the icon and url is replaced
        *              status  :  The message is displayed on the basis of this status 
        * Return Value: Shall not return any value
        * Compatibility: Internet Explorer v6.0; Mozilla v5.0; Netscape V7.1;
        **/
        function changeNewsStatus(url,div_id,status)
        {  
            if(status == 12)
            {
                var change_status=confirm(CNF_TGS028_002);
            }
            else
            {
                var change_status=confirm(CNF_TGS028_001);
            }
            if (change_status)
            {   
                var edit_display = document.getElementById('edit_message_slot');
                edit_display.innerHTML = '';
                var message_display_slot_id = div_id;
                var table_id = document.getElementById('display_slot');
                makeGETRequest(url, message_display_slot_id);
                table_id.style.width='95%';
                if(status == 12)
                {
                    document.getElementById('message_slot').innerHTML = 
                    '<'+'span class=confirmation_normal'+'>'+' News Rejected'+'<'+'/span'+'>';
                }
                else
                {
                    document.getElementById('message_slot').innerHTML =
                    '<'+'span class=confirmation_normal'+'>'+' News Published'+'<'+'/span'+'>';
                }

            }
            else
            {
                return false;
            }

        }

       /** 
       * deleteOrRestoreNews : This function is used to call the ajax method makeGETRequest() to change
       *                   the status of the member and display the search result
       * Parameters : url     :   The url to be used to locate the deleteOrRestoreNewsPY;
       *              div_id  :   The slot id where the icon and url is replaced
       *              flg     :   Flag indicating whether the news is being deleted or restored
       *              id_news :   id of the news to be deleted or restored
       * Return Value: Shall not return any value
       * Compatibility: Internet Explorer v6.0; Mozilla v5.0; Netscape V7.1;
        **/
        function deleteOrRestoreNews(url,div_id,flg, id_news)
        {  
            var edit_slot_obj = document.getElementById('edit_icon_slot'+id_news);
                      
            if(flg == 0)
            {
                var change_status=confirm(CNF_TGS028_003);
            }
            else
            {
                var change_status=confirm(CNF_TGS028_004);
            }
            if (change_status)
            {   
                var edit_display = document.getElementById('edit_message_slot');
                edit_display.innerHTML = '';
                var message_display_slot_id = div_id;
                var table_id = document.getElementById('display_slot');
                makeGETRequest(url, message_display_slot_id);
                table_id.style.width='95%';
                if(flg == 0)
                {
                    document.getElementById('message_slot').innerHTML = 
                    '<'+'span class=confirmation_normal'+'>'+' News Deleted'+'<'+'/span'+'>';
                    edit_slot_obj.style.visibility = 'hidden';
                }
                else
                {
                    document.getElementById('message_slot').innerHTML =
                    '<'+'span class=confirmation_normal'+'>'+' News Restored'+'<'+'/span'+'>';
                    edit_slot_obj.style.visibility = 'visible';
                }

            }
            else
            {
                return false;
            }

        }
/** 
* showProfileDiv : This function is used to call the ajax method makeGETRequest() to display
*                   the member profile in a div
* Parameters : url    :   The url to be used to locate the viewProfilePT
*              event  :   event action 
* Return Value: Shall not return any value
* Compatibility: Internet Explorer v6.0; Mozilla v5.0; Netscape V7.1;
**/
function showRelatedEventsDiv(url, id_news, event)
{
    url = url + '/NM/searchnews/relatedEventsPT?id_news=' + id_news;
    var event_display_slot_id = 'viewevent_slot';
    makeGETRequest(url, event_display_slot_id);
    displayWindow('viewevent_slot',event);
}


