/**
 * JavaScript Library required for all pages of the public site.
 *
 */

$(document).ready(function()
{
    // apply class name to a tags in menu; for IE fix:
    $('body.ie6 .main-menu li a').each(function(i) {
        $(this).attr('class', $(this).parent().attr('class'));
    });
    
    // apply lightbox behavior:
    $('.ngg-gallery-thumbnail a').lightBox({overlayBgColor:'#2a1e2a',txtImage:''});

    var msg_email = '(enter your email address)';
    
    $('input#kjuuji-kjuuji').bind("focus", function() {
        if ($(this).attr('value') == msg_email) $(this).attr('value', '');
    });
    
    $('input#kjuuji-kjuuji').bind("blur", function() {
        if ($(this).attr('value') == '') $(this).attr('value', msg_email);
    });
    
    // GALLERY
    $("body.home .image").bind("click", function() {
        if ($(this).hasClass('current')) {
            return false;
        }
        $('.current div').fadeIn(250, function() {
            $('.current').removeClass('current');
        });
        $(this).children('div').fadeOut(500, function() {
            $(this).parent().addClass('current');
        });
        $('#main-image img').attr('src', $(this).children().eq(0).children('a').attr('href'));
        $('#main-image img').attr('alt', $(this).children().eq(0).children('a').attr('title'));
        
        $('#info').html($(this).children('p').eq(0).text());
        
        return false;
    });
    
});

// SIFR:
var heading = {
  src: '/wp-content/themes/erinsparler/heading.swf'
  ,ratios: [10, 1.13, 12, 1.04, 24, 1, 49, 0.96, 74, 0.94, 80, 0.93, 81, 0.94, 85, 0.93, 87, 0.94, 0.93]
};
sIFR.useStyleCheck = true;
sIFR.activate(heading);

sIFR.replace(heading, {
  selector: '#content h1'
  ,wmode: 'transparent'
  ,css: [
    '.sIFR-root { color: #756b75; text-transform: uppercase; letter-spacing: 3; leading:5 }'
    ,'a { text-decoration: none; }'
    ,'a:link { color: #756b75; }'
    ,'a:hover { color: #000000; }'
  ],
});

sIFR.replace(heading, {
  selector: '#content h2'
  ,wmode: 'transparent'
  ,css: [
    '.sIFR-root { color: #756b75; text-transform: uppercase; letter-spacing: 1.5; leading: 2.5 }'
    ,'a { text-decoration: none; }'
    ,'a:link { color: #756b75; }'
    ,'a:hover { color: #000000; }'
  ],
});

sIFR.replace(heading, {
  selector: '#content h3'
  ,wmode: 'transparent'
  ,css: [
    '.sIFR-root { color: #756b75; text-transform: uppercase; letter-spacing: 2; font-size:15px; leading:3 }'
    ,'a { text-decoration: none; }'
    ,'a:link { color: #756b75; }'
    ,'a:hover { color: #000000; }'
  ],
});

sIFR.replace(heading, {
  selector: '.footer-block h4'
  ,wmode: 'transparent'
  ,css: [
    '.sIFR-root { color: #ffffff; text-transform: uppercase; letter-spacing: 2; }'
    ,'a { text-decoration: none; }'
    ,'a:link { color: #ffffff; }'
    ,'a:hover { color: #000000; }'
  ],
});

