ReferenceError: launchWindow is not defined

ReferenceError: launchWindow is not defined

This is a modified version of a script I found on the web earlier on. It works great up until I try and invoke the use of another HTML file (content.html), at which point it errors as in the title.

It also gives the same error if you move the "'content.html ' + " from line 9 to line 34.

No such error occurs if you just try and load an element in the same HTML file.

No such error occurs when using .load() with essentially the same code.

What gives? Help appreicated!

---

  1. $(document).ready(function() {   
  2.     //on click of an a tag with .downloadLink as class
  3.     $('.downloadLink').click(function(e) {
  4.        
  5.         //stop the link from following through
  6.         e.preventDefault();
  7.        
  8.         //Get the a href tag and suffix that to content.html[space]
  9.         var id = 'content.html ' + $(this).attr('name');
  10.    
  11.         //Get the screen height and width
  12.         var maskWidth = $(window).width();
  13.         var maskHeight = $(document).height();
  14.    
  15.         //Set height and width to mask to fill up the whole screen
  16.         $('#downloadMask').css({'width':maskWidth,'height':maskHeight});
  17.        
  18.         //transition effect
  19.         $('#downloadMask').fadeIn(1000);
  20.         $('#downloadMask').fadeTo("slow",0.7);   
  21.    
  22.         //Get the window width and height
  23.         var winW = $(window).width();
  24.         var winH = $(window).height();
  25.              
  26.         //Set the popup window to center
  27.         $(id).css('top',  winH/2-$(id).height()/2);
  28.         $(id).css('left', winW/2-$(id).width()/2);
  29.    
  30.         //transition effect
  31.         $(id).fadeIn(2000);
  32.        
  33.         //id is the ID for the DIV you want to display it as modal window
  34.           launchWindow(id);
  35.    
  36.     });
  37.    
  38.     //if close button is clicked
  39.     $('.downloadDialogExit').click(function (e) {
  40.         //Cancel the link behavior
  41.         e.preventDefault();
  42.         $('#downloadMask, .downloadDialog').fadeOut(400);
  43.         $('#downloadMask, .downloadDialog').fadeTo("fast");
  44.     });       
  45.    
  46.     //if mask is clicked
  47.     $('#downloadMask').click(function () {
  48.         //hide the mask and dialog
  49.         $('#downloadMask, .downloadDialog').fadeOut(200);
  50.         $('#downloadMask, .downloadDialog').fadeTo("fast");
  51.     });           
  52.    
  53.     $(window).resize(function () {
  54.  
  55.          var box = $('.downloadDialog');
  56.  
  57.         //Get the screen width and height
  58.         var maskWidth = $(window).width();
  59.         var maskHeight = $(document).height();
  60.      
  61.         //Set height and width to mask to fill up the whole screen
  62.         $('#downloadMask').css({'width':maskWidth,'height':maskHeight});
  63.               
  64.         //Get the window width and height
  65.         var winW = $(window).width();
  66.         var winH = $(window).height();
  67.  
  68.         //Set the popup window to center
  69.         box.css('top',  winH/2 - box.height()/2);
  70.         box.css('left', winW/2 - box.width()/2);
  71.  
  72.     });
  73. });