//---------------------------------------------------------------------------
// This script is based on the work of Dieter Bungers - http://www.infovation.de
// The original example for the "Cross Browser Expanding and Collapsing TOC"
// was published on http://www.siteexperts.com/tips/techniques/ts03/index.htm
//---------------------------------------------------------------------------

var tocTab = new Array();var ir=0;
tocTab[ir++] = new Array ("1", "Introduction", "introduction.htm", "", "cicon9.gif", "cicon9.gif");
tocTab[ir++] = new Array ("2", "Requirements", "requirements.htm", "", "cicon9.gif", "cicon9.gif");
tocTab[ir++] = new Array ("3", "What is new", "whatisnew.htm", "", "cicon9.gif", "cicon9.gif");
tocTab[ir++] = new Array ("4", "User Interface", "theuserinterface.htm", "", "cicon1.gif", "cicon2.gif");
tocTab[ir++] = new Array ("4.1", "Main Menu", "mainmenu.htm", "", "cicon9.gif", "cicon9.gif");
tocTab[ir++] = new Array ("4.2", "Keyboard shortcuts", "keyboardshortcuts.htm", "", "cicon9.gif", "cicon9.gif");
tocTab[ir++] = new Array ("4.3", "Server Navigator", "servernavigator.htm", "", "cicon9.gif", "cicon9.gif");
tocTab[ir++] = new Array ("4.4", "Tools", "tools.htm", "", "cicon9.gif", "cicon9.gif");
tocTab[ir++] = new Array ("4.5", "DB Navigator", "dbnavigator.htm", "", "cicon9.gif", "cicon9.gif");
tocTab[ir++] = new Array ("4.6", "Database object window", "databaseobjectwindow.htm", "", "cicon9.gif", "cicon9.gif");
tocTab[ir++] = new Array ("4.7", "Connect/Disconnect", "connectdisconnect.htm", "", "cicon9.gif", "cicon9.gif");
tocTab[ir++] = new Array ("4.8", "Query Window", "querywindow.htm", "", "cicon1.gif", "cicon2.gif");
tocTab[ir++] = new Array ("4.8.1", "Code Assistant", "codeassistant.htm", "", "cicon9.gif", "cicon9.gif");
tocTab[ir++] = new Array ("4.8.2", "Estimated execution plan", "estimatedexecutionplan.htm", "", "cicon9.gif", "cicon9.gif");
tocTab[ir++] = new Array ("4.9", "Data View", "dataview.htm", "", "cicon9.gif", "cicon9.gif");
tocTab[ir++] = new Array ("4.10", "Space Utilization", "spaceutilization.htm", "", "cicon9.gif", "cicon9.gif");
tocTab[ir++] = new Array ("4.11", "Triggers", "triggers.htm", "", "cicon9.gif", "cicon9.gif");
tocTab[ir++] = new Array ("4.12", "Indexes", "indexes.htm", "", "cicon9.gif", "cicon9.gif");
tocTab[ir++] = new Array ("4.13", "SQL Editor options", "sqleditoroptions.htm", "", "cicon9.gif", "cicon9.gif");
tocTab[ir++] = new Array ("4.14", "Options", "options.htm", "", "cicon9.gif", "cicon9.gif");
tocTab[ir++] = new Array ("4.15", "SQL History", "sqlhistory.htm", "", "cicon9.gif", "cicon9.gif");
tocTab[ir++] = new Array ("4.16", "Databases", "databases.htm", "", "cicon1.gif", "cicon2.gif");
tocTab[ir++] = new Array ("4.16.1", "Database backup", "databasebackup.htm", "", "cicon9.gif", "cicon9.gif");
tocTab[ir++] = new Array ("4.16.2", "DataBase restore", "databaserestore.htm", "", "cicon9.gif", "cicon9.gif");
tocTab[ir++] = new Array ("4.16.3", "New/Edit DB", "neweditdb.htm", "", "cicon9.gif", "cicon9.gif");
tocTab[ir++] = new Array ("4.16.4", "Attach DB", "attachdb.htm", "", "cicon9.gif", "cicon9.gif");
tocTab[ir++] = new Array ("4.17", "DB properties", "dbproperties.htm", "", "cicon9.gif", "cicon9.gif");
tocTab[ir++] = new Array ("4.18", "System info", "systeminfo.htm", "", "cicon9.gif", "cicon9.gif");
tocTab[ir++] = new Array ("4.19", "Extended Stored Procedures", "extendedstoredprocedures.htm", "", "cicon9.gif", "cicon9.gif");
tocTab[ir++] = new Array ("4.20", "Find in objects", "findinobjects.htm", "", "cicon9.gif", "cicon9.gif");
tocTab[ir++] = new Array ("4.21", "Compare objects", "compareobjects.htm", "", "cicon1.gif", "cicon2.gif");
tocTab[ir++] = new Array ("4.21.1", "Two scripts", "twoscripts.htm", "", "cicon9.gif", "cicon9.gif");
tocTab[ir++] = new Array ("4.22", "Objects properties", "objectproperties.htm", "", "cicon9.gif", "cicon9.gif");
tocTab[ir++] = new Array ("4.23", "Fragmentation of tables", "fragmentationoftables.htm", "", "cicon9.gif", "cicon9.gif");
tocTab[ir++] = new Array ("4.24", "Generate script", "generatescript.htm", "", "cicon9.gif", "cicon9.gif");
tocTab[ir++] = new Array ("4.25", "Connections", "connections.htm", "", "cicon9.gif", "cicon9.gif");
tocTab[ir++] = new Array ("4.26", "Send message", "sendmessage.htm", "", "cicon9.gif", "cicon9.gif");
tocTab[ir++] = new Array ("4.27", "Wait statistics", "waitstatistics.htm", "", "cicon9.gif", "cicon9.gif");
tocTab[ir++] = new Array ("4.28", "Database Users", "databaseusers.htm", "", "cicon9.gif", "cicon9.gif");
tocTab[ir++] = new Array ("4.29", "Security", "security.htm", "", "cicon1.gif", "cicon2.gif");
tocTab[ir++] = new Array ("4.29.1", "New Login", "newlogin.htm", "", "cicon9.gif", "cicon9.gif");
tocTab[ir++] = new Array ("4.30", "Error Logs", "errorlogs.htm", "", "cicon9.gif", "cicon9.gif");
tocTab[ir++] = new Array ("4.31", "Cached objects", "cachedobjects.htm", "", "cicon9.gif", "cicon9.gif");
tocTab[ir++] = new Array ("4.32", "Lock info", "lockinfo.htm", "", "cicon9.gif", "cicon9.gif");
tocTab[ir++] = new Array ("4.33", "BCP insert", "bcpinsert.htm", "", "cicon9.gif", "cicon9.gif");
tocTab[ir++] = new Array ("4.34", "Jobs", "jobs.htm", "", "cicon1.gif", "cicon2.gif");
tocTab[ir++] = new Array ("4.34.1", "Add/Edit job", "addeditjob.htm", "", "cicon9.gif", "cicon9.gif");
tocTab[ir++] = new Array ("4.35", "Terminal", "terminal.htm", "", "cicon9.gif", "cicon9.gif");
tocTab[ir++] = new Array ("4.36", "Maintenance plans", "maintenanceplans.htm", "", "cicon1.gif", "cicon2.gif");
tocTab[ir++] = new Array ("4.36.1", "Maintenance Plan Edit", "maintenanceplanedit.htm", "", "cicon9.gif", "cicon9.gif");
tocTab[ir++] = new Array ("4.37", "Servers Aliases", "serveraliases.htm", "", "cicon9.gif", "cicon9.gif");
tocTab[ir++] = new Array ("4.38", "SQLTraces", "sqltraces.htm", "", "cicon9.gif", "cicon9.gif");
tocTab[ir++] = new Array ("5", "Command line parameters", "commandlineparameters.htm", "", "cicon9.gif", "cicon9.gif");
tocTab[ir++] = new Array ("6", "How To", "howto2.htm", "", "cicon1.gif", "cicon2.gif");
tocTab[ir++] = new Array ("6.1", "How to Disable/Enable trigger", "howtodisableenabletrigger.htm", "", "cicon9.gif", "cicon9.gif");
tocTab[ir++] = new Array ("6.2", "How to check selectivity of the index", "howtocheckselectivityofth.htm", "", "cicon9.gif", "cicon9.gif");
tocTab[ir++] = new Array ("6.3", "How to check fragmentation of a table or an index", "howtocheckfragmentationof.htm", "", "cicon9.gif", "cicon9.gif");
tocTab[ir++] = new Array ("6.4", "How to copy a whole data row into clipboard", "howtocopywholedatarowint.htm", "", "cicon9.gif", "cicon9.gif");
tocTab[ir++] = new Array ("6.5", "How to generate INSERT INTO script", "howtogenerateinsertscript.htm", "", "cicon9.gif", "cicon9.gif");
tocTab[ir++] = new Array ("6.6", "How to attach a database", "howtoattachdatabase.htm", "", "cicon9.gif", "cicon9.gif");
tocTab[ir++] = new Array ("6.7", "How to find an object by its ID", "howtofindanobjectbyitsi.htm", "", "cicon9.gif", "cicon9.gif");
tocTab[ir++] = new Array ("6.8", "How to edit stored procedures or other objects", "howtoeditstoredprocedures.htm", "", "cicon9.gif", "cicon9.gif");
tocTab[ir++] = new Array ("6.9", "How to manage database files/FileGroups", "howtomanagedatabasefiles.htm", "", "cicon9.gif", "cicon9.gif");
tocTab[ir++] = new Array ("6.10", "How to deploy a database", "howtodeploydatabase.htm", "", "cicon9.gif", "cicon9.gif");
tocTab[ir++] = new Array ("6.11", "How to deploy a job", "howtodeployajob.htm", "", "cicon9.gif", "cicon9.gif");
tocTab[ir++] = new Array ("6.12", "How to shrink a file", "howtoshrinkfile.htm", "", "cicon9.gif", "cicon9.gif");
tocTab[ir++] = new Array ("6.13", "How to check estimated execution plan", "howtocheckestimatedexecuti.htm", "", "cicon9.gif", "cicon9.gif");
tocTab[ir++] = new Array ("6.14", "How to defragment index", "howtodefragmentindex_.htm", "", "cicon9.gif", "cicon9.gif");
tocTab[ir++] = new Array ("6.15", "How to monitor server activity", "howtomonitorserveractivity.htm", "", "cicon9.gif", "cicon9.gif");
tocTab[ir++] = new Array ("6.16", "How to alter a table", "howtoalteratable.htm", "", "cicon9.gif", "cicon9.gif");
tocTab[ir++] = new Array ("6.17", "How to execute stored procedure", "howtoexecutestoredprocedur.htm", "", "cicon9.gif", "cicon9.gif");
tocTab[ir++] = new Array ("6.18", "How to check hanging transactions", "howtocheckhangingtransacti.htm", "", "cicon9.gif", "cicon9.gif");
tocTab[ir++] = new Array ("6.19", "How to change options of a database", "howtochangeparametersofa.htm", "", "cicon9.gif", "cicon9.gif");
tocTab[ir++] = new Array ("6.20", "How to rename a database", "howtorenameadatabase.htm", "", "cicon9.gif", "cicon9.gif");
tocTab[ir++] = new Array ("6.21", "How to find all references to my table in other objects", "howtofindallreferenciesto.htm", "", "cicon9.gif", "cicon9.gif");
tocTab[ir++] = new Array ("6.22", "How to find a difference between two databases", "howtofindadifferencebewee.htm", "", "cicon9.gif", "cicon9.gif");
tocTab[ir++] = new Array ("6.23", "How to create a copy of existing user", "howtocreateacopyofexisit.htm", "", "cicon9.gif", "cicon9.gif");
tocTab[ir++] = new Array ("6.24", "How can I change the owner of my database", "howcanichangetheownerof.htm", "", "cicon9.gif", "cicon9.gif");
isContent = true,
isIndex = false,
showNumbers = false,
textSizes = new Array(1, 1, 0.7, 0.7),
tocBehaviour = new Array(1,1),
tocScroll=false,
tocLinks = new Array(1,0);
var isIE = navigator.appName.toLowerCase().indexOf("explorer") > -1;
var mdi = (isIE) ? textSizes[1]:textSizes[3];
var sml = (isIE) ? textSizes[2]:textSizes[4];
var oldCurrentNumber = "", oldLastVisitNumber = "";
var toDisplay = new Array();
for (ir=0; ir<tocTab.length; ir++) {
toDisplay[ir] = tocTab[ir][0].split(".").length==1;
}
function reDisplay(currentNumber,tocChange,noLink,e) {
if (isIndex && (toc.location.href.substring(toc.location.href.lastIndexOf("/")+1,toc.location.href.length) != "sqlexecms2_kwindex.htm")) { isIndex=false; isContent=true; }
if (currentNumber == "navIndex") { isContent=false; }
if (currentNumber == "navContent") { isIndex=false; isContent=true; }
if (e) {
ctrlKeyDown = (isIE) ? e.ctrlKey : (e.modifiers==2);
if (tocChange && ctrlKeyDown) tocChange = 2;
}
var currentNumArray = currentNumber.split(".");
var currentLevel = currentNumArray.length-1;
var currentIndex = 0;
var scrollY=0, addScroll=tocScroll;
if (currentNumber == "") currentNumber = top.location.href.substring(top.location.href.lastIndexOf("?")+1,top.location.href.length);
for (i=0; i<tocTab.length; i++) {
if ((tocTab[i][0] == currentNumber) || (tocTab[i][2] == currentNumber && tocTab[i][2] != "")) {
currentIndex = i;
currentNumber = tocTab[i][0];
currentNumArray = currentNumber.split(".");
currentLevel = currentNumArray.length-1;
break;
}
}
if (currentIndex < tocTab.length-1) {
nextLevel = tocTab[currentIndex+1][0].split(".").length-1;
currentIsExpanded = nextLevel > currentLevel && toDisplay[currentIndex+1];
}
else currentIsExpanded = false;
theHref = (noLink) ? "" : tocTab[currentIndex][2];
theTarget = tocTab[currentIndex][3];
for (i=1; i<tocTab.length; i++) {
if (tocChange) {
thisNumber = tocTab[i][0];
thisNumArray = thisNumber.split(".");
thisLevel = thisNumArray.length-1;
isOnPath = true;
if (thisLevel > 0) {
for (j=0; j<thisLevel; j++) {
isOnPath = (j>currentLevel) ? false : isOnPath && (thisNumArray[j] == currentNumArray[j]);
}
}
toDisplay[i] = (tocChange == 1) ? isOnPath : (isOnPath || toDisplay[i]);
if (thisNumber.indexOf(currentNumber+".")==0 && thisLevel > currentLevel) {
if (currentIsExpanded) toDisplay[i] = false;
else toDisplay[i] = (thisLevel == currentLevel+1);
}
}
}
if (!isContent && !isIndex) {
toc.location.href = "sqlexecms2_kwindex.htm";
isIndex = true;
}
if (isContent) {
toc.document.write("<html>\n\r<head></head>\n\r<style type=\"text/css\">\n\r       SPAN.heading1 { font-family: Arial,Helvetica; font-weight: normal; font-size: 10pt; color: #000000; text-decoration: none }\n\r       SPAN.heading2 { font-family: Arial,Helvetica; font-weight: normal; font-size: 9pt; color: #000000; text-decoration: none }\n\r       SPAN.heading3 { font-family: Arial,Helvetica; font-weight: normal; font-size: 8pt; color: #000000; text-decoration: none }\n\r       SPAN.heading4 { font-family: Arial,Helvetica; font-weight: normal; font-size: 8pt; color: #000000; text-decoration: none }\n\r       SPAN.heading5 { font-family: Arial,Helvetica; font-weight: normal; font-size: 8pt; color: #000000; text-decoration: none }\n\r       SPAN.heading6 { font-family: Arial,Helvetica; font-weight: normal; font-size: 8pt; color: #000000; text-decoration: none }\n\r\n\r       SPAN.hilight1 { font-family: Arial,Helvetica; font-weight: normal; font-size: 10pt; color: #FFFFFF; background: #002682; text-decoration: none }\n\r       SPAN.hilight2 { font-family: Arial,Helvetica; font-weight: normal; font-size: 9pt; color: #FFFFFF; background: #002682; text-decoration: none }\n\r       SPAN.hilight3 { font-family: Arial,Helvetica; font-weight: normal; font-size: 8pt; color: #FFFFFF; background: #002682; text-decoration: none }\n\r       SPAN.hilight4 { font-family: Arial,Helvetica; font-weight: normal; font-size: 8pt; color: #FFFFFF; background: #002682; text-decoration: none }\n\r       SPAN.hilight5 { font-family: Arial,Helvetica; font-weight: normal; font-size: 8pt; color: #FFFFFF; background: #002682; text-decoration: none }\n\r       SPAN.hilight6 { font-family: Arial,Helvetica; font-weight: normal; font-size: 8pt; color: #FFFFFF; background: #002682; text-decoration: none }\n\r</style>\n\r<body bgcolor=\"#FFFFFF\">\n\r<font face=\"Tahoma,Helvetica\" size=\"4\"><b>SQLExecMS 2.7</b></font><br>\n\r<font face=\"Arial,Helvetica\" size=\"1\">\n\r<a href=\"javaScript:parent.reDisplay(\'navIndex\',0,0);\">Keyword Index</a>\n\r</font>\n\r<hr>\n\r\n\r  <!-- Place holder for the TOC, do not delete the line below -->\n\r  ");}
for (i=0; i<tocTab.length; i++) {
if (toDisplay[i]) {
thisNumber = tocTab[i][0];
thisNumArray = thisNumber.split(".");
thisLevel = thisNumArray.length-1;
isCurrent = (i == currentIndex);
if (i < tocTab.length-1) {
nextLevel = tocTab[i+1][0].split(".").length-1;
img = (thisLevel >= nextLevel) ? tocTab[i][4] : ((toDisplay[i+1]) ? tocTab[i][5] : tocTab[i][4]);
}
else img = tocTab[i][4];
if (isContent) {
thisTextClass = ((thisNumber==currentNumber)?("hilight"):("heading"));
if (addScroll) scrollY+=((thisLevel<2)?mdi:sml)*25;
if (isCurrent) addScroll=false;
toc.document.write("<table border=0 cellspacing=0 cellpadding=2>");
toc.document.write("<tr><td width=" + ((thisLevel+1) * 20) + " align=right valign=top>");
toc.document.write("<a href=\"javaScript:history.go(0)\" onMouseDown=\"parent.reDisplay('" + thisNumber + "'," + tocBehaviour[0] + "," + tocLinks[0] + ",event)\">");
toc.document.write("<img src=\"" + img + "\" border=0></a>");
toc.document.write("</td><td align=left>");
toc.document.write("<a href=\"javaScript:history.go(0)\" onMouseDown=\"parent.reDisplay('" + thisNumber + "'," + tocBehaviour[1] + "," + tocLinks[1] + ",event)\">");
toc.document.write("<span class=\""  + thisTextClass + ((thisLevel>5) ? 6 : thisLevel+1) + "\">");
toc.document.write( ((showNumbers)?(thisNumber+" "):"") + tocTab[i][1]);
toc.document.write("</span></a>");
toc.document.writeln("</td></tr></table>");
} //isContent
}
}
if (!noLink) {
oldLastVisitNumber = oldCurrentNumber;
oldCurrentNumber = currentNumber;
}
if (isContent) {
toc.document.write("\n\r\n\r<hr><font face=\"Arial,Helvetica\" size=\"1\">&copy; 2009 Laplas-soft</font>\n\r</body>\n\r</html>\n\r");
toc.document.close();
if (tocScroll) toc.scroll(0,scrollY);
}
if (theHref)
if (theTarget=="top") top.location.href = theHref;
else if (theTarget=="parent") parent.location.href = theHref;
else if (theTarget=="blank") open(theHref,"");
else content.location.href = theHref;
}
