//<![CDATA[ <!--
/*
 * NASM JavaScript File for HTMLHelp
 * Version 0.0.01 2006/08/16 (Wednesday)
 * Version 0.0.02a 2007/05/23
 *	started adding array of instructions (see inst.js).
 */

/*
 * doShow(iNum) used inside NASM_TOC.htm
 */
function doShow(iNum) {
 var oPara = document.getElementById("oPara" + iNum);
 var oImg = document.getElementById("oAr" + iNum);
 var oButton = document.getElementById("ShowNone");
 oButton.disabled = false;
 oButton = document.getElementById("ShowAll");
 oButton.disabled = false;
 
 // expand paragraph and rotate the arrow; collapse and rotate it back
 // alert("oPara.style.display = " + oPara.style.display + " " + oImg.style.display);
 if (oPara.style.display == "none") { oPara.style.display=""; oImg.src="images/arrowdn.gif"; }
 else { oPara.style.display = "none"; oImg.src = "images/arrowrt.gif"; }
}

/*
 * Added: 2007.06.26 (Tuesday)
 * Opens all the items in NASM_TOC.htm
 */
function doShowAll(iCount) {
	var oPara;
	var oImg;
	var oButton = document.getElementById("ShowAll");
	oButton.disabled = true;
	oButton = document.getElementById("ShowNone");
	oButton.disabled = false;
	
	for (var i=1; i<=iCount; i++) {
		oPara = document.getElementById("oPara" + i);
		oImg = document.getElementById("oAr" + i);
		oPara.style.display="";
		oImg.src="images/arrowdn.gif";
	}
}

/*
 * Added: 2007.06.26 (Tuesday)
 * Collapses all the items in NASM_TOC.htm
 */
function doShowNone(iCount) {
	var oPara;
	var oImg;
	var oButton = document.getElementById("ShowAll");
	oButton.disabled = false;
	oButton = document.getElementById("ShowNone");
	oButton.disabled = true;
	
	for (var i=1; i<=iCount; i++) {
		oPara = document.getElementById("oPara" + i);
		oImg = document.getElementById("oAr" + i);
		oPara.style.display="none";
		oImg.src="images/arrowrt.gif";
	}
}

/*
 * FormatURLString() used by OpenThisLink().
 */

// gsURL = "";
// function OpenThisLink(sURL) { gsURL = sURL;FormatURLString(); }
// function FormatURLString() { return("," + gsURL + ","); }
function FormatURLString(sURL) { return(","+sURL+","); }

/*
 * function OpenThisLink(sURL) { window.open(FormatURLString(sURL)); }
 * function OpenThisLink(sURL) { window.open(sURL); }
 *
 * Used inside:
 * nasmdo01.htm
 *
 * PURPOSE:
 *
 */
function OpenThisLink(sURL, sName) {
	var NewObject = new Object();
	NewObject.type = "application/x-oleobject";
	// NewObject.classid = "clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11";
	NewObject.classid = "adb880a6-d8ff-11cf-9377-00aa003b7a11";
	NewObject.Command = "ShortCut";
	// "http://sourceforge.net/projects/nasm/"
	NewObject.name = "hhctrl_" + sName;
	// NewObject.id = "hhctrl_" + sName;
	NewObject.Item1 = FormatURLString(sURL);
	// eval(NewObject);
	// NewObject.Click();
	NewObject.hhclick();
	// 'javascript:OpenThisLink("http://sourceforge.net/projects/nasm/", "nasm");hhctrl_nasm.Click();'
}

/*
 * Added: 2007.07.25 ( Wednesday )
 * function IsACHM() returns true if the source is a compiled help metafile.
 */
function IsACHM() {
	if (location.href.search("::") == -1) {
		return(false);
	} else {
		return(true);
	}
}

/*
 * IsAnchor(sURI)
 * RETURNS: True if a # pound-symbol designating an anchor.
 * PARAMETERS: Pass in a URI to check.
 */
function IsAnchored(sURI) {
 if (location.href.search("#") == -1) {
	return(false);
 } else {
	return(true);
 }
}

function MyName() {
	return(location.href);
}

function ThisURI() {
	return(document.URL);
}

function getchmfile(){
	document.chmfile = new Object();
	document.chmfile.fullname = "";
	document.chmfile.name = "";
	document.chmfile.path = "";
	document.chmfile.page = "";
	
	var ra, sl, a, X, Y, Z;
	ra = /:/;
	a = location.href.search(ra);
	sl = "::";
	Y = location.href.lastIndexOf(sl);
	if (a == 4) {	// file: or http: 
		Y = location.href.lastIndexOf("/");
		chmfile.page = unescape(location.href.substring(Y+1));
		if(location.href.substring(0,4) == "file"){
		   chmfile.path = unescape(location.href.substring(8, Y+1));
		}
	}
	else	{
		if (a == 2) X = 14;	// mk:@MSITStore: 
		if (a == 7) X = 7;	// ms-its: 
		chmfile.fullname = unescape(location.href.substring(X, Y));
		Z = chmfile.fullname.lastIndexOf("\\");
		chmfile.path = unescape(chmfile.fullname.substring(0, Z+1));
		chmfile.name = unescape(chmfile.fullname.substring(Z+1));
		chmfile.page = unescape(location.href.substring(Y+3));
	}

	// alert(location.href+"\n\n"+"fullname="+chmfile.fullname+"\n"+"path="+chmfile.path+"\n"+"name="+chmfile.name+"\n"+"page="+chmfile.page);
	return(chmfile);
}

/*
 * PURPOSE: Determine if running inside javascript or a web-browser and then
 *	display the appropriate link.
 * PARAMETERS:
 *	sURL = "http://www.microcosmotalk.com/ or other link"
 *	sName = "hhctrl_microcosmotalk"
 *	sLinkID = "MicroCosmoTalk"
 */
function ShowThisLink(sURL, sName, sLinkID) {
	/*
	 * (1)	<a href="javascript:hhctrl_microcosmotalk.Click();">MicroCosmoTalk</a>
	 *	http://www.microcosmotalk.com/
	 * (2)	<a href="http://www.microcosmotalk.com/">MicroCosmoTalk</a>
	 *	
	 *	
	 */
	if (IsACHM()) {
		document.write("<object name=\"hhctrl_" + sName + "\" type=\"application/x-oleobject\" classid=\"clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11\"><param name=\"Command\" value=\"ShortCut\" /><param name=\"Item1\" value=\"," + sURL + ",\" /></object>\"\n");
	} else {
		document.write("<a href=\"" + sURL + "\">" + sLinkID + "</a>");
	}
}

//]] -->
