  var message = '#saori';
$(function() {
        var wtitle = '';
      	var dialogOptsSmall = {
              modal: true,
              width: 380,
              height: 320,
              overlay: {
                background: "url(images/notice.png) repeat"
              }
        };
      	var dialogOptsLarge = {
              modal: true,
              width: 690,
              height: 400,
              overlay: {
                background: "url(images/notice.png) repeat"
              }
        };
      	var dialogOptsWide = {
              modal: true,
              width: 680,
              height: 500,
              overlay: {
                background: "url(images/notice.png) repeat"
              }
        };
      	var dialogOptsLogin = {
              modal: true,
              width: 380,
              height: 260,
              overlay: {
                background: "url(images/notice.png) repeat"
              }
        };
      	var dialogOptsLogout = {
              modal: true,
              width: 380,
              height: 320,
              overlay: {
                background: "url(images/notice.png) repeat"
              }
		 };	  
      	var dialogOptsInfo = {
              width: 320,
              height: 200,
              overlay: {
                background: "url(images/notice.png) repeat"
              }
        };

 $(function() {
   $('a[href$=1]').bind('click', {msg: message}, function(event) {       // reservar bibliografia
    $("#dialog1").dialog(dialogOptsLarge);
    $("#dialog1").dialog({ dialogClass: 'dialogmodal' });
    $("#dialog1").dialog( "option", "buttons", { "Fechar janela": function() { $(this).dialog("close"); } } );
    $("#dialog1").dialog( "option", "title", 'Reservar Bibliografia' );
    event.preventDefault();                          // alert(1);
    $("#myFrame").replaceWith("");                   // alert(  $(event.target).attr('title'));
        $('<iframe />', {
            name: 'myFrame',
            id:   'myFrame',
            src:  $(event.target).attr('title'),
            width:  '100%',
            height: '100%',
            frameborder: '0'
        }).appendTo('#dialog1');

   });
 });


    $('a[href$=3]').click(function(e)   {   // minhas reservas
           $("#dialog3").dialog(dialogOptsLarge);      // alert(3);
           $("#dialog3").dialog({ dialogClass: 'dialogmodal' });
           $("#dialog3").dialog( "option", "buttons", { "Fechar janela": function() { $(this).dialog("close"); } } );
           $("#dialog3").dialog( "option", "title", 'Minhas Reservas' );
            e.preventDefault();
           $("#myFrame").replaceWith("");
        //    wtitle =  "../shared/my_reserve.php?mbrid=<?php echo $_SESSION['mbrid'];?>";
              wtitle =  "../shared/loginformreserve.php?pwhocall=myreserve";
            $('<iframe />', {
                name: 'myFrame',
                id:   'myFrame',
                src:  wtitle,
                width:  '100%',
                height: '100%',
                frameborder: '0'
            }).appendTo('#dialog3');


    });
    $('a[href$=2]').click(function(e)   {   // login
           $("#dialog2").dialog(dialogOptsLogin);
           $("#dialog2").dialog({ dialogClass: 'dialogmodal' });
           $("#dialog2").dialog( "option", "buttons", { "Fechar janela": function() { $(this).dialog("close"); } } );
           $("#dialog2").dialog( "option", "title", 'Login OPAC SAORI Web Bibliotheca' );
            message = '#dialog';          // alert(2);
            e.preventDefault();
           $("#myFrame").replaceWith("");
            wtitle =  "../shared/loginformreserve.php?pwhocall=mylogin";
            $('<iframe />', {
                name: 'myFrame',
                id:   'myFrame',
                src:  wtitle,
                width:  '100%',
                height: '100%',
                frameborder: '0'
            }).appendTo('#dialog2');
  });
    $('a[href$=5]').click(function(e)   {   // minhas pesquisas
           $("#dialog5").dialog(dialogOptsLarge);
           $("#dialog5").dialog({ dialogClass: 'dialogmodal' });
           $("#dialog5").dialog( "option", "buttons", { "Fechar janela": function() { $(this).dialog("close"); } } );
           $("#dialog5").dialog( "option", "title", 'Minhas Pesquisas' );
            message = '#dialog';         //  alert(5);
            e.preventDefault();
           $("#myFrame").replaceWith("");
        //    wtitle =  "../shared/my_dsi.php?mbrid=<?php echo $_SESSION['mbrid'];?>";
            wtitle =  "../shared/loginformreserve.php?pwhocall=mydsi";
            $('<iframe />', {
                name: 'myFrame',
                id:   'myFrame',
                src:  wtitle,
                width:  '100%',
                height: '100%',
                frameborder: '0'
            }).appendTo('#dialog5');
  });
    $('a[href$=a]').click(function(e)   {   // meu perfil
           $("#dialoga").dialog(dialogOptsLarge);
           $("#dialoga").dialog({ dialogClass: 'dialogmodal' });
           $("#dialoga").dialog( "option", "buttons", { "Fechar janela": function() { $(this).dialog("close"); } } );
           $("#dialoga").dialog( "option", "title", 'Meu Perfil' );
            message = '#dialog';         //  alert(a);
            e.preventDefault();
           $("#myFrame").replaceWith(""); 
            wtitle =  "../shared/loginformreserve.php?pwhocall=myperfil";
            $('<iframe />', {
                name: 'myFrame',
                id:   'myFrame',
                src:  wtitle,
                width:  '100%',
                height: '100%',
                frameborder: '0'
            }).appendTo('#dialoga');
  });
    $('a[href$=6]').click(function(e)   {   // buy sugestions
           $("#dialog6").dialog(dialogOptsWide);
           $("#dialog6").dialog({ dialogClass: 'dialogmodal' });
           $("#dialog6").dialog( "option", "buttons", { "Fechar janela": function() { $(this).dialog("close"); } } );
           $("#dialog6").dialog( "option", "title", 'Minhas Sugestões' );
            message = '#dialog';        //   alert(6);
            e.preventDefault();
           $("#myFrame").replaceWith("");
      //      wtitle =  "../shared/buy_sugestion_listS.php?mbrid=<?php echo $_SESSION['mbrid'];?>";
            wtitle =  "../shared/loginformreserve.php?pwhocall=mysugestions";
            $('<iframe />', {
                name: 'myFrame',
                id:   'myFrame',
                src:  wtitle,
                width:  '100%',
                height: '100%',
                frameborder: '0'
            }).appendTo('#dialog6');
  });
    $('a[href$=7]').click(function(e)   {   // troca de senha
           $("#dialog7").dialog(dialogOptsWide);
           $("#dialog7").dialog({ dialogClass: 'dialogmodal' });
           $("#dialog7").dialog( "option", "buttons", { "Fechar janela": function() { $(this).dialog("close"); } } );
           $("#dialog7").dialog( "option", "title", 'Trocar Senha' );
            message = '#dialog';       //    alert(7);
            e.preventDefault();
           $("#myFrame").replaceWith("");
        //    wtitle =  "../shared/change_pass.php?mbrid=<?php echo $_SESSION['mbrid'];?>";
            wtitle =  "../shared/loginformreserve.php?pwhocall=changepass";
            $('<iframe />', {
                name: 'myFrame',
                id:   'myFrame',
                src:  wtitle,
                width:  '100%',
                height: '100%',
                frameborder: '0'
            }).appendTo('#dialog7');
  });
    $('a[href$=8]').click(function(e)   {   // meus empréstimos
           $("#dialog8").dialog(dialogOptsLarge);
           $("#dialog8").dialog({ dialogClass: 'dialogmodal' });
           $("#dialog8").dialog( "option", "buttons", { "Fechar janela": function() { $(this).dialog("close"); } } );
           $("#dialog8").dialog( "option", "title", 'Meus Empréstimos' );
            message = '#dialog';         //  alert(8);
            e.preventDefault();
           $("#myFrame").replaceWith(""); 
            wtitle =  "../shared/loginformreserve.php?pwhocall=mybooks";
            $('<iframe />', {
                name: 'myFrame',
                id:   'myFrame',
                src:  wtitle,
                width:  '100%',
                height: '100%',
                frameborder: '0'
            }).appendTo('#dialog8');
  });
    $('a[href$=9]').bind('click', {msg: message}, function(event) {     // exemplares
    $("#dialog9").dialog(dialogOptsLarge);
    $("#dialog9").dialog({ dialogClass: 'dialogmodal' });
    $("#dialog9").dialog( "option", "buttons", { "Fechar janela": function() { $(this).dialog("close"); } } );
    $("#dialog9").dialog( "option", "title", 'Exemplares da Bibliografia' );

    event.preventDefault();                          // alert(9);
    $("#myFrame").replaceWith("");                   // alert(  $(event.target).attr('title'));
        $('<iframe />', {
            name: 'myFrame',
            id:   'myFrame',
            src:  $(event.target).attr('title'),
            width:  '100%',
            height: '100%',
            frameborder: '0'
        }).appendTo('#dialog9');
  });
    $('a[href$=0]').bind('click', {msg: message}, function(event) {     // minhas seleções
    $("#dialog0").dialog(dialogOptsLarge);
    $("#dialog0").dialog({ dialogClass: 'dialogmodal' });
    $("#dialog0").dialog( "option", "buttons", { "Fechar janela": function() { $(this).dialog("close"); } } );
    $("#dialog0").dialog( "option", "title", 'Minhas Seleções' );

    event.preventDefault();                          // alert(9);
    $("#myFrame").replaceWith("");                   // alert(  $(event.target).attr('title'));
        $('<iframe />', {
            name: 'myFrame',
            id:   'myFrame',
            src:  $(event.target).attr('title'),
            width:  '100%',
            height: '100%',
            frameborder: '0'
        }).appendTo('#dialog0');
  });
 $(function() {
   $('a[href$=4]').bind('click', {msg: message}, function(event) {      // logout
    $("#dialog4").dialog(dialogOptsLogout);
    $("#dialog4").dialog({ dialogClass: 'dialogmodal' });
    $("#dialog4").dialog( "option", "buttons", { "Fechar janela": function() { $(this).dialog("close"); } } );
    $("#dialog4").dialog( "option", "title", 'Logout OPAC SAORI Web Bibliotheca' );
    event.preventDefault();                        //    alert(4);
  //    wtitle= "../shared/logout.php";
     wtitle =  "../shared/loginformreserve.php?pwhocall=logout";
    $("#myFrame").replaceWith("");                   // alert(  $(event.target).attr('title'));
        $('<iframe />', {
            name: 'myFrame',
            id:   'myFrame',
            src:  wtitle,
            width:  '100%',
            height: '100%',
            frameborder: '0'
        }).appendTo('#dialog4');

   });
 });

  	$(document).ready(function(){
	    $("#dialogb").hide();
		$('a[href$=b]').bind('click', {msg: message}, function(event) {    
                    $("#dialogb").dialog(dialogOptsInfo);  
                    $("#dialogb").dialog( "option", "title", 'Informações da Bibliotheca' );
		});			

	});
	
 


 });
 

