// +-------------------------------------------------------------+
// | FILENAME:          vsphelp1.js                              |
// | DESCRIPTION:       Main JavaScript library file for VSPHelp |
// |                    Called by all help topics.               |
// |                                                             |
// | TRANSLATION TASKS: None                                     |
// |                                                             |
// | Copyright 2004 Sun Microsystems Inc. All Rights Reserved    |
// +-------------------------------------------------------------+

//////////////////////////////////
// Declare Global Variables /////////////////////////////
// Do not translate         /////////////////////////////
//////////////////////////////////
var topic_title = document.title
var HelpFilenamePrefix = "h_"
var HelpFilenameExtension = ".htm"
var isNav4, isNav6, isIE4;
var_productname = "Sun[tm] Advanced Lights Out Manager"
var_productnameShort = "ALOM"
var_productrelease = "1.5"
var_helprelease = "1.5"
var_browsername = navigator.appName
var_browserversion = navigator.appVersion
var_clientOS = navigator.platform
var_userlanguage = navigator.userLanguage
var_testonline = navigator.onLine
var_currentfilename = DocFileNameExtract()
var_javaenabled = navigator.javaEnabled()


//////////////////////////////
// Help Functions         /////////////////////////////
//////////////////////////////

// Builds and displays information about the current
// help topic and the current session. 
function infoBox()
{
var cr = "\n"
var ind = " - "
var hr = "-------------------------------------"
l1 = var_label_topicinformation
l2 = var_label_productname + " = " + var_productname
l3 = var_label_productrelease + " = " + var_productrelease
l4 = var_label_currentlanguage + " = " + var_currentlanguage
l5 = var_label_currentfilename + " = " + var_currentfilename
//l6 = var_label_currentlanguage + " = " + var_currentlanguage
l7 = var_label_helprelease + " = " + var_helprelease
l8 = var_label_sessioninformation
l9 = var_label_browsername + " = " + var_browsername
l10 = var_label_browserversion + " = " + var_browserversion
l11 = var_label_clientOS + " = " + var_clientOS
l12 = var_label_userlanguage + " = " + var_userlanguage
l13 = var_label_testonline + " = " + var_testonline
l14 = var_label_javaenabled + " = " + var_javaenabled
l15 = var_label_daycode + " = " + daycode
l16 = var_label_partnumber + " = " + var_partnumber

alert(cr+cr+cr+cr+l1+cr+hr+cr+ind+l2+cr+ind+l3+cr+ind+l7+cr+ind+l4+cr+ind+l5+cr+ind+l16+cr+ind+l15+cr+cr+l8+cr+hr+cr+ind+l9+cr+ind+l10+cr+ind+l11+cr+ind+l12+cr+ind+l13+cr+ind+l14)

//alert(cr+cr+cr+cr+l1+cr+hr+cr+ind+l2+cr+ind+l3+cr+ind+l4+cr+ind+l5+cr+ind+l6+cr+ind+l7+cr+cr+l8+cr+hr+cr+ind+l9+cr+ind+l10+cr+ind+l11+cr+ind+l12+cr+ind+l13+cr+ind+l14)

//alert(cr+cr+cr+cr+l1+cr+hr+cr+ind+l2+cr+ind+l3+cr+ind+l4+cr+ind+l5+cr+ind+l6+cr+ind+l7+cr+ind+l15+cr+cr+l8+cr+hr+cr+ind+l9+cr+ind+l10+cr+ind+l11+cr+ind+l12+cr+ind+l13+cr+ind+l14)
}


// Inserts text as a footer.
function insertFooter ()
{
//	FooterFilename = DocFileNameExtract()
	document.write('<HR><CENTER>');
	document.write('<a href="../shared/h_help_copyright.htm">Copyright</a> 2004 Sun Microsystems, Inc. All Rights Reserved.<BR>');
//	document.write(FooterFilename);
	document.write('</CENTER><HR>');
}

// Inserts the value of a JavaScript variable at the 
// location of the calling script.
// In the HTML file, the calling script takes the form:
//    <script language="JavaScript">
//       insertVariable(var_name)
//    </script>
function insertVariable (variablename)
{
	variable2insert = variablename
	document.write(variable2insert);
}

// Interrogates the browser displaying Help to determine
// browser type and version. 
function setBrowser()
{
    if (navigator.appVersion.charAt(0) == "4")
    {
        if (navigator.appName.indexOf("Explorer") >= 0)
        {
            isIE4 = true;
        }
        else
        {
            isNav4 = true;
        }
    }
    else if (navigator.appVersion.charAt(0) > "4")
    {
        isNav6 = true;
    }
}

// Writes the first part of the "Related information"
// code at the bottom of each topic. If you are
// running Netscape4, it writes plain text. Otherwise
// it writes all the code to manage the expand/collapse
// section.
function DoSeeAlsoHead()
{
setBrowser();
	if (isNav4)
		{

		document.writeln(SeeAlsoString);
		}
		
	else
		{
		document.write(SeeAlsoString);
		document.write('<span id="MoreInfo2" class="short">');
		document.write('<a href="javascript:swapDiv(2, true)">');
		document.write('<img alt="more" src="../shared/icon_greenarrow_down.gif" border="0" width="12" height="12">');
		document.write('</a>');
		document.write('</span>');

		document.write('<span id="LessInfo2" class="long">');
		document.write('<a href="javascript:swapDiv(2,false)">');
		document.write('<img src="../shared/icon_greenarrow_up.gif" alt="less" border="0" width="12" height="12">');
		document.write('</a>');
		}

}

// Writes the closing part of the "Related information"
// section at the bottom of each topic.
function DoSeeAlsoTail()
{
	setBrowser();
	if (isNav4)
		{

//		document.writeln("Nav4");
//		document.writeln(SeeAlsoString);
		}
		
	else
		{
		document.write('</span>');
//		document.write('NotNav4');
		}
}

// Displays or hides the "Related information"
// text at the bottom of each topic by setting
// "value" to visible or invisible.
function setIdProperty( id, property, value )
{
    if (isNav6)
    {
        var styleObject = document.getElementById( id );
        if (styleObject != null)
        {
            styleObject = styleObject.style;
            styleObject[ property ] = value;
        }
    }
    else if (isNav4)
    {
        document[id][property] = value;
    }
    else if (isIE4)
    {
         document.all[id].style[property] = value;
    }
}

// Manages the actual show-or-hide behavior
// in the "Related information" section of each topic
// by setting the display property of the section to
// either "none" or "block". The background color of
// the section is set in the .css file.
function swapDiv( divNum, expanding )
{
    if (expanding)
    {
        setIdProperty("MoreInfo" + divNum, "display", "none");
//        setIdProperty("LessInfo" + divNum, "display", "inline");
        setIdProperty("LessInfo" + divNum, "display", "block");


    }
    else
    {
        setIdProperty("LessInfo" + divNum, "display", "none");
//        setIdProperty("MoreInfo" + divNum, "display", "inline");
        setIdProperty("MoreInfo" + divNum, "display", "block");

    }
}

// Displays an HTML file in a new browser window
function openWindow(url, name, rs, w, h) {
  var resize = "";
  if (rs) {
    resize = "resizable,";
  }
  popupWin = window.open(url, name, 'scrollbars,' + resize + 'width=' + w + ',height=' + h);
// window.name='opener'
}

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Inserts the framework bar at the beginning of each help topic.
// Buttons can be added or deleted from the NavBar by commenting
// them out or in.
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function createFramework() 
{ 
//document.write('<BR>');
document.write('<table height="50" width="600" bgcolor="#ddddff">');
document.write('	<tr>');
		
document.write('		<td width="250">');
document.write('&nbsp;		<a href="javascript:Navigator()">');
document.write('		<img src="../shared/icon_toc01.gif" BORDER=0 ALT="');
document.write(var_TOCAlt);
document.write('">');
document.write('</a>');
document.write('		&nbsp;');
//document.write('		<a href="javascript:index()">');
//document.write('		<img src="../shared/icon_index02.gif" BORDER=0 ALT="Index">');
//document.write('</a>');
//document.write('		&nbsp;');


if (KWOnly == 0) {
	document.write('		<a href="javascript:FullTextSearch()">');
			}
	else
			{
	document.write('		<a href="javascript:KWSearch()">');
			}

document.write('		<img src="../shared/icon_search.gif" BORDER=0 ALT="');
document.write(var_SearchAlt);
document.write('">');
document.write('</a>');
document.write('		&nbsp;');
document.write('		<a href="javascript:getFeedback()">');
document.write('		<img src="../shared/icon_feedback.gif" BORDER=0 ALT="');
document.write(var_FeedbackAlt);
document.write('">');
document.write('</a>');
document.write('		&nbsp;');
document.write('		<a href="javascript:infoBox()">');
document.write('		<img src="../shared/icon_nav_info.gif" BORDER=0 ALT="');
document.write(var_InfoAlt);
document.write('">');
document.write('</a>');
document.write('		</td>');
document.write('		<td width="350">');
document.write('		<B>');
document.write(topic_title);
document.write('		</B>');
document.write('		</td>');
document.write('	</tr>');
document.write('</table>');
}

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Launches a graphical tOC in a seprate browser window.
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function Navigator()
{
openWindow('../app_TOC.htm','winTOC', 'rs', '300', '400')
}

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Launches a browser window containing a full-text search Java applet.
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function FullTextSearch()
{
	openWindow("../app_FullTextSearch.htm", "VSPSearchManager", "yes", 500, 400)
}

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Launches a browser window containing a keyword search application.
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function KWSearch()
{
	openWindow("../app_KWSearch.htm", "VSPKWSearchManager", "yes", 500, 400)
}


//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Launches a browser window with feedback information.
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function getFeedback()
{
feedbackPage = DocFileNameExtract()
formString1 = "../app_FeedbackForm.htm?"+var_productnameShort+":"+var_productrelease+":"+feedbackPage

	openWindow(formString1, 'FeedbackForm', 'yes', 400, 400)

}

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Launches a browser window with instructions about email feedback.
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function getFeedbackEmail()
{
feedbackPage = DocFileNameExtract()
formString1 = "../app_FeedbackFormEmail.htm?"+var_productnameShort+":"+var_productrelease+":"+feedbackPage

	openWindow(formString1, 'FeedbackForm', 'yes', 400, 400)

}

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Extracts the name of the current help file name from the
// complete URL. 
// RETURNS: The current file name minus path.
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function DocFileNameExtract()
{
   wholeurl = window.location.href;
   x = wholeurl.length;
   while((wholeurl.substring(x,x-1)) != "/"){ x--; } clipstart = x;
   return wholeurl.substring(wholeurl.length,clipstart);
}

