//<![CDATA[
var itemList = [
	{href:'', url: 'fileadmin/images/partner/3m-medica-grau.png', hover: 'fileadmin/images/partner/3m-medica-farbe.png', title: '', height: 105, width: 195},
	{href:'', url: 'fileadmin/images/partner/asmuth-grau.png', hover: 'fileadmin/images/partner/asmuth-farbe.png', title: '', height: 105, width: 195},
	{href:'', url: 'fileadmin/images/partner/biotronik-grau.png', hover: 'fileadmin/images/partner/biotronik-farbe.png', title: '', height: 105, width: 195},
	{href:'', url: 'fileadmin/images/partner/catgut-grau.png', hover: 'fileadmin/images/partner/catgut-farbe.png', title: '', height: 105, width: 195},
	{href:'', url: 'fileadmin/images/partner/colopast-grau.png', hover: 'fileadmin/images/partner/colopast-farbe.png', title: '', height: 105, width: 195},
	{href:'', url: 'fileadmin/images/partner/coringermany-grau.png', hover: 'fileadmin/images/partner/coringermany-farbe.png', title: '', height: 105, width: 195}
	
];

function autoStart(carousel)
{
	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();
    });
}

function getItemHTML(item)
{
	return '<a href="' + item.href + '"><img src="' + item.url + '" alt="' + item.title + '" width="'+item.width+'" height="'+item.height+'" onmouseover="this.src = \''+item.hover+'\';" onmouseout="this.src = \''+item.url+'\';"/></a>';
}

function itemVisible(carousel, item, i, state, evt)
{
	var idx = carousel.index(i, itemList.length);
    carousel.add(i, getItemHTML(itemList[idx - 1]));
}

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

$(document).ready(function() {
	$("#content-slider").jFlow({
		slides: "#slides",
		width: "981px",
		height: "314px"
	});
	$('#partner-carousel').jcarousel({
		animation: 1500,
		scroll: 1,
		auto: 1.5,
		initCallback: autoStart,
		wrap: "circular",
		itemVisibleInCallback: {onBeforeAnimation: itemVisible},
        itemVisibleOutCallback: {onAfterAnimation: itemInvisible}
	});
	$('#partner-carousel-vertical').jcarousel({
		animation: 1500,
		vertical: true,
		scroll: 1,
		auto: 1.5,
		initCallback: autoStart,
		wrap: "circular",
		itemVisibleInCallback: {onBeforeAnimation: itemVisible},
        itemVisibleOutCallback: {onAfterAnimation: itemInvisible}
	});
});
//]]>

