﻿// Array of testimonials
var testim = new Array(
"I've made several attempts at setting up my HD TV and it always turned out less than perfect.&nbsp;&nbsp; You guys came in and made it work better than ever -- plus made it so my wife and kids could easily use it!&nbsp;&nbsp; Thanks guys.",
"With your help, we were able to cut the operating costs of our business by 60 percent in the last 4 months.&nbsp;&nbsp; That was without losing any functionality AND all of our data is <i>much</i> more safe.&nbsp;&nbsp; Voodoo Techs rocks!",
"With our new Wi-Fi setup, I can walk all around the house and not skip a beat.&nbsp;&nbsp; It's like I thought it was going to be but wasn't when I first setup our home network.&nbsp;&nbsp; Now I get full bandwidth everywhere!",
"Where were you guys 2 years ago?&nbsp;&nbsp; I've been pulling my hair out on my media system for longer than I care to remember but I can finally USE it now.&nbsp;&nbsp; My family loves it.&nbsp;&nbsp; Now for the Man Cave...");

// Array of person names for testimonials
var testimName = new Array(
"Paul K, Seattle WA",
"Allison P, Mountlake Terrace WA",
"Terry G, Bellevue WA",
"Thomas J, Kirkland WA");

// array of "normal state" images
var normalImages = new Array('images/button_home_off.gif', 'images/button_smallbusiness_off.gif', 'images/button_hometechnologies_off.gif', 'images/button_rss_off.gif', 'images/button_aboutus_off.gif', 'images/button_contact_off.gif');

// array of "hover state" images
var hoverImages = new Array('images/button_home_roll.gif', 'images/button_smallbusiness_roll.gif', 'images/button_hometechnologies_roll.gif', 'images/button_rss_roll.gif', 'images/button_aboutus_roll.gif', 'images/button_contact_roll.gif');

// array of "click state" images
var clickImages = new Array('images/button_home_on.gif', 'images/button_smallbusiness_on.gif', 'images/button_hometechnologies_on.gif', 'images/button_rss_on.gif', 'images/button_aboutus_on.gif', 'images/button_contact_on.gif');

// Ad rotation counters and limits.
var iCurrAd=1;
var iMaxAd=4;

// Testimonial counters and limits.
var iCurrTest=1;
var iMaxTest=4;

// this function is called on page load
// it preloads all the hover and click images
// for faster swap response time
function preloadImages() 
{
	var i=0;

	objImage = new Image();

	for	(i=1; i<=hoverImages.length; i++)
	{
		objImage.src = hoverImages[i];
	}

	for	(i=1; i<=clickImages.length; i++)
	{
		objImage.src = clickImages[i];
	}
}

// this function resets all the images to their "normal" state 
// used when clicking on an image, to reset all images 
function resetAll()
{
	for	(i=1; i<=normalImages.length; i++)
	{
		obj = eval('document.image' + i);
		obj.src = normalImages[i-1];
	}
}

// used on mouseover
// swap the named image into "hover" state
// but only if it is not already in "click" state
function setHover(num)
{
	obj = eval('document.image' + num);
	str = obj.src;

	if (str.search(clickImages[num-1]) == -1)
	{
		obj.src = hoverImages[num-1];
	}
}

// swap the named image into "click" state
// previously clicked images must go back to "normal" state first
function setClick(num) 
{
	resetAll();
	obj = eval('document.image' + num);
	obj.src = clickImages[num-1];
}

// used on mouseout
// swap the named image into "normal" state
// but only if it is not already in "click" state
function setNormal(num)
{
	obj = eval('document.image' + num);

	if (str.search(clickImages[num-1]) == -1)
	{
		obj.src = normalImages[num-1];
	}
}

// Ad and testimonial rotating routine
function rotateElems()
{
	iCurrAd++;
	if (iCurrAd > iMaxAd) iCurrAd = 1;

	// Ad image filenames need to be named like: AdImg??.jpg
	document.adImg.src = "images/AdImg" + iCurrAd + ".png";

	iCurrTest++;
	if (iCurrTest > iMaxTest) iCurrTest = 1;

	document.getElementById('testimonial').innerHTML = testim[iCurrTest-1];
	document.getElementById('testName').innerHTML = testimName[iCurrTest-1];
}
