function initPromo()
{
	var _opener = $('#promo');
	var _holder = $('#promo-holder');
	_opener.click(function()
		{
			if (_holder.hasClass('active')){
				_holder.removeClass('active')
			} 
			else {
				_holder.addClass('active');
			}
			return false;
		});
	var _promoContent = $('.box-center .center img');
	var _promoHolder = $('#promo-holder');
	_promoHolder.css('width',(_promoContent.width()+ 16 ));
}

function initGallery() {
	$('div.carusel').galleryScroll({
		circleSlide:false,
		btPrev: 'a.next-btn',
		btNext: 'a.prev-btn',
		holderList: 'div.items-holder',
		scrollElParent: 'div.items-holder > ul',
		scrollEl: 'div.items-holder > ul li',
		slideNum: false,
		duration : 1000,
		step: 1,
		circleSlide: false,
		disableClass: 'disable'
	});
}

function initSlideShow() {
	$('div.slideshow').slideShow({
		slideEl:'ul.slide-list > li',
		numElementLink:'ul.slide-nav a',
		autoSlideShow:false,
		switchTime:8000,
		duration:1000,
		event:'click'
	});
}

function initTabs() {
	$('ul.tabset').each(function(){
		var _list = $(this);
		var _links = _list.find('a.tab');

		_links.each(function() {
			var _link = $(this);
			var _href = _link.attr('href');
			var _tab = $(_href);

			if(_link.hasClass('active')) {
				_tab.show();
				_link.css('opacity','0.5');
			}
			else _tab.hide();

			_link.click(function(){
				_links.filter('.active').each(function(){
					$($(this).removeClass('active').attr('href')).hide();
					$($(this).css('opacity','1'));
				});
				_link.addClass('active');
				_link.css('opacity','0.5');
				_tab.show();
				return false;
			});
		});
	});
}

function General() {
	initPromo();
	initGallery();
	initSlideShow();
	initTabs();
}

if (window.addEventListener) window.addEventListener("load", General, false);
else if (window.attachEvent) window.attachEvent("onload", General);
