jQuery(function($){
	
	$('#search button').click(function(){
		window.open( 'http://www.google.com/custom?hl=de&client=google-coop-np&cof=AH%3Aleft%3BCX%3AMathematics%2520at%2520School%2520Suche%3BL%3Ahttp%3A%2F%2Fwww.google.com%2Fcoop%2Fintl%2Fde%2Fimages%2Fcustom_search_sm.gif%3BLH%3A65%3BLP%3A1%3BVLC%3A%23551a8b%3BGFNT%3A%23666666%3BDIV%3A%23cccccc%3B&adkw=AELymgVG5qD5JIYh1q0NISnTdWEOXTl3Gjy04KTfFuhjLl-q5T5szCc3uqC1mWJLNrTmGcMyRr_wEG5PZjU9HDHjjYcIlsATyflyh6BAXGmZBO_UHkIxVrs8fXIIHv28ntwbKzuoUrJ6&btnG=Suche&cx=006048522592569388475%3Ak93sit6t2nq&q='+ $('#search .form-text')[0].value, "_self");
		return false;
	});
	
$('#nav-main > li.active a, #nav-main > li.active-trail a').append('<span class="i"></span><span class="ii"></span>');

$('#nav-main li').hover(function(){
	$(this).addClass('hover');
},function(){
	$(this).removeClass('hover');	
});

/* --------------------------------------------------- Inputfelder Texteingabe */
loginboxtext = "";
$('#search input.form-text').focus(function(){ 
	loginboxtext = this.value;
	this.value = "";
}).blur(function(){
	if (this.value == "") { 
		this.value = loginboxtext; 
	}
});

/* --------------------------------------------------- Externe Links als Target blank */

$("a[@href^='http']").not("a[@href*='mathematics-at-school']").attr('target','_blank');


$('#search-block-form .form-submit').found(function(){
	if ($(this).attr('value') == "Search") {
		$(this).attr('value', "Suche");
	}	
});

/* --------------------------------------------------- Sprunglinks in Navi fixen */
	
	$('#sidebar .menu a').each(function(){
		var url = this.href;
		if (url.indexOf("linksammlung#") > 0) {
			$(this).removeClass('active');
		}
	})

});



(function($) {
   $.fn.found = function(myFunction) {
      if(this.length) {
         myFunction.call(this);
      }
   };
})(jQuery);


