// Initialize DHTML Menu functions
HM_DOM = (document.getElementById) ? true : false;
HM_NS4 = (document.layers) ? true : false;
HM_IE = (document.all) ? true : false;
HM_IE4 = HM_IE && !HM_DOM;
HM_Mac = (navigator.appVersion.indexOf("Mac") != -1);
HM_IE4M = HM_IE4 && HM_Mac;
  
if(window.event + "" == "undefined") event = null;
function HM_f_PopUp(){return false};
function HM_f_PopDown(){return false};
popUp = HM_f_PopUp;
popDown = HM_f_PopDown;

// Set default window status
window.defaultStatus = 'MicroStrategy - Best in Business Intelligence';

// Initialize global variables
var blnHomepage = false;
var intMenuTop = 95;
var Flash_Version = 0;
var Flash_Menus_Enabled = false;
var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;

var thisHostName = window.location.hostname;
if (thisHostName != '199.173.152.115') {
	thisHostName = "www.microstrategy.com";
}

// Obtain integer for Flash version installed
if (plugin) {
		numPlugins = navigator.mimeTypes.length;
		for (i = 0; i < numPlugins; i++)	{
			plugin = navigator.mimeTypes[i];			
			if ((plugin.type == "application/x-shockwave-flash") && (plugin.enabledPlugin)) {
				pluginDesc = plugin.enabledPlugin.description;
				plugVersionPoz = pluginDesc.indexOf(".")	
				Flash_Version = parseInt(pluginDesc.substring(plugVersionPoz -1, plugVersionPoz));
				}
		}
}
else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 && (navigator.appVersion.indexOf("Win") != -1)) {
	document.write("<SCR" + "IPT LANGUAGE='VBScript'\> \n");
	document.write("Function VBGetFlashControlVersion() \n");
	document.write("On Error Resume Next \n");
	document.write("Dim Control, server, theversion \n");
	document.write("server = \"ShockwaveFlash.ShockwaveFlash\" \n");
	document.write("set Control = CreateObject(server) \n");
	document.write("if (IsObject(Control)) then \n");
	document.write("Dim majorVersion, controlVersion \n");
	document.write("controlVersion = Control.FlashVersion() \n");
	document.write("majorVersion = int(controlVersion / 65536) \n");
	document.write("theversion = CStr(majorVersion) \n");
	document.write("theversion = left(theversion,InStr(theversion,\".\")-1) \n");
	document.write("end if \n");
	document.write("if IsNull(theversion) or IsEmpty(theversion) or theversion = \"\" then \n");
	document.write("	theversion = 0 \n");
	document.write("end if \n");
	document.write("set Control = nothing \n");
	document.write("VBGetFlashControlVersion = theversion \n");
	document.write("End Function \n");
	document.write("</SCR" + "IPT\> \n");

	//Flash_Version = parseInt(VBGetFlashControlVersion());
}

if ((HM_IE) && (!HM_Mac) && (Flash_Version >= 6)) {
	Flash_Menus_Enabled = true;
}

// Tab images cache
Tab1Cache0 = new Image();
Tab1Cache0.src = "/graphics/Headers/Tab1_on.gif";
Tab2Cache0 = new Image();
Tab2Cache0.src = "/graphics/Headers/Tab2_on.gif";
Tab3Cache0 = new Image();
Tab3Cache0.src = "/graphics/Headers/Tab3_on.gif";
Tab4Cache0 = new Image();
Tab4Cache0.src = "/graphics/Headers/Tab4_on.gif";
Tab5Cache0 = new Image();
Tab5Cache0.src = "/graphics/Headers/Tab5_on.gif";
Tab6Cache0 = new Image();
Tab6Cache0.src = "/graphics/Headers/Tab6_on.gif";

// Include JS Date function for IR site
function MakeArray(n) {
	this.length = n
	return this
}

function customDateString(oneDate) {
	var theDay = dayNames[oneDate.getDay() + 1];
	var theMonth = monthNames[oneDate.getMonth() + 1];
	var theYear = oneDate.getFullYear();
	return theDay + ", " + theMonth + " " + oneDate.getDate() + ", " + theYear;
}

monthNames = new MakeArray(12)
monthNames[1] = "January"
monthNames[2] = "February"
monthNames[3] = "March"
monthNames[4] = "April"
monthNames[5] = "May"
monthNames[6] = "June"
monthNames[7] = "July"
monthNames[8] = "August"
monthNames[9] = "September"
monthNames[10] = "October"
monthNames[11] = "November"
monthNames[12] = "December"

dayNames = new MakeArray(7)
dayNames[1] = "Sunday"
dayNames[2] = "Monday"
dayNames[3] = "Tuesday"
dayNames[4] = "Wednesday"
dayNames[5] = "Thursday"
dayNames[6] = "Friday"
dayNames[7] = "Saturday"

// Begin Global JS Functions
function DropdownChooser(Product) {
if (Product != "") {
window.location = Product;
		}
}

function SpawnWin(URL,W,H,Name) {
Spawned = window.open(URL,Name,"width="+W+",height="+H+",resizable=1");
setTimeout("Spawned.window.focus()",500);
}

function SetScreenshot(Product,Num) {
SpawnWin('/QuickTours/HTML/Screenshots/' + Product,860,565);
setTimeout("Spawned.top.topframe.ChangeSlide('" + Num + "')",2000);
}

function SpawnSurvey() {
SurveyWin = window.open('/Public/Surveys/Website','','width=560,height=250,resizable=1,scrollbars=1,left=140,top=200,screenx=140,screeny=200');
}

function Hilite(ThisID) {
		ThisImage = ThisID;
	    document.images[ThisImage].src = document.images[ThisImage].src.substring(0, document.images[ThisImage].src.lastIndexOf('.') - 4) + "_on.gif";
}

function UnHilite(ThisID) {
		ThisImage = ThisID;
	    document.images[ThisImage].src = document.images[ThisImage].src.substring(0, document.images[ThisImage].src.lastIndexOf('.') - 3) + "_off.gif";
}

function ToggleMenuVisibility(myid){
	// Toggle DIV visibility and switch plus sign, disabled for NS4
	if ((HM_IE) || (HM_DOM)) {
		// Explorer
		if (HM_IE){
			ThisDIV = document.all["LeftNav_" + myid];
			ThisExp = document.all["LeftNavExp_" + myid];
		}
		// DOM Browsers
		else if (HM_DOM) {
			ThisDIV = document.getElementById("LeftNav_" + myid);
			ThisExp = document.getElementById("LeftNavExp_" + myid);
		}
		// If hidden, show
		if (ThisDIV.style.display == "none") {
			ThisDIV.style.display = "";
			ThisExp.src = "http://www.microstrategy.com/graphics/sides/navigation/DIVExpander_minus.gif";
		}
		// If showing, hide
		else {
			ThisDIV.style.display = "none";
			ThisExp.src = "http://www.microstrategy.com/graphics/sides/navigation/DIVExpander_plus.gif";
		}
	}
}

function TriggerFlash() {
var args = TriggerFlash.arguments;
	for (x = 0; x < args.length; x++) {
		Root = eval("window." + args[x]);
		if (Root) {
			Root.Play();
		}
	}
}
