//PageCodes for Events in PostGrads as new ones are added you must add the page codes here
var eventID = "";
var cityID = "";

function showDiv(id) {
 if (pageType=="faq"){
 
 	document.getElementById('completetext' + id).style.display=(document.getElementById('completetext' + id).style.display!="none")? "none" : ""
	matchDivHeights();
 }
 else{
	document.getElementById('summary' + id).style.display=(document.getElementById('summary' + id).style.display!="none")? "none" : ""
	document.getElementById('completetext' + id).style.display=(document.getElementById('completetext' + id).style.display!="none")? "none" : ""
	document.getElementById('readmore' + id).style.display=(document.getElementById('readmore' + id).style.display!="none")? "none" : ""
	document.getElementById('close' + id).style.display=(document.getElementById('close' + id).style.display!="none")? "none" : ""
	matchDivHeights();

	}
}


function showHideBio(bioID, onOff){
	document.getElementById(bioID).style.display=(document.getElementById(bioID).style.display!="none")? "none" : "";
	document.getElementById('bioLink'+ bioID).style.display=(document.getElementById('bioLink'+ bioID).style.display!="none")? "none" : "";
	matchDivHeights();
}



function matchDivHeights(){
	var contentHeight = window.document.getElementById('lmcontent').offsetHeight;
	var navHeight = window.document.getElementById('lmsidenav').offsetHeight;
	if (contentHeight > navHeight){
		window.document.getElementById('lmsidenav').style.height = contentHeight + 'px';
	}
	if (navHeight > contentHeight){
		window.document.getElementById('lmcontent').style.height = navHeight + 'px';
	}
}







function showAll(numOfItems) {
 if (pageType=="faq"){
 	for (id=1;id<=numOfItems;id=id+1){
		document.getElementById('completetext' + id).style.display="";
 		document.getElementById('hideShowLink').innerHTML = "<a href=\"javascript:hideAll(expandingDivsNum);matchDivHeights();\">[-] Hide All</a>"
 	}
 }
 
 else {
	for (id=1;id<=numOfItems;id=id+1) 
		{
   			document.getElementById('summary' + id).style.display="none";
			document.getElementById('completetext' + id).style.display="";
			document.getElementById('readmore' + id).style.display="none";
			document.getElementById('close' + id).style.display="";
			document.getElementById('hideShowLink').innerHTML = "<a href=\"javascript:hideAll(expandingDivsNum);matchDivHeights();\">[-] Hide All</a>"
		}
	}
}


function hideAll(numOfItems) {
	if (pageType=="faq"){
		for (id=1;id<=numOfItems;id=id+1){
			document.getElementById('completetext' + id).style.display="none";
			document.getElementById('hideShowLink').innerHTML = "<a href=\"javascript:showAll(expandingDivsNum);matchDivHeights();\">[+] Show All</a>"
			}
		}

	else {
		for (id=1;id<=numOfItems;id=id+1) 
			{
   				document.getElementById('summary' + id).style.display="";
				document.getElementById('completetext' + id).style.display="none";
				document.getElementById('readmore' + id).style.display="";
				document.getElementById('close' + id).style.display="none";
				document.getElementById('hideShowLink').innerHTML = "<a href=\"javascript:showAll(expandingDivsNum);matchDivHeights();\">[+] Show All</a>"
			}
		}
	}


function lmMenuHelper(mode){

	if(mode=="city"){
		dropDownValue = document.getElementById("cityList").options[document.getElementById("cityList").options.selectedIndex].value;
		self.location = "../"+dropDownValue;
	}
	if(mode=="reg"){
		var regURL = "http://pgnet.stanford.edu/goto/event" + eventID + "reg";
		self.location = regURL;
	}
	if(mode=="who"){
		var whoURL= "http://pgnet.stanford.edu/goto/event" + eventID + "who";
		self.location = whoURL;
	}
	if(mode=="logoLink"){
		var logoURL= "http://leadingmatters.stanford.edu/" + cityID;
		self.location = logoURL;
	}
}


function setEventID(){

	var str = self.location.toString();

	if(str.match('seattle')=='seattle'){
		eventID='3862';
		cityID='seattle';
	}
	if(str.match('san_diego')=='san_diego'){
		eventID='3863';
		cityID='san_diego';
	}
	if(str.match('hong_kong')=='hong_kong'){
		eventID='3864';
		cityID='hong_kong';
	}
	if(str.match('dallas_ftworth')=='dallas_ftworth'){
		eventID='3865';
		cityID='dallas_ftworth';
	}
	if(str.match('los_angeles')=='los_angeles'){
		eventID='3866';
		cityID='los_angeles';
	}
	if(str.match('london')=='london'){
		eventID='3867';
		cityID='london';
	}
	if(str.match('san_francisco')=='san_francisco'){
		eventID='3868';
		cityID='san_francisco';
	}
	if(str.match('new_york')=='new_york'){
		eventID='3869';
		cityID='new_york';
	}
	if(str.match('washington')=='washington'){
		eventID='3870';
		cityID='washington';
	}
	if(str.match('shanghai')=='shanghai'){
		eventID='3871';
		cityID='shanghai';
	}
	if(str.match('peninsula')=='peninsula'){
		eventID='3872';
		cityID='peninsula';
	}
	if(str.match('chicago')=='chicago'){
		eventID='3873';
		cityID='chicago';
	}
	if(str.match('orange_county')=='orange_county'){
		eventID='3874';
		cityID='orange_county';
	}
	if(str.match('houston')=='houston'){
		eventID='3876';
		cityID='houston';
	}
	if(str.match('portland')=='portland'){
		eventID='3877';
		cityID='portland';
	}
	if(str.match('tokyo')=='tokyo'){
		eventID='3878';
		cityID='tokyo';
	}
        if(str.match('denver')=='denver'){
                eventID='3879';
                cityID='denver';
	}
	if(str.match('boston')=='boston'){
                eventID='3880';
                cityID='';
        }
	if(str.match('singapore')=='singapore'){
                eventID='3881';
                cityID='singapore';
        }
	if(str.match('taipei')=='taipei'){
                eventID='3882';
                cityID='taipei';
        }
}

function createCityList(){
	document.writeln("<FORM NAME=\"selectCity\">");
	document.writeln("<select name=\"cityList\" id=\"cityList\" onChange=\"lmMenuHelper(\'city\');\">");
	document.writeln("<option value=\"\" selected=\"selected\">Choose a different city");
	document.writeln("<option value=\"peninsula\">Bay Area");
	document.writeln("<option value=\"boston\">Boston");
	document.writeln("<option value=\"chicago\">Chicago");
	document.writeln("<option value=\"dallas_ftworth\">Dallas/Ft. Worth");
	document.writeln("<option value=\"denver\">Denver");
	document.writeln("<option value=\"hong_kong\">Hong Kong");
	document.writeln("<option value=\"houston\">Houston");
	document.writeln("<option value=\"london\">London");
	document.writeln("<option value=\"los_angeles\">Los Angeles");
	document.writeln("<option value=\"new_york\">New York");
	document.writeln("<option value=\"orange_county\">Orange County");
	document.writeln("<option value=\"portland\">Portland");
	document.writeln("<option value=\"san_diego\">San Diego");
	document.writeln("<option value=\"san_francisco\">San Francisco");
	document.writeln("<option value=\"seattle\">Seattle");
	document.writeln("<option value=\"singapore\">Singapore");
        document.writeln("<option value=\"taipei\">Taipei");
	document.writeln("<option value=\"tokyo\">Tokyo");
	document.writeln("<option value=\"washington_dc\">Washington D.C.");
	document.writeln("</select>");
}

