jQuery.noConflict();
jQuery(document).ready(function($) {

    // Add body class
	$('body').addClass('js');

    /**
     * News/Events Accordion
     */
    if($(".accordion").length) {
        $(".accordion").accordion({
            autoHeight:false,
            collapsible:true
        });
        $(".accordion > ul").hide();
    }
   
    /**
     * Captcha Reload
     */
    $('.verify').append(
        $('<a></a>')
            .attr('href','javascript:;')
            .html('Try another')
            .click(function(){
                var $img = $('<img src="/captcha/verify.jpg?s=' + Math.random()  + '" href="javascript:;" />');
                if($.browser.msie && $.browser.version == 6) {
                    // IE6 fix
                    if(confirm('Are you sure that you wish to generate a new verification image?')) {
                        $(this).siblings('img').remove();
                        $(this).parent('.verify').append($img);
                    }
                } else {
                    $(this).siblings('img').remove();
                    $(this).parent('.verify').append($img);
                }
            })
    );

    /**
     * UK Space Industry Flash Map
     */
    if($('#flashMap').length>0) {
        var vars = {sXMLFile: '/space-in-the-uk/default.xml'};
        var params = {};
        params.wmode = "transparent";
        swfobject.embedSWF("/flash/map.swf", "flashMap", "683", "787", "9", false, vars, params);
    }

    if($('.chCol3 p').length>0) {
        $('.chCol3 p').truncatable({
            limit:400,
            more: 'Read more',
            less: true,
            hideText: 'Read less'
        });
    }

});

