/*
CLCP v2.1 Clear Links to Current Page
Jonathan Snook
This code is offered unto the public domain
http://www.snook.ca/jonathan/
*/


function clearCurrentLink(){
	var a = document.getElementsByTagName("A");	
    for(var i=0;i<a.length;i++){
        if(a[i].href == window.location.href.split("#")[0]){			  		
            removeNode(a[i]);
        }
    }
}

function removeNode(n){
    if(n.hasChildNodes()){
        for(var i=0;i<n.childNodes.length;i++){
            n.parentNode.insertBefore(n.childNodes[i].cloneNode(true),n);
        }
    }
    n.parentNode.removeChild(n);
    
}

/* Set class for current page links, etc */
function setClass() {
  var cssClass = "current"; 
  var aElem=document.getElementsByTagName("a");
  for (i=0; i<aElem.length; i++) { 
    if(aElem[i].href == window.location.href.split("#")[0] && aElem[i].parentNode.tagName == "LI")	{ 	  
       aElem[i].parentNode.className = cssClass;
	   clearCurrentLink();         
	}
  }
}
function quoteLoad()	{	

   var quotes = new Array(); 
   var authors = new Array();
   quotes[0]= "Geri's ability to quickly and accurately understand my objectives and vision made the process very enjoyable.";
   authors[0] = "Kathy Eggers Goumas, Plaid Petal Floral Design";
 quotes[1]= "Geri's work on our website has been creative, productive and, in some ways, transformational.";
 authors[1] = "Nancy Lippe, Former Director MVLA Community Scholars";
 quotes[2]= "It is a gift to finally find someone who can interpret what you imagine and put it on screen.";
 authors[2] =  "Michele Garrett Laster, Casting Point Sculpture";
 quotes[3]= "Geri valued our input and ideas while continually leading us promptly towards our end goal.  Our finished product is fabulous and user friendly.";
 authors[3] = "Rochelle Bochner, Co-Founder Sky's The Limit Fund";
 quotes[4]= "Geri was an absolute professional and a pleasure to work with!  We had a very tight campaign timeline and Geri was either ahead of schedule or met deadlines spot on.";
 authors[4] = "Julia Rosenberg, Measure A Campaign Chair";
   var l = quotes.length;
   var n = randomNum(l);
   var m = n;
   while (n == m)	{
	   m = randomNum(l);
   }

   var divNode = document.getElementById("random_quote");
   var pNode = addNode(divNode,"p","quote","");
   var textNode = document.createTextNode(quotes[n]);
   pNode.appendChild(textNode);
   var divNode = document.getElementById("quote_author");
   var pNode = addNode(divNode,"p","author","");
   var textNode = document.createTextNode(authors[n]);
   pNode.appendChild(textNode);  
   
 }
function randomNum(length)	{
	var rNum = Math.random();
	rNum = rNum * (length);
	rNum = Math.floor(rNum);	
	return rNum;
}

//creates a new element node, appends it to parent.
// if text != "", this also creates a text node with text in it and appends it to element.
//sets the name and id attributes to nameId.
//adapted From page 48 of Crane and Pescarello.
function addNode(parent, element, class_id, text)
{	var childEl = document.createElement(element);
	childEl.setAttribute("class", class_id);
	if (text != "")
	{	textNode = document.createTextNode(text);
		childEl.appendChild(textNode);
	}
	parent.appendChild(childEl);
	return childEl;
}
/*Accordian */
$(document).ready(function(){

 /* $(".accordian h2:first").addClass("active");*/
	$(".accordian ul").hide();

	$(".accordian h2").click(function(){

	  $(this).next("ul").slideToggle("fast")
	  .siblings("ul:visible").slideUp("fast");
	  $(this).toggleClass("active");
	  $(this).siblings("h2").removeClass("active");

	});

});

$(function() {
        $('.accordian h2').hover(function(){
               $(this).addClass('over');
			   $(this).removeClass('out');
        }, function() {
			$(this).removeClass('over');
               $(this).addClass('out');
        });
});


	


