// MASTER FUNCTIONS ////////////////////////////////////////////////////////////////////////////////////////////////////
// ---------- Rollover ----------
	function si(elem,turnTo) {
	  elem.src = "imgs/" + turnTo;
	}

// ---------- Preload ----------
plimg_hr = new Image(365,210);
plimg_hr.src = "imgs/hm_residential.jpg";
plimg_hrh = new Image(365,210);
plimg_hrh.src = "imgs/hm_residential_h.jpg";
plimg_hc = new Image(365,210);
plimg_hc.src = "imgs/hm_commercial.jpg";
plimg_hch = new Image(365,210);
plimg_hch.src = "imgs/hm_commercial_h.jpg";

// ---------- Flash Detector ----------
	// Copyright (c) Copyright (c) 2007, Carl S. Yestrau All rights reserved.
	// Code licensed under the BSD License: http://www.featureblend.com/license.txt
	// Version: 1.0.3
	var FlashDetect = new function(){
		var self = this;
		self.installed = false;
		self.raw = "";
		self.major = -1;
		self.minor = -1;
		self.revision = -1;
		self.revisionStr = "";
		var activeXDetectRules = [
			{
				"name":"ShockwaveFlash.ShockwaveFlash.7",
				"version":function(obj){
					return getActiveXVersion(obj);
				}
			},
			{
				"name":"ShockwaveFlash.ShockwaveFlash.6",
				"version":function(obj){
					var version = "6,0,21";
					try{
						obj.AllowScriptAccess = "always";
						version = getActiveXVersion(obj);
					}catch(err){}
					return version;
				}
			},
			{
				"name":"ShockwaveFlash.ShockwaveFlash",
				"version":function(obj){
					return getActiveXVersion(obj);
				}
			}
		];
		var getActiveXVersion = function(activeXObj){
			var version = -1;
			try{
				version = activeXObj.GetVariable("$version");
			}catch(err){}
			return version;
		};
		var getActiveXObject = function(name){
			var obj = -1;
			try{
				obj = new ActiveXObject(name);
			}catch(err){}
			return obj;
		};
		var parseActiveXVersion = function(str){
			var versionArray = str.split(",");//replace with regex
			return {
				"raw":str,
				"major":parseInt(versionArray[0].split(" ")[1], 10),
				"minor":parseInt(versionArray[1], 10),
				"revision":parseInt(versionArray[2], 10),
				"revisionStr":versionArray[2]
			};
		};
		var parseStandardVersion = function(str){
			var descParts = str.split(/ +/);
			var majorMinor = descParts[2].split(/\./);
			var revisionStr = descParts[3];
			return {
				"raw":str,
				"major":parseInt(majorMinor[0], 10),
				"minor":parseInt(majorMinor[1], 10), 
				"revisionStr":revisionStr,
				"revision":parseRevisionStrToInt(revisionStr)
			};
		};
		var parseRevisionStrToInt = function(str){
			return parseInt(str.replace(/[a-zA-Z]/g, ""), 10) || self.revision;
		};
		self.majorAtLeast = function(version){
			return self.major >= version;
		};
		self.FlashDetect = function(){
			if(navigator.plugins && navigator.plugins.length>0){
				var type = 'application/x-shockwave-flash';
				var mimeTypes = navigator.mimeTypes;
				if(mimeTypes && mimeTypes[type] && mimeTypes[type].enabledPlugin && mimeTypes[type].enabledPlugin.description){
					var version = mimeTypes[type].enabledPlugin.description;
					var versionObj = parseStandardVersion(version);
					self.raw = versionObj.raw;
					self.major = versionObj.major;
					self.minor = versionObj.minor; 
					self.revisionStr = versionObj.revisionStr;
					self.revision = versionObj.revision;
					self.installed = true;
				}
			}else if(navigator.appVersion.indexOf("Mac")==-1 && window.execScript){
				var version = -1;
				for(var i=0; i<activeXDetectRules.length && version==-1; i++){
					var obj = getActiveXObject(activeXDetectRules[i].name);
					if(typeof obj == "object"){
						self.installed = true;
						version = activeXDetectRules[i].version(obj);
						if(version!=-1){
							var versionObj = parseActiveXVersion(version);
							self.raw = versionObj.raw;
							self.major = versionObj.major;
							self.minor = versionObj.minor; 
							self.revision = versionObj.revision;
							self.revisionStr = versionObj.revisionStr;
						}
					}
				}
			}
		}();
	};
	FlashDetect.release = "1.0.3";
	
	// Turn on/off all flash
	FlashDetect.installed = false;

// MASTER UPDATERS ////////////////////////////////////////////////////////////////////////////////////////////////////
copyright =  new Date().getFullYear();
yearsago =  new Date().getFullYear()-1982;


// MASTER LISTS ////////////////////////////////////////////////////////////////////////////////////////////////////
// ---------- Advertisements ----------
	function ad1(flash, noflash, link, startdate, enddate, adnotes) {
		this.flash = flash;
		this.noflash = noflash;
		this.link = link;
		this.startdate = startdate;
		this.enddate = enddate;
		this.adnotes = adnotes;
	}

	ad1_468060=0;
	var ad1_list = new Array();
	// Bottom Ads (468 x 60)
	//ad_list[ad1_468060] = new ad("flash", "noflash", "link", "", "", ""); ad1_468060++;
	ad1_list[ad1_468060] = new ad1("haciendapools.gif", "haciendapools.gif", "http://www.haciendapools.com", "", "", ""); ad1_468060++;
	
	ad1n = Math.random()*ad1_list.length;
	ad1n = parseInt(ad1n);


// ---------- Safety Alerts ----------
	function safety_alert(title, img, content, notes) {
		this.title = title;
		this.img = img;
		this.content = content;
		this.notes = notes;
	}

	sa=0;
	var sa_list = new Array();
	// Safety Alerts
	// sa_list[sa] = new safety_alert("Alert Title", "Alert Image", "Alert content", "Alert notes"); sa++;
	sa_list[sa] = new safety_alert("GFI's Save Lives", "gfi", "A \"GFI\" or \"GFCI\" is a ground fault circuit interrupter. A ground fault circuit interrrupter is an inexpensive electrical device that, if installed in household branch circuits, could prevent over two-thirds of the approximately 300 electrocutions still occurring each year in and around the home. Installation of the device could also prevent thousands of burn and electric shock injuries each year.<br /><br />The GFCI is designed to protect people from severe or fatal electric shocks. Because a GFCI detects ground faults, it can also prevent some electrical fires and reduce the severity of others by interrupting the flow of electric current.<br /><br />More detailed information can be found on the U.S. Consumer Product Safety Commission's website at <span class=\"nowrap\"><a href=\"http://www.cpsc.gov\" target=\"_blank\">http://www.cpsc.gov</a>.</span><span class=\"footer\"><br /><br />The previous information is cited from the U.S. Consumer Product Safety Commission's <span class=\"nowrap\"><a href=\"images/sa_gfi.pdf\" target=\"_blank\">GFI CPSC Fact Sheet (pdf)</a>.</span></span>", ""); sa++;
	sa_list[sa] = new safety_alert("Stop 40,000 Fires Every Year", "afci", "The \"AFCI\" is an arc fault circuit interrupter. AFCIs are newly-developed electrical devices designed to protect against fires caused by arcing faults in the home electrical wiring.<br /><br />Annually, over 40,000 fires are attributed to home electrical wiring. These fires result in over 350 deaths and over 1,400 injuries each year. Arcing faults are one of the major causes of these fires. When unwanted arcing occurs, it generates high temperatures that can ignite nearby combustibles such as wood, paper, and carpets.<br /><br />Arcing faults often occur in damaged or deteriorated wires and cords. Some causes of damaged and deteriorated wiring include puncturing of wire insulation from picture hanging or cable staples, poorly installed outlets or switches, cords caught in doors or under furniture, furniture pushed against plugs in an outlet, natural aging, and cord exposure to heat vents and sunlight.<br /><br />More detailed information can be found on the  U.S. Consumer Product Safety Commission's <span class=\"nowrap\"><a href=\"images/sa_afci.pdf\" target=\"_blank\">Arc Fault Circuit Interrupter (AFCI) Fact Sheet (pdf)</a>.</span><span class=\"footer\"><br /><br />The previous information is cited from <a href=\"http://www.cpsc.gov\" target=\"_blank\">The U.S. Consumer Product Safety Commission</a>.</span>", ""); sa++;
	sa_list[sa] = new safety_alert("FPE \"Stab-Lok\" Danger", "fpe", "Federal Pacific Electric (FPE) \"Stab-Lok\" service panels and breakers are a latent hazard and can fail to trip in response to overcurrent, leading to electrical fires. The breakers may also fail to shut off internally even if the toggle is switched to \"off.\" Some double-pole (240-Volt) FPE circuit breakers and single-pole FPE Stab-Lok circuit breakers simply do not work safely.<br /><br />There are other FPE panel-defects independent of the breaker problems, panel and panel-bus fires and arcing failures in some equipment. The failure rates for these circuit breakers were and still are significant. In some cases failure to trip occurs 60% of the time - a serious fire and electrical shock hazard.<br /><br />Failures are documented in the CPSC study and by independent research. Additional independent testing and research are on-going and are reported here. FPE Stab-Lok electrical panels should be replaced. Do not simply swap in some replacement breakers.<br /><br />More detailed information can be found on the InspectAPedia&#0153; website at <span class=\"nowrap\"><a href=\"http://www.inspect-ny.com/fpe/fpepanel.htm\" target=\"_blank\">http://www.inspect-ny.com/fpe/fpepanel.htm</a>.</span><span class=\"footer\"><br /><br />The previous information is cited from <a href=\"http://InspectAPedia.com\" target=\"_blank\">InspectAPedia&#0153;</a>.</span>", ""); sa++;
	sa_list[sa] = new safety_alert("Zinsco Shock/Fire Danger", "zinsco", "Homes with Zinsco electrical panels are at greater risk and/of fire or other electrical hazards (than with other, standard electrical panels). Where Zinsco and Zinsco-Sylvania electrical panels are discovered in buildings they should be replaced to reduce some very real fire and shock hazards. Building owners or electricians encountering problems with this equipment are asked to <a href=\"http://www.inspect-ny.com/electric/Zinsco.htm\" target=\"_blank\">contact&nbsp;InspectAPedia</a> to add that information to our electrical failure database in an effort to develop accurate safety information which is then shared with appropriate federal and state agencies.<br /><br />Signs of Trouble with Zinsco or electrical equipment:<ul><li class=\"lista\">Flickering lights</li><li class=\"lista\">Smell of burning electrical devices such as plastic receptacles, receptacle covers, circuit breakers, or electrical wiring</li><li class=\"lista\">If you have noticed any of the trouble signs, have a qualified electrician determine the cause of the problem. <b>DO NOT TRY TO DO IT YOURSELF.</b> You could be electrocuted or you could make the electrical equipment more unsafe by disturbing it.</li></ul>More detailed information can be found on the InspectAPedia&#0153; website at <span class=\"nowrap\"><a href=\"http://www.inspect-ny.com/electric/Zinsco.htm\" target=\"_blank\">http://www.inspect-ny.com/electric/Zinsco.htm</a>.</span><span class=\"footer\"><br /><br />The previous information is cited from <a href=\"http://InspectAPedia.com\" target=\"_blank\">InspectAPedia&#0153;</a>.</span>", ""); sa++;

	sahn = Math.random()*sa_list.length;
	sahn = parseInt(sahn);
	sah = '';
	sah += '<div class="bxorag">';
	sah += '		<div class="bxtitle">SAFETY ALERT</div>';
	if (FlashDetect.installed) {	sah += '		<div class="flashbx"><script language="javascript"  type="text/javascript">if (AC_FL_RunContent == 0) {alert("This page requires AC_RunActiveContent.js.");}else {AC_FL_RunContent(\'codebase\', \'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0\',\'width\', \'75\',\'height\', \'75\',\'src\', \'sa_' + sa_list[sahn].img + '\',\'quality\', \'high\',\'pluginspage\', \'http://www.macromedia.com/go/getflashplayer\',\'align\', \'right\',\'play\', \'true\',\'loop\', \'true\',\'scale\', \'showall\',\'wmode\', \'Opaque\',\'devicefont\', \'false\',\'id\', \'sa_' + sa_list[sahn].img + '\',\'bgcolor\', \'#ffffff\',\'name\', \'images/sa_' + sa_list[sahn].img + '\',\'menu\', \'false\',\'allowFullScreen\', \'false\',\'allowScriptAccess\',\'sameDomain\',\'movie\', \'images/sa_' + sa_list[sahn].img + '\',\'salign\', \'\');}</script></div>';}
	else {sah += '		<img class="bximgr" src="images/sa_' + sa_list[sahn].img + '_s.jpg" border="0" alt="" />';}
	sah += '		<div class="bxtx"><b>' + sa_list[sahn].title + '</b>. ' + sa_list[sahn].content.slice(0, 100 + sa_list[sahn].content.slice(100, 2000).search(" ")) + '... <a href="safety.html#sa' + sahn + '">more&nbsp;&gt;&gt;&gt;</a></div>';
	sah += '	</div>';

	sal = '';
	sal += '<div class="bxorag">';
	sal += '		<div class="bxtitle">SAFETY ALERTS</div>';
	for(var saln=0; saln<sa_list.length; saln++){
		sal += '		<div class="toclist"><span class="bxtx" style="margin-left: 0px;" ><a href="safety.html#sa' + saln + '"><b>' + sa_list[saln].title + '</b></a><br /></span></div>';
	}
	sal += '	</div>';


// ---------- Featured Products ----------
	function featured_product(title, img, content, notes) {
		this.title = title;
		this.img = img;
		this.content = content;
		this.notes = notes;
	}

	fpr=0;
	var fpr_list = new Array();
	// Featured Products Residential
	//fpr_list[fp] = new featured_product("Product Title", "Product Image", "Product content", "Product notes"); fpr++;
	fpr_list[fpr] = new featured_product("Leviton", "leviton", "A leading North American producer of electrical and electronic products.<br /><a href=\"http://www.leviton.com\" target=\"_blank\">www.leviton.com</a><br />", ""); fpr++;
	fpr_list[fpr] = new featured_product("Lutron", "lutron", "Lighting controls to enhance the atmosphere of your home or the productivity of your office. Lutron has a wide range of electronic lighting controls to deliver the ideal lighting for any space.<br /><a href=\"http://www.lutron.com\" target=\"_blank\">www.lutron.com</a>", ""); fpr++;
	fpr_list[fpr] = new featured_product("Hunter fans", "hunter", "Since 1886, the Hunter Fan Company has provided the craftsmanship and performance insisted on by people who understand quality. Today, Hunter offers a new collection of products that meets this tradition of excellence. Hunter products are quiet, beautiful and built to last a lifetime.<br /><a href=\"http://www.hunterfan.com\" target=\"_blank\">www.hunterfan.com</a>", ""); fpr++;

	fpc=0;
	var fpc_list = new Array();
	fpc_list[fpc] = new featured_product("Infrared Inspection", "ird", "An infrared inspection will help you discover dangerous \"hot-spots\" before they become expensive repairs or life-threatening fires. See problems that can't be seen with the naked eye through the use of this cutting-edge technology.<br /><br /><img src=\"images/flir_systems.jpg\" align=\"right\" vspace=\"10\" hspace=\"10\" alt=\"\" />Tri-Valley Electrical Service is one of the few California companies with personnel certified in thermographic infrared technology. <br /><a href=\"http://www.goinfrared.com\" target=\"_blank\">www.goinfrared.com</a>", ""); fpc++;
	fpc_list[fpc] = new featured_product("Square D", "squared", "Square&nbsp;D&reg; is a market leading, global brand of Schneider Electric for NEMA type industrial controls, electrical distribution, circuit protection, related power equipment, systems and services. Square&nbsp;D products are widely accepted in residential, commercial, industrial and OEM markets.<br /><a href=\"http://www.us.squared.com\" target=\"_blank\">www.us.squared.com</a>", ""); fpc++;
	fpc_list[fpc] = new featured_product("Cutler-Hammer", "cutler", "by Eaton. Cutler-Hammer products provide the automotive, electrical, retail and truck industries with flexible, reliable products to keep their PowerChain&#0153; moving.<br /><a href=\"http://www.cutler-hammer.eaton.com\" target=\"_blank\">www.cutler-hammer.eaton.com</a>", ""); fpc++;

	fprhn = Math.random()*fpr_list.length;
	fprhn = parseInt(fprhn);
	fprhn1 = fprhn+1;
	if(fprhn1+1 > fpr_list.length) {fprhn1 = 0;}
	fprh = '';
	fprh += '<div class="bxgold">';
	fprh += '		<div class="bxtitle">FEATURED PRODUCTS</div>';
	fprh += '		<img class="bximgl" src="images/fpr_' + fpr_list[fprhn].img + '_5050.jpg" width="50" height="50" border="0" alt="" /><div class="bxtx"><b>' + fpr_list[fprhn].title + '.</b> ' + fpr_list[fprhn].content.slice(0, 45 + fpr_list[fprhn].content.slice(45, 2000).search(" ")) + '... <a href="products.html#fpr' + fprhn + '">more&nbsp;&gt;&gt;&gt;</a></div>';
	fprh += '		<img class="bxgoldline" src="imgs/clear.gif" height="1" width="150" border="0" alt="" />';
	fprh += '		<img class="bximgl" src="images/fpr_' + fpr_list[fprhn1].img + '_5050.jpg" width="50" height="50" border="0" alt="" /><div class="bxtx"><b>' + fpr_list[fprhn1].title + '.</b> ' + fpr_list[fprhn1].content.slice(0, 45 + fpr_list[fprhn1].content.slice(45, 2000).search(" ")) + '... <a href="products.html#fpr' + fprhn1 + '">more&nbsp;&gt;&gt;&gt;</a></div>';
	fprh += '</div>';

	fpchn = Math.random()*fpc_list.length;
	fpchn = parseInt(fpchn);
	fpchn1 = fpchn+1;
	if(fpchn1+1 > fpc_list.length) {fpchn1 = 0;}
	fpch = '';
	fpch += '<div class="bxgold">';
	fpch += '		<div class="bxtitle" >FEATURED PRODUCTS</div>';
	fpch += '		<img class="bximgl" src="images/fpc_' + fpc_list[fpchn].img + '_5050.jpg" width="50" height="50" border="0" alt="" /><div class="bxtx"><b>' + fpc_list[fpchn].title + '.</b> ' + fpc_list[fpchn].content.slice(0, 45 + fpc_list[fpchn].content.slice(45, 2000).search(" ")) + '... <a href="products.html#fpc' + fpchn + '">more&nbsp;&gt;&gt;&gt;</a></div>';
	fpch += '		<img class="bxgoldline" src="imgs/clear.gif" height="1" width="150" border="0" alt="" />';
	fpch += '		<img class="bximgl" src="images/fpc_' + fpc_list[fpchn1].img + '_5050.jpg" width="50" height="50" border="0" alt="" /><div class="bxtx"><b>' + fpc_list[fpchn1].title + '.</b> ' + fpc_list[fpchn1].content.slice(0, 45 + fpc_list[fpchn1].content.slice(45, 2000).search(" ")) + '... <a href="products.html#fpc' + fpchn1 + '">more&nbsp;&gt;&gt;&gt;</a></div>';
	fpch += '</div>';

	fpl = '';
	fpl += '<div class="bxgold">';
	fpl += '		<div class="bxtitle">FEATURED PRODUCTS</div>';
	fpl += '		<div class="bxsec">Residential Products</div>';
	for(var fprln=0; fprln<fpr_list.length; fprln++){
		fpl += '		<div class="toclist"><span class="bxtx" style="margin-left: 0px;" ><a href="products.html#fpr' + fprln + '"><b>' + fpr_list[fprln].title + '</b></a><br /></span></div>';
	}
	fpl += '		<div class="bxsec" style="margin-top: 20px;">Commercial Products</div>';
	for(var fpcln=0; fpcln<fpc_list.length; fpcln++){
		fpl += '		<div class="toclist"><span class="bxtx" style="margin-left: 0px;" ><a href="products.html#fpc' + fpcln + '"><b>' + fpc_list[fpcln].title + '</b></a><br /></span></div>';
	}
	fpl += '	</div>';





// ---------- Premier Partners ----------
/*
function premier_partners(title, img, content, notes) {
		this.title = title;
		this.img = img;
		this.content = content;
		this.notes = notes;
	}

	pp=0;
	var pp_list = new Array();
	// Premier Partners
	// pp_list[pp] = new premier_partners("Premier Partners Title", "Premier Partners Image", "Premier Partners content", "Premier Partners notes: center image"); pp++;
	pp_list[pp] = new premier_partners("Equity Residential", "equity.gif", "xxxxxx xxxxxxxx xxx xxx xxxxxxxxxx xxxxxxxx xx xxxxxx xxx xxxxx; xxx xxxxxx xxx xxxxxx xxx xxxxxxxxx, xxx xxx xxx xxxxxxxxx xx xxx; xxx xxxxx xxxxx xx xxxxx xxx xxxxxxx xxxxxx xx x xxxx; xxx xxxxx xxx xxxxxxx xxxxx xxxxxxxx; xxx xxxxxxxx xxxxxx. xxxxx xxxxxxxx xxxx xxxxxx xxx xxxxxx xxxxxx xx xxx xxxxxx xxxxxxxx; xxxx xxxxxxxx xxxxxx x xxxxxx xxxx xx xxx xxxxxxx xxx xxxxxxx xxxxx.", "center image"); pp++;
	pp_list[pp] = new premier_partners("Investment Properties", "investmentprops.gif", "xxxxxx xxxxxxxx xxx xxx xxxxxxxxxx xxxxxxxx xx xxxxxx xxx xxxxx; xxx xxxxxx xxx xxxxxx xxx xxxxxxxxx, xxx xxx xxx xxxxxxxxx xx xxx; xxx xxxxx xxxxx xx xxxxx xxx xxxxxxx xxxxxx xx x xxxx; xxx xxxxx xxx xxxxxxx xxxxx xxxxxxxx; xxx xxxxxxxx xxxxxx. xxxxx xxxxxxxx xxxx xxxxxx xxx xxxxxx xxxxxx xx xxx xxxxxx xxxxxxxx; xxxx xxxxxxxx xxxxxx x xxxxxx xxxx xx xxx xxxxxxx xxx xxxxxxx xxxxx.", "center image"); pp++;
	pp_list[pp] = new premier_partners("Martin Land Co.", "martinland.gif", "xxxxxx xxxxxxxx xxx xxx xxxxxxxxxx xxxxxxxx xx xxxxxx xxx xxxxx; xxx xxxxxx xxx xxxxxx xxx xxxxxxxxx, xxx xxx xxx xxxxxxxxx xx xxx; xxx xxxxx xxxxx xx xxxxx xxx xxxxxxx xxxxxx xx x xxxx; xxx xxxxx xxx xxxxxxx xxxxx xxxxxxxx; xxx xxxxxxxx xxxxxx. xxxxx xxxxxxxx xxxx xxxxxx xxx xxxxxx xxxxxx xx xxx xxxxxx xxxxxxxx; xxxx xxxxxxxx xxxxxx x xxxxxx xxxx xx xxx xxxxxxx xxx xxxxxxx xxxxx.", "center image"); pp++;

	pphn = Math.random()*pp_list.length;
	pphn = parseInt(pphn);
	pph = '';
	pph += '<div class="bxblue">';
	pph += '		<div class="bxtitle">PREMIER PARTNERS</div>';
	if (pp_list[pphn].notes.search("center image") != -1) {pph += '		<img class="bximgc" src="images/pp_' + pp_list[pphn].img + '" border="0" alt="" />';}
	else {pph += '		<img class="bximgr" src="images/pp_' + pp_list[pphn].img + '" border="0" alt="" />';}
	pph += '		<div class="bxtx"><nobr><b>' + pp_list[pphn].title + '</b>.</nobr> ' + pp_list[pphn].content + '</div>';
	pph += '	</div>';
*/

// ---------- Service Area ----------
	sva = '';
	sva += '<div class="bxblue">';
	sva += '		<div class="bxtitle">SERVICE AREA</div>';
	sva += '		<a href="imgs/tves_service_area.jpg" target="Service Area"><img class="bximgc" style="margin-bottom: 10px" src="imgs/tves_service_area_s.jpg" width="200" height="150" border="0" alt="" /></a>';
	sva += '		<div class="bxtx" style="text-align: center;">';
	sva += '			<b>Region:</b> San Francisco East Bay<br />';
	sva += '			<b>Counties:</b> Alameda, Contra&nbsp;Costa, San&nbsp;Joaquin, San&nbsp;Mateo, Santa&nbsp;Clara, Stanislaus<br />';
	sva += '			<b>Cities:</b> Alamo, Antioch, Banta, Bay&nbsp;Point, Bethel&nbsp;Island, Blackhawk, Brentwood, Byron, Castro&nbsp;Valley, Clayton, Concord, Cupertino, Danville, Diablo, Discovery&nbsp;Bay, Dublin, Fremont, French&nbsp;Camp, Hayward, Knightsen, Lafayette, Lathrop, Livermore, Los&nbsp;Altos, Manteca, Martinez, Milpitas, Mountain&nbsp;House, Mountain&nbsp;View, Newark, Oakley, Pacheco, Palo&nbsp;Alto, Patterson, Pittsburg, Pleasant&nbsp;Hill, Pleasanton, San&nbsp;Jose, San&nbsp;Leandro, San&nbsp;Lorenzo, San&nbsp;Ramon, Santa&nbsp;Clara, Stockton, Sunnyvale, Sunol, Tracy, Union&nbsp;City, Walnut&nbsp;Creek, Westley, Weston&nbsp;Ranch';
	sva += '		</div>';
	sva += '	</div>';

// ---------- Organizations ----------
	org = '';
	org += '<div class="bxquote" style="margin-bottom: 1px;">';
	org += '	<img class="bximgc" style="margin-bottom: 10px" src="imgs/o_servicemagic.png" width="95" height="100" border="0" alt="" />';
	org += '	<a href="http://www.bbb.org/" target="_blank"><img class="bximgc" style="margin-bottom: 10px" src="imgs/o_bbb.gif" width="95" height="100" border="0" alt="" /></a>';
	org += '	<a href="http://www.nfpa.org" target="_blank"><img class="bximgc" style="margin-bottom: 10px" src="imgs/o_nfpa.gif" width="95" height="100" border="0" alt="" /></a>';
	org += '</div>';

// ---------- Quotes ----------
	function quote(content, nametitle, company, notes) {
		this.content = content;
		this.nametitle = nametitle;
		this.company = company;
		this.notes = notes;
	}

	qt=0;
	var qt_list = new Array();
	// Quotes
	//qt_list[qt] = new quote("Quote", "Quote Name and Title", "Quote Company", "Quote notes"); qt++;
	qt_list[qt] = new quote("Your technician did a great job. He was very thorough and explained everything that needed to be done. We are very happy with Tri-Valley Electrical.", "Scott &amp; Jean P.", "Danville, CA", ""); qt++;
	qt_list[qt] = new quote("[Tri-Valley Electrical] did a great job! The technician was very nice. I was impressed with the service I received.", "Karen G.", "Pleasanton, CA", ""); qt++;
	qt_list[qt] = new quote("Wow, I was amazed at how quickly [Tri-Valley Electrical] returned my call and then ...came out same day. Now that's service!", "Ellen P.", "Tracy, CA", ""); qt++;
	
	qthn = Math.random()*qt_list.length;
	qthn = parseInt(qthn);
	qth = '';
	qth += '<div class="bxquote">';
	qth += '		<div class="quote"><img class="quote_open" src="imgs/q1.gif" border="0" alt="" />' + qt_list[qthn].content + '<img class="quote_close" src="imgs/q2.gif" border="0" alt="" /><br />';
	qth += '		<div class="quoted">' + qt_list[qthn].nametitle + '<br />' + qt_list[qthn].company + '</div>';
	qth += '		</div>';
	qth += '</div>';


// ---------- Business Clients ----------
	bcl = '';
	bcl += '<div class="bxblue">';
	bcl += '		<div class="bxtitle">SOME VALUED CLIENTS</div>';
	bcl += '			<div class="bxtx_list" style="line-height: 15px;">Amador Valley Prop. Mgmnt</div>';
	bcl += '			<div class="bxtx_list" style="line-height: 15px;">St. Augustine Church</div>';
	bcl += '			<div class="bxtx_list" style="line-height: 15px;">Big Valley Termite</div>';
	bcl += '			<div class="bxtx_list" style="line-height: 15px;">Black Hawk Veterinary</div>';
	bcl += '			<div class="bxtx_list" style="line-height: 15px;">Brighton Collectibles</div>';
	bcl += '			<div class="bxtx_list" style="line-height: 15px;">City of Union City</div>';
	bcl += '			<div class="bxtx_list" style="line-height: 15px;">Common Interest Mgmnt</div>';
	bcl += '			<div class="bxtx_list" style="line-height: 15px;">DelaTorre\'s Restaurant</div>';
	bcl += '			<div class="bxtx_list" style="line-height: 15px;">St. Elizabeth Church</div>';
	bcl += '			<div class="bxtx_list" style="line-height: 15px;">Equity Residential</div>';
	bcl += '			<div class="bxtx_list" style="line-height: 15px;">Fredericks of Hollywood</div>';
	bcl += '			<div class="bxtx_list" style="line-height: 15px;">H&amp;R Block</div>';
	bcl += '			<div class="bxtx_list" style="line-height: 15px;">Hacienda Pools</div>';
	bcl += '			<div class="bxtx_list" style="line-height: 15px;">Harris Prop. Mgmnt</div>';
	bcl += '			<div class="bxtx_list" style="line-height: 15px;">Investment Properties</div>';
	bcl += '			<div class="bxtx_list" style="line-height: 15px;">Jack in the Box</div>';
	bcl += '			<div class="bxtx_list" style="line-height: 15px;">Kimber &amp; Associates</div>';
	bcl += '			<div class="bxtx_list" style="line-height: 15px;">Las Positas College</div>';
	bcl += '			<div class="bxtx_list" style="line-height: 15px;">Marine Corp Recruitment Ctr</div>';
	bcl += '			<div class="bxtx_list" style="line-height: 15px;">Marriott Courtyard</div>';
	bcl += '			<div class="bxtx_list" style="line-height: 15px;">Martin Land Company</div>';
	bcl += '			<div class="bxtx_list" style="line-height: 15px;">St. Phillips Church</div>';
	bcl += '			<div class="bxtx_list" style="line-height: 15px;">PS Business Parks</div>';
	bcl += '			<div class="bxtx_list" style="line-height: 15px;">Radisson Hotels</div>';
	bcl += '			<div class="bxtx_list" style="line-height: 15px;">Vic\' All Star Kitchen</div>';
	bcl += '	</div>';

// ---------- Coupons ----------
	couEval = new Date ();
	couYear =  couEval.getFullYear();
	couMonth = "";
	if (couYear <=2020) {
		if(couEval.getMonth() <= 2) {couMonth="03";}
		else if (couEval.getMonth() <= 5) {couMonth="06";}
		else if (couEval.getMonth() <= 8) {couMonth="09";}
		else {couMonth="12";}
	}
	else {couYear="0000"; couMonth="00";}
	coupon_date =  couYear + couMonth;

	cou = '';
	cou += '<div class="bxcoupon">';
	cou += '		<a href="coupon.html" target="_coupon"><img src="imgs/coupon/coupon' + coupon_date + '.gif" width="177" height="133" border="0" alt="" /></a><div class="footer"><a href="coupon.html" target="_coupon">Click&nbsp;for&nbsp;Printable&nbsp;Coupon</a></div>';
	cou += '</div>';

	coupon_img = '';
	coupon_img += '<div class="coupon_base"><img src="imgs/coupon/coupon_bg.jpg" border="0" alt="" /></div>';
	coupon_img += '<div class="coupon"><img src="imgs/coupon/coupon' + coupon_date + '.gif" border="0" alt="" /></div>';



// MASTER HTML ////////////////////////////////////////////////////////////////////////////////////////////////////
// ---------- Page Open ----------
pg_open = '';
pg_open += '	<center>';
pg_open += '		<table width="820" cellspacing="0" cellpadding="5" border="0">';
//top bar
pg_open += '			<tr>';
pg_open += '				<td colspan="2" align="center" valign="top">';
pg_open += '					<table width="100%" cellspacing="0" cellpadding="0" border="0">';
pg_open += '						<tr>';
if (pg_section=='home') {pg_open += '							<td align="left"><a href="index.html"><img src="imgs/tves_logo_long.gif" width="533" height="76" border="0" alt="Tri-Valley Electrical Service, Inc." /></a></td>';}
else {pg_open += '							<td align="left"><a href="index.html"><img src="imgs/tves_logo_long.gif" width="533" height="76" border="0" alt="Tri-Valley Electrical Service, Inc." /></a></td>';}
pg_open += '							<td align="center"><font class="appt">Appointments&nbsp;and<br />24/7&nbsp;Emergency&nbsp;Service<br /><font class="phone">(800)&nbsp;449-6244</font></font></td>';
pg_open += '						</tr>';
pg_open += '					</table>';
pg_open += '				</td>';
pg_open += '			</tr>';
//nav
pg_open += '			<tr>';
pg_open += '				<td colspan="2" align="center" valign="top">';
pg_open += '				<div class="nav1">';
pg_open += '					<table width="100%" cellspacing="0" cellpadding="0" border="0">';
pg_open += '						<tr>';
pg_open += '							<td width="10%" align="center" valign="top"><img src="imgs/clear.gif" width="10" height="22" alt="" /><font class="nav1tx"><br /><a href="index.html">TVES<br />Home</a><br />';
if (pg_section=='home') {pg_open += '<img src="imgs/n1_marker.gif" width="50" height="23" alt="" />';} else {pg_open += '<img src="imgs/clear.gif" width="18" height="23" alt="" />';}
pg_open += '</font></td>';
pg_open += '							<td width="13%" align="center" valign="top"><img src="imgs/clear.gif" width="10" height="22" alt="" /><font class="nav1tx"><br /><a href="residential.html">Residential<br />Services</a><br />';
if (pg_section=='resi') {pg_open += '<img src="imgs/n1_marker.gif" width="50" height="23" alt="" />';} else {pg_open += '<img src="imgs/clear.gif" width="18" height="23" alt="" />';}
pg_open += '</font></td>';
pg_open += '							<td width="13%" align="center" valign="top"><img src="imgs/clear.gif" width="10" height="22" alt="" /><font class="nav1tx"><br /><a href="commercial.html">Commercial<br />Services</a><br />';
if (pg_section=='comm') {pg_open += '<img src="imgs/n1_marker.gif" width="50" height="23" alt="" />';} else {pg_open += '<img src="imgs/clear.gif" width="18" height="23" alt="" />';}
pg_open += '</font></td>';
pg_open += '							<td width="13%" align="center" valign="top"><img src="imgs/clear.gif" width="10" height="22" alt="" /><font class="nav1tx"><br /><a href="company.html">Company<br />Information</a><br />';
if (pg_section=='comp') {pg_open += '<img src="imgs/n1_marker.gif" width="50" height="23" alt="" />';} else {pg_open += '<img src="imgs/clear.gif" width="18" height="23" alt="" />';}
pg_open += '</font></td>';
pg_open += '							<td width="13%" align="center" valign="top"><img src="imgs/clear.gif" width="10" height="22" alt="" /><font class="nav1tx"><br /><a href="careers.html">Careers<br />at&nbsp;TVES</a><br />';
if (pg_section=='care') {pg_open += '<img src="imgs/n1_marker.gif" width="50" height="23" alt="" />';} else {pg_open += '<img src="imgs/clear.gif" width="18" height="23" alt="" />';}
pg_open += '</font></td>';
pg_open += '							<td width="13%" align="center" valign="top"><img src="imgs/clear.gif" width="10" height="22" alt="" /><font class="nav1tx"><br /><a href="contact.html">Contact<br />Info</a><br />';
if (pg_section=='cont') {pg_open += '<img src="imgs/n1_marker.gif" width="50" height="23" alt="" />';} else {pg_open += '<img src="imgs/clear.gif" width="18" height="23" alt="" />';}
pg_open += '</font></td>';
pg_open += '							<td width="13%" align="center" valign="top"><img src="imgs/clear.gif" width="10" height="22" alt="" /><font class="nav1tx"><br /><a href="products.html">Featured<br />Products</a><br />';
if (pg_section=='prod') {pg_open += '<img src="imgs/n1_marker.gif" width="50" height="23" alt="" />';} else {pg_open += '<img src="imgs/clear.gif" width="18" height="23" alt="" />';}
pg_open += '</font></td>';
pg_open += '							<td width="12%" align="right" valign="middle">';
pg_open += '								<table width="100%" cellspacing="0" cellpadding="0" border="0">';
pg_open += '									<tr>';
pg_open += '										<td width="14" align="right" valign="bottom"><img src="imgs/bx_orag_tl.gif" width="14" height="14" alt="" /></td>';
pg_open += '										<td align="center" bgcolor="#ee8054"><img src="imgs/clear.gif" width="1" height="1" border="0" alt="" /></td>';
pg_open += '										<td width="14" align="left" valign="bottom"><img src="imgs/bx_orag_tr.gif" width="14" height="14" alt="" /></td>';
pg_open += '									</tr>';
pg_open += '									<tr>';
pg_open += '										<td width="14" align="center" bgcolor="#ee8054"><img src="imgs/clear.gif" width="14" height="45" border="0" align="left" alt="" /></td>';
pg_open += '										<td align="center" valign="middle" bgcolor="#ee8054"><font class="nav1tx"><a href="safety.html">Safety<br />Alerts</a></font></td>';
pg_open += '										<td width="14" align="center" bgcolor="#ee8054"><img src="imgs/clear.gif" width="14" height="45" border="0" align="left" alt="" /></td>';
pg_open += '									</tr>';
pg_open += '									<tr>';
pg_open += '										<td width="14" align="right" valign="top"><img src="imgs/bx_orag_bl.gif" width="14" height="14" alt="" /></td>';
if (pg_section=='safe') {pg_open += '<td align="center" valign="bottom" bgcolor="#ee8054"><img src="imgs/n1_marker2.gif" width="50" height="12" border="0" alt="" /></td>';} else {pg_open += '<td align="center" bgcolor="#ee8054"><img src="imgs/clear.gif" width="1" height="1" border="0" alt="" /></td>';}
pg_open += '										<td width="14" align="left" valign="top"><img src="imgs/bx_orag_br.gif" width="14" height="14" alt="" /></td>';
pg_open += '									</tr>';
pg_open += '								</table>';
pg_open += '							</td>';
pg_open += '						</tr>';
pg_open += '					</table>';

pg_open += '				</div>';
pg_open += '					<img src="imgs/clear.gif" width="5" height="5" border="0" alt="" /><br />';
pg_open += '				</td>';
pg_open += '			</tr>';
// start content row
pg_open += '			<tr>';
if (pg_section=='home') {pg_open += '				<td colspan="2" align="left" valign="top">';}
else {pg_open += '				<td align="left" valign="top">';}



// ---------- Page Close ----------
pg_close = '';
// Banner Ad1
if (FlashDetect.installed) {pg_close += '<div class="adspace"><div class="footer">Advertisement</div><a href="' + ad1_list[ad1n].link + '" target="_ad1"><img  class="adbanner" src="ads/' + ad1_list[ad1n].flash + '" width="468" height="60" border="0" alt="" /></a></div>';}
else {pg_close += '<div class="adspace"><div class="footer">Advertisement</div><a href="' + ad1_list[ad1n].link + '" target="_ad1"><img  class="adbanner" src="ads/' + ad1_list[ad1n].noflash + '" width="468" height="60" border="0" alt="" /></a></div>';}
pg_close += '</td>';
// Right Column
if (pg_section!='home') {pg_close += '				<td width="225" align="center" valign="top">';}
if (pg_section=='home') {pg_close += '';}
else if (pg_section=='resi') {pg_close +=  cou + sva + sah;}
else if (pg_section=='comm') {pg_close += sah + qth + fpch;}
else if (pg_section=='comp') {pg_close += org + qth + bcl;}
else if (pg_section=='care') {pg_close += qth + fprh;}
else if (pg_section=='cont') {pg_close += sah + qth + fprh;}
else if (pg_section=='prod') {pg_close += fpl + qth + sah;}
else if (pg_section=='safe') {pg_close += sal + qth + fprh;}
else {pg_close += sah + qth + fprh;}
pg_close += '</td>';
// Page Wrap
pg_close += '			</tr>';
pg_close += '			<tr>';
pg_close += '				<td colspan="2" align="center" valign="top"><div class="footer"><br />';
pg_close += '					<a href="index.html"><span class="nowrap">Tri-Valley</span> Electrical Service (home)</a> | <a href="residential.html">Residential Service</a> | <a href="commercial.html">Commercial Service</a><br />';
pg_close += '					<a href="company.html">Company&nbsp;Information</a> | <a href="careers.html">Careers&nbsp;at&nbsp;TVES</a> | <a href="contact.html">Contact&nbsp;Info</a> | <a href="products.html">Featured&nbsp;Products</a> | <a href="safety.html">Safety&nbsp;Alerts</a><br />';
pg_close += '					&copy; ' + copyright + ' <span class="nowrap">Tri-Valley</span> Electrical Service, Inc. &nbsp;&nbsp;&nbsp; All rights reserved.';
pg_close += '				</div></td>';
pg_close += '			</tr>';
pg_close += '		</table>';
pg_close += '	</center>';




