function loadTabContent(id) {
	var tabs = $$('div#offers-tabs div[id^=tab-box-]');
	var content = $('tabs-content');
	
	$each(tabs, function(item) {
		item.set('class', 'offer-tab set-left');
	});
	$('tab-box-' + id).set('class', 'offer-tab-active set-left');
	
	var params = '';
	
	params += 'ajax_action=load_offer';
	params += '&id_cat=' + id;
		
	var myRequest = new Request({
		url: host_url + '/www/ajax.php',
		method: 'get',
		data: params,
		onRequest: function () {
			content.set('html', '');
			content.set('class', 'ajax-loader');
		},
		onSuccess: function (resposneText ) {
			var response = new String(resposneText);
			content.set('class', '');
			content.set('html', response);
			initScroller();
		}	
	});
	myRequest.send();
	window.location.hash = "#" + id;
}

function initScroller() {
	myScroller.init({
		windowID: 'offer-window',
		tapeID: 'offer-tape',
		prevArrowID: 'offer-left-arrow',
		nextArrowID: 'offer-right-arrow',
		itemsName: 'offer-frame',
		step: 3								
	});
}

function showHideBlock(id) {
	var block = $(id);
	if(block.getStyle('display') == 'none') {
		block.setStyle('display', 'block');
	}else {
		block.setStyle('display', 'none');
	}
}

function changeSearchGroup() {
	var group = $('search-group').value;
	var params = '';
	params += 'ajax_action=get_search_categories';
	params += '&group=' + group;
		
	var myRequest = new Request({
		url: host_url + '/www/ajax.php',
		method: 'get',
		data: params,
		onSuccess: function (resposneText ) {
			var response = new String(resposneText);
			$('search-category').set('html', response);
		}	
	});
	myRequest.send();
}

function adminChangeGroup() {
	var group = $('pro-group').value;
	var params = '';
	params += 'ajax_action=admin_get_pro_categories';
	params += '&group=' + group;
		
	var myRequest = new Request({
		url: host_url + '/www/ajax.php',
		method: 'get',
		data: params,
		onSuccess: function (resposneText ) {
			var response = new String(resposneText);
			$('pro-category').set('html', response);
		}	
	});
	myRequest.send();
}
