// BEGIN: FUNCTION RESIZE WINDOW
if (!expresso_offline) {
var _showBar = showBar;
var _hideBar = hideBar;
}
function __showBar(){
_showBar();
resizeWindow();
}
function __hideBar(){
_hideBar();
resizeWindow();
}
showBar = __showBar;
hideBar = __hideBar;
window.onresize = resizeWindow;
function config_events(pObj, pEvent, pHandler)
{
if( typeof pObj == 'object')
{
if( pEvent.substring(0, 2) == 'on')
pEvent = pEvent.substring(2, pEvent.length);
if ( pObj.addEventListener )
pObj.addEventListener(pEvent, pHandler, false);
else if( pObj.attachEvent )
pObj.attachEvent('on' + pEvent, pHandler );
}
}
function resizeWindow(){
var divScrollMain = Element("divScrollMain_"+numBox);
var table_message = Element("table_message");
var content_folders = Element("content_folders");
var clientHeight = ((window.innerHeight ? window.innerHeight : document.body.offsetHeight) - 8);
var clientWidth = window.innerWidth ? window.innerWidth : document.body.offsetWidth;
if(divScrollMain){
divScrollMain.style.height = (clientHeight - (findPosY(divScrollMain) + (table_message.clientHeight ? table_message.clientHeight : table_message.offsetHeight))) + "px";
}
if(typeof(BordersArray) != 'undefined') {
for(var i = 1; BordersArray.length > 1 && i < BordersArray.length;i++) {
var div_scroll = Element("div_message_scroll_"+BordersArray[i].sequence);
var div = Element("content_id_"+BordersArray[i].sequence);
if(div){
div.style.height = (clientHeight - (findPosY(div) + (table_message.clientHeight ? table_message.clientHeight : table_message.offsetHeight)+2)) + "px";
div.style.width = (clientWidth - (findPosX(div)+10)) + "px";
}
if(div_scroll){
div_scroll.style.height = (clientHeight - (findPosY(div_scroll) + (table_message.clientHeight ? table_message.clientHeight : table_message.offsetHeight)+5)) + "px";
div_scroll.style.width = (clientWidth - (findPosX(div_scroll)+15)) + "px";
}
}
}
if(content_folders){
var search_div = Element("search_div");
var contentFoldersY = findPosY(content_folders);
content_folders.style.height = (clientHeight - (contentFoldersY + (contentFoldersY > findPosY(search_div) ? 0 : (search_div.clientHeight ? search_div.clientHeight : search_div.offsetHeight) + 5))) + "px";
}
redim_borders(count_borders());
}
// END: FUNCTION RESIZE WINDOW
var _beforeunload_ = window.onbeforeunload;
window.onbeforeunload = function()
{
return unloadMess();
}
function unloadMess(){
if (typeof BordersArray == 'undefined') return; // We're not on expressoMail
if (typeof(expresso_mail_sync) != "undefined" && expresso_mail_sync.working) {
var mess = get_lang("You're about archiving your e-mails from server. Do you really want to stop this action?");
return mess;
}
else {
var mess = get_lang("Your message has not been sent and will be discarted.");
for (var i = 0; i < BordersArray.length; i++) {
var body = Element('body_' + BordersArray[i].sequence);
if (body && body.contentWindow && body.contentWindow.document.designMode.toLowerCase() == 'on') {
return mess;
}
}
}
}
// Translate words and phrases using user language from eGroupware.
function get_lang(_key) {
if (typeof(_key) == 'undefined')
return false;
var key = _key.toLowerCase();
if(array_lang[key])
var _value = array_lang[key];
else
var _value = _key+"*";
if(arguments.length > 1)
for(j = 1; typeof(arguments[j]) != 'undefined'; j++)
_value = _value.replace("%"+j,arguments[j]);
return _value;
}
// Make decimal round, using in size message
function round(value, decimal){
var return_value = Math.round( value * Math.pow( 10 , decimal ) ) / Math.pow( 10 , decimal );
return( return_value );
}
// Change the class of message.
// In refresh, the flags UnRead and UnSeen don't exist anymore.
function set_msg_as_read(msg_number, selected){
tr_message = Element(msg_number);
if (exist_className(tr_message, 'tr_msg_unread'))
decrement_folder_unseen();
remove_className(tr_message, 'tr_msg_unread');
remove_className(tr_message, 'selected_msg');
if( document.getElementById("td_message_unseen_"+msg_number) != null )
Element("td_message_unseen_"+msg_number).innerHTML = " ";
connector.purgeCache();
return true;
}
function msg_is_read(msg_number, selected){
tr_message = Element(msg_number);
return !(tr_message && LTrim(tr_message.className).match('tr_msg_unread'))
}
function set_msg_as_unread(msg_number){
tr_message = Element(msg_number);
if ((exist_className(tr_message, 'tr_msg_read') || exist_className(tr_message, 'tr_msg_read2')) && (!exist_className(tr_message, 'tr_msg_unread')))
increment_folder_unseen();
remove_className(tr_message, 'selected_msg');
add_className(tr_message, 'tr_msg_unread');
Element("td_message_unseen_"+msg_number).innerHTML = " ";
}
function set_msg_as_flagged(msg_number){
var msg = Element(msg_number);
remove_className(msg, 'selected_msg');
add_className(msg, 'flagged_msg');
Element("td_message_important_"+msg_number).innerHTML = " ";
}
function set_msg_as_unflagged(msg_number){
var msg = Element(msg_number);
remove_className(msg, 'selected_msg');
remove_className(msg, 'flagged_msg');
Element("td_message_important_"+msg_number).innerHTML = " ";
}
function removeAll(id){
do
{
if (typeof(Element(id)) == 'undefined')
break;
Element(id).parentNode.removeChild(Element(id));
}
while(Element(id));
}
function get_current_folder(){
return current_folder;
}
// Kill current box (folder or page).
function kill_current_box(){
var box = document.getElementById("table_box");
if (box != null)
box.parentNode.removeChild(box);
else
return false;
}
// Kill current paging.
function kill_current_paging(){
var paging = Element("span_paging");
if (paging != null)
paging.parentNode.removeChild(paging);
}
function show_hide_span_paging(ID){
if ((ID != "0") && Element("span_paging"))
Element("span_paging").style.display = 'none';
else
if (Element("span_paging"))
Element("span_paging").style.display = '';
}
//Get the current number of messages in a page.
function get_messages_number_in_page(){
//Get element tBody.
main = document.getElementById("tbody_box");
// Get all TR (messages) in tBody.
main_list = main.childNodes;
return main_list.length;
}
function download_local_attachment(url) {
url=encodeURI(url);
url=url.replace("%25","%");
if (div_attachment == null){
var div_attachment = document.createElement("DIV");
div_attachment.id="id_div_attachment";
document.body.appendChild(div_attachment);
}
div_attachment.innerHTML="";
}
function download_attachments(msg_folder, msg_number, idx_file, msg_part, encoding, new_file_name, show_iframe){
div_attachment = document.getElementById("id_div_attachment");
var params = '';
if (div_attachment == null){
var div_attachment = document.createElement("DIV");
div_attachment.id="id_div_attachment";
document.body.appendChild(div_attachment);
}
if(new_file_name)
params = "&newfilename="+escape(new_file_name);
if(encoding)
params += "&encoding="+encoding;
div_attachment.innerHTML="";
}
function download_all_attachments(msg_folder, msg_number){
var handler_source = function(data){
download_attachments(null, null, data, null,null,'anexos.zip');
}
cExecute("$this.exporteml.download_all_attachments",handler_source,"folder="+msg_folder+"&num_msg="+msg_number);
}
//ADD forwarded files
function addForwardedFile(id_border,file_name,link,divFiles){
if(!divFiles)
divFiles = document.getElementById("divFiles_"+id_border);
if (! divFiles)
return false;
if (divFiles.lastChild)
var countDivFiles = parseInt(divFiles.lastChild.id.split('_')[2]) + 1;
if (! countDivFiles)
var countDivFiles = 1;
divFile = document.createElement('DIV');
if (!expresso_offline) {
if (!is_ie) {
var inputFile = document.createElement("INPUT");
var tmp_id_border = document.createAttribute('id_border');
tmp_id_border.value = id_border;
inputFile.setAttributeNode(tmp_id_border);
inputFile.id = "inputFile_" + id_border + "_" + countDivFiles;
inputFile.type = 'file';
inputFile.size = 50;
inputFile.maxLength = 255;
inputFile.name = 'file_' + countDivFiles;
inputFile.style.display = "none";
}
else {
var inputFile = document.createElement("link");
var tmp_id_border = document.createAttribute('id_border');
tmp_id_border.value = id_border;
inputFile.setAttributeNode(tmp_id_border);
inputFile.id = "inputFile_" + id_border + "_" + countDivFiles;
inputFile.name = 'file_' + countDivFiles;
}
}
else {
var inputFile = document.createElement("input");
inputFile.type = 'hidden';
inputFile.name = 'offline_forward_' + countDivFiles;
}
divFile.appendChild(inputFile);
var a_tmp = new Array();
a_tmp[0] = "local_";
a_tmp[1] = 'file_' + countDivFiles;
a_tmp[2] = file_name;
s_tmp = escape(connector.serialize(a_tmp));
var checkbox = document.createElement("INPUT");
checkbox.type = "checkbox";
checkbox.id = "checkbox_"+id_border+"_"+countDivFiles;
checkbox.name = "local_attachments[]";
checkbox.value = s_tmp;
divFile.appendChild(checkbox);
var link_attachment = document.createElement("A");
link_attachment.setAttribute("href", link);
link_attachment.innerHTML = file_name;
divFile.appendChild(link_attachment);
countDivFiles++;
divFile.id = "divFile_"+id_border+"_"+countDivFiles;
divFiles.appendChild(divFile);
checkbox.checked = true; //Incrível, mas no Internet Explorer o checked só funciona efetivamente se o elemente já estiver renderizado... por isso só aqui eu seleciono ele...
return inputFile;
}
// Add Input File Dynamically.
function addFile(id_border){
divFiles = document.getElementById("divFiles_"+id_border);
if (! divFiles)
return false;
if (divFiles.lastChild)
var countDivFiles = parseInt(divFiles.lastChild.id.split('_')[2]) + 1;
if (! countDivFiles)
var countDivFiles = 1;
divFile = document.createElement('DIV');
divFile.innerHTML = " ";
var linkFile = document.createElement("A");
linkFile.id = "linkFile_"+id_border+"_"+countDivFiles;
linkFile.href='javascript:void(0)';
linkFile.onclick=function () {removeFile(this.id.replace("link","div")); return false;};
linkFile.innerHTML=get_lang("Remove");
//divFile.innerHTML += " ";
divFile.appendChild(linkFile);
divFile.id = "divFile_"+id_border+"_"+countDivFiles;
divFiles.appendChild(divFile);
return document.getElementById("inputFile_"+id_border+"_"+countDivFiles);
}
// Remove Input File Dynamically.
function removeFile(id){
var border_id = id.substr(8,1);
var el = Element(id);
el.parentNode.removeChild(el);
}
function validateFileExtension(fileName, id, id_border){
var error_flag = false;
if ( fileName.indexOf('/') != -1 )
{
if (fileName[0] != '/'){ // file name is windows format?
var file = fileName.substr(fileName.lastIndexOf('\\') + 1, fileName.length);
if ((fileName.indexOf(':\\') != 1) && (fileName.indexOf('\\\\') != 0)) // Is stored in partition or a network file?
error_flag = true;
}
else // is Unix
var file = fileName.substr(fileName.lastIndexOf('/') + 1, fileName.length);
}
else // is Firefox 3
var file = fileName;
var fileExtension = file.split(".");
fileExtension = fileExtension[(fileExtension.length-1)];
for(var i=0; i ';
old_divStatusBar.style.display = 'none';
msg_div.style.display = '';
// Nao ponha var na frente!! jakjr
handle_write_msg = function(){
try{
if(!old_msg)
clean_msg();
else
write_msg(old_msg, true);
}
catch(e){}
}
if(notimeout)
old_msg = msg;
else
setTimeout_write_msg = setTimeout("handle_write_msg();", 5000);
}
// Funcao usada para apagar mensagem sem timeout
function clean_msg(){
old_msg = false;
var msg_div = Element('em_div_write_msg');
var old_divStatusBar = Element("divStatusBar");
if(msg_div)
msg_div.style.display = 'none';
old_divStatusBar.style.display = '';
}
function make_body_reply(body, to, date_day, date_hour){
to = to.replace("<","<");
to = to.replace(">",">");
block_quoted_body =" ";
block_quoted_body += get_lang('At %1, %2 hours, %3 wrote:', date_day, date_hour, to);
block_quoted_body += "";
block_quoted_body += body;
block_quoted_body += " ";
return block_quoted_body;
}
function make_forward_body(body, from, date, subject, to, cc){
from = from.replace(//g,">");
to = to.replace(//g,">");
var forward_body = ' ---------- ' + get_lang('Forwarded message') + ' ---------- ';
forward_body += get_lang('From') + ': ' + from + ' ';
forward_body += get_lang('Date') + ': ' + date + ' ';
forward_body += get_lang('Subject') + ': ' + subject + ' ';
forward_body += get_lang('To') + ': ' + to+ ' ';
if(cc != undefined){
cc = cc.replace(//g,">");
forward_body += get_lang('CC') + ': ' + cc+ ' ';
}
forward_body += body;
return forward_body;
}
function emMessageSearch(e,value){
var e = is_ie ? window.event : e;
if(e.keyCode == 13) {
search_emails(value);
}
}
function validateEmail(email){
if (typeof(email) != 'string')
return false;
var validName = /^[a-z0-9][a-z-_0-9\.]*/i;
emailParts = email.split('@');
return (validName.test(emailParts[0]) && validateDomain(emailParts[1]));
}
function validateDomain(domain){
var domainReg = /^(([A-Za-z\d][A-Za-z\d-]{0,61}[A-Za-z\d]\.)+[A-Za-z]{2,6}|\[\d{1,3}(\.\d{1,3}){3}\])$/i;
return (domainReg.test(domain));
}
function validateUrl(url){
var urlReg = /([A-Za-z]{2,7}:\/\/)(.*)/i;
urlParts = url.split(urlReg);
return (urlParts[1].length > 4 && validateDomain(urlParts[2]));
}
function performQuickSearch(keyword){
if (preferences.quick_search_default=='1')
emQuickSearch(keyword, 'null', 'null');
else
search_emails(keyword);
}
function emQuickSearch(emailList, field, ID){
var quickSearchKeyBegin;
var quickSearchKeyEnd;
if(expresso_offline) {
alert(get_lang('Not allowed in offline mode'));
return;
}
if ((field != 'null') && (ID != 'null'))
{
connector.loadScript("QuickCatalogSearch");
if (typeof(QuickCatalogSearch) == 'undefined'){
setTimeout('emQuickSearch("'+emailList+'", "'+field+'", "'+ID+'")',500);
return false;
}
}
else
{
connector.loadScript("QuickSearchUser");
if (typeof(QuickSearchUser) == 'undefined'){
setTimeout('emQuickSearch("'+emailList+'", "'+field+'", "'+ID+'")',500);
return false;
}
}
var handler_emQuickSearch = function(data)
{
window_DropDownContacts = Element('tipDiv');
if (window_DropDownContacts.style.visibility != 'hidden'){
window_DropDownContacts.style.visibility = 'hidden';
}
if ((!data.status) && (data.error == "many results")){
alert(get_lang('More than %1 results. Please, try to refine your search.',200));
return false;
}
if (data.length > 0){
if ((field != 'null') && (ID != 'null'))
{
QuickCatalogSearch.showList(data, quickSearchKeyBegin, quickSearchKeyEnd);
}
else
{
QuickSearchUser.showList(data);
}
}
else
alert(get_lang('None result was found.'));
return true;
}
if ((field != 'null') && (ID != 'null'))
{
Element(field +'_'+ ID).focus(); //It requires for IE.
var i = getPosition(Element(field +'_'+ ID)); //inputBox.selectionStart;
var j = --i;
// Acha o inicio
while ((j >= 0) && (emailList.charAt(j) != ',')){j--};
quickSearchKeyBegin = ++j;
// Acha o final
while ((i <= emailList.length) && (emailList.charAt(i) != ',')){i++};
quickSearchKeyEnd = i;
// A Chave da Pesquisa
var search_for = trim(emailList.substring(quickSearchKeyBegin, quickSearchKeyEnd));
}
else
var search_for = emailList;
if (search_for.length < preferences.search_characters_number){
alert(get_lang('Your search argument must be longer than %1 characters.', preferences.search_characters_number));
return false;
}
cExecute ("$this.ldap_functions.quicksearch&search_for="+search_for+"&field="+field+"&ID="+ID, handler_emQuickSearch);
}
function folderbox(){
connector.loadScript("TreeS");
if (typeof(ttree) == 'undefined'){
setTimeout('folderbox()',500);
return false;
}
ttree.make_Window();
}
function filterbox(){
connector.loadScript("filter");
connector.loadScript("filters");
if (typeof(filters) == 'undefined')
{
setTimeout('filterbox()',500);
return false;
}
filters.Forms();
}
function sharebox(){
var handler_imap_getacl = function(data)
{
var options = '';
for (var x in data)
{
options += ""+data[x].cn+" ";
}
connector.loadScript("sharemailbox");
if (typeof(sharemailbox) == 'undefined')
{
setTimeout('sharebox()',500);
return false;
}
sharemailbox.makeWindow(options);
}
cExecute ("$this.imap_functions.getacl", handler_imap_getacl);
}
function open_rss(param){
connector.loadScript("news_edit");
if (typeof(news_edit) == 'undefined')
{
setTimeout('open_rss(\''+param+'\')',500);
return false;
}
news_edit.read_rss(param);
return true;
}
function editrss(){
connector.loadScript("news_edit");
if (typeof(news_edit) == 'undefined')
{
setTimeout('editrss()',500);
return false;
}
news_edit.makeWindow();
}
function preferences_mail(){
location.href="../preferences/preferences.php?appname=expressoMail1_2";
}
function search_emails(value){
connector.loadScript("TreeS");
connector.loadScript("search");
if (typeof(EsearchE) == 'undefined' || typeof(ttree) == 'undefined'){
setTimeout('search_emails("'+value+'")',500);
return false;
}
EsearchE.showForms(value);
}
function source_msg(id_msg,folder){
var num_msg = id_msg.substr(0,(id_msg.length - 2));
var handler_source = function(data){
download_attachments(null, null, data, null,null,'fonte_da_mensagem.eml');
}
cExecute("$this.exporteml.export_msg",handler_source,"folder="+url_decode(folder)+"&msgs_to_export="+num_msg);
}
function url_encode(str){
var hex_chars = "0123456789ABCDEF";
var noEncode = /^([a-zA-Z0-9\_\-\.])$/;
var n, strCode, hex1, hex2, strEncode = "";
for(n = 0; n < str.length; n++) {
if (noEncode.test(str.charAt(n))) {
strEncode += str.charAt(n);
} else {
strCode = str.charCodeAt(n);
hex1 = hex_chars.charAt(Math.floor(strCode / 16));
hex2 = hex_chars.charAt(strCode % 16);
strEncode += "%" + (hex1 + hex2);
}
}
return strEncode;
}
function url_decode(str) {
var n, strCode, strDecode = "";
for (n = 0; n < str.length; n++) {
strDecode += str.charAt(n);
//if (str.charAt(n) == "%") {
// strCode = str.charAt(n + 1) + str.charAt(n + 2);
// strDecode += String.fromCharCode(parseInt(strCode, 16));
// n += 2;
//} else {
// strDecode += str.charAt(n);
//}
}
return strDecode;
}
function Element (el) {
return document.getElementById(el);
}
function getPosition(obj)
{
if(typeof obj.selectionStart != "undefined")
{
return obj.selectionStart;
}
else if(document.selection && document.selection.createRange)
{
var M = document.selection.createRange();
try
{
var Lp = M.duplicate();
Lp.moveToElementText(obj);
}
catch(e)
{
var Lp=obj.createTextRange();
}
Lp.setEndPoint("EndToStart",M);
var rb=Lp.text.length;
if(rb > obj.value.length)
{
return -1;
}
return rb;
}
}
function trim(inputString) {
if (typeof inputString != "string")
return inputString;
var retValue = inputString;
var ch = retValue.substring(0, 1);
while (ch == " ") {
retValue = retValue.substring(1, retValue.length);
ch = retValue.substring(0, 1);
}
ch = retValue.substring(retValue.length-1, retValue.length);
while (ch == " ") {
retValue = retValue.substring(0, retValue.length-1);
ch = retValue.substring(retValue.length-1, retValue.length);
}
while (retValue.indexOf(" ") != -1) {
retValue = retValue.substring(0, retValue.indexOf(" ")) + retValue.substring(retValue.indexOf(" ")+1, retValue.length);
}
return retValue;
}
function increment_folder_unseen(){
var folder_id = get_current_folder();
var folder_unseen = Element('dftree_'+folder_id+'_unseen');
var abas_unseen = Element('new_m').innerHTML;
abas_unseen = abas_unseen.match(/(){0,1} *([0-9]+) *(<\/font>){0,1}/)[2];
if (folder_unseen)
folder_unseen.innerHTML = (parseInt(folder_unseen.innerHTML) + 1);
else
{
tree_folders.getNodeById(folder_id).alter({caption: tree_folders.getNodeById(current_folder).caption + ' ( 1 ) '});
tree_folders.getNodeById(folder_id)._refresh();
}
if( abas_unseen == NaN || abas_unseen == undefined )
abas_unseen = 1;
else
abas_unseen = parseInt(abas_unseen) + 1;
Element('new_m').innerHTML = '' + abas_unseen + ' ';
if ( current_folder.indexOf( 'INBOX' ) !== 0 && current_folder.indexOf( 'local_' ) !== 0 )
{
var display_unseen_in_shared_folders = Element('dftree_user_unseen');
if ( display_unseen_in_shared_folders )
tree_folders.getNodeById( 'user' ).alter({caption:'[ ' + ( parseInt( display_unseen_in_shared_folders.innerHTML) + 1 ) + ' ] ' + get_lang("Shared folders")});
else
tree_folders.getNodeById( 'user' ).alter({caption:'[ 1 ] ' + get_lang("Shared folders")});
tree_folders.getNodeById( 'user' )._refresh();
}
var display_unseen_in_mailbox = Element('dftree_root_unseen');
if(!expresso_offline)
var node_to_refresh = 'root';
else
var node_to_refresh = 'local_root';
tree_folders.getNodeById( node_to_refresh )._refresh();
}
function decrement_folder_unseen(){
var folder_id = get_current_folder();
var folder_unseen = Element('dftree_'+folder_id+'_unseen');
var abas_unseen = Element('new_m').innerHTML;
abas_unseen = abas_unseen.match( /(){0,1} *([0-9]+) *(<\/font>){0,1}/)[2];
if(!folder_unseen || !abas_unseen)
return;
if ((folder_unseen) && (parseInt(folder_unseen.innerHTML) > 1))
{
folder_unseen.innerHTML = (parseInt(folder_unseen.innerHTML) - 1);
}
else if (parseInt(folder_unseen.innerHTML) <= 1)
{
var tmp_folder_name = tree_folders.getNodeById(folder_id).caption.split('<');
var folder_name = tmp_folder_name[0];
tree_folders.getNodeById(folder_id).alter({caption: folder_name});
tree_folders.getNodeById(folder_id)._refresh();
}
if (parseInt(abas_unseen) > 1) {
Element('new_m').innerHTML = '' + (parseInt(abas_unseen) - 1) + ' ';
} else {
Element('new_m').innerHTML = '0';
}
if ( current_folder.indexOf( 'INBOX' ) !== 0 )
{
var display_unseen_in_shared_folders = Element('dftree_user_unseen');
if ( display_unseen_in_shared_folders )
{
var unseen_in_shared_folders = parseInt( display_unseen_in_shared_folders.innerHTML );
unseen_in_shared_folders--;
if ( unseen_in_shared_folders > 0 )
tree_folders.getNodeById( 'user' ).alter({caption:'[ ' + unseen_in_shared_folders + ' ] ' + get_lang("My Folders")});
else
tree_folders.getNodeById( 'user' ).alter({caption:get_lang("Shared folders")});
tree_folders.getNodeById( 'user' )._refresh();
}
}
var display_unseen_in_mailbox = Element('dftree_root_unseen');
if ( display_unseen_in_mailbox )
{
var unseen_in_mailbox = parseInt( display_unseen_in_mailbox.innerHTML );
unseen_in_mailbox--;
//if ( unseen_in_mailbox > 0 )
// tree_folders.getNodeById( 'root' ).alter({caption:'[ ' + unseen_in_mailbox + ' ] ' + get_lang("My Folders")});
//else
if(!expresso_offline)
var node_to_refresh = 'root';
else
var node_to_refresh = 'local_root';
tree_folders.getNodeById( node_to_refresh ).alter({caption:get_lang("My Folders")});
tree_folders.getNodeById( node_to_refresh )._refresh();
}
}
function LTrim(value){
var w_space = String.fromCharCode(32);
var strTemp = "";
var iTemp = 0;
var v_length = value ? value.length : 0;
if(v_length < 1)
return "";
while(iTemp < v_length){
if(value && value.charAt(iTemp) != w_space){
strTemp = value.substring(iTemp,v_length);
break;
}
iTemp++;
}
return strTemp;
}
//changes MENU background color.
function set_menu_bg(menu)
{
menu.style.backgroundColor = 'white';
menu.style.border = '1px solid black';
menu.style.padding = '0px 0px';
}
//changes MENU background color.
function unset_menu_bg(menu)
{
menu.style.backgroundColor = '';
menu.style.border = '0px';
menu.style.padding = '1px 0px';
}
function array_search(needle, haystack) {
var n = haystack.length;
for (var i=0; i 100)
return (size/mbyte).toFixed(0) + ' MB';
else
return (size/mbyte).toFixed(1) + ' MB';
else
return (size/gbyte).toFixed(1) + ' GB';
}
function validate_date(date){
if (date.match(/^[0-3][0-9]\/[0-1][0-9]\/\d{4,4}$/))
{
tmp = date.split('/');
day = new Number(tmp[0]);
month = new Number(tmp[1]);
year = new Number(tmp[2]);
if (month >= 1 && month <= 12 && day >= 1 && day <= 31)
{
if (month == 02 && day <= 29)
{
return true;
}
return true;
}
else
{
return false;
}
}
else
{
return false;
}
}
function dateMask(inputData, e){
if(document.all) // Internet Explorer
var tecla = event.keyCode;
else //Outros Browsers
var tecla = e.which;
if(tecla >= 47 && tecla < 58){ // numeros de 0 a 9 e "/"
var data = inputData.value;
if (data.length == 2 || data.length == 5){
data += '/';
inputData.value = data;
}
} else {
if(tecla == 8 || tecla == 0) // Backspace, Delete e setas direcionais(para mover o cursor, apenas para FF)
return true;
else
return false;
}
}