function expand(trg) {
	jQuery('#' + trg).show();
}

$(document).ready(function(){
	$('#all_pro .brd_shaped:last-child').addClass(' last-child');

	$('img.hover').hover(
		function () {
			var bg = $(this).attr('src');
			$(this).attr('src', bg.replace('.','_h.'));
		},
		function () {
			var bg = $(this).attr('src');
			$(this).attr('src', bg.replace('_h.','.'));
		}
	);

/* promoblock */
	$('div.promoblock').hover(
		function () {
			$(this).find('a.more').css({'text-decoration':'underline'});
			var href = $(this).find('a.more').attr('href');
			window.status = 'http://' + location.hostname + href;
			return false;
		},
		function () {
			$(this).find('a.more').css({'text-decoration':'none'});
			window.status = '';
			return false;
		}
	);

	$('div.promoblock').click(function(){
		var href = $(this).find('a.more').attr('href');
		location.href = 'http://' + location.hostname + href;
	});

/* /promoblock */


	$('#combo_wrap_1').click(function(){
		$('#combo_wrap_1 div.combo_drop').toggleClass('hidden');
		$('#combo_wrap_2 div.combo_drop').addClass('hidden');
	});

	$('#combo_wrap_2').click(function(){
		$('#combo_wrap_2 div.combo_drop').toggleClass('hidden');
		$('#combo_wrap_1 div.combo_drop').addClass('hidden');
	});

	$(document).click(function(e){
		if (e.target.className != 'combo'){
			$('div.combo_drop').addClass('hidden');
		}
	});

}); //document ready

$(function() {
	$('#cru_clients').jCarouselLite({
		btnNext: '.next',
		btnPrev: '.prev',
		scroll: 2,
		speed: 400
	});
	$('#cru_proj_x_t').jCarouselLite({
		btnGo: getTriggers(),
		visible: 1,
		auto: 5000,
		speed: 400,
		awakeAuto: 5000,
		stopAnimationOnBtnGoClick: true
	});

	$('#cru_proj_x_i').jCarouselLite({
		btnGo: getTriggers(),
		visible: 1,
		beforeStart: function() {
			$('#cru_proj_x_t').hide();
		},

		afterEnd: function() {
			$('#cru_proj_x_t').fadeIn(400);
			$('img.carou_dot').attr('src', '/general/img/carou_dot.gif');
			if (this._currentItem + 1 == this._carouselLength) { $('#z0_2').attr('src', '/general/img/carou_dot_active.gif'); }
			$('#z' + (this._currentItem - 1) + '_2').attr('src', '/general/img/carou_dot_active.gif');

		},
		auto: 5000,
		speed: 400,
		awakeAuto: 5000,
		stopAnimationOnBtnGoClick: true
	});
});

// preload images
function preloadimages(){
	var myimages = new Array();
	for (i = 0; i < preloadimages.arguments.length; i++) {
		myimages[i]=new Image();
		myimages[i].src=preloadimages.arguments[i];
	}
}

function getTriggers(){
  var items = $('#switcher').children();
  var itemsID = [];
  
  $.each(items, function(){
    itemsID.push( '#' + $(this).attr('id') )
  })
  
  return itemsID;
}



