$(document).ready(function(){
  $('p.back-top a').click(function() {
	if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
	&& location.hostname == this.hostname) {
	  var $target = $(this.hash);
	  $target = $target.length && $target
	  || $('[name=' + this.hash.slice(1) +']');
	  if ($target.length) {
		var targetOffset = $target.offset().top;
		$('html,body')
		.animate({scrollTop: targetOffset}, 700);
	   return false;
	  }
	}
  });
});

$(document).ready(function(){
  $('li.godown a').click(function() {
	if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
	&& location.hostname == this.hostname) {
	  var $target = $(this.hash);
	  $target = $target.length && $target
	  || $('[name=' + this.hash.slice(1) +']');
	  if ($target.length) {
		var targetOffset = $target.offset().top;
		$('html,body')
		.animate({scrollTop: targetOffset}, 700);
	   return false;
	  }
	}
  });
});

var mycarousel_itemList = [
    {url: "photos/1.jpg", large: "photos/large/1.jpg"},
    {url: "photos/2.jpg", large: "photos/large/2.jpg"},
    {url: "photos/3.jpg", large: "photos/large/3.jpg"},
    {url: "photos/4.jpg", large: "photos/large/4.jpg"},
    {url: "photos/5.jpg", large: "photos/large/5.jpg"},
    {url: "photos/6.jpg", large: "photos/large/6.jpg"},
    {url: "photos/7.jpg", large: "photos/large/7.jpg"},
    {url: "photos/8.jpg", large: "photos/large/8.jpg"},
    {url: "photos/9.jpg", large: "photos/large/9.jpg"},
    {url: "photos/10.jpg", large: "photos/large/10.jpg"},
    {url: "photos/11.jpg", large: "photos/large/11.jpg"},
    {url: "photos/12.jpg", large: "photos/large/12.jpg"},
    {url: "photos/13.jpg", large: "photos/large/13.jpg"},
    {url: "photos/14.jpg", large: "photos/large/14.jpg"},
    {url: "photos/15.jpg", large: "photos/large/15.jpg"},
    {url: "photos/16.jpg", large: "photos/large/16.jpg"},
    {url: "photos/17.jpg", large: "photos/large/17.jpg"},
    {url: "photos/18.jpg", large: "photos/large/18.jpg"},
    {url: "photos/19.jpg", large: "photos/large/19.jpg"},
    {url: "photos/20.jpg", large: "photos/large/20.jpg"},
    {url: "photos/21.jpg", large: "photos/large/21.jpg"},
    {url: "photos/22.jpg", large: "photos/large/22.jpg"},
    {url: "photos/23.jpg", large: "photos/large/23.jpg"},
    {url: "photos/24.jpg", large: "photos/large/24.jpg"},
    {url: "photos/25.jpg", large: "photos/large/25.jpg"},
    {url: "photos/26.jpg", large: "photos/large/26.jpg"},
    {url: "photos/27.jpg", large: "photos/large/27.jpg"},
    {url: "photos/28.jpg", large: "photos/large/28.jpg"},
    {url: "photos/29.jpg", large: "photos/large/29.jpg"},
    {url: "photos/30.jpg", large: "photos/large/30.jpg"},
    {url: "photos/31.jpg", large: "photos/large/31.jpg"},
    {url: "photos/32.jpg", large: "photos/large/32.jpg"}
];

function mycarousel_itemLoadCallback(carousel, state)
{
    for (var i = carousel.first; i <= carousel.last; i++) {
        if (carousel.has(i)) {
            continue;
        }

        if (i > mycarousel_itemList.length) {
            break;
        }

        carousel.add(i, mycarousel_getItemHTML(mycarousel_itemList[i-1]));
    }
};

/**
 * Item html creation helper.
 */
function mycarousel_getItemHTML(item)
{
    return '<a href="' + item.large + '" height="150" width="195" rel="lightbox"><img src="' + item.url + '" /></a>';
};


jQuery(document).ready(function() {
    jQuery('#mycarousel').jcarousel({
        size: mycarousel_itemList.length,
        auto: 5,
        wrap: 'wrap',
        itemLoadCallback: {onBeforeAnimation: mycarousel_itemLoadCallback}
    });
});