
$(document).ready(function(){
  initialize_tool_tips();
  });
  
function initialize_tool_tips() {
  $("#reading_popup_link").click(function () {
    $("#reading_popup").dialog({autoOpen: false,
				  title: "Lexile Info",
				  width: "500px",
				    buttons: {
					Ok: function() {
					$(this).dialog('close');
					}}
				});
    $("#reading_popup").dialog("open");
    });
    
  $.fn.qtip.styles.fab = { // Last part is the name of the style
     width: 300,
     background: '#ffffff',
     color: 'black',
     textAlign: 'left',
     border: {
        width: 1,
        radius: 5,
        color: '#4593ae'
     },
    tip: 'topLeft',
     name: 'cream' // Inherit the rest of the attributes from the preset cream style
  };
  //Easiest way to do this is have a separate selector for each code, rather than fetching dynamic content.
  $('.code_AD').qtip({
     content: '<b>AD: Adult Directed</b><br/>Picture books often get an AD or "Adult Directed" code. They\'re usually read to a child, rather than a child reading them independently. Although seemingly easy reading, some picture books actually have pretty high Lexile measures, and could present a challenging independent reading experience to an age-appropriate reader. Initially, an adult may want to read the book along with a child.',
     style: 'fab',
     show: 'click'
  });
  $('.code_BR').qtip({
     content: '<b>BR: Beginning Reader</b><br/>A book with a Lexile measure of 0L or below is coded BR for "Beginning Reader." These books are appropriate for emergent readers. Often BR books are not used for independent reading, but are read aloud by an adult to or with the child.',
     style: 'fab',
     show: 'click' 
  });
  $('.code_GN').qtip({
     content: '<b>GN: Graphic Novel</b><br/>Graphic novels and comic books get a GN code. Text appears primarily in voice or thought bubbles integrated into comic book-style illustrations. The impact of the pictures on reading comprehension is not captured in the Lexile measure of a graphic novel.',
     style: 'fab',
     show: 'click' 
  });
  $('.code_HL').qtip({
     content: '<b>HL: High-Low</b><br/>Librarians, teachers, and booksellers sometimes refer to young adult books written at low levels as "high-low" books. HL books are useful when matching older (grade 7 and beyond) struggling or reluctant readers with books about age-appropriate topics and issues written at elementary-school reading levels.',
     style: 'fab',
     show: 'click' 
  });
  $('.code_IG').qtip({
     content: '<b>IG: Illustrated Guide</b><br/>Books that consist of short, standalone pieces of text like in an encyclopedia or glossary are given an IG code for "Illustrated Guide." Usually nonfiction, IG books are often used as a reference resource rather than read in their entirety like a storybook. The IG code doesn\'t have anything to do with reading levels, but instead conveys an idea of the kind of book and what the book typically will be used for in the classroom or library.',
     style: 'fab',
     show: 'click' 
  });
  $('.code_NC').qtip({
     content: '<b>NC: Non-Conforming</b><br/>These NC or "Non-Conforming" books have a Lexile measure markedly higher than is typical for the intended audience or designated developmental level of the book. The NC code is useful when matching high-ability readers with a book that\'s still at an appropriate developmental level. ',
     style: 'fab',
     show: 'click' 
  });
  $('.code_NP').qtip({
     content: '<b>NP: Non-Prose</b><br/>The NP or "Non-Prose" code is for any book comprising more than half non-standard prose. This includes most plays, songs, recipes, some kinds of poetry, and text with non-standard or absent punctuation. Lexile is based on prose analysis, so NP books do not receive a Lexile measure, merely the NP code.',
     style: 'fab',
     show: 'click' 
  });
}