/**
 * Changes the browsers location to the specified url
 * The href-value of <base href=".." /> is prepended if necessary
 *
 * @param url string	Can be an absolute or relative url
 */
function goto(url, target)
{
  var base = document.getElementsByTagName('base');
  if (base && base[0] && base[0].href && url.indexOf('://')==-1)
  {
    if (base[0].href.substr(base[0].href.length-1) == '/' && url.charAt(0) == '/')
    {
      url = url.substr(1);
    }
    url = base[0].href + url;
  }
  
  if (target)
  {
   	 var newWindow = window.open(url, target);
	 newWindow.focus();
  }
  else
  {
    window.location.assign(url);
  }
}
