jQuery(document).ready(function(){

	/*<!-- START ZOOM-FUNCTION BEI CLICK ENLARGE -->*/

		if ( jQuery("a[target='thePicture']").length ){
			
			jQuery("a[target='thePicture']").find("img:last").after("<span class='lupe'></span>");

			jQuery("#col3 a[target='thePicture']").removeAttr("onclick");
			jQuery("#col3 a[target='thePicture']").wrap("<div class='pic_block'></div>");

			jQuery(".pic_block").each(function(){
				jQuery(this).find("img:first").after("<div class='big_picture'><img src='' /></div>");
				jQuery(this).find(".big_picture").hide();
			});

			jQuery(".pic_block").click(function(){

				if(jQuery(this).find("img:first").hasClass("small_picture")){
					
					jQuery(".small_picture").click(function(){
						jQuery(this).hide();
						jQuery(this).parent().find(".big_picture").show();
						jQuery(this).parent().find(".lupe").hide();
					});
				}

				else{
					jQuery(this).find("a img").removeAttr("width");
					jQuery(this).find("a img").removeAttr("height");
					
					var imgbig = jQuery(this).find("a").attr("href").split("file=");
					var imgbig = imgbig[1].split('&width=');
					var imgbig = imgbig[0].replace("%2F","/");
					var imgbig = imgbig.replace("%2F","/");
					var imgbig = imgbig.replace("%2F","/");
					var imgbig = imgbig.replace("%2F","/");
					
					jQuery(this).find("a").removeAttr("href");

					jQuery(this).find("img:first").addClass("small_picture");
					jQuery(this).find("img:last").attr("src", imgbig);
					
					jQuery(this).find("a").removeAttr("href");

					jQuery(this).find(".small_picture").hide();
					jQuery(this).find(".big_picture").show();
					jQuery(this).find(".lupe").hide();
					};

				jQuery(".big_picture").click(function(){
					jQuery(this).hide();
					jQuery(this).parent().find(".small_picture").show();
					jQuery(this).parent().find(".lupe").show();
				});

			});
		}

	/*<!-- END ZOOM-FUNCTION BEI CLICK ENLARGE -->*/

	/*<!-- START ABFRAGEN WIE GROSS COL3 WERDEN SOLL -->*/
	
		//if (jQuery("#col1_content").children().size() == "0"){jQuery("#col3").css("margin-left","0px");}
		//if (jQuery(".box_background").children().size() == "0"){jQuery("#col3").css("margin-right","0px");}	
	
	/*<!-- END ABFRAGEN WIE GROSS COL3 WERDEN SOLL -->*/

	/*<!-- START UMBRÜCHE IN TT_NEWS-ANSICHT -->*/

		if (jQuery('#col3 div').hasClass('.news_list_item')){
			jQuery('.news_list_item:eq(2)').after("<div style='width:95%;float:left;height:40px;'></div>");
			jQuery('.news_list_item:eq(5)').after("<div style='width:95%;float:left;height:40px;'></div>");
			jQuery('.news_list_item:eq(8)').after("<div style='width:95%;float:left;height:40px;'></div>");
			jQuery('.news_list_item:eq(11)').after("<div style='width:95%;float:left;height:40px;'></div>");
			jQuery('.news_list_item:eq(14)').after("<div style='width:95%;float:left;height:40px;'></div>");
			jQuery('.news_list_item:eq(17)').after("<div style='width:95%;float:left;height:40px;'></div>");
			jQuery('.news_list_item:eq(20)').after("<div style='width:95%;float:left;height:40px;'></div>");
			jQuery('.news_list_item:eq(23)').after("<div style='width:95%;float:left;height:40px;'></div>");
			jQuery('.news_list_item:eq(26)').after("<div style='width:95%;float:left;height:40px;'></div>");
			jQuery('.news_list_item:eq(29)').after("<div style='width:95%;float:left;height:40px;'></div>");
			jQuery('.news_list_item:eq(32)').after("<div style='width:95%;float:left;height:40px;'></div>");
			jQuery('.news_list_item:eq(35)').after("<div style='width:95%;float:left;height:40px;'></div>");
		};

	/*<!-- END UMBRÜCHE IN TT_NEWS-ANSICHT -->*/

	/*<!-- START UMBRÜCHE IN SITEMAP -->*/

		if (jQuery('#col3 div').hasClass('.csc-sitemap')){
			jQuery('.csc-sitemap ul li:nth-child(3)').after("<div style='clear:both;height:5px;'></div>");
		};

	/*<!-- END UMBRÜCHE IN SITEMAP -->*/

	/*<!-- START INITIALISIERE FONTSIZER -->*/

		jQuery('#fontsizer').jfontsizer({
			applyTo: '#main',
			changesmall: '2',
			changelarge: '4',
			expire: 30
		});

	/*<!-- END INITIALISIERE FONTSIZER -->*/

	/*<!-- START LOGIN BOX FUNKTIONEN -->*/
		
		jQuery("#Login_Tab").click(function(){
			jQuery("#Login_Tab").toggleClass("login_active");
			jQuery("#Login_Text").toggleClass("login_active");
		});

	/*<!-- END LOGIN BOX FUNKTIONEN -->*/

	/*<!-- START INITIALISIERE GALERIE IM HEADER-BEREICH -->*/

		if (jQuery('#header_gallery ul li').hasClass('.gallery_item')){
			jQuery('#header_gallery ul li:last').remove();
			jQuery("#header_gallery").carousel({
				loop: true, 
				autoSlide: true,
				effect: "fade",
				animSpeed: 1500
			});	
		}
		else{
			jQuery('#header_gallery ul').append('<li></li>');
		};

	/*<!-- END INITIALISIERE GALERIE IM HEADER-BEREICH -->*/

	/*<!-- START Normale Tabelle in Zebra konvertieren -->*/
	   jQuery(".contenttable tr:even").addClass("tr-even"); 
	   
	   jQuery(".contenttable tr:odd").addClass("tr-odd"); 

	   jQuery(".contenttable-3 tr:even").removeClass("tr-even"); 
	   
	   jQuery(".contenttable-3 tr:odd").removeClass("tr-odd");  

	   jQuery(".user-table tbody tr:even").addClass("tr-even"); 
	   
	   jQuery(".user-table tbody tr:odd").addClass("tr-odd"); 

	/*<!-- END Normale Tabelle in Zebra konvertieren -->*/

	/*<!-- START PAGE COMMENTS CLICK-FUNKTIONEN -->*/

		jQuery(".show_comments").click(function(){
			jQuery(".tx-skpagecomments-pi1").toggle();
			jQuery(".hint_to_register").toggle();
		});
	
	/*<!-- END PAGE COMMENTS CLICK-FUNKTIONEN -->*/

});