if($.browser.msie && $.browser.version < 7){
    // don't use sifr
} else {
    // Initialize SIFr
    var myriad = {src:_m + 'swfs/sifr.swf'};
    sIFR.activate(myriad);
    sIFR.replace(myriad, {
	     selector: 'h2',
	     css: {
		      '.sIFR-root':{
			       'text-transform':'uppercase',
			       'font-weight':'bold',
			       'font-size':'45px'
		      }
	     },
        transparent: true
    });
}

$(document).ready(function(){
	// New Window Links
	$("a.external").click(function(event){
		event.preventDefault();
		window.open($(this).attr("href"), 'external', '');
	});

	// Add shadows to sidebar
	$("#sidebar div:not(.hr,#sidebar div div)").append('<br class="clear" /><div class="left-shadow"></div><div class="right-shadow"></div><div class="top-shadow"></div><div class="bottom-shadow"></div><div class="top-left-corner"></div><div class="top-right-corner"></div><div class="bottom-right-corner"></div><div class="bottom-left-corner"></div>');

	// Capitalize navigation
	$('#top-navigation ul li a').each(function(){
		var title_str_sp = $(this).html().toLowerCase().split(' ');
		var rt_str = [];
		for(var i=0;i < title_str_sp.length;i++){
			var x = title_str_sp[i];
			var z = x.charAt(0).toUpperCase() + x.substring(1,x.length);
			rt_str.push(z);
		}
		$(this).html(rt_str.join(' '));
	});

	if($.browser.msie && $.browser.version < 8){
		$("#top-navigation ul li:not(.first)").each(function(){
			$(this).html(' | ' + $(this).html());
		});
	}

    var h = 0;
    var sibling = null;
    $('#large_view li:not(.first)').each(function(idx, e) { 
        h = Math.max(h, $(e).height()); 
        if (idx % 2 == 1) { 
            sibling.height(h); 
            $(e).height(h); 
            h = 0; 
        } else { 
            sibling = $(e); 
        } 
    });

    stretch();
    $(window).resize(stretch);
});

function stretch(){
    var w = $(window);
    var b = $('body');
    var c = $('#container');
    try {
        // fix the horizontal scroll issue
        if (w.width() < 1000) {
            b.width(1000);
            c.width(1000);
        } else {
            b.width('auto');
            c.width('auto');
        }
        // fix an issue with the body height not getting set properly
        if(w.height() > b.height() || (b.height() > w.height() && b.height() > c.height())) {
            h=w.height()>c.height()?w.height():c.height();
            b.height(h);
        }
    } catch(e) {  }
}

