jQuery.fn.basketSlider = function(settings)
{
	settings = jQuery.extend(
		{
			basketBlock : 'basket-block',
			duration : 250,
			closeBtnSelector : '.close-btn',
			maskEl : '.conteiner_info'
		}, settings
	);
	
	var baskelBlockEl = $('#' + settings.basketBlock);
	
	baskelBlockEl.data('sliding', false);
	baskelBlockEl.data('opened', false);
	
	$('#' + settings.basketBlock + ' ' + settings.closeBtnSelector).click(function () {
		if (!$(this.basketBlock).data('sliding') && $(this.basketBlock).data('opened')) {
			$(this.basketBlock).data('sliding', true);
			$(this.basketBlock).effect('slide', {  
				direction : 'up',
				mode : 'hide'
			}, settings.duration, function () {
				$(this).data('sliding', false);
				$(this).data('opened', false);
				$(this).data('maskEl').unmask();
			});
		}
	});
	
	this.each(function(idx, el) {		
		el.basketBlock = baskelBlockEl;	
		el.maskEl = $(settings.maskEl);		
	});
	
	$('#' + settings.basketBlock + ' ' + settings.closeBtnSelector).each(function(idx, el) {		
		el.basketBlock = baskelBlockEl;				
	});
	
	baskelBlockEl.data('maskEl', $(settings.maskEl));	
	
	this.click(function (e){		
		if ($(this.basketBlock).data('sliding')) return;
		if ($(this.basketBlock).data('opened')) {
		    $(this.basketBlock).data('sliding', true);
			$(this.basketBlock).effect('slide', {  
				direction : 'up',
				mode : 'hide'
			}, settings.duration, function () {
				$(this).data('sliding', false);
				$(this).data('opened', false);
				$(this).data('maskEl').unmask();
			});
		} else {
			$(this.basketBlock).data('sliding', true);
			$(this.basketBlock).effect('slide', {  
				direction : 'up',
				mode : 'show'
			}, settings.duration, function () {
				$(this).data('sliding', false);
				$(this).data('opened', true);
				$(this).data('maskEl').mask();
			});
		}		
	});
	
}




jQuery.fn.regSlider = function(settings)
{
	settings = jQuery.extend(
		{
			regBlock : 'reg-block',
			duration : 250,
			closeBtnSelector : '.close-btn',
			maskEl : '.conteiner_info'
		}, settings
	);
	
	var baskelBlockEl = $('#' + settings.regBlock);
	
	baskelBlockEl.data('sliding', false);
	baskelBlockEl.data('opened', false);
	
	$('#' + settings.regBlock + ' ' + settings.closeBtnSelector).click(function () {
		if (!$(this.regBlock).data('sliding') && $(this.regBlock).data('opened')) {
			$(this.regBlock).data('sliding', true);
			$(this.regBlock).effect('slide', {  
				direction : 'up',
				mode : 'hide'
			}, settings.duration, function () {
				$(this).data('sliding', false);
				$(this).data('opened', false);
				$(this).data('maskEl').unmask();
			});
		}
	});
	
	this.each(function(idx, el) {		
		el.regBlock = baskelBlockEl;	
		el.maskEl = $(settings.maskEl);		
	});
	
	$('#' + settings.regBlock + ' ' + settings.closeBtnSelector).each(function(idx, el) {		
		el.regBlock = baskelBlockEl;				
	});
	
	baskelBlockEl.data('maskEl', $(settings.maskEl));	
	
	this.click(function (e){		
		if ($(this.regBlock).data('sliding')) return;
		if ($(this.regBlock).data('opened')) {
		    $(this.regBlock).data('sliding', true);
			$(this.regBlock).effect('slide', {  
				direction : 'up',
				mode : 'hide'
			}, settings.duration, function () {
				$(this).data('sliding', false);
				$(this).data('opened', false);
				$(this).data('maskEl').unmask();
			});
		} else {
			$(this.regBlock).data('sliding', true);
			$(this.regBlock).effect('slide', {  
				direction : 'up',
				mode : 'show'
			}, settings.duration, function () {
				$(this).data('sliding', false);
				$(this).data('opened', true);
				$(this).data('maskEl').mask();
			});
		}		
	});
	
}






jQuery.fn.loginSlider = function(settings)
{
	settings = jQuery.extend(
		{
			loginBlock : 'login-block',
			duration : 250,
			closeBtnSelector : '.close-btn',
			maskEl : '.conteiner_info'
		}, settings
	);
	
	var baskelBlockEl = $('#' + settings.loginBlock);
	
	baskelBlockEl.data('sliding', false);
	baskelBlockEl.data('opened', false);
	
	$('#' + settings.loginBlock + ' ' + settings.closeBtnSelector).click(function () {
		if (!$(this.loginBlock).data('sliding') && $(this.loginBlock).data('opened')) {
			$(this.loginBlock).data('sliding', true);
			$(this.loginBlock).effect('slide', {  
				direction : 'up',
				mode : 'hide'
			}, settings.duration, function () {
				$(this).data('sliding', false);
				$(this).data('opened', false);
				$(this).data('maskEl').unmask();
			});
		}
	});
	
	this.each(function(idx, el) {		
		el.loginBlock = baskelBlockEl;	
		el.maskEl = $(settings.maskEl);		
	});
	
	$('#' + settings.loginBlock + ' ' + settings.closeBtnSelector).each(function(idx, el) {		
		el.loginBlock = baskelBlockEl;				
	});
	
	baskelBlockEl.data('maskEl', $(settings.maskEl));	
	
	this.click(function (e){		
		if ($(this.loginBlock).data('sliding')) return;
		if ($(this.loginBlock).data('opened')) {
		    $(this.loginBlock).data('sliding', true);
			$(this.loginBlock).effect('slide', {  
				direction : 'up',
				mode : 'hide'
			}, settings.duration, function () {
				$(this).data('sliding', false);
				$(this).data('opened', false);
				$(this).data('maskEl').unmask();
			});
		} else {
			$(this.loginBlock).data('sliding', true);
			$(this.loginBlock).effect('slide', {  
				direction : 'up',
				mode : 'show'
			}, settings.duration, function () {
				$(this).data('sliding', false);
				$(this).data('opened', true);
				$(this).data('maskEl').mask();
			});
		}		
	});
	
}



jQuery.fn.mainSlider = function(settings)
{
	settings = jQuery.extend(
		{
			mainBlock : 'main-block',
			duration : 250,
			closeBtnSelector : '.close-btn',
			maskEl : '.conteiner_info'
		}, settings
	);
	
	var baskelBlockEl = $('#' + settings.mainBlock);
	
	baskelBlockEl.data('sliding', false);
	baskelBlockEl.data('opened', false);
	
	$('#' + settings.mainBlock + ' ' + settings.closeBtnSelector).click(function () {
		if (!$(this.mainBlock).data('sliding') && $(this.mainBlock).data('opened')) {
			$(this.mainBlock).data('sliding', true);
			$(this.mainBlock).effect('slide', {  
				direction : 'up',
				mode : 'hide'
			}, settings.duration, function () {
				$(this).data('sliding', false);
				$(this).data('opened', false);
				$(this).data('maskEl').unmask();
			});
		}
	});
	
	this.each(function(idx, el) {		
		el.mainBlock = baskelBlockEl;	
		el.maskEl = $(settings.maskEl);		
	});
	
	$('#' + settings.mainBlock + ' ' + settings.closeBtnSelector).each(function(idx, el) {		
		el.mainBlock = baskelBlockEl;				
	});
	
	baskelBlockEl.data('maskEl', $(settings.maskEl));	
	
	this.click(function (e){		
		if ($(this.mainBlock).data('sliding')) return;
		if ($(this.mainBlock).data('opened')) {
		    $(this.mainBlock).data('sliding', true);
			$(this.mainBlock).effect('slide', {  
				direction : 'up',
				mode : 'hide'
			}, settings.duration, function () {
				$(this).data('sliding', false);
				$(this).data('opened', false);
				$(this).data('maskEl').unmask();
			});
		} else {
			$(this.mainBlock).data('sliding', true);
			$(this.mainBlock).effect('slide', {  
				direction : 'up',
				mode : 'show'
			}, settings.duration, function () {
				$(this).data('sliding', false);
				$(this).data('opened', true);
				$(this).data('maskEl').mask();
			});
		}		
	});
	
}
