$(document).ready(function() { 
	// JCarousel
	$('#partner').jcarousel({
        scroll: 1,
        wrap: 'circular',
        itemVisibleInCallback: {onBeforeAnimation: mycarousel_itemVisibleInCallback},
        itemVisibleOutCallback: {onAfterAnimation: mycarousel_itemVisibleOutCallback}
    });	
	
	// Fancybox
	fancyBoxReload();
	
}); 


// JCarousel - Funktionen
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_itemList[idx - 1].html);
	fancyBoxReload();

};

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

// Funktion, damit die FancyBox auch bei dynamisch generiertem Content funktioniert
function fancyBoxReload()
{
	if( !isIE6() ) // Nicht beim IE6
	{
		$("a.fbShow").fancybox({ 
			'hideOnContentClick': true,
			frameWidth:810,
			frameHeight:630
		});
	}
};

// Thickbox-Aufruf für IE6
function openProjekt(url)
{
	var width = 810;
	var height = 630;
	
	if( isIE6() )
	{
		tb_show('', url+'&keepThis=true&TB_iframe=true&height='+height+'&width='+width,'');
		return false;
	}
	else
		return true;
	
}

function isIE6()
{
	var browser = navigator.userAgent.toLowerCase();
	var ganzzahl = parseInt(navigator.appVersion);	
	var explorer = ((browser.indexOf("msie") != -1) && (browser.indexOf("opera") == -1));
 	var explorer6 = (explorer && (ganzzahl == 4) && (browser.indexOf("msie 6.0") !=-1));
	return explorer6;
}

function createMarker(point,html) {
	var marker = new GMarker(point);
	GEvent.addListener(marker, "mouseover", function() {
	  marker.openInfoWindowHtml(html);
	});
	return marker;
}

