/*!
 * JavaScript enhancement driven by jQueryv1.4.2
 * http://jquery.com/
 *
 * Copyright 2010, Thomas Apfelbacheer
 * http://strom-im-zoo.de
 *
 *
 * Date: April 26 2010
 */
/*!
 * JavaScript enhancement driven by jQueryv1.4.2
 * http://jquery.com/
 *
 * Copyright 2010, Thomas Apfelbacheer
 * http://strom-im-zoo.de
 *
 *
 * Date: April 26 2010
 */
jQuery.noConflict();

jQuery(document).ready(function() {
	var addthis_config = {
     ui_language: "de"
}

	// Hide the slidingPanel an make it animatable
	jQuery('a.hidePanel').hide();
	slidePanel();
	// clear the Value of the searchinput
	defaultValue = jQuery('#SearchForm_SearchForm_Search').val();  
	jQuery('#SearchForm_SearchForm_Search').click(function() {
		if( this.value == defaultValue ) {jQuery(this).val("");}
	});
	// 	bind hoverfunction to social icons
	//	elasticthumbs();
	jQuery(':input[type=submit]').addClass("green");
 	
 	//nivoslider on homepage and sponsorslide
 	var total = jQuery('#slider img').length;
	var totalSponsors = jQuery('#sponsorslide a').length;
	var rand = Math.floor(Math.random()*total);
	
	if( jQuery.isFunction(jQuery.fn.nivoSlider) ){
	// function exists, so we can now call it
	jQuery('#slider').nivoSlider({
		effect:'fold', //Specify sets like: 'fold,fade,sliceDown'
		slices:5,
		animSpeed:500,
		pauseTime:20000,
     	startSlide:rand,
     	keyboardNav:true, //Use left & right arrows
		pauseOnHover:true, //Stop animation while hovering
		captionOpacity:0.0 //Universal caption opacity
	});
}
	
	
	
	
	
	jQuery('#sponsorslide').gallery({
		autoAnimation: true,
		stopTime: 10000,
		transitionTime: 500
	});
 
 	// uniform loaded? yes: style the input elements 
 	if( jQuery.isFunction(jQuery.fn.uniform) ){
	// function exists, so we can now call it
	jQuery("select, input:checkbox, input:radio, input:file").uniform();
}
 	
 	
 	// uniform loaded? yes: style the input elements 
	if(jQuery().embedly) {
	jQuery("#Content a.video,#BlogContent a.video").embedly({maxWidth: 624, wrapElement: 'div', method : "after" });
	jQuery("#Content a.photo,#BlogContent a.photo").embedly({maxWidth: 400, wrapElement: 'div', method : "after" });	
	} else {
 		console.log('embedly_plug is not loaded')
	}

	// include the google Tracker
    jQuery.trackPage('UA-15981180-1');
 
 });
 

	
// Functions	
function slidePanel(){
 	jQuery('div#BtnSearch a').click(function() {
 		
  		jQuery('div#searchrow').slideToggle('fast', function() {
		jQuery('#BtnSearch a').toggle();
		if ( jQuery("div#BtnSearch a.hidePanel").is(':visible')){
		 	jQuery("div#BtnSearch a.hidePanel").css('display', 'block');
		} 
  		});
	return false;
	});
	jQuery('div#BtnLogin a').click(function() {
  		jQuery('div#loginrow').slideToggle('fast', function() {
		 jQuery('#BtnLogin a').toggle();
  		});
	});
 };

// todo	
function elasticthumbs (){
	jQuery('.menuitem img').animate({width: 100}, 0);
			jQuery('.menuitem').mouseover(function(){
					gridimage = jQuery(this).find('img');
					gridimage.stop().animate({width: 200}, 150);
				}).mouseout(function(){
					gridimage.stop().animate({width: 100}, 150);
			});
};

