// JavaScript Document



//MENU FUNCTIONS

menulength = 9;
baseURL = "http://www.yale.edu/worldfellows/"

//array to make the main menu
var MenuItems= new Array(menulength+1);
MenuItems[1]=new Array("about","About","y",baseURL+"about.html"); 
MenuItems[2]=new Array("fellows","The World Fellows","","http://ris-systech2.its.yale.edu/worldfellows/fellows/search.asp"); 
MenuItems[3]=new Array("program","The Program","y",baseURL+"program.html"); 
MenuItems[4]=new Array("newsmedia","News &amp; Media","",baseURL+"newsmedia.html");
MenuItems[5]=new Array("events","Events","y",baseURL+"events.html");  
MenuItems[6]=new Array("application","Application and Admissions","y",baseURL+"application.html");
MenuItems[7]=new Array("involved","Getting Involved","",baseURL+"involved.html");  
MenuItems[8]=new Array("internationalization","Internationalization at Yale University","",baseURL+"internationalization.html");  
MenuItems[9]=new Array("contact","Contact","",baseURL+"contact.html");

//arrays to make the submenus

var aboutSubMenu= new Array();
aboutSubMenu[1]=new Array("goals","about_goals.html","Core Goals/Overview"); 
//aboutSubMenu[2]=new Array("committee","about_committee.html","Faculty Advisory Committee");
aboutSubMenu[2]=new Array("betts","about_betts.html","Yale University/Betts House");
aboutSubMenu[3]=new Array("partners","about_partners.html","Partners");

var programSubMenu= new Array();
programSubMenu[1]=new Array("curriculum","program_curriculum.html","Curriculum"); 
programSubMenu[2]=new Array("trips","program_trips.html","Trips");
programSubMenu[3]=new Array("speakers","program_speakers.html","Speakers");
programSubMenu[4]=new Array("activities","program_activities.html","Activities on Campus");
programSubMenu[5]=new Array("alumni","program_alumni.html","Alumni Network");

var eventsSubMenu= new Array();
eventsSubMenu[1]=new Array("calendar","calendar.html","Calendar");
//eventsSubMenu[2]=new Array("events_returntoyale","events_returntoyale.html","Return To Yale Forum");
eventsSubMenu[2]=new Array("events_tedx","http://www.tedxyaleworldfellows.org/","TEDx");
eventsSubMenu[3]=new Array("events_globalleadership","events_globalleadership.html","Global Leadership Series");

var applicationSubMenu= new Array();
applicationSubMenu[1]=new Array("apply","application_apply.html","Apply to the Program");
applicationSubMenu[2]=new Array("nominate","application_nominate.html","Nominate a Candidate");
applicationSubMenu[3]=new Array("eligibility","application_eligibility.html","Eligibility and Selection Criteria");
applicationSubMenu[4]=new Array("dates","application_dates.html","Dates and Deadlines");
applicationSubMenu[5]=new Array("faq","application_faq.html","Frequently Asked Questions (FAQ)"); 




//************************ DON'T CHANGE ANYTHING BELOW THIS LINE !!! *****************************
//************************************************************************************************
//************************************************************************************************



// function to write flash obj passing query string vars
function writeFlash2010() {
	
	// appearance vars, these can be customized to your liking
	var width = '271'
	var height = '336'
	var src = 'home_fellows_2010.swf'
	var rannumber = (Math.floor(Math.random()*10000)+1);
	//alert(rannumber);
	// queries -- type in the variables you want to send to flash here
	//var queries = '?text='+QueryString('year')+'&month='+QueryString('month')+'';
	var queries = '?NumberOfFellows='+NumberOfFellows+'&rand='+rannumber+''
	for (i = 1; i <= NumberOfFellows; i++)
	{
		queries = queries + '&name'+i+'='+FellowsArray[i][0]+''
		queries = queries + '&url'+i+'='+FellowsArray[i][1]+''
		queries = queries + '&target'+i+'='+FellowsArray[i][2]+''
	}
	

	// write all lines
	document.write('<object id="FlashID" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+width+'" height="'+height+'">');
  document.write('<param name="movie" value="'+src+queries+'" />');
  document.write('<param name="quality" value="high" />');
  document.write('<param name="wmode" value="opaque" />');
  document.write('<param name="swfversion" value="8.0.35.0" />');
  document.write('<!-- This param tag prompts users with Flash Player 6.0 r65 and higher to download the latest version of Flash Player. Delete it if you don’t want users to see the prompt. -->');
  document.write('<param name="expressinstall" value="scripts/expressInstall.swf" />');
  document.write('<!-- Next object tag is for non-IE browsers. So hide it from IE using IECC. -->');
  document.write('<!--[if !IE]>-->');
  document.write('<object type="application/x-shockwave-flash" data="'+src+queries+'" width="'+width+'" height="'+height+'">');
    document.write('<!--<![endif]-->');
    document.write('<param name="quality" value="high" />');
    document.write('<param name="wmode" value="opaque" />');
    document.write('<param name="swfversion" value="8.0.35.0" />');
    document.write('<param name="expressinstall" value="scripts/expressInstall.swf" />');
    document.write('<!-- The browser displays the following alternative content for users with Flash Player 6.0 and older. -->');
    document.write('<div>');
      document.write('<h4>Content on this page requires a newer version of Adobe Flash Player.</h4>');
      document.write('<p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" width="112" height="33" /></a></p>');
    document.write('</div>');
    document.write('<!--[if !IE]>-->');
  document.write('</object>');
  document.write('<!--<![endif]-->');
document.write('</object>');
document.write('<script type="text/javascript">');
document.write('<!--');
document.write('swfobject.registerObject("FlashID");');
document.write('//-->');
document.write('</script>');

}






function MakeMainMenu(thepage,subpage) {
	
	document.write('<ul>');
	
	for (x=1; x<=menulength; x++) {
		document.write('<li');
		if ((MenuItems[x][2]=="y")&&(thepage==MenuItems[x][0])) {
			document.write(' class="nounderline"');
		}
		document.write('><a href="' + MenuItems[x][3] + '"');
		if (thepage==MenuItems[x][0]) {
			document.write(' style="color: #2991f1;"');
		}
		document.write('>' + MenuItems[x][1] + '</a></li>');
		if ((MenuItems[x][2]=="y")&&(thepage==MenuItems[x][0])) {
			document.write('<div id="submenu_'+MenuItems[x][0]+'" class="submenu">');
			thisArrayName = eval(MenuItems[x][0]+"SubMenu");
			for (y=1; y<=(thisArrayName.length-1); y++) {
				document.write('<a href="'+thisArrayName[y][1]+'"');
				if (subpage==thisArrayName[y][0]) {
					document.write(' style="color: #4ba6d2;"');
				}
				
				//IF TEDX LINK< OPEN IN NEW TAB/WINDOW
				if (thisArrayName[y][0]=='events_tedx') {
					document.write(' target="_blank"');
				}
				
				document.write('>'+thisArrayName[y][2]+'</a><br />');
			}
			document.write('<div id="submenuline"></div>');
			
			document.write('</div>');
		}
		
	}
	
	if (thepage!="homepage") {
		document.write('<li><a href="'+baseURL+'index.html">Home Page</a></li>');
	}
	
	document.write('</ul>');
	
	
	
}



//MEMBER SECTION MENU FUNCTIONS

membermenulength = 9;
memberbaseURL = "http://www.yale.edu/worldfellows/members/"

//array to make the main menu
var memberMenuItems= new Array(membermenulength+1);
memberMenuItems[1]=new Array("main","Member Area <BR>Home Page","","index.html"); 
memberMenuItems[2]=new Array("prearrival","Pre-Arrival Information","","prearrival.html");
memberMenuItems[3]=new Array("calendar","Calendar","","calendar.html");
memberMenuItems[4]=new Array("orientation","Orientation","","orientation.html");
memberMenuItems[5]=new Array("curriculum","Curriculum","","curriculum.html");
memberMenuItems[6]=new Array("outreach","Outreach","","outreach.html");  
memberMenuItems[7]=new Array("whoswho","Who's Who","y","whoswho.html");
memberMenuItems[8]=new Array("sites","Sites of Interest","y","sites.html");
memberMenuItems[9]=new Array("photos","Photo Gallery","","photos.html"); 

//arrays to make the submenus

var curriculumSubMenu= new Array();
curriculumSubMenu[1]=new Array("orientation","curric_orientation.html","Orientation"); 
curriculumSubMenu[2]=new Array("worldaffairsseminar","curric_worldaffairsseminar.html","Global Issues Seminar");
curriculumSubMenu[3]=new Array("skillbuilding","curric_skillbuilding.html","Skill Building Series");
curriculumSubMenu[4]=new Array("speakers","curric_speakers.html","Distinguished Speaker Series");
curriculumSubMenu[5]=new Array("hotissues","curric_hotissues.html","Hot Issues");
curriculumSubMenu[6]=new Array("newyork","curric_newyork.html","New York City");
curriculumSubMenu[7]=new Array("dc","curric_dc.html","Washington D.C.");

var whoswhoSubMenu= new Array();
whoswhoSubMenu[1]=new Array("worldfellows","whoswho_worldfellows.html","Yale World Fellows"); 
whoswhoSubMenu[2]=new Array("associates","whoswho_associates.html","Associate Fellows");
whoswhoSubMenu[3]=new Array("affiliates","whoswho_affiliates.html","Affiliates");
whoswhoSubMenu[4]=new Array("liaisons","whoswho_liaisons.html","Liaisons");
whoswhoSubMenu[5]=new Array("staff","whoswho_staff.html","Staff");

var sitesSubMenu= new Array();
sitesSubMenu[1]=new Array("yale","sites_yale.html","Navigating Yale"); 
sitesSubMenu[2]=new Array("academic","sites_academic.html","Academic Enrichment");
sitesSubMenu[3]=new Array("professional","sites_professional.html","Professional Enrichment");


function MakeMemberMenu(thepage,subpage) {
	
	document.write('<ul>');
	
	for (x=1; x<=membermenulength; x++) {
		document.write('<li');
		if ((memberMenuItems[x][2]=="y")&&(thepage==memberMenuItems[x][0])) {
			document.write(' class="nounderline"');
		}
		document.write('><a href="' + memberMenuItems[x][3] + '"');
		if (thepage==memberMenuItems[x][0]) {
			document.write(' style="color: #2991f1;"');
		}
		document.write('>' + memberMenuItems[x][1] + '</a></li>');
		if ((memberMenuItems[x][2]=="y")&&(thepage==memberMenuItems[x][0])) {
			document.write('<div id="submenu_'+memberMenuItems[x][0]+'" class="submenu">');
			thisArrayName = eval(memberMenuItems[x][0]+"SubMenu");
			for (y=1; y<=(thisArrayName.length-1); y++) {
				document.write('<a href="'+thisArrayName[y][1]+'"');
				if (subpage==thisArrayName[y][0]) {
					document.write(' style="color: #4ba6d2;"');
				}
				
				
				document.write('>'+thisArrayName[y][2]+'</a><br />');
			}
			document.write('<div id="submenuline"></div>');
			
			document.write('</div>');
		}
		
	}
	
	if (thepage!="homepage") {
		document.write('<li><a href="http://www.yale.edu/worldfellows/index.html">World Fellows Home Page</a></li>');
	}
	
	document.write('</ul>');
	
	
	
}


//CONFERENCE SECTION MENU FUNCTIONS

conferencemenulength = 3;
conferencebaseURL = "http://www.yale.edu/worldfellows/conference/"

//array to make the main menu
var conferenceMenuItems= new Array(conferencemenulength+1);
conferenceMenuItems[1]=new Array("overview","Overview","","index.html"); 
conferenceMenuItems[2]=new Array("registration","Registration","","registration.html"); 
conferenceMenuItems[3]=new Array("contact","Contact Us","","contact.html"); 

//arrays to make the submenus


function MakeConferenceMenu(thepage,subpage) {
	
	document.write('<ul>');
	
	for (x=1; x<=conferencemenulength; x++) {
		document.write('<li');
		if ((conferenceMenuItems[x][2]=="y")&&(thepage==conferenceMenuItems[x][0])) {
			document.write(' class="nounderline"');
		}
		document.write('><a href="' + conferenceMenuItems[x][3] + '"');
		if (thepage==conferenceMenuItems[x][0]) {
			document.write(' style="color: #2991f1;"');
		}
		document.write('>' + conferenceMenuItems[x][1] + '</a></li>');
		if ((conferenceMenuItems[x][2]=="y")&&(thepage==conferenceMenuItems[x][0])) {
			document.write('<div id="submenu_'+conferenceMenuItems[x][0]+'" class="submenu">');
			thisArrayName = eval(conferenceMenuItems[x][0]+"SubMenu");
			for (y=1; y<=(thisArrayName.length-1); y++) {
				document.write('<a href="'+thisArrayName[y][1]+'"');
				if (subpage==thisArrayName[y][0]) {
					document.write(' style="color: #4ba6d2;"');
				}
				
				
				document.write('>'+thisArrayName[y][2]+'</a><br />');
			}
			document.write('<div id="submenuline"></div>');
			
			document.write('</div>');
		}
		
	}
	
	if (thepage!="homepage") {
		document.write('<li><a href="http://www.yale.edu/worldfellows/index.html" target="_blank">World Fellows Home Page</a></li>');
	}
	
	document.write('</ul>');
	
	
	
}


//RETURN TO YALE MENU FUNCTIONS

returntoyalemenulength = 4;

//array to make the main menu
var returntoyaleMenuItems= new Array(returntoyalemenulength+1);
returntoyaleMenuItems[1]=new Array("overview","Overview","","Forum2011.html"); 
returntoyaleMenuItems[2]=new Array("schedule","Schedule","","Forum2011_Schedule.html"); 
returntoyaleMenuItems[3]=new Array("travel","Travel &amp; Accommodations","","Forum2011_travel.html"); 
returntoyaleMenuItems[4]=new Array("contact","Contact Us","","Forum2011_Contact.html");

//arrays to make the submenus


function MakereturntoyaleMenu(thepage,subpage) {
	
	document.write('<ul>');
	
	for (x=1; x<=returntoyalemenulength; x++) {
		document.write('<li');
		if ((returntoyaleMenuItems[x][2]=="y")&&(thepage==returntoyaleMenuItems[x][0])) {
			document.write(' class="nounderline"');
		}
		document.write('><a href="' + returntoyaleMenuItems[x][3] + '"');
		if (thepage==returntoyaleMenuItems[x][0]) {
			document.write(' style="color: #2991f1;"');
		}
		document.write('>' + returntoyaleMenuItems[x][1] + '</a></li>');
		if ((returntoyaleMenuItems[x][2]=="y")&&(thepage==returntoyaleMenuItems[x][0])) {
			document.write('<div id="submenu_'+returntoyaleMenuItems[x][0]+'" class="submenu">');
			thisArrayName = eval(returntoyaleMenuItems[x][0]+"SubMenu");
			for (y=1; y<=(thisArrayName.length-1); y++) {
				document.write('<a href="'+thisArrayName[y][1]+'"');
				if (subpage==thisArrayName[y][0]) {
					document.write(' style="color: #4ba6d2;"');
				}
				
				
				document.write('>'+thisArrayName[y][2]+'</a><br />');
			}
			document.write('<div id="submenuline"></div>');
			
			document.write('</div>');
		}
		
	}
	
	if (thepage!="homepage") {
		document.write('<li><a href="http://www.yale.edu/worldfellows/index.html" target="_blank">World Fellows Home Page</a></li>');
	}
	
	document.write('</ul>');
	
	
	
}




//SEARCH FIELD FUNCTIONS
// clear default value from field when selected
function MPClearField(field) {
	if (field.value == "World Fellows Site") { 
	field.value = '';
	}
}

// clear all defaults when form is submitted
function MPClearAll(theForm) {
  if (theForm.q.value == "World Fellows Site")
  {
	theForm.q.value = '';
    return (true);
  }
}



//SLIDING DIV FUNCTIONS
ns4 = (document.layers)? true:false;
ie4 = (document.all)? true:false;
W3C = document.getElementById ? 1 : 0;

function showSpan(thespan){
	if (ns4) {
	//doesn't work
	} else if (ie4) {
	eval("document.all."+thespan+".style.display = 'block'");
	} else if (W3C) {
		eval("document.getElementById('"+thespan+"').style.display = 'block'");
	}
}

function hideSpan(thespan){
	if (ns4) {
	//doesn't work
	} else if (ie4) {
	eval("document.all."+thespan+".style.display = 'none'");
	} else if (W3C) {
		eval("document.getElementById('"+thespan+"').style.display = 'none'");
	}
}



//HOME PAGE MAP FUNCTIONS

function mapSearch(theregion) {

	document.form1.region.value = theregion;
	document.form1.submit();

}

function preLoadAll() {
	MM_preloadImages('images/homepage/map_americas.gif');
	MM_preloadImages('images/homepage/map_africa.gif');
	MM_preloadImages('images/homepage/map_europe.gif');
	MM_preloadImages('images/homepage/map_asia-pcf.gif');
	MM_preloadImages('images/homepage/map_me-nafr.gif');
	MM_preloadImages('images/homepage/map_sc-asia.gif');
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
