

var mycarousel_itemList = [
						   /*
    {url: 'http://static.flickr.com/66/199481236_dc98b5abb3_s.jpg', title: 'Flower1'},
    {url: 'http://static.flickr.com/75/199481072_b4a0d09597_s.jpg', title: 'Flower2'},
    {url: 'http://static.flickr.com/57/199481087_33ae73a8de_s.jpg', title: 'Flower3'},
    {url: 'http://static.flickr.com/77/199481108_4359e6b971_s.jpg', title: 'Flower4'},
    {url: 'http://static.flickr.com/58/199481143_3c148d9dd3_s.jpg', title: 'Flower5'},
    {url: 'http://static.flickr.com/72/199481203_ad4cdcf109_s.jpg', title: 'Flower6'},
    {url: 'http://static.flickr.com/58/199481218_264ce20da0_s.jpg', title: 'Flower7'},
    {url: 'http://static.flickr.com/69/199481255_fdfe885f87_s.jpg', title: 'Flower8'},
    {url: 'http://static.flickr.com/60/199480111_87d4cb3e38_s.jpg', title: 'Flower9'},
    {url: 'http://static.flickr.com/70/229228324_08223b70fa_s.jpg', title: 'Flower10'}
	*/
	{url: 'http://www.sjohn.com/wp-content/themes/SJG/img/carousel/cardActivate.jpg', title: 'RFID Tradeshow Bookmarking', link: 'http://www.sjohn.com/what-we-do/index.php?ShowSample=12'},
	{url: 'http://www.sjohn.com/wp-content/themes/SJG/img/carousel/PartnerTestimonials.jpg', title: 'RFID Tradeshow Testimonials', link: 'http://www.sjohn.com/what-we-do/index.php?ShowSample=13'},
	{url: 'http://www.sjohn.com/wp-content/themes/SJG/img/carousel/BBDeviceMontageVideo.jpg', title: 'BlackBerry&reg; Device Montage Video', link: 'http://www.sjohn.com/what-we-do/index.php?ShowSample=1'},
	{url: 'http://www.sjohn.com/wp-content/themes/SJG/img/carousel/NortelAdvancedTechnologySummit.jpg', title: 'Advanced Technology Summit Video', link: 'http://www.sjohn.com/what-we-do/index.php?ShowSample=4'},
	{url: 'http://www.sjohn.com/wp-content/themes/SJG/img/carousel/SeminarSeries.jpg', title: 'Seminar Series', link: 'http://www.sjohn.com/what-we-do/index.php?ShowSample=10'},
	{url: 'http://www.sjohn.com/wp-content/themes/SJG/img/carousel/BBCESMicrosite.jpg', title: 'BlackBerry&reg; CES Microsite', link: 'http://www.sjohn.com/what-we-do/index.php?ShowSample=2'},
	{url: 'http://www.sjohn.com/wp-content/themes/SJG/img/carousel/BBSolutionGuideinteractiveCDWeb.jpg', title: 'BlackBerry&reg; Solution Guide', link: 'http://www.sjohn.com/what-we-do/index.php?ShowSample=3'},
	{url: 'http://www.sjohn.com/wp-content/themes/SJG/img/carousel/BBWindowsLiveMediaFlashVideo.jpg', title: 'BlackBerry&reg; Windows Live Media Flash Video', link: 'http://www.sjohn.com/what-we-do/index.php?ShowSample=5'},
	{url: 'http://www.sjohn.com/wp-content/themes/SJG/img/carousel/MontcrestSchoolHouseBrandIdentitySystem.jpg', title: 'Montcrest School House Brand Identity System', link: 'http://www.sjohn.com/what-we-do/index.php?ShowSample=6'},
	{url: 'http://www.sjohn.com/wp-content/themes/SJG/img/carousel/ProductDemos.jpg', title: 'Product Demos', link: 'http://www.sjohn.com/what-we-do/index.php?ShowSample=7'},
	{url: 'http://www.sjohn.com/wp-content/themes/SJG/img/carousel/RFID.jpg', title: 'Radio Frequency Identification (RFID)', link: 'http://www.sjohn.com/what-we-do/index.php?ShowSample=8'},
	{url: 'http://www.sjohn.com/wp-content/themes/SJG/img/carousel/SalesProgram.jpg', title: 'Sales Program', link: 'http://www.sjohn.com/what-we-do/index.php?ShowSample=9'},
	{url: 'http://www.sjohn.com/wp-content/themes/SJG/img/carousel/LiveEventsandTradeShows.jpg', title: 'Live Events and Trade Shows', link: 'http://www.sjohn.com/what-we-do/index.php?ShowSample=11'}	
];

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);
};


function mycarousel_getItemHTML(item)
{
	var tile;
	tile = '<div><a href="' + item.link + '">';
	tile += '<img src="' + item.url + '" width="164" height="111" alt="' + item.title + '" />';
	tile += '<br /><div style="padding-top: 5px;">' + item.title + "</div>";
	tile += '</a></div>';
	
    return tile;
};

function mycarousel_initCallback(carousel)
{
    // Disable autoscrolling if the user clicks the prev or next button.
    carousel.buttonNext.bind('click', function() {
        carousel.startAuto(0);
    });

    carousel.buttonPrev.bind('click', function() {
        carousel.startAuto(0);
    });

    // Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
};

jQuery(document).ready(function() {

    jQuery('#mycarousel').jcarousel({
		vertical: false,
        start: 1,
        offset: 1,
        size: null,
        scroll: 3,
        visible: null,
        animation: 2000,
        easing: 'swing',
        auto: 5,
		wrap: 'circular',
        reloadCallback: null,
        itemLoadCallback: null,
        itemFirstInCallback: null,
        itemFirstOutCallback: null,
        itemLastInCallback: null,
        itemLastOutCallback: null,
        buttonNextHTML: '<div></div>',
        buttonPrevHTML: '<div></div>',
		buttonNextEvent: 'mouseover',
        buttonPrevEvent: 'mouseover',
        buttonNextCallback: null,
        buttonPrevCallback: null,
        initCallback: mycarousel_initCallback,
        itemVisibleInCallback: {onBeforeAnimation: mycarousel_itemVisibleInCallback},
        itemVisibleOutCallback: {onAfterAnimation: mycarousel_itemVisibleOutCallback}
    });

/*
	jQuery('#mycarousel').jcarousel({
        itemLoadCallback: mycarousel_itemLoadCallback
    });
*/
});



/*
function mycarousel_itemLoadCallback(carousel, state)
{
    // Since we get all URLs in one file, we simply add all items
    // at once and set the size accordingly.
    if (state != 'init')
        return;

    //jQuery.get('dynamic_ajax.txt', function(data) {
	<?php echo 'jQuery.get("/wp-content/themes/SJG/dynamic_ajax.txt", function(data) {' ?>
        mycarousel_itemAddCallback(carousel, carousel.first, carousel.last, data);
    });
};

function mycarousel_itemAddCallback(carousel, first, last, data)
{
    // Simply add all items at once and set the size accordingly.
    var items = data.split('|');

    for (i = 0; i < items.length; i++) {
        carousel.add(i+1, mycarousel_getItemHTML(items[i]));
    }

    carousel.size(items.length);
};


function mycarousel_getItemHTML(url)
{
    return '<img src="' + url + '" width="75" height="75" alt="" />';
};

*/

