// Open Error-Message-Box
function showError(headline, content, errorClass)
{
    
    if (typeof errorClass == 'undefined') errorClass = 'notice';    
    var errorContent = '<h1>' + headline + '</h1><p>' + content + '</p>';
    $("#errorMessage").addClass(errorClass).html(errorContent).slideDown();
	// scroll to top, so user can read the error message
	$(window).scrollTop(0);
    
}


// colors for default value
var active_color 	= '#676c6a'; 	// Colour of user provided text
var inactive_color 	= '#d5d6d6'; 	// Colour of default text


// jQuery Ready-Handler
$(function() {
	
	// Hide all elements which should be initially hidden
    $(".hidden").hide();

	// defaultValue of input form (lighter color and get replaced)
	// Written by Rob Schmitt, The Web Developer's Blog (http://webdeveloper.beforeseven.com/)
	$("input.default_value").css("color", inactive_color);
	var default_values = new Array();
	$("input.default_value").focus(function() {
	  if (!default_values[this.id]) {
	    default_values[this.id] = this.value;
	  }
	  if (this.value == default_values[this.id]) {
	    this.value = '';
	    this.style.color = active_color;
	  }
	  $(this).blur(function() {
	    if (this.value == '') {
	      this.style.color = inactive_color;
	      this.value = default_values[this.id];
	    }
	  });
	});

	
	// add zebra-stripes to odd cells in .zebra tables (via .each so each table starts new)
	$("table.zebra").each(function(){
		$(this).find("tbody tr:odd td").css("background-color", "#eee");
	});


	// standard dialog for displaying a confirmation-message
	$('a.confirm').click(function(){
	  return confirm(langAreYouSure);
	});

	// generic class for go back to previous page
    $('a.goBack').click(function(event){
		event.preventDefault();
		history.back();
	});
});