function homeSlider(){

if (document.images) {
	img1 = new Image();
	img2 = new Image();
	img3 = new Image();
	img4 = new Image();
	img5 = new Image();	

	img1.src = 'graphics/slider/fairytale.jpg';
	img2.src = 'graphics/slider/renaissance.jpg';
	img3.src = 'graphics/slider/brazilian.jpg';
	img4.src = 'graphics/slider/chateau.jpg';
	img5.src = 'graphics/slider/palmer.jpg';	
}

var mycarousel_itemList = [
	{url: 'graphics/slider/fairytale.jpg', title: 'Fairy Tale', caption: '', link: '/galleries/fairytale.html'},
	{url: 'graphics/slider/renaissance.jpg', title: 'Renaissance Hotel', caption: '', link: '/galleries/weddings.html'},
	{url: 'graphics/slider/brazilian.jpg', title: 'Four Seasons Hotel, Las Vegas', caption: '', link: '/galleries/braziliancarnival.html'},
	{url: 'graphics/slider/chateau.jpg', title: 'Chateau Ritz', caption: '', link: '/galleries/chateauritz.html'},
	{url: 'graphics/slider/palmer.jpg', title: 'Palmer House Hilton', caption: '', link: '/galleries/weddings.html'}
];

function mycarousel_itemVisibleInCallback(carousel, item, i, state, evt)
{
    // The index() method calculates the index from a
    // given index who is out of the actual item range.
    var idx = carousel.index(i, mycarousel_itemList.length);
    carousel.add(i, mycarousel_getItemHTML(mycarousel_itemList[idx - 1]));
};

function mycarousel_itemVisibleOutCallback(carousel, item, i, state, evt)
{
    carousel.remove(i);
};

/**
 * Item html creation helper.
 */
function mycarousel_getItemHTML(item)
{
    //return '<div id="sliderimage"><a href="' + item.link + '"><img src="' + item.url + '" width="680" height="390" alt="' + item.title + '" /></a><br /><span class="caption"><h1>' + item.title + '</h1><br />' + item.caption + '</span></div>';
	return '<div id="sliderimage"><a href="' + item.link + '"><img src="' + item.url + '" width="680" height="390" alt="' + item.title + '" /></a><br /><span class="caption"><h1>' + item.title + '</h1></span></div>';
};


function mycarousel_initCallback(carousel) {
    jQuery('.jcarousel-control a').bind('click', function() {
        carousel.scroll(jQuery.jcarousel.intval(jQuery(this).text()));
        return false;
    });

    jQuery('.jcarousel-scroll select').bind('change', function() {
        carousel.options.scroll = jQuery.jcarousel.intval(this.options[this.selectedIndex].value);
        return false;
    });

    jQuery('#mycarousel-next').bind('click', function() {
        carousel.next();
        return false;
    });

    jQuery('#mycarousel-prev').bind('click', function() {
        carousel.prev();
        return false;
    });
};



jQuery(document).ready(function() {
    jQuery('#slider').jcarousel({
        auto: 6,
		scroll: 1,
		easing: 'swing',
		wrap: 'circular',
		//initCallback: mycarousel_initCallback,
        itemVisibleInCallback: {onBeforeAnimation: mycarousel_itemVisibleInCallback},
        itemVisibleOutCallback: {onAfterAnimation: mycarousel_itemVisibleOutCallback}
    });
});


} ///////end homeSlider
