// general mediativ functions for publishing, mainly popup windows

// shared functionality
function initWindow(p,x,y,w,h,t,scroll) {
  if (scroll) scrolltext="scrollbars=yes";
  else scrolltext="scrollbars=no";
  if(document.all) {
    wnd=window.open(p, t, scrolltext+", menubar=no, titlebar=no, dependent=yes, status=no ,width="+w+",height="+h);
  } else {
    wnd=window.open(p, t, "scrollbars,width="+w+",height="+h);
  }
  wnd.resizeTo(w,h);
  wnd.moveTo(x,y);
  wnd.blur();
  window.focus();
  wnd.focus();
  return wnd;
}

// comment popup window
function comment(inParent, inTyp, inId) {
  y=200; x=100;
  w=640; h=500;
  t="::comment::";
  p="/servlet/controller?page=kommentar&action=edit.pub.popup&ParentId="+inParent+"&Typ="+inTyp+"&ObjektId="+inId;
  initWindow(p,x,y,w,h,"comment",true);
}

// login popup window
function login() { 
  y=200; x=100;
  w=250; h=250;
  t="::login::";
  p="/servlet/controller?page=login&action=print.pub.popup";
  initWindow(p,x,y,w,h,"login",false);
}

/* DEPRECATED!
// logout popup window
function logout() {
  y=-10; x=-10;
  w=10; h=10;
  t="::login::";
  p="/servlet/controller?page=login&action=destroy.pub";
  initWindow(p,x,y,w,h,"logout",false);
}
*/

// join mediativ as registered user popup window
function join(id) {
  y=200; x=100;
  w=460; h=470;
  t="::abonnent::";
  if (id==0)  p="/servlet/controller?page=benutzer&action=edit.pub.popup";
  else        p="/servlet/controller?page=benutzer&action=edit.abo.popup&BenutzerId="+id;
  initWindow(p,x,y,w,h,"abo",true);
}

// select stars window
function fav() {
  y=200; x=100;
  w=320; h=450;
  t="::favoriten::";
  p="/servlet/controller?page=favoriten&action=edit.abo";
  initWindow(p,x,y,w,h,"favoriten",true);
}

// liedempfehlung comment popup window
function songinfo(inText) {
  y=200; x=100;
  w=200; h=200;
  t=": : s o n g i n f o : :";
  p="";
  x=initWindow(p,x,y,w,h,"abo",true);
  x.document.writeln("<html><head><title>::song::</title></head><body style='text-align:center;font-family:verdana,arial;font-size:10px'>"+inText+"</body></html>");
}

// image popup window
function showImagePopup(url) {
  y=10; x=10;
  popup=window.open( "/pub/imageShow_popup.jsp?"+url, 'newWin',
     'resizable=1,HEIGHT=200,WIDTH=200,scrollbars=auto');
  popup.focus();
  popup.moveTo(x,y);
}

function getAdress(pre,post){
  var link="mai" + "lto" + ":" + pre + "@" + post;
  window.location=link;
}


