function slideSwitch() {
    var $active = $('#slideshow img.active');
    if ( $active.length == 0 ) $active = $('#slideshow img:last');
    var $next =  $active.next().length ? $active.next()
        : $('#slideshow img:first');
    $active.addClass('last-active');
    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() { $active.removeClass('active last-active'); });
}

$(function() { setInterval( "slideSwitch()", 5000 ); });

$(document).ready(function() {

    $(".zjunction").click(function() {
		$.fancybox([
			{ 'href' : 'images/zjunction.gif',  'title' : 'Customising of open source application (osCommerce)' }
		], {
			'padding'			: 22,
            'overlayShow' : false,
            'autoScale'   : false,
            'cyclic' : true,
            'titlePosition'     : 'over',
			'transitionIn'		: 'elastic',
			'transitionOut'		: 'elastic',
			'type'              : 'image',
			'changeFade'        : 0
		});
	});

    $(".sarugby").click(function() {
		$.fancybox([
			{ 'href' : 'images/sarugby-upload1.gif',  'title' : 'Customising of commercial application (FileStore)' },
			{ 'href' : 'images/sarugby-upload2.gif',  'title' : 'Customising of commercial application (FileStore)' }
		], {
			'padding'			: 22,
            'overlayShow' : false,
            'autoScale'   : false,
            'cyclic' : true,
            'titlePosition'     : 'over',
			'transitionIn'		: 'elastic',
			'transitionOut'		: 'elastic',
			'type'              : 'image',
			'changeFade'        : 0
		});
	});

    $(".pcsquare").click(function() {
		$.fancybox([
			{ 'href' : 'images/pcsquare-admin1.gif',  'title' : 'Customising of open source application (PHP List)' },
			{ 'href' : 'images/pcsquare-admin2.gif',  'title' : 'Customising of open source application (PHP List)' },
			{ 'href' : 'images/pcsquare-public1.gif', 'title' : 'Customising of open source application (PHP List)' },
			{ 'href' : 'images/pcsquare-public2.gif', 'title' : 'Customising of open source application (PHP List)' }
		], {
			'padding'			: 22,
            'overlayShow' : false,
            'autoScale'   : false,
            'cyclic' : true,
            'titlePosition'     : 'over',
			'transitionIn'		: 'elastic',
			'transitionOut'		: 'elastic',
			'type'              : 'image',
			'changeFade'        : 0
		});
	});

});
