// Set thickbox loading image
tb_pathToImage = "../images/loading-thickbox.gif";

var mycarousel_itemList = [
    {url: "_img/destinations/destinations.jpg", title: "Ian and Helena and guests(UK) got carried away with excitement during their NYC destination wedding! - photo courtesy of Brian Friendman"},
    {url: "_img/destinations/destinations2.jpg", title: "Glen and Paula (UK)share a kiss later on while touring the town during their post-ceremony photo shoot with photographer Brian Friedman"},
    {url: "_img/destinations/destinations3.jpg", title: "Glen (UK) and Rev Alison share a laugh during the signing of the license in Ladies Pavilion"},
	{url: "_img/destinations/destinations4.jpg", title: "Georgina and Paul (UK) have a fun moment during their traditional church wedding in NYC"},
	{url: "_img/destinations/destinations5.jpg", title: "James and Caroline from The UK brought their family and friends to participate in their beautiful June wedding in Central Park  Photo courtesy of Brian Friedman"},
	{url: "_img/destinations/destinations6.jpg", title: "Neil and Donna Wileman (UK) with their children renew thei vows in Ladies Pavillion, Central Park"},
    {url: "_img/destinations/destinations7.jpg", title: "Michael & Wendy (from California) chose Central Park for their destination wedding - photo courtesy of Brian Friedman - make up by Jessica Golding - hair by Joey Battisti"},
    {url: "_img/destinations/destinations8.jpg", title: "Jenny and Stephen from UK chose NYC as their destination wedding - photo courtesy of Brian Friedman - make up by Jessica Golding - hair by Joey Battisti"},
	{url: "_img/destinations/destinations9.jpg", title: "Rachel and Kevin(from The UK) chose NYC for their  winter destination wedding"},
	{url: "_img/destinations/destinations10.jpg", title: "Michaela & Dan (from The UK) in Central for their winter wedding "},
	{url: "_img/destinations/destinations11.jpg", title: "Jordan & Louise's from UK chose Conservatory Gardens in Central Park as their destination wedding location"},
    {url: "_img/destinations/destinations12.jpg", title: "James and Denise from The UK chose NYC as their destination wedding site. Dec '07 - photo courtesy of Brian Friedman"},
    {url: "_img/destinations/destinations13.jpg", title: "Dean and Emma from Dubai.  Their winter wedding February  2008 in Ladies Pavilion, Central Park NYC - photo courtesy of Brian Friedman - make up by Jessica Golding - hair by Joey Battisti"},
	{url: "_img/destinations/destinations14.jpg", title: "Kjetil and Hilde from Norway chose Ladies Pavillion in Central Park for their winter wedding"},
	{url: "_img/destinations/destinations15.jpg", title: "John and Kelli from Iowa chose Shakespeare's Garden in Central Park as their destination wedding location"},
	{url: "_img/destinations/destinations16.jpg", title: "Russell and Kelley from Scotland and daughter taking a horse drawn carriage ride to their Central Park destination wedding spot"},
    {url: "_img/destinations/destinations17.jpg", title: "Robert and Belinda chose NYC as their Christmas destination wedding spot. - Photo courtesy of Brian Friedman - Hairstylist Joey - Makeup Artist Jessica"},
    {url: "_img/destinations/destinations18.jpg", title: "August and Denise chose Central Park as their destination wedding site - photo courtesy of Brian Friedman"},
	{url: "_img/destinations/destinations19.jpg", title: "Adriana & Paul chose Top Of The Rock Rockefeller Center, as their destination wedding  1/07"}
];

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;
        }

        // Create an object from HTML
        var item = jQuery(mycarousel_getItemHTML(mycarousel_itemList[i-1])).get(0);

        // Apply thickbox
        tb_init(item);

        carousel.add(i, item);
    }
};

/**
 * Item html creation helper.
 */
function mycarousel_getItemHTML(item)
{
    var url_m = item.url.replace(/_s.jpg/g, '_m.jpg');
    return '<a href="' + url_m + '" title="' + item.title + '"><img src="' + item.url + '" width="175" height="151" border="0" alt="' + item.title + '" /></a>';
};

jQuery(document).ready(function() {
    jQuery('#mycarousel').jcarousel({
		auto: 5,
        wrap: 'last',
         visible: 2,
        size: mycarousel_itemList.length,
        itemLoadCallback: {onBeforeAnimation: mycarousel_itemLoadCallback}
    });
});

/* jcycle function */
$(function() {
    // run the code in the markup!
    $('#s1').cycle({
    fx:    'fade',
    speed:  3500,
	timeout:  5000
 });
});

