var IQTest = {

  _q_num: 1,
  _q_total: 10,

  init: function() {
    if (typeof sc_sentinel == 'function') {
      if (!sc_sentinel({cookie_name:'IQTest_completed'})) {
        return;
      }
    }
    else if (Get_Cookie('IQTest_completed') == 'true') {
      return;
    }

    $('#inputzone').hide();
    $('#question_index').show();
    $('#container').removeClass('imagestep1').addClass('imagestep0');
    $('#question_zone #answers a').click(function(e) {e.preventDefault(); IQTest.next();});
  },

  startTest: function() {
    $('#question_index').hide();
    $('#question_zone').fadeIn('slow');
  },

  next: function() {
    this._q_num++;
    if (this._q_num > this._q_total) {
      this.endTest();
    }
    else {
      $('#question_zone').attr('class', 'q'+this._q_num);
    }
  },

  endTest: function() {
    $('#question_zone').hide();
    $('#question_gender').fadeIn('slow');
  },

  end: function() {
    $('#operatorlist').val($('#question_operatorlist').val());
    $('#question_gender').hide();
    $('#inputzone').fadeIn('slow');
    $('#container').removeClass('imagestep0').addClass('imagestep1');
    Set_Cookie('IQTest_completed', 'true');
  },

  checkTerms: function(message) {
    if (! $('#terms')) return true;
    if ($('#terms').attr('type') == 'hidden') return true;
    if (! $('#terms').attr('checked')) {
      // highlight the checkbox
      $('#term_warn_box').css('visibility', 'visible');
      $('#term_cb_wrap').addClass("term_cb_highlight");
      alert(message);
      return false;
    }
    return true;
  }
};



top.window.moveTo(0,0);
if (document.all) {
	top.window.resizeTo(screen.availWidth,screen.availHeight);
}
else if (document.layers||document.getElementById) {
	if (top.window.outerHeight<screen.availHeight||top.window.outerWidth<screen.availWidth){
		top.window.outerHeight = screen.availHeight;
		top.window.outerWidth = screen.availWidth;
	}
};

landingControlHolder['precontroller'] = IQTest;