var gotoUrl = "";

$(document).ready(function(){    
  $(".toggleBox span.minusImage").click( myToggle );				
  $(".toggleBox span.plusImage").click( myToggle );
  $(".toggleBox span.plusImage").each( function(){
    $(this).parent().next().hide();
  });
	
	$('.foldSection').before( '<a class="foldMore" href="#">[...]</a>' ).hide();
	$('.foldMore').click( function() {
		$(this).next().show( );
		$(this).hide();
		return false;
	});

  $('.popupContainer').hide();
  $('.popupSection').tooltip( {
		  bodyHandler: function() {				 
				return $(this).next().html();
			},			 
			delay: 0,
			fade: 250,
			opacity: 1,
			top: -15, 
    	left: 5,  
			showURL: false
		} 	
	);

  $('.tx-inlinesearch-pi1 form').submit( function() {
  	$('#inlineSearchButton').click();
		return false;
	});
  
  $('#inlineSearchText').val('').coolinput( $('#inlineSearchButton').val() ); 
  $('#inlineSearchButton').hide();
  
	$('#searchResult').click( function(evt){
		evt.stopPropagation();
	}).addClass("glow makeRound");
		
	$('#inlineSearchButton').click( function() {
		var qstr		= $('#inlineSearchText').val();
		var lang		= $('#linlineSearchLang').val();			
				
		if ( qstr!="" )
		{
			var pageUrl = "index.php?type=202&L="+lang+"&"+$.param({q:qstr});

			$('#inlineSearchButton').hide();
			$('#inlineSearchWait').show();
			
			$.get( pageUrl, function(data) {
			
				// $('#inlineSearchButton').show();
				$('#inlineSearchWait').hide();
			
			
				$('#searchResult').html('').html(data).fadeIn('normal');
				$('#searchResult a').attr( "target", "_blank" );
				
				$(document).one( "click", function(){
					$('#searchResult').fadeOut('normal');
				});
				
	    });
		}				 										

		return false;
	});
});  

function myToggle()
{
  $dobj = $(this).parent().next();
  
  if ( $(this).is(".minusImage") )
    $(this).removeClass( "minusImage" ).addClass( "plusImage" );
  else  
    $(this).removeClass( "plusImage" ).addClass( "minusImage" );
  
	if ( $.browser.msie )
		$dobj.toggle();
	else
		$dobj.animate( {height: 'toggle', opacity: 'toggle' }, "normal" );        
}

