//
// Javascript Nav Bar
//////////////////////////////////////////
// Globals
//Declare variables --bjr 08-17-04

var thisBrowser      = "";
var thisSRC          = "";
var thisUSEMAP       = "";
var thisFirstLoadTgt = "";

if (navigator.appName == "Netscape") 
	{
		if( navigator.userAgent.indexOf( "Mozilla/4" ) != -1 )
		{
		thisBrowser = "Netscape4";
		}
		else
		{
		thisBrowser = "Netscape6or7";
		}
	}
else if( navigator.appName == "Opera" )
	{
		thisBrowser = "Opera";
	}
else
	{
		if( navigator.userAgent.indexOf( "MSIE 4.5" ) != -1 )
		{
			thisBrowser = "Mac IE 4.5";
		}
		else
		{
			thisBrowser = "IE";
		}
	}

// Magically figure out what page to start with
switch( location.hostname )
{
    case 'netins.com':
    case 'www.demo.netins.com':
	thisFirstLoadTgt = 'business';
	break;

    case 'webhosting.demo.netins.net':
	thisFirstLoadTgt = 'hosting';
	break;

    case 'support.demo.netins.net':
	thisFirstLoadTgt = 'support';
	break;

    // The default is www.netins.net since it's the only one
    // with multiple entry points in the same domain name
    default:
	var pathParts = location.pathname.split( "/" );
	switch( pathParts[1] )
	{
	    case 'contact.htm':
		thisFirstLoadTgt = 'contact';
		break;

	    case 'residential':
	    case 'dialup':
	    case 'dsl':
	    case 'travel':
	    case 'email':
		thisFirstLoadTgt = 'residential';
		break;

	    default:
		thisFirstLoadTgt = 'main';
		break;
	}
	break;
}

function doRollover( tgtName )
{
    setTargets( tgtName );

    if( thisBrowser == "Netscape6or7" )
    {
	var xref = document.getElementById( 'theImage' );
	xref.setAttribute( 'SRC', thisSRC );
	xref.setAttribute( 'USEMAP', thisUSEMAP );
    }

    if( (thisBrowser == "IE") ||
	(thisBrowser == "Opera") )
    {
	var xref    = document.getElementById( 'theImage' );
	xref.src    = thisSRC;
	xref.useMap = thisUSEMAP;
    }

    if( thisBrowser == "Mac IE 4.5" )
    {
        document.images["theImage"].src    = thisSRC;
        document.images["theImage"].useMap = thisUSEMAP;
    }

    if( thisBrowser == "Netscape4" )
    {
// This will change the image, but there is no way to change the map
// without using layers.  Yes, Netscape4 sucks... a lot.
//	document.images["theImage"].src = thisSRC;
    }	
}

function setTargets( tgtName )
{
    // This could be made easier if the src image name and map to
    // to use all contained the tgtName coming in.  Then, all we'd
    // have to do is say:
    // thisSRC    = eval( 'images/newNav/navBar_' + tgtName + '.gif' );
    // thisUSEMAP = eval( '#' + tgtName + 'Map' );
    switch( tgtName )
    {
	case 'business':
		thisSRC    = "/common/images/newNav/navbar_business2.gif";
	    thisUSEMAP = "#busMap";
	    break;

	case 'residential':
	    thisSRC    = "/common/images/newNav/navbar_residential2.gif";
	    thisUSEMAP = "#resMap";
	    break;

	case 'hosting':
	    thisSRC    = "/common/images/newNav/navbar_hosting2.gif";
	    thisUSEMAP = "#hostingMap";
	    break;

	case 'support':
	    thisSRC    = "/common/images/newNav/navbar_support.gif";
	    thisUSEMAP = "#supportMap";
	    break;

	case 'contact':
	    thisSRC    = "/common/images/newNav/navbar_contact.gif";
	    thisUSEMAP = "#contactMap";
	    break;

	default:
	    thisSRC    = "/common/images/newNav/navbar_main.gif";
	    thisUSEMAP = "#mainMap";
	    break;
    }
}

function openContactWindow () {
	var newwin=window.open('http://www.demo.netins.net/contact_eSupport.htm', 'contactWindow','width=600,height=300,resizable=no,scrollbars=no');
	return false;
}
