
/* --------------- GALLERY SLIDESHOW ------------------------ */

$(function(){
  var nextButton = $('.nextbutton'), prevButton = $('.prevbutton');

  //Remove scrollbars
  $('.sc_menu').css({overflow: 'hidden'});

	var galleryNum = $('#gallery li').size();
	var currentItem = 1;
	var temporaryLoc;
	var newLoc;
	
	nextButton.click(function() {
		if(currentItem == galleryNum - 4) {
			currentItem = 1;
			$('#gallery').animate({"left":"0px"});
		} else {
			temporaryLoc = currentItem * 95;
			newLoc = temporaryLoc - temporaryLoc - temporaryLoc;
			$('#gallery').animate({"left":newLoc});
			currentItem++;
		}
			return false;
	});
	
	prevButton.click(function() {
		if(currentItem == 1) {
			currentItem = 1;
			$('#gallery').animate({"left":"0px"});
		} else {
			temporaryLoc = currentItem * 95 - 190;
			newLoc = temporaryLoc - temporaryLoc - temporaryLoc;
			$('#gallery').animate({"left":newLoc});
			currentItem--;
		}
			return false;
	});

/* --------------- AJAXFORM ------------------------ */

$('#ajaxform').ajaxForm({
target: '#log',
success: function(responseText) 
{
	var x = $('div.success').text().length;
	if(x>0) $('#ajaxform').slideUp('slow');	
}
});


//
$('div#blog .post:last-child').addClass('last-single-post');

});


/* --------------- EASYSLIDES ------------------------ */
// Set up our options for the slideshow...
var myOptions = {
    noImages: 5, // Number of images
    path: "/images/slideshow/", // Relative path with trailing slash.
    captions: { // HTML can be included in the captions.
        1: 'Caption 1',
        2: 'Caption 2',
        3: 'Caption 3',
        4: 'Caption 4',
        5: 'Caption 5',
        6: 'Caption 6'
    },
    links: { // Should the images link anywhere? if no links are required at all then this option can be omitted.
        1:"http://www.google.com",
        2:"http://www.yahoo.com",
        3:"",
        4:"http://www.jquery.com",
        5:"http://www.youtube.com",
        6:""
    },
    linksOpen:'newWindow', // How to open links? sameWindow or newWindow.
    timerInterval: 6500, // 6500 = 6.5 seconds
    randomise: false // Start with random image? true=yes/false=no
};

// Initiate the Easy Slides plugin, assigning it to your contaner DIV...
$('#slideshow_container').easySlides(myOptions);

