_cfscriptLocation = "/ajax/ehmc/functions.cfm";

var questionindex = 1;

function previousQuestion() {
	DWREngine._execute(_cfscriptLocation, null, 'getNextQuestion', questionindex, -1, updateQuestionBlock);	 
}

function nextQuestion() {
	DWREngine._execute(_cfscriptLocation, null, 'getNextQuestion', questionindex, 1, updateQuestionBlock);	 
}

function updateQuestionBlock(obj) {
	eval(obj);
	questionindex = question.index;
	$('ask-fullname').innerHTML = question.fname + ' ' + question.lname;
	$('ask-lastname').innerHTML = question.lname + ':';
	$('ask-photo').src = '/images/physicians/' + question.photo;
	$('ask-question').innerHTML = question.question;
	$('ask-answer').innerHTML = question.answer;
	$('ask-link').href = '/patienteducation/viewanswer.cfm?aid='+question.id;
}



function previousStory() {
	DWREngine._execute(_cfscriptLocation, null, 'getNextStory', questionindex, -1, updateStoryBlock);	 
}

function nextStory() {
	DWREngine._execute(_cfscriptLocation, null, 'getNextStory', questionindex, 1, updateStoryBlock);	 
}

function updateStoryBlock(obj) {
	eval(obj);
	
	questionindex = question.index;
	$('ask-fullname').innerHTML = question.patientfirstname + ' ' + question.patientlastname;
	$('ask-photo').src = '/images/patients/' + question.homepagephoto;
	$('ask-question').innerHTML = question.homeintrotext;
	
	$('ask-link').href = '/forpatients/readstory.cfm?sid='+question.patientstoryid;
}
