$(document).ready(function(){
    if (window.location.hash == "") {
        $("#container").load("aindex.php");
       } else if (window.location.hash == "#news") {
        $("#container").load("anews.php");
       } else if (window.location.hash == "#team") {
        $("#container").load("ateam.php");
       } else if (window.location.hash == "#index") {
        $("#container").load("aindex.php");
       } else if (window.location.hash == "#listen") {
        $("#container").load("alisten.php");
       } else if (window.location.hash == "#last10") {
        $("#container").load("alast10");
       } else if (window.location.hash == "#downloads") {
        $("#container").load("adownloads.php");
       } else if (window.location.hash == "#friends") {
        $("#container").load("afriends.php");
       } else if (window.location.hash == "#listenhere") {
        $("#container").load("ahere.php");
       } else if (window.location.hash == "#listenmy") {
        $("#container").load("aplayers.php"); 
       } else if (window.location.hash == "#special") {
        $("#container").load("aspecial.php"); 
       }
       else if (window.location.hash == "#bot") {
         console.log("bot");
        url = 'add_nonstop';
	view = false;
	$.ajax({
	        type: "POST",
         	url: "http://perfect-radio.ru/4admin_sky/CI/dindex.php/common_controller/load_container" ,
	    	data: "url=" + url + "&view=" + view,
	    	    dataType: "json",
	    	        success: function(data){
		    	    	$("#container").html(data.container);
	    		        },
		    	    error: function (xhr, ajaxOptions, thrownError){
		    			console.log("error");
    			        }
		});
       }
       else $("#container").load("aindex.php");
       

    $("#uprava").click(function () {
     $("div.hider").css({display:"block"});
//     $("#uprava").css({display:"none"});
//     $("#uprava2").css({display:"block"});
      $("#uprava").hide();
      $("#uprava2").show();
      $("#container").show('slow');
    });
    $("#uprava2").click(function () {
     $("div.hider").css({display:"none"});
//     $("#uprava").css({display:"block"});
//     $("#uprava2").css({display:"none"});
     $("#uprava").show();
     $("#uprava2").hide();
     $("#container").hide('slow');
    });
    $("#index").click(function () {
     $("#container").load("aindex.php");
     document.location.hash="#index";
    });
     $("#newz").click(function (){
      $("#container").load("anews.php");
      document.location.hash="#news";
    });
     $("#team").click(function (){
      $("#container").load("ateam.php");
      document.location.hash="#team";
    });
     $("#listen").click(function (){
      $("#container").load("alisten.php");
      document.location.hash="#listen";
    });
     $("#last10").click(function (){
      $("#container").load("alast10.php");
      document.location.hash="#last10";
    });
     $("#downloads").click(function (){
       $("#container").load("adownloads.php");
       document.location.hash="#downloads";
    });
     $("#friends").click(function (){
      $("#container").load("afriends.php");
      document.location.hash="#friends";
    });
     $("#listenhere").click(function (){
      $("#container").load("ahere.php");
      document.location.hash="#listenhere";
    });
     $("#listenmy").click(function (){
      $("#container").load("aplayers.php");
      document.location.hash="#listenmy";
    });
     $("#special").click(function (){
      $("#container").load("aspecial.php");
      document.location.hash="#special";
    });

});
