// 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 intCustomerCount = '2,800';
var intPartnerCount = '500';
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;
// Check for external vs internal sites by name & IP
if ( (thisHostName != 'www.microstrategy.com') && (thisHostName != '199.173.152.24') && (thisHostName != 'dev-mrkt-web') && (thisHostName != '10.15.70.150') && (thisHostName != '10.15.71.2') && (thisHostName != '10.15.71.4') ) {
	var externalSite = true;
	thisHostName = "www.microstrategy.com";
}
else {
	var externalSite = false;
}

// 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
/* //not used on new site -j
SpacerCache = new Image();
SpacerCache.src = "/graphics/spacer.gif";
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 SpawnVideoWin(URL,W,H,Name) {
		SpawnedVideoWin = window.open(URL,Name,"width="+W+",height="+H+",top=0,left=0,directories=0,resizable=0,fullscreen=0,titlebar=0,scrollbars=0,toolbar=0,menubar=0,status=0");
		setTimeout("SpawnedVideoWin.window.focus()",1000);
}

function SpawnWin(URL,W,H,Name) {
Spawned = window.open(URL,Name,"width="+W+",height="+H+",resizable=1");
setTimeout("Spawned.window.focus()",1000);
}

function SetScreenshot(Product,Num) {
SpawnWin('/QuickTours/HTML/Screenshots/' + Product,860,565);
setTimeout("Spawned.top.topframe.ChangeSlide('" + Num + "')",1000);
}

function SetQuickTourSlide(Tour,Num) {
SpawnWin('http://www.microstrategy.com/QuickTours/HTML/' + Tour,843,532);
setTimeout("Spawned.top.topframe.ChangeSlide('" + Num + "')",1000);
}

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;
		if (document.images[ThisImage].src.indexOf('_on.gif') <= 0) {
		    document.images[ThisImage].src = document.images[ThisImage].src.substring(0, document.images[ThisImage].src.lastIndexOf('.') - 4) + "_on.gif";
		}
}

function UnHilite(ThisID) {
		ThisImage = ThisID;
		if (document.images[ThisImage].src.indexOf('_off.gif') <= 0) {
		    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 GetDIVStyleID(myid) {
	if ((HM_IE) || (HM_DOM)) {
		// Explorer
		if (HM_IE){
			ThisDIV = document.all[myid];
		}
		// DOM Browsers
		else if (HM_DOM) {
			ThisDIV = document.getElementById(myid);
		}
		return (ThisDIV);
	}
	else {
		return false;
	}
}

function Edu_ShowMe(myid,mydisplay) {
	if ((HM_IE) || (HM_DOM)) {
		if (mydisplay == "none") {
			eval(GetDIVStyleID('Role_' + myid)).style.display = "none";
			eval(GetDIVStyleID('Hd_' + myid)).style.fontWeight = "normal";
		}
		else if (mydisplay == "block") {
			eval(GetDIVStyleID('Role_' + myid)).style.display = "block";
			eval(GetDIVStyleID('Hd_' + myid)).style.fontWeight = "bold";		
		}
	}
}

function Careers_ShowMe(myid) {
	if ((HM_IE) || (HM_DOM)) {
		if (eval(GetDIVStyleID('JobDiv_' + myid)).className == "Hide") {
			eval(GetDIVStyleID('JobDiv_' + myid)).className = "Show";
		}
		else {
			eval(GetDIVStyleID('JobDiv_' + myid)).className = "Hide";
		}
	}
}

//JS to show BI Symposium layers



// JS to show education courses by Role
function Edu_ShowDiv(myid) {
	Edu_HideAllDivs();
	Edu_ShowMe(myid,'block');
}

function Edu_HideAllDivs() {
	Edu_ShowMe('BusinessAnalyst','none');
	Edu_ShowMe('Architect','none');
	Edu_ShowMe('ReportDeveloper','none');
	Edu_ShowMe('Administrator','none');
	Edu_ShowMe('ProjectLead','none');
	Edu_ShowMe('InterfaceDesigner','none');
	Edu_ShowMe('ProjectDesigner','none');
	Edu_ShowMe('InfrastructureLead','none');
	Edu_ShowMe('HelpDesk','none');
	Edu_ShowMe('SystemsIntegrator','none');
	Edu_ShowMe('TechWriter','none');
	Edu_ShowMe('Tester','none');
	Edu_ShowMe('Report','none');
}

// JS to show education courses by Product
function Edu_ShowProdDiv(myid) {
	Edu_HideAllProdDivs();
	Edu_ShowMe(myid,'block');
}

function Edu_HideAllProdDivs() {
	Edu_ShowMe('NarrowcastServer','none');
	Edu_ShowMe('Web','none');
	Edu_ShowMe('Desktop','none');
	Edu_ShowMe('SDK','none');
	Edu_ShowMe('IServer','none');
	Edu_ShowMe('MOffice','none');
	Edu_ShowMe('Architect','none');
	Edu_ShowMe('Report','none');
	Edu_ShowMe('Administrator','none');
}

function TriggerFlash() {
var args = TriggerFlash.arguments;
	for (x = 0; x < args.length; x++) {
		Root = eval("window." + args[x]);
		if (Root) {
			Root.Play();
		}
	}
}

function startReportServicesWebcast(Marker) {
winWebcast = window.open('/Events/Webcasts/ReportServices/11_18_2003.asp?intMarker=' + Marker,'Webcast','height=832,width=1024,top=0,left=0,screenX=0,screenY=0,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1,copyhistory=0,titlebar=0');
	setTimeout("winWebcast.focus()",500);
}


