$().ready(function() {

    $("#leftSide").height( $(document).height() );

    $('#dynamicMapDialog').jqm({ajax:'@href',trigger:'.dynamicMapLink',modal:true,toTop:true});
    //$('#authDialog').jqm({ajax:'@href',trigger:'.authLink',modal:true});


  var loadInIframeModal = function(hash){
       var $trigger = $(hash.t);
       var $modal = $(hash.w);
       var myUrl = $trigger.attr('href');
       var myTitle = $trigger.attr('title')
       var iframeHeight = $trigger.attr('iframeHeight');

       var $modalContent = $("iframe", $modal);

       if (iframeHeight!=null) {
           $modalContent.html('').attr('height', iframeHeight);
       }
       $modalContent.html('').attr('src', myUrl);
       //let's use the anchor "title" attribute as modal window title
       $('#jqmTitle').text(myTitle);
       $modal.show();
   };

   // initialise jqModal
   $('#iframeDialog').jqm({
       modal: true,
       trigger: '.iframeDialogLink',
       target: '#jqmContent',
       onShow:  loadInIframeModal,
       toTop:true
   });

  // Load the nav links
  loadNavLinks();

});

function loadNavLinks() {

    //$("#navLinks").append("<li><a href=\"photos.html\">Photo Gallery</a></li>");

}

function closeAuthDialog() {
    $('#iframeDialog').jqmHide();
}
function closeIframeDialog() {
    $('#iframeDialog').jqmHide();
}

function reloadScreen() {
    //alert("Reloading the screen");
    window.location = window.location.href;//.reload(true);
}

