// Rollover script & more
// 10/03/2002 - James DiEdwardo - for the Glory of God
// Test for occurence of strings in location href to determine what button to display in it's 'over' state

// This variable indicates which button to have in it's 'over' state - 0 means no buttons lit
var navnum = 1;
var subnavnum = 1;

// This variable indicates how many nav items there are
var itemnum = 7;
var subitemnum = 6;

// In case a query string was passed, save it
var qstring = self.location.search.substring(1,self.location.search.length);

// The string we're testing is the location href
var targetstr = new String(self.location);

// This array holds all the strings we'll be testing for - for main nav
var lookfor = new Array();
	lookfor[1] = /home.htm/;
	lookfor[2] = /services/;
	lookfor[3] = /portfolio.htm/;
	lookfor[4] = /ds/;
	lookfor[5] = /supplies.htm/;
	lookfor[6] = /support.htm/;
	lookfor[7] = /contact.htm/;

// This array holds all the strings we'll be testing for - for subnav
var lookforsub = new Array();
	lookforsub[1] = /ds.htm/;
	lookforsub[2] = /dsvoice/;
	lookforsub[3] = /order/;
	lookforsub[4] = /faqs/;
	lookforsub[5] = /contest/;
	lookforsub[6] = /demos/;

// This determines which string is present in the location href for main nav
for (i=1; i<=itemnum; i++)
	{
	var strcheck = targetstr.search(lookfor[i]);
	if (strcheck != -1)
		{
		navnum = i;
		break;
		}
	}

// This determines which string is present in the location href for subnav
for (i=1; i<=subitemnum; i++)
	{
	var strcheck = targetstr.search(lookforsub[i]);
	if (strcheck != -1)
		{
		subnavnum = i;
		break;
		}
	}

// If a query string was passed, use that instead to force a menu item to be lit
//if (qstring !="")
//	{
//	var navstr = new String(qstring);
//	navnum = navstr.substring(1,navstr.length)
//	}
//
// Rollover code ------------------------------------------------------------------------
//
// The filepath to the images -  don't forget to include a forward slash at the end
var path = "graphics/";

// Initialize images - for main nav
var nav_out = new Array();
var nav_over = new Array();
	for (i=1; i<=itemnum; i++)
		{
		nav_out[i] = new Image();
		nav_out[i].src = path + "menu" + i + "_out" + ".gif";
		nav_over[i] = new Image();
		nav_over[i].src = path + "menu" + i + "_over" + ".gif";
		}

// Initialize images - for subnav
var subnav_out = new Array();
var subnav_over = new Array();
	for (i=1; i<=subitemnum; i++)
		{
		subnav_out[i] = new Image();
		subnav_out[i].src = path + "subnav" + i + "_out" + ".gif";
		subnav_over[i] = new Image();
		subnav_over[i].src = path + "subnav" + i + "_over" + ".gif";
		}

// MouseOver - for main nav
function imgOn(imgNum)
	{
	// If this button is not lit
	if (("nav"+navnum)!=("nav"+imgNum))
		{
		document["menu"+imgNum].src = nav_over[imgNum].src;
		}
	}
            
// MouseOut - for main nav
function imgOut(imgNum)
	{
	// If this button is not lit
	if (("nav"+navnum)!=("nav"+imgNum))
		{
		document["menu"+imgNum].src = nav_out[imgNum].src;
		}
	}


// MouseOver - for subnav
function imgOnsub(imgNum)
	{
	// If this button is not lit
	if (("subnav"+subnavnum)!=("subnav"+imgNum))
		{
		document["subnav"+imgNum].src = subnav_over[imgNum].src;
		}
	}
            
// MouseOut - for subnav
function imgOutsub(imgNum)
	{
	// If this button is not lit
	if (("subnav"+subnavnum)!=("subnav"+imgNum))
		{
		document["subnav"+imgNum].src = subnav_out[imgNum].src;
		}
	}
//
// IE Bookmarker
var bookmarkurl="http://www.granitedigitalimaging.com/supplies.htm"
var bookmarktitle="Granite Digital Imaging - CD-ROM Supplies"

function addbookmark()
	{
	if (document.all)
	window.external.AddFavorite(bookmarkurl,bookmarktitle)
	}

// CDROM2GO hyperlink handler
function supplylink(pagelink)
	{
	// Save the link
	savedlink = pagelink;

	// First send them to the affliate link
	cdromwin = window.open("http://coldfusion.affiliateshop.com/AIDLink.cfm?AID=024821&BID=280");

	// Wait a second, then send them to the disired page
	setTimeout("gonow()", 3000);
	}

function gonow()
	{
	cdromwin.location.href = savedlink;
	}
//
// Handles popup windows
function popwin(url) {
	window.open(url,"popwin","menubar=no,status=no,toolbar=no,location=top,scrollbars=no,resizable=no,fullscreen=yes") ;
	}

// Opens Voice sample window
function voiceSamples()
	{
	window.open("voices.htm","popwin","width=650, height=30, menubar=no,status=no,toolbar=no,location=top,scrollbars=no,resizable=no") ;
	}

// Launch demo reel
function demoReel() {
	window.open("demoreel.htm","popwin","menubar=no,status=no,toolbar=no,location=top,scrollbars=no,resizable=no,width=340,height=260") ;
	}






