/// <reference path="jquery-vsdoc2.js" />
var litium = {};

litium.templates = {
	include: (function(litium) {
		var that = {};
		var defaults = { iframeHeight: '600px' };

		that.resize = function(iframe, iframeHeight) {
			try {
				iframe.style.height = iframe.contentWindow.document.body.scrollHeight + 'px';
			} catch (e) {
				iframe.style.height = iframeHeight;
			}
		};

		that.init = function(options) {
			///<summary>
			/// Initialises the resizing of iframes in the document.
			/// Parameters: options: { iframeHeight: height declaration, e.g. '600px' }
			///</summary>
			var i;
			var iframe;
			var iframes = document.getElementsByTagName('iframe');
			var settings = jQuery.extend({}, defaults, options);
			var onloadValue = 'litium.templates.include.resize(this, \'' + settings.iframeHeight + '\');'

			for (i = 0; iframe = iframes[i]; i++) {
				iframe.setAttribute('onload', onloadValue);
			}
		};

		return that;
	})()
};

