// generic window pop-up.
// accepts the url variables and window properties
// used in adminshop/admindloads/add and edit-dload.php
function abreSesamo(theurl, thewin, hasscroll, hasstatus, hastoolbar, hasmenubar, isresizable, winwidth, winheight, leftpos, toppos)
{
    var URL = theurl;
    var windowName = thewin;
    var features =
        'width='        + winwidth +
        ',height='      + winheight +
        ',menubar='     + hasmenubar +
        ',scrollbars='  + hasscroll +
        ',status='      + hasstatus +
        ',toolbar='     + hastoolbar +
        ',left='        + leftpos +
        ',top='         + toppos +
        ',screenX='     + leftpos +
        ',screenY='     + toppos +
        ',resizable='   + isresizable;

    window.open (URL, windowName, features);
}


/*
* kind of like the admin.js setFormAction() method
* takes the url link, link redirect or not, and an alert string
*/
function setLinkAction(thelink, sumbmitbool, alertstring)
{
linkval = thelink;
if(alertstring.length > 1){
if((confirm(alertstring)) && (sumbmitbool)) {
document.location.href = linkval;
} else {
alertstring = "";
}
return;
}
if(sumbmitbool) {
document.location.href = linkval;
}
}

// sets a form field value
function setFieldVal(fname, ffldname, ffldval)
{
document[fname][ffldname].value = ffldval;
}


// sets a search order field and the search order. asc. or desc.
function setAdvSrchDir(srchorder, srchdir)
{
setFieldVal('advnsearchform', 'dynsrchorder', srchorder);
setFieldVal('advnsearchform', 'dynsrchdir', srchdir);
document.advnsearchform.submit();
}

function newResLyt(fldname, fldval, sumbmitbool, offsetbool) {
setFieldVal('advnsearchform', fldname, fldval);
if(offsetbool) {
setFieldVal('advnsearchform', 'offset', '0');
}
if(sumbmitbool) {
document.advnsearchform.submit();
}
}