var acePopupWindow=null;
function acePopup(mypage,myname,w,h,pos,infocus)
{
        if(pos=='random')
                {
                        LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;
                        TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;
                }
        if(pos=='center')
                {
                        LeftPosition=(screen.width)?(screen.width-w)/2:100;
                        TopPosition=(screen.height)?(screen.height-h)/2:100;
                }
        else
                if((pos!='center' && pos!='random') || pos==null){LeftPosition=100;TopPosition=100;}
                        settings='width='+ w + ',height='+ h + ',top=' + TopPosition + ',left=' + LeftPosition + ',location=no,directories=no,menubar=no,toolbar=no,status=no,scrollbars=yes,resizable=yes,dependent=no';
        acePopupWindow=window.open('',myname,settings);
        if(infocus=='back')
        {
                acePopupWindow.blur();
                acePopupWindow.location=mypage;
                acePopupWindow.blur();
        }
        else
                acePopupWindow.location=mypage;
 return false;
}

function openMess(user)
{
        myname='mess_window'+user;
        LeftPosition=20;
        TopPosition=50;
        w=300;
        h=400;
        settings='width='+ w + ',height='+ h + ',top=' + TopPosition + ',left=' + LeftPosition + ',location=no,directories=no,menubar=no,toolbar=no,status=no,scrollbars=no,resizable=no,dependent=no';
        PopupWindow=window.open('',myname,settings);
        PopupWindow.location="messenger.php?action=runmess&mode=app&id="+user;
}

function openInfo(what, id, wi, he)
{
        myname='Preview_'+ what;
        LeftPosition=(screen.width)?(screen.width-wi)/2:100-wi;
        TopPosition=(screen.height)?(screen.height-he)/2:100-he;
        w=wi+100;
        h=he+200;
        settings='width='+ w + ',height='+ h + ',top=' + TopPosition + ',left=' + LeftPosition + ',location=no,directories=no,menubar=no,toolbar=no,status=no,scrollbars=no,resizable=no,dependent=no';
        PopupWindow=window.open('',myname,settings);
        PopupWindow.location="info.php?action=" + what + "&id=" + id;
}

function cleaner(frm) {
        for(i=0;i<(frm.elements.length-1);i++){
                if( (frm.elements[i].type == "radio") || (frm.elements[i].type == "checkbox") ) frm.elements[i].checked=0;
                if( (frm.elements[i].type == "select") ) frm.elements[i].selected=0;
                if( (frm.elements[i].type == "text") ) frm.elements[i].value="";
        }
}







