function URLEncode(sStr) 
{
	return escape(sStr).replace(/\+/g, '%2b').replace(/\"/g,'%22').replace(/\'/g, '%27').replace(/\//g,'%2f');
}



function Size(width, height)
{
	this.Width = width;
	this.Height = height;
}
Size.prototype.Width = 0;
Size.prototype.Height = 0;

function Rectangle(x,y,width,height)
{
	this.X = x;
	this.Y = y;
	this.Width = width;
	this.Height = height;
}
Rectangle.prototype.X = 0;
Rectangle.prototype.Y = 0;
Rectangle.prototype.Width = 0;
Rectangle.prototype.Height = 0;


function ImageCrop()
{
	this.SourceRectangle = new Rectangle(0,0,0,0);
}
ImageCrop.prototype.ZoomFactor = 100;
ImageCrop.prototype.SourceRectangle = null

//-------------------------------------------------------

window.DOMParserUseXMLRepeater = false;
if (typeof window.DOMParser != "undefined") 
{
	if (typeof window.DOMParser.parseFromString == "undefined") 
	{
		window.DOMParserUseXMLRepeater = true;

		function DOMParser() {}
			
		DOMParser.prototype.parseFromString = function (str, contentType) 
		{
			if (window.ActiveXObject) {
				var d = new ActiveXObject("MSXML.DomDocument");
				d.loadXML(str);
				return d;
			} else if (window.XMLHttpRequest) {
				var req = new XMLHttpRequest;

				req.open("POST", "http://www.brianraleymd.com/default.aspx?__ac=1&__ac_wcmid=RAWCIL&__ac_lib=Radactive.WebControls.ILoad&__ac_key=RAWVCO_501&__ac_sid=ygni3vaa54vayvymicl0ur45&__ac_ssid=&fr=" + escape(Date()), false);
				req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
								
				req.send("xml=" + escape(str));
				return req.responseXML;
			}
		}
	}
}


if (document.implementation && document.implementation.createDocument)
{
	var doc = document.implementation.createDocument("", "doc", null);
	if (!doc.loadXML)
	{
		Document.prototype.loadXML = function (s) 
		{  
			var doc2 = (new DOMParser()).parseFromString(s, "text/xml");
			      
			while (this.hasChildNodes())
			{
				this.removeChild(this.lastChild);
			}

			for (var i = 0; i < doc2.childNodes.length; i++) 
			{
				this.appendChild(this.importNode(doc2.childNodes[i], true));
			}
		}
	}
}

function createXMLDOM(rootTagName)
{
	return createXMLDOMFromString("<" + rootTagName + " />");
}

function createXMLDOMFromString(str)
{
	var doc;
	
	if (window.ActiveXObject)
	{
		doc = new ActiveXObject("Microsoft.XMLDOM")
		doc.loadXML(str);
	}
	else
	{
		if (window.DOMParserUseXMLRepeater)
		{
			doc = (new DOMParser()).parseFromString(str, "text/xml");
		}
		else
		{
			doc = document.implementation.createDocument("", "doc", null);
			doc.loadXML(str);
		}
	}

	return doc;
}

function createXMLDOMFromRequest(url, async)
{
	var doc;

	if (window.ActiveXObject)
	{
		doc = new ActiveXObject("Microsoft.XMLDOM")
		doc.async = async;
		doc.load(url);
	}
	else
	{
		if (window.DOMParserUseXMLRepeater)
		{
			if (window.XMLHttpRequest) 
			{
				var req = new XMLHttpRequest;

				req.open("GET", url, false);						
				req.send(null);
				doc = req.responseXML;
			}
		}
		else
		{
			doc = document.implementation.createDocument("", "doc", null);
			doc.async = async;
			doc.load(url);
		}
	}

	return doc;
}

/*
function getInnerXMLGeneric(node)
{
	var _result = "";
	if (node == null) 
	{ 
		return _result; 
	}
	for (var i = 0; i < node.childNodes.length; i++) 
	{
		var thisNode = node.childNodes[i];
		switch (thisNode.nodeType) 
		{
			case 1: // ELEMENT_NODE
			case 5: // ENTITY_REFERENCE_NODE
				_result += getElementAsStringGeneric(thisNode);
				break;
			case 3: // TEXT_NODE
			case 2: // ATTRIBUTE_NODE
			case 4: // CDATA_SECTION_NODE
				_result += thisNode.nodeValue;
				break;
			default:
				break;
		}
	}
	return _result;
 }

function getElementAsStringGeneric(thisNode)
{
	var _result = "";
	if (thisNode == null) 
	{
		return _result;
	}
	// start tag
	_result += '<' + thisNode.nodeName;
	// add attributes
	if (thisNode.attributes && thisNode.attributes.length>0) 
	{
		for (var i = 0; i < thisNode.attributes.length; i++) 
		{
			_result += " " + thisNode.attributes[i].name
			+ "=\"" + thisNode.attributes[i].value +
			"\"";
		}
	}
	// close start tag
	_result += '>';
	// content of tag
	_result += getInnerXMLGeneric(thisNode);
	// end tag
	_result += '</' + thisNode.nodeName + '>';
	return _result;
}
*/

//-------------------------------------------------------

function _Radactive()
{
}

function Radactive_WebControls()
{
}

// MSIE
Radactive_WebControls.prototype.Dialog_hborder = 6;
Radactive_WebControls.prototype.Dialog_vborder = 50;

Radactive_WebControls.prototype.ShowDialog_window = null;
Radactive_WebControls.prototype.ShowDialog_window_isModal = false;

Radactive_WebControls.prototype.ShowDialog = function (url, width, height, modal, center, resize)
{
	this.ShowDialog_window_isModal = false;
	var resizeTxt = "no";
	if (resize)
	{
		resizeTxt = "yes";
	}
	var ieVersion = this.GetIEVersion();
	if (ieVersion >= 4)
	{
		// MSIE
		var hborder = 0;
		var vborder = 0;
		
		if (ieVersion < 7) 
		{
			hborder += this.Dialog_hborder;
			vborder += this.Dialog_vborder;
		}
		
		if (resize)
		{
			hborder += 2;
			vborder += 2;
		}
		var centerTxt = "no";
		if (center)
		{
			centerTxt = "yes";
		}
		else
		{
			if (window.top.dialogLeft)
			{
				var left = parseInt(window.top.dialogLeft) + 20;
				var top = parseInt(window.top.dialogTop) + 20;
				centerTxt += "; dialogLeft=" + left + "px; dialogTop=" + top + "px";
			}
		}
		if (modal)
		{
			this.ShowDialog_window_isModal = true;
			return window.showModalDialog(url,window,"dialogHeight:" + (height + vborder) + "px; dialogWidth:" + (width + hborder) +"px; resizable:" + resizeTxt +"; help:no; scroll:no; status:yes; center:" + centerTxt);	
		}
		else
		{
			this.ShowDialog_window = window.showModelessDialog(url,window,"dialogHeight:" + (height + vborder) + "px; dialogWidth:" + (width + hborder) +"px; resizable:" + resizeTxt + "; help:no; scroll:no; status:yes; center:" + centerTxt);	
			return ShowDialog_window;
		}
	}
	else
	{
		// Mozilla
		if (this.ShowDialog_window)
		{
			if (!this.ShowDialog_window.closed)
			{
				if (this.ShowDialog_window.close)
				{
					var ex;
					try
					{
						this.ShowDialog_window.close();
					}
					catch(ex)
					{
					}
				}
			}
		}
		this.ShowDialog_window = window.open(url,"ppw","width=" + width + ",height=" + height + ",status=yes,dependent=yes,dialog=yes,close=no,alwaysRaised=yes,modal=yes,resizable=" + resizeTxt);
		return this.ShowDialog_window;
	}
}

Radactive_WebControls.prototype.ShowDialog2 = function(url, title, width, height, modal, center, resize)
{
	return this.ShowDialog("http://www.brianraleymd.com/default.aspx?__ac=1&__ac_wcmid=RAWCIL&__ac_lib=Radactive.WebControls.ILoad&__ac_key=RAWVCO_101&__ac_sid=ygni3vaa54vayvymicl0ur45&__ac_ssid=&fr=" + URLEncode(Date()) + "&url=" + URLEncode(url) + "&title=" + URLEncode(title), width, height, modal, center, resize);
}

Radactive_WebControls.prototype.GetIEVersion = function()
{
	return 0;
}

_Radactive.prototype.WebControls = new Radactive_WebControls();
var Radactive = new _Radactive();