// JavaScript Document
blnImg = document.images
function Create(Name) {
  Rollovers[Name]=new Rollover(Name);
}
function Setup(Name) {
  Replace[Name]=new sizeImg(Name);
}
function sizeImg(Name) {
	 this.name = Name;
	 this.smImg = new Image;
	 this.lgImg = new Image;
	 this.smImg.src = "images/commercial-realty-services.png"
	 this.lgImg.src = "images/commercial-realty-services-lg.png"
}
function Rollover(Name) {
    this.name       = Name;
	this.btnImg     = new Image;
	this.ovrImg     = new Image;
	this.btnImg.src = "images/btn-"+Name+".gif";
	this.ovrImg.src = "images/ovr-"+Name+".gif";
}	
function Btn(Name) {
  if (blnImg) {
    document[Name].src = Rollovers[Name].btnImg.src;
  }
}
function Ovr(Name) {
  if (blnImg) {
    document[Name].src = Rollovers[Name].ovrImg.src;
  }
} 

function pageWidth() {
  return window.innerWidth != null? window.innerWidth : document.documentElement && document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body != null ? document.body.clientWidth : null;
} 

function chooseImg(Name) {
  browserWidth = pageWidth();
  if(blnImg) {
    if(browserWidth > 1242) {
		document[Name].src = Replace[Name].lgImg.src; 
	}
	else {
		document[Name].src = Replace[Name].smImg.src;
	}
  }
}

if (blnImg) {
      Rollovers = new Object;
	  Create("home");
	  Create("mls");
	  Create("featured");
	  Create("commercial");
	  Create("agents");
	  Create("homevalue");
	  Create("history");
	  Create("contact");
	  Create("openhouse");
	  Replace = new Object;
	  Setup("logo");
}

