/*************************************************************
* Internal anchor: do some stuff
************************************************************
$(document).ready(function () {
  internalAnchor.doInternalRedirect();  
});
*/
var internalAnchor = 
{
  doInternalRedirect: function()
  {
    var startIndex = 0;
    var endIndex = 0;
    var rawUrl = location.href;
    var key = "__ia";
    
    startIndex = rawUrl.indexOf(key, 0);
    
    if (startIndex >= 0)
    {
      startIndex += key.length + 1;
      
      var bitWeCareAbout = rawUrl.substring(startIndex);
      
      if( bitWeCareAbout.length > 0)
      {
        location.href = "#" + bitWeCareAbout;
      }
    }
    else
    {
      // see if there's something on the form for us
      var postedAnchor = $("input.internalAnchor__").val();
      
      if (postedAnchor.length > 0)
      {
        location.href = "#" + postedAnchor;
      }
    }
  }
}

