function pop_window (url) {
    var w = 500;
    var h = 700;
    var x = screen.width - w;
    var y = 0; 
    var params = "toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=no," + 
	"left=" + x + ",top=" + y + ",width=" + w + ",height=" + h;
    
    newWindow = window.open(url, 'Nice Water-Polo', params);
    newWindow.focus(); 
}

function pop_window_param (url, title, w, h, x, y) {
    var params
    h = h + 50;
    w = w + 24;
    params = "toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=no," + "left=" + x + ",top=" + y + ",width=" + w + ",height=" + h;
    newWindow = window.open(url, title, params);
    newWindow.focus(); 
}

function print_return (url) {
  res = '<p><a href="' + url + '">Retour</a></p>';
  return res
}

function print_close () {
  res = '<center><p><a href="javascript:close_me()"><b>Fermer</b></a></p></center>';
  return res
}


function add_bbcode (textarea, bbcode) {
  var content = '';
  var info = '';
  if (bbcode == 'B') { 
    content = prompt("Tapez le texte a afficher en gras", "");
    if (content == null) {
	return;
    }
    textarea.value = textarea.value + '[B]' + content + '[/B]';
    return;
  }
  if (bbcode == 'I') {
    content = prompt("Tapez le texte a afficher en italic", "");    
    if (content == null) {
        return;
    }
    textarea.value = textarea.value + '[I]' + content + '[/I]';
    return;
  }   
  if (bbcode == 'IMG') {
    content = prompt("Entrez l'URL de l'image a inserer", "http://");    
    if (content == null) {
        return;
    }
    textarea.value = textarea.value + '[IMG]' + content + '[/IMG]';
    return;
  }    
  if (bbcode == 'URL') {
    var url = prompt("Entrez l'URL vers laquelle pointer", "http://");    
    if (url == null) {
        return;
    }
    var text = prompt("Entrez le texte du lien (optionel)", "");    
    if (text == null) {
      textarea.value = textarea.value + '[URL]' + url + '[/URL]';        
    }else{
      textarea.value = textarea.value + '[URL=' + url + ']' + text + '[/URL]';
    }
    return;
  }    
  if (bbcode == 'QUOTE') {
    textarea.value = textarea.value + '[QUOTE]' + content + '[/QUOTE]';
    return;
  }    
}


function pop_team(code, file, number) {
  var url = 'roster/display_team.php?code=' + code;
  url += '&player=' + file + '&nofPlayers=' + number;
  pop_window(url);
}

