Cufon.replace('.bio-copy h2', { fontFamily: 'Gotham Medium' });
Cufon.replace('h2.cufon', { fontFamily: 'Gotham Bold' });
Cufon.replace('h3.cufon', { fontFamily: 'Gotham Medium' });
Cufon.replace('h4.cufon', { fontFamily: 'Gotham Book' });
Cufon.replace('.heading h2', {hover:true, fontFamily: 'Gotham Book' });
Cufon.replace('.tango h5', {hover:true, fontFamily: 'Gotham Book' });
Cufon.replace('.post h2', {hover:true, fontFamily: 'Gotham Medium' });
Cufon.replace('.page h2', {hover:true, fontFamily: 'Gotham Medium' });
Cufon.replace('.project h4', {hover:true, fontFamily: 'Gotham Book' });
Cufon.replace('.features h4', {hover:true, fontFamily: 'Gotham Bold'});
Cufon.replace('#nav-menu', {hover:true, fontFamily: 'Gotham Medium' });

 $(function () {
	$(".features div").click(function(){
	  window.location=$(this).find("a").attr("href"); return false;
	});
});




$(function(){

	$('div.casestudy .client').click(function() {
		location.href = $('a',this).attr('href');
	});
	
$('div#clientlist').hide();
	$("a#clist").click(function(){
		$("div#clientlist").toggle();
		$(this).toggleClass("active");
		return false;});
});


$(function(){
    var config = {    
         sensitivity: 3, // number = sensitivity threshold (must be 1 or higher)    
         interval: 200,  // number = milliseconds for onMouseDown polling interval    
         over: doOpen,   // function = onMouseDown callback (REQUIRED)    
         timeout: 200,   // number = milliseconds delay before onMouseOut    
         out: doClose    // function = onMouseOut callback (REQUIRED)    
    };
    function doOpen() {
        $(this).addClass("hover");
        $('ul:first',this).css('visibility', 'visible');
    }
    function doClose() {
        $(this).removeClass("hover");
        $('ul:first',this).css('visibility', 'hidden');
    }
});




function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}
function insertAfter(newElement,targetElement) {
  var parent = targetElement.parentNode;
  if (parent.lastChild == targetElement) {
    parent.appendChild(newElement);
  } else {
    parent.insertBefore(newElement,targetElement.nextSibling);
  }
}
function faviconizeDivClass() { 
  if (!document.getElementsByTagName) return false;
  if (!document.createElement) return false;
  var span = document.getElementsByTagName("span");
  for (var i=0; i<span.length; i++) {
  	if (span[i].className == "favicon") {
  		var links = span[i].getElementsByTagName("a");
  		for (var j=0; j<links.length; j++) {
  			var hoststring = /^http:/;
  			var hrefvalue = links[j].getAttribute("href",2);
			if (hrefvalue.search(hoststring) != -1) {
				var domain = hrefvalue.match(/(\w+):\/\/([^/:]+)(:\d*)?([^# ]*)/);
				domain = RegExp.$2;
				var cue = document.createElement("img");
				cue.className = "faviconimg";
				var cuesrc = "http://"+domain+"/favicon.ico";
				cue.setAttribute("src",cuesrc);
				cue.onerror = function () {
					this.src = "/wp-content/themes/Festival/images/external.png";
					}
				links[j].parentNode.insertBefore(cue,links[j]);
			}
		}
  	}
  }
}
addLoadEvent(faviconizeDivClass);