title: jquery lightbox select source/link based on content type
body: <p>I'm trying to create a lightbox that uses the rel attribute and the href/src (depending on the type of content). I need an if/else statement to assign an href to a variable (contentURL) if the content's a video but assign the src instead if the content's an image.</p>
  
  <p>html for video content:</p>
  
  <pre><code>&lt;a href="http://www.youtube.com/..." rel="lightbox"&gt;&lt;/a&gt;
  </code></pre>
  
  <p>html for image content:</p>
  
  <pre><code>&lt;a href="#" rel="lightbox"&gt;&lt;img src="images/photo.jpg"&gt;&lt;/a&gt;
  </code></pre>
  
  <p>Here's what I have so far:</p>
  
  <pre><code>$("a[rel='lightbox'").click(function(e){
      e.preventDefault();
      var shadow = $('#lightbox-shadow'),
          lightbox = $('#lightbox');
      shadow.fadeIn(300);
      lightbox.delay(450).fadeIn(300);
      var contentURL; //assign href or src to this variable
  
      //IF/ELSE STATEMENT HERE
  
      shadow.click(function(){
          shadow.fadeOut(300);
          lightbox.empty();
      });
  });
  </code></pre>
  
  <p>Also, if you could help me understand the ajax method for loading the content, that would be awesome! :)</p>