| Server IP : 172.67.201.108 / Your IP : 216.73.217.123 Web Server : Apache/2.4.68 (Amazon Linux) OpenSSL/3.5.5 System : Linux ip-172-31-69-123.ec2.internal 6.1.176-223.369.amzn2023.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Jul 24 13:34:27 UTC 2026 x86_64 User : ec2-user ( 1000) PHP Version : 8.4.23 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/nymp/wwwdev/js/ |
Upload File : |
var jsddm_timeout = 500;
var jsddm_closetimer = 0;
var ddmenuitem = 0;
var jsddm_click = 0;
var sheet_dirty = false;
var window_terms_orig_html;
function jsddm_open()
{
jsddm_canceltimer();
jsddm_close();
ddmenuitem = $(this).find('ul').css('visibility', 'visible');
}
function jsddm_close()
{
if (jsddm_click == 0)
{
if(ddmenuitem)
{
ddmenuitem.css('visibility', 'hidden');
jsddm_click = 0;
}
}
}
function jsddm_timer()
{ jsddm_closetimer = window.setTimeout(jsddm_close, jsddm_timeout);}
function jsddm_canceltimer()
{ if(jsddm_closetimer)
{ window.clearTimeout(jsddm_closetimer);
jsddm_closetimer = null;}}
function jsddm_toggle()
{
jsddm_click = 1;
var o_ul = $(this).find('ul');
if (o_ul.css('visibility') == 'hidden')
{
o_ul.css('visibility', 'visible');
ddmenuitem = o_ul;
}
else
{
o_ul.css('visibility', 'hidden');
}
window.setTimeout( function() {jsddm_click = 0;}, 100);
}
$(document).ready(function()
{
$('#jsddm > li').bind('click', jsddm_toggle);
$('#jsddm > li').bind('mouseover', jsddm_open);
$('#jsddm > li').bind('mouseout', jsddm_timer);
// If the browser is IE, apply Z-Order bug fix
if($.browser.msie)
{
/*
** For each div with class menu (i.e.,
** the thing we want to be on top),
*/
$("#jsddm > li > ul").parents().each(function() {
var p = $(this);
var pos = p.css("position");
// If it's positioned,
if(pos == "relative" ||
pos == "absolute" ||
pos == "fixed")
{
/*
** Add the "on-top" class name when the
** mouse is hovering over it, and remove
** it when the mouse leaves.
*/
p.hover(function() {
$(this).addClass("on-top");
},
function() {
$(this).removeClass("on-top");
});
}
});
}
$('#jsddm').slicknav({
label: '',
duration: 200
});
Date.format = 'mm/dd/yyyy';
$('.date-pick').datePicker({
createButton: false,
clickInput: true,
startDate: '01/01/1996',
verticalOffset: 18
});
$('.mail_field').blur(function(){
//alert($('#linkout_' + $(this).attr('id')).attr('href'));
$('#linkout_' + $(this).attr('id')).attr('href','mailto:' + $(this).val());
//alert($('#linkout_' + $(this).attr('id')).attr('href'));
})
$('.link_field').blur(function(){
//alert($('#linkout_' + $(this).attr('id')).attr('href'));
link = $(this).val();
if (typeof link === 'undefined' || !link)
{
}
else
{
if (link.substr(0, 7).toLowerCase() != 'http://' && link.substr(0, 8).toLowerCase != 'https://')
{
link = 'http://' + link;
}
$('#linkout_' + $(this).attr('id')).attr('href','' + link);
}
//alert($('#linkout_' + $(this).attr('id')).attr('href'));
})
window_terms_orig_html = $('#terms_content').html();
/*
$('form.delay_submit').submit(function (e)
{
var form = this;
e.preventDefault();
setTimeout(function () {
//alert('submitting');
$(form).submit();
}, 1000); // in milliseconds
});
*/
$('#main_footer_spacer').html($('#main_footer').html());
$.wakeUp(function(sleep_time) { logoutRedirect(); } );
});
document.onclick = jsddm_close;
setCookie = function(c_name,value,expiredays) {
var exdate=new Date();
exdate.setDate(exdate.getDate()+expiredays);
//document.cookie=c_name+ "=" +escape(value) + ((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
document.cookie=c_name+ "=" +encodeURIComponent(value) + ((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}
getCookie = function(c_name) {
if (document.cookie.length>0)
{
c_start=document.cookie.indexOf(c_name + "=");
if (c_start!=-1)
{
c_start=c_start + c_name.length+1;
c_end=document.cookie.indexOf(";",c_start);
if (c_end==-1) c_end=document.cookie.length;
//return unescape(document.cookie.substring(c_start,c_end));
return decodeURIComponent(document.cookie.substring(c_start,c_end));
}
}
return "";
}
/* ***************** LCS DB GRID FUNCTIONS ******************** */
/*
*/
$.fn.scrollStopped = function(callback) {
var that = this, $this = $(that);
$this.scroll(function(ev) {
clearTimeout($this.data('scrollTimeout'));
$this.data('scrollTimeout', setTimeout(callback.bind(that), 250, ev));
});
};
var ar_lcs_db_load = [];
var ar_lcs_db_loaded = [];
var lcs_db_keep_alive_interval;
lcs_scrolled_into_view = function(elem, parent_elem)
{
var $elem = $(elem);
var $window = $(parent_elem);
var docViewTop = $window.scrollTop();
var docViewBottom = docViewTop + $window.height();
var elemTop = $elem.offset().top;
var elemBottom = elemTop + $elem.height();
return ((elemBottom <= docViewBottom) && (elemTop >= docViewTop));
}
lcs_scrolled_past_view = function(elem, parent_elem)
{
var $elem = $(elem);
var $window = $(parent_elem);
var docViewTop = $window.scrollTop();
var docViewBottom = docViewTop + $window.height();
var elemTop = $elem.offset().top;
var elemBottom = elemTop + $elem.height();
return (elemTop >= docViewTop);
}
lcs_db_scrollbar_width = function()
{
var $outer = $('<div>').css({visibility: 'hidden', width: 100, overflow: 'scroll'}).appendTo('body'),
widthWithScroll = $('<div>').css({width: '100%'}).appendTo($outer).outerWidth();
$outer.remove();
return 100 - widthWithScroll;
}
lcs_db_cell_spacing = function()
{
var $p = $('<div class="lcs_dbg_cell_spacer"></div>').hide().appendTo("body");
var spacer_width = parseInt($p.css("width"));
$p.remove();
return spacer_width;
}
lcs_db_adjust_sapcer_height = function(div)
{
var h = $('#' + div + ' .lcs_dbg_row').first().height();
$('.lcs_dbg_cell_spacer').height(h);
}
lcs_db_toggle_filter = function(div, call, func, ix_form, sort_col, sort_order, search_str, parm1, parm2, parm3, filter_cols, filter_index)
{
//alert('toggle');
var ar_filter_cols = filter_cols.split(',');
if (ar_filter_cols[filter_index - 1] == 1)
{
ar_filter_cols[filter_index - 1] = 0;
}
else
{
ar_filter_cols[filter_index - 1] = 1;
}
filter_cols = ar_filter_cols.join(',');
lcs_db_load(div, call, func, ix_form, sort_col, sort_order, search_str, parm1, parm2, parm3, filter_cols);
}
lcs_db_load = function(div, call, func, ix_form, sort_col, sort_order, search_str, parm1, parm2, parm3, filter_cols)
{
sort_col = sort_col || 0;
sort_order = sort_order || 0;
search_str = search_str || '';
filter_cols = filter_cols || '';
if (typeof window[div + '_uid'] === 'undefined')
{
window[div + '_uid'] = '0';
}
$.ajax({
url: "ajax.php?div=" + div + "&call=" + call + "&func=" + func + "&ix_form=" + encodeURIComponent(ix_form) + "&scrollbar_width=" + lcs_db_scrollbar_width() +
"&spacer_width=" + lcs_db_cell_spacing() + "&sort_col=" + sort_col + "&sort_order=" + sort_order + "&search_str=" + search_str +
"&parm1=" + encodeURIComponent(parm1) + "&parm2=" + encodeURIComponent(parm2) + "&parm3=" + encodeURIComponent(parm3) + "&filter_cols=" + filter_cols + "&old_uid=" + window[div + '_uid'],
cache: false,
dataType: "json",
success: function(json) {
//alert('html characters: ' + json.html.length);
$('#' + div + '_total_count').text(json.row_count);
$('#' + div + '_extra_data').text(json.extra_data);
window[div + '_xls_sql'] = json.xls_sql;
$('#' + div).html(json.html);
//lcs_db_adjust_sapcer_height(div);
//alert(json.xls_sql);
//alert(json.xls_sql);
//alert(json.html);
//alert(window[div + '_uid']);
//alert(window[div + '_load_method']);
if (window[div + '_load_method'] == 'lazy2' || window[div + '_load_method'] == 'lazy3')
{
window[div + '_scroll_top'] = $('#lcs_dbg_data_' + window[div + '_uid']).scrollTop();
if (window[div + '_load_method'] == 'lazy2')
{
lcs_db_lazy_load2(window[div + '_uid'], div);
}
else if (window[div + '_load_method'] == 'lazy3')
{
clearInterval(lcs_db_keep_alive_interval);
lcs_db_lazy_load3(window[div + '_uid'], div);
lcs_db_keep_alive_interval = setInterval(lcs_db_keep_alive, 60000, window[div + '_uid'], div);
}
$('#lcs_dbg_data_' + window[div + '_uid']).scrollStopped(function ()
{
if ($('#lcs_dbg_data_' + window[div + '_uid']).scrollTop() > ($('#lcs_dbg_data_' + window[div + '_uid'])[0].scrollHeight - $('#lcs_dbg_data_' + window[div + '_uid']).height() * 2) )
{
window[div + '_scroll_top'] = $('#lcs_dbg_data_' + window[div + '_uid']).scrollTop();
$('.lcs_appear').each(function()
{
if (window[div + '_load_method'] == 'lazy2')
{
lcs_db_lazy_load2(window[div + '_uid'], div);
}
else if (window[div + '_load_method'] == 'lazy3')
{
lcs_db_lazy_load3(window[div + '_uid'], div, true);
}
$(this).removeClass('lcs_appear');
});
}
});
}
}
,error: function (request, status, error) { alert(status + ", " + error + " DBG Load Response: " + request.responseText) + ' Status: ' + request.statusText; }
});
}
lcs_db_scroll = function(uid, div)
{
//alert($('#lcs_dbg_header_' + uid).scrollLeft());
$('#lcs_dbg_header_' + uid).scrollLeft($('#lcs_dbg_data_' + uid).scrollLeft());
}
lcs_db_search = function()
{
$('#' + table_id + '_strSearch').on( 'keyup', function () {
if (this.value > ' ')
{
$('#' + table_id + '_strSearch').removeClass('search');
$('#' + table_id + '_strSearch').addClass('search_cancel');
$('#' + table_id + '_search_box a').show();
}
else
{
$('#' + table_id + '_strSearch').removeClass('search_cancel');
$('#' + table_id + '_strSearch').addClass('search');
$('#' + table_id + '_search_box a').hide();
}
} );
}
lcs_db_lazy_load1 = function(i, imax, uid, div)
{
if (i > imax)
{
return;
}
$("#lcs_dbg_data_" + uid).append(window[div + '_ar_blocks'][i]);
i = i + 1;
setTimeout(function() { lcs_db_lazy_load1(i, imax, uid, div) }, 200);
}
lcs_db_lazy_load2 = function(uid, div)
{
if (window[div + '_current_block'] > window[div + '_block_count'])
{
return;
}
$("#lcs_dbg_data_" + uid).append(window[div + '_ar_blocks'][window[div + '_current_block']]);
window[div + '_current_block'] = window[div + '_current_block'] + 1;
}
lcs_db_lazy_load3 = function(uid, div, load_async)
{
if (window[div + '_current_block'] > window[div + '_block_count'])
{
return;
}
$.ajax({
url: "ajax.php?call=lcs_db_grid_ajax&func=load_block&uid=" + uid + "&block=" + window[div + '_current_block'],
cache: false,
async: load_async,
dataType: "json",
success: function(json) {
//alert(json.html);
$("#lcs_dbg_data_" + uid).append(json.html);
window[div + '_current_block'] = window[div + '_current_block'] + 1;
}
,error: function (request, status, error) { alert(status + ", " + error + " LZL3 Response: " + request.responseText); }
});
}
lcs_db_keep_alive = function(uid, div)
{
$.ajax({
url: "ajax.php?call=lcs_db_grid_ajax&func=keep_alive&uid=" + uid + "&bypass_session_timeout=true",
cache: false,
dataType: "text",
success: function(text) {
//$('#' + div + '_diag').text(text);
}
,error: function (request, status, error) { /* alert(status + ", " + error + " Response: " + request.responseText); */ }
});
}
/* ************************************************************ */
val_checkbox = function(cbval)
{
if (typeof cbval === 'undefined')
{
cbval = '0';
}
//alert(cbval);
return cbval;
}
clear_search_box = function(search_box_id)
{
$('#' + search_box_id).val('').keyup();
}
exportExcel = function(xls_sql)
{
window.location.href = "mod/_export_excel.php?sql=" + xls_sql;
//rptWindowName = this.open("mod/_export_excel.php?sql=" + xls_sql, "rptWindowName", "scrollbars=yes, resizable=yes, location=no, toolbar=no, menubar=no, height=200, width=400");
//rptWindowName.focus();
}
confirmDelete = function(msg, id, div)
{
var answer = confirm(msg);
//alert(eval(div + '_call') + ' id: ' + id);
if (answer == true){
$.ajax({
url: "ajax.php?call=" + eval(div + '_call') + "&func=delete&id=" + id,
cache: false,
dataType: "json",
success: function(json) {
if (json.result == 'Success')
{
lcs_db_load(div, eval(div + '_call'), 'grid', eval(div + '_ix_form'),
eval(div + '_sort_col'), eval(div + '_sort_order'), eval(div + '_search_str'),
eval(div + '_parm1'), eval(div + '_parm2'), eval(div + '_parm3') );
}
else
{
alert(json.result);
}
}
,error: function (request, status, error) { alert(status + ", " + error); }
})
}
}
function real_width(container_obj, measure_obj)
{
var clone = container_obj.clone();
clone.css("visibility","hidden");
$('body').append(clone);
var width = clone.outerWidth();
//alert(clone.innerWidth());
clone.remove();
return width;
}
printSection = function (id)
{
if (window[id + '_load_method'] == 'lazy2' || window[id + '_load_method'] == 'lazy3')
{
while (window[id + '_current_block'] <= window[id + '_block_count'])
{
if (window[id + '_load_method'] == 'lazy2')
{
lcs_db_lazy_load2(window[id + '_uid'], id);
}
else if (window[id + '_load_method'] == 'lazy3')
{
lcs_db_lazy_load3(window[id + '_uid'], id, false);
}
}
}
var table_grid_id;
var table_grid_scroller;
var table_grid_header;
var scroller_style;
var class_list = $('#' + id).attr('class').split(/\s+/);
$.each( class_list, function(index, item){
if (item === 'db-grid')
{
table_grid_id = $('#' + id).find("table").eq(1).attr('id');
table_grid_scroller = $('#' + id).find(".dataTables_scrollBody").eq(0);
table_grid_header = $('#' + id).find(".dataTables_scrollHeadInner").eq(0);
var header_width = $(table_grid_header).width();
if ($('#' + table_grid_id ).length > 0)
{
scroller_style = $(table_grid_scroller).attr('style');
$(table_grid_scroller).attr('style', 'width:' + header_width + 'px;');
}
}
});
var height = $('#' + id).css('height');
if (height == '')
{
height = 'auto';
}
var html="<html>";
var unix_time = Math.round(+new Date()/1000);
html+='<link rel="stylesheet" href="css/main.css?' + unix_time + '" type="text/css" >';
html+='<link rel="stylesheet" href="css/print.css?' + unix_time + '" type="text/css" >';
if (typeof print_header !== 'undefined')
html+= print_header;
if (typeof print_sub_header !== 'undefined')
html+= print_sub_header;
html+= '<h1>' + $('h1:first').html() + '</h1>';
html+= '<div style="float:none;position:relative;min-height:' + height + ';">';
//html+= document.getElementById(id).innerHTML;
//alert($('#' + id).html());
//html+= $('#' + id).html();
var clean_html = $('#' + id).html();
clean_html = clean_html.replace(/<script.*?>[\s\S]*?<\/script>/ig, "");
clean_html = clean_html.replace(/onclick="[\s\S]*?"/ig, "");
clean_html = clean_html.replace(/onchange="[\s\S]*?"/ig, "");
clean_html = clean_html.replace(/onblur="[\s\S]*?"/ig, "");
clean_html = clean_html.replace(/onmouseover="[\s\S]*?"/ig, "");
clean_html = clean_html.replace(/onmousedown="[\s\S]*?"/ig, "");
clean_html = clean_html.replace(/onmouseup="[\s\S]*?"/ig, "");
clean_html = clean_html.replace(/onkeypress="[\s\S]*?"/ig, "");
clean_html = clean_html.replace(/onkeydown="[\s\S]*?"/ig, "");
clean_html = clean_html.replace(/onkeyup="[\s\S]*?"/ig, "");
clean_html = clean_html.replace(/onfocus="[\s\S]*?"/ig, "");
clean_html = clean_html.replace(/href="[\s\S]*?"/ig, "");
clean_html = clean_html.replace(/<input /ig, '<input readonly="readonly" ');
clean_html = clean_html.replace(/ type="checkbox"/ig, ' type="checkbox" disabled="disabled" ');
clean_html = clean_html.replace(/ type="radio"/ig, ' type="radio" disabled="disabled" ');
clean_html = clean_html.replace(/ type="button"/ig, ' type="hidden" ');
html+= clean_html;
html+= '</div>';
html+= '<div style="float:none;">';
if (typeof print_footer !== 'undefined')
html+= print_footer;
html+= '</div>';
html+="</html>";
//alert(html);
$.each( class_list, function(index, item){
if (item === 'db-grid')
{
$(table_grid_scroller).attr('style', scroller_style);
}
});
var printWin = window.open('','','left=50,top=50,width=960,height=600,toolbar=0,scrollbars=1,menubar=1,status=0');
printWin.document.write(html);
printWin.document.close();
printWin.focus();
printWin.print();
//printWin.close();
}
pdfSection = function (id, strip_anchor)
{
var rec_count = parseInt(trim($('#' + id + '_total_count').text()));
if (rec_count > 200)
{
alert('Creating a PDF with too many records will take a long time and may crash the server. Please filter the records to narrow your selection or try the Print or Excel function instead.');
return;
/*
var answer = confirm('Are you sure? Creating a PDF with too many records will take a long time and may crash the server. Please click [Cancel] and try the Print or Excel function instead.');
if (answer != true){
return;
}
*/
}
if ('undefined' === typeof strip_anchor)
{
strip_anchor = 1;
}
if (window[id + '_load_method'] == 'lazy2' || window[id + '_load_method'] == 'lazy3')
{
while (window[id + '_current_block'] <= window[id + '_block_count'])
{
if (window[id + '_load_method'] == 'lazy2')
{
lcs_db_lazy_load2(window[id + '_uid'], id);
}
else if (window[id + '_load_method'] == 'lazy3')
{
lcs_db_lazy_load3(window[id + '_uid'], id, false);
}
}
}
var table_grid_id;
var table_grid_scroller;
var table_grid_header;
var scroller_style;
var class_list =$('#' + id).attr('class').split(/\s+/);
$.each( class_list, function(index, item){
if (item === 'db-grid')
{
table_grid_id = $('#' + id).find("table").eq(1).attr('id');
table_grid_scroller = $('#' + id).find(".dataTables_scrollBody").eq(0);
table_grid_header = $('#' + id).find(".dataTables_scrollHeadInner").eq(0);
var header_width = $(table_grid_header).width();
if ($('#' + table_grid_id ).length > 0)
{
scroller_style = $(table_grid_scroller).attr('style');
$(table_grid_header).hide();
$(table_grid_scroller).attr('style', 'width:' + header_width + 'px;');
}
}
});
var height = $('#' + id).css('height');
if (height == '')
{
height = 'auto';
}
var html="<html><head>";
var unix_time = Math.round(+new Date()/1000);
html+='<link rel="stylesheet" href="css/main.css?' + unix_time + '" type="text/css" >';
html+='<link rel="stylesheet" href="css/pdf.css?' + unix_time + '" type="text/css" >';
html+='</head><body>';
if (typeof print_header !== 'undefined')
html+= print_header;
if (typeof print_sub_header !== 'undefined')
html+= print_sub_header;
html+= '<div style="float:none;position:relative;min-height:' + height + ';">';
//html+= document.getElementById(id).innerHTML;
//alert($('#' + id).html());
//html+= $('#' + id).html();
var clean_html = $('#' + id).html();
clean_html = clean_html.replace(/<script.*?>[\s\S]*?<\/script>/ig, "");
clean_html = clean_html.replace(/onclick="[\s\S]*?"/ig, "");
clean_html = clean_html.replace(/onchange="[\s\S]*?"/ig, "");
clean_html = clean_html.replace(/onblur="[\s\S]*?"/ig, "");
clean_html = clean_html.replace(/onmouseover="[\s\S]*?"/ig, "");
clean_html = clean_html.replace(/onmousedown="[\s\S]*?"/ig, "");
clean_html = clean_html.replace(/onmouseup="[\s\S]*?"/ig, "");
clean_html = clean_html.replace(/onkeypress="[\s\S]*?"/ig, "");
clean_html = clean_html.replace(/onkeydown="[\s\S]*?"/ig, "");
clean_html = clean_html.replace(/onkeyup="[\s\S]*?"/ig, "");
clean_html = clean_html.replace(/onfocus="[\s\S]*?"/ig, "");
if (strip_anchor == 1)
{
clean_html = clean_html.replace(/href="[\s\S]*?"/ig, "");
}
clean_html = clean_html.replace(/<input /ig, '<input readonly="readonly" ');
clean_html = clean_html.replace(/ type="checkbox"/ig, ' type="checkbox" disabled="disabled" ');
clean_html = clean_html.replace(/ type="radio"/ig, ' type="radio" disabled="disabled" ');
clean_html = clean_html.replace(/ type="button"/ig, ' type="hidden" ');
html+= clean_html;
html+= '</div>';
html+= '<div style="float:none;">';
if (typeof print_footer !== 'undefined')
html+= print_footer;
html+= '</div>';
html+="</body></html>";
//alert(html);
$.each( class_list, function(index, item){
if (item === 'db-grid')
{
$(table_grid_header).show();
$(table_grid_scroller).attr('style', scroller_style);
}
});
$("textarea#pdf_html").val(html);
$("form#frm_pdf").submit();
}
logoutRedirect = function()
{
$.ajax({
url: "ajax.php?call=logout_check",
cache: false,
dataType: "json",
success: function(json) {
//alert('got JSON');
//alert(json.logout);
if (json.logout == 1)
{
sheet_dirty = false;
window.location.href = 'index.php?IX=logout';
}
}
,error: function (request, status, error) { /*alert(status + ", " + error);*/ }
});
var logout_timer = window.setTimeout("logoutRedirect()",30000);
}
appstack_reset = function()
{
var ar_stack = [];
sessionStorage.appstack = JSON.stringify(ar_stack);
return false;
}
appstack_pop = function()
{
if (sessionStorage.appstack)
{
var ar_stack = JSON.parse(sessionStorage.appstack);
ar_stack.pop(); //pop current page
var ar_url = ar_stack.pop(); //get to previous page
if (typeof ar_url === 'object')
{
var url = $.param(ar_url);
sessionStorage.appstack = JSON.stringify(ar_stack);
if (url > ' ')
{
window.location.href = 'index.php?' + url;
}
else
{
window.open('','_self').close();
}
}
else
{
window.open('','_self').close();
}
}
return false;
}
appstack_push = function()
{
if (!sessionStorage.appstack)
{
var ar_stack = [];
sessionStorage.appstack = JSON.stringify(ar_stack);
}
else
{
var ar_stack = JSON.parse(sessionStorage.appstack);
}
var ar_url = window.location.search.substring(1).split('&');
var ar_param = [];
var ar_item = {};
for (var i = 0; i < ar_url.length; i++)
{
ar_param = ar_url[i].split('=');
ar_item[ar_param[0]] = ar_param[1];
}
var ar_compare = ar_stack[ar_stack.length - 1];
if (typeof ar_compare === 'undefined')
{
ar_compare = {};
}
if (ar_compare['IX'] != ar_item['IX'])
{
ar_stack.push(ar_item);
}
else
{
ar_stack[ar_stack.length - 1] = ar_item;
}
sessionStorage.appstack = JSON.stringify(ar_stack);
}
appstack_switch_param = function(param, value)
{
if (sessionStorage.appstack)
{
var ar_stack = JSON.parse(sessionStorage.appstack);
ar_stack[ar_stack.length - 1][param] = value;
sessionStorage.appstack = JSON.stringify(ar_stack);
}
return false;
}
window_open = function (w_id,x,y)
{
var open_timer = 500;
//Get the screen height and width
var maskHeight = $(document).height();
var maskWidth = $(window).width();
//Set height and width to mask to fill up the whole screen
$('#mask').css({'width':maskWidth,'height':maskHeight});
//transition effect
//$('#mask').fadeIn(open_timer);
$('#mask').fadeTo(0,0.8);
//Get the window height and width
var winH = $(window).height();
var winW = $(window).width();
//Set the popup window to center
//$(w_id).css('top', winH/2-$(w_id).height()/2);
//$(w_id).css('left', winW/2-$(w_id).width()/2);
//transition effect
$('#' + w_id).fadeIn(open_timer);
}
window_close = function ()
{
$('#mask, div.window').hide();
$('#terms_content').html(window_terms_orig_html);
}
window_video = function (w_id, ix)
{
//$('#terms_title').html(title);
$('#terms_content').html(window_terms_orig_html);
//$('#terms_content').scrollTop(0);
window_open(w_id);
$('#terms_content').load('ajax.php?call=video_load&ix=' + ix,
function()
{
} );
//$('#terms_content').load('mod/terms.php?text_key=' + text_key, function() { $('#terms_content').scrollTop(1); });
//window_open(w_id);
}
window_popup = function (w_id, ix)
{
$('#terms_content').html(window_terms_orig_html);
window_open(w_id);
$('#terms_content').load('ajax.php?call=video_load<ype=text&ix=' + ix,
function()
{
} );
//$('#terms_content').load('mod/terms.php?text_key=' + text_key, function() { $('#terms_content').scrollTop(1); });
//window_open(w_id);
}
switch_tab = function(tab_name)
{
$(".tab_content").hide();
$("#tab_content_" + tab_name).show();
$(".tab_header").removeClass("tab_header_selected");
$("#tab_" + tab_name).addClass("tab_header_selected");
$("#active_tab").val(tab_name);
appstack_switch_param('tab', tab_name);
$('#tab_content_' + tab_name + ' div.db-grid').each(function()
{
if (!ar_lcs_db_loaded[$(this).attr('id')])
{
ar_lcs_db_load[$(this).attr('id')]();
}
});
}
function normalize_new_lines(text)
{
return text.replace(/(\r\n|\r|\n)/g, '\r\n');
}
function key(e)
{
//return e?e.which:event.keyCode;
evt = e || window.event;
return evt.keyCode;
}
function delay(ms)
{
ms += new Date().getTime();
while (new Date() < ms){}
}
function prevent_enter_submit(e)
{
evt = e || window.event;
//alert(evt.keyCode);
if (evt.keyCode == 13)
{
var tagName = e.target.tagName.toLowerCase();
var tagTpe = '';
if ($(e.target).attr('type'))
{
tagType = $(e.target).attr('type').toLowerCase();
}
if (tagName !== "textarea" && tagType != 'submit' && tagType != 'button')
{
if (window.event)
{
window.event.keyCode = 9;
return window.event.keyCode;
}
else
{
return false;
}
}
else
{
//return false;
}
}
}
function check_enter(e)
{
//alert('check enter');
/*
*/
evt = e || window.event;
//alert(evt.keyCode);
if (evt.keyCode == 13)
{
return false;
}
//return false;
}
var ok_to_submit = false;
var form_to_submit = '';
function delay_submit(frm)
{
form_to_submit = $(frm).attr('id');
if (ok_to_submit)
{
frm.submit();
}
else
{
ok_to_submit = true;
setTimeout( function()
{
delay_submit(frm);
}, 1000);
return false;
}
}
function preventEnterSubmit(e)
{
if (e.which == 13) {
var $targ = $(e.target);
if (!$targ.is("textarea") && !$targ.is(":button,:submit")) {
var focusNext = false;
$(this).find(":input:visible:not([disabled],[readonly]), a").each(function(){
if (this === e.target) {
focusNext = true;
}
else if (focusNext){
$(this).focus();
return false;
}
});
return false;
}
}
}
/* ************* Form processing ****** */
function lcs_autocomplete_open(fid)
{
setTimeout(function() {
$('#' + fid + '_autocomplete').show();
lcs_autocomplete_filter(fid);
}, 50);
}
function lcs_autocomplete_close(fid)
{
setTimeout(function() {$('#' + fid + '_autocomplete').hide(); }, 600);
}
function lcs_autocomplete_filter(fid)
{
var search_text = $('#' + fid).val().toLowerCase();
$('div#' + fid + '_autocomplete ul li').each(function() {
var string = $(this).text().toLowerCase();
if(string.indexOf(search_text)!=-1) {
$(this).show();
} else {
$(this).hide();
}
});
}
function lcs_autocomplete_pick(elem, fid)
{
$('#' + fid).val($(elem).text());
}
/****************************************/
var ac_picked = 0;
var ac_filter = 0;
var ac_mouse_x = 0;
var ac_mouse_y = 0;
jQuery.expr[':'].Contains = function(a,i,m)
{
return (a.textContent || a.innerText || "").toUpperCase().indexOf(m[3].toUpperCase())>=0;
};
jQuery.expr[':'].Equals = function(a,i,m)
{
return (a.textContent || a.innerText || "").toUpperCase() == m[3].toUpperCase();
};
autocomplete_toggle = function(fid, limit_list)
{
if($('#' + fid + '_items').is(":visible"))
{
autocomplete_close(fid, limit_list);
}
else
{
autocomplete_open(fid, limit_list);
}
}
autocomplete_open = function(fid, limit_list)
{
$('#' + fid + '_items li').slideDown(0);
$('#' + fid + '_items').show().scrollTop(0);
ac_picked = 0;
ac_filter = 0;
setTimeout(function()
{
$(document).on('click.mynamespace_' + fid, function(event) {
if($(event.target).parents().index($('#' + fid + '_items')) == -1 && $(event.target).attr('id') != fid + '_mask' ) {
if($('#' + fid + '_items').is(":visible")) {
autocomplete_close(fid, limit_list);
$(document).off('click.mynamespace_' + fid);
}
}
});
$('#' + fid + '_mask').keydown(function (e)
{
if (e.keyCode == 9)
{
autocomplete_close(fid, limit_list);
}
});
},200);
setTimeout(function() {$('#' + fid + '_items').attr('ac_open','1');},200);
}
autocomplete_close = function(fid, limit_list)
{
setTimeout(function()
{
if (ac_picked == 0)
{
$('#' + fid).val($('#' + fid + '_mask').val());
}
if (limit_list)
{
var filter = $('#' + fid + '_mask').val();
if (filter)
{
$('#' + fid).val($('#' + fid + '_items li:Equals(' + filter + ')').first().attr('ac_value'));
}
else
{
$('#' + fid).val('');
}
}
ac_filter = 0;
},50);
setTimeout(function()
{
$('#' + fid + '_items').hide();
$('#' + fid + '_items').attr('ac_open','0');
$('#' + fid + '_items li').slideDown(0);
$(document).off('click.mynamespace_' + fid);
},100);
}
autocomplete_pick = function(fid,value,text, limit_list)
{
$('#' + fid + '_mask').val(text);
$('#' + fid).val(value);
ac_picked = 1;
autocomplete_close(fid, limit_list);
}
autocomplete_filter = function(e, fid)
{
var xkey = key(e);
if (xkey == 9 || xkey > 111 || (xkey < 48 && xkey != 8))
{
return;
}
var filter = $('#' + fid + '_mask').val();
if (filter)
{
$('#' + fid + '_items li:not(:Contains(' + filter + '))').slideUp(50);
$('#' + fid + '_items li:Contains(' + filter + ')').slideDown(50);
}
else
{
$('#' + fid + '_items li').slideDown(50);
}
}
function trim(stringToTrim)
{
return stringToTrim.replace(/^\s+|\s+$/g,"");
}
function ltrim(stringToTrim)
{
return stringToTrim.replace(/^\s+/,"");
}
function rtrim(stringToTrim)
{
return stringToTrim.replace(/\s+$/,"");
}
function str2num(strInput)
{
var numResult = 0.0;
var dec_flag = 0;
var strVal = "0";
strInput = trim(strInput);
for (var i = 0; i < strInput.length; i++)
{
strChar = strInput.charAt(i);
if ((i == 0) && (strChar == "-"))
strVal = "-0";
if ((strChar >="0") && (strChar <="9"))
strVal = strVal + strChar;
if ((strChar == ".") && (dec_flag == 0))
{
strVal = strVal + strChar;
dec_flag = 1;
}
}
numResult = parseFloat(strVal);
//alert(strVal);
return numResult;
}
// Parameters:
// numInput - number to convert to string
// intDec - number of digits after the decimal point
// strComma - thousands separatot
// intLen - maximum length of result not counting signs - will fill with leading zeroes
// strMinusL - minus character(s) to the left of result
// strMinusR - minus character(s) to the right of result
function num2str(numInput, intDec, strComma, intLen, strMinusL, strMinusR)
{
var i = 0;
var j = 0;
var strResult = "";
var numResult = Math.round(numInput * Math.pow(10, intDec));
if (numResult >= 0)
strMinusL = strMinusR = "";
var arNum = (Math.abs(numResult) + "").split(""); //convert to array
var x = arNum.length; //make sure at least one zero before decimal
if (x < (intDec + 1))
{
var y = intDec - x + 1;
for (i = 0; i < y; i++)
arNum.splice(i, 0, "0");
}
if (intDec > 0) //insert decimal
arNum.splice(arNum.length - intDec, 0, ".");
j = 0; //insert thousands
x = arNum.length - 1;
if (intDec > 0)
intDec = intDec + 1;
for (i = (x - intDec); i > 0; i--)
{
j = j + 1;
if (j == 3)
{
arNum.splice(i, 0, strComma);
j = 0;
}
}
if (intLen > 0) //insert leading zeroes
{
for (i = 0; (i < intLen - arNum.length); i++)
{
arNum.splice(0, 0, "0");
}
}
strResult = strMinusL + arNum.join("") + strMinusR;
return strResult;
}
function val_dollar_field(field)
{
if (!strID)
var strID = "";
field.value = trim(field.value);
field.value = num2str(str2num(field.value),2,",",0,"-","");
}
function val_int_field(field)
{
if (!strID)
var strID = "";
field.value = trim(field.value);
field.value = num2str(str2num(field.value),0,",",0,"-","");
}
function check_dirty()
{
if (sheet_dirty == true)
{
return "Data has changed - discard changes?";
}
}
function nl2br (str, is_xhtml)
{
var breakTag = (is_xhtml || typeof is_xhtml === 'undefined') ? '<br />' : '<br>';
return (str + '').replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, '$1'+ breakTag +'$2');
}
var MAX_DUMP_DEPTH = 10;
dump = function(obj, name, indent, depth)
{
if (depth > MAX_DUMP_DEPTH) {
return indent + name + ": <Maximum Depth Reached>\n";
}
if (typeof obj == "object") {
var child = null;
var output = indent + name + "\n";
indent += "\t";
for (var item in obj)
{
try {
child = obj[item];
} catch (e) {
child = "<Unable to Evaluate>";
}
if (typeof child == "object") {
output += dump(child, item, indent, depth + 1);
} else {
output += indent + item + ": " + child + "\n";
}
}
return output;
} else {
return obj;
}
}