/* sign in form */

/*
{
   	var thiz = $(this);
   	return thiz.is(':visible') ? thiz.stop(true,true).fadeOut() : thiz.stop(true,true).fadeIn();
*/

$.fn.fadeToggle = function(speed, easing, callback) {
	return $(this).animate({opacity: 'toggle'}, speed, easing, callback);
};




$(function() {
	$("#profileLinks li.userEmail strong").hover(function(){
	           $(this).addClass('hover');
	       }, function(){
	           $(this).removeClass('hover');
	       }).click(function(){
	           $("#signInForm").fadeToggle();
	       });
});

/*
$(function() {
	$("#topArea ul#profileLinks li.userEmail form#signInForm").addClass("hide");
	$("#topArea ul#profileLinks li.userEmail strong").hover(function(){
		$(this).addClass('hover');
		}, function() {
			$(this).removeClass('hover');
		$("#topArea ul#profileLinks li.userEmail strong").click(function(){
				$("#topArea ul#profileLinks li.userEmail form#signInForm").toggleClass('show');
			});
		});
});
*/

/* language bar */
$(function() {
	$("#topArea ul#profileLinks li.language ul").addClass("hide");
	$("#topArea ul#profileLinks li.language").hover(function(){
		$("#topArea ul#profileLinks li.language ul").addClass('show');
	}, function() {
	    $("#topArea ul#profileLinks li.language ul").removeClass('show');
	});
});

/* hover on <LI> for main navigation */
$(function() {
	$('ul#mainNavigation li').hover(function() {
		$(this).addClass('hover');
		}, function() {
		$(this).removeClass('hover');
	});
});


$(document).ready(function(){
	/* tabs for quicklinks */
	//$('#select').tabs();
	$('#select').tabs({
	    fx: { opacity: 'toggle', duration: 'fast' }
	});
	/* tabs for glossary */
	/*
	$('#glossaryLinks').tabs({
	    fx: { opacity: 'toggle', duration: 'fast' }
	});
	*/
	$("#signInForm").fadeToggle();
	defaultSearchValue = $('#sword')[0].value;
	$('#sword').focus(function() {
		if ($(this)[0].value === defaultSearchValue) {
			$(this)[0].value = '';
		}
	});
	$('#sword').blur(function() {
		if ($(this)[0].value === '') {
			$(this)[0].value = defaultSearchValue;
		}
	});
	/* load large image in container for IMG library */
	/*
	$('a.redirIfPossible').livequery('click', 
		function(event) {
		$('#ajaxContainer').empty();
		$('#ajaxContainer').append('<img src="fileadmin/templates/images/loading.gif" class="loading" alt="Loading... Please wait"');
		$('#ajaxContainer').load($(this).attr("href") + ' div#selectedImage'); 
		event.preventDefault(); 
 	});
	*/
});
