var init = munky.init;

munkyExt = {

	init : function(){
		init();
		
		var match = location.href.match(/#(\d+)$/);
		
		if(match){
			if(match[1]!=$('#promoContent').attr('rel')){
				munky.setPromotion(match[1], match[1]);
			}
		}		
		
		$('#promotionsRight a').click(function(){
			return true;
			$(this).blur();

			$('#promoTitle').html('Loading...');
			$('#promoContent').html('');
			
			$('#promoContent').css('height', '300px');
			$('#promoContent').css('background', "#111 url('images/ajax.gif') 50% 50% no-repeat");
			
			location.href = '#'+$(this).attr('rel');
			
			munky.setPromotion($(this).attr('rel'), $(this).attr('href'));
			
			return false;
		});
	},
	
	setPromotion : function(id, failUrl){
		return;
		$('#promotionsRight a').removeClass('selected');
		$('#promotionsRight a[rel='+id+']').addClass('selected');
		
		$.getJSON(	"./ajax",
						{'id' : id},
						function(json){

							if(json[0]=="fail"){
								location.href = failUrl;
								return;
							}
							
							$('#promoContent').css('height', 'auto');
							$('#promoContent').css('background', '#111');
							
							$('#promoTitle').html(json[0]);
							$('#promoContent').html(json[1]);
							
						});
	}
}

$.extend(munky, munkyExt);
