﻿jQuery(document).ready(function()
{
 //Hide all project details
 $kuj(".row").hide();

 $kuj("h3.variable").toggle(
 function(){
 //Toggle style on trigger clicked
 $kuj(this).addClass("active");
 }
 ,function(){
 //Toggle style off trigger clicked
 $kuj(this).removeClass("active");
 }
 ).click(
 function(){
 //Toggle content when trigger clicked
 $kuj(this).next(".row").slideToggle("slow,");
}
);

 //Opens the variable's documentation and highlight it yellow
 jQuery.fn.openAndFlash = function() {
$kuj(this).next(".row").slideDown("slow").effect("highlight", {}, 2500);
 }

 //If page has a URL anchor when loaded, open that documentation block
 var urlanchor = self.document.location.hash;
 if(urlanchor)
 {
 $kuj('a[name="'+urlanchor.substring(1)+'"]').parent().addClass("active").openAndFlash();
 }

 //If we are anchor-linking to an attribute on this page, simulate it being clicked, open its documentation block, and highlight it
 $kuj("a[href^=#]").click(
 function()
 {
 var attribute = $kuj(this).attr("href");
 if(attribute.length > 1)
 {
 var linkto = attribute.split("#",2);
 var linkto = linkto[1];
 $kuj('a[name="'+linkto+'"]').parent().addClass("active").openAndFlash();
 }
 }
 );
}); 
