﻿var offline = false; function ajaxProxy(webservice, method, jsonstring, callback) { if (offline) { return false; } $.ajax({ type: "POST", url: rootUrl + "WebServices/" + webservice + ".asmx/" + method, data: jsonstring, contentType: "application/json; charset=utf-8", dataType: "json", success: function(response) { callback((typeof response.d) == "string" ? eval("(" + response.d + ")") : response.d); }, error: function(XMLHttpRequest, textStatus, errorThrown) { callback({ Error: XMLHttpRequest.statusText }); } }); } function formReset(a) { $(a + " input[type='text']").each(function() { $(this).val(""); }); $(a + " textarea").each(function() { $(this).html(""); }); } function scrollToTop() { $("html, body").animate({ scrollTop: 0 }, "slow"); } function blinkIn(c) { var b = 150; for (var a = 0; a < 10; a++) { $(c).fadeIn(b * (a / 4)).fadeOut(b * (a / 4)).fadeIn(b * (a / 4)); } } $.extend({ getScript: function(c, e) { var d = document.getElementsByTagName("head")[0]; var b = document.createElement("script"); b.src = c; var a = false; b.onload = b.onreadystatechange = function() { if (!a && (!this.readyState || this.readyState == "loaded" || this.readyState == "complete")) { a = true; if (e) { e(); } b.onload = b.onreadystatechange = null; } }; d.appendChild(b); return undefined; } }); jQuery.extend({ clearText: function(b) { var a = b.replace(/<[^>]*>/g, ""); a = $.trim(a); a = a.replace(/^[\s(&nbsp;)]+/g, ""); return a; } }); jQuery.extend({ jsonText: function(a) { return a.replace("'", "").replace("\\", "\\\\").replace("\n", "\\n").replace("\r", "\\r"); } }); jQuery.extend({ truncateText: function(b, a) { return b.substring(0, (b.length > a ? a : b.length)); } });
