if (typeof OV == "undefined" || !OV) {
    var OV = {};
}

OV.expertSpotlight = {};

OV.expertSpotlight.nextExpert = function(e, forward) {
	YAHOO.util.Event.preventDefault(e);
	var url = '/topics/replace_expert_spotlight';
	if (!forward) url += '?previous=true';
	if (context_type != null && context_id != null) url += ((!forward) ? '&' : '?') + 'context_type=' + context_type + '&context_id=' + context_id;
	var obj = YAHOO.util.Connect.asyncRequest('GET', url, OV.expertSpotlight.expertSpotlightCallback);
	OV.loading.showSpinner("spotlightSpinner", "expertSpotlight");
}

OV.expertSpotlight.expertSpotlightCallback = {
	success: function(o) {
    	YAHOO.util.Dom.get("takeAction").innerHTML = o.responseText;
		OV.loading.hideSpinner("spotlightSpinner", "expertSpotlight");
		YAHOO.util.Event.addListener("nextExpertSpotlight", "click", OV.expertSpotlight.nextExpert, true);
		YAHOO.util.Event.addListener("previousExpertSpotlight", "click", OV.expertSpotlight.nextExpert, false);
  	},
	failure: function(o) {
		OV.loading.hideSpinner("spotlightSpinner", "expertSpotlight");
	},
	cache:false
}
