jQuery.noConflict($);

/*
 * Function to animate opacity in photo album thumbs
 */
//<![CDATA[

jQuery(document).ready(function($) {

    $('#primary-content a img').each(function() {
        $(this).hover(
            function() {
                $(this).stop().animate({ opacity: 0.7 }, 250);
            },
           function() {
               $(this).stop().animate({ opacity: 1.0 }, 250);
           })
        });
});

//]]>

/*
 * Function to generate "h3" for blog sidebar elements
 */
//<![CDATA[

jQuery(document).ready(function($) {

		// Add Blog Categories title
		if ($("#blog-categories").children().size() > 0) $("#blog-categories").prepend("<h3>Kategorie<\/h3>");

		// Add Blog Archives title
		if ($("#blog-archives").children().size() > 0) $("#blog-archives").prepend("<h3>Archiv z<\/h3>");

		// Add Tags title
		if ($("#secondary-content ul.blog-tag-cloud").children().size() > 0) $("#secondary-content ul.blog-tag-cloud").before("<h3>Tags<\/h3>");

	});
	
//]]>

/*
 * Enable prettyPhoto and apply dark_rounded theme
 */
//<![CDATA[

jQuery(document).ready(function($) {

		$('a[rel^="prettyPhoto"]').prettyPhoto({theme:'dark_rounded'});
		
	});	
	
//]]>

/**
 * k_menu controlls the dropdown menus and improves them with javascript
 */

jQuery(document).ready(function($){
	
	k_menu($); // controls the dropdown menu

});

function k_menu($)
{
	
	jQuery("#navigation a").removeAttr('title');
	jQuery(" navigation ul ul ").css({display: "none"}); // Opera Fix

	
	//smooth drop downs
	jQuery("#navigation li").each(function()
	{	
		
		var $sublist = jQuery(this).find('ul:first');
		
		jQuery(this).hover(function()
		{	
			$sublist.stop().css({overflow:"hidden", height:"auto", display:"none", paddingTop:40}).slideDown(200, function()
			{
				jQuery(this).css({overflow:"visible", height:"auto"});
			});	
		},
		function()
		{	
			$sublist.stop().slideUp(200, function()
			{	
				jQuery(this).css({overflow:"hidden", display:"none"});
			});
		});	
	});
}

/**
 * jQuery adding icons dynamically to links
 */

jQuery(document).ready(function($){
	
	// Add pdf icons to pdf links
	$("a[href$='.pdf']").addClass("pdf");
	 
	// Add txt icons to document links (doc, rtf, txt)
	$("a[href$='.doc'], a[href$='.txt'], a[href$='.rft']").addClass("txt");

	// Add zip icons to Zip file links (zip, rar)
	$("a[href$='.zip'], a[href$='.rar']").addClass("zip"); 
	
	// Add image icons to Image file links (jpg, png)
	$("a[href$='.jpg'], a[href$='.png']").addClass("img"); 
	
	// Add email icons to email links
	$("a[href^='mailto:']").addClass("email");

	//Add external link icon to external links
	 $('a[target="_blank"]').addClass("external");
 
});

/**
 * Widget list
 */

jQuery(document).ready(function($) {

	$('#blog-categories').find('a:last').css('border-bottom','none'); 
    $('#blog-categories a').each(function() {
        $(this).hover(
            function() {
                $(this).stop(true,false).animate({'padding-left': '15px'},200, function() {
				$(this).addClass('hover_current');
				});
			},
           function() {
           		$(this).removeClass('hover_current');
               	$(this).stop(true,false).animate({'padding-left': '0'},200);
           })
	});
});
