
//<![CDATA[
function JSInit()
{
	{
		IV1.Show(IV1.IsViewModeOK());
		IV1.Init();
	}
	{
		if(typeof(SYS_SearchResultsGetWords) + "" != "undefined") {
			var obj = SFGetRef("SF1_input");
			if(typeof(obj) + "" != "undefined") {
				obj.value = SYS_SearchResultsGetWords();
			}
		}

	}
}
//]]>

//<![CDATA[
		function ICT1_C()
		{
			this.ChannelID		= 1;
			this.strObjName		= "ICT1";
			this.strCompName	= "Comp5_ImageControllerText";

			this.GetViewer = function()			{ return eval("document.ESSIV1"); }
			this.SetModeSingle = function()		{ this.GetViewer().ImageSetViewMode(1); }
	
			this.OnImageEvent = function(nChannel, nMsg, nParam, strParam)
			{
				if(nChannel != this.ChannelID) return;
				switch(nMsg) {
					case 1:		//	1 == Init
						break;
					case 100:	//	100 == IndexChanged
					case 200:	//	200 == ViewModeChanged
						break;
					default:
						return;
				}
				this.Render();
			}

			this.GetCommandJS = function(strThis, strCommand, strDefault)
			{
				return strDefault;
			}

			this.Render = function() {
				var objViewer = this.GetViewer();
				var nCurIndex = objViewer.ImageGetCurIndex();
				
				var objImage = objViewer.ImageGetCur();
				if(objImage == null || typeof(objImage) == "undefined") {
					objViewer.LayerWrite(this.strCompName, "");
					return;
				}
				var strText = "#title";
				strText = strText.replace(/#count/ig,		objViewer.ImageGetCurIndex() + 1);
				strText = strText.replace(/#maxcount/ig,	objViewer.ImageGetNum());
				strText = strText.replace(/#page/ig,		Math.floor(objViewer.ImageGetCurIndex() / 5) + 1);
				strText = strText.replace(/#maxpage/ig,		Math.ceil(objViewer.ImageGetNum() / 5));
				strText = strText.replace(/#filename/ig,	objImage.Filename);
				strText = strText.replace(/#title/ig,		objImage.Name);
				strText = strText.replace(/#alt/ig,			objImage.Alt);
				strText = strText.replace(/#description/ig,	objImage.Description);
				strText = strText.replace(/#width/ig,		objImage.Width);
				strText = strText.replace(/#height/ig,		objImage.Height);
				strText = strText.replace(/#filesize/ig,	objImage.Filesize);
				strText = strText.replace(/\r/ig,			"");
				strText = strText.replace(/\n/ig,			"<br />");

				var strRet = "";
				strRet += "<p class=\"legendafotos\" style=\"text-align:left;\">";
				strRet += strText;	
				strRet += "</p>\r\n";

				objViewer.LayerWrite(this.strCompName, strRet);		
			}
		}

		var ICT1 = new ICT1_C();
		if(document.ESSIC == null || typeof(document.ESSIC) == "undefined") document.ESSIC = new Array();
		document.ESSIC[document.ESSIC.length] = ICT1;
//]]>

//<![CDATA[
		function ICT2_C()
		{
			this.ChannelID		= 1;
			this.strObjName		= "ICT2";
			this.strCompName	= "Comp6_ImageControllerText";

			this.GetViewer = function()			{ return eval("document.ESSIV1"); }
			this.SetModeSingle = function()		{ this.GetViewer().ImageSetViewMode(1); }
	
			this.OnImageEvent = function(nChannel, nMsg, nParam, strParam)
			{
				if(nChannel != this.ChannelID) return;
				switch(nMsg) {
					case 1:		//	1 == Init
						break;
					case 100:	//	100 == IndexChanged
					case 200:	//	200 == ViewModeChanged
						break;
					default:
						return;
				}
				this.Render();
			}

			this.GetCommandJS = function(strThis, strCommand, strDefault)
			{
				return strDefault;
			}

			this.Render = function() {
				var objViewer = this.GetViewer();
				var nCurIndex = objViewer.ImageGetCurIndex();
				
				var objImage = objViewer.ImageGetCur();
				if(objImage == null || typeof(objImage) == "undefined") {
					objViewer.LayerWrite(this.strCompName, "");
					return;
				}
				var strText = "#description";
				strText = strText.replace(/#count/ig,		objViewer.ImageGetCurIndex() + 1);
				strText = strText.replace(/#maxcount/ig,	objViewer.ImageGetNum());
				strText = strText.replace(/#page/ig,		Math.floor(objViewer.ImageGetCurIndex() / 5) + 1);
				strText = strText.replace(/#maxpage/ig,		Math.ceil(objViewer.ImageGetNum() / 5));
				strText = strText.replace(/#filename/ig,	objImage.Filename);
				strText = strText.replace(/#title/ig,		objImage.Name);
				strText = strText.replace(/#alt/ig,			objImage.Alt);
				strText = strText.replace(/#description/ig,	objImage.Description);
				strText = strText.replace(/#width/ig,		objImage.Width);
				strText = strText.replace(/#height/ig,		objImage.Height);
				strText = strText.replace(/#filesize/ig,	objImage.Filesize);
				strText = strText.replace(/\r/ig,			"");
				strText = strText.replace(/\n/ig,			"<br />");

				var strRet = "";
				strRet += "<p class=\"normal\" style=\"text-align:left;\">";
				strRet += strText;	
				strRet += "</p>\r\n";

				objViewer.LayerWrite(this.strCompName, strRet);		
			}
		}

		var ICT2 = new ICT2_C();
		if(document.ESSIC == null || typeof(document.ESSIC) == "undefined") document.ESSIC = new Array();
		document.ESSIC[document.ESSIC.length] = ICT2;
//]]>

//<![CDATA[

function IV1Res(strFN, strFNT, strN, strD, strA, nW, nH, nWT, nHT, nFS)
{ 
	this.Filename		= strFN;
	this.FilenameThumb	= strFNT;
	this.Name			= strN;
	this.Description	= strD;
	this.Alt			= strA;
	this.Width			= nW;
	this.Height			= nH;
	this.WidthThumb		= nWT;
	this.HeightThumb	= nHT;
	this.Filesize		= nFS;

}

function IV1_C()
{
	this.arrRes					= new Array();
	this.nTimeOutID				= 0;
	this.bSlideShowIsPlaying	= false;
	this.bInitDone				= false;
	this.nImageCurIndex			= 0;

	this.Init = function() 
	{
		this.Show(this.IsViewModeOK());
		this.ImageGoto(parseInt(Math.random() * this.ImageGetNum()), false);
		this.bInitDone = true;
		this.SendAll(this.nChannelID, 1, 0, "");
		document.arrImgIV1 = new Array();
		for(var i = 0; i < this.arrRes.length; ++i) {
			document.arrImgIV1[(i * 2)]		= new Image(); document.arrImgIV1[(i * 2)].src		= this.arrRes[i].Filename;
			document.arrImgIV1[(i * 2) + 1]	= new Image(); document.arrImgIV1[(i * 2) + 1].src	= this.arrRes[i].FilenameThumb;
		}
	}

	this.SendAll = function(nChannel, nMsg, nParam, strParam)
	{
		if(document.ESSIC == null || typeof(document.ESSIC) == "undefined") return false
	
		if(!this.bInitDone && nMsg != 1) return false;
		
		for(var i = 0; i < document.ESSIC.length; ++i) {
			if(document.ESSIC[i] && document.ESSIC[i].OnImageEvent) {
				document.ESSIC[i].OnImageEvent(nChannel, nMsg, nParam, strParam);
			}
		}
		return true;
	}
	this.ImageGetNum = function()			{ return this.arrRes.length; }
	this.ImageGetIndex = function(nIndex)	{ return nIndex < 0 || nIndex >= this.arrRes.length ? null : this.arrRes[nIndex]; }
	this.ImageGetCurIndex = function()		{ return this.nImageCurIndex; }
	this.ImageGetCur = function()			{ return this.ImageGetIndex(this.nImageCurIndex); }
	this.ImageGoto = function(nIndex, bStop)
	{
		if(nIndex < 0 || nIndex >= this.arrRes.length)
			return false;

		this.Show(this.IsViewModeOK());
		var bRender = this.nImageCurIndex != nIndex;
		this.nImageCurIndex = nIndex;
		if(bRender) {
			this.SwitchImage();
		}
		if(bStop) this.SlideShowStop();
		this.SendAll(this.nChannelID, 100, nIndex, "");
	}

	this.ImageGotoRel = function(nSteps, bWrap, bStop)
	{
		var nNewIndex = this.nImageCurIndex + nSteps;

		if(bWrap) {
			if(nNewIndex < 0 || nNewIndex >= this.ImageGetNum() - 1) {
				var bReverse = nSteps < 0;
				nSteps = Math.abs(nSteps);
				var nDiff = nSteps % this.ImageGetNum();

				var nCur = this.nImageCurIndex;				
				for(var i = 0; i < nDiff; ++i) {
					nCur = bReverse ? --nCur : ++nCur;
					if(nCur < 0)					nCur = this.ImageGetNum() - 1;
					if(nCur >= this.ImageGetNum())	nCur = 0;
				}
				nNewIndex = nCur;
			}
		}
		this.ImageGoto(nNewIndex, bStop);
	}
	
	this.IsViewModeOK = function()
	{
		if(this.ImageGetViewMode() != 1) return false;
		return true;
	}
	this.ImageSetViewMode = function(nMode)
	{
		this.nImageCurViewMode = nMode;
		this.Show(this.IsViewModeOK());
		this.SlideShowStop();
		this.SendAll(this.nChannelID, 200, nMode, nMode == 0 ? "Overview" : "Single");
	}
	this.ImageGetViewMode = function()		{ return this.nImageCurViewMode; }
	this.SlideShowIsWrapping = function()	{ return true; }


	this.SlideShowPlay = function()
	{
		if(this.SlideShowIsPlaying()) return;
		if(this.ImageGetCurIndex() == this.ImageGetNum() - 1 && this.ImageGetNum() > 1) {
			this.ImageGoto(0);		
		}
		this.bSlideShowIsPlaying = true;
		this.nTimeOutID = setTimeout(this.strObjName + ".SlideShowPlayer()", 3000.0000);
		this.SendAll(this.nChannelID, 300, 0, "");
	}

	this.SlideShowStop = function()
	{
		if(!this.SlideShowIsPlaying()) return;
		this.bSlideShowIsPlaying = false;
		clearTimeout(this.nTimeOutID);
		this.nTimeOutID = 0;
		this.SendAll(this.nChannelID, 301, 0, "");
	}

	this.SlideShowIsPlaying = function()		{ return this.bSlideShowIsPlaying; }

	this.SlideShowPlayer = function()
	{
		this.ImageGotoRel(1, true, false);
		this.nTimeOutID = setTimeout(this.strObjName + ".SlideShowPlayer()", 3000.0000);
	}

	this.Show = function(bShow)
	{
		var objDOM = this.GetRef("IV1_container");
		if(objDOM != null && typeof(objDOM) != "undefined" && typeof(objDOM.style) != "undefined") {
			objDOM.style.display = bShow ? "" : "none";
		}
	}
	
	this.SwitchImage = function()
	{
		var objImage = this.ImageGetCur();
		if(objImage == null || typeof(objImage) == "undefined") return;

		var strImageID = "img_" + this.strObjName;
		var obj = this.GetRef(strImageID)
		
		if(obj == null || typeof(obj) == "undefined") return;

		var bIE55 = window.createPopup;
		if(bIE55 && this.strFilter != "") {
			obj.style.filter = this.strFilter;
			for(var i = 0; i < obj.filters.length; ++i)
				obj.filters[i].Apply();    
		}
		obj.src				= objImage.Filename;
		obj.width			= objImage.Width;
		obj.height			= objImage.Height;
		obj.alt				= objImage.Alt;
		obj.title			= objImage.Alt;
		if(bIE55 && this.strFilter != "") {
			for(var i = 0; i < obj.filters.length; ++i)
				obj.filters[i].Play();    
		}
	}
	this.GetRef = function(str)		{ return document.all ? document.all[str] : document.getElementById(str); }
	this.LayerWrite = function(strLayer, strHtml)
	{
		if(document.all) {
			if(document.all[strLayer] != null && typeof(document.all[strLayer]) != "undefined") document.all[strLayer].innerHTML = strHtml;
		} else {
			if(document.getElementById) {
				document.getElementById(strLayer).innerHTML = strHtml;
			} else {
				var obj = document.layers[strLayer].document;
				obj.open();
				obj.write(strHtml);
				obj.close();
			}
		}
	}
}
	IV1 = new IV1_C();
	IV1.arrRes[0] = new IV1Res("webImages/services/SolidWaste.gif", "webImages/services/thumbSolidWaste.gif", "Solid Waste", "BME professionals have demonstrated expertise in municipal solid waste management by providing permitting, design, and construction management for landfills and transfer stations–as well as site selection studies, technical and economic feasibility studies, rate studies–since the... <a href=services.php?serv=SW class=body>continue</a>", "Solid Waste", 253, 151, 50, 60, 1); 
	IV1.arrRes[1] = new IV1Res("webImages/services/Geology.gif", "webImages/services/thumbGeology.gif", "Geology and Hydrogeology", "Since the development of Federal environmental rules by the USEPA beginning the 1970’s, most environmental permitting projects have been required to design groundwater protection systems and groundwater monitoring systems. These monitoring system designs are generally required... <a href=services.php?serv=Geo class=body>continue</a>", "Geology and Hydrogeology", 252, 155, 50, 60, 1); 
	IV1.arrRes[2] = new IV1Res("webImages/services/Construction.gif", "webImages/services/thumbConstruction.gif", "Construction Management", "At BME we understand that your project is not over when the permit is issued or the design is completed, rather the real work begins when construction starts. We offer the full array of construction phase services that are necessary to bring your next project in on time and on budget. BME’s team of professionals provides the expertise in engineering design, surveying, construction materials, contract administration... <a href=services.php?serv=CM class=body>continue</a>", "Construction Management", 252, 153, 50, 60, 1); 
	IV1.arrRes[3] = new IV1Res("webImages/services/FS.gif", "webImages/services/thumbFS.gif", "Field Services", "Biggs & Mathews Field Services group provides field support related to landfill gas to energy, groundwater sampling, data management, statistical analysis, surface water sampling and analysis, leachate system design/construction and sampling for solid waste landfills throughout Texas, Louisiana and Oklahoma... <a href=services.php?serv=FS class=body>continue</a>", "Field Services", 253, 152, 50, 60, 1);
	IV1.arrRes[4] = new IV1Res("webImages/services/Surveying.gif", "webImages/services/thumbSurvey.gif", "Surveying", "Biggs & Mathews combines its highly trained surveyors, 50 years of surveying expertise, and state-of-the-art surveying equipment to deliver our clients an accurate finished product in the most efficient manner possible. Our professional land surveying services include title surveys from small residential closing surveys to expansive and detailed commercial closing surveys, topographic surveys... <a href=services.php?serv=Sur class=body>continue</a>", "Surveying", 253, 152, 50, 60, 1);
	IV1.arrRes[5] = new IV1Res("webImages/services/Res.gif", "webImages/services/thumbRes.gif", "Residential and Commercial", "Computer graphics, electronic plotting, and electronic surveying equipment give our residential development design engineers the most efficient tools to produce the high quality and innovative plans our clients expect. All phases of residential development are coordinated to produce a community our clients are proud to present... <a href=services.php?serv=RC class=body>continue</a>", "Residential and Commercial", 253, 152, 50, 60, 1);
	IV1.arrRes[6] = new IV1Res("webImages/services/Water.gif", "webImages/services/thumbWater.gif", "Water Facilties", "In 1960 Biggs & Mathews helped begin the rural water program in Texas by working with the Farmers Home Administration. Each year our systems deliver water to thousands of customers. We value our excellent working relationship with the funding agencies and especially enjoy working with small communities and rural Texans... <a href=services.php?serv=WF class=body>continue</a>", "Water Facilities", 253, 152, 50, 60, 1);
	IV1.arrRes[7] = new IV1Res("webImages/services/WaterW.gif", "webImages/services/thumbWaterW.gif", "Wastewater Facilities", "Expertise in wastewater system engineering–master planning, analysis, design, upgrades, renovation of existing systems, and process design and modification for wastewater collection and treatment systems. Dozens of projects completed means cost-effective, realistic solutions to our clients... <a href=services.php?serv=WT class=body>continue</a>", "Wastewater Facilities", 253, 152, 50, 60, 1);
	document.ESSIV1			= IV1;
	IV1.nChannelID			= 1;
	IV1.nImageCurViewMode		= 1;
	IV1.strCompID			= "IV";
	IV1.strObjName			= "IV1";
	IV1.strImageText			= "";
IV1.strFilter = "progid:DXImageTransform.Microsoft.Fade(duration=1.0000,overlap=0.7500)";
//]]>

//<![CDATA[
		function ICSP1_C(strObjName, strCompName, nChannelID)
		{
			this.ChannelID		= nChannelID;
			this.strCompName	= strCompName;
			this.strObjName		= "ICSP1";

			this.GetViewer = function()		{ return eval("document.ESSIV" + this.ChannelID); }
			this.SetModeSingle = function()	{ this.GetViewer().ImageSetViewMode(1); }
			this.Goto = function(nIndex)	{ this.GetViewer().ImageGoto(nIndex, true); }
			this.GetRef = function(str)		{ return document.all ? document.all[str] : document.getElementById(str); }

			this.CheckViewMode = function() {
				objViewer = this.GetViewer();
				if(objViewer.SlideShowIsPlaying()) {
					this.GetRef("Comp10_ImageControllerThumbnailSlider").style.display = "none";
				} else {
					this.GetRef("Comp10_ImageControllerThumbnailSlider").style.display = "";
				}
			}
			this.OnImageEvent = function(nChannel, nMsg, nParam, strParam)
			{
				if(nChannel != this.ChannelID) return;
				if(Math.min(10, this.GetViewer().ImageGetNum()) <= 0) return;

				if(this.TimeOutID != null && typeof(this.TimeOutID) != "undefined") clearTimeout(this.TimeOutID);
				switch(nMsg) {
					case 1:		//	1 == Init
					{
						this.CheckViewMode();
						this.ItemSelectedPos = 0;
						this.Render();
						return;
					}
					case 100:	//	100 == IndexChanged
						this.SetSelectedID();
						this.TimeOutID = setTimeout("ICSP1.TimerFunc()", 20);
						break;
					case 200:	//	200 == ViewModeChanged
					case 300:	//	300 == SlideShowPlay
					case 301:	//	301 == SlideShowStop
						this.CheckViewMode();
						break;
				}
			}
			this.SetSelectedID = function()
			{
				var nID = this.GetViewer().ImageGetCurIndex();
				var nXTo = this.arrImagePos[nID] - this.ItemSelectedPos;
				var n = Math.floor(this.nCurX / this.nImagesWidth);
				nXTo += n * this.nImagesWidth;
				var nXTo2 = nXTo + this.nImagesWidth;
				if(Math.abs(nXTo - this.nCurX) > Math.abs(nXTo2 - this.nCurX)) nXTo = nXTo2;
				this.nTargetX = nXTo;
			}
			this.SetX = function(nX)
			{
				if(isNaN(nX) || isNaN(this.nImagesWidth)) return;
				if(nX < 0) {
					nX = -nX;
					nX = this.nImagesWidth - nX % this.nImagesWidth;
				} else {
					nX = nX % this.nImagesWidth;
				}
				this.GetRef("ICSP1_panel").style.left = (-nX) + "px";
			}
			this.TimerFunc = function()
			{
				var ndx = this.nTargetX - this.nCurX;
				var ndx2 = Math.floor(ndx / 10);
				if(ndx != 0 && ndx2 == 0) {
					if(ndx < 0) { 
						ndx2 = -1;
					} else {
						ndx2 = 1;
					}
				}
				this.nCurX += ndx2;
				if(Math.abs(ndx) <= 1) {
					this.nCurX = this.nTargetX;
					this.SetX(this.nCurX);
					clearTimeout(this.TimeOutID);
					return;
				}
				this.SetX(this.nCurX);
				this.TimeOutID = setTimeout("ICSP1.TimerFunc()", 20);
			}
			this.Render = function() {
				var objViewer			= this.GetViewer();
				var strRet				= "";
				this.arrImagePos		= new Array();
				var nPos				= 0;
				this.nImagesWidth		= 0;
				this.nCurX				= 0;
				this.nTargetX			= 0;
				var nMax				= Math.min(10, objViewer.ImageGetNum());
				var arrThumbs			= new Array();
				for(var i = 0; i < objViewer.ImageGetNum(); ++i) {
					var strThumb		= "";
					var nWTN			= objViewer.ImageGetCur().WidthThumb;
					var nHTN			= objViewer.ImageGetCur().HeightThumb;
					var nW				= nWTN + 0;
					var nH				= nHTN + 0;
					this.arrImagePos[i]	= nPos;
					nPos += nW + 2;
					this.nImagesWidth += nW + 2;
					var strImageID = "ICSP1" + "I" + i;
					var objImage = objViewer.ImageGetIndex(i);
					if(i == 0) {
						this.nClipWidth		= (nMax * (nW + 2)) - 2;
						this.nClipHeight	= nH;
					}
					strThumb += "<a href=\"javascript:ICSP1.Goto(" + i + ");\">";
					strThumb += "<img src=\"" + objImage.FilenameThumb + "\" id=\"" + strImageID + "\" width=\"" + nWTN + "\" height=\"" + nHTN + "\" alt=\"" + objImage.Alt + "\" title=\"" + objImage.Alt + "\" style=\"border:none;display:block;\"";
					strThumb += " />";
					strThumb += "</a>";
					arrThumbs[i] = strThumb;
				}
				strRet += "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\"><tr><td align=\"left\">";
				strRet += "<div style=\"position:relative;display:inline-block;width:" + this.nClipWidth + "px;height:" + this.nClipHeight + "px;overflow:hidden;\">";
				strRet += "<div id=\"ICSP1_panel\" name=\"ICSP1_panel\" style=\"position:relative;";

				this.SetSelectedID();
				strRet += "left:-" + (this.nTargetX < 0 ? (this.nImagesWidth - Math.abs(this.nTargetX) % this.nImagesWidth) : this.nTargetX % this.nImagesWidth) + "px;top:0px;";
				this.nCurX = this.nTargetX;
				strRet += "\">";
				strRet += "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">";
				strRet += "<tr>";
				for(var i = 0; i < arrThumbs.length * 2; ++i) {
					var nIndex = i % arrThumbs.length;
					var bSecond = i > (arrThumbs.length - 1); 
					strRet += "<td";
					strRet += " style=\"padding-right:2px;\"";
					strRet += ">";
					strRet += !bSecond ? arrThumbs[nIndex] : arrThumbs[nIndex].replace(new RegExp("ICSP1" + "I" + nIndex, "ig"), "ICSP1" + "I" + nIndex + "_2");
					strRet += "</td>";
				}				
				strRet += "</tr>";
				strRet += "</table>";
				strRet += "</div>";
				strRet += "</div>";
				strRet += "</td></tr></table>";
				
				objViewer.LayerWrite(this.strCompName, strRet);		
			}
		}
		var ICSP1 = new ICSP1_C("ICSP1", "Comp10_ImageControllerThumbnailSlider", 1);
		if(document.ESSIC == null || typeof(document.ESSIC) == "undefined") document.ESSIC = new Array();
		document.ESSIC[document.ESSIC.length]			= ICSP1;
//]]>

//<![CDATA[
	function MHTGetRef(str)
	{
		if(document.all)
			return document.all[str];
		else
			return document.getElementById(str);
	}

	function MHTSetClass(strID, strClass)
	{
		var obj = MHTGetRef(strID);
		if(obj != null && typeof(obj) + "" != "undefined")
			obj.className = strClass;
		var obj = MHTGetRef(strID + "_second");
		if(obj != null && typeof(obj) + "" != "undefined")
			obj.className = strClass;
	}
//]]>