jQuery(document).ready(function(){
	jQuery("#rightarrow").click(function(){
			//
		scrollpanel(1200);
		return false;
		
    });

    jQuery("#leftarrow").click(function(){
	
		scrollpanel(-1200);
		return false;
		
    });
	
	function scrollpanel(delta){
		var targetx = jQuery("#thumbnailpanel").offset().left - jQuery("#thumbnailpanel").parent().offset().left - delta;
		if(targetx > 0) targetx = 0;
		if(targetx < -jQuery("#thumbnailpanel").width() + delta) targetx = -jQuery("#thumbnailpanel").width() + delta;
		//jQuery("#debug").text("targetx: " + targetx + " tnp width:" + jQuery("#thumbnailpanel").width() + "  delta: " + delta);
      jQuery("#thumbnailpanel").stop().animate({"left": targetx}, "slow");
		return false;
	}
	
	function showimg(url, descr){
		//alert("show:" + url + jQuery("#largeimage").html());
		jQuery("#largeimage").html("<img src='" + url + "'>");
		jQuery("#imgdescr").html( descr );
		jQuery("#imgdescr").removeClass( "sIFR-replaced" );
		sIFR.replaceElement("#imgdescr", named({sFlashSrc: "/alotta/user/carstenkofalk.com/gfx/tradegothiccondensed.swf", sColor: "#666666", sCase: "upper", sHoverColor: "#000"}));
		
	}
	
	jQuery("#leftcolumn li a[href='/15']").parent().addClass('news');
	//jQuery("#leftcolumn li a[href='/15']").parent().addClass('archiv');
	jQuery("#leftcolumn li a[href='"+categoryurl+"']").parent().addClass('active');
	//jQuery("#categorynavigation").appendTo(jQuery("#leftcolumn li.active"));	
	jQuery("#thumbnailpanel a").click(function(e) { showimg( jQuery(this).attr('id'), jQuery(this).attr('title') ); return false;});
	
	
	if(typeof sIFR == "function"){
		sIFR.bHideBrowserText = true;
		sIFR.replaceElement("#gallerynavigation>.sbbox>.sbcont>ul>li, #imgdescr, #copyright", named({sFlashSrc: "/alotta/user/carstenkofalk.com/gfx/tradegothiccondensed.swf", sColor: "#666666", sCase: "upper", sHoverColor: "#000", sWmode: "transparent"}));
	};

});
