	var domain_path = '/static';

	// saves all slides id
	var slides = [];
	// saves current slide
	var current_slide = null;
	// saves first and last slide
	var first_slide = null;
	var last_slide = null;
		
	// reload prev and next slide
	function preLoadSlide(slide) {
		var prev = slides[slide].prev.attr("id");
		var next = slides[slide].next.attr("id");
		$("<img>").attr('src',domain_path+'/imgs/careers/'+prev+'.jpg');
		$("<img>").attr('src',domain_path+'/imgs/careers/'+next+'.jpg');
	}

	$(document).ready(function(){
		
		// loop to save all slides and prev and next of each one of them
		$("#careersSlidesTxt ul li").each(function(i) {
			var obj = $(this);
			var next = obj.next();
			var prev = obj.prev();
			if(next.length == 0) last_slide = this;
			if(prev.length == 0) first_slide = this;
			slides[this.id] = { index:i, next:next, prev:prev };
		});
		
		// prev and next slide of the fist and last slide
		slides[first_slide.id].prev = $("#careersSlidesTxt ul li:last");
		slides[last_slide.id].next = $("#careersSlidesTxt ul li:first");
		
		// preload next and prev of the first slide
		preLoadSlide(first_slide.id);
		
		// set up the carousel
		$("#careersSlidesTxt").jCarouselLite({
			 btnNext: "#next",
			 btnPrev: "#prev",
			 visible: 1,
			 speed: 380,
			 beforeStart: function(e) {
			 	// before animation, save current slide id
			 	current_slide = e[0].id;
			 },
			 afterEnd: function(e) {
			 	// after animation, preload prev and next slides of the current slide
				preLoadSlide(e[0].id);
			 }
		});
		
		$('a#next').click(function(){
			// load slide image
			var slide = slides[current_slide].next.attr("id");
			$('#careersSlideContainer').removeClass().addClass(slide);
		});
		
		$('a#prev').click(function(){
			// load slide image
			var slide = slides[current_slide].prev.attr("id");
			$('#careersSlideContainer').removeClass().addClass(slide);
		});
		
		// equal heights for job listing columns
		$("#currentPositions div").equalHeight();
		
	});
	
	jQuery.fn.equalHeight = function() {
	    var height = 0, 
	    maxHeight = 0;
	    // Store the tallest element's height
	    this.each(function() {
	        var t = jQuery(this);
	        //height = t.height() + parseInt(t.css('paddingTop'), 10) + parseInt(t.css('paddingBottom'), 10) + parseInt(t.css('borderTopWidth'), 10) + parseInt(t.css('borderBottomWidth'), 10);
	        var border_top = ( isNaN(parseInt(t.css('borderTopWidth'),10)) ? 0 : parseInt(t.css('borderTopWidth'),10) );
	        var border_bottom = ( isNaN(parseInt(t.css('borderBottomWidth'),10)) ? 0 : parseInt(t.css('borderBottomWidth'),10) );
	        height = t.height() + parseInt(t.css('paddingTop'), 10) + parseInt(t.css('paddingBottom'), 10) + border_top + border_bottom;
	        maxHeight = (height > maxHeight) ? height : maxHeight;
	    });
	    // Set element's min-height to tallest element's height
	    return this.each(function() {
	        var t = jQuery(this);
            var border_top = ( isNaN(parseInt(t.css('borderTopWidth'),10)) ? 0 : parseInt(t.css('borderTopWidth'),10) );
            var border_bottom = ( isNaN(parseInt(t.css('borderBottomWidth'),10)) ? 0 : parseInt(t.css('borderBottomWidth'),10) );
            mh = maxHeight - (parseInt(t.css('paddingTop'), 10) + parseInt(t.css('paddingBottom'), 10) + border_top + border_bottom );
            //mh = maxHeight - (parseInt(t.css('padding-top'), 10) + parseInt(t.css('padding-bottom'), 10) + parseInt(t.css('border-top-width'), 10) + parseInt(t.css('border-bottom-width'), 10));
            t.height(mh);
            //t.css({minHeight: mh +'px'});
	    });
	};