
// Allgemeines PopUp
function popup(page,x,y,s,t) {
  if (!x) { x = "510"; }
  if (!y) { y = "511"; }
  if (!s) { s = "1"; }
  if (!t) { t = x +""+ y; }
  PopWindow=window.open(page,t,"scrollbars="+s+",resizable=no,width="+x+",height="+y);
  PopWindow.focus();
}


// Liebling des Tages
function VoteWin() {
  NewsWindow=window.open("vote.php","VoteWin","scrollbars=yes,resizable=no,width=380,height=450");
  NewsWindow.focus();
}

// Liebling des Tages (Ergebnis)
function ResultsWin() {
  NewsWindow=window.open("vote_results.php","VoteWin","scrollbars=yes,resizable=no,width=380,height=450");
  NewsWindow.focus();
}

// Storylines
function StoryWin() {
  popup("storyliner.php",650,450,1,"StoryWindow");
  //NewsWindow=window.open("storyliner.php","StoryWin","scrollbars=yes,resizable=no,width=650,height=450");
  //NewsWindow.focus();
}


// Foto-Fenster
function FotoWin(foto,x,y) {
  popup("show_foto.php?id="+foto,x,y,0,"FotoWindow");
}


// Profil-Fenster
function ProfilWin(id,name) {
  if (id == "0") { id = "0"; }
  if (!id) { id = ""; }
  if (!name) { name = ""; }
  popup("/popup_index.php?mode=profil&id="+id+"&name="+name,600,450,1,"ProfilWindow"+id);
}


// Nachrichten-Fenster
function MsgWin() {
  popup("/popup_index.php?mode=msg",600,450,1,"MsgWindow");
}


// Quiz
function startquiz() {
  d = document.quizform;
  param = "?quizstart=" + d.Modus.value + "&l=" + d.Level.value + "&k=" + d.Kategorie.value;
  QuizWindow=window.open("quizplay.php"+param,"Quiz","scrollbars=no,resizable=no,width=600,height=450");
  QuizWindow.focus();
}


// Seite des Hauptfensters ändern (von Popup aus)
function MainURL(page) {
  if (top.opener.top.window.uumain) {
    //alert('test');
    top.opener.top.window.uumain.location.href = page;
  }
}


// Smily in Nachricht hinzufügen
function AddSmily(code) {
  var d = document.form1.text;
  
  if (d.createTextRange && d.caretPos) {
    var caretPos = d.caretPos;
    caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? code + ' ' : code;
  } else {
    d.value += code;
  }
  
  d.focus();
}


// Zusatzfunktion für AddSmily
function getActiveText(selectedtext) {
  text = (document.all) ? document.selection.createRange().text : document.getSelection();
  if (selectedtext.createTextRange) {
    selectedtext.caretPos = document.selection.createRange().duplicate();
  }
  return true;
}


// Formular senden
function SendForm(d) {
  d.submit2.disabled = true;
  d.submit2.value = "Wird gesendet...";
  d.submit();
}

