  function loadPage(page)
  {
    location.hash = 'page:' + page;
    $('ajax_loader').show();
    new Ajax.Updater('page_content', page,
    {
      method: 'get',
      /*evalScripts: 'true',*/
      onSuccess: function(transport){
        var response = transport.responseText || "no response text";
        $('ajax_loader').hide();
      },      
      onFailure: function() { 
        var response = transport.responseText || "An error occured";
        $('ajax_loader').hide(); 
      }
    }
     
    );
    /*
    if(page == '/e-shop.html')
    {    
      Element.addClassName(document.body, 'e-shop');    
    }
    else
    {
      Element.removeClassName(document.body, 'e-shop');
    }
    */
  };
  
  
  
  function updatePage()
  {
    var hash = readHashVars();
    // we now have a hash with attributes matching the parameters in the url
    // so if the url has #message:viewInline|id:3, we have a javascript object like
    // hash { message: viewInline, id: 3 }
    if(hash.page)
    {
      loadPage(hash.page);
    }     
  };
  
  
  function tshirtPreview(image)
  {
    preview = window.open("", "preview", "toolbar=0,location=0,directories=0,status=yes,menubar=0,scrollbars=0,resizable=yes,copyhistory=0,width=620,height=620");
    preview.document.open();
    preview.document.write("<html><head>");
    preview.document.write('<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />');    
    preview.document.write("<title>Preview / Náhled</title>");
    preview.document.write("</head><body>");    
    preview.document.write("<img " +"src='" + image + "' />");   
    preview.document.write("</body></html>");
    preview.document.close();
    return false;    
  };
  
  
  
function readHashVars()
{
  var hash = window.location.hash;
  hash = hash.substring(1);
  hash = hash.replace(/\|/g, '&');
  hash = hash.replace(/\:/g, '=');
  // lets turn our url hash into a javascript hash (like an associated array)
  // we will use a useful function provided in the prototype library
  hash = hash.parseQuery();
  return hash;
};
  
  