//////////////////////////////////////////////////////////////////
//																//
//	Weill Cornell Medical College								//
//	cornellsurgery.org site javascript							//
//	cornellsurgery.js											//
//	Version 1.5 												//											
//																//
//////////////////////////////////////////////////////////////////

// ::::::::::::::::::::::::::: SECTION I: preload top nav images: three state rollovers

// fill in the absolute paths for all the images
if (browser) {
	one_on= new Image; one_on.src="http://www.cornellphysicians.com/cma/images/header/nav1_on.gif";
	one_off= new Image; one_off.src="http://www.cornellphysicians.com/cma/images/header/nav1.gif";

	two_on= new Image; two_on.src="http://www.cornellphysicians.com/cma/images/header/nav2_on.gif";
	two_off= new Image; two_off.src="http://www.cornellphysicians.com/cma/images/header/nav2.gif";

	three_on= new Image; three_on.src="http://www.cornellphysicians.com/cma/images/header/nav3_on.gif";
	three_off= new Image; three_off.src="http://www.cornellphysicians.com/cma/images/header/nav3.gif";

	four_on= new Image; four_on.src="http://www.cornellphysicians.com/cma/images/header/nav4_on.gif";
	four_off= new Image; four_off.src="http://www.cornellphysicians.com/cma/images/header/nav4.gif";
	
	five_on= new Image; five_on.src="http://www.cornellphysicians.com/cma/images/header/nav5_on.gif";
	five_off= new Image; five_off.src="http://www.cornellphysicians.com/cma/images/header/nav5.gif";
	
	six_on= new Image; six_on.src="http://www.cornellphysicians.com/cma/images/header/nav6_on.gif";
	six_off= new Image; six_off.src="http://www.cornellphysicians.com/cma/images/header/nav6.gif";

	
		
	// include all additional section types to avoid errors. Set them to null.
	_on= new Image; _on.src=null;
	toolbar_1_on= new Image; toolbar_1_on.src=null;
	toolbar_2_on= new Image; toolbar_2_on.src=null;
	toolbar_3_on= new Image; toolbar_3_on.src=null;
	toolbar_4_on= new Image; toolbar_4_on.src=null;
	toolbar_5_on= new Image; toolbar_5_on.src=null;
	toolbar_6_on= new Image; toolbar_6_on.src=null;
	toolbar_7_on= new Image; toolbar_7_on.src=null;
	toolbar_8_on= new Image; toolbar_8_on.src=null;
	toolbar_9_on= new Image; toolbar_9_on.src=null;
	
}

// ::::::::::::::::::::::::::: SECTION II: set values for panos, use absolute paths for all file locations

// flash pano: use this if using only one pano for the whole site
//panoLoc				= "http://media.med.cornell.edu/panoramas/nyp/pano_home.swf";

// flash pano: use this if using different pano for each section
if (active == "home") {
	panoLoc = "http://media.med.cornell.edu/panoramas/cornellphysicians/cma/pano_home.swf";
} else if (active == "one") {
	panoLoc = "http://media.med.cornell.edu/panoramas/cornellphysicians/cma/pano_" + active + ".swf";
} else if (active == "two") {
	panoLoc = "http://media.med.cornell.edu/panoramas/cornellphysicians/cma/pano_" + active + ".swf";
} else if (active == "three") {
	panoLoc = "http://media.med.cornell.edu/panoramas/cornellphysicians/cma/pano_" + active + ".swf";
} else if (active == "four") {
	panoLoc = "http://media.med.cornell.edu/panoramas/cornellphysicians/cma/pano_" + active + ".swf";
} else if (active == "five") {
	panoLoc = "http://media.med.cornell.edu/panoramas/cornellphysicians/cma/pano_" + active + ".swf";
} else if (active == "six") {
	panoLoc = "http://media.med.cornell.edu/panoramas/cornellphysicians/cma/pano_" + active + ".swf";
} else { //default to this just in case
	panoLoc = "http://media.med.cornell.edu/panoramas/cornellphysicians/cma/pano.swf";
}
		
// set animation to true or false		
inAnimation			= "false";

// static pano: use this if using one pano for the whole site
//altPanoLoc = "http://images.med.cornell.edu/panoramas/test/pano_" + active + ".jpg";
// static pano: use this if using different pano for each section
if (active == "home") {
	altPanoLoc = "http://www.cornellphysicians.com/cma/images/panoramas/home.jpg";
} else if (active == "one") {
	altPanoLoc = "http://www.cornellphysicians.com/cma/images/panoramas/pano_one.jpg";
} else if (active == "two") {
	altPanoLoc = "http://www.cornellphysicians.com/cma/images/panoramas/pano_two.jpg";
} else if (active == "three") {
	altPanoLoc = "http://www.cornellphysicians.com/cma/images/panoramas/pano_three.jpg";
} else  if (active == "four") {
	altPanoLoc = "http://www.cornellphysicians.com/cma/images/panoramas/pano_four.jpg";
} else  if (active == "five") {
	altPanoLoc = "http://www.cornellphysicians.com/cma/images/panoramas/pano_five.jpg";
} else  if (active == "six") {
	altPanoLoc = "http://www.cornellphysicians.com/cma/images/panoramas/pano_six.jpg";
} else { //default to this just in case
	altPanoLoc = "http://www.cornellphysicians.com/cma/images/panoramas/pano_six.jpg";
}		
	

// set xml data for pano flash here
dataLoc	= "http://www.weillcornell.org/cma/data/pano.xml";

// set this line to the location of the temp toolbar when working on the test server. comment it out to move to production
//toolBarLoc			= "http://media.med.cornell.edu/panoramas/framework_toolbar" + homeWrapper + ".swf";

// set loading value here: wmc or nyp
brand				= "wmc";

// setting the array, don't touch
buttonArray			= new Array ();

// set absolute paths for all the pano toolbar links [image map for static pano]
buttonArray[0]		= new createButtonObject ( 8, "http://www.cornellphysicians.com/find.html");
buttonArray[1]		= new createButtonObject ( 4, "http://www.med.cornell.edu/search/search_advanced.html");
buttonArray[2]		= new createButtonObject ( 7, "http://www.cornellphysicians.com/cma/patients/maps.html?name1=Maps+and+Directions&type1=2Active");
buttonArray[3]		= new createButtonObject ( 5, "http://www.cornellphysicians.com/cma/patients/contact.html?name1=Important+Telephone+Numbers&type1=2Active");

// setting the array, don't touch
additionalMapArray	= new Array ();

// lefthand nav homepage link
siteURL = "http://www.cornellphysicians.com/cma";

// ::::::::::::::::::::::::::: SECTION III: set 2nd and 3rd level navigation links here, customize according to section

// needed for 4th level links grey line, don't touch
var num4thLevelLinks = 0;

// load 2nd and 3rd level navigation here
function loadLinks() {
	
	// setting the array, don't touch this line
	var navLinks = new Array();
		
	if (active == "one") {
	    
		//navLinks[0] = new LeftLink('Our Physicians', 'http://www.cornellphysicians.com/cma/about/index.html', '2', '', '');
		//navLinks[1] = new LeftLink('Obstetrics and Gynecology', 'http://www.cornellphysicians.com/cma/about/obgyn.html', '3', 'Our Physicians', '');
		//navLinks[2] = new LeftLink('Pediatrics', 'http://www.cornellphysicians.com/cma/about/pediatrics.html', '3', 'Our Physicians', '');
		//navLinks[3] = new LeftLink('Internal Medicine', 'http://www.cornellphysicians.com/cma/about/medicine.html', '3', 'Our Physicians', '');
		
	} else if (active == "two") {
	    
		navLinks[0] = new LeftLink('East Side', 'http://www.cornellphysicians.com/cma/medicine/east.html', '2', '', '');
		navLinks[1] = new LeftLink('West Side', 'http://www.cornellphysicians.com/cma/medicine/west.html', '2', '', '');
		
	} else if (active == "three") {
	    
		navLinks[0] = new LeftLink('East Side', 'http://www.cornellphysicians.com/cma/obgyn/east.html', '2', '', '');
		navLinks[1] = new LeftLink('West Side', 'http://www.cornellphysicians.com/cma/obgyn/west.html', '2', '', '');
		
	} else if (active == "four") {
	    
		navLinks[0] = new LeftLink('East Side', 'http://www.cornellphysicians.com/cma/pediatrics/east.html', '2', '', '');
		navLinks[1] = new LeftLink('West Side', 'http://www.cornellphysicians.com/cma/pediatrics/west.html', '2', '', '');
		
	} else if (active == "five") {
	    
		navLinks[0] = new LeftLink('Adult Health Information', 'http://www.cornellphysicians.com/cma/az/aHealth.html', '2', '', '');
		navLinks[1] = new LeftLink('Pediatric Health Information', 'http://www.cornellphysicians.com/cma/az/pHealth.html', '2', '', '');
		
	} else if (active == "six") {
		
		navLinks[0] = new LeftLink('Medical Release Forms', 'http://www.cornellphysicians.com/cma/patients/forms.html', '2', '', '');
		navLinks[1] = new LeftLink('Request a Prescription Refill', 'http://www.cornellphysicians.com/cma/patients/prescription.html', '2', '', '');
		navLinks[2] = new LeftLink('Request a Referral to a Specialist', 'http://www.cornellphysicians.com/cma/patients/referral.html', '2', '', '');
		navLinks[3] = new LeftLink('Pediatric FAQs', 'http://www.cornellphysicians.com/cma/patients/faq.html', '2', '', '');
		navLinks[4] = new LeftLink('Pediatric News and Links', 'http://www.cornellphysicians.com/cma/patients/news.html', '2', '', '');
		navLinks[5] = new LeftLink('How to Make An Appointment', 'http://www.cornellphysicians.com/cma/patients/appointment.html', '2', '', '');
		navLinks[6] = new LeftLink('Maps and Directions', 'http://www.cornellphysicians.com/cma/patients/maps.html', '2', '', '');
		navLinks[7] = new LeftLink('Contact Us', 'http://www.cornellphysicians.com/cma/patients/contact.html', '2', '', '');
		navLinks[8] = new LeftLink('Office Hours', 'http://www.cornellphysicians.com/cma/patients/hours.html', '2', '', '');
		
	} 
		
	// returning the value here, don't touch
	return (navLinks);
}

// Expanding Questions/Answers Javascript

var ids=new Array();

function QAinit(){
	if(document.getElementById) {
		var tids=document.getElementsByTagName('div');
		for(i=0;i<tids.length;i++)if(tids[i].className=="expand")ids[ids.length]=tids[i];
		for(i=0;i<ids.length;i++)ids[i].onmouseup=setstate;
	}
}

function setstate(){
	

	for(i=0;i<ids.length;i++) {
		//ids[i].style.display="block";
		ids[i].style.visibility="";
		ids[i].style.height="";

	}
	
	if(this.className=="expand")this.style.visibility="hidden";
	if(this.className=="expand")this.style.height="0";

	
	for(i=0;i<ids.length;i++) {
	ids[i].parentNode.getElementsByTagName('div')[1].style.display="none";
	}
	
	for(i=0;i<ids.length;i++) {
		if(ids[i]==this){
			var d=this.parentNode.getElementsByTagName('div')[1];
		if(d.style.display=="block")d.style.display="none";
		else d.style.display="block";
		}
	}

}

function expandall(){
if(document.getElementById){
for(i=0;i<ids.length;i++)ids[i].parentNode.getElementsByTagName('div')[1].style.display="block";
}}

function collapseall(){
if(document.getElementById){
for(i=0;i<ids.length;i++)ids[i].parentNode.getElementsByTagName('div')[1].style.display="none";
}}
