﻿	      function getPalabra_callback(response){

              var palabra = response.value;
              if (palabra == "noPalabra")
                  palabra = 'Palabra desconocida en este diccionario';
              
             $jq("#jqPopupDicco").html(palabra);
             $jq("#jqPopupDicco").dialog('destroy');
             $jq("#jqPopupDicco").dialog({width: 600, 
                                         height: 400,
                                         modal:true,
                                         resizable: false,
                                         title:''});
             $jq("#accordion").accordion({
                autoHeight: false
             });
	      }
  	    
  	    function getFichaTecnica_callback(response){
  	        if (response.value != "")
  	        {
                 $jq("#jqPopupFicha").html(response.value);
                 $jq("#jqPopupFicha").css({'background-color': 'white', 'font-family':'Verdana', 'font-size':'12px','overflow':'auto'});
                 var titulo ="";                 
                 if ($jq("#jqPopupFicha [id='dvFicha']") != null){
                    titulo = $jq("#jqPopupFicha [id='dvFicha']").attr("title")
                 }
                 $jq("#jqPopupFicha").dialog('destroy');
                 $jq("#jqPopupFicha").dialog({width: 600, 
                                             height: 400,
                                             modal:true,
                                             resizable: false,
                                             title:titulo});
            }
	      }
  	    
	      function getLink_callback(response){
  	    
  			 try {
			    var resp = response.value;
    			
			    //alert (resp.tipo + ", " + resp.url);
          
    			
			    if (resp.tipo == 0){        // misma ventana
			        location.href = resp.url;
			    }
			    if (resp.tipo == 1){        // nueva ventana
              // para los documentos ofimaticos pasamos de nueva ventana
			        if (resp.tipoContenido == 13){
                location.href = resp.url;
              }else{
			          window.open(resp.url); 
              }
			    }
			    if (resp.tipo == 2){        // flotante
    			
               var heightPopup = $jq(window).height()-100;
               var widthPopup = $jq(window).width()-100;
               
               switch (resp.tipoContenido){
                    case 8:
                        heightPopup = 520;
                        widthPopup = 710;
                        break;
                      
                    case 9:  
                        if (resp.alto != 0) {
                            heightPopup = resp.alto;
                        }
                        else {
                            heightPopup = 475;
                        }
                          
                        if (resp.ancho != 0) {
                            widthPopup = resp.ancho;
                        }
                        else {
                            widthPopup = 785;
                        }
                    
                      break;
                      
                    case 10:  
                        if (resp.alto != 0) {
                            heightPopup = resp.alto;
                        }
                        if (resp.ancho != 0) {
                            widthPopup = resp.ancho;
                        }
                        
                      break;
                      
                    case 14: 
                      if (resp.alto != 0){
                        heightPopup = resp.alto;
                      }else{
                        heightPopup = 600;
                      }
                      
                      if (resp.ancho != 0){
                        widthPopup = resp.ancho;
                      }else{
                        widthPopup = 800;
                      }
                    
                      break;
                      
                    case 11:
                      heightPopup = 200;
                      widthPopup = 400;
                      break;
                    
                    case 15:
                      heightPopup = 300;
                      widthPopup = 500;
                      break;
                    case 18:
                      heightPopup = 480;
                      widthPopup = 700;
                      break;
                    
               } 

               // valores max
               if (heightPopup > $jq(window).height()-100){
                  heightPopup = $jq(window).height()-100;
               }
               if (widthPopup > $jq(window).width()-100){
                    widthPopup = $jq(window).width()-100;
               }
                                  
               $jq("#ifContents").css({'width': widthPopup, 'height': heightPopup});
               $jq("#ifContents").attr("src", resp.url);
                      
               $jq("#jqueryPopup").dialog('destroy');
               $jq("#jqueryPopup").dialog({width: widthPopup + 4, 
                                           height: heightPopup + 45,
                                           modal: true,
                                           resizable: false,
                                           title: resp.nombre,
                                           close: function(event, ui) {
                                            $jq("#ifContents").attr("src", "");}
                                           });
  			
			  }
              }
              catch(err) { }
  			
  			
	      }
  	    
	      function getRuta_callback(response){
      			
			      var resp = response.value;
			      $jq("#VisorLibros")[0].fnRcvLibro(resp);
  			
	      } 