// you must define those vars: FORM_NAME, TA_TABLENAME, TA_OP, TA_COLID, TA_OP_CUSTOMPAGE, TA_CUSTOMPAGE
// TA_OP_REFRESH, TA_ACTION, TA_OP_ORDER, TA_OP_FILTER, TA_SELKEY, TA_OP_SELMENUKEY, TA_OP_ROWMENUCALL
// TA_OP_EDITMODE, TA_OP_ROLLBACK, TA_ROWKEY
function doTableSort(_table, _colid){
    document.forms[FORM_NAME].elements[TA_TABLENAME].value=_table;
    document.forms[FORM_NAME].elements[TA_OP].value=TA_OP_ORDER;
    document.forms[FORM_NAME].elements[TA_COLID].value=_colid;
    doMainSubmit();
}  
function doTableNavigate(_table, _op){
    document.forms[FORM_NAME].elements[TA_TABLENAME].value=_table;
    document.forms[FORM_NAME].elements[TA_OP].value=_op;
    doMainSubmit();
}  
function doTableCustomPage(_table, _num){
    document.forms[FORM_NAME].elements[TA_TABLENAME].value=_table;
    document.forms[FORM_NAME].elements[TA_OP].value=TA_OP_CUSTOMPAGE;
    document.forms[FORM_NAME].elements[TA_CUSTOMPAGE].value=_num;
    doMainSubmit();
}  
function doTableRefresh(_table){
    document.forms[FORM_NAME].elements[TA_TABLENAME].value=_table;
    document.forms[FORM_NAME].elements[TA_OP].value=TA_OP_REFRESH;
}
function doTableFilter(_table){
    document.forms[FORM_NAME].elements[TA_TABLENAME].value=_table;
    document.forms[FORM_NAME].op.value=TA_OP_FILTER;
    doMainSubmit();
}
function doTableMenuSubmit(_table, _action, _selkey){
    document.forms[FORM_NAME].elements[TA_TABLENAME].value=_table;
    if (_selkey=='')
    {
      document.forms[FORM_NAME].elements[TA_OP].value=TA_OP_ROWMENUCALL;
    }
    else
    {
      document.forms[FORM_NAME].elements[TA_OP].value=TA_OP_SELMENUKEY;
      document.forms[FORM_NAME].elements[TA_SELKEY].value=_selkey;
    }
    document.forms[FORM_NAME].elements[TA_ACTION].value=_action;
    doMainSubmit();
}
function doTableEditMode(_table){
    doTableEdit(_table, TA_OP_EDITMODE);
}
function doTableRollback(_table){
    doTableEdit(_table, TA_OP_ROLLBACK);
}
function doTableEdit(_table, _op){
    document.forms[FORM_NAME].elements[TA_TABLENAME].value=_table;
    document.forms[FORM_NAME].elements[TA_OP].value=_op;
    doMainSubmit();
}
function doHrefNewWin(_method, _selkey, _winName, _winProp){
    var url = document.forms[FORM_NAME].action+'?method='+_method+'&newWin=y&'+TA_SELKEY+'='+_selkey;
    if (typeof _winProp=='undefined')
      window.open(url, _winName, defaultWinProp);
    else
      window.open(url, _winName, _winProp);
}
function doRowMenuNewWin(_table, _action, _selkey, _winName){
    var url = document.forms[FORM_NAME].action+'?'+TA_TABLENAME+'='+_table+'&'+TA_COLID+'='+document.forms[FORM_NAME].elements[TA_COLID].value+'&'+TA_ACTION+'='+_action+'&'+TA_ROWKEY+'='+document.forms[FORM_NAME].elements[TA_ROWKEY].value+'&method='+document.forms[FORM_NAME].method.value+'&newWin=y';
    if (_selkey=='')
      url= url+'&'+TA_OP+'='+TA_OP_ROWMENUCALL;
    else
      url= url+'&'+TA_OP+'='+TA_OP_SELMENUKEY+'&'+TA_SELKEY+'='+_selkey;

    if (typeof _winProp=='undefined')
      window.open(url, _winName, defaultWinProp);
    else
      window.open(url, _winName, _winProp);
    if (_selkey!='') cClick();
}
function filterShow(_name, _parent_name){
    var elem = document.getElementById(_name);
    var parent_elem = document.getElementById('rolluppanel'+_parent_name);
    elem.style.top=parent_elem.offsetTop+50;
    elem.style.left=parent_elem.offsetLeft+200;
    if (elem.style.display!='none'){
      elem.style.display='none';
      elem.style.zIndex=document.getElementById('rolluppanelbody'+_parent_name).style.zIndex-1;
    } 
    else{
      elem.style.display='';
      elem.style.zIndex=document.getElementById('rolluppanelbody'+_parent_name).style.zIndex+3;
    } 
}
function showncolsShow(_name, _parent_name){
    var elem = document.getElementById(_name);
    var parent_elem = document.getElementById('rolluppanel'+_parent_name);
    elem.style.top=parent_elem.offsetTop+80;
    elem.style.left=parent_elem.offsetLeft+250;
    if (elem.style.display!='none'){
      elem.style.display='none';
      elem.style.zIndex=document.getElementById('rolluppanelbody'+_parent_name).style.zIndex-1;
    } 
    else{
      elem.style.display='';
      elem.style.zIndex=document.getElementById('rolluppanelbody'+_parent_name).style.zIndex+3;
    } 
}
function showMenu(_items_arr, _menu_title, _close_btn_url, _css_fg, _css_bg, _css_caption, _width, _css_item, _css_selected)
{
    var body="";
    var i=0;
    for (i=0; i<_items_arr.length; i++)
    {
       var row=_items_arr[i];
       var is_new_win=row[0];
       body+="<tr><td class=\'"+_css_item+"\' onmouseover=this.className=\'"+_css_selected+"\'; onmouseout=this.className=\'"+_css_item+"\'; onclick="+(is_new_win?"doRowMenuNewWin":"doTableMenuSubmit")+"(\'"+row[1]+"\',\'"+row[2]+"\',\'"+row[3]+"\',\'"+row[5]+"\')><span>"+row[4]+"</span></td></tr>";
    }
    body="<table width=100% cellspacing=0>"+body+"</table>";
	return overlib(body, STICKY, CENTER, CLOSECLICK, CAPTION, _menu_title, CLOSETEXT, ('<img src='+_close_btn_url+' border=0>'), CSSCLASS, FGCLASS, _css_fg, BGCLASS, _css_bg, CAPTIONFONTCLASS, _css_caption, WIDTH, _width);
}