/*!
* jQuery Cookie Plugin v1.4.1
* https://github.com/carhartl/jquery-cookie
*
* Copyright 2006, 2014 Klaus Hartl
* Released under the MIT license
*/
(function (factory) {
if (typeof define === 'function' && define.amd) {
// AMD (Register as an anonymous module)
define(['jquery'], factory);
} else if (typeof exports === 'object') {
// Node/CommonJS
module.exports = factory(require('jquery'));
} else {
// Browser globals
factory(jQuery);
}
}(function ($) {
var pluses = /\+/g;
function encode(s) {
return config.raw ? s : encodeURIComponent(s);
}
function decode(s) {
return config.raw ? s : decodeURIComponent(s);
}
function stringifyCookieValue(value) {
return encode(config.json ? JSON.stringify(value) : String(value));
}
function parseCookieValue(s) {
if (s.indexOf('"') === 0) {
// This is a quoted cookie as according to RFC2068, unescape...
s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
}
try {
// Replace server-side written pluses with spaces.
// If we can't decode the cookie, ignore it, it's unusable.
// If we can't parse the cookie, ignore it, it's unusable.
s = decodeURIComponent(s.replace(pluses, ' '));
return config.json ? JSON.parse(s) : s;
} catch(e) {}
}
function read(s, converter) {
var value = config.raw ? s : parseCookieValue(s);
return $.isFunction(converter) ? converter(value) : value;
}
var config = $.cookie = function (key, value, options) {
// Write
if (arguments.length > 1 && !$.isFunction(value)) {
options = $.extend({}, config.defaults, options);
if (typeof options.expires === 'number') {
var days = options.expires, t = options.expires = new Date();
t.setMilliseconds(t.getMilliseconds() + days * 864e+5);
}
return (document.cookie = [
encode(key), '=', stringifyCookieValue(value),
options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
options.path ? '; path=' + options.path : '',
options.domain ? '; domain=' + options.domain : '',
options.secure ? '; secure' : ''
].join(''));
}
// Read
var result = key ? undefined : {},
// To prevent the for loop in the first place assign an empty array
// in case there are no cookies at all. Also prevents odd result when
// calling $.cookie().
cookies = document.cookie ? document.cookie.split('; ') : [],
i = 0,
l = cookies.length;
for (; i < l; i++) {
var parts = cookies[i].split('='),
name = decode(parts.shift()),
cookie = parts.join('=');
if (key === name) {
// If second argument (value) is a function it's a converter...
result = read(cookie, value);
break;
}
// Prevent storing a cookie that we couldn't decode.
if (!key && (cookie = read(cookie)) !== undefined) {
result[name] = cookie;
}
}
return result;
};
config.defaults = {};
$.removeCookie = function (key, options) {
// Must not alter options, thus extending a fresh object...
$.cookie(key, '', $.extend({}, options, { expires: -1 }));
return !$.cookie(key);
};
}));
var RLANG = {
alert1: 'Message',
alert2: 'Close',
alert3: 'Save',
alert4: 'Enter to account',
enter: 'Enter',
entercode: 'Enter code',
sent: 'Message sent',
join: 'Register!',
sendp: 'Remind password',
errlogin: 'Error: Wrong Email format',
errpass: 'Error: Password has letters and digits',
errrnd: 'Error: Wrong code',
erract: 'Error: Wrong autentificate code',
authok: 'Login sucessful. Page reloading...',
empty: 'No items in you basket',
name: "Name",
tel: "Phone",
wrmail: "Email format is invalid.",
telchar: "The phone can only have numbers",
err:"Server communication error",
fields: "Field {0} must contain from {1} to {2} characters.",
msg: "Send message"
};
var Alert={
w:null,
settings: {'title':RLANG.alert1,'bclose':RLANG.alert2,'bsave':RLANG.alert3,breg:'','save':0,'onclose':function(){},'onsave':function(e){},'onreg':null},
fields:['title','bclose','bsave','body','breg'],
onclose:null,
onsave:null,
onreg:null,
mt:null,
bs:null,
bc:null,
br:null,
save:0,
alert:function(t){
if(typeof(t)=='string') {
t={'body':t,'save':0};
}
this.flds(t);
this.w.modal('show');
},
load:function(t,tt){
var r='';
$.get(t, function(r) {
if(tt!=undefined) {
Alert.alert({'body':r,'save':0,'title':tt,'class':'wide'});
} else {
Alert.alert(r);
}
});
},
rebind:function(){
this.bs.off('click');
this.bs.one('click',function(e){
Alert.onsave(e);
});
},
noclose:function(s){
this.w.modal({backdrop:false});
var ee=this.w.data('bs.modal');
if(s==undefined) {
ee._config.backdrop = 'static';
} else {
ee._config.backdrop = 'false';
}
},
wait:function(rem){
if(rem!=undefined){
$('#walert .modal-bsave').removeClass('waiting btn-disabled').prop('disbled',false);
$('.modal-bclose,.btn-close',$('#walert')).show();
} else {
//console.log('a');
$('.modal-bclose,.btn-close',$('#walert')).hide();
$('#walert .modal-bsave').addClass('waiting').prop('disbled',true);
}
},
flds:function(t){
//console.log(t);
var s=$.extend(true,{},this.settings);
$.extend(s, t);
this.save=t.save;
if(t.save) {$('#walert .modal-bsave').removeClass('d-none');}
else {$('#walert .modal-bsave').addClass('d-none');}
for (var k in this.fields) {
//console.log(this.fields[k]);
if(typeof this.fields[k]=='string') {
$('.modal-'+this.fields[k],this.w).html(s[this.fields[k]]);
}
}
this.w.children().attr('class','modal-dialog'+(s.class==''?'':' '+s.class));
//console.log(this.onreg);
// this.br.attr('class','btn btn-warning modal-breg'+(t.onreg==null?' hidden':''));
if(t.onsave!=undefined){
this.onsave=t.onsave;
console.log('a');
this.bs.off('click');
this.bs.one('click',function(e1){
console.log('b');
try{
Alert.onsave(e1);
} catch (e) {
if (e instanceof SyntaxError) {
alert(e.message);
}
}
Alert.bc.off('click');});
}
if(t.onreg!=undefined){
this.onreg=t.onreg;
this.br.off('click');
this.br.one('click',function(){
try{
Alert.onreg();
} catch (e) {
if (e instanceof SyntaxError) {
alert(e.message);
}
}
Alert.br.off('click');});
}
if(t.onclose!=undefined){
this.onclose=t.onclose;
/* this.bc.one('click',function(){
try{
Alert.onclose();
} catch (e) {
if (e instanceof SyntaxError) {
alert(e.message);
}
}
Alert.bs.off('click');});
*/
}
},
confirm:function(t){
this.flds(t);
this.w.modal('show');
},
show:function(){this.w.modal('show');},
close:function(){this.w.modal('hide');return true;},
init:function(o){
r='
';
$('body').append(r);
this.w=$('#walert');
this.bs=$('.modal-bsave',this.w);
this.bc=$('.modal-bclose',this.w);
if(o!=undefined){this.br=$('.modal-breg',this.w);}
$(document.body).on('click','.modal-bclose',function(){
try{
Alert.onclose();
} catch (e) {
if (e instanceof SyntaxError) {
alert(e.message);
}
}
});
// this.bs.off('click');
$(document.body).on('click','.modal-bsave',function(){
//console.log(Alert.onsave);
//return false;
if(Alert.save==1){
try{
Alert.onsave();
} catch (e) {
if (e instanceof SyntaxError) {
alert(e.message);
}
}}
});
// $('body').on('click.modal.data-api', function (e) {
// console.log(e.target);
// });
},
};
/*!
* ClockPicker v0.0.7 (http://weareoutman.github.io/clockpicker/)
* Copyright 2014 Wang Shenwei.
* Licensed under MIT (https://github.com/weareoutman/clockpicker/blob/gh-pages/LICENSE)
*/
!function(){function t(t){return document.createElementNS(p,t)}function i(t){return(10>t?"0":"")+t}function e(t){var i=++m+"";return t?t+i:i}function s(s,r){function p(t,i){var e=u.offset(),s=/^touch/.test(t.type),o=e.left+b,n=e.top+b,p=(s?t.originalEvent.touches[0]:t).pageX-o,h=(s?t.originalEvent.touches[0]:t).pageY-n,k=Math.sqrt(p*p+h*h),v=!1;if(!i||!(g-y>k||k>g+y)){t.preventDefault();var m=setTimeout(function(){c.addClass("clockpicker-moving")},200);l&&u.append(x.canvas),x.setHand(p,h,!i,!0),a.off(d).on(d,function(t){t.preventDefault();var i=/^touch/.test(t.type),e=(i?t.originalEvent.touches[0]:t).pageX-o,s=(i?t.originalEvent.touches[0]:t).pageY-n;(v||e!==p||s!==h)&&(v=!0,x.setHand(e,s,!1,!0))}),a.off(f).on(f,function(t){a.off(f),t.preventDefault();var e=/^touch/.test(t.type),s=(e?t.originalEvent.changedTouches[0]:t).pageX-o,l=(e?t.originalEvent.changedTouches[0]:t).pageY-n;(i||v)&&s===p&&l===h&&x.setHand(s,l),"hours"===x.currentView?x.toggleView("minutes",A/2):r.autoclose&&(x.minutesView.addClass("clockpicker-dial-out"),setTimeout(function(){x.done()},A/2)),u.prepend(j),clearTimeout(m),c.removeClass("clockpicker-moving"),a.off(d)})}}var h=n(V),u=h.find(".clockpicker-plate"),v=h.find(".clockpicker-hours"),m=h.find(".clockpicker-minutes"),T=h.find(".clockpicker-am-pm-block"),C="INPUT"===s.prop("tagName"),H=C?s:s.find("input"),P=s.find(".input-group-addon"),x=this;if(this.id=e("cp"),this.element=s,this.options=r,this.isAppended=!1,this.isShown=!1,this.currentView="hours",this.isInput=C,this.input=H,this.addon=P,this.popover=h,this.plate=u,this.hoursView=v,this.minutesView=m,this.amPmBlock=T,this.spanHours=h.find(".clockpicker-span-hours"),this.spanMinutes=h.find(".clockpicker-span-minutes"),this.spanAmPm=h.find(".clockpicker-span-am-pm"),this.amOrPm="PM",r.twelvehour){{var S=['','",'","
"].join("");n(S)}n('').on("click",function(){x.amOrPm="AM",n(".clockpicker-span-am-pm").empty().append("AM")}).appendTo(this.amPmBlock),n('').on("click",function(){x.amOrPm="PM",n(".clockpicker-span-am-pm").empty().append("PM")}).appendTo(this.amPmBlock)}r.autoclose||n('").click(n.proxy(this.done,this)).appendTo(h),"top"!==r.placement&&"bottom"!==r.placement||"top"!==r.align&&"bottom"!==r.align||(r.align="left"),"left"!==r.placement&&"right"!==r.placement||"left"!==r.align&&"right"!==r.align||(r.align="top"),h.addClass(r.placement),h.addClass("clockpicker-align-"+r.align),this.spanHours.click(n.proxy(this.toggleView,this,"hours")),this.spanMinutes.click(n.proxy(this.toggleView,this,"minutes")),H.on("focus.clockpicker click.clockpicker",n.proxy(this.show,this)),P.on("click.clockpicker",n.proxy(this.toggle,this));var E,D,I,B,z=n('');if(r.twelvehour)for(E=1;13>E;E+=1)D=z.clone(),I=E/6*Math.PI,B=g,D.css("font-size","120%"),D.css({left:b+Math.sin(I)*B-y,top:b-Math.cos(I)*B-y}),D.html(0===E?"00":E),v.append(D),D.on(k,p);else for(E=0;24>E;E+=1){D=z.clone(),I=E/6*Math.PI;var O=E>0&&13>E;B=O?w:g,D.css({left:b+Math.sin(I)*B-y,top:b-Math.cos(I)*B-y}),O&&D.css("font-size","120%"),D.html(0===E?"00":E),v.append(D),D.on(k,p)}for(E=0;60>E;E+=5)D=z.clone(),I=E/30*Math.PI,D.css({left:b+Math.sin(I)*g-y,top:b-Math.cos(I)*g-y}),D.css("font-size","120%"),D.html(i(E)),m.append(D),D.on(k,p);if(u.on(k,function(t){0===n(t.target).closest(".clockpicker-tick").length&&p(t,!0)}),l){var j=h.find(".clockpicker-canvas"),L=t("svg");L.setAttribute("class","clockpicker-svg"),L.setAttribute("width",M),L.setAttribute("height",M);var U=t("g");U.setAttribute("transform","translate("+b+","+b+")");var W=t("circle");W.setAttribute("class","clockpicker-canvas-bearing"),W.setAttribute("cx",0),W.setAttribute("cy",0),W.setAttribute("r",2);var N=t("line");N.setAttribute("x1",0),N.setAttribute("y1",0);var X=t("circle");X.setAttribute("class","clockpicker-canvas-bg"),X.setAttribute("r",y);var Y=t("circle");Y.setAttribute("class","clockpicker-canvas-fg"),Y.setAttribute("r",3.5),U.appendChild(N),U.appendChild(X),U.appendChild(Y),U.appendChild(W),L.appendChild(U),j.append(L),this.hand=N,this.bg=X,this.fg=Y,this.bearing=W,this.g=U,this.canvas=j}o(this.options.init)}function o(t){t&&"function"==typeof t&&t()}var c,n=window.jQuery,r=n(window),a=n(document),p="http://www.w3.org/2000/svg",l="SVGAngle"in window&&function(){var t,i=document.createElement("div");return i.innerHTML="",t=(i.firstChild&&i.firstChild.namespaceURI)==p,i.innerHTML="",t}(),h=function(){var t=document.createElement("div").style;return"transition"in t||"WebkitTransition"in t||"MozTransition"in t||"msTransition"in t||"OTransition"in t}(),u="ontouchstart"in window,k="mousedown"+(u?" touchstart":""),d="mousemove.clockpicker"+(u?" touchmove.clockpicker":""),f="mouseup.clockpicker"+(u?" touchend.clockpicker":""),v=navigator.vibrate?"vibrate":navigator.webkitVibrate?"webkitVibrate":null,m=0,b=100,g=80,w=54,y=13,M=2*b,A=h?350:1,V=['','
','
',''," : ",'','',"
",'
","
"].join("");s.DEFAULTS={"default":"",fromnow:0,placement:"bottom",align:"left",donetext:"完成",autoclose:!1,twelvehour:!1,vibrate:!0},s.prototype.toggle=function(){this[this.isShown?"hide":"show"]()},s.prototype.locate=function(){var t=this.element,i=this.popover,e=t.offset(),s=t.outerWidth(),o=t.outerHeight(),c=this.options.placement,n=this.options.align,r={};switch(i.show(),c){case"bottom":r.top=e.top+o;break;case"right":r.left=e.left+s;break;case"top":r.top=e.top-i.outerHeight();break;case"left":r.left=e.left-i.outerWidth()}switch(n){case"left":r.left=e.left;break;case"right":r.left=e.left+s-i.outerWidth();break;case"top":r.top=e.top;break;case"bottom":r.top=e.top+o-i.outerHeight()}i.css(r)},s.prototype.show=function(){if(!this.isShown){o(this.options.beforeShow);var t=this;this.isAppended||(c=n(document.body).append(this.popover),r.on("resize.clockpicker"+this.id,function(){t.isShown&&t.locate()}),this.isAppended=!0);var e=((this.input.prop("value")||this.options["default"]||"")+"").split(":");if("now"===e[0]){var s=new Date(+new Date+this.options.fromnow);e=[s.getHours(),s.getMinutes()]}this.hours=+e[0]||0,this.minutes=+e[1]||0,this.spanHours.html(i(this.hours)),this.spanMinutes.html(i(this.minutes)),this.toggleView("hours"),this.locate(),this.isShown=!0,a.on("click.clockpicker."+this.id+" focusin.clockpicker."+this.id,function(i){var e=n(i.target);0===e.closest(t.popover).length&&0===e.closest(t.addon).length&&0===e.closest(t.input).length&&t.hide()}),a.on("keyup.clockpicker."+this.id,function(i){27===i.keyCode&&t.hide()}),o(this.options.afterShow)}},s.prototype.hide=function(){o(this.options.beforeHide),this.isShown=!1,a.off("click.clockpicker."+this.id+" focusin.clockpicker."+this.id),a.off("keyup.clockpicker."+this.id),this.popover.hide(),o(this.options.afterHide)},s.prototype.toggleView=function(t,i){var e=!1;"minutes"===t&&"visible"===n(this.hoursView).css("visibility")&&(o(this.options.beforeHourSelect),e=!0);var s="hours"===t,c=s?this.hoursView:this.minutesView,r=s?this.minutesView:this.hoursView;this.currentView=t,this.spanHours.toggleClass("text-primary",s),this.spanMinutes.toggleClass("text-primary",!s),r.addClass("clockpicker-dial-out"),c.css("visibility","visible").removeClass("clockpicker-dial-out"),this.resetClock(i),clearTimeout(this.toggleViewTimer),this.toggleViewTimer=setTimeout(function(){r.css("visibility","hidden")},A),e&&o(this.options.afterHourSelect)},s.prototype.resetClock=function(t){var i=this.currentView,e=this[i],s="hours"===i,o=Math.PI/(s?6:30),c=e*o,n=s&&e>0&&13>e?w:g,r=Math.sin(c)*n,a=-Math.cos(c)*n,p=this;l&&t?(p.canvas.addClass("clockpicker-canvas-out"),setTimeout(function(){p.canvas.removeClass("clockpicker-canvas-out"),p.setHand(r,a)},t)):this.setHand(r,a)},s.prototype.setHand=function(t,e,s,o){var c,r=Math.atan2(t,-e),a="hours"===this.currentView,p=Math.PI/(a||s?6:30),h=Math.sqrt(t*t+e*e),u=this.options,k=a&&(g+w)/2>h,d=k?w:g;if(u.twelvehour&&(d=g),0>r&&(r=2*Math.PI+r),c=Math.round(r/p),r=c*p,u.twelvehour?a?0===c&&(c=12):(s&&(c*=5),60===c&&(c=0)):a?(12===c&&(c=0),c=k?0===c?12:c:0===c?0:c+12):(s&&(c*=5),60===c&&(c=0)),this[this.currentView]!==c&&v&&this.options.vibrate&&(this.vibrateTimer||(navigator[v](10),this.vibrateTimer=setTimeout(n.proxy(function(){this.vibrateTimer=null},this),100))),this[this.currentView]=c,this[a?"spanHours":"spanMinutes"].html(i(c)),!l)return void this[a?"hoursView":"minutesView"].find(".clockpicker-tick").each(function(){var t=n(this);t.toggleClass("active",c===+t.html())});o||!a&&c%5?(this.g.insertBefore(this.hand,this.bearing),this.g.insertBefore(this.bg,this.fg),this.bg.setAttribute("class","clockpicker-canvas-bg clockpicker-canvas-bg-trans")):(this.g.insertBefore(this.hand,this.bg),this.g.insertBefore(this.fg,this.bg),this.bg.setAttribute("class","clockpicker-canvas-bg"));var f=Math.sin(r)*d,m=-Math.cos(r)*d;this.hand.setAttribute("x2",f),this.hand.setAttribute("y2",m),this.bg.setAttribute("cx",f),this.bg.setAttribute("cy",m),this.fg.setAttribute("cx",f),this.fg.setAttribute("cy",m)},s.prototype.done=function(){o(this.options.beforeDone),this.hide();var t=this.input.prop("value"),e=i(this.hours)+":"+i(this.minutes);this.options.twelvehour&&(e+=this.amOrPm),this.input.prop("value",e),e!==t&&(this.input.triggerHandler("change"),this.isInput||this.element.trigger("change")),this.options.autoclose&&this.input.trigger("blur"),o(this.options.afterDone)},s.prototype.remove=function(){this.element.removeData("clockpicker"),this.input.off("focus.clockpicker click.clockpicker"),this.addon.off("click.clockpicker"),this.isShown&&this.hide(),this.isAppended&&(r.off("resize.clockpicker"+this.id),this.popover.remove())},n.fn.clockpicker=function(t){var i=Array.prototype.slice.call(arguments,1);return this.each(function(){var e=n(this),o=e.data("clockpicker");if(o)"function"==typeof o[t]&&o[t].apply(o,i);else{var c=n.extend({},s.DEFAULTS,e.data(),"object"==typeof t&&t);e.data("clockpicker",new s(e,c))}})}}();
/**
* @package PickMeUp - jQuery datepicker plugin
* @author Nazar Mokrynskyi
* @author Stefan Petre
* @copyright Copyright (c) 2013-2014, Nazar Mokrynskyi
* @copyright Copyright (c) 2008-2009, Stefan Petre
* @license MIT License, see license.txt
*/
(function(d){function getMaxDays(){var tmpDate=new Date(this.toString()),d=28,m=tmpDate.getMonth();while(tmpDate.getMonth()==m){++d;tmpDate.setDate(d);}return d-1;}d.addDays=function(n){this.setDate(this.getDate()+n);};d.addMonths=function(n){var day=this.getDate();this.setDate(1);this.setMonth(this.getMonth()+n);this.setDate(Math.min(day,getMaxDays.apply(this)));};d.addYears=function(n){var day=this.getDate();this.setDate(1);this.setFullYear(this.getFullYear()+n);this.setDate(Math.min(day,getMaxDays.apply(this)));};d.getDayOfYear=function(){var now=new Date(this.getFullYear(),this.getMonth(),this.getDate(),0,0,0);var then=new Date(this.getFullYear(),0,0,0,0,0);var time=now-then;return Math.floor(time/24*60*60*1000);};})(Date.prototype);(function($){$.pickmeup=$.extend($.pickmeup||{},{date:new Date,flat:false,first_day:1,prev:"◀",next:"▶",mode:"single",view:"days",calendars:1,format:"d-m-Y",position:"bottom",trigger_event:"click",class_name:"",separator:" - ",hide_on_select:false,min:null,max:null,render:function(){},change:function(){return true;},before_show:function(){return true;},show:function(){return true;},hide:function(){return true;},locale:{days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],daysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sun"],daysMin:["Su","Mo","Tu","We","Th","Fr","Sa","Su"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]}});var views={years:"pmu-view-years",months:"pmu-view-months",days:"pmu-view-days"},tpl={wrapper:'',head:function(d){var result="";for(var i=0;i<7;++i){result+=""+d.day[i]+"
";}return'";},days:function(days){var result="";for(var i=0;i<42;++i){result+=''+days[i].text+"
";}return''+result+"
";},months:function(d){var result="";for(var i=0;i<12;++i){result+=''+d.data[i]+"
";}return''+result+"
";}};function fill(){var options=$(this).data("pickmeup-options"),pickmeup=this.pickmeup,current_cal=Math.floor(options.calendars/2),date,data,header,year,day,month,count=0,days,html,instance,today=(new Date).setHours(0,0,0,0).valueOf();pickmeup.find(".pmu-instance > :not(nav)").remove();for(var i=0;idate)||(options.max&&options.max-1||(options.mode=="range"&&val>=options.date[0]&&val<=options.date[1]))){if(val==options.date[0]&&!nm){day.class_name.push('st');}if(val==options.date[1]-86399000 && !options.lastSel && !nm){day.class_name.push('fin');}day.class_name.push("pmu-selected");}if(val==today){day.class_name.push("pmu-today");}if(from_user.disabled||disabled){day.class_name.push("pmu-disabled");}if(from_user.class_name){day.class_name.push(from_user.class_name);}day.class_name=day.class_name.join(" ");data.push(day);date.addDays(1);count++;}html=tpl.days(data)+html;data={data:options.locale.monthsShort,class_name:"pmu-months"};html=tpl.months(data)+html;instance.append(html);}}function parseDate(date,format,separator){if(date.constructor==Date){return date;}else{if(!date){return new Date;}}var splitted_date=date.split(separator);if(splitted_date.length>1){splitted_date.forEach(function(element,index,array){array[index]=parseDate(element,format,separator);});return splitted_date;}var parts=date.split(/\W+/),against=format.split(/\W+/),d,m,y,h,min,now=new Date();for(var i=0;i100?0:(y<29?2000:1900);break;case"H":case"I":case"k":case"l":h=parseInt(parts[i],10);break;case"P":case"p":if(/pm/i.test(parts[i])&&h<12){h+=12;}else{if(/am/i.test(parts[i])&&h>=12){h-=12;}}break;case"M":min=parseInt(parts[i],10);break;}}return new Date(y===undefined?now.getFullYear():y,m===undefined?now.getMonth():m,d===undefined?now.getDate():d,h===undefined?now.getHours():h,min===undefined?now.getMinutes():min,0);}function formatDate(date,format,locale){var m=date.getMonth();var d=date.getDate();var y=date.getFullYear();var w=date.getDay();var s={};var hr=date.getHours();var pm=(hr>=12);var ir=(pm)?(hr-12):hr;var dy=date.getDayOfYear();if(ir==0){ir=12;}var min=date.getMinutes();var sec=date.getSeconds();var parts=format.split(""),part;for(var i=0;i15?-1:1);}current_date.setDate(val);switch(options.mode){case"multiple":val=(current_date.setHours(0,0,0,0)).valueOf();if($.inArray(val,options.date)>-1){$.each(options.date,function(nr,dat){if(dat==val){options.date.splice(nr,1);return false;}return true;});}else{options.date.push(val);}break;case"range":if(!options.lastSel){options.date[0]=(current_date.setHours(0,0,0,0)).valueOf();}val=(current_date.setHours(23,59,59,0)).valueOf();if(valviewport.t+viewport.h){top=pos.top-pickmeup.offsetHeight;}if(topviewport.l+viewport.w){left=pos.left-pickmeup.offsetWidth;}if(left',
code:'',
auu:''
}
$('.ico-user').on('click',function(){
//console.log('open');
open();
return false;
});
this.open=function(){
Modal.modal({keyboard: false});
Alert.flds({'title':RLANG.alert4,'body':val.form,'save':1,'bsave':RLANG.enter,'onsave':function(){userauth();}});
}
this.bind=function(){
$(document.body).on('click','#sndp',function(){sp(this);});
};
bind();
this.sp=function(th,a){
if ($('#fpass img').length || a) {
if(val.auu){$('#fpass').html(val.auu);}
$('.modal-bsave').text(RLANG.enter);
// $(th).text(RLANG.sendp);
} else {
val.auu=$('#fpass').html();
$('#fpass').html(val.code);
$('.modal-bsave',Modal).text(RLANG.sendp);
// $(th).text(RLANG.login);
}
Alert.rebind();
};
this.err=function(th,t){
val.active=th;
alrt(t);
$('#subres').css({background:'#d99'}).addClass('err').show();
$(th).addClass('err').bind('blur',function(){$(this).removeClass('err');$('#subres').html('').removeClass('err').css({background:''}).hide();});
return false;
};
this.ok=function(r){
r=r.replace(/^ok\:/i,'');
$('#subres').html(r).slideDown().addClass('ok');
clearTimeout(TMS);
TMS=setTimeout(function(){$('#sndp').trigger('click');},5000);
TMS=setTimeout(function(){$('#subres').slideUp();},15000);
},
this.alrt=function(t){
$('#subres').html(t).slideDown();
setTimeout(function(){$('#subres').slideUp();},5000);
};
function userauth() {
this.auth();
}
this.auth=function(){
//console.log('b');
if (!$("#umail").val().match(/^\+?[a-z\d\-_\@\.]+$/i)) {
return err("#umail",RLANG.errlogin);
}
var pwd=($('#aupass').length?$('#aupass').val():'');
console.log(pwd);
if ($('#aupass').length && (!pwd.length || !pwd.match(/^[a-z\d\-_\@\.]{2,25}$/i))) {
return err("#aupass",RLANG.errpass);
} else if ($("#randnum").length && !$("#randnum").val().match(/^[\d]{4,10}$/i)) {
return err("#randnum",RLANG.errrnd);
} else if ($("#authcode").length && !$("#authcode").val().match(/^[a-z\d]{7,30}$/i)) {
return err("#authcode",RLANG.erract);
}
var llg=(typeof Lang!='undefined'?Lang:'');
$.ajax({
type: "POST", url: '/auth.php',dataType:'json',data:{'mtd':'s','login':$('#umail').val(),'pass':$('#aupass').val(),'sendpass':$("#fpass input[type='hidden']").length,'randnum':$('#randnum').val(),'Lang':llg},
cache: false, success: function(r){
// auth.mail=$('#umail').val();
if (r.result=='ok') {
alrt(RLANG.authok);
$('#subres').addClass('ok');
location.reload();
// } else if (r.match(/^\d+::[a-z]+$/)) {
// alrt(RLANG.authok);
// $('#subres').addClass('ok');
// x=r.split(/::/);
// location.href='/'+(llg?llg+'/':'')+x[1]+'.html';
} else if (r.result=='sent') {
alrt(r.msg);
$('#subres').addClass('ok');
sp(this);
} else if (r.result=='error') {
$('#subres').addClass('err');
alrt(r.msg);
} else if (r) {
if (r.match(/^ok:/)) {
ok(r);
} else {
$('#subres').addClass('err');
alrt(r);
}
}
}});
return false;
}
}
var last;
$(function(){
if(!$('.calend').length) $(document.body).append('
');
$('.calend').pickmeup({
flat : true,
min: new Date(1945,1,1),
calendars : 1,
change:function(a,e){change(a,e);},
render : function (date) {
return {};
}
// locale:ctext
});
$('.calend>.ico-cancel').bind('click',function(){$('.calend').hide();return false;});
$('#date').click(function(){
last=this;
var ss= $(window).scrollTop();
var b=window.pageYOffset;
var l=$(this).offset();
var w=$(this).width();
// if($(this).parent().attr('id')=='today'){ss=0;}
//console.log(l,w,$(window).width());
//alert(l.top-b+' - '+ss);
var lf=$(window).width()-(l.left+w)+40;
var dnw=$(this).val();
if(dnw) {
var y=dnw.split('-');
f2 = new Date(y[2], (y[1]-1), y[0]);
} else {
f2 = new Date(1972,7,15);
}
$('.calend').pickmeup('set_date', f2);
$('.calend').css({width:(lf<11?'250px':'auto'),'right':lf,'top':(l.top-b-5+ss)}).toggle();
return false;
});
this.format=function(a){
var x=a.split('-');
var i=Math.round(x[1])-1;
// return x[0]+' '+ctext.months2[i]+' '+x[2];
}
var change=function(a,e){
//alert(a);
$(last).val(a).data('val',a);
$('.calend').hide();
console.log(a,e);
}
});