$(document).ready(function(){
	$('#nav').jmenu();
	$('#leftCol').jScrollPane({showArrows: true});
	$('#contents').jScrollPane({showArrows: true});
	$('.email').mailto();
	$(function() {
		$("a[href*='http://']:not([href*='"+location.hostname+"'])").click( function() {
		window.open(this.href);
		return false;
		});
   	});
	var randomImages = ['01','02','03','04','05','06','07','08','09','10','11'];
  	var rndNum = Math.floor(Math.random() * randomImages.length);
  	$("div.home").css({ background: "url(images/pages/home/bg_home_"+ randomImages[rndNum] + ".jpg) 100% 100% no-repeat" });
	$('#home').cycle({
		fx: 'fade',
		timeout: 3000,
		random: true
	});
	$('#map area').mouseover(function(){
		var title = $(this).attr('title');
		$('.closeBtn').remove();
		$('.office').fadeOut(300).delay(400);
		$('#'+title).fadeIn(300);
		$('.office').prepend('<div class="closeBtn"><img src="images/sitewide/btn_close.jpg" width="15" height="15" /></div>');
		 return false
	});
	$(".closeBtn").live('click', function(event) {
    		event.stopPropagation();
    		$('.office').fadeOut(400);
	});
	
	$('#people ul li').click(function(){
		var title = $(this).attr('class');
		$('.bio').fadeOut(300).delay(400);
		$('#'+title).fadeIn(300);
		$('.bio').prepend('<div class="closeBtnBio"><img src="images/sitewide/btn_close.jpg" width="15" height="15" /></div>');
		 return false
	});
	$(".closeBtnBio").live('click', function(event) {
    		event.stopPropagation();
    		$('.bio').fadeOut(400);
	});
	$(function() {
    		$('img[data-hover]').hover(function() {
        			$(this).attr('tmp', $(this).attr('src')).attr('src', $(this).attr('data-hover')).attr('data-hover', $(this).attr('tmp')).removeAttr('tmp');
    			}).each(function() {
        				$('<img />').attr('src', $(this).attr('data-hover'));
    			});
	});
});

Cufon.replace('#nav ul li a, #rightCol ul li',  {hover:true, fontfamily:'gotham'});
Cufon.replace('#pageTitle h2, #pageTitle p',  {fontfamily:'gotham extra'});
Cufon.replace('.sectionLinks h3 a',  {hover:true, fontfamily:'gotham'});

