How to determine if accordion is active?

How to determine if accordion is active?

I am using jquery accordion where multiple accordions can be opened by user.  I added onclick event to that adds source to an iframe within that accordion when user clicks on it.  However I want to only load the source into the iframe when an accordion is opened...currently I load the source into the iframe even if they close the accordion.  Example:
  <div id="toggleboxes" onclick="loadIFrame('iframe${iframe}','${mstrObject.firstChild.objectUrl}');">

How can I determine if the onclick event on the above div is for open accordion action only?
The code below returns object object. I am quite new to jquery and have been scratching my head for a bit regarding this.  Does anyone know how to achieve this?

I tried the following:
var active = $( ".selector" ).accordion( "option", "active");

Here is my loadIFrame function.
function loadIFrame(iframeId, reportUrl){
//getter
var isActive = $( ".selector" ).accordion( "option", "active");
alert('in loadIFrame, isActive:' + isActive); 
var iframe = document.getElementById(iframeId);
iframe.src=reportUrl;
}


Thanks,
Martin