function do_the_feast() {
	var t = document.getElementById('js-notify');
	t.style.display = 'none';
}
function removeMePleaseById(id) {
	var t = document.getElementById(id);
	t.style.display = 'none';
}
function removeMePlease(thing) {
	thing.style.display = 'none';
}

Ext.ns('wt.eats');
Ext.onReady(function() {
//	Ext.get('js-notify').remove();
	wt.initializer.init();
	wt.util.icon.reg('arrow_right.png','cancel.png');
	Ext.get('apply-btn').show();



	var prescreenPanel = new Ext.Panel({
		id : 'prescreenPanel',
		hidden: true,
		renderTo : 'pre-screen',
		buttonAlign: 'left',
		width: 450,
		border: false,
		items: [{
				xtype:'panel',
				html: '<h3>Before you get started, please answer the following pre-screening questions:</h3><br/>',
				border: false
			},{
				xtype: 'form',
				border: false,
				id: 'prescreenForm',
				labelAlign: 'top',
				bodyStyle : 'margin: 10px'
		}],
		buttons: [{
			text: 'Continue',
			iconCls: 'icon-arrow-right',
			id: 'continue',
			listeners: {
				'click' : {
					fn: function() {
						var apply = true;
						Ext.each(Ext.getCmp('prescreenForm').items.items, function(item) {
							answer = Ext.getCmp(item.id).getValue().boxLabel;
							if (answer != item.desiredAnswer ) {
								apply = false;
							}
						});
						if (apply === false) {
							Ext.Msg.show({
								title: 'Results',
								msg: 'Based on your answers to the pre-screening questions you do ' +
										'not meet the minimum requirements for this position, when you ' +
										'click OK you will be redirected to the employment home page.',
								buttons: Ext.MessageBox.OK,
								icon: Ext.MessageBox.CANCEL,
								fn: function() {
									window.location="index";
								}
							});
						} else {
							window.location="apply-check?position_id="+position_id;
						}
					}
				}
			}
		},{
			text: 'Cancel',
			iconCls: 'icon-cancel',
			handler: function() {
				window.location="index";
			}
		}]
	});
	wt.eats.questionsStore = new Ext.data.JsonStore({
		id: 'questionsStore',
		url: 'position-details-data',
		autoLoad:true,
		root: 'payload',
		fields: ['id','question','desired_answer'],
		getTotalCount: 'total',
		baseParams: {
			task: 'LOAD',
			position_id: position_id
		}
	});
	wt.eats.questionsStore.on('load',function() {
		Ext.each(wt.eats.questionsStore.data.items, function(data) {
			Ext.getCmp('prescreenForm').add({
				xtype: 'radiogroup',
				fieldLabel : data.data.question,
				width: 100,
				id : 'question'+data.data.id,
				allowBlank : false,
				desiredAnswer: data.data.desired_answer,
				items : [{
							boxLabel : 'Yes',
							name : data.data.id,
							inputValue : 'Yes'
						}, {
							boxLabel : 'No',
							name : data.data.id,
							inputValue : 'No'
						}]
			});	
		});
	});
		Ext.get('apply-btn').on('click', function() {
		if (has_questions == 1) {
				Ext.getCmp('prescreenPanel').show();
				Ext.get('details').slideOut();
				Ext.get('apply-btn').hide();
				Ext.getCmp('prescreenForm').doLayout();
		} else {
			window.location="apply-check?position_id="+position_id;
		}
	});
});
