def var(name)
      s = Setting.where(:name => name).first
      return "" if s.nil?    
      return s.value
    end
def var(name)
      s = Setting.where(:name => name).first
      return "" if s.nil?    
      return s.value
    end
def auth_or_error(message)
  if (!logged_in?)
    redirect_to "/login?return_url=#{request.request_uri}" and return false
  end
  redirect_to "/error?message=#{message}"
end