	//home page
	var api = $("#homeCarousel").scrollable({
		//cate elemente se afiseaza odata
		size: 1,
		speed: 1000
	}).circular().autoscroll(
	{
		//cate elemente muta de-odata si la ce interval in milisecunde
    steps: 1,
    interval: 8000
	}).navigator({
    // ul.tabs va fi navigatorul nostru adica cele 4 butoane de jos
    navi:'ul.navig',
		api: true
	});

	$('ul.navig').hover(function() {
		api.stop();
	}, function(){
		setTimeout('api.play()',2000);
	});



	//stanga sus
	$("#verticalScroller").scrollable({
		//cate elemente se afiseaza odata
		size: 4,
		vertical: true,
		speed: 1000
	}).circular().autoscroll(
	{
		//cate elemente muta de-odata si la ce interval in milisecunde
    steps: 1,
    interval: 8000
	});

	
	$('img[alt$=" - Company Logo X"]').hover(function() {
		$(this).attr('src','upload/portfolio/assoc_' + $(this).attr('rel') + '.png');
	}, function() {
		if ($(this).attr('title') != 'click') {
			$(this).attr('src','upload/portfolio/assoc_grey_' + $(this).attr('rel') + '.png');
		}
	});
	

	//portfolio
	$("#portfolioCarousel").scrollable({
		//cate elemente se afiseaza odata
		size: 4,
		speed: 1000,
		onSeek: function() {
      var count = this.getSize();
			var now = this.getIndex();
			
			if (now == count-4) {
				this.getNaviButtons().filter('.nextPage').addClass('disable');
			} else {
				this.getNaviButtons().filter('.nextPage').removeClass('disable');
			}
			
			if (now == 0) {
				this.getNaviButtons().filter('.prevPage').addClass('disable');
			} else {
				this.getNaviButtons().filter('.prevPage').removeClass('disable');
			}
    }
	});

	$('div#portfolioCarousel div.items div a').click(function (e) {
		$('[title="click"]').attr('src','upload/portfolio/assoc_grey_' + $('[title="click"]').attr('rel') + '.png').attr('title','');
		$(this).find('img').attr('src','upload/portfolio/assoc_' + $(this).attr('rel') + '.png').attr('title','click');
		$('div[class^="port"]').hide();
		$('div.port'+$(this).attr('rel')).show();
		e.preventDefault();
	});

	//change pictures in the right side
	//first select all links with the right class and set the onclick (e is the event)
	$('a.changePic').mouseover(function(e) {
		//now the magic
		var bg = 'background';
		//let's see if there's a title and if there is use the title value as the class name of the background div
		var title	= $(this).attr('title');
		
		if (title != 'undefined' && title != '') {
			var elem = $('.'+title);
			if (elem.attr('class') != 'undefined' && elem.attr('class') != '') {
				var elem	= $('.'+title);
				bg = title;
			}
		}
		
		//check if the image exists
		var name	= $(this).attr('name');
		var img		= $('img[rel="'+name+'"]'); //select it first
		if (img.src != 'undefined' && img.src != '' && img.src != 'upload/contentimg') { //we check if the src exists because jquery doesn't throw any errors if the selection went wrong'
			//if the image is ok we can set the background
			$('div.'+bg).css('background-image','url(upload/contentimg/'+name+')');
		} else { //if the image is not valid we set the cursor to default for the link
			$(this).css('cursor','default');
		}

		//surpress the default click
		e.preventDefault();
	});

	//autoselect company when comming from top left carousel
	if ($('[title="activate"]').length > 0) {
    $('div[class^="port"]').hide();

		$('img[title="activate"]').attr('src','upload/portfolio/assoc_' + $('img[title="activate"]').attr('rel') + '.png').attr('title','click');
		$('div[title="activate"]').show();
	}

