');
} else {
fn_beforeSend(D, $this);
}
},
success: function(responce) {
// ������� ����� �������� �� ������ �����������
$this.trigger('afterLoading');
D.afterLoading(D, $this, responce);
if (fn_success==undefined) {
D.body.html(responce);
} else {
fn_success(D, $this, responce);
}
modal.prepare_body(D, $this);
// ������� ����� �������� ����� ����������� �����������
$this.trigger('afterLoadingOnShow');
D.afterLoadingOnShow(D, $this, responce);
},
error: function() {
// ������� ��� ������ ��������
$this.trigger('errorLoading');
D.errorLoading(D, $this);
if (fn_error==undefined) {
D.body.html(D.errors.tpl);
$('.arcticmodal-error', D.body).html(D.errors.ajax_unsuccessful_load);
$('.arcticmodal-close', D.body).click(function() {
$this.arcticmodal('close');
return false;
});
if (D.errors.autoclose_delay)
setTimeout(function() {
$this.arcticmodal('close');
}, D.errors.autoclose_delay);
} else {
fn_error(D, $this);
}
}
}, D.ajax);
D.ajax_request = $.ajax(o);
// ��������� ���������
$this.data('arcticmodal', D);
},
// �������������
init: function(options) {
options = $.extend(true, {}, default_options, options);
if ($.isFunction(this)) {
if (options==undefined) {
$.error('jquery.arcticmodal: Uncorrect parameters');
return;
}
if (options.type=='') {
$.error('jquery.arcticmodal: Don\'t set parameter "type"');
return;
}
switch (options.type) {
case 'html':
if (options.content=='') {
$.error('jquery.arcticmodal: Don\'t set parameter "content"');
return
}
var c = options.content;
options.content = '';
return modal.init_el($(c), options);
break;
case 'ajax':
if (options.url=='') {
$.error('jquery.arcticmodal: Don\'t set parameter "url"');
return;
}
return modal.init_el($('
'), options);
break;
}
} else {
return this.each(function() {
modal.init_el($(this), $.extend(true, {}, options));
});
}
}
};
var actions = {
// ��������
show: function() {
var $this = modal.getParentEl(this);
if ($this===false) {
$.error('jquery.arcticmodal: Uncorrect call');
return;
}
var D = $this.data('arcticmodal');
// �������� overlay � container
D.overlay.block.hide();
D.container.block.hide();
$('BODY').append(D.overlay.block);
$('BODY').append(D.container.block);
// �������
D.beforeOpen(D, $this);
$this.trigger('beforeOpen');
// Wrap
if (D.wrap.css('overflow')!='hidden') {
D.wrap.data('arcticmodalOverflow', D.wrap.css('overflow'));
var w1 = D.wrap.outerWidth(true);
D.wrap.css('overflow', 'hidden');
var w2 = D.wrap.outerWidth(true);
if (w2!=w1)
D.wrap.css('marginRight', (w2 - w1) + 'px');
}
// ������ ���������� �������
modals.not($this).each(function() {
var d = $(this).data('arcticmodal');
d.overlay.block.hide();
});
// ��������
modal.transition(D.overlay.block, 'show', modals.length>1 ? {type: 'none'} : D.openEffect);
modal.transition(D.container.block, 'show', modals.length>1 ? {type: 'none'} : D.openEffect, function() {
D.afterOpen(D, $this);
$this.trigger('afterOpen');
});
return $this;
},
// �������
close: function() {
if ($.isFunction(this)) {
modals.each(function() {
$(this).arcticmodal('close');
});
} else {
return this.each(function() {
var $this = modal.getParentEl(this);
if ($this===false) {
$.error('jquery.arcticmodal: Uncorrect call');
return;
}
var D = $this.data('arcticmodal');
// ������� ����� ���������
if (D.beforeClose(D, $this)===false) return;
$this.trigger('beforeClose');
// �������� ���������� �������
modals.not($this).last().each(function() {
var d = $(this).data('arcticmodal');
d.overlay.block.show();
});
modal.transition(D.overlay.block, 'hide', modals.length>1 ? {type: 'none'} : D.closeEffect);
modal.transition(D.container.block, 'hide', modals.length>1 ? {type: 'none'} : D.closeEffect, function() {
// ������� ����� ��������
D.afterClose(D, $this);
$this.trigger('afterClose');
// ���� �� ����������� - ������ �� �����
if (!D.clone)
$('#arcticmodalReserve' + D.modalID).replaceWith(D.body.find('>*'));
D.overlay.block.remove();
D.container.block.remove();
$this.data('arcticmodal', null);
if (!$('.arcticmodal-container').length) {
if (D.wrap.data('arcticmodalOverflow'))
D.wrap.css('overflow', D.wrap.data('arcticmodalOverflow'));
D.wrap.css('marginRight', 0);
}
});
if (D.type=='ajax')
D.ajax_request.abort();
modals = modals.not($this);
});
}
},
// ���������� ����� ��-���������
setDefault: function(options) {
$.extend(true, default_options, options);
}
};
$(function() {
default_options.wrap = $((document.all && !document.querySelector) ? 'html' : 'body');
});
// �������� ��� ������� Escape
$(document).bind('keyup.arcticmodal', function(e) {
var m = modals.last();
if (!m.length) return;
var D = m.data('arcticmodal');
if (D.closeOnEsc && (e.keyCode===27))
m.arcticmodal('close');
});
$.arcticmodal = $.fn.arcticmodal = function(method) {
if (actions[method]) {
return actions[method].apply(this, Array.prototype.slice.call(arguments, 1));
} else if (typeof method==='object' || !method) {
return modal.init.apply(this, arguments);
} else {
$.error('jquery.arcticmodal: Method ' + method + ' does not exist');
}
};
})(jQuery);
// jquery.arcticmodal.js end
// jquery.jgrowl.js start
(function ($) {
/** Compatibility holdover for 1.9 to check IE6 **/
var $ie6 = (function () {
return false === $.support.boxModel && $.support.objectAll && $support.leadingWhitespace;
})();
/** jGrowl Wrapper - Establish a base jGrowl Container for compatibility with older releases. **/
$.jGrowl = function (m, o) {
// To maintain compatibility with older version that only supported one instance we'll create the base container.
if ($('#jGrowl').size() == 0)
$('
').addClass((o && o.position) ? o.position : $.jGrowl.defaults.position).appendTo('body');
// Create a notification on the container.
$('#jGrowl').jGrowl(m, o);
};
/** Raise jGrowl Notification on a jGrowl Container **/
$.fn.jGrowl = function (m, o) {
if ($.isFunction(this.each)) {
var args = arguments;
return this.each(function () {
var self = this;
/** Create a jGrowl Instance on the Container if it does not exist **/
if ($(this).data('jGrowl.instance') == undefined) {
$(this).data('jGrowl.instance', $.extend(new $.fn.jGrowl(), {
notifications: [],
element: null,
interval: null
}));
$(this).data('jGrowl.instance').startup(this);
}
/** Optionally call jGrowl instance methods, or just raise a normal notification **/
if ($.isFunction($(this).data('jGrowl.instance')[m])) {
$(this).data('jGrowl.instance')[m].apply($(this).data('jGrowl.instance'), $.makeArray(args).slice(1));
} else {
$(this).data('jGrowl.instance').create(m, o);
}
});
}
;
};
$.extend($.fn.jGrowl.prototype, {
/** Default JGrowl Settings **/
defaults: {
pool: 0,
header: '',
group: '',
sticky: false,
position: 'top-right',
glue: 'after',
theme: 'default',
themeState: '',//'highlight',
corners: '10px',
check: 250,
life: 3000,
closeDuration: 'normal',
openDuration: 'normal',
easing: 'swing',
closer: true,
closeTemplate: '×',
closerTemplate: '
[ ������� ]
',
log: function (e, m, o) {
},
beforeOpen: function (e, m, o) {
},
afterOpen: function (e, m, o) {
},
open: function (e, m, o) {
},
beforeClose: function (e, m, o) {
},
close: function (e, m, o) {
},
animateOpen: {
opacity: 'show'
},
animateClose: {
opacity: 'hide'
}
},
notifications: [],
/** jGrowl Container Node **/
element: null,
/** Interval Function **/
interval: null,
/** Create a Notification **/
create: function (message, o) {
var o = $.extend({}, this.defaults, o);
/* To keep backward compatibility with 1.24 and earlier, honor 'speed' if the user has set it */
if (typeof o.speed !== 'undefined') {
o.openDuration = o.speed;
o.closeDuration = o.speed;
}
this.notifications.push({message: message, options: o});
o.log.apply(this.element, [this.element, message, o]);
},
render: function (notification) {
var self = this;
var message = notification.message;
var o = notification.options;
// Support for jQuery theme-states, if this is not used it displays a widget header
o.themeState = (o.themeState == '') ? '' : 'ui-state-' + o.themeState;
var notification = $(
'
' +
'
' + o.closeTemplate + '
' +
'' +
'
' + message + '
'
).data("jGrowl", o).addClass(o.theme).children('div.jGrowl-close').bind("click.jGrowl", function () {
$(this).parent().trigger('jGrowl.close');
}).parent();
/** Notification Actions **/
$(notification).bind("mouseover.jGrowl", function () {
$('div.jGrowl-notification', self.element).data("jGrowl.pause", true);
}).bind("mouseout.jGrowl", function () {
$('div.jGrowl-notification', self.element).data("jGrowl.pause", false);
}).bind('jGrowl.beforeOpen', function () {
if (o.beforeOpen.apply(notification, [notification, message, o, self.element]) != false) {
$(this).trigger('jGrowl.open');
}
}).bind('jGrowl.open', function () {
if (o.open.apply(notification, [notification, message, o, self.element]) != false) {
if (o.glue == 'after') {
$('div.jGrowl-notification:last', self.element).after(notification);
} else {
$('div.jGrowl-notification:first', self.element).before(notification);
}
$(this).animate(o.animateOpen, o.openDuration, o.easing, function () {
// Fixes some anti-aliasing issues with IE filters.
if ($.support.opacity === false)
this.style.removeAttribute('filter');
if ($(this).data("jGrowl") != null) // Happens when a notification is closing before it's open.
$(this).data("jGrowl").created = new Date();
$(this).trigger('jGrowl.afterOpen');
});
}
}).bind('jGrowl.afterOpen', function () {
o.afterOpen.apply(notification, [notification, message, o, self.element]);
}).bind('jGrowl.beforeClose', function () {
if (o.beforeClose.apply(notification, [notification, message, o, self.element]) != false)
$(this).trigger('jGrowl.close');
}).bind('jGrowl.close', function () {
// Pause the notification, lest during the course of animation another close event gets called.
$(this).data('jGrowl.pause', true);
$(this).animate(o.animateClose, o.closeDuration, o.easing, function () {
if ($.isFunction(o.close)) {
if (o.close.apply(notification, [notification, message, o, self.element]) !== false)
$(this).remove();
} else {
$(this).remove();
}
});
}).trigger('jGrowl.beforeOpen');
/** Optional Corners Plugin **/
if (o.corners != '' && $.fn.corner != undefined) $(notification).corner(o.corners);
/** Add a Global Closer if more than one notification exists **/
if ($('div.jGrowl-notification:parent', self.element).size() > 1 &&
$('div.jGrowl-closer', self.element).size() == 0 && this.defaults.closer != false) {
$(this.defaults.closerTemplate).addClass('jGrowl-closer ' + this.defaults.themeState + ' ui-corner-all').addClass(this.defaults.theme)
.appendTo(self.element).animate(this.defaults.animateOpen, this.defaults.speed, this.defaults.easing)
.bind("click.jGrowl", function () {
$(this).siblings().trigger("jGrowl.beforeClose");
if ($.isFunction(self.defaults.closer)) {
self.defaults.closer.apply($(this).parent()[0], [$(this).parent()[0]]);
}
});
}
;
},
/** Update the jGrowl Container, removing old jGrowl notifications **/
update: function () {
$(this.element).find('div.jGrowl-notification:parent').each(function () {
if ($(this).data("jGrowl") != undefined && $(this).data("jGrowl").created != undefined &&
($(this).data("jGrowl").created.getTime() + parseInt($(this).data("jGrowl").life)) < (new Date()).getTime() &&
$(this).data("jGrowl").sticky != true &&
($(this).data("jGrowl.pause") == undefined || $(this).data("jGrowl.pause") != true)) {
// Pause the notification, lest during the course of animation another close event gets called.
$(this).trigger('jGrowl.beforeClose');
}
});
if (this.notifications.length > 0 &&
(this.defaults.pool == 0 || $(this.element).find('div.jGrowl-notification:parent').size() < this.defaults.pool))
this.render(this.notifications.shift());
if ($(this.element).find('div.jGrowl-notification:parent').size() < 2) {
$(this.element).find('div.jGrowl-closer').animate(this.defaults.animateClose, this.defaults.speed, this.defaults.easing, function () {
$(this).remove();
});
}
},
/** Setup the jGrowl Notification Container **/
startup: function (e) {
this.element = $(e).addClass('jGrowl').append('
');
this.interval = setInterval(function () {
$(e).data('jGrowl.instance').update();
}, parseInt(this.defaults.check));
if ($ie6) {
$(this.element).addClass('ie6');
}
},
/** Shutdown jGrowl, removing it and clearing the interval **/
shutdown: function () {
$(this.element).removeClass('jGrowl').find('div.jGrowl-notification').remove();
clearInterval(this.interval);
},
close: function () {
$(this.element).find('div.jGrowl-notification').each(function () {
$(this).trigger('jGrowl.beforeClose');
});
}
});
/** Reference the Defaults Object for compatibility with older versions of jGrowl **/
$.jGrowl.defaults = $.fn.jGrowl.prototype.defaults;
})(jQuery);
// jquery.jgrowl.js end
// cookie
function getCookie(name){var matches=document.cookie.match(new RegExp("(?:^|; )"+name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g,"\\$1")+"=([^;]*)"));return matches?decodeURIComponent(matches[1]):undefined};
function setCookie(name,value,options){options=options||{};var expires=options.expires;if(typeof expires=="number"&&expires){var d=new Date;d.setTime(d.getTime()+expires*1E3);expires=options.expires=d}if(expires&&expires.toUTCString)options.expires=expires.toUTCString();value=encodeURIComponent(value);var updatedCookie=name+"="+value;for(var propName in options){updatedCookie+="; "+propName;var propValue=options[propName];if(propValue!==true)updatedCookie+="="+propValue}document.cookie=updatedCookie};
function deleteCookie(name){setCookie(name,"",{expires:-1})};