$(document).ready(function() {
    if(typeof sIFR == "function"){
        sIFR.replaceElement("h2", named({sFlashSrc: "/Common/Flash/skia.swf", sColor: "#336633"}));
        sIFR.replaceElement(".panelSide h3", named({sFlashSrc: "/Common/Flash/skia.swf", sColor: "#336633", sWmode: "transparent"}));
        sIFR.replaceElement("h3.hdrLinks", named({sFlashSrc: "/Common/Flash/skia.swf", sColor: "#336633"}));
    };
    
	$('.btnPanels').each(function(){
		if($.browser.msie && parseInt($.browser.version)==6 && $('img', this).attr('src').indexOf('.png')!=-1) {
			var imgPng = $('img', this).attr('src');
			var imgPngW = $('img', this).width();
			var imgPngH = $('img', this).height();
			$('h3', this).css('filter',"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+imgPng+"',sizingMethod='crop')").click(function(){
				location.href = $('a', this).attr('href');
			});
		} else {
			$('h3', this).css('background','url('+$('img', this).attr('src')+') 0 0 no-repeat');
		}
	});
	$('#NewsList li').each(function(){
		$(this).click(function(){
			location.href = $('h3 a', this).attr('href');
			return false;
		});
	});
    $('.rollover').rollover();
 
    $('.navigation div').each(function(){
        $(this).data('width',0);
        $('img',this).each(function(){
            $(this).parent().parent().parent().parent().data('width', $(this).parent().parent().parent().parent().data('width')+10+$(this).width())
        });
        $(this).width($(this).data('width'))
    });
    if($('.navigation > li.selected').length > 0){
        $('.navigation > li:not(.selected)').hover(function(){
            $(this).addClass('hover');
            $('.navigation').data('selectedPosition',$('.navigation > li.selected div').css('left'));
            $('.navigation > li.selected div').css('left','-9999px');
        },function(){
            $(this).removeClass('hover');
            $('.navigation > li.selected div').css('left',$('.navigation').data('selectedPosition'));
        });
    }
    
    $('.shareThis #btn').click(function(){$('.shareThis p, .shareThis ul').toggle();});
    $('.shareThis li a').click(function(){
        var h = $(this).attr('href');
        var t = document.title;
        var u = location.href;
        h = h.replace(/#url/,u);
        h = h.replace(/#title/,t);
        h = encodeURI(h);
        window.open(h);
        return false;
    });
});