function setResize()
{
     McIFrame.resize();
}


/* A routine to resize iframes in deviceanywhere */
var McIFrame = {
	resize: function () {
		window.scrollTo(0,0);
		try {
			document.domain = "deviceanywhere.com";
		} catch (ex) {
		    document.getElementById('iframeId').style.visibility = 'visible';
			//return;
		}
        	try {
		    var iframe = document.getElementById ('iframeId');
		    if (iframe == null) {
			    iframe = document.getElementsByName ('iframeName')[0];
		    }
		    if (iframe.offsetHeight == 0) {
			setTimeout (function () {McIFrame.resize()}, 500);
			return;
                    }
		    var offset = (document.getElementById && !document.all ?  20 : 4); // tweak offset for moz
		    iframe.height = 300;
		    iframe.height = window.frames['iframeName'].document.body.scrollHeight + offset;
		}
		catch (ex) {
		    //alert('Iframe access security exception (different domains): '+ex);
		    iframe.height = 2000;
		}
		finally {
		    //This will hide the Preloader image.
		    document.getElementById('iframeId').style.visibility = 'visible';
		    document.getElementById('preloaderDiv').style.display = 'none';
		}
	}
}

var McMenu = function (idWrapper) {
	this.elRoot				= document.createElement('ul');
	if (idWrapper != undefined) {
		this.elWrapper			= document.getElementById (idWrapper);
		this.elRoot.className	= "mcMenu";
		this.elWrapper.appendChild (this.elRoot);
		this.elWrapper.appendChild (document.createElement('div')).style.clear = 'both'; // add a clearing div
	}
}
McMenu.prototype = {
	addItem: function (label, url, submenu) {
		var li		= document.createElement ('li')
		var link	= li.appendChild (document.createElement('a'));
		link.setAttribute ('href', (url==undefined ? '#' : url));
		link.appendChild (document.createTextNode (label));

		if (submenu != undefined) {
			li.appendChild (submenu.elRoot);
		}
		if (window.ActiveXObject) { // fake out IE hover
			li.onmouseover=function() {
				this.className=" mcHover";
			}
			li.onmouseout=function() {
				this.className=this.className.replace(new RegExp(" mcHover\\b"), "");
			}
		}
		this.elRoot.appendChild (li);
		return this;
	}
}


