$(document).ready(function(){
var 	sect='div.section.a',
	item="div.content.i",
	qv="div.qv";
if($(sect)){
  $(sect+' ul').css({display:"none"});
  $(sect).css({margin:"5pt"});
	$(sect+' h4').css({display:"inline"})
			.mouseover(function(){
			$(this)
				.css({textDecoration:"underline"})
				.click(function(){
					$(this).siblings("ul").slideDown("fast");
				});
			})
			.mouseout(function(){
			$(this)
				.css({textDecoration:"none"})
				.children("ul");
    			})
    			.click(function(){
    				$("ul").slideUp(200);
    				$(this).siblings("ul").slideDown("fast");
    			});
}
if($(item)){
	$(".box:last:has(.content.i)").append("<a class='right back' href='./?p=gallery'>Main Gallery Page</a>");

	$(item).each(function(){
		var 	fImgSrc=$(this).find("a:first:has(img)").children("img:first").attr("src"),
			title=$(this).find("b:first").text();
		$(":header").css({textAlign:"left"});
		$('div.box').css({clear:"both",textAlign:"center",overflow:"hidden"});
		
		$(this).append("<a class='back right'>Back to Listings</a>");
		$(this).wrap("<div id='qv'></div>").css({display:"none"});
		$(this).before(
				 "<div class='qc'><b>"+title+"</b><br/><span>"
                  		+"<img src='"+fImgSrc+"' title='Click for more Information'/>"
                  		+"</span></div>"
                );
	});
	$(item+",.fl>*").each(function(){
    		$(this).children("a:has(img)").attr("rel","lightbox["+$(this).find("span.number").text()+"]").attr("class","lb");
	});
	$(".lb").lightbox();
	$(item).children("a.back").click(function(){
		$(this).parent().hide("fast");
		$(document.body).find(".qc").fadeIn("slow");
	});
	$("div.qc")
			.mouseover(function(){$(this).css({textDecoration:"underline"});})
			.mouseout(function(){$(this).css({textDecoration:"none"});})
			.click(function(){
				$(document.body).find(".qc").fadeOut("fast");
				$(this).siblings(".content").show("slow");
			})
	;
  $("#nixon_movie").append("<big><a hreflang='en' href='#frost-nixon' class='extra'>Recent Movie featuring the Story of Nixon</a></big><br/>");
  $("#NR_nix_brief").after("<span class='inTheMovies'></span>");
      var itm=".inTheMovies";
  $(itm).hide();
  $(".extra").click(function(){
    $(this).hide();
    $(itm).html("<br/><br/><br/><img src='sys/sty/img/pg/frost-nixon-bg.jpg' class='left'/>").fadeIn()
          .append("<ul style='list-style:none;' class='left'><li><a hreflang='en' href='http://www.frostnixon.net'>Official Website</a></li>"
               +"<li><a hreflang='en' href='http://www.movietickets.com/movie_detail.asp?movie_id=62652' class='right'>Showtimes at MovieTickets.com</a></li>"
               +"<li><a hreflang='en' href='http://www.fandango.com/frostnixon_113324/movieoverview'>Overview and Synopsis</a></li>"
               +"<li><a hreflang='en' href='http://www.moviefone.com/movie/frost-nixon/27572/main'>Reviews</a></li>"
               +"<li><a hreflang='en' href='http://movies.aol.com/golden-globes/nominee-winner'>Golden Globe Nominations</a></li>"
               +"</ul>").fadeIn();
    
  });
}
$("#lightbox").css({display:"none"});
});