CM = {};

CM.open = function(id){

	var fullscreendiv;
	var w;
	var h;
	var so;

	//fullscreendiv
 	fullscreendiv = document.createElement('div');
	fullscreendiv.id = 'fullscreen';
	document.body.appendChild(fullscreendiv);

	//w,h
	w = window.innerWidth || document.documentElement.clientWidth;
	h = window.innerHeight || document.documentElement.clientHeight;
	h = Math.max(document.body.scrollHeight, h);

	//CSS
	fullscreendiv.style.width = w + 'px';
	fullscreendiv.style.height = h + 'px';
	fullscreendiv.style.overflow = 'hidden';
	fullscreendiv.style.position = 'absolute';
	fullscreendiv.style.top = '0';
	fullscreendiv.style.left = '0';
	fullscreendiv.style.zIndex = '9999';
	//fullscreendiv.style.border = '2px solid red';
	//fullscreendiv.style.backgroundColor = 'yellow';

	//SWFObject
	so = new SWFObject('cm.swf','cmwf','100%','100%','9','#ffffff');
	so.addParam('wmode','transparent');
	so.addParam('allowScriptAccess','always');
	so.addVariable('ID',id);
	so.write('fullscreen');

	this.content = fullscreendiv;
	return false;
};

CM.close = function(){
	document.body.removeChild(this.content);
};

CM.getScrollTop = function(){
	return document.body.scrollTop || document.documentElement.scrollTop;
};
