var _currentVisibleOfferId = null;

function showOffer(offerId){
	if (_currentVisibleOfferId !== null){
		$(_currentVisibleOfferId + "_qb").style.display = "none";
		$(_currentVisibleOfferId).style.display = "none";
	}
	$(offerId + "_qb").style.display = "";	
	$(offerId).style.display = "";
	_currentVisibleOfferId = offerId
	var offerLink;
	for(var offerIndex = 0; offerIndex < _offerCodes.length;offerIndex ++){
		if (_offerCodes[offerIndex].id === offerId)
		{
			offerLink=$(offerId + "_link");
			if(offerLink!==null)offerLink.style.textDecoration = "underline";
		}else{
			offerLink=$(_offerCodes[offerIndex].id + "_link");
			if(offerLink!==null)offerLink.style.textDecoration = "";
		}
	}
}


function initOffer(offerId){
	var hash=window.location.hash;
	if(typeof(hash)!="undefined" && hash.length){
		hash = hash.replace("#", "");
		for(var offerIndex = 0; offerIndex < _offerCodes.length;offerIndex ++){
			if (_offerCodes[offerIndex].code === hash) { 
				showOffer(_offerCodes[offerIndex].id);
				return;
			}
		}
	}
	showOffer(offerId);
}
