(function($){
    var origContent = "";

    function loadContent(hash) {        		
		if(hash != "") {         
			  switch(hash){
				case "/now_playing/":
					//show_page(0,0);
					break;
				case "/playing/":
					show_page(0,0);
					break;
				case "/beam_collection/":
					show_page(1,0);
					break;
				case "/get_beam/":
					show_page(2,0);
					break;
				case "/store/":
					show_page(3,0);
					break;
				case "/what_is_beam/":
					show_page(5,0);
					break;
				case "/help/":
					show_page(6,0);
					break;
				case "/home/":
					show_page(7,0);
					break;
				case "/mobile/":
					show_page(8,0);
					break;	
				case "/contact/":
					show_page(9,0);
					break;	
				case "/desktop/":
					show_page(10,0);
					break;				
				default:	
				given=hash.split("/");
				if(given[1]=="purchase"){
						buy_album(given[2]);
						$.colorbox.close();
						return;
				}	
				if(given[1]=="channel"){
						show_store_id(given[2],given[2],1)
				}
				else
				{
					show_details(given[1],given[1],1);
				}
							
			} 	
        } 
		else
		{
			//default	
		}
    }

    $(document).ready(function() {
            $.history.init(loadContent);
            //$('#navigation a').not('.external-link').click(function(e) {                    
				//	var url = $(this).attr('href');
                 //   url = url.replace(/^.*#/, '');
                  //  $.history.load(url);
                   // return false;
                //});
        });
})(jQuery);



