// Forum JS functions and variables
// (C) DQ Dev Team
// 
function openCentered(url, name, height, width, wparams) 
{
 var str = "height=" + height + ",innerHeight=" + height;
 str += ",width=" + width + ",innerWidth=" + width;
 if (window.screen) {
 var ah = screen.availHeight - 30;
 var aw = screen.availWidth - 10;
      
 var xc = (aw - width) / 2;
 var yc = (ah - height) / 2;
  
 str += ",left=" + xc + ",screenX=" + xc;
 str += ",top=" + yc + ",screenY=" + yc;
}

if(wparams!='') str=str+','+wparams;

return window.open(url, name, str);
} // of fn


function loginWindow(calledFrom)
{
loginUrl = new String();
loginUrl = 'flogon'+'?cf='+calledFrom;
lWindow=openCentered(loginUrl,'LoginWindow',200,400,'status=YES');
}

function newThread()
{
id = new String("000000000000");
if(document.auth.id != null)
{
 id = document.auth.id.value;
}
//alert("ID="+id);
ntrUrl = new String();
ntrUrl = 'newthr'+'?fid='+document.auth.fid.value+'&id='+id;
lWindow=openCentered(ntrUrl,'NewThreadWindow',450,650,'status=YES');
}

function newMsg(mid,act) // note: this function can be called only from msglist :-)
{
id = new String("000000000000");
if(document.auth.id != null)
{
 id = document.auth.id.value;
 document.auth.act.value=act;
 document.auth.msgid.value=mid;
}
nUrl = new String();
nUrl = 'msgrqe'+'?mid='+mid+'&id='+id+'&act='+act+'&tid='+document.auth.tid.value;
rqeWindow=openCentered(nUrl,'EditWindow',400,600,'status=YES,scrollbars=YES,resizable=NO');

}

function tlist(fid)
{
 document.auth.method='POST';
 document.auth.action='tlist';
// alert('fid='+fid);
 if(fid!=0) document.auth.fid.value=fid;
 document.auth.submit();
}

function refreshTlist(fid)
{
 opener.auth.method='POST';
 opener.auth.action='tlist';
 //opener.auth.fid.value=fid;
 opener.auth.submit();
}

function msgl(tid)
{
 document.auth.method='POST';
 document.auth.action='msglist';
 if(tid!=0) document.auth.tid.value=tid;
 document.auth.submit();
}

function rlist(rid)
{
 document.auth.method='POST';
 document.auth.action='rlist';
 document.auth.rid.value=rid;
 document.auth.submit();
}

function delMsg(msg)
{
 document.auth.method='POST';
 document.auth.action='msglist';
 document.auth.msgid.value=msg;
 document.auth.act.value=4;
 document.auth.submit();
}

function regUser()
{
 regWindow=openCentered('../../external.html?link=http://www.europadonna.md/cgi-bin/register','RegisterWindow',400,600,'status=YES,scrollbars=YES,resizable=NO,toolbar=YES');
}

function pEdit()
{
id = new String("000000000000");                     
if(document.auth.id != null)
{
 id = document.auth.id.value;
}
 pWindow=openCentered('http://www.europadonna.md/cgi-bin/profile?id='+id,'ProfileWindow',400,600,'status=YES,scrollbars=YES,resizable=NO,toolbar=YES');
}

function regEnt()
{
 regEntWindow=openCentered('../../external.html?link=http://www.europadonna.md/cgi-bin/entreg_en','EntRegisterWindow',550,600,'status=NO,scrollbars=YES,resizable=NO,toolbar=YES');
}

function editNews(nid, logondata)
{
 newsEditWindow=openCentered('http://www.europadonna.md/cgi-bin/newsedit_t?id='+logondata+'&nid='+nid,'EditWindow',600,700,'status=NO,scrollbars=YES,resizable=YES,toolbar=YES');
}