/* Grab all iframes (gadgets) and apply the override.css stylesheet */
// key issue here is a race condition, need to wait until after the iframes are seeded AND loaded. below, sometimes I catch frames, sometimes I don't.
AJS.toInit(function(){

// get this off thread? after init?
setTimeout(function() {
    jQuery(function(){

	// find all iframes that start with gadget-
        AJS.$('iframe[id^="gadget-"]').each( function(){

//alert(this);
//AJS.log(this);
            var head = AJS.$(this).contents().find("head");                
            //AJS.log(head);

	    head.append(AJS.$("<link/>", { rel: "stylesheet", href: "http://jira.metova.com/static/jira/override.css", type: "text/css" } ));                
            AJS.log(head);
        });
    });
}, 1);
});


