// This contains all base javascript (e.g. siFR, swfobject calls, etc)

//  base.js
//  
//  Created by Matt Dills on 2010-04-02.
//  Copyright 2010 Scully Group. All rights reserved.
// 

$(document).ready(function() {
  
  /////////////////////////////////////////////////////////////// cufon
  
  // American Typewriter Regular
  Cufon.set('fontfamily', 'Eurostile')
  Cufon.replace('#main-nav a', {hover:true});
  Cufon.replace('h2.section-title');
  Cufon.replace('h1.glossary');
  Cufon.replace('#sub-nav ul', {hover:true});
  Cufon.replace('#feature h2', {hover:true});
  Cufon.replace('#interior-header h2', {textShadow: '#5e5e60 2px 2px'});
  Cufon.replace('#interior-header h4', {textShadow: '#5e5e60 2px 2px'});
  Cufon.replace('#home-features p.link', {hover:true});
  Cufon.replace('#interior-content h1', {hover:true});
  Cufon.replace('#bottom-nav a', {hover:true});
  Cufon.replace('#footer-content p', {hover:true});

  /////////////////////////////////////////////////////////////// interior image background frame
  
  $("#interior-content #image-right").each(function(){
    $(this).parent().wrap("<div id='interior-imagebox'></div>");
    $(this).wrap("<div id='interior-image'></div>");
  });
  
  $("#interior-content .image-bio").each(function(){
    $(this).parent().wrap("<div class='interior-imageboxbio'></div>");
    $(this).wrap("<div class='interior-imagebio'></div>");
  });

  /////////////////////////////////////////////////////////////// rollovers  
  
  $('#main-nav ul li').each(function() {
    $(this).hover(function() {
      $(this).addClass('nav-on');
    }, function() {
      $(this).removeClass('nav-on');
    });
  });
  
  $('#main-nav ul.subnav li').each(function() {
    $(this).hover(function() {
      $(this).addClass('subnav-on');
    }, function() {
      $(this).removeClass('subnav-on');
    });
  });
  
  $('#glossary-subnav ul li').each(function() {
    $(this).hover(function() {
      $(this).addClass('nav-on');
    }, function() {
      $(this).removeClass('nav-on');
    });
  });
  
  /////////////////////////////////////////////////////////////// add pipes to bottom nav

  	//map
	$("#soltherm-map").fancybox({
		'titleShow'		: false,
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'elastic',
		'width' : 1000,
		'height' : 600,
		'autoScale' : true
	});
  
  $(".flash-video").fancybox({
		'titleShow'		: false,
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'elastic',
		'width' : 640,
		'height' : 400,
		'autoScale' : true
	});
  
  // $('#feature a').append('<img src="images/home_feat_link.jpg"/>');
  $('#bottom-nav li:not(:first)').prepend('<span class="pipe">|</span>');

  $('p.link a').each(function(){
    $(this).after('<span class="arrow"><img src="/images/home_feat_link.jpg" /></span>');
  });
  
  
  $(function() {
    $("#glossary-content").tabs();
  });
  
  // $('#interior-header img').parent().append('<div id="header-shade"></div>');


  /////////////////////////////////////////////////////////////// swf call
  var params = {
      menu: "false",
      wmode: "transparent"
      };
  var attributes = {};
  
  swfobject.embedSWF("/swf/slideshow.swf", "flash-embed", "957", "286","9.0.0", "", {xmlpath:"/slides.xml"}, params, attributes);
    
}); //end document.ready
