////////////////////////////////////////////////////////////////////////////////
// 20110201 coded by Kishi,HIDEYO
// Copyright(c) 2011 Kishi,HIDEYO
////////////////////////////////////////////////////////////////////////////////
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

// cufon
Cufon.replace("#headerImg .powerPhrase, .cta .ctaTitle, h1, h2, #sidebar blockquote, #subNavHeading");
Cufon.replace("#logo p", { textShadow: "1px 1px #000" });
$(document).ready(function() {
 //Add a Last Item class to a few things
 $("nav ul li:last-child").addClass("lastItem");
 //Add piping
 $("footer nav li:not(:last-child)").after("<li> |</li>");
 //hide subnav container if empty
 if ( $("#subNav").has("ul").length ) {  /* display */ }
 else { $("#subNav").hide(); }
});

// infogrid 20110304 HK
$(function() {
 // Set up variables
 var $el, $parentWrap, $otherWrap,
  $allTitles = $("dt").css({
   padding: 5, // setting the padding here prevents a weird situation, where it would start animating at 0 padding instead of 5
   "cursor": "pointer" // make it seem clickable
  }),
  $allCells = $("dd").css({
   position: "relative",
   left: 0,
   top: -1,
   display: "none" // info cells are just kicked off the page with CSS (for accessibility)
  });
  // clicking image of inactive column just opens column, doesn't go to link
  $("#page-wrap").delegate("a.image","click", function(e) {
   if ( !$(this).parent().hasClass("curCol") ) {
    e.preventDefault();
    $(this).next().find('dt:first').click();
   }
  });
  // if class"no0",doesn't change cursor
  $("#page-wrap").delegate("dt", "mouseover", function() {
   if ($(this).hasClass("no0"))
    $(this).css("cursor","default");
   });
  // clicking on titles does stuff
  $("#page-wrap").delegate("dt", "click", function() {
   // if class="no0",doesn't work
   if ($(this).hasClass("no0")) return;
   // cache this, as always, is good form
   $el = $(this);
   // if this is already the active cell, don't do anything
   if (!$el.hasClass("current")) {
    $parentWrap = $el.parent().parent();
    $otherWraps = $(".info-col").not($parentWrap);
    // remove current cell from selection of all cells
    $allTitles = $("dt").not(this);
    // close all info cells
    $allCells.slideUp();
    // return all titles (except current one) to normal size
    $allTitles.animate({
    fontSize: "12px",
    paddingTop: 5,
    paddingRight: 5,
    paddingBottom: 5,
    paddingLeft: 5
   });
   // animate current title to larger size
   $el.animate({
    "font-size": "20px",
    paddingTop: 10,
    paddingRight: 5,
    paddingBottom: 0,
    paddingLeft: 10
   }).next().slideDown();
   // make the current column the large size
   $parentWrap.animate({
    width: 321
   }).addClass("curCol");
   // make other columns the small size
   $otherWraps.animate({
    width: 153
   }).removeClass("curCol");
   // make sure the correct column is current
   $allTitles.removeClass("current");
   $el.addClass("current");
  }
 });
 $("#starter").trigger("click");
});

// Sliding Boxes
$(document).ready(function(){
//Diagnal Sliding
$('.boxgrid.thecombo').hover(function(){
$(".cover", this).stop().animate({top:'155px', left:'309px'},{queue:false,duration:309});
}, function() {
$(".cover", this).stop().animate({top:'1px', left:'1px'},{queue:false,duration:309});
});
});

