//
// Javascript Nav Bar
//////////////////////////////////////////
// Globals
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.netins.com':
	thisFirstLoadTgt = 'business';
	break;

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

    case 'support.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':
		//marked out the following to test new NavBar with Web Development now listed in subnam
   	    //thisSRC    = "/shared_data/images/newNav/navbar_business.gif";
	    //thisUSEMAP = "#busMap";
		thisSRC    = "/shared_data/images/newNav/navbar_business2.gif";
	    thisUSEMAP = "#busMap";
	    break;

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

	case 'hosting':
	    thisSRC    = "/shared_data/images/newNav/navbar_hosting3.gif";
	    //thisSRC    = "/shared_data/images/newNav/navbar_hosting05.gif";
	    thisUSEMAP = "#hostingMap";
	    break;

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

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

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

function openContactWindow () {
	var newwin=window.open('http://www.netins.net/contact_eSupport.htm', 'contactWindow','width=600,height=300,resizable=no,scrollbars=no');
	return false;
}
// bookmark function used on eSupport/index.htm
function bookmark(url, description){
	netscape="Netscape Users hit CTRL+D to add a bookmark.";
		if (navigator.appName=='Microsoft Internet Explorer'){
			window.external.AddFavorite(url, description);
			}
		else if (navigator.appName=='Netscape'){
			alert(netscape);
			}
}
