//////////////////////////////////////////////////////////////////
//																//
//	Weill Cornell Medical College Main Header JavaScript		//
//	header.js													//
//	Version 1.5													//
//	Author														//
//		?														//
//		Mike Sachs												//
//																//
//////////////////////////////////////////////////////////////////


//////////////////////////////////////////////////////////////////
//																//
//	Browser sniffer. Script will only be enabled in compliant	//
//	browsers.													//
//																//
//////////////////////////////////////////////////////////////////

var isMac = (navigator.userAgent.indexOf("Macintosh") != -1);
var isWin = (navigator.userAgent.indexOf("Windows 95") != -1 || navigator.userAgent.indexOf("Windows NT") != -1);
var isNS =  (navigator.appName == "Netscape");
var isIE =  (navigator.userAgent.indexOf("MSIE") != -1);
var ieWin = (navigator.userAgent.indexOf("MSIE") != -1 && (navigator.userAgent.indexOf("Windows 95") != -1 || navigator.userAgent.indexOf("Windows NT") != -1));

browser = (((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) >= 3 )) || ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4 )))

//////////////////////////////////////////////////////////////////
//																//
//	Event handling functions									//
//																//
//////////////////////////////////////////////////////////////////

//  TopNav rollovers
if ( browser )

{

		wmc_on= new Image; wmc_on.src="http://images.med.cornell.edu/headers/wmc/topNav_wmc_on.gif";
		wmc_off= new Image; wmc_off.src="http://images.med.cornell.edu/headers/wmc/topNav_wmc.gif";
		wmc_active= new Image; wmc_active.src="http://images.med.cornell.edu/headers/wmc/topNav_wmc_on.gif";
		
		edu_on= new Image; edu_on.src="http://images.med.cornell.edu/headers/wmc/topNav_edu_on.gif";
		edu_off= new Image; edu_off.src="http://images.med.cornell.edu/headers/wmc/topNav_edu.gif";
		edu_active= new Image; edu_active.src="http://images.med.cornell.edu/headers/wmc/topNav_edu_on.gif";
		
		res_on= new Image; res_on.src="http://images.med.cornell.edu/headers/wmc/topNav_res_on.gif";
		res_off= new Image; res_off.src="http://images.med.cornell.edu/headers/wmc/topNav_res.gif";
		res_active= new Image; res_active.src="http://images.med.cornell.edu/headers/wmc/topNav_res_on.gif";
		
		pat_on= new Image; pat_on.src="http://images.med.cornell.edu/headers/wmc/topNav_pat_on.gif";
		pat_off= new Image; pat_off.src="http://images.med.cornell.edu/headers/wmc/topNav_pat.gif";
		pat_active= new Image; pat_active.src="http://images.med.cornell.edu/headers/wmc/topNav_pat_on.gif";
		
		dep_on= new Image; dep_on.src="http://images.med.cornell.edu/headers/wmc/topNav_dep_on.gif";
		dep_off= new Image; dep_off.src="http://images.med.cornell.edu/headers/wmc/topNav_dep.gif";
		dep_active= new Image; dep_active.src="http://images.med.cornell.edu/headers/wmc/topNav_dep_on.gif";
		}
		
function mouseOver ( buttonName )
{
	if ( ( browser ) && ( buttonName != active ) )
	{
		document[ buttonName ].src = eval ( buttonName + "_on.src" );
	}       
}

function mouseOut ( buttonName )
{
	if ( ( browser ) && ( buttonName != active ) )
	{
		document[ buttonName ].src = eval ( buttonName + "_off.src" );
	} 
}

function mouseClick ( buttonName )
{
	active = buttonName;
	if ( browser )
	{
		document[ buttonName ].src = eval ( buttonName + "_active.src" );
	}
}

function pageLoad ( )
{
	if ( browser )
	{
		if ( active != "" )
		{
			document[ active ].src = eval ( active + "_active.src" );
		}
	}
}



//////////////////////////////////////////////////////////////////
//																//
//	Popup window opener											//
//																//
//////////////////////////////////////////////////////////////////

function doCreateNewWindow ( inUrl, inWidth, inHeight, inScroll )
{
	var winl = (screen.availWidth - inWidth) / 2;
	var wint = (screen.availHeight - inHeight) / 2 - 40;

	window.open(inUrl,'cme_demo','plainWindow,width=' + inWidth +',height=' + inHeight + ',top='+wint+',left='+winl+',screenX='+winl+',screenY='+wint+',scrollbars='+inScroll);
}

function doCreateNewWindowWithContent ( inUrl, inWidth, inHeight, inName, inContent )
{
	var winl = (screen.availWidth - inWidth) / 2;
	var wint = (screen.availHeight - inHeight) / 2 - 40;
	
	content="<html><head><title>"+inName+"<\/title><\/head>"+inContent+"<noframes><body><\/body><\/noframes><\/html>";
	newWin = window.open ( inUrl, 'popupwindow', "scrollbars=yes,resizable,width=" + inWidth +",height=" + inHeight + ",top="+wint+",left="+winl+",screenX="+winl+",screenY="+wint );
	newWin.document.write(content);
	newWin.document.close();
}

//////////////////////////////////////////////////////////////////
//																//
//	Flash sniffer												//
//																//
//////////////////////////////////////////////////////////////////

FlashMode = 0;

var plgIn = "Shockwave Flash";

var autoGo = true;

var ok=false;

document.MM_returnValue = false;

var plgIn = 'Shockwave Flash';

var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"] ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0);

with (navigator){
	if (appName.indexOf('Microsoft')==-1 || (plugins && plugins.length)){
		if (plugin && parseInt(plugin.description.substring(plugin.description.indexOf(".")-1)) >= 6){
			ok = true;
		} else {
			ok = false;
		}
	} else if (appVersion.indexOf('3.1')==-1) { 
	//not Netscape or Win3.1
		if (plgIn.indexOf("Flash")!=-1 && window.MM_flash!=null) {
			ok=window.MM_flash;
		} else if (plgIn.indexOf("Director")!=-1 && window.MM_dir!=null) {
			ok=window.MM_dir;
		} else {
			ok=autoGo;
		}
	}
}

if (!ok) {
	FlashMode = 0;
} else {
	FlashMode = 1;
}

//////////////////////////////////////////////////////////////////
//																//
//	Alt Pano functions											//
//																//
//////////////////////////////////////////////////////////////////

function createButtonObject ( inButtonSize, inAltURL )
{
	this.size 	= inButtonSize;
	this.URL	= inAltURL;
}

function createAdditionalMapObject ( inPoint1x, inPoint1y, inPoint2x, inPoint2y, inURL )
{
	this.x1 	= inPoint1x;
	this.y1 	= inPoint1y;
	this.x2 	= inPoint2x;
	this.y2 	= inPoint2y;
	this.URL 	= inURL;
}