var care2floater = function() {
	var obj = {};

	obj.hide = function() {
		if(obj.iframe) { document.body.removeChild(obj.iframe); }
		if(obj.overlay) { document.body.removeChild(obj.overlay); }
		if(obj.box) { document.body.removeChild(obj.box); }
		if(obj.leftshadow) { document.body.removeChild(obj.leftshadow); }
		if(obj.leftcorner) { document.body.removeChild(obj.leftcorner); }
		if(obj.bottomshadow) { document.body.removeChild(obj.bottomshadow); }
		if(obj.bottomcorner) { document.body.removeChild(obj.bottomcorner); }
		var o=document.getElementsByTagName('object');for(var i=0;i<o.length;i++)o[i].style.visibility="visible";
		obj.onclose();
	}

	obj.assignBg = function(img) {
		var line = (navigator.userAgent.indexOf('MSIE') >= 0) ? "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader (src='" + img + "', sizingMethod='crop');" : "background: transparent url(" + img + ") no-repeat scroll top left;";
		line += " z-index: 99;";
		return line;
	}

	obj.onclose = function() {}

	obj.resizeBox = function() {
		obj.content.style.cssText = "padding: 10px; float: left";
		var this_width = (obj.box_width == null) ? (obj.content.offsetWidth) : obj.box_width;
		var this_height = (obj.box_height == null) ? (obj.content.offsetHeight) : obj.box_height;
		obj.content.style.cssText = "padding: 10px;";
		obj.box.style.width = this_width + "px";
		obj.box.style.height = (this_height + 30) + "px";
		obj.box.style.top = (arrayPageScroll.y + (arrayPageSize.windowHeight / 2) - (parseFloat(obj.box.style.height) / 2)) + "px";
		obj.box.style.left = (arrayPageScroll.x + (arrayPageSize.windowWidth / 2) - (parseFloat(obj.box.style.width) / 2)) + "px";

		obj.leftshadow.style.height = (parseFloat(obj.box.style.height) - 12) + "px";
		obj.leftshadow.style.top = (parseFloat(obj.box.style.top) + 10) + "px";
		obj.leftshadow.style.left = (parseFloat(obj.box.style.left) - 10) + "px";
		obj.leftcorner.style.top = (parseFloat(obj.leftshadow.style.top) + parseFloat(obj.leftshadow.style.height)) + "px";
		obj.leftcorner.style.left = obj.leftshadow.style.left;
		obj.bottomshadow.style.width = (parseFloat(obj.box.style.width) - 22) + "px";
		obj.bottomshadow.style.top = (parseFloat(obj.box.style.top) + parseFloat(obj.box.style.height) + 2) + "px";
		obj.bottomshadow.style.left = parseFloat(obj.box.style.left) + "px";
		obj.bottomcorner.style.top = (parseFloat(obj.box.style.top) + parseFloat(obj.box.style.height) + 2) + "px";
		obj.bottomcorner.style.left = (parseFloat(obj.box.style.left) + parseFloat(obj.bottomshadow.style.width)) + "px";
	}

	var html = (arguments[0].html||arguments[0]);
	obj.box_width = (arguments[0].width||arguments[1]);
	obj.box_height = (arguments[0].height||arguments[2]);
	var titletxt = (arguments[0].titletxt||arguments[3]);
	var csspre = (arguments[0].csspre||arguments[4]);
	csspre = (csspre||"modal");
	titletxt = (titletxt||"");

	var arrayPageScroll = util.getPageScroll();
	var arrayPageSize = util.getPageSize();

	obj.overlay = document.createElement("div");
	obj.overlay.id = csspre + "_overlay";
	obj.overlay.onclick = obj.hide;
	obj.overlay.style.height = arrayPageSize.pageHeight + "px";
	if(navigator.userAgent.indexOf('MSIE') >= 0) {
		obj.iframe = document.createElement('<iframe frameborder="0">');
		obj.iframe.style.position = 'absolute';
		obj.iframe.border = '0';
		obj.iframe.frameborder = 0;
		obj.iframe.id = "modal_iframe";
		obj.iframe.style.backgroundColor = '#fff';
		obj.iframe.style.left = 0;
		obj.iframe.style.top = 0;
		obj.iframe.style.width = "100%";
		obj.iframe.style.height = arrayPageSize.pageHeight + "px";
		document.body.appendChild(obj.iframe);
	}
	document.body.appendChild(obj.overlay);

	obj.box = document.createElement("div");
	obj.box.id = csspre + "_box";
	obj.box.style.visibility = "hidden";
	obj.title = document.createElement("div");
	obj.title.id = csspre + "_title";
	obj.title.innerHTML = "<img src=\"http://dingo.care2.com/3d_floater/branding_care2Logo.gif\" alt=\"Care2: \" style=\"vertical-align: middle\" /><span>" + titletxt + "</span>";
	obj.closebox = document.createElement("div");
	obj.closebox.id = csspre + "_close_box";
	obj.closebox.onclick = obj.hide;
	obj.content = document.createElement("div");
	obj.content.style.cssText = "padding: 10px;";
	obj.content.className = "contain_floats";
	obj.content.appendChild(html);

	obj.box.appendChild(obj.title);
	obj.box.appendChild(obj.closebox);
	obj.box.appendChild(obj.content);
	document.body.appendChild(obj.box);

	obj.leftshadow = document.createElement("div");
	obj.leftshadow.style.cssText = obj.assignBg('http://dingo.care2.com/drop_shadow_left.png');
	obj.leftshadow.style.width = "10px";
	obj.leftshadow.style.position = "absolute";
	obj.leftshadow.style.opacity = 0.6;
	document.body.appendChild(obj.leftshadow);
	obj.leftcorner = document.createElement("div");
	obj.leftcorner.style.cssText = obj.assignBg('http://dingo.care2.com/drop_shadow_left_corner.png');
	obj.leftcorner.style.width = "10px";
	obj.leftcorner.style.height = "14px";
	obj.leftcorner.style.position = "absolute";
	obj.leftcorner.style.opacity = 0.6;
	document.body.appendChild(obj.leftcorner);
	obj.bottomshadow = document.createElement("div");
	obj.bottomshadow.style.cssText = obj.assignBg('http://dingo.care2.com/drop_shadow_bottom.png');
	obj.bottomshadow.style.height = "11px";
	obj.bottomshadow.style.position = "absolute";
	obj.bottomshadow.style.opacity = 0.6;
	document.body.appendChild(obj.bottomshadow);
	obj.bottomcorner = document.createElement("div");
	obj.bottomcorner.style.cssText = obj.assignBg('http://dingo.care2.com/drop_shadow_bottom_corner.png');
	obj.bottomcorner.style.width = "14px";
	obj.bottomcorner.style.height = "11px";
	obj.bottomcorner.style.position = "absolute";
	obj.bottomcorner.style.opacity = 0.6;
	document.body.appendChild(obj.bottomcorner);

	obj.resizeBox();
	var o=document.getElementsByTagName('object');for(var i=0;i<o.length;i++)o[i].style.visibility="hidden";
	obj.box.style.visibility = "visible";

	return obj;
}
