// JS:  note, this routine will break in internet explorer
// if the domains are set to different "security" levels in Internet Explorer
//  For example, I had "cms.nortia.org" as a trusted site, but "calendar3.nortia.org" as a
//  standard "internet" site.  Even though both sides were setting document.domain to
//	nortia.org, Internet Explorer still wouldn't allow them to communicate!
//	Adding "calendar3.nortia.org" as a trusted site fixed it.  Another solution is to
//	remove "cms.nortia.org" from the trusted sites list.

$(document).ready(function()
	{
	    // Set specific variable to represent all iframe tags.
	    var iFrames = document.getElementsByTagName('iframe');
    	
	    // Resize heights.
	    function iResize()
	    {
		    // Iterate through all iframes in the page.
		    for (var i = 0, j = iFrames.length; i < j; i++)
		    {
			    // Set inline style to equal the body height of the iframed content.
			    iFrames[i].style.height = iFrames[i].contentWindow.document.body.offsetHeight + 'px';
		    }
	    }

	    // Check if browser is Safari or Opera.
	    if ($.browser.safari || $.browser.opera)
	    {
		    // Start timer when loaded.
		    $('iframe').load(function()
			    {
				    setTimeout(iResize, 0);
			    }
		    );

		    // Safari and Opera need a kick-start.
		    for (var i = 0, j = iFrames.length; i < j; i++)
		    {
			    var iSource = iFrames[i].src;
			    iFrames[i].src = '';
			    iFrames[i].src = iSource;
		    }
	    }
	    else
	    {

		    // For other good browsers.
				$('iframe').load(function()
					{
						// Set inline style to equal the body height of the iframed content.
						this.style.height = this.contentWindow.document.body.offsetHeight + 'px';
					}
				);
	    }
	}
);

function TriggerResize()
{
	$('iframe').trigger("load");
}