/*** SET BUTTON'S FOLDER HERE ***/
var buttonFolder = "buttons/";

/*** SET BUTTONS' FILENAMES HERE ***/
upSources = new Array("button1up.png","button2up.png","button3up.png","button4up.png","button5up.png","button6up.png","button7up.png","button8up.png","button9up.png","button10up.png");

overSources = new Array("button1over.png","button2over.png","button3over.png","button4over.png","button5over.png","button6over.png","button7over.png","button8over.png","button9over.png","button10over.png");

// 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();


//*** SET SUB MENUS TEXT LINKS AND TARGETS HERE ***//
subInfo[1][1] = new Array("Home","index.html","");
subInfo[1][2] = new Array("Mission","mission.html","");
subInfo[1][3] = new Array("About the Owner","about.html","");
subInfo[1][4] = new Array("Contact","contact.html","");
subInfo[1][5] = new Array("Disclaimer","disclaimer.html","");
subInfo[1][6] = new Array("Testimonial's","testimonial.html","");

subInfo[2][1] = new Array("Mission","mission.html","");
subInfo[2][2] = new Array("About the Owner","about.html","");

subInfo[3][1] = new Array("File Servers","fileserver.html","");
subInfo[3][2] = new Array("Personal Computers","pc.html","");
subInfo[3][3] = new Array("Work Stations","workstations.html","");
subInfo[3][4] = new Array("Backup Drives","drives.html","");
subInfo[3][5] = new Array("Network Storage","nas.html","");
subInfo[3][6] = new Array("Avg Anti-Virus","sample/avg.pdf","");
subInfo[3][7] = new Array("ShodowProtect &#174;","shadowprotect.html","");
subInfo[3][8] = new Array("Battery Backup","http://www.apcc.com/tools/ups_selector/pso/rslr/index.cfm?ISOCountryCode=US","new");
subInfo[3][9] = new Array("Surge protection","http://www.apcc.com/tools/surge_selector/surge_selector_rslr/index.cfm?ISOCountryCode=US","new");
subInfo[3][10] = new Array("Hot-Spot Hazards","https://sales.hotspotvpn.com/info.asp?rid=semcclure98&pid=2&tc=1","new");
subInfo[3][11] = new Array("VMware","vmware.html","new");

subInfo[4][1] = new Array("Our Services","services.html","");
subInfo[4][2] = new Array("NetWork Security","gfi.html","");
subInfo[4][3] = new Array("Mangaged Services","managed.html","");
subInfo[4][4] = new Array("NetWork Setup & Administration","network.html","");

subInfo[5][1] = new Array("Mangaged Services","managed.html","");
subInfo[5][2] = new Array("NetWork Monitoring","monitor.html","");
subInfo[5][3] = new Array("24/7 Instant Support","24-7.pdf","new");
subInfo[5][4] = new Array("Daily Health Checks","daily_health_checks.pdf","new");
subInfo[5][5] = new Array("Client Portal","ClientPortal.pdf","new");


subInfo[6][1] = new Array("Simple Networking","network.html","");
subInfo[6][2] = new Array("Simple Hardware Fixes","hw.html","");

subInfo[7][1] = new Array("Hard Drive Failure Rates","http://www.pcworld.com/article/129558/study_hard_drive_failure_rates_much_higher_than_makers_estimate.html","new");
subInfo[7][2] = new Array("PC Failure Rates","http://www.crn.com/it-channel/189601855","new");
subInfo[7][3] = new Array("Microsoft doles out two patches for four flaws","http://www.scmagazineus.com/Microsoft-doles-out-two-patches-for-four-flaws/article/120840/","new");
subInfo[7][4] = new Array("Study: Spamer profits could dwindle","http://www.scmagazineus.com/Study-Spammer-profits-could-dwindle/article/120750/","new");
subInfo[7][5] = new Array("Five Simple Steps","book_order.html","new");
subInfo[7][6] = new Array("A Small Business Approach To Computer Downtime","http://www.user-groups.net/articles/computer_downtime.html","new");
subInfo[7][7] = new Array("26 Tips to Keep Your Computer Up and Functioning","http://www.lifehack.org/articles/lifehack/26-tips-to-keep-your-computer-up-and-functioning.html","new");
subInfo[7][8] = new Array("Identity Theft and Spyware","http://www.spywareguide.com/articles/article_show.php?id=19","new");
subInfo[7][9] = new Array("France passes new law against Internet piracy","http://www.geekwithlaptop.com/france-passes-new-law-against-internet-piracy#comment-66638","new");
subInfo[7][10] = new Array("Ex-charity worker charged with computer crime","http://www.seattlepi.com/local/412644_computer25.html","new");
subInfo[7][11] = new Array("The Top Cyber Security Risks","http://www.sans.org/top-cyber-security-risks/","new");
subInfo[7][12] = new Array("Authorities bust 3 in infection of 13M computers","http://news.yahoo.com/s/ap/20100302/ap_on_hi_te/us_tec_botnet_busted","new");

subInfo[8][1] = new Array("Contact","contact.html","");
subInfo[8][2] = new Array("Help","help.html","");

subInfo[9][1] = new Array("Contact","contact.html","");
//subInfo[9][2] = new Array("Sub-Button 2","Sub-Link 2","");

subInfo[10][1] = new Array("Untangle Info (PDF)","untangle_pdf_order.html","");
subInfo[10][2] = new Array("Book Order","book_order.html","");


//*** SET SUB MENU POSITION ( RELATIVE TO BUTTON ) ***//
var xSubOffset = 117;
var ySubOffset = 5;



//*** 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();

