function showhidepanel(item) {
	var _trigger = $('#'+item+'_bar');
	var _command = $('#'+item+'_bar .command a');
	var _item = $('#'+item+'_content');
	if(_item.is(':hidden')) {
		_command.text('» hide');
		_trigger.removeClass('overlay');
	}else{
		_command.text('« show');
		_trigger.addClass('overlay');
	}
	_item.showhide({mode:'slide'});
}

function show_hide_donation(elem) {
	var _item = $('#'+elem);
	_item.showhide({mode:'slide'});
}


// modal pop up
// partly based on http://webcloud.se/log/Building-modal-panels-with-jQuery/
jQuery.fn.modalPopup = function(settings){
	var config = {
  	'opacity': '0.6',
    'width': '600',
    'target': 'topupwindow',
    'trigger': $(this)
  };
  if (settings){$.extend(config, settings);}

	//Create our overlay object
  var overlay = $("<div id='modal-overlay'></div>");
        
  var modalWindow = $("<div id='modal-window'></div>");          
	var _body = $('body');
	var _popup = $('#'+config.target);
					
	var left = (_body.width()-config.width)/2;
 
  return this.each(function(){

  	//Listen for clicks on objects passed to the plugin
    //$(this).click(function(e) {

    //Append the overlay to the document body
    _body.append(overlay.click(function() { 
    	modalHide(); 
    }))

    //Set the css and fade in our overlay
    overlay.css("opacity", config.opacity);
    overlay.fadeIn(250);

    //Prevent the anchor link from loading
    //e.preventDefault();

    //Activate a listener 
    $(document).keydown(handleEscape);
                  
    modalWindow.append(_popup.html());
		modalWindow.css('width',config.width+'px');
		modalWindow.css('left',left+'px');
		_body.append(modalWindow);
		modalWindow.fadeIn(250);

    //});
  });

  //Our function for hiding the modalbox
  function modalHide() {
    $(document).unbind("keydown", handleEscape)
    	var remove = function() { 
      $(this).remove(); 
    }
    overlay.fadeOut(remove);
    modalWindow
 			.fadeOut(remove)
			.empty();
  }

  //Our function that listens for escape key.
  function handleEscape(e) {

    if (e.keyCode == 27) {
    	modalHide();
  	}
  }
};


// show/ hide object
jQuery.fn.showhide = function(settings){
    var config = {
    	'mode': 'fade', // normal, slide, fade
    	'action': '' // normal, slide, fade
    };
    if (settings){$.extend(config, settings);}
 
    return this.each(function(){
    	if(config.mode == 'slide') {
    		if(!$(this).is(':hidden') || config.action == 'hide') {
    			$(this).slideUp('300');
    		}else{
    			$(this).slideDown('800');
    		}
        }else if(config.mode == 'fade') {
    		if(!$(this).is(':hidden') || config.action == 'hide') {
    			$(this).fadeOut('200');
    		}else{
    			$(this).fadeIn('500');
    		}
        }else{
    		if(!$(this).is(':hidden') || config.action == 'hide') {
    			$(this).hide();
    		}else{
    			$(this).show();
    		}
        }
    });
};

function none() {
}

function setStatus(text) {
}

