
	var z = 0; //for setting the initial z-index's
	var inAnimation = false; //flag for testing if we are in a animation

$(document).ready(function() { //perform actions when DOM is ready
	z = 0;
	$('.heroArea img.imgTag').each(function() { //set the initial z-index's
		z++; //at the end we have the highest z-index value stored in the z variable
		$(this).css('z-index', z); //apply increased z-index to <img>
	});

    /*
	// Scrollable Area
	var intPosition = 0;
	var intMoveBy = 250;
	var intPositionMax = $("#scrollAreaControl").width() - $("#scrollAreaWindow").width();
	// Change Overflow to Hidden
	$('#scrollAreaWindow').css("overflow", "hidden");
	// Show Buttons
	$('#btnArrowLeft').css("display", "block");
	$('#btnArrowRight').css("display", "block");
	// Bind Buttons
	$('#btnArrowRight').click(function () {
		intPosition = intPosition - intMoveBy;
		if (intPosition < (0 - intPositionMax)) intPosition = (0 - intPositionMax);
		$("#scrollAreaControl").animate({ 
			left: intPosition + "px"
		}, 500 );
		return false;
	});
	$('#btnArrowLeft').click(function () {
		intPosition = intPosition + intMoveBy;
		if (intPosition > 0) intPosition = 0;
		$("#scrollAreaControl").animate({ 
			left: intPosition + "px"
		}, 500 );
		return false;
	});
    */

    $('#scrollAreaControl').jcarousel();
    
	$(function() {
		$('#scrollAreaControl a').lightBox({
			overlayBgColor: '#000000',
			overlayOpacity: 0.7,
			imageBlank: 'img/lightbox-blank.gif',
			imageLoading: 'img/lightbox-ico-loading.gif',
			imageBtnClose: 'img/lightbox-btn-close.gif',
			imageBtnPrev: 'img/lightbox-btn-prev.gif',
			imageBtnNext: 'img/lightbox-btn-next.gif',
			containerResizeSpeed: 350,
			txtImage: 'Image',
			txtOf: 'of'
		});
	});
    
    
    $('.slideshow').cycle({
		fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
        timeout: 10000
	});

});


	//
	//swapFirstLast(true);
	//setTimeout ( "swapFirstLast(true)", 3000);
	var int = self.setInterval( "swapFirstLast(true)", 5000)
	var intQuote = self.setInterval( "swapQuotes()", 10000)

	var quoteNo = 1;
	var quoteAnimation = false;

function swapFirstLast(isFirst) {
	if(inAnimation) return false; //if already swapping pictures just return
	else inAnimation = true; //set the flag that we process a image
	var processZindex, direction, newZindex, inDeCrease; //change for previous or next image
	if(isFirst) { processZindex = z; direction = '-'; newZindex = 1; inDeCrease = 1; } //set variables for "next" action
	else { processZindex = 1; direction = ''; newZindex = z; inDeCrease = -1; } //set variables for "previous" action

	// process each image
	$('.heroArea img.imgTag').each(function() {
		// if its the image we need to process
		if($(this).css('z-index') == processZindex) {
			$(this).animate({ 'opacity' : '0' }, 'slow', function() {
				// animate the img above/under the gallery (assuming all pictures are equal height)
				// set new z-index
				$(this).css('z-index', newZindex)
				.animate({ 'top' : '0' }, 'slow', function() { //animate the image back to its original position
					inAnimation = false; //reset the flag
					$(this).css('opacity', '100') //set new z-index
				});
			});
		} else {
			// not the image we need to process, only in/de-crease z-index
			$(this).animate({ 'top' : '0' }, 'slow', function() {
				// make sure to wait swapping the z-index when image is above/under the gallery
				$(this).css('z-index', parseInt($(this).css('z-index')) + inDeCrease); //in/de-crease the z-index by one
			});
		}
	});

	return false; //don't follow the clicked link
}

