// JavaScript Document

// For testing purposes, the base url is different since it is a sub-directory on the test website
// accommodate for that using the baseurl variable
// 
hostname = location.host;
hostname = hostname.toLowerCase();
//alert(hostname);
if (hostname.indexOf("drfinstalls.com") >= 0) {
	//alert("Live site");
	baseurl = "";
}
else if (hostname.indexOf("drftps.com") >= 0) {
	//alert("Live site");
	baseurl = "";
}
else {
	//alert("Test site");
	// this test site is under the "/drf" directory on the test server
	baseurl = "/drf";
}
//

function AddTopNavBar() {
	
	var x = String.fromCharCode(8226);
	
	document.write('<a href="http://www.drfinstalls.com" title="DRF Home">Home</a>');
	document.write('<span class="topnavdot">');
	document.write(x);
	document.write('</span>');
	
	document.write('<a href="' + baseurl + '/hotwater.html" title="Hot Water">Hot Water</a>');
	document.write('<span class="topnavdot">');
	document.write(x);
	document.write('</span>');
	
	
	document.write('<a href="' + baseurl + '/irrigation.html" title="Irrigation">Irrigation</a>');
	document.write('<span class="topnavdot">');
	document.write(x);			   
	document.write('</span>');
	
	document.write('<a href="' + baseurl + '/rpz.html" title="RPZ Services">RPZ</a>');
	document.write('<span class="topnavdot">');
	document.write(x);
	document.write('</span>');
	
	document.write('<a href="' + baseurl + '/plumbing.html" title="Plumbing">Plumbing</a>');
	document.write('<span class="topnavdot">');
	document.write(x);
	document.write('</span>');
	
	document.write('<a href="' + baseurl + '/water" title="Filtration">Filtration</a>');
	document.write('<span class="topnavdot">');
	document.write(x);
	document.write('</span>');
	
	document.write('<a href="' + baseurl + '/hvac.html" title="Heating, Ventilation &amp; Air Conditioning - HVAC">HVAC</a>');
	document.write('<span class="topnavdot">');
	document.write(x);
	document.write('</span>');
	
	document.write('<a href="' + baseurl + '/electrical.html" title="Electrical">Electrical</a>');
	
}

function AddTopMajorMenu(subtype, mposition) {
	// this creates the top or side menu for each major top level subject
	// This function defaults to the "top" memnu which is active for sub pages
	mposition = mposition || "top";  // otherwise should be set to "side"
	
	// seperator "dot" with spaces on both sides
	var x = String.fromCharCode(8226);
	x = ' ' + x + ' ';
	
	document.write('<a href="http://www.drfinstalls.com/" title="Home">Home</a>');
	document.write(x);
	document.write('<a href="' + baseurl + '/about.html" title="Company Information">Company Information</a> ');
	document.write(x);
	document.write(' <a href="' + baseurl + '/contactus" title="Contact Us">Contact Us</a> ');
	
	if (mposition == "side") {document.write('<br />')} else document.write(x);
	 
	document.write(' <a href="' + baseurl + '/servicearea.html" title="Service Ares">Service Area</a> ');
	
    if (mposition == "top") {document.write('<br />')} else document.write(x);
	
	document.write('<a href="' + baseurl + '/testimonials.html" title="Testimonials">Testimonials</a>');
	
	document.write(x);
	
	document.write('<a href="' + baseurl + '/careers" title="Careers">Careers</a>');
	
	if (mposition == "side") {document.write('<br />')} else document.write(x);
 	
	// Now service specific menu pieces
	if (subtype == "HotWater") {
		document.write('<a href="' + baseurl + '/hotwaterbid" title="Hot Water Bid">Online Bid</a> ');
		document.write(x);
		document.write(' <a href="' + baseurl + '/hotwater_faq.php" title="Hot Water Frequently Asked Questions">FAQ</a> ');
		
	}
	else if (subtype == "Irrigation") {
		document.write('<a href="' + baseurl + '/irrigation_bid.html" title="Irrigation Bid">Online Bid</a> ');
		document.write(x);
		document.write(' <a href="' + baseurl + '/irrigation_faq.html" title="Irrigation Frequently Asked Questions">FAQ</a> ');
		document.write(x);
		document.write(' <a href="' + baseurl + '/irrigation_components.html" title="Product Info">Product Info</a> ');
		
	}
	else if (subtype == "Plumbing") {
		document.write('<a href="' + baseurl + '/irrigation_bid.html" title="Irrigation Bid">Online Bid</a> ');
		document.write(x);
		document.write(' <a href="' + baseurl + '/hotwater_faq.php" title="Hot Water Frequently Asked Questions">FAQ</a> ');
		
		
	}
	else if (subtype == "RPZ") {
		document.write('<a href="' + baseurl + '/rpz_certification_request.html" title="Online Certification Request Form">Online Certification Request</a> ');
		document.write(x);
		document.write(' <a href="' + baseurl + '/hotwater_faq.php" title="Hot Water Frequently Asked Questions">FAQ</a> ');
	
		
		
	}
	else if (subtype == "Filtration") {
		document.write('<a href="' + baseurl + '/irrigation_bid.html" title="Irrigation Bid">Online Bid</a> ');
		document.write(x);
		document.write(' <a href="' + baseurl + '/hotwater_faq.php" title="Hot Water Frequently Asked Questions">FAQ</a> ');
		document.write(x);
		document.write(' <script type="text/javascript">PageUnavailable("Product Info");</script> ');
		
	}
	else if (subtype == "HVAC") {
		document.write(' <a href="' + baseurl + '/furnacebid" title="Online Furnace Bid">Online Furnace Bid</a> ');
		document.write(x);
		document.write(' <a href="' + baseurl + '/hvac_faq.php" title="General HVAC Frequently Asked Questions">FAQ</a> ');
		document.write(x);
		document.write(' <script type="text/javascript">PageUnavailable("Product Info");</script> ' );
	;
	}
	else if (subtype == "Electrical") {
		document.write('<script type="text/javascript">PageUnavailable("Online Bid");</script> ');
		document.write(x);
		document.write('<script type="text/javascript">PageUnavailable("FAQ");</script> ');
		document.write(x);
		document.write('<script type="text/javascript">PageUnavailable("Product Info");</script> ');
	
	}
	else if (subtype == "None") {
		
	}
}

function AddSubMenu(subtype) {
	var x = String.fromCharCode(8226);
	
	if (subtype == "HotWater") {
		document.write('Residential ');
		document.write(x);
		document.write('<br><a href="' + baseurl + '/hotwater_commercial.html" title="Commercial">Commercial</a> ');
		document.write(x);
		document.write('<br><a href="' + baseurl + '/hotwaterbid" title="Online Bid - Hot Water">Online Bid</a> ');
		document.write(x);
		document.write('<br><a href="' + baseurl + '/hotwater_tankless.html" title="Tankless">Tankless</a> ');
		document.write(x);
		document.write('<br><a href="' + baseurl + '/hotwater_instant.html" title="Residential Instant Hot Water">Instant Hot Water</a> ');
		document.write(x);
		document.write('<br><a href="' + baseurl + '/hotwater_trouble.html" title="Troubleshooting">Troubleshooting</a> ');
		document.write(x);
		
	}
		else if (subtype == "Company") {
		document.write('<a href="' + baseurl + '/news.html" title="News & Press">News &amp; Press</a> ');
		document.write(x);
		document.write('<br><a href="' + baseurl + '/certificates.html" title="Licenses/Certifications">Licenses/Certifications</a> ');
		document.write(x);
		document.write('<br><a href="' + baseurl + '/community.html" title="Community Involvement">Community Involvement</a> ');
		document.write(x);
		
	}
	else if (subtype == "Irrigation") {
		document.write('<a href="' + baseurl + '/irrigation_contracts.html" title="Service Contracts">Service Contracts</a> ');
		document.write(x);
		document.write('<br><a href="' + baseurl + '/irrigation_components.html" title="Product Info">Product Info</a> ');
		document.write(x);
		document.write('<br><a href="' + baseurl + '/irrigation_bid.html" title="Irrigation Bid">Online Bid</a> ');
		document.write(x);
		document.write('<br><a href="' + baseurl + '/irrigation_referrals.html" title="Irrigation Testimonials and Referrals">Referrals</a> ');
		document.write(x);

	}
	else if (subtype == "Plumbing") {
		document.write('<a href="' + baseurl + '/irrigation_bid.html" title="Irrigation Bid">Online Bid</a> ');
		document.write(x);
		document.write('<br><a href="' + baseurl + '/hotwater_faq.php" title="Hot Water Frequently Asked Questions">FAQ</a> ');
		document.write(x);

	}
	else if (subtype == "RPZ") {
		document.write('<a href="' + baseurl + '/rpz_certification.html" title="RPZ Certification">RPZ Certification</a> ');
		document.write(x);
		document.write('<br><a href="' + baseurl + '/rpz_certification_request.html" title="RPZ Certification within 48-72 Hrs">Online Certification Request</a> ');
		document.write(x);
		
		document.write('<br><a href="' + baseurl + '/rpz_certificationspecs.html" title="Certification Specifications">Certification Specs</a> ');
		document.write(x);
	}
	else if (subtype == "Filtration") {
		document.write('<a href="' + baseurl + '/irrigation_bid.html" title="Irrigation Bid">Online Bid</a> ');
		document.write(x);
		document.write('<br><a href="' + baseurl + '/hotwater_faq.php" title="Hot Water Frequently Asked Questions">FAQ</a> ');
		document.write(x);
	
	}
	
	else if (subtype == "HVAC") {
		document.write('<a href="' + baseurl + '/hvac_commercial.html" title="Commercial Heating &amp; Cooling">Commercial</a> ');
		document.write(x);
		document.write('<br><a href="' + baseurl + '/hvac_residential.html" title="Residential Heating &amp; Cooling">Residential</a> ');
		document.write(x);
		document.write('<br><a href="' + baseurl + '/hvac_residential_fa_heating.html" title="Forced Air Heating">Forced Air Heating</a> ');
		document.write(x);
		document.write('<br><a href="' + baseurl + '/hvac_residential_hy_heating.html" title="Hydronic - Hot Water - Heating">Hydronic Heating</a> ');
		document.write(x);
		document.write('<br><a href="' + baseurl + '/hvac_residential_cooling.html" title="Cooling">Cooling</a> ');
		document.write(x);	
		document.write('<br><a href="' + baseurl + '/furnacebid" title="Online Furnace Bid">Online Furnace Bid</a> ');
		document.write(x);
		
/*		
		document.write('<br><a href="' + baseurl + '/hvac_residential_addons.html" title="Controls, Humidifiers, Air Cleaners">Add-ons</a> ');
		document.write(x);
*/
		
	}
	else if (subtype == "Electrical") {
		
	}
	
}


function PageUnavailable(linktext) {

	document.write('<a href="javascript:void(0);" title="This page is not currently available" onclick="window.open(\'' + baseurl + '/unavailable.html\',\'WindowUnavailable\',\'menubar=no,width=300,height=260,toolbar=no\')">');
	document.write(linktext);
	document.write('</a>');
}

function CallPopUp(linkfile, width, height, linktext) {

	document.write('<a href="javascript:void(0);" onclick="window.open(\'');
	document.write(linkfile);
	document.write('\',\'WindowPopUp\',\'menubar=no,width=');
	document.write(width);
	document.write(',height=');
	document.write(height);
	document.write(',toolbar=no\')">');
	document.write(linktext);
	document.write('</a>');
}


function AddCopyright() {
	
	var copyrightstring;
	var year;
	var nowDate=new Date();
	year = nowDate.getFullYear();
	
	copyrightstring = '<span class="copyright">&copy; ';
	copyrightstring += year;
	copyrightstring += ', DRF Trusted Property Solutions - ';
	copyrightstring += 'All rights reserved</span>';
	document.write(copyrightstring);
}


function SetEaddr(user, txtclass) {

	var emaddrstring = "";

	var adr1=user;

	var adr2="@"

	var adr3="DRFtps";

	var adr4=".com";

	var adrx= adr1 + adr2 + adr3 + adr4;

	emaddrstring += "<a href=\"mail";

	emaddrstring += "to:";

	emaddrstring += adrx;

	emaddrstring += "\" class=\"";
	
	emaddrstring += txtclass;
	
	emaddrstring += "\" title=\"Click to e-mail\">";

	emaddrstring += adrx;

	emaddrstring += "</a>";

	document.write(emaddrstring);
}

function SetEaddrWithImage(user, image) {

	var mailstring = "";

	var adr1=user;

	var adr2="@";

	var adr3="DRFinstalls";

	var adr4=".com";

	var adrx= adr1 + adr2 + adr3 + adr4;

	mailstring += "<a href=\"mail";

	mailstring += "to:";

	mailstring += adrx;

	mailstring += "\">";
	
	mailstring += "<img src=\"";
	
	mailstring += image;
	
	mailstring += "\" alt=\"\">";

	mailstring += "</a>";

	document.write(mailstring);
}

function containsHTML(textstring) {
	
	var re = /(.*)<(.*)>(.*)/;
	return re.test(textstring);
}

