function rect(x1, y1, x2, y2) {

	var m_dblLeft;
	var m_dblBottom;
	var m_dblRight;
	var m_dblTop; 
	
	var dblX1 = parseFloat(x1);
	var dblY1 = parseFloat(y1);
	var dblX2 = parseFloat(x2);
	var dblY2 = parseFloat(y2);
	
	var m_WorldviewBtn = document.getElementById("WorldviewBtn");

	if (dblX1 < dblX2) {
   	m_dblLeft = dblX1;
		m_dblRight = dblX2;
	} else  {
   	m_dblLeft = dblX2;
		m_dblRight = dblX1;
	}

	if (dblY1 < dblY2) {
		m_dblBottom = dblY1;
		m_dblTop = dblY2;
	} else {
		m_dblBottom = dblY2;
		m_dblTop = dblY1;
	}
	
	//see if the boundary of the rect is over the range
	if (m_dblLeft < -180) {
		m_dblRight = m_dblRight - (m_dblLeft - -180);
		m_dblLeft = -180;
	}
	if (m_dblRight > 180) {
		m_dblLeft = m_dblLeft - (m_dblRight - 180);
		m_dblRight = 180;
	}
	if (m_dblBottom < -90) {
		m_dblTop = m_dblTop - (m_dblBottom - -90);
		m_dblBottom = -90;
	}
	if (m_dblTop > 90) {
		m_dblBottom = m_dblBottom - (m_dblTop - 90);
		m_dblTop = 90;
	}
	
	//see if Zoomed out too far
	if (m_dblRight - m_dblLeft > 360) { 
		m_dblLeft = -180;
		m_dblRight = 180;
		m_dblTop = 90;
		m_dblBottom = -90;
	}
	else
	{
		if (m_dblLeft < -180) {
			m_dblRight = m_dblRight - (m_dblLeft - -180);
			m_dblLeft = -180;
		}
		if (m_dblRight > 180) {
			m_dblLeft = m_dblLeft - (m_dblRight - 180);
			m_dblRight = 180;
		}
		if (m_dblBottom < -90) {
			m_dblTop = m_dblTop - (m_dblBottom - -90);
			m_dblBottom = -90;
		}
		if (m_dblTop > 90) {
			m_dblBottom = m_dblBottom - (m_dblTop - 90);
			m_dblTop = 90;
		}
	}
	
	if ((m_dblRight - m_dblLeft == 360)&&(m_dblTop - m_dblBottom == 180)) { 
		m_WorldviewBtn.style.visibility = "hidden";
		m_divNorth.style.visibility = "hidden";
		m_divSouth.style.visibility = "hidden";
		m_divWest.style.visibility = "hidden";
		m_divEast.style.visibility = "hidden";
		m_divNorthEast.style.visibility = "hidden";
		m_divSouthWest.style.visibility = "hidden";
		m_divNorthWest.style.visibility = "hidden";
		m_divSouthEast.style.visibility = "hidden";
	}
	else
	{
		m_WorldviewBtn.style.visibility = "visible";
		m_divNorth.style.visibility = "visible";
		m_divSouth.style.visibility = "visible";
		m_divWest.style.visibility = "visible";
		m_divEast.style.visibility = "visible";
		m_divNorthEast.style.visibility = "visible";
		m_divSouthWest.style.visibility = "visible";
		m_divNorthWest.style.visibility = "visible";
		m_divSouthEast.style.visibility = "visible";
	}	

	// methods
	this.getLeft = getLeft;
	this.getBottom = getBottom;
	this.getRight = getRight;
	this.getTop = getTop;
	this.getCenter = getCenter;
	this.getWidth = getWidth;
	this.getHeight = getHeight;
	this.scale = scale;

  // ------------------------------
  // ------- Public Methods -------
  // ------------------------------

  function getLeft() {
		return m_dblLeft;
	}

  function getBottom() {
		return m_dblBottom;
  }

  function getRight() {
		return m_dblRight;
	}

  function getTop() {
		return m_dblTop;
  }

  function getWidth() {
		return (this.getRight() - this.getLeft());
  }

  function getHeight() {
		return (this.getTop() - this.getBottom());
  }
  
  function scale(factor) {

		makeFromCenter(this.getCenter(),
									 this.getWidth() * factor, 
									 this.getHeight() * factor);

  }

	function getCenter() {

		var dblCenterX = this.getLeft() + (this.getWidth() / 2);
		var dblCenterY = this.getBottom() + (this.getHeight() / 2);

		return new point(dblCenterX, dblCenterY);

	}

  // ------------------------------
  // ------ Private Functions -----
  // ------------------------------

	function makeFromCenter(center, width, height) {

		m_dblLeft = center.x - (width / 2);
		m_dblRight = center.x + (width / 2);
		m_dblBottom = center.y - (height / 2);
		m_dblTop = center.y + (height / 2);

  }

}
