//Pause Function

(function($) {
	$.fn.extend({
		pause: function(milli,type) {
			milli = milli || 1000;
			type = type || "fx";
			return this.queue(type,function(){
				var self = this;
				setTimeout(function(){
					$(self).dequeue();
				},milli);
			});
		},
		clearQueue: function(type) {
			return this.each(function(){
				type = type || "fx";
				if(this.queue && this.queue[type]) {
					this.queue[type].length = 0;
				}
			});
		},
		unpause: $.fn.clearQueue
	});
})(jQuery);


//Questions


//Set number of questions and default starting question
numOfQuestions = 5;
currentQuestion = 1;


var q = new Array(numOfQuestions);
var a = new Array(numOfQuestions);


q[0] = "How will this affect my benefits?";
q[1] = "What about my member ID card?";
q[2] = "Why did Preferred Care change its name to MVP Health Care?";
q[3] = "Why did you choose &ldquo;MVP Health Care&rdquo; instead of &ldquo;Preferred Care&rdquo;?";
q[4] = "What does &ldquo;MVP&rdquo; stand for?";

//Answers
a[0] = "Rest assured: if you were a Preferred Care member, your benefits are staying exactly the same. This is a change in name only. Our offices and local Member Services team are staying here in Rochester. Our commitment to supporting the culture and community of this region is staying the same.";
a[1] = "All Preferred Care members received a new member ID card in the mail in April. And your member number is staying the same!";
a[2] = "In 2006, our companies combined. And now, as we continue to launch new products, services and benefits across our combined service area, we need to simplify to just one name &ndash; to be more efficient and less confusing for our members and the many doctors and hospitals in our network.";
a[3] = "Both MVP and Preferred Care are top-rated, well-known brand names in their own service areas. MVP Health Care is an independent company serving more than 740,000 members in N.Y., VT. and N.H., including 330,000 Preferred Care members in the Greater Rochester region. We chose the name of the larger plan to make this transition as easy as possible.";
a[4] = "When MVP began 25 years ago in eastern New York State, it was called Mohawk Valley Physicians Health Plan. As the service area expanded beyond the Mohawk Valley, the name changed to MVP Health Care. MVP is headquartered in Schenectady, N.Y. near Albany.";



function clickNext() {
	if (currentQuestion >= q.length) {
		questionToDisplay = 1;
	}
	else {
		questionToDisplay = (currentQuestion + 1);
	}
	currentQuestion = questionToDisplay;
	
	$("#questionOverlay")
		.fadeIn("slow")
		.pause(100)
		.fadeOut("slow");
	$("#answerOverlay")
		.fadeIn("slow")
		.pause(100)
		.fadeOut("slow");
	setTimeout(function(){$("#question").html("<p>" + q[(questionToDisplay - 1)] + "</p>");}, 800);
	setTimeout(function(){$("#answer").html("<p>" + a[(questionToDisplay - 1)] + "</p>");}, 800);
	$("#number")
		.html(currentQuestion);
}



function clickPrev() {
	if (currentQuestion <= 1) {
		questionToDisplay = (q.length);
	}
	else {
		questionToDisplay = (currentQuestion - 1);
	}
	currentQuestion = questionToDisplay;

	$("#questionOverlay")
		.fadeIn("slow")
		.pause(100)
		.fadeOut("slow");
	$("#answerOverlay")
		.fadeIn("slow")
		.pause(100)
		.fadeOut("slow");
	setTimeout(function(){$("#question").html("<p>" + q[(questionToDisplay - 1)] + "</p>");}, 800);
	setTimeout(function(){$("#answer").html("<p>" + a[(questionToDisplay - 1)] + "</p>");}, 800);
	$("#number")
		.html(currentQuestion);
}
