/* to be used in /site/xxx/public/head{n}.tpl */

function showContact(object) {
  _openC('obj/page.php?'+object,380,500,'scrollbars,resizable');
}

function login() {
  //_openC('../../../public/login.php',280,180,'dependent');
  proxy= 'proxy.php?target=login';
  if (window.location.href.search(/\/obj\/page\./)!=-1) proxy= '../'+proxy;
  window.status= 'Moment bitte...';
  _openC(proxy,280,180,'dependent');
  window.status= '';
}

function logout(toURL,fromURL) {
  //document.location= '../../../public/logout.php?from='+fromURL;
  proxy= 'proxy.php?target=logout&from='+escape(fromURL)+'&to='+escape(toURL);
  if (window.location.href.search(/\/obj\/page\./)!=-1) proxy= '../'+proxy;
  top.location= proxy;
}


/* re-defined here so that you don't have to include /etc/openC.js as well */
function _openC(url,w,h,features) {
  var x= (screen.width-w)/2, y= (screen.height-h)/2;
  if (features==null || features=='') // NS optimization
    features= 'screenX='+x+',screenY='+y+',width='+w+',height='+h;
  else
    features= features +',screenX='+x+',screenY='+y+',width='+w+',height='+h;
  w= window.open(url,'',features);
  w.moveTo(x,y);
  // return w;
}

// for sites using frames:
function hShowEditorFor() {
  editor= window.open('','publisher');
  oID= parent.main.objectID; if (oID==undefined) oID='';
  if (editor.JoustFrameset) {
    url= window.system_root+'intern/tshow.php?obj='+oID+'&ignoreP=no';
    editor.work.location.href= url;
  } else {
    url= window.system_root+'intern/index.php?page=%3D'+oID;
    editor.location.href= url;
  }
  editor.focus();
}
