// This script heavily modified from
// The JavaScript Source: http://javascript.internet.com 
// Nicola Monat-Jacobs nicola@nyu.edu

// Departmental Arrays

var CASArray =  new Array("('Select department','',true,true)",
"('Africana Studies')",
"('Ancient Studies')",
"('Anthropology')",
"('Anthropology and Classical Civilization')",
"('Anthropology and Linguistics')",
"('Asian/Pacific/American Studies')",
"('Astronomy')",
"('Biochemistry')",
"('Biology')",
"('Chemistry')",
"('Classical Civilization')",
"('Classical Civilization and Hellenic Studies')",
"('Classics-Fine Arts')",
"('Comparative Literature')",
"('Computer Science')",
"('Computer Science and Mathematics')",
"('Creative Writing')",
"('Dramatic Literature and Cinema Studies')",
"('Earth and Environmental Science')",
"('East Asian Studies')",
"('Economics')",
"('Economics and Mathematics')",
"('Education (minor)')",
"('Engineering')",
"('English and American Literature')",
"('European Studies')",
"('Fine Arts')",
"('French')",
"('French and Linguistics')",
"('German')",
"('German and Linguistics')",
"('Hebrew Language and Literature')",
"('Hellenic Studies')",
"('History')",
"('Irish Studies')",
"('Italian')",
"('Italian and Linguistics')",
"('Jewish History and Civilization')",
"('Journalism')",
"('Language and Mind')",
"('Latin American Studies')",
"('Latin/Greek')",
"('Law and Society')",
"('Linguistics and Languages')",
"('Literature in Translation')",
"('Luso-Brazilian Language and Literature')",
"('Mathematics')",
"('Medieval and Renaissance Studies')",
"('Metropolitan Studies')",
"('Middle Eastern Studies')",
"('Music')",
"('Neural Science')",
"('Philosophy')",
"('Physics')",
"('Politics')",
"('Psychology')",
"('Public Policy')",
"('Religious Studies')",
"('Romance Languages')",
"('Russian')",
"('Social Work')",
"('Sociology')",
"('Spanish')",
"('Spanish and Linguistics')",
"('Studio Art')",
"('Urban Design and Architecture Studies')",
"('West European Studies')",
"('Women s Studies')",
"('Other')");

var DentistryArray =  new Array("('Select department','',true,true)",
"('Other')");

var CourantArray =  new Array("('Select department','',true,true)",
"('Other')");

var GallatinArray =  new Array("('Select department','',true,true)",
"('Other')");

var GSASArray =  new Array("('Select department','',true,true)","('Africana Studies')",
"('American Studies')",
"('Anthropology')",
"('Basic Medical Sciences')",
"('Biology')",
"('Biomaterials Science')",
"('Biomedical Sciences')",
"('Chemistry')",
"('Cinema Studies')",
"('Classics')",
"('Comparative Literature')",
"('Computer Science')",
"('Creative Writing')",
"('Economics')",
"('English')",
"('Environmental Health Sciences')",
"('Ergonomics and Biomechanics')",
"('European Studies')",
"('Fine Arts')",
"('French')",
"('French Studies')",
"('Germanic Languages and Literatures')",
"('Hebrew and Judaic Studies')",
"('History')",
"('Humanities and Social Thought (Draper)')",
"('Italian')",
"('Journalism')",
"('Latin American and Caribbean Studies')",
"('Law and Society')",
"('Linguistics')",
"('Mathematics')",
"('Middle Eastern Studies')",
"('Museum Studies')",
"('Music')",
"('Near Eastern Studies')",
"('Neural Science')",
"('Performance Studies')",
"('Philosophy')",
"('Physics')",
"('Poetics and Theory')",
"('Politics')",
"('Psychology')",
"('Psychotherapy and Psychoanalysis')",
"('Religious Studies')",
"('Russian and Slavic Studies')",
"('Sociology')",
"('Spanish and Portuguese')",
"('Other')");

var IFAArray =  new Array("('Select department','',true,true)",
"('Other')");

var SternArray =  new Array("('Select department','',true,true)",
"('Accounting, Taxation and Business Law')",
"('Economics')",
"('Entrepreneurship and Innovation')",
"('Finance')",
"('Information, Operations, and Management Sciences')",
"('Information Systems')",
"('Operations Management')",
"('Statistics')",
"('International Business')",
"('Management and Organizational Behavior')",
"('Management Communication')",
"('Marketing')",
"('Other')");

var WagnerArray =  new Array("('Select department','',true,true)",
"('Other')");

var SCPSArray =  new Array("('Select department','',true,true)",
"('Adult Reentry Programs')",
"('Architechture, Engineering, and Construction')",
"('Arts Programs')",
"('Career, Education, and Life Planning')",
"('Design, Digital Arts, and Film')",
"('English as a Second Language')",
"('Finance and Accounting')",
"('Foreign Languages, Translation, and Interpreting')",
"('Hospitality, Tourism, and Sports Management')",
"('Humanities')",
"('Information Technology')",
"('Instructional Design and Corporate Training')",
"('International Affairs and Non-Governmental Organizations')",
"('Law, Taxation, and Paralegal Studies')",
"('Liberal Arts')",
"('Management')",
"('Marketing, Advertising, Sales, and Public Relations')",
"('Philanthropy and Fundraising')",
"('Professional Studies')",
"('Publishing')",
"('Real Estate')",
"('Writing and Speech')",
"('Other')");

var LawArray =  new Array("('Select department','',true,true)",
"('Other')");

var MedicineArray =  new Array("('Select department','',true,true)",
"('Anesthesiology')",
"('Biochemistry')",
"('Cardiac Prevention and Rehabilitation Center')",
"('Cell Biology')",
"('Dermatology')",
"('Ehrman Medical Library')",
"('Environmental Medicine')",
"('Division of Biostatistics and Epidemiology')",
"('Forensic Medicine')",
"('Medical and Molecular Parasitology')",
"('Medicine')",
"('Microbiology')",
"('Neurological Surgery')",
"('Neurology')",
"('Obstetrics and Gynecology')",
"('Orthopaedic Surgery')",
"('Ophthalmology')",
"('Otolaryngology')",
"('Pathology')",
"('Pediatrics')",
"('Pharmacology')",
"('Physiology and Neuroscience')",
"('Psychiatry')",
"('Radiation Oncology')",
"('Radiology')",
"('Rehabilitation Medicine')",
"('Surgery')",
"('Urology')",
"('Other')");

var SteinhardtArray =  new Array("('Select department','',true,true)",
"('Administration Leadership and Technology')",
"('Applied Psychology')",
"('Art and Art Professions')",
"('Culture and Communication')",
"('Division of Nursing')",
"('Health Studies')",
"('Humanities and Social Sciences')",
"('Music and Performing Arts Professions')",
"('Nutrition and Food Studies')",
"('Occupational Therapy')",
"('Physical Therapy')",
"('Speech-Language Pathology and Audiology')",
"('Teaching and Learning')",
"('Other')");

var TischArray =  new Array("('Select department','',true,true)",
"('Graduate Acting Program')",
"('Department of Dance')",
"('Department of Design for Stage and Film')",
"('Department of Drama, Undergraduate')",
"('Department of Performance Studies')",
"('Graduate Musical Theatre Writing Program')",
"('Department of Film and Television')",
"('Department of Photography')",
"('Dramatic Writing Program')",
"('Interactive Telecommunications Program')",
"('Department of Cinema Studies')",
"('IBM Digital Portfolio Laboratory')",
"('Special Programs')",
"('Department of Art and Public Policy')",
"('Other')");

var Social_WorkArray =  new Array("('Select department','',true,true)",
"('Other')");

var otherArray =  new Array("('Select department','',true,true)",
"('Other')");


//session topic & date arrays

var Setting_Up_a_Blackboard_Course_SiteArray =  new Array("('Select a date','',true,true)",
"('Tuesday, February 3, 12:00-1:00pm')",
"('Tuesday, February 17, 12:00-1:00pm')");

var Communicating_and_CollaboratingArray =  new Array("('Select a date','',true,true)",
"('Tuesday, February 10, 12:00-1:00pm')");

var Presenting_Content_and_Learning_PathsArray =  new Array("('Select a date','',true,true)",
"('Friday, February 20, 12:00-1:00pm')");

var Grading_Student_WorkArray =  new Array("('Select a date','',true,true)",
"('Friday, February 13, 12:00-1:00pm')",
"('Friday, February 27, 12:00-1:00pm')");

var Managing_Assessments_and_Student_SubmissionsArray =  new Array("('Select a date','',true,true)",
"('Friday, February 6, 12:00-1:00pm')",
"('Tuesday, February 24, 12:00-1:00pm')");


/* Changes problem type options based on role selection
function changeProbType(role) {
	//alert(role);
	var origLength = document.globe.type_request.options.length;
	if (role == 'TA' || role == 'Faculty' || role == 'Administrator') {
		//RENABLE THE FOLLOWING LINE OF CODE IF WE WANT TO OFFER TRAINING
		//document.globe.type_request.options[3] = new Option('Schedule Training','Schedule Training');
		document.globe.type_request.options[3] = null;
	}
	if (role == 'Student') {
		document.globe.type_request.options[3] = null;
	}
}
*/
// Next set of functions handle the pop-ups and automatic population 
// generated when the user selects 'Other.'

function populateCountry(inForm,selected) {
	if (selected == 'Other') {
		newCountry = "";
		while (newCountry == ""){
			newCountry=prompt ("Please enter the name of your department:", "");
		}
		if (newCountry != null) {
			inForm.country.options[(inForm.country.options.length-1)]=new Option(newCountry,newCountry,true,true);
			inForm.country.options[inForm.country.options.length]=new Option('Other, not listed','Other');
  		}
	}
	
	var selectedArray = eval(selected + "Array");
	while (selectedArray.length < inForm.country.options.length) {
		inForm.country.options[(inForm.country.options.length - 1)] = null;
	}
	for (var i=0; i < selectedArray.length; i++) {
		eval("inForm.country.options[i]=" + "new Option" + selectedArray[i]);
	}
	if (inForm.region.options[0].value == '') {
		inForm.region.options[0]= null;
		if ( navigator.appName == 'Netscape') {
			if (parseInt(navigator.appVersion) < 4) {
				window.history.go(0);
			}
		else {   	
			if (navigator.platform == 'Win32' || navigator.platform == 'Win16') {
				// window.history.go(0);
            }
         }
      }
   }
   
}

function populateUSstate(inForm,selected) {  
	if (selected == 'Other') {
		newCountry = "";
		while (newCountry == ""){
			newCountry=prompt ("Please enter the name of your department:", "");
		}
		if (newCountry != null) {
			inForm.country.options[(inForm.country.options.length-1)]=new Option(newCountry,newCountry,true,true);
			inForm.country.options[inForm.country.options.length]=new Option('Other, not listed','Other');
  		}
	}
	
	if(inForm.country.options[0].text == 'Select department') {
		inForm.country.options[0]= null;
   	}
}






function populateTopic(inForm,selected) {
	var selectedArray = eval(selected + "Array");
	while (selectedArray.length < inForm.date.options.length) {
		inForm.date.options[(inForm.date.options.length - 1)] = null;
	}
	for (var i=0; i < selectedArray.length; i++) {
		eval("inForm.date.options[i]=" + "new Option" + selectedArray[i]);
	}
	if (inForm.topic.options[0].value == '') {
		inForm.topic.options[0]= null;
		if ( navigator.appName == 'Netscape') {
			if (parseInt(navigator.appVersion) < 4) {
				window.history.go(0);
			}
		else {   	
			if (navigator.platform == 'Win32' || navigator.platform == 'Win16') {
				// window.history.go(0);
            }
         }
      }
   }
   
}

function populateDate(inForm,selected) {  
	if(inForm.date.options[0].text == 'Select a topic') {
		inForm.date.options[0]= null;
   	}
}




function makeVisible(note) {
	// this makes notes which exist in the html source, but are hidden,
	// visible. This function is called only by the drop-down menu.
	var note_div = document.getElementById(note);
	note_div.style.display = "block";
}


function closeThis(note) {
    // gets called when the user clicks to close a note
	var note_div = document.getElementById(note);
	note_div.style.display = "none";
}


function typeRequest(inForm,selected) {
	if (selected == 'Request Assistance') {
		makeVisible('help_text');
		closeThis('suggestion_text');
		closeThis('training_text');
	}
	if (selected == 'Make a Suggestion') {
		makeVisible('suggestion_text');
		closeThis('help_text');
		closeThis('training_text');
	}
	if (selected == 'Schedule Training') {
		makeVisible('training_text');
		closeThis('help_text');
		closeThis('suggestion_text');
	}
}

/*function showDefinition(def) {
	// this makes notes which exist in the html source, but are hidden,
	// visible. This function is called only by the drop-down menu.
	var def_div = document.getElementById(def);
	def_div.style.display = "block";
}

function hideDefinition(def) {
    // gets called when the user clicks to close a note
	var def_div = document.getElementById(def);
	def_div.style.display = "none";
}*/

var y1 = 50;   // change the # on the left to adjust the Y co-ordinate
(document.getElementById) ? dom = true : dom = false;

function hideIt(def) {
  if (dom) {document.getElementById(def).style.visibility='hidden';}
}

function showIt(def) {
  if (dom) {document.getElementById(def).style.visibility='visible';}
}

function placeIt() {
  if (dom && !document.all) {document.getElementById("def").style.top = window.pageYOffset + (window.innerHeight - (window.innerHeight-y1)) + "px";}
  if (document.all) {document.all["layer1"].style.top = document.documentElement.scrollTop + (document.documentElement.clientHeight - (document.documentElement.clientHeight-y1)) + "px";}
  window.setTimeout("placeIt()", 10); }




