function window_open(url)
{ //aktuelle URL holen
  var act_url = getUrlVars();
  if(is_numeric(act_url['L']))
  { var l = '&L='+act_url['L'];
  }
  else
  { var l = '';
  }

  //URL vom Typo3-Backend splitten
  var elem = url.split('||');
  
  //is_numeric => mit ID linken
  if(is_numeric(elem[0]))
  { elem[0] = '/index.php?id='+elem[0]+l;
  }
  
  //mittel Target neues oder gleiches Fenster 
  if(elem[1]=='blank')
  { window.open(elem[0]);
  }
  else if(elem[1]=='self')
  { document.location.href = elem[0];
  }
  else
  { document.location.href = elem[0];
  }
}

function is_numeric (mixed_var)
{ // Returns true if value is a number or a numeric string  
  // example 1: is_numeric(186.31);
  // returns 1: true
  
  // example 2: is_numeric('Kevin van Zonneveld');
  // returns 2: false
  
  // example 3: is_numeric('+186.31e2');
  // returns 3: true
  
  // example 4: is_numeric('');
  // returns 4: false
  if (mixed_var === '')
  { return false;
  }
  return !isNaN(mixed_var * 1);
}

function pasteUrl()
{ url = window.location;
  alert(url.href+'::'+url.hash);
}

function getUrlVars()
{ var vars = [], hash;
  var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
  for(var i = 0; i < hashes.length; i++)
  { hash = hashes[i].split('=');
    vars.push(hash[0]);
    vars[hash[0]] = hash[1];
  }
  return vars;
}

/*function getURLVar(urlVarName)
{ //divide the URL in half at the '?' 
  var urlHalves = String(document.location).split('?');
  var urlVarValue = '';
  if(urlHalves[1]){
  //load all the name/value pairs into an array 
  var urlVars = urlHalves[1].split('&');
  //loop over the list, and find the specified url variable 
  for(i=0; i<=(urlVars.length); i++)
  { if(urlVars[i])
    { //load the name/value pair into an array 
      var urlVarPair = urlVars[i].split('=');
      if (urlVarPair[0] && urlVarPair[0] == urlVarName)
      { //I found a variable that matches, load it's value into the return variable 
        urlVarValue = urlVarPair[1];
      }
    }
  }
  return urlVarValue;
}*/
