
var RESPONSES = {

"basic" : ["Signs point to yes.",
     "Yes.",
     "Most likely.",
     "Without a doubt.",
     "Yes - definitely.",
	   "As I see it, yes.",
     "You may rely on it.",
     "Outlook good.",
     "It is certain.",
     "It is decidedly so.",
     "Reply hazy, try again.",
     "Better not tell you now.",
     "Ask again later.",
     "Concentrate and ask again.",
    "Cannot predict now.",
    "My sources say no.",
    "Very doubtful.",
    "My reply is no.",
    "Outlook not so good.",
    "Don't count on it."],

"job" : ["Unemployment benefits aren't so bad", "You're screwed", "Don't count on it", "Start looking for a new job", "Ever thought about a career in the circus", "If you have Woo as a strength then no"],

"releasing": ["Make sure you aren't on call", "No Chance in hell!", "Unlikely"]
}

var UNITS = ["points/days", "days", "weeks", "months", "qtrs", "years"]
var units = UNITS[0]
var estimate_template = new Template("<h3 id=\"estimate_response\" class=\"important\">#{value} #{units}</h3>")

var ESTIMATE_SCALE =
{"exponential": [1, 3, 5, 8, 13, 21, 34, 55, 89, 154],
 "binary": [1, 2 ,4, 8, 16, 32, 64, 128, 256, 512, 1024]
}

function get_estimate(scale) {
  return get_random(10 * scale)
}

function ask_question(group) {
  return RESPONSES[group][get_random(RESPONSES[group].length)]
}

function set_estimate_response() {
  var estimate = get_random(100);
  $('estimate_response').replace(estimate_template.evaluate({"value": estimate, "units": units}))
}

function set_response_for(group) {
  var response = ask_question(group);
  $('question_response').replace("<h3 id=\"question_response\">" + response + "</h3>")
}

function get_random(value)
{
    var ranNum= Math.floor(Math.random()*value);
    return ranNum;
}

function guesstimate() {
  set_estimate_response()
  set_response_for('basic')
}
