﻿/*** SET BUTTON'S FOLDER HERE ***/
var buttonFolder = "buttons/";

/*** SET BUTTONS' FILENAMES HERE ***/
upSources = new Array("button1up.gif","button2up.gif","button3up.gif","button4up.gif","button5up.gif","button6up.gif","button7up.gif","button8up.gif","button9up.gif","button10up.gif","button11up.gif","button12up.gif","button13up.gif","button14up.gif","button15up.gif","button16up.gif");

overSources = new Array("button1over.gif","button2over.gif","button3over.gif","button4over.gif","button5over.gif","button6over.gif","button7over.gif","button8over.gif","button9over.gif","button10over.gif","button11over.gif","button12over.gif","button13over.gif","button14over.gif","button15over.gif","button16over.gif");

// SUB MENUS DECLARATION, YOU DONT NEED TO EDIT THIS
subInfo = new Array();
subInfo[1] = new Array();
subInfo[2] = new Array();
subInfo[3] = new Array();
subInfo[4] = new Array();
subInfo[5] = new Array();
subInfo[6] = new Array();
subInfo[7] = new Array();
subInfo[8] = new Array();
subInfo[9] = new Array();
subInfo[10] = new Array();
subInfo[11] = new Array();
subInfo[12] = new Array();
subInfo[13] = new Array();
subInfo[14] = new Array();
subInfo[15] = new Array();
subInfo[16] = new Array();


//*** SET SUB MENUS TEXT LINKS AND TARGETS HERE ***//

subInfo[1][1] = new Array("Home","http://www.thehomeinspector.com/index.html","");
subInfo[1][2] = new Array("MLC Websites","http://www.TheHomeInspector.com/sites.html","");
subInfo[1][3] = new Array("MLC Newsletters","http://www.TheHomeInspector.com/Newsletters.html","");
subInfo[1][4] = new Array("--Buyers - IYH","http://www.TheHomeInspector.com/Clients/IYHSubscribe.html","");
subInfo[1][5] = new Array("--Sellers - IYH","http://www.TheHomeInspector.com/Clients/IYHSubscribe.html","");
subInfo[1][6] = new Array("--Agents - ASP","http://www.thehomeinspector.com/Agents/Agents.html","");
subInfo[1][7] = new Array("--Lenders - ASP","http://www.thehomeinspector.com/Agents/Agents.html","");
subInfo[1][8] = new Array("--Inspectors - MMM","http://www.thehomeinspector.com/Inspector/MMMSubscribe.html","");


subInfo[2][1] = new Array("Clients","http://www.thehomeinspector.com/Clients.html","");
subInfo[2][2] = new Array("Report Download","http://www.thehomeinspector.com/Report.html","");
subInfo[2][3] = new Array("Directory","http://www.thehomeinspector.com/Clients/LinksDirectory.html","");
subInfo[2][4] = new Array("Foreclosures","http://www.REOInspector.com","");
subInfo[2][5] = new Array("IYH Newsletter","http://www.TheHomeInspector.com/Clients/IYHSubscribe.html","");
subInfo[2][6] = new Array("Report Payment","http://www.thehomeinspector.com/pay.html","");

subInfo[3][1] = new Array("Residential","http://www.thehomeinspector.com/Clients/IResidential.html","");
subInfo[3][2] = new Array("EOET","http://www.thehomeinspector.com/Clients/IEOET.html","");
subInfo[3][3] = new Array("Radon","http://www.thehomeinspector.com/ERadon.html","");
subInfo[3][4] = new Array("Termite","http://www.thehomeinspector.com/Clients/ITermite.html","");
subInfo[3][5] = new Array("Stucco","http://www.thestuccoinspector.com/","blank");
subInfo[3][6] = new Array("Lead","http://www.thehomeinspector.com/Clients/ILead.html","");
subInfo[3][7] = new Array("Decks","http://www.deckfailure.com/","blank");
subInfo[3][8] = new Array("METH","http://www.themethinspector.com","_blank");
subInfo[3][9] = new Array("REO Bank Owned","http://www.REOInspector.com","");
subInfo[3][10] = new Array("Foreclosures","http://www.REOInspector.com","");
subInfo[3][11] = new Array("Short-Sales","http://www.REOInspector.com","");

subInfo[4][1] = new Array("Credentials","http://www.thehomeinspector.com/Credentials.html","");
subInfo[4][2] = new Array("You’re Too Critical","http://www.thehomeinspector.com/Clients/Critical.html","");

subInfo[5][1] = new Array("Online Order","http://www.thehomeinspector.com/Order.html","");
subInfo[5][2] = new Array("Travel Fees","http://www.thehomeinspector.com/Area.html","");
subInfo[5][3] = new Array("Report Download","http://www.thehomeinspector.com/Report.html","");
subInfo[5][4] = new Array("Report Payment","http://www.thehomeinspector.com/pay.html","");
subInfo[5][5] = new Array("CONTRACT","https://thehomeinspector.com/Clients/ContractHI.html","");
subInfo[5][6] = new Array("ADDENDUMS","https://thehomeinspector.com/Clients/ContractHIAddendums.html","");
subInfo[5][7] = new Array("--Termite","https://thehomeinspector.com/Clients/ContractHITermite.html","");
subInfo[5][8] = new Array("--E.O.E.T.","https://thehomeinspector.com/Clients/ContractHIEOET.html","");
subInfo[5][9] = new Array("--Lead Paint","https://thehomeinspector.com/Clients/ContractHILead.html","");
subInfo[5][10] = new Array("--Radon","https://thehomeinspector.com/Clients/ContractHIRadon.html","");

subInfo[6][1] = new Array("TheStuccoInspector.com","http://www.thestuccoinspector.com","blank");
subInfo[6][2] = new Array("EIFS","http://www.thestuccoinspector.com/EIFS.html","blank");
subInfo[6][3] = new Array("Hardcoat","http://www.thestuccoinspector.com/Hardcoat.html","blank");
subInfo[6][4] = new Array("FAQs","http://www.thestuccoinspector.com/FAQ.html","blank");
subInfo[6][5] = new Array("Order","http://www.thestuccoinspector.com/order.html","blank");

subInfo[7][1] = new Array("WaterEntry.com","http://www.waterentry.com","blank");

subInfo[8][1] = new Array("Environmental","http://www.thehomeinspector.com/Environmental.html","");
subInfo[8][2] = new Array("Radon","http://www.thehomeinspector.com/ERadon.html","");
subInfo[8][3] = new Array("METH","http://www.themethinspector.com","_blank");
subInfo[8][4] = new Array("Mold","http://www.thehomeinspector.com/EMold.html","");
subInfo[8][5] = new Array("Asbestos","http://www.thehomeinspector.com/EAsbestos.html","");
subInfo[8][6] = new Array("Vermiculite","http://www.thehomeinspector.com/Clients/Vermiculite.html","");
subInfo[8][7] = new Array("Popcorn Ceiling","http://www.thehomeinspector.com/EAsbestosPopcorn.html","");

subInfo[9][1] = new Array("Decks","http://www.deckfailure.com","blank");
subInfo[9][2] = new Array("Failures","http://www.deckfailure.com/Failures.html","blank");
subInfo[9][3] = new Array("FAQs","http://www.deckfailure.com/FAQs.html","blank");
subInfo[9][4] = new Array("Inspections","http://www.deckfailure.com/Inspections.html","blank");
subInfo[9][5] = new Array("Order","http://www.deckfailure.com/Order.html","blank");

subInfo[10][1] = new Array("FULL LIST","http://www.thehomeinspector.com/Specialty.html","");
subInfo[10][2] = new Array("Water Quality","http://www.thehomeinspector.com/Clients/IWaterQuality.html","");
subInfo[10][3] = new Array("Radon","http://www.thehomeinspector.com/ERadon.html","");
subInfo[10][4] = new Array("EOET Electrical","http://www.thehomeinspector.com/Clients/IEOET.html","");
subInfo[10][5] = new Array("Condominiums","http://www.thehomeinspector.com/Clients/ICondos.html","blank");
subInfo[10][6] = new Array("Log Cabins","http://www.thehomeinspector.com/Clients/ILogHomes.html","");
subInfo[10][7] = new Array("Multi-Units","http://www.thecommercialinspector.com","blank");
subInfo[10][8] = new Array("Hotel","http://www.thecommercialinspector.com","blank");
subInfo[10][9] = new Array("METH","http://www.themethinspector.com","_blank");
subInfo[10][10] = new Array("Commercial","http://www.thecommercialinspector.com","blank");
subInfo[10][11] = new Array("Moisture Intrusion","http://www.WaterEntry.com","");
subInfo[10][12] = new Array("REO Bank Owned","http://www.REOInspector.com","");
subInfo[10][13] = new Array("Foreclosures","http://www.REOInspector.com","");
subInfo[10][14] = new Array("Short-Sales","http://www.REOInspector.com","");
subInfo[10][14] = new Array("FULL LIST","http://www.thehomeinspector.com/Specialty.html","");

subInfo[11][1] = new Array("Inspectors","http://www.thehomeinspector.com/Inspectors.html","");

subInfo[12][1] = new Array("MLC Newsletters","http://www.TheHomeInspector.com/Newsletters.html","");
subInfo[12][2] = new Array("--Buyers - IYH","http://www.TheHomeInspector.com/Clients/IYHSubscribe.html","");
subInfo[12][3] = new Array("--Sellers - IYH","http://www.TheHomeInspector.com/Clients/IYHSubscribe.html","");
subInfo[12][4] = new Array("--Agents - ASP","http://www.thehomeinspector.com/Agents/Agents.html","");
subInfo[12][5] = new Array("--Lenders - ASP","http://www.thehomeinspector.com/Agents/Agents.html","");
subInfo[12][6] = new Array("--Inspectors - MMM","http://www.thehomeinspector.com/Inspector/MMMSubscribe.html","");
subInfo[12][7] = new Array("MMM Subscribe","http://www.thehomeinspector.com/Inspector/MMMSubscribe.html","");
subInfo[12][8] = new Array("MMM Current Issue","http://www.thehomeinspector.com/MMM.html","");
subInfo[12][9] = new Array("MMM Sample","http://www.thehomeinspector.com/Inspector/MMMSample.html","");

subInfo[13][1] = new Array("Family","http://www.thehomeinspector.com/Family.html","");
subInfo[13][2] = new Array("Grumpa Jack","http://www.thehomeinspector.com/Family/FamilyPhotos/JackWebb/JackWebb.html","");
subInfo[13][3] = new Array("Orem Dodgers","OremDodgers.com","");
subInfo[13][4] = new Array("Oglala","http://www.thehomeinspector.com/Family/Oglala.html","");
subInfo[13][5] = new Array("Atomic Adam","http://www.atomicadam.com/","");
subInfo[13][6] = new Array("Michael Sports","http://www.thehomeinspector.com/Family/MichaelHistorical.html","");
subInfo[13][7] = new Array("Timer","http://www.thehomeinspector.com/timer.html","_blank");

subInfo[14][1] = new Array("Industry","http://www.thehomeinspector.com/Clients/LinksIndustry.html","");
subInfo[14][2] = new Array("Directory","http://www.thehomeinspector.com/Clients/LinksDirectory.html","");
subInfo[14][3] = new Array("MLC Websites","http://www.TheHomeInspector.com/sites.html","");
subInfo[14][4] = new Array("MLC Newsletters","http://www.TheHomeInspector.com/Newsletters.html","");
subInfo[14][5] = new Array("TheHomeInspector","http://www.TheHomeInspector.com","_blank");
subInfo[14][6] = new Array("TheForeclosureInspector","http://www.REOInspector.com","");
subInfo[14][7] = new Array("TheCommercialInspector","http://www.TheCommercialInspector.com","_blank");
subInfo[14][8] = new Array("TheStuccoInspector","http://www.TheStuccoInspector.com","_blank");
subInfo[14][9] = new Array("TheMethInspector","http://www.TheMethInspector.com","_blank");
subInfo[14][10] = new Array("DeckFailure.com","http://www.DeckFailure.com","_blank");
subInfo[14][11] = new Array("WaterEntry.com","http://www.WaterEntry.com","_blank");
subInfo[14][12] = new Array("Kickout.info","http://www.kickout.info","_blank");
subInfo[14][13] = new Array("Diptube.info","http://www.diptube.info","_blank");
subInfo[14][14] = new Array("REOInspector.com","http://www.REOInspector.com","");

subInfo[15][1] = new Array("Phone","http://www.thehomeinspector.com/ContactUs.html","");
subInfo[15][2] = new Array("Email","http://www.thehomeinspector.com/ContactUs.html","");
subInfo[15][3] = new Array("Mail","http://www.thehomeinspector.com/ContactUs.html","");
subInfo[15][4] = new Array("MLC Websites","http://www.TheHomeInspector.com/sites.html","");



//*** SET SUB MENU POSITION ( RELATIVE TO BUTTON ) ***//
var xSubOffset = 123;
var ySubOffset = 0;



//*** NO MORE SETTINGS BEYOND THIS POINT ***//
var overSub = false;
var delay = 1000;
totalButtons = upSources.length;

// GENERATE SUB MENUS
for ( x=0; x<totalButtons; x++) {
	// SET EMPTY DIV FOR BUTTONS WITHOUT SUBMENU
	if ( subInfo[x+1].length < 1 ) { 
		document.write('<div id="submenu' + (x+1) + '">');
	// SET DIV FOR BUTTONS WITH SUBMENU
	} else {
		document.write('<div id="submenu' + (x+1) + '" class="dropmenu" ');
		document.write('onMouseOver="overSub=true;');
		document.write('setOverImg(\'' + (x+1) + '\',\'\');"');
		document.write('onMouseOut="overSub=false;');
		document.write('setTimeout(\'hideSubMenu(\\\'submenu' + (x+1) + '\\\')\',delay);');
		document.write('setOutImg(\'' + (x+1) + '\',\'\');">');


		document.write('<ul>');
		for ( k=0; k<subInfo[x+1].length-1; k++ ) {
			document.write('<li>');
			document.write('<a href="' + subInfo[x+1][k+1][1] + '" ');
			document.write('target="' + subInfo[x+1][k+1][2] + '">');
			document.write( subInfo[x+1][k+1][0] + '</a>');
			document.write('</li>');
		}
		document.write('</ul>');
	}
	document.write('</div>');
}





//*** MAIN BUTTONS FUNCTIONS ***//
// PRELOAD MAIN MENU BUTTON IMAGES
function preload() {
	for ( x=0; x<totalButtons; x++ ) {
		buttonUp = new Image();
		buttonUp.src = buttonFolder + upSources[x];
		buttonOver = new Image();
		buttonOver.src = buttonFolder + overSources[x];
	}
}

// SET MOUSEOVER BUTTON
function setOverImg(But, ID) {
	document.getElementById('button' + But + ID).src = buttonFolder + overSources[But-1];
}

// SET MOUSEOUT BUTTON
function setOutImg(But, ID) {
	document.getElementById('button' + But + ID).src = buttonFolder + upSources[But-1];
}



//*** SUB MENU FUNCTIONS ***//
// GET ELEMENT ID MULTI BROWSER
function getElement(id) {
	return document.getElementById ? document.getElementById(id) : document.all ? document.all(id) : null; 
}

// GET X COORDINATE
function getRealLeft(id) { 
	var el = getElement(id);
	if (el) { 
		xPos = el.offsetLeft;
		tempEl = el.offsetParent;
		while (tempEl != null) {
			xPos += tempEl.offsetLeft;
			tempEl = tempEl.offsetParent;
		} 
		return xPos;
	} 
} 

// GET Y COORDINATE
function getRealTop(id) {
	var el = getElement(id);
	if (el) { 
		yPos = el.offsetTop;
		tempEl = el.offsetParent;
		while (tempEl != null) {
			yPos += tempEl.offsetTop;
			tempEl = tempEl.offsetParent;
		}
		return yPos;
	}
}

// MOVE OBJECT TO COORDINATE
function moveObjectTo(objectID,x,y) {
	var el = getElement(objectID);
	el.style.left = x;
	el.style.top = y;
}

// MOVE SUBMENU TO CORRESPONDING BUTTON
function showSubMenu(subID, buttonID) {
	hideAllSubMenus();
	butX = getRealLeft(buttonID);
	butY = getRealTop(buttonID);
	moveObjectTo(subID,butX+xSubOffset, butY+ySubOffset);
}

// HIDE ALL SUB MENUS
function hideAllSubMenus() {
	for ( x=0; x<totalButtons; x++) {
		moveObjectTo("submenu" + (x+1) + "",-500, -500 );
	}
}

// HIDE ONE SUB MENU
function hideSubMenu(subID) {
	if ( overSub == false ) {
		moveObjectTo(subID,-500, -500);
	}
}



//preload();

