function removeHelpMenu2(){
 var x;
 x = new ActiveXObject("esriHelp.HelpCore");
 x.MenuDelete2();
}

function browser()
{
  var ua = navigator.userAgent;

  // Is it IE?
 bMSIE = (ua.indexOf("MSIE")!= -1);
  // Is it IE5.5?
 bMSIE55 = (ua.indexOf("MSIE 5.5") != -1);
}

function ShowFeedback()  
{
  if (window.location.protocol == "http:") {
    document.write("<A href='javascript:Feedback()'>");
    document.write("<img src='/arcobjects/9.1/panebar_files/feedback2.gif' alt='Feedback'border='0' height='16' width='16'/>");
    document.write("&nbsp;Send feedback on this page</A>");
  }
}

function Feedback()  {
  if (top.fraTopic != null) {
    top.fraTopic.location = '/arcobjects/9.1/email.asp?Page=' + top.fraTopic.location;
  }  else {
  top.location = '/arcobjects/9.1/email.asp?Page=' + top.location;
  }
}

function Jump(fullPath)
{
	// First check if the window.name property is set.
	// If not, check if there is an occurrence of "VC.chm".
	// If so, then add "VC" to the window.name property.
	// Added by KG 9/17/2004
	if (window.name == "") {
		var href = window.location.href;
		if (href.indexOf("VC.chm") != -1) {
			window.name = "VC";
		}
	}

	var pathArray = fullPath.split("/");
	var folder = pathArray[0];
	var path = fullPath.substring(folder.length + 1, fullPath.length); 
	var offset = fullPath.lastIndexOf("/"); 
	if (offset != 0)
	{
	  var file = fullPath.substring(offset+ 1, fullPath.length);
	}
	else
	{
	  var file = fullPath;
	}

	switch (window.location.protocol)
	{
		// JavaDoc
		case "file:":
		{
			var pathName = window.location.pathname;
			pathName = pathName.substring(1, pathName.length);
			offset = pathName.lastIndexOf("arcgis");
			if (offset != 0)
			{
	  		  pathName = pathName.substring(0, offset) + "arcgis\\";
			}
			var temp = folder.substring(0,4);
			if (temp == "esri")
			{
				folder = folder.slice(4);
				pathName = pathName + folder + "\\" + path + "l";
				window.location = pathName;
			}

			break;
		}
		case "mk:":
		{
			var href = window.location.href;
			if  ((window.name == "VC") || (href.indexOf("VC.chm") != -1)) // Added by KG 9/17/2004
			{
				switch (folder)
				{
				  case "ArcGISDevHelp":
					folder = folder + "VC";
					break;
				  case "ArcGISEngine":
					break;
				  case "ArcGISDesktop":
					break;
				  case "ArcGISServer":
					break;
				  case "ExtendingArcObjects":
					break;
				  case "Samples":
					break;
				  default:
					folder = folder + "VC"; // Added by KG 9/17/2004
					break;
				}
			}
			window.location="ms-its:" + folder + ".chm::/" + path;

			break;
		}
		case "ms-its:":
		{
			var href = window.location.href;
			if  ((window.name == "VC") || (href.indexOf("VC.chm") != -1)) // Added by KG 9/17/2004
			{
				switch (folder)
				{
				  case "ArcGISDevHelp":
					folder = folder + "VC";
					break;
				  case "ArcGISEngine":
					break;
				  case "ArcGISDesktop":
					break;
				  case "ArcGISServer":
					break;
				  case "ExtendingArcObjects":
					break;
				  case "Samples":
					break;
				  default:
					folder = folder + "VC"; // Added by KG 9/17/2004
					break;
				}
			}
			window.location="ms-its:" + folder + ".chm::/" + path;

			break;
		}
		case "ms-help:":
		{
			var prefix;
			switch (folder)
			{
				case "ArcGISDevHelp":
					prefix = "eagcon";
					break;
				case "ArcGISEngine":
					prefix = "eagcon";
					break;
				case "ArcGISDesktop":
					prefix = "eagcon";
					break;
				case "ArcGISServer":
					prefix = "eagcon";
					break;
				case "ExtendingArcObjects":
					prefix = "eagcon";
					break;
				case "Samples":
					prefix = "eagsam";
					folder = "";
					break;
				default:
					prefix = "eaglrf";
					break;
			}


			var temp = folder.substring(0,4);
			if (temp == "esri")
			{
				folder = folder.slice(4);
			}		
			offset = file.lastIndexOf(".htm");
			file = file.substring(0, offset);
			LinkKwd(prefix + folder + file)
			break;
		}
		case "http:":
		{
			var temp = folder.substring(0,4);
			if (temp == "esri")
			{
				fullPath= "ComponentHelp/" + fullPath;
			}

			window.location="/arcobjects/9.1/" + fullPath;
			break;
		}
	
	};
}

function WriteStyleSheet()
{
	switch (window.location.protocol)
	{
		case "ms-help:":
		{
			document.write("<SCRIPT SRC='../scripts/dtuelink.js' LANGUAGE='JScript'></SCRIPT>");
			document.write("<SCRIPT SRC='../scripts/ns.js' LANGUAGE='JScript'></SCRIPT>");
			document.write("<link rel='stylesheet' href='../scripts/dtue.css' TYPE='text/css'>");
			break;
		}
		case "http:":
		{
			document.write("<SCRIPT SRC='../scripts/dtuelink.js'></SCRIPT>");
			document.write("<link rel='stylesheet' href='../scripts/dtue.css' TYPE='text/css'>");
			break;
		}
		default:
		{
			document.write("<SCRIPT SRC='dtuelink.js'></SCRIPT>");
			document.write("<link rel='stylesheet' href='dtue.css' TYPE='text/css'>");

		}
	}
}

function ToCompressedSample(fullPath)
{
  // First replace spaces in the folder name with "_"
  var re = new RegExp (' ', 'gi');
  newPath = fullPath.replace(re, '_');

  if (navigator.appVersion.indexOf("Win")!=-1) ToCompressedSampleWin(newPath);
  else if (navigator.appVersion.indexOf("X11")!=-1) ToCompressedSampleUnix(newPath);
  else if (navigator.appVersion.indexOf("Linux")!=-1) ToCompressedSampleUnix(newPath);

}

function ToCompressedSampleUnix(fullPath)
{  
  var pathArray = fullPath.split("/");
  alert('To open the samples files on Unix go to <your install location>/samples/' + pathArray[1] + '/' + pathArray[2] + '.');
}

function ToCompressedSampleWin(fullPath)
{
  var X, Y, sl, a, ra, link, templink;

  ra = /:/;
  a = location.href.search(ra);
 
  // this takes care of mk:@MSITSTORE: and ms-its:
  //    still need to deal with .NET and Java versions
  if (a == 2)
    X = 14;
  else
    X = 7;
  sl = "\\";
  Y = location.href.lastIndexOf(sl) + 1;
  link = 'file:///' + location.href.substring(X, Y) + "../../" + fullPath;

  try 
  {
    window.onError=tellerror;
    if (window.location.protocol == "ms-help:")   // .NET help
	{
       window.open("file://c:/program files/arcgis/developerkit/" + fullPath, "fileWindow", "width=400,height=200,toolbar=1,menubar=1,location=1,resizable=1,scrollbars=1" );
	}
    else if (window.location.protocol == "file:")  // Java help
	{
       link = "../../../../../" + fullPath;
	   window.open(link, "fileWindow", "width=400,height=200,toolbar=1,menubar=1,location=1,resizable=1,scrollbars=1" );
	}
    else    // CHM help (VB and VC)
      window.open(link, "fileWindow", "width=400,height=200,toolbar=1,menubar=1,location=1,resizable=1,scrollbars=1" );
  }
  catch(oException) 
  {
    alert("Broken link to zip file.\nThe most common reason for this is that you did not choose to install the samples.\nIf you are using the .NET help, these links will not work if you did not install to the default location.");
  }
}

function tellerror(msg, url, linenumber)
{
  alert('Error message= '+ msg +'\nURL= '+ url +'\nLine Number= '+ linenumber);
  return true;
}

