/****************************************************************************************************/
var replace_to = "%26";
/****************************************************************************************************/

$(function() {
		$("#all-references").jCarouselLite({
			btnNext: ".next",
			btnPrev: ".prev",
			visible: 1,
			speedAuto: 2000,
			speedClick: 750,
			pauseOnHover: true,
			vertical: true,
			auto: 7000
		});
	});

/****************************************************************************************************/

$(document).ready(function() {
		$('#reference-wrapper div').click(function() {
				window.location.href = '?sec=nase_sluzby';
		});
		$('#reference-wrapper div').mouseover(function() {
				$(this).css('cursor','pointer');
		});
		
						     
/*  Main page preview starts here   */
		$('#nase-reference-wrapper ul').mouseout(function() {
		  $('#nase-reference-wrapper li').removeClass('slider-li-hover');
		  $('#nase-reference-wrapper li').addClass('slider-li');
		});
		$('#nase-reference-wrapper li').mouseover(function() {
		  $('#nase-reference-wrapper li').removeClass('slider-li');
		  $('#nase-reference-wrapper li').addClass('slider-li-hover');
		  $(this).addClass('slider-li');
		  $(this).css('cursor','pointer');
		});
		$('#nase-reference-wrapper li').click(function() {
		  	var NewLink= $(this).attr("link");
			window.location.href = NewLink;
		});
/*  Main page preview ends here   */

	$(window).load(function () {
  		doMoreLessLoad();
	});
		
});

/****************************************************************************************************/

function doMoreLess(parentId){
	var imageHeight   =  $('#ref' + parentId + 'img').css('height');
	var currentHeight =  $('#ref' + parentId + 'text').css('height');
	
	imageHeight   = parseInt(imageHeight);
	currentHeight = parseInt(currentHeight);
	
	if( imageHeight >= currentHeight ){
		$('#ref' + parentId + 'text').css('height', 'auto');
		var height = $('#ref' + parentId + 'text').height();
		$('#ref' + parentId + 'text').css('height', currentHeight + 'px');
		$('#ref' + parentId + 'text').animate({'height': height});
		$('#more-less-' + parentId).html('<img src="media/arrow-two-up.gif" /> menej ');
	}else{
		$('#ref' + parentId + 'text').animate({height: imageHeight});
		$('#more-less-' + parentId).html('<img src="media/arrow-two-down.gif" /> viac ');
	}
}

/****************************************************************************************************/

function doMoreLessLoad(){
	$('.more-less-div').each( function(){
		parentId = this.id.replace("more-less-", "");
		
		var imageHeight   =  $('#ref' + parentId + 'img').height();
		var currentHeight =  $('#ref' + parentId + 'text').height();
		
		imageHeight   = parseInt(imageHeight);
		currentHeight = parseInt(currentHeight);
		
		if( imageHeight > currentHeight ){
			$('#more-less-' + parentId).html('');
		}else if( imageHeight <= currentHeight ) {
			$('#ref' + parentId + 'text').height(imageHeight);
			$('#more-less-' + parentId).html('<img src="media/arrow-two-down.gif" /> viac ');
		}else{
			$('#more-less-' + parentId).html('');
		}
													   
	});
}




