var total_carousel_length;
var current_carousel_length;

$(document).ready(function(){
	$('.submitbutton,.button').hover(function(){
		$(this).addClass('pointer');
	},function(){
		$(this).removeClass('pointer');
	});
	
	$('select[name=artists]').change(function() {
		var value = ($(this).val());
		if(value!='') {
			window.location=value;
		}
	});
	$('select[name=artists] option[selected]').click(function() {
		var value = ($(this).val());
		if(value!='') {
			window.location=value;
		}
	});
	$('#f_searchterm').toggleVal();
	swfobject.embedSWF('flash/intro.swf', 'flashreplacement', '726', '451', '8.0.0','/scripts/expressInstall.swf', {}, {'wmode': 'transparent', 'menu': 'false', 'allowscriptaccess': 'always'}, {});
	
	$('a.camera').hover(function(){
		$(this).css('background-image',$(this).css('background-image').replace(/\.gif/,'_on.gif'));
	},function(){
		$(this).css('background-image',$(this).css('background-image').replace(/_on\.gif/,'.gif'));
	});
	
	jQuery('#mycarousel').jcarousel({
		scroll: 1,
		visible: 1,
		warp: 'both',
		animation: 'slow',
		buttonNextHTML: null,
		buttonPrevHTML: null,
		initCallback: mycarousel_initCallback,
		wrap: 'both'
    });
	$('.galerie p.float a').each(function(){
		var tmp = String($(this).attr('href')).split('#');
		$(this).attr('href','Javascript:void(0);')
		$(this).attr('rel',tmp[1]);
	});
	$('.galerie p.float a').click(function(){
		var tmp_rel = $(this).attr('rel');
		$('.scroll-pane').each(function(){
			this.scrollTo('a[name='+tmp_rel+']');
		});
	});
	
	$('.scroll-pane').jScrollPane({
		dragMinHeight: 50,
		scrollbarWidth: 15
	});
	$("a[rel='fancybox']").attr('href','Javascript:void(0)');
	$("a[rel='fancybox']").click(function() {;$.fancybox({"padding": 0,"href":"../events/Events_Peuckert_Detail.jpg","transitionIn": "none","transitionOut": "none"});});
});

function mycarousel_initCallback(carousel) {
   /* jQuery('.jcarousel-control a').bind('click', function() {
        carousel.scroll(jQuery.jcarousel.intval(jQuery(this).text()));
        return false;
    });

    jQuery('.jcarousel-scroll select').bind('change', function() {
        carousel.options.scroll = jQuery.jcarousel.intval(this.options[this.selectedIndex].value);
        return false;
    });*/

    jQuery('#carousel_next').bind('click', function() {
        carousel.next();
        return false;
    });

    jQuery('#carousel_prev').bind('click', function() {
        carousel.prev();
        return false;
    });
	
};

/* Zoom */
function startZoom(){
		
	if (ganz_grosses_bild != "") {
		
		var imgWidth = $("img#shadowbox_content").width();
		var imgHeight = $("img#shadowbox_content").height();
		var ratio = imgWidth / imgHeight;
		
		var decision;
		if (ratio <= 1.5) {
			decision = "right";
			$("div#shadowbox").css("right","100px");
		}
		else {
			decision = "top";
			$("div#shadowbox").css("top","10px");
		}
		
		$("img#shadowbox_content").wrap("<a href='" + ganz_grosses_bild + "' class='zoomInfo' title='" + imgTitle + "'></a>");
		$("a.zoomInfo").css("display", "block");

		var options = {
			zoomWidth: 250,
			zoomHeight: 250,
			position: decision,
			alwaysOn: true
		};
		$(".zoomInfo").jqzoom(options);
	}else{
		return false;
	}

};

function removeZoom(){
	$('.jqZoomWindow').remove();
	$('div.jqZoomPup').remove();
	
}


