(function () { var Ask = {}; var scriptName = "Ask.EmbeddedQuestionWidget.jss"; var $j; //noconflict reference to jquery var jqueryPath = "https://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"; var jqueryVersion = "1.8.1"; var scriptTag; //reference to the html script tag var baseUrl = "https://askquestions.askiitians.com/"; var containerId = "ELEMENTID"; var cssFileName = "https://askquestions.askiitians.com/Resources/widget.css"; var embeddedFileName = "Ask.EmbeddedWidgetHtml.wdt"; var container; var jScript; var allScripts = document.getElementsByTagName('script'); var targetScripts = []; for (var i in allScripts) { var name = allScripts[i].src; if (name && name.indexOf(scriptName) > 0) targetScripts.push(allScripts[i]); } scriptTag = targetScripts[targetScripts.length - 1]; function loadScript(src, onLoad) { var script_tag = document.createElement('script'); script_tag.setAttribute("type", "text/javascript"); script_tag.setAttribute("src", src); script_tag.async = true; if (script_tag.readyState) { script_tag.onreadystatechange = function () { if (this.readyState == 'complete' || this.readyState == 'loaded') { onLoad(); } }; } else { script_tag.onload = onLoad; } (document.getElementsByTagName("head")[0] || document.documentElement).appendChild(script_tag); } function loadCss(href) { var link_tag = document.createElement('link'); link_tag.setAttribute("type", "text/css"); link_tag.setAttribute("rel", "stylesheet"); link_tag.setAttribute("href", href); (document.getElementsByTagName("head")[0] || document.documentElement).appendChild(link_tag); } if (window.jQuery === undefined || window.jQuery.fn.jquery !== jqueryVersion) { loadScript(jqueryPath, initjQuery); } else { initjQuery(); } (function (window) { function CorsAjax() { this.post = function (url, data, callback) { $j.support.cors = true; var jqxhr; if ($j.browser.msie && window.XDomainRequest) { var xdr = new XDomainRequest(); var xUrl; var items = ''; if (data) { $j.each(data, function (key, val) { if (items == '') { items += "?"; items += key + '=' + val; } else { items += "&"; items += key + '=' + val; } }); xUrl = url + items; } else { xUrl = url; } xdr.open("post", xUrl); xdr.onload = function () { if (callback) { callback(JSON.parse(this.responseText), 'success'); } }; xdr.send(); } else { jqxhr = $j.post(url, data, callback, "json"); } }; this.get = function (url, callback, json) { $j.support.cors = true; var jqxhr = $j.get(url, callback) .error(function (jqXhHR, status, errorThrown) { if ($j.browser.msie && window.XDomainRequest) { var xdr = new XDomainRequest(); xdr.open("get", url); xdr.onload = function () { if (callback) { if (json) { callback(JSON.parse(this.responseText), 'success'); } else { callback(this.responseText, 'success'); } } }; xdr.send(); } else { console.log("corsAjax.get error: " + status + ", " + errorThrown); } }); }; }; window.corsAjax = new CorsAjax(); })(window); var intId; var loadDependentFiles = function () { /* json2.js */ if (typeof JSON !== "object") { JSON = {} } (function () { function f(n) { return n < 10 ? "0" + n : n } if (typeof Date.prototype.toJSON !== "function") { Date.prototype.toJSON = function () { return isFinite(this.valueOf()) ? this.getUTCFullYear() + "-" + f(this.getUTCMonth() + 1) + "-" + f(this.getUTCDate()) + "T" + f(this.getUTCHours()) + ":" + f(this.getUTCMinutes()) + ":" + f(this.getUTCSeconds()) + "Z" : null }; String.prototype.toJSON = Number.prototype.toJSON = Boolean.prototype.toJSON = function () { return this.valueOf() } } var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, gap, indent, meta = { "\b": "\\b", "\t": "\\t", "\n": "\\n", "\f": "\\f", "\r": "\\r", '"': '\\"', "\\": "\\\\" }, rep; function quote(string) { escapable.lastIndex = 0; return escapable.test(string) ? '"' + string.replace(escapable, function (a) { var c = meta[a]; return typeof c === "string" ? c : "\\u" + ("0000" + a.charCodeAt(0).toString(16)).slice(-4) }) + '"' : '"' + string + '"' } function str(key, holder) { var i, k, v, length, mind = gap, partial, value = holder[key]; if (value && typeof value === "object" && typeof value.toJSON === "function") { value = value.toJSON(key) } if (typeof rep === "function") { value = rep.call(holder, key, value) } switch (typeof value) { case "string": return quote(value); case "number": return isFinite(value) ? String(value) : "null"; case "boolean": case "null": return String(value); case "object": if (!value) { return "null" } gap += indent; partial = []; if (Object.prototype.toString.apply(value) === "[object Array]") { length = value.length; for (i = 0; i < length; i += 1) { partial[i] = str(i, value) || "null" } v = partial.length === 0 ? "[]" : gap ? "[\n" + gap + partial.join(",\n" + gap) + "\n" + mind + "]" : "[" + partial.join(",") + "]"; gap = mind; return v } if (rep && typeof rep === "object") { length = rep.length; for (i = 0; i < length; i += 1) { if (typeof rep[i] === "string") { k = rep[i]; v = str(k, value); if (v) { partial.push(quote(k) + (gap ? ": " : ":") + v) } } } } else { for (k in value) { if (Object.prototype.hasOwnProperty.call(value, k)) { v = str(k, value); if (v) { partial.push(quote(k) + (gap ? ": " : ":") + v) } } } } v = partial.length === 0 ? "{}" : gap ? "{\n" + gap + partial.join(",\n" + gap) + "\n" + mind + "}" : "{" + partial.join(",") + "}"; gap = mind; return v } } if (typeof JSON.stringify !== "function") { JSON.stringify = function (value, replacer, space) { var i; gap = ""; indent = ""; if (typeof space === "number") { for (i = 0; i < space; i += 1) { indent += " " } } else { if (typeof space === "string") { indent = space } } rep = replacer; if (replacer && typeof replacer !== "function" && (typeof replacer !== "object" || typeof replacer.length !== "number")) { throw new Error("JSON.stringify") } return str("", { "": value }) } } if (typeof JSON.parse !== "function") { JSON.parse = function (text, reviver) { var j; function walk(holder, key) { var k, v, value = holder[key]; if (value && typeof value === "object") { for (k in value) { if (Object.prototype.hasOwnProperty.call(value, k)) { v = walk(value, k); if (v !== undefined) { value[k] = v } else { delete value[k] } } } } return reviver.call(holder, key, value) } text = String(text); cx.lastIndex = 0; if (cx.test(text)) { text = text.replace(cx, function (a) { return "\\u" + ("0000" + a.charCodeAt(0).toString(16)).slice(-4) }) } if (/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, "@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, "]").replace(/(?:^|:|,)(?:\s*\[)+/g, ""))) { j = eval("(" + text + ")"); return typeof reviver === "function" ? walk({ "": j }, "") : j } throw new SyntaxError("JSON.parse") } } } ()); //spin.js !function (e, t, n) { function o(e, n) { var r = t.createElement(e || "div"), i; for (i in n) r[i] = n[i]; return r } function u(e) { for (var t = 1, n = arguments.length; t < n; t++) e.appendChild(arguments[t]); return e } function f(e, t, n, r) { var o = ["opacity", t, ~ ~(e * 100), n, r].join("-"), u = .01 + n / r * 100, f = Math.max(1 - (1 - e) / t * (100 - u), e), l = s.substring(0, s.indexOf("Animation")).toLowerCase(), c = l && "-" + l + "-" || ""; return i[o] || (a.insertRule("@" + c + "keyframes " + o + "{" + "0%{opacity:" + f + "}" + u + "%{opacity:" + e + "}" + (u + .01) + "%{opacity:1}" + (u + t) % 100 + "%{opacity:" + e + "}" + "100%{opacity:" + f + "}" + "}", a.cssRules.length), i[o] = 1), o } function l(e, t) { var i = e.style, s, o; if (i[t] !== n) return t; t = t.charAt(0).toUpperCase() + t.slice(1); for (o = 0; o < r.length; o++) { s = r[o] + t; if (i[s] !== n) return s } } function c(e, t) { for (var n in t) e.style[l(e, n) || n] = t[n]; return e } function h(e) { for (var t = 1; t < arguments.length; t++) { var r = arguments[t]; for (var i in r) e[i] === n && (e[i] = r[i]) } return e } function p(e) { var t = { x: e.offsetLeft, y: e.offsetTop }; while (e = e.offsetParent) t.x += e.offsetLeft, t.y += e.offsetTop; return t } var r = ["webkit", "Moz", "ms", "O"], i = {}, s, a = function () { var e = o("style", { type: "text/css" }); return u(t.getElementsByTagName("head")[0], e), e.sheet || e.styleSheet } (), d = { lines: 12, length: 7, width: 5, radius: 10, rotate: 0, corners: 1, color: "#000", speed: 1, trail: 100, opacity: .25, fps: 20, zIndex: 2e9, className: "spinner", top: "auto", left: "auto", position: "relative" }, v = function m(e) { if (!this.spin) return new m(e); this.opts = h(e || {}, m.defaults, d) }; v.defaults = {}, h(v.prototype, { spin: function (e) { this.stop(); var t = this, n = t.opts, r = t.el = c(o(0, { className: n.className }), { position: n.position, width: 0, zIndex: n.zIndex }), i = n.radius + n.length + n.width, u, a; e && (e.insertBefore(r, e.firstChild || null), a = p(e), u = p(r), c(r, { left: (n.left == "auto" ? a.x - u.x + (e.offsetWidth >> 1) : parseInt(n.left, 10) + i) + "px", top: (n.top == "auto" ? a.y - u.y + (e.offsetHeight >> 1) : parseInt(n.top, 10) + i) + "px" })), r.setAttribute("aria-role", "progressbar"), t.lines(r, t.opts); if (!s) { var f = 0, l = n.fps, h = l / n.speed, d = (1 - n.opacity) / (h * n.trail / 100), v = h / n.lines; (function m() { f++; for (var e = n.lines; e; e--) { var i = Math.max(1 - (f + e * v) % h * d, n.opacity); t.opacity(r, n.lines - e, i, n) } t.timeout = t.el && setTimeout(m, ~ ~(1e3 / l)) })() } return t }, stop: function () { var e = this.el; return e && (clearTimeout(this.timeout), e.parentNode && e.parentNode.removeChild(e), this.el = n), this }, lines: function (e, t) { function i(e, r) { return c(o(), { position: "absolute", width: t.length + t.width + "px", height: t.width + "px", background: e, boxShadow: r, transformOrigin: "left", transform: "rotate(" + ~ ~(360 / t.lines * n + t.rotate) + "deg) translate(" + t.radius + "px" + ",0)", borderRadius: (t.corners * t.width >> 1) + "px" }) } var n = 0, r; for (; n < t.lines; n++) r = c(o(), { position: "absolute", top: 1 + ~(t.width / 2) + "px", transform: t.hwaccel ? "translate3d(0,0,0)" : "", opacity: t.opacity, animation: s && f(t.opacity, t.trail, n, t.lines) + " " + 1 / t.speed + "s linear infinite" }), t.shadow && u(r, c(i("#000", "0 0 4px #000"), { top: "2px" })), u(e, u(r, i(t.color, "0 0 1px rgba(0,0,0,.1)"))); return e }, opacity: function (e, t, n) { t < e.childNodes.length && (e.childNodes[t].style.opacity = n) } }), function () { function e(e, t) { return o("<" + e + ' xmlns="urn:schemas-microsoft.com:vml" class="spin-vml">', t) } var t = c(o("group"), { behavior: "url(#default#VML)" }); !l(t, "transform") && t.adj ? (a.addRule(".spin-vml", "behavior:url(#default#VML)"), v.prototype.lines = function (t, n) { function s() { return c(e("group", { coordsize: i + " " + i, coordorigin: -r + " " + -r }), { width: i, height: i }) } function l(t, i, o) { u(a, u(c(s(), { rotation: 360 / n.lines * t + "deg", left: ~ ~i }), u(c(e("roundrect", { arcsize: n.corners }), { width: r, height: n.width, left: n.radius, top: -n.width >> 1, filter: o }), e("fill", { color: n.color, opacity: n.opacity }), e("stroke", { opacity: 0 })))) } var r = n.length + n.width, i = 2 * r, o = -(n.width + n.length) * 2 + "px", a = c(s(), { position: "absolute", top: o, left: o }), f; if (n.shadow) for (f = 1; f <= n.lines; f++) l(f, -2, "progid:DXImageTransform.Microsoft.Blur(pixelradius=2,makeshadow=1,shadowopacity=.3)"); for (f = 1; f <= n.lines; f++) l(f); return u(t, a) }, v.prototype.opacity = function (e, t, n, r) { var i = e.firstChild; r = r.shadow && r.lines || 0, i && t + r < i.childNodes.length && (i = i.childNodes[t + r], i = i && i.firstChild, i = i && i.firstChild, i && (i.opacity = n)) }) : s = l(t, "animation") } (), typeof define == "function" && define.amd ? define(function () { return v }) : e.Spinner = v } (window, document); //TT.Core (function () { String.format = function () { var f = arguments[0]; for (var d = 0; d < arguments.length - 1; d++) { var e = new RegExp("\\{" + d + "\\}", "gm"); f = f.replace(e, arguments[d + 1]) } return f }; if (typeof String.prototype.trim !== "function") { String.prototype.trim = function () { return this.replace(/^\s+|\s+$/g, "") } } if (typeof console == "undefined") { this.console = { log: function () { } } } var b = this, c = Object.prototype; if (b.TT == undefined) { b.TT = {} } TT.ttGlobal = b; var a = true; for (i in { toString: 1 }) { a = null } if (a) { a = ["hasOwnProperty", "valueOf", "isPrototypeOf", "propertyIsEnumerable", "toLocaleString", "toString", "constructor"] } TT.enumerables = a; TT.extend = function (g, f, l) { if (l) { TT.extend(g, l) } if (g && f && typeof f === "object") { var h, e, d; for (h in f) { g[h] = f[h] } if (a) { for (e = a.length; e - 1; ) { d = a[e]; if (f.hasOwnProperty(d)) { g[d] = f[d] } } } } return g }; TT.extendIf = function (e, d) { var f; if (e) { for (f in d) { if (e[f] === undefined) { e[f] = d[f] } } } return e }; TT.namespace = function () { var g = arguments.length, f, h, d, k, j, e; for (f = 0; f < g; f += 1) { h = arguments[f]; j = h.split("."); if (global.TT) { e = global[j[0]] = Object(global[j[0]]) } else { e = arguments.callee.caller.arguments[0] } for (d = 1, k = j.length; d < k; d + 1) { e = e[j[d]] = Object(e[j[d]]) } } return e }; TT = $j.extend({}, { ns: TT.namespace, isEmpty: function (e, d) { return (e == null) || ((TT.isArray(e) && !e.length)) || (!d ? e === "" : false) }, isDate: function (d) { return c.toString.apply(d) === "[object Date]" }, isFunction: function (d) { return c.toString.apply(d) === "[object Function]" }, isString: function (d) { return typeof d === "string" }, isBoolean: function (d) { switch (d.toLowerCase()) { case "true": case "yes": case "1": return true; case "false": case "no": case "0": case null: return false; default: return false } }, SetEllipsis: function (d, g, f, e) { d.on("click", function () { g.toggleClass("ellipsis", ""); var h = g.hasClass("ellipsis") ? f ? f : "View more" : e ? e : "View less"; d.text(h) }) }, isNull: function (d) { return d != undefined }, toHtmlEncode: function (d) { return $j("
").text(d).html() }, toHtmlDecode: function (d) { return $j("").html(d).text() }, getUrlParam: function (f, e) { e = e.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); var d = "[\\?&]" + e + "=([^]*)"; var h = new RegExp(d); var g = h.exec(f); if (g == null) { return "" } else { return g[1] } }, isValidFile: function (f, e) { if (!e) { return false } var h = false; while (e.indexOf("\\") != -1) { e = e.slice(e.indexOf("\\") + 1) } var g = e.slice(e.lastIndexOf(".")).toLowerCase(); for (var d = 0; d < f.length; d++) { if (f[d] == g) { h = true; break } } return h } }); TT.ModalProgress = $j.extend({}, { show: function (d) { var e = " "; $j("#pnlLoadingBar").fadeOut("slow"); $j("#pnlLoadingBar").remove(); var f = ""; if (d == undefined) { f = String.format(e, "") } else { f = String.format(e, d) } $j("body").prepend(f); $j("#pnlLoadingBar").fadeIn("slow"); if (typeof (Spinner) != "undefined") { var g = new Spinner().spin(); $j("#imgLoading")[0].appendChild(g.el) } else { $j("#imgLoading").html("Please wait...") } }, hide: function () { $j("#pnlLoadingBar").fadeOut("slow"); $j("#pnlLoadingBar").remove() } }); TT.callBack = function () { }; TT.ModalPopup = $j.extend({}, { show: function (g, j, f, h) { TT.ModalPopup.hide(); var l = " "; var m = ""; var e = m; var k = ""; if (typeof h == "function") { TT.callBack = h } else { if (typeof j == "function") { TT.callBack = j; j = "" } else { if (typeof f == "function") { TT.callBack = f; f = "" } } } if (!j || j == "") { j = "Askiitians" } if (!f || f == "") { f = true } if (!g) { g = "Please wait...." } k = String.format(l, j, g); if (f) { k = e + k } $j("body").prepend(k); var d = $j("#dvPopupMessage"); var n = $j("#dvOverlay"); n.fadeIn("fast"); d.fadeIn("fast"); $j(document).on("click", ".closepopup", function (o) { TT.ModalPopup.hide(TT.callBack); o.preventDefault(); return false }).on("keydown", function (o) { if (o.which == 27) { TT.ModalPopup.hide(TT.callBack); o.preventDefault(); return false } return true }); $j("#btnOk").focus() }, hide: function () { var e = $j("#dvPopupMessage"); var d = $j("#dvOverlay"); if (e) { e.fadeOut("fast", function () { e.remove() }) } if (d) { d.fadeOut("fast", function () { d.remove() }) } if (typeof TT.callBack == "function") { TT.callBack.apply(); TT.callBack = null } } }); TT.Object = { keyOf: function (d, f) { var e; for (e in d) { if (d.hasOwnProperty(e) && d[e] == f) { return e } } return null }, getValues: function (e) { var d = [], f; for (f in e) { if (e.hasOwnProperty(f)) { d.push(e[f]) } } return d }, getKeys: function (d) { var f = [], e; for (e in d) { if (d.hasOwnProperty(e)) { f.push(e) } } return f } } })(); var showModalPopup = function (b, d, c, a) { TT.ModalPopup.show(b, d, c, a) }; /*! * jQuery Cookie Plugin v1.4.0 * https://github.com/carhartl/jquery-cookie * * Copyright 2013 Klaus Hartl * Released under the MIT license */ (function (a) { if (typeof define === "function" && define.amd) { define(["jquery"], a); } else { a(jQuery); } } (function (f) { var a = /\+/g; function d(i) { return b.raw ? i : encodeURIComponent(i); } function g(i) { return b.raw ? i : decodeURIComponent(i); } function h(i) { return d(b.json ? JSON.stringify(i) : String(i)); } function c(i) { if (i.indexOf('"') === 0) { i = i.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, "\\"); } try { i = decodeURIComponent(i.replace(a, " ")); } catch (j) { return; } try { return b.json ? JSON.parse(i) : i; } catch (j) { } } function e(j, i) { var k = b.raw ? j : c(j); return f.isFunction(i) ? i(k) : k; } var b = f.cookie = function (q, p, v) { if (p !== undefined && !f.isFunction(p)) { v = f.extend({}, b.defaults, v); if (typeof v.expires === "number") { var r = v.expires, u = v.expires = new Date(); u.setDate(u.getDate() + r); } return (document.cookie = [d(q), "=", h(p), v.expires ? "; expires=" + v.expires.toUTCString() : "", v.path ? "; path=" + v.path : "", v.domain ? "; domain=" + v.domain : "", v.secure ? "; secure" : ""].join("")); } var w = q ? undefined : {}; var s = document.cookie ? document.cookie.split("; ") : []; for (var o = 0, m = s.length; o < m; o++) { var n = s[o].split("="); var j = g(n.shift()); var k = n.join("="); if (q && q === j) { w = e(k, p); break; } if (!q && (k = e(k)) !== undefined) { w[j] = k; } } return w; }; b.defaults = {}; f.removeCookie = function (j, i) { if (f.cookie(j) === undefined) { return false; } f.cookie(j, "", f.extend({}, i, { expires: -1 })); return !f.cookie(j); }; })); //CountryDropdown/ (function ($j) { $j.fn.countryISDCodeDropdown = function (options) { var defaultOptions = { hypCountryCode: '#hypCountryCode', spnCountryName: '#spnCountryName', txtMobile: '#txtMobile', target: 'forum', onChange: function (countryName) { } }, opt = $j.extend({}, defaultOptions, options), $ctxObj = {}; this.each(function () { $ctxObj.hypCountryCode = $j(opt.hypCountryCode); $ctxObj.spnCountryName = $j(opt.spnCountryName); $ctxObj.txtMobile = $j(opt.txtMobile); $ctxObj.dvCountryCodeMenu = $j(this); var lastHotKey = 0; var iteration = false; var iterationCount = 1; var currentItem; function onDropDoownChange() { var countryCode = $j(this).attr('data-code'); var countryName = $j(this).attr('data-country'); $ctxObj.dvCountryCodeMenu.hide(); $ctxObj.spnCountryName.html('+' + countryCode); $ctxObj.txtMobile.focus(); opt.onChange(countryName); } $ctxObj.dvCountryCodeMenu.show(); var menuHeight = $ctxObj.dvCountryCodeMenu.find('ul li:first').show().height(); $ctxObj.dvCountryCodeMenu.hide(); if (opt.target == 'loginpopup') { menuHeight = 24; } if (menuHeight === 0) { menuHeight = 23; } $ctxObj.dvCountryCodeMenu.find('ul li a').on('hover', function () { $ctxObj.dvCountryCodeMenu.find('ul li a').removeClass('selected'); }); $ctxObj.dvCountryCodeMenu.find('ul li a').on('focus', function () { $ctxObj.dvCountryCodeMenu.find('ul li a').removeClass('selected'); }); $j(document).on('keydown', function (e) { if ($ctxObj.dvCountryCodeMenu.is(':visible')) { var scrolLength = $ctxObj.dvCountryCodeMenu.scrollTop(); var keycode = (e.keyCode ? e.keyCode : e.which); if (keycode == 40 || keycode == 38) { switch (keycode) { case 38: scrolLength = scrolLength - menuHeight; if (currentItem > 0) currentItem -= 1; break; case 40: scrolLength = scrolLength + menuHeight; if (currentItem < 191) currentItem += 1; break; } $ctxObj.dvCountryCodeMenu.scrollTop(scrolLength); $ctxObj.dvCountryCodeMenu.find('ul li a').removeClass('selected'); $ctxObj.dvCountryCodeMenu.find('ul li:eq(' + currentItem + ') a').addClass('selected').focus(); e.preventDefault(); return false; } } }); $j(document).keypress(function (event) { var $li; if ($ctxObj.dvCountryCodeMenu.is(':visible')) { var searchkey = String.fromCharCode(event.which).toLowerCase(); var totalItems = 0; var isLastItem = false; $ctxObj.dvCountryCodeMenu.find('ul li a').each(function (index, item) { if ($j(item).text()[0].toLowerCase() == searchkey) { totalItems += 1; } }); $ctxObj.dvCountryCodeMenu.find('ul li a').each(function (index, item) { if ($j(item).text()[0].toLowerCase() == searchkey) { if (lastHotKey == event.which) { iterationCount += 1; iteration = true; } else { iteration = false; iterationCount = 0; } if (!iteration) { $li = $j(this).parent(); lastHotKey = event.which; return false; } if (iteration) { if (iterationCount == (totalItems - 1)) { isLastItem = true; } $li = $j(this).parent(); lastHotKey = event.which; var lastItemIndex = $li.index(); var newIndexItem = lastItemIndex + iterationCount; $li = $ctxObj.dvCountryCodeMenu.find('ul li:eq(' + newIndexItem + ')'); if (isLastItem) { iteration = false; iterationCount = 0; lastHotKey = 0; } return false; } } }); if ($li) { var height = menuHeight * $li.index(); currentItem = $li.index(); $ctxObj.dvCountryCodeMenu.scrollTop(height); $ctxObj.dvCountryCodeMenu.find('ul li a').removeClass('selected'); $li.find('a').addClass('selected').focus(); } } }); $j(document).click(function (event) { if (!$j(event.target).closest($ctxObj.hypCountryCode).length) { $ctxObj.dvCountryCodeMenu.hide(); } }); $ctxObj.hypCountryCode.on('click focus', function () { var countryCode = $ctxObj.spnCountryName.html().replace('+', ''); $ctxObj.txtMobile.addClass('selectbdr'); $ctxObj.dvCountryCodeMenu.show(); var $li = $ctxObj.dvCountryCodeMenu.find('ul li a[data-code="' + countryCode + '"]').parent(); currentItem = $li.index(); var height = menuHeight * $li.index(); $ctxObj.dvCountryCodeMenu.find('ul li a').removeClass('selected'); $li.find('a').addClass('selected').focus(); $ctxObj.dvCountryCodeMenu.scrollTop(height); }); $ctxObj.txtMobile.on('blur', function () { $ctxObj.txtMobile.removeClass('selectbdr'); }); $ctxObj.dvCountryCodeMenu.on('click', 'ul li a', onDropDoownChange); }); }; })($j); Ask.QuestionEmbeddedGab = function () { var $ctxObj = {}, opt = {}; var initEvents = function () { var countryOption = { txtMobile: '#txtRegMobile', hypCountryCode: '#hypCountryCode', spnCountryName: '#spnCountryName', target: 'loginpopup', onChange: function (country) { $ctxObj.countryName = country; } }; $ctxObj.dvCountryCodeMenu.countryISDCodeDropdown(countryOption); var friendCountryOption = { txtMobile: '#txtFriendMobile', hypCountryCode: '#hypFriendCountryCode', spnCountryName: '#spnFriendCountryName', target: 'loginpopup', onChange: function (country) { $ctxObj.friendCountryName = country; } }; $ctxObj.dvFriendCountryCodeMenu.countryISDCodeDropdown(friendCountryOption); $ctxObj.btnPostQuestion.off().on('click', function (e) { if (window.location.origin == baseUrl.replace(/\/$/, '') && $j.cookie(".ASPXAUTH") != null) { var questionSubmitDetail = { Description: $ctxObj.txtQuestion.val().trim().replace(/'/g, '`'), Category: $ctxObj.drpCategory.find('option:selected').text(), CategoryId: $ctxObj.drpCategory.val(), Source: document.referrer == "" ? window.location.href : document.referrer }; var urlSubmitQuestion = baseUrl + "Handler/BlogQuestionHandler.ashx?method=SubmitWidgetQuestion"; TT.ModalProgress.show(); corsAjax.post(urlSubmitQuestion, questionSubmitDetail, function (response) { if (response) { var message = response.ResponseMessage; TT.ModalProgress.hide(); if (response.IsError === false) { if (message) { showModalPopup(response.ResponseMessage, function () { $j('#divAuthentication').hide(); fillSecondStep(response.ResponseData); }); } else { showModalPopup('There is some problem while doing the requested operation. Please try once again. If you still face same problem please contact administrator'); } } else { showModalPopup(response.ResponseMessage); } } else { showModalPopup('There is some problem while doing the requested operation. Please try once again. If you still face same problem please contact administrator'); } }); } else { if ($ctxObj.drpCategory.prop('selectedIndex') == 0) { showModalPopup('Please choose category', function () { $ctxObj.drpCategory.focus(); }); return false; } if ($ctxObj.txtQuestion.val().trim() == '') { showModalPopup('Please enter question description', function () { $ctxObj.txtQuestion.focus(); }); return false; } $j('#divAuthentication').show(); $ctxObj.txtLoginEmail.focus(); e.preventDefault(); } }); $ctxObj.litab1.on('click', function () { $ctxObj.litab1.addClass('active'); $ctxObj.litab2.removeClass('active'); $ctxObj.tab1.show(); $ctxObj.txtLoginEmail.focus(); $ctxObj.tab2.hide(); }); $ctxObj.litab2.on('click', function () { $ctxObj.litab1.removeClass('active'); $ctxObj.litab2.addClass('active'); $ctxObj.tab2.show(); $ctxObj.txtRegName.focus(); $ctxObj.tab1.hide(); }); $ctxObj.txtCity.on('keyup', function () { $ctxObj.txtCity.val($ctxObj.txtCity.val().replace(/[^a-zA-z]$/, '')); }); $ctxObj.txtState.on('keyup', function () { $ctxObj.txtState.val($ctxObj.txtState.val().replace(/[^a-zA-z]$/, '')); }); $ctxObj.boxclose.on('click', function (e) { $j('#divAuthentication').hide(); e.preventDefault(); }); $ctxObj.btnLogin.off().on('click', function () { if ($ctxObj.txtLoginEmail.val().trim() == '') { showModalPopup('Please enter email id', function () { $ctxObj.txtLoginEmail.focus(); }); return false; } if ($ctxObj.txtLoginEmail.val() != '') { var lEmailInputString = /^\w[\w\.\_\-]*\w\@\w[\w\-\.]*\w\.[a-zA-z]{2,3}$/g; var lMatchArray = $ctxObj.txtLoginEmail.val().trim().match(lEmailInputString); if (lMatchArray == null) { showModalPopup("Please enter your valid email id.", function () { $ctxObj.txtLoginEmail.select().focus(); }); return false; } } if ($ctxObj.txtLoginPassword.val() == '') { showModalPopup('Please enter password', function () { $ctxObj.txtLoginPassword.focus(); }); return false; } var questionSubmitDetail = { Email: $ctxObj.txtLoginEmail.val().trim(), Password: $ctxObj.txtLoginPassword.val(), Description: $ctxObj.txtQuestion.val().trim().replace(/'/g, '`'), Category: $ctxObj.drpCategory.find('option:selected').text(), CategoryId: $ctxObj.drpCategory.val(), Source: document.referrer == "" ? window.location.href : document.referrer }; var urlSubmitQuestion = baseUrl + "Handler/BlogQuestionHandler.ashx?method=SubmitWidgetQuestion"; TT.ModalProgress.show(); corsAjax.post(urlSubmitQuestion, questionSubmitDetail, function (response) { if (response) { var message = response.ResponseMessage; TT.ModalProgress.hide(); if (response.IsError === false) { if (message) { if (window.location.origin == baseUrl.replace(/\/$/, '')) $j('#loginLogOut').empty().append('