﻿// Add an entry to the _spBodyOnLoadFunctionNames array
// so that our function will run on the pageLoad event.

function EnableLinks()
{
     if(!IsInDesignMode())
     {
           var cstIdentifier='id="StringAReemplazar_onclick=';
     
           // Create an array to store all the anchor elements in the page.
           var anchors = document.getElementsByTagName("a");
     
           // Loop through the anchors array.
           for (var i=0; i<anchors.length; i++) 
           {
                // Check if this anchor element contain cstIdentifier text.
                if (anchors[i].outerHTML.indexOf(cstIdentifier) > 0)
                {
                     //alert(anchors[i].outerHTML);
                     
                     // Store the HTML for this anchor element.
                     oldText = anchors[i].outerHTML;
           
                     //rewrite the URL to remove our test text and add a target instead
                     newText = oldText.replace(cstIdentifier, 'onclick="');
           
                     // Write the HTML back to the browser.
                     anchors[i].outerHTML = newText;
                     
                     //alert(newText);
                }
           }
     }
}

function IsInDesignMode()
{
   if(document.getElementById("MSOLayout_InDesignMode").value == '1') return true;
   if(document.getElementById("MSOTlPn_SelectedWpId").value != "") return true;
   return false;
}		