// JavaScript Document
$(document).ready(function(){
	var listSize = $("#ul_openings_container li").size();					   
	$("#ul_openings_container").width(listSize * 440);					   
	var currentIndex = 0;
	checkRepeat();
	
	$("#divRightArrow").click(function () {
		//alert("top");
		currentIndex++;
		$("#ul_openings_container").animate({"left": currentIndex*(-440) + "px"}, "slow");
		checkRepeat();
	}); 	
	$("#divLeftArrow").click(function () {
		//alert("down");
		currentIndex--;
		$("#ul_openings_container").animate({"left": currentIndex*(-440) + "px"}, "slow");
		checkRepeat();
	});
	
	function checkRepeat(){
		if(currentIndex > (listSize-1)){
			currentIndex = 0;
		}else if(currentIndex <0){
			currentIndex = listSize-1;
		}
		$("#divCount").html(currentIndex+1+"/"+listSize);
		$("#ul_openings_container").animate({"left": currentIndex*(-440) + "px"}, "slow");
	}
	
	/*//==================
	//marquee function
	//==================
	$(function () {
		// basic version is: $('div.demo marquee').marquee() - but we're doing some sexy extras
		$('div.demo marquee').marquee('pointer').mouseover(function () {
			$(this).trigger('stop');
			}).mouseout(function () {
				$(this).trigger('start');
			}).mousemove(function (event) {
				if ($(this).data('drag') == true) {
					this.scrollLeft = $(this).data('scrollX') + ($(this).data('x') - event.clientX);
				}
			}).mousedown(function (event) {
				$(this).data('drag', true).data('x', event.clientX).data('scrollX', this.scrollLeft);
			}).mouseup(function () {
				$(this).data('drag', false);
		});
	}); */
});
