$(document).ready(function()
{
	$('body.pageid-567 #body .content .left .maintext :not(h3)').hide();
	$('body.pageid-578 #body .content .left .maintext :not(h3)').hide();
	$('body.pageid-567 #body .content .left .maintext h3').click(function()
	{
	    $('body.pageid-567 #body .content .left .maintext p:visible').hide();
	    $('body.pageid-567 #body .content .left .maintext h3.on').removeClass('on');
	    $(this).addClass('on');
	    $(this).nextUntil('h3').show();
	});
	$('body.pageid-578 #body .content .left .maintext h3').click(function()
	{
	    $('body.pageid-578 #body .content .left .maintext :not(h3)').hide();
	    $('body.pageid-578 #body .content .left .maintext h3.on').removeClass('on');
	    $(this).addClass('on');
	    $(this).nextUntil('h3').show();
	});
});
function saveToBasket(type,eid,desc,url)
{
        jQuery.post("/ajax/basket.php",
                { action:"save",
                        type: type,
                        eid:eid,
                        description:desc,
                        url:url
                },
                function(data)
                {
                        basketResponse(data);
                        jQuery('.' + type + eid).hide();
                }
        );
}
function removeFromBasket(id,type,refreshtype)
{
        jQuery.post("/ajax/basket.php",{action:"remove",type:type,id:id,refreshtype:refreshtype},
                function(data)
                {
                        basketResponse(data);
                        jQuery('li#fav_' + type + '_' + id).remove();
                }
        );
}
function basketResponse(data)
{
        var dat = eval("(" + data + ")");
        if(dat["basket"])
        {
                jQuery(".my_favourites .inner").html(dat["basket"]);
                jQuery(".my_favourites .collapsible-heading-collapsed").click();
        }
        if(dat["msg"])
        {
                alert(dat["msg"]);
        }
        if(dat["error"])
        {
                alert("ERROR: " + dat["error"]);
        }
        if(dat["showclass"])
        {
                jQuery('.' + dat["showclass"]).show();
        }
        return false;
}

$(document).ready(function(){
        $('body').removeClass('js_disabled').addClass('js_enabled');
        $('a[href^="http://"]')
          .attr({
            target: "_blank",
            title: "Opens in a new window"
          });

        $('a[href$=".pdf"]')
          .attr({
            target: "_blank",
            title: "Opens in a new window"
          });
});


