403Webshell
Server IP : 104.21.21.239  /  Your IP : 216.73.216.11
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/mitzvahm/planner/js/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/mitzvahm/planner/js/index.js
var timeout    = 500;
var closetimer = 0;
var ddmenuitem = 0;
var sheet_dirty = false;
var dTable;
var dTable_width;
var window_terms_orig_html;

function jsddm_open()
{  jsddm_canceltimer();
   jsddm_close();
   ddmenuitem = $(this).find('ul').css('visibility', 'visible');}

function jsddm_close()
{  if(ddmenuitem) ddmenuitem.css('visibility', 'hidden');}

function jsddm_timer()
{  closetimer = window.setTimeout(jsddm_close, timeout);}

function jsddm_canceltimer()
{  if(closetimer)
   {  window.clearTimeout(closetimer);
	  closetimer = null;}}

$(document).ready(function()
{  
	$('#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");
					});
			}
		});
	}

	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'));
						   })

   //$('.help_icon').bind('click', toggleHelp('a'));
	format_dtable('db_grid_main');
	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
		});	
	*/
	$('div.form_strip input[type=button], div.form_strip input[type=submit]').each(function(){
		if ($(this).closest('form').attr('target') != '_blank' && $(this)[0].getAttributeNode('onclick') != null && $(this)[0].getAttributeNode('onclick').value.indexOf('this.form.submit()') !== -1) {
			$(this).on('click', function() {
				$('div.form_strip input[type=button], div.form_strip input[type=submit]').css('visibiblity', false);
				$('div.form_strip').html('<b>Please wait...</b>');
			});
		}
	});
});

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 "";
}

val_checkbox = function(cbval)
{
	if (typeof cbval === 'undefined')
	{
		cbval = '0';
	}
	//alert(cbval);
	return cbval;
}

change_rating = function(eid, rating)
{
	//alert(eid);
	//alert(rating);
	var html = '';
	var xdiv = document.getElementById('rating_' + eid);
	var i = 0;
	var jscript = '';
	for (i=1; i<=5; i++)
	{
		jscript = "'" + eid + "'," + i;
		if (i <= rating)
			html = html + '<img src="img/star_filled_16.gif" style="cursor:pointer;" onclick="change_rating(' + jscript + ');">';
		else
			html = html + '<img src="img/star_hollow_16.gif" style="cursor:pointer;" onclick="change_rating(' + jscript + ');">';
	}
	xdiv.innerHTML = html;
	xelem = document.getElementById(eid);	
	xelem.value = rating;	
}


exportExcel = function(xls_sql)
{
	window.location.href = "mod/_export_excel.php?sql=" + xls_sql;
}

confirmDelete = function(msg, page)
{
	var answer = confirm(msg);
	if (answer == true){
		window.location.href = 'index.php?IX=' + page;
	}
}

live_field = function(id)
{
	var input_type = $('#' + id).attr('type');
	switch(input_type)
	{
		case 'text' :
			//alert('value ' + $('input[id=' + id + ']').attr('val'));
			$('input[id=' + id + ']').attr('value', $('input[id=' + id + ']').val());
			break;
		case 'checkbox' :
			if (val_checkbox($('input[id=' + id + ']:checked').val()) == 0)
			{
				$('input[id=' + id + ']').attr('checked', null);
			}
			else
			{
				$('input[id=' + id + ']').attr('checked', $('input[id=' + id + ']').attr('checked'));
			}
			break;
		case 'radio' :
			//alert('radio ' + id + '   ' + $('input[id=' + id + ']').val());
			var radio_name = $('input[id=' + id + ']').attr('name');
			var checked_id = '';
			$('input[name=' + radio_name + ']').each(function()
				{
					if ($(this).is(':checked'))
					{
						checked_id = $(this).attr('id');
						//$(this).attr('checked', 'checked');
					}
					else
					{
						//$(this).attr('checked', null);
					}
				});
			$('input[name=' + radio_name + ']').removeAttr('checked');
			if (checked_id > '')
			{
				$('#' + checked_id).attr('checked', 'checked');
			}
			/*
			var this_checked = $('input[id=' + id + ']').attr('checked');
			$('input[name=' + radio_name + ']').removeAttr('checked');
			if (this_checked == 'checked')
			{
				$('input[id=' + id + ']').attr('checked', 'checked');
			}
			break;
			*/
	}
}

format_dtable = function(table_id)
{
	if ($('#' + table_id).length > 0)
	{
		var t_width = $('#' + table_id).width() + 10;
		dTable_width = $('#' + table_id).width();
		if($.browser.msie)
		{
			var expr = new RegExp('>[ \t\r\n\v\f]*<', 'g');
			var expr2 = new RegExp('\\t', 'g');
			var expr3 = new RegExp('\\n', 'g');
			var strHTML = document.getElementById('div_db_grid').innerHTML;
			strHTML = strHTML.replace(expr, '><');
			strHTML = strHTML.replace(expr2, '');
			strHTML = strHTML.replace(expr3, '');
			//$('#' + table_id).html(strHTML);
			document.getElementById('div_db_grid').innerHTML = strHTML;
		}
		dTable = $('#' + table_id).dataTable( {
			"bAutoWidth": false,
			"sScrollY": "500px",
			"bFilter": false,
			"bInfo": false,
			"bSort": false,
			"bPaginate": false
		} );
		$('#' + table_id + '_wrapper').css('width', t_width + 'px');
		dTable.fnAdjustColumnSizing();
	}
}

printSection = function (id)
{
	if (id == 'div_db_grid')
	{
		if ($('#db_grid_main' ).length > 0)
		{
			dTable.fnDestroy();
			$( "#db_grid_main>thead" ).insertBefore( "#db_grid_main>tbody" );
			$( "#db_grid_main" ).width(dTable_width);
		}
	}
	var height = $('#' + id).css('height');
	if (height == '')
	{
		height = 'auto';
	}
	var html="<html>";
	html+='<link rel="stylesheet" href="css/main.css" type="text/css" >';
	html+='<link rel="stylesheet" href="css/print.css" 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);
	
	if (id == 'div_db_grid')
	{
		if ($('#db_grid_main' ).length > 0)
		{
			format_dtable('db_grid_main');
		}
	}

	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();
	setTimeout(function(){
		printWin.print();
	}, 500);
	//printWin.close();
}

pdfSection = function (id, strip_anchor)
{
	if ('undefined' === typeof strip_anchor)
	{
		strip_anchor = 1;
	}
	if (id == 'div_db_grid')
	{
		if ($('#db_grid_main' ).length > 0)
		{
			dTable.fnDestroy();
			$( "#db_grid_main>thead" ).insertBefore( "#db_grid_main>tbody" );
			$( "#db_grid_main" ).width(dTable_width);
		}
	}
	var height = $('#' + id).css('height');
	if (height == '')
	{
		height = 'auto';
	}
	var html="<html>";
	html+='<link rel="stylesheet" href="css/main.css" type="text/css" >';
	html+='<link rel="stylesheet" href="css/print.css" type="text/css" >';
	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+="</html>";
	//alert(html);
	if (id == 'div_db_grid')
	{
		if ($('#db_grid_main' ).length > 0)
		{
			format_dtable('db_grid_main');
		}
	}

	$("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)
				{
					window.location.href = 'index.php?IX=logout';
				}
		}
		 ,error: function (request, status, error) { /*alert(status + ", " + error);*/ }
	});
	var logout_timer = window.setTimeout("logoutRedirect()",30000);
}

toggleReports = function()
{
	//alert('toggleHelp');
	if ($('#report_select').is(':visible'))
	{
		$('#report_select').hide();
		//$('#report_icon').text('Reports...');
		$('#report_icon').show();
	}
	else
	{
		$('#report_select').show();
		//$('#report_icon').text('Close');
		$('#report_icon').hide();
	}
}

toggleHelp = function(ix)
{
	//alert('toggleHelp');
	if ($('#help_section').is(':visible'))
	{
		$('#help_section').hide();
		$('#help_icon').text('?').removeClass('help_icon_open');
		$('#ajax_help').load('ajax.php?call=help_toggle&mode=off');
	}
	else
	{
		$('#help_section').show();
		$('#help_icon').text('X').addClass('help_icon_open');
		$('#ajax_help').load('ajax.php?call=help_toggle&mode=on');
	}
}

loadHelp = function(ix)
{
	$('#help_section').load('ajax.php?call=help_load&ix=' + ix,
			function() 
			{
				
			} );
}

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);
	$('#terms_window').removeClass('coupon_window');
}


window_video = function (w_id, ix)
{
	$('#terms_content').html(window_terms_orig_html);
	window_open(w_id);
	$('#terms_content').load('ajax.php?call=video_load&ix=' + ix,
			function() 
			{
				
			} );
}

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&ltype=text&ix=' + ix,
			function() 
			{
				
			} );
}

window_coupon_popup = function (w_id, coupon_html)
{
	$('#terms_content').html(window_terms_orig_html);
	$('#terms_window').addClass('coupon_window');
	window_open(w_id);
	$('#terms_content').html(coupon_html);
}

var ar_gallery = [];
var ix_gal = 0;
var ix_gal_max = 0;
var ix_gal_current = 0;
	

window_gallery = function (w_id, ix)
{
	if (ix < 1) {
		ix = ix_gal_max;
	}
	if (ix > ix_gal_max) {
		ix = 1;
	}
	$('#terms_content').html(window_terms_orig_html);
	window_open(w_id);
	$('#terms_content').load('ajax.php?call=video_load&ltype=gallery&ix=' + ar_gallery[ix],
			function() 
			{
				ix_gal_current = ix;
			} );
}

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);
	loadHelp('help_' + active_page + '_' + tab_name);
}

function normalize_new_lines(text)
{
    return text.replace(/(\r\n|\r|\n)/g, '\r\n');
}

notes_load = function(ix, ix_id, show)
{
	/*
	$('#notes_ajax').load('ajax.php?call=notes_load&notes_ix=' + ix + '&notes_ix_id=' + ix_id,
			function() 
			{
				$('#system_notes').val(normalize_new_lines($('#notes_ajax').html().trim()));
			} );
	*/
	$.ajax({
		url: 'ajax.php?call=notes_load&notes_ix=' + ix + '&notes_ix_id=' + ix_id,
		cache: false,
		dataType: "json",
		success: function(json) {
				$('#system_notes').val(normalize_new_lines(json.note));
				$('#notes_followup_date').val(json.date);
				if (json.complete == '1')
				{
					$('#notes_followup_complete').attr('checked', 'checked');
				}
				if ($('#system_notes').val() > ' ' || $('#notes_followup_date').val() > ' ')
				{
					$('#note_icon_image').attr('src','img/lg_note_icon_checked_30x30.png');
				}
				else
				{
					$('#note_icon_image').attr('src','img/lg_note_icon_30x30.png');
				}
		}
		 ,error: function (request, status, error) { /* alert(status + ", " + error); */ }
	})
	$('#system_notes').unbind('change');
	$('#notes_followup_date').unbind('change');
	$('#notes_followup_complete').unbind('change');
	if (show)
	{
		$('#note_window').show();
	}
}

notes_save = function(ix, ix_id)
{
	//alert(val_checkbox($('#notes_followup_complete:checked').val()));
	$('#notes_ajax').load('ajax.php?call=notes_save&notes_ix=' + ix + '&notes_ix_id=' + ix_id + '&note=' + encodeURIComponent($('#system_notes').val()) + 
						'&date=' + encodeURIComponent($('#notes_followup_date').val()) + '&complete=' + val_checkbox($('#notes_followup_complete:checked').val()),
			function() 
			{
			} );
	$('#note_window').hide();
}

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;
        }
    }
}

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;
	$('#' + fid).attr('curr_value', $('#' + fid ).val());
	$('#' + fid + '_mask').attr('curr_value', $('#' + fid + '_mask').val());
	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)
						{
							if ($('#' + fid + '_mask').attr('curr_value') != $('#' + fid + '_mask').val()) {
								$('#' + 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).attr('value', text);
	$('#' + fid).val(value);
	//$('#' + fid + '_mask').blur();
	ac_picked = 1;
	autocomplete_close(fid, limit_list);
}

autocomplete_blur = function(fid, limit_list)
{
	//alert(fid);
	//alert($('#' + fid + '_mask').val());
	if (!limit_list)
	{
		if ($('#' + fid + '_mask').attr('curr_value') != $('#' + fid + '_mask').val()) {
			$('#' + fid).val($('#' + fid + '_mask').val());
		}
	}
}

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');
}

function set_country(state_field, country_field)
{
	if ($('#' + country_field).val() == '')	{
		if ($('#' + state_field).is('select')) {
			if ($('#' + state_field + ' option:selected').attr('attr_country') != 'United States of America')		{
				$('#' + country_field).val($('#' + state_field + ' option:selected').attr('attr_country'));
			}
		} else {
			setTimeout(function() {
				console.log($('#' + state_field).val());
				if (ar_states[$('#' + state_field).val()] != 'United States of America')		{
					$('#' + country_field).val(ar_states[$('#' + state_field).val()]);
				}
			}, 500);
		}
	}
	/*
	else
	{
		if ($('#' + state_field + ' option:selected').attr('attr_country') == 'United States of America')
		{
			$('#' + country_field).val('');
		}
	}
	*/
}

var captcha_i = 0;
reload_captcha = function(img_id)
{
	captcha_i = captcha_i + 1;
	$('#' + img_id).attr('src', 'mod/_captcha.php?ver=' + captcha_i);
}

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;
	  }
}

Youez - 2016 - github.com/yon3zu
LinuXploit