DIALOG_DIR='/lib/dialogs/';

function confirmLink(theQuery)
{
	  var is_confirmed = confirm(theQuery);
	    return is_confirmed;
}

function new_win(urel,w,h)
{
 w1=window.open(urel+'&'+_sname+'='+_sid,'_blank','resizable=yes,menubar=no,status=no,scrollbars=no,width='+w+',height='+h);
 
}
function new_win_scr(urel,w,h)
{
 w1=window.open(urel+'&'+_sname+'='+_sid,'_blank','resizable=no,menubar=no,status=no,scrollbars=yes,width='+w+',height='+h);
}

function show_image(urel,w,h)
{
	w1=window.open('','_blank','resizable=yes,menubar=no,status=no,scrollbars=no,width='+w+',height='+h);
	w1.document.write('<html><head><title>Full size</title></head><body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">');
	w1.document.write('<img src="' + urel + '">');
	w1.document.write('</body></html>');
}
function new_win_res(urel,w,h)
{
 w1=window.open(urel,'_blank','resizable=yes,menubar=no,status=yes,scrollbars=yes,width='+w+',height='+h);
}
function ParentRedirect(url)
{
         self.opener.location=url;
         return false;
}
function AutoTop()
{
	parent.document.URL='';
}

function detectIE()
{
	var str = navigator.appName;
	if (str.match("Microsoft"))
		return true;
	else
		return false;
}
function resizeWindow(winObject,xOffset,yOffset)
{
	winObject.resizeTo(screen.availWidth - xOffset,screen.availHeight - yOffset);
}
function moveWindow(winObject,xOffset,yOffset)
{
	winObject.moveTo(screen.availWidth - xOffset,screen.availHeight - yOffset);
}
function closeWindow(winObject,restoreSize)
{
	if (restoreSize)
  	{
  		resizeWindow(winObject,0,0);
	}
}
function selectCategory(tblname,catelem)
{
      	w1 = window.open(DIALOG_DIR+'category.php?tbl='+tblname+'&elem='+catelem+'&'+_sname+'='+_sid,'_blank','resizable=no,menubar=no,status=no,scrollbars=yes,width=700,height=450,dialog=1,depended=1,modal=1,z-lock=1');

}
function selectAuthor(tblname,catelem,sid)
{
  	w1 = window.open(DIALOG_DIR+'author.php?tbl='+tblname+'&elem='+catelem+'&sid='+sid+'&'+_sname+'='+_sid,'_blank','resizable=no,menubar=no,status=no,scrollbars=yes,width=700,height=450,dialog=1,depended=1,modal=1,z-lock=1');

}
function selectItemsCat(tblname,catelem,sid)
{
  	w1 = window.open(DIALOG_DIR+'itemcategory.php?tbl='+tblname+'&elem='+catelem+'&sid='+sid+'&'+_sname+'='+_sid,'_blank','resizable=no,menubar=no,status=no,scrollbars=yes,width=700,height=450,dialog=1,depended=1,modal=1,z-lock=1');

}
function selectPagesToPublish(tblname,catelem,sid)
{
  	w1 = window.open(DIALOG_DIR+'pages.php?tbl='+tblname+'&elem='+catelem+'&sid='+sid+'&'+_sname+'='+_sid,'_blank','resizable=no,menubar=no,status=no,scrollbars=yes,width=700,height=450,dialog=1,depended=1,modal=1,z-lock=1');

}
function selectRoles(tblname,catelem,sid,mode)
{
  	w1 = window.open(DIALOG_DIR+'sysroles.php?tbl='+tblname+'&elem='+catelem+'&sid='+sid+'&mode='+mode+'&'+_sname+'='+_sid,'_blank','resizable=no,menubar=no,status=no,scrollbars=yes,width=700,height=450,dialog=1,depended=1,modal=1,z-lock=1');

}
function selectGroups(tblname,catelem,sid,mode)
{
  	w1 = window.open(DIALOG_DIR+'sysgroups.php?tbl='+tblname+'&elem='+catelem+'&sid='+sid+'&mode='+mode+'&'+_sname+'='+_sid,'_blank','resizable=no,menubar=no,status=no,scrollbars=yes,width=700,height=450,dialog=1,depended=1,modal=1,z-lock=1');

}
function selecUsers(tblname,catelem,sid,mode)
{
  	w1 = window.open(DIALOG_DIR+'sysusers.php?tbl='+tblname+'&elem='+catelem+'&sid='+sid+'&mode='+mode+'&'+_sname+'='+_sid,'_blank','resizable=no,menubar=no,status=no,scrollbars=yes,width=700,height=450,dialog=1,depended=1,modal=1,z-lock=1');

}
function selectGrants(tblname,catelem,sid,mode)
{
  	w1 = window.open(DIALOG_DIR+'sysgrants.php?tbl='+tblname+'&elem='+catelem+'&sid='+sid+'&mode='+mode+'&'+_sname+'='+_sid,'_blank','resizable=no,menubar=no,status=no,scrollbars=yes,width=700,height=450,dialog=1,depended=1,modal=1,z-lock=1');

}
function selectSectionToPublish(tblname,catelem,sid)
{
  	w1 = window.open(DIALOG_DIR+'sections.php?tbl='+tblname+'&elem='+catelem+'&sid='+sid+'&'+_sname+'='+_sid,'_blank','resizable=no,menubar=no,status=no,scrollbars=yes,width=700,height=450,dialog=1,depended=1,modal=1,z-lock=1');

}
function selectTypesForItem(tblname,itemtype,sid,nulsid,lang,mode)
{
  	w1 = window.open(DIALOG_DIR+'itemtypes.php?tbl='+tblname+'&itemtype='+itemtype+'&sid='+sid+'&nulsid='+nulsid+'&lang='+lang+'&mode='+mode+'&'+_sname+'='+_sid,'_blank','resizable=no,menubar=no,status=no,scrollbars=yes,width=700,height=450,dialog=1,depended=1,modal=1,z-lock=1');

}
function selectDictToLink(tblname,catelem,sid)
{
  	w1 = window.open(DIALOG_DIR+'sections.php?onlydic=1&tbl='+tblname+'&elem='+catelem+'&sid='+sid+'&'+_sname+'='+_sid,'_blank','resizable=no,menubar=no,status=no,scrollbars=yes,width=700,height=450,dialog=1,depended=1,modal=1,z-lock=1');

}
function selectDictToItems(tblname,catelem,sid)
{
  	w1 = window.open(DIALOG_DIR+'sections.php?shop=1&tbl='+tblname+'&elem='+catelem+'&sid='+sid+'&'+_sname+'='+_sid,'_blank','resizable=no,menubar=no,status=no,scrollbars=yes,width=700,height=450,dialog=1,depended=1,modal=1,z-lock=1');

}
function selectImage(id_name,section_name)
{
      	w1 = window.open(DIALOG_DIR+'imgdlg.php?div='+id_name + '&section='+section_name+'&'+_sname+'='+_sid,'_blank','resizable=no,menubar=no,status=yes,scrollbars=yes,width=710,height=650,dialog=1,depended=1,modal=1,z-lock=1');
      	return w1;

}
function selectImageLink(id_name,section_name)
{
      	w1 = window.open(DIALOG_DIR+'imgdlg_simple.php?div='+id_name + '&section='+section_name+'&'+_sname+'='+_sid,'_blank','resizable=no,menubar=no,status=yes,scrollbars=yes,width=710,height=650,dialog=1,depended=1,modal=1,z-lock=1');
      	return w1;

}
function selectImageForFoto(id_name,section_name)
{
      	w1 = window.open(DIALOG_DIR+'imgdlg_foto.php?div='+id_name + '&section='+section_name+'&'+_sname+'='+_sid,'_blank','resizable=no,menubar=no,status=yes,scrollbars=yes,width=710,height=650,dialog=1,depended=1,modal=1,z-lock=1');
      	return w1;

}
function selectFile(id_name,section_name)
{
      	w1 = window.open(DIALOG_DIR+'filesdlg.php?div='+id_name + '&section='+section_name+'&'+_sname+'='+_sid,'_blank','resizable=no,menubar=no,status=no,scrollbars=yes,width=710,height=650,dialog=1,depended=1,modal=1,z-lock=1');

}
function selectRawFile(id_name,section_name)
{
      	w1 = window.open(DIALOG_DIR+'filesdlg_foto.php?div='+id_name + '&section='+section_name+'&'+_sname+'='+_sid,'_blank','resizable=no,menubar=no,status=no,scrollbars=yes,width=710,height=650,dialog=1,depended=1,modal=1,z-lock=1');

}

function selectLink(id_name,dynamic,lng)
{
      	w1 = window.open(DIALOG_DIR+'linkdlg.php?lang='+lng+'&div='+id_name+'&dynamic='+dynamic+'&'+_sname+'='+_sid,'_blank','resizable=yes,menubar=no,status=yes,scrollbars=yes,width=710,height=650,dialog=1,depended=1,modal=1,z-lock=1');
      	return w1;

}

function selectTable(id_name)
{
      	w1 = window.open(DIALOG_DIR+'tabledlg.php?div='+id_name+'&'+_sname+'='+_sid,'_blank','resizable=no,menubar=no,status=yes,scrollbars=yes,width=710,height=650,dialog=1,depended=1,modal=1,z-lock=1');
      	return w1;

}
function selectWebForm(id_name,section_name)
{
      	w1 = window.open(DIALOG_DIR+'webformdlg.php?div='+id_name+'&section='+section_name+'&'+_sname+'='+_sid,'_blank','resizable=no,menubar=no,status=yes,scrollbars=yes,width=620,height=500,dialog=1,depended=1,modal=1,z-lock=1');
      	return w1;

}
function selectHiddenFormElementDict(id)
{
	w1 = window.open(DIALOG_DIR+'dictdlg.php?hidden=1&row='+id+'&'+_sname+'='+_sid,'_blank','resizable=no,menubar=no,status=yes,scrollbars=yes,width=560,height=610,dialog=1,depended=1,modal=1,z-lock=1');
      	return w1;
}
function selectMultiFormElementDict(id,ex)
{
	w1 = window.open(DIALOG_DIR+'sections.php?onlydic=1&forform=1&exists='+ex+'&row='+id+'&'+_sname+'='+_sid,'_blank','resizable=no,menubar=no,status=yes,scrollbars=yes,width=560,height=610,dialog=1,depended=1,modal=1,z-lock=1');
      	return w1;
}
function selectFormElementDict(id)
{
	w1 = window.open(DIALOG_DIR+'dictdlg.php?row='+id+'&'+_sname+'='+_sid,'_blank','resizable=no,menubar=no,status=yes,scrollbars=yes,width=560,height=610,dialog=1,depended=1,modal=1,z-lock=1');
      	return w1;
}
function showText(table,field,id)
{
	w1 = window.open(DIALOG_DIR+'textview.php?tbl='+table+'&field='+field+'&id='+id+'&'+_sname+'='+_sid,'_blank','resizable=yes,menubar=no,status=no,scrollbars=yes,width=610,height=610,dialog=1,depended=1,modal=1,z-lock=1');
      	return w1;
}
function showPicture(code)
{
	w1 = window.open(DIALOG_DIR+'pictureview.php?code='+code+'&'+_sname+'='+_sid,'_blank','resizable=yes,menubar=no,status=no,scrollbars=yes,width=610,height=610,dialog=1,depended=1,modal=1,z-lock=1');
      	return w1;
}
function ChangePwdDlg()
{
	w1 = window.open(DIALOG_DIR+'chpassdlg.php'+'?'+_sname+'='+_sid,'_blank','resizable=no,menubar=no,status=no,scrollbars=no,width=340,height=230,dialog=1,depended=0,modal=1,z-lock=1');
      	return w1;
}

