// common function _e(id){var el = document.getElementById(id); el = el==undefined?document.createElement("span"):el; return el; }; function _cl(id, classid){ return classid==undefined?document.getElementsByClassName(id):document.getElementById(id).getElementsByClassName(classid); }; function isMail(id){return (/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i).test(id);}; function getnum(num){ num = Number(num.toString().trim()); return !isNaN(num)?num:0;}; function formatNum(num){ num = Number(num).toFixed(2); num = num.toString().replace(/\.00$/g, ""); return num;} function money(nStr) { nStr = formatNum(getnum(nStr)); nStr += ''; var x = nStr.split('.'), x1 = x[0], x2 = x.length > 1 ? '.' + x[1] : '', rgx = /(\d+)(\d{3})/; while (rgx.test(x1)) { x1 = x1.replace(rgx, '$1' + ',' + '$2');} return x1 + x2;} Element.prototype.addClass = function(name){if(!new RegExp(name, "gi").test(this.className)){this.className = this.className+" "+name;}return this;}; Element.prototype.removeClass = function(name){this.className = this.className.replace(new RegExp(name, "gi"), '').replace(/ {2,}/g, ' ').replace(/^ | $/gi, ''); return this;}; Element.prototype.switchClass = function(cl, add){add = add==undefined?true:add; this.className = (add?this.className+(!new RegExp(cl).test(this.className)?" "+cl:""):this.className.replace(new RegExp("(\ *)"+cl, "g"), "")).trim(); return this;}; Element.prototype.getClass = function(cl){var el = this.getElementsByClassName(cl); return el[0]!=undefined?el[0]:document.createElement("span");}; Element.prototype.parent = function (className){var obj = this; found = false; while(obj!=null && !found){ obj = obj.parentNode; found = obj!=null && new RegExp(className).test(obj.className);} return obj!=null?obj:document.createElement("span");}; function makeString(t,n,e){var o="",r="";for(n=void 0==n?10:n,t=void 0==t?"uln":t,o+=void 0!=e?e:"",o+=/u/.test(t)?"ABCDEFGHIJKLMNOPQRSTUVWXYZ":"",o+=/l/.test(t)?"abcdefgijklmnopqrstuvwxyz":"",o+=/n/.test(t)?"0123456789":"",o+=/s/.test(t)?"`~!@#$%^&*()_+-={}|][:;\"'<>,./?":"";r.length/g, '>')}; String.prototype.htmlDecode = function(){return this.replace(/\&\;/g, '&').replace(/\"\;/g, '"').replace(/\&\#39\;/g, '\'').replace(/\<\;/g, '<').replace(/\>\;/g, '>')}; String.prototype.enQuote = function(a){return this.replace(/"/g, '"').replace(/'/g, ''')}; String.prototype.deQuote = function(a){return this.replace(/\"\;/g, '"').replace(/\&\#39\;/g, '\'')}; function str2url(name){return name.trim().toLowerCase().replace(/[^0-9a-zA-Z]/g, '-').replace(/--+/g, '-').replace(/-$|^-/g, '')} Element.prototype.show = function(prop){this.style.display=prop||'block';return this} Element.prototype.hide = function(prop){this.style.display='none';return this} // global functions function inr(num, nZero){var r='0.00',appNum;num=Number(num);if(!isNaN(num)){num=num.toFixed(2);if(num.length>6){num=num.split('').reverse().join('');appNum=num.slice(0,6);for(i=6;i\
\ \
\
\ '+(attrs.text||'please wait..')+'\
\ '); }; $.fn.preloader_remove = function(){ var obj = $(this); obj.find(".hover-preloader").remove(); } // JavaScript Document var popup = { show : function(title, content, ops){ var infoMode=ops.mode=="info"; ops = ops==undefined?{}:ops; title = title!=undefined?title:""; content = content!=undefined?content:""; ops.closebtn = ops.closebtn!=undefined?ops.closebtn:true; if(infoMode){ title = '
'+title+'
'; content = '
'+content+'
'; ops.ok_btn = ops.ok_btn!=undefined?ops.ok_btn:true; ops.width = ops.width==undefined?500:ops.width; } var popObj = document.createElement("div"); if(ops.id!=undefined) popObj.id = ops.id; popObj.className = 'popup-frame'+(infoMode?' info-mode':''); popObj.innerHTML = ''; if(ops.closebtn){ $(popObj).find(".popup-close").click(function(e) { popup.hide($(this).parents(".popup-frame")); return false; }); } if(ops.ok_btn==true){ $(popObj).find(".ok_btn").click(function(e){ popup.hide($(this).parents(".popup-frame")); return false; }); } if(infoMode && !window.infoModeKeyEvtBound){ window.infoModeKeyEvtBound = 1; document.addEventListener('keypress', popup.onInfoModeCloseEvtTrack); } if(!popup.popupLastIx){ popup.popupLastIx = 7499; } popup.popupLastIx++; popObj.style.zIndex = popup.popupLastIx; $("body").prepend(popObj); if(ops.callback!=undefined){ ops.callback(); } popObj.resizeEvent = function(){ popup.updateHeight($(popObj)); }; $(window).bind("resize", popObj.resizeEvent); $("html").css({overflow:"hidden"}); popObj.resizeEvent(); }, hide : function(obj, ops){ ops = ops==undefined?{}:ops; obj = obj==undefined?$(".popup-frame"):$(obj); $(window).unbind("resize", obj[0].resizeEvent); obj.remove(); if(ops.callback!=undefined){ ops.callback(); } if($(".popup-frame").length==0){ $("html").css({overflow:""}); } }, updateHeight : function(obj){ var targetHeight = $(window).height() - 90; var limiter = obj.find('.limit-content'); if (limiter.find('> div').height() > targetHeight) { limiter.height(targetHeight).css({ overflow: 'auto', marginRight:"-15px", maxWidth:"none" }); }else if(obj.length>0){ limiter[0].style = {}; } }, showPreloader:function(msg, width, id){ this.show('', `
`+(msg||'Loading. Please wait..')+`
`, { width:width||400, closebtn:0, id:id }); }, onInfoModeCloseEvtTrack:function(e){ if(e.keyCode==13){ var lastInfo = $('.popup-frame.info-mode'); if(lastInfo[0]){ popup.hide(lastInfo[0]); } if(lastInfo.length<2){ delete window.infoModeKeyEvtBound; document.removeEventListener('keypress', popup.onInfoModeCloseEvtTrack); } } } } $(document).ready(function(e) { $(".confirm").click(function(e) { return confirm(this.dataset.message!=undefined?this.dataset.message:"Are you sure ?"); }); $("#mobileMenuBtn,#close").click(function(e){ $("#mobMenu").toggleClass("show_menu"); e.preventDefault(); }); }); function closeUserNoti() { setTimeout(function(){ $(".user-notification").remove(); }, 7000); } var pix={ openNotification:function(message, ok){ message = message||'Oops. An error occurred. Please try again.'; ok = ok||''; var msgCont = document.getElementById('notificationMsgLoader'), msgItem=document.createElement('div'); if(!msgCont){ msgCont = document.createElement('div'); msgCont.id = 'notificationMsgLoader'; document.body.appendChild(msgCont); } msgItem.className = 'notification-item'+(ok?' success':''); msgItem.innerHTML = message+''; msgItem.getClass('noti-close-btn').onclick = pix.winNotificationHide; $(msgItem).fadeIn(250); msgCont.appendChild(msgItem); $(msgItem).delay(15000).fadeOut(250, pix.winNotificationFadeOutCb); }, winNotificationHide:function(){ $(this.parentNode).clearQueue().fadeOut(250, pix.winNotificationFadeOutCb); }, winNotificationFadeOutCb:function(){ $(this).remove(); } };