function button_as_link(div, change) {
	
	var ele = document.getElementById(div);
	
	if(change == "yes"){
		ele.style.color = "#00F";
	} else{
		ele.style.color = "#009";
	}
	
}

function confirmSubmit(){
	var agree=confirm("Are you sure you wish to continue? \n\n This cannot be undone.");
	if (agree)
		return true ;
	else
		return false ;
}

function wordCounter(textarea, counter, minimum, maximum) {
	var wordCount = document.getElementById(counter);
	var newWordCount = 0;
	
	//Remove line breaks from string
	var temp="";
	for(i=0; i<textarea.value.length; i++){
		temp = temp + textarea.value[i].replace("\n", " ");
	}
	
	//Loop through text and count number of words
	for(i=0; i<temp.length; i++){
		
		//If next character is a word increment word count
		if(temp[i] != " " && (temp[i-1] == " " || i == 0))
			newWordCount++;
		
		//Limit number of words
		if(newWordCount > maximum){
			textarea.value = textarea.value.substring(0, i);
			if(temp[i] == " ")
				textarea.value = textarea.value.substring(0, i-1);
		}
	}
		
	//Update number of words
	if(newWordCount < maximum)
		wordCount.innerHTML = newWordCount;
	else
		wordCount.innerHTML = maximum;
	
	//Update Inner HTML Color for newWordCount
	if(newWordCount < minimum)
		wordCount.style.color="#900";
	else
		wordCount.style.color="#009";
	
}

function KeyCheckTripApps(){
	
	var KeyID = event.keyCode;
	var temp1 = document.trip_app.keyvalues1.value;
	var temp2 = document.trip_app.keyvalues2.value;
	
	if(KeyID == '17')
		document.trip_app.keyvalues1.value = KeyID;
	else if(KeyID == '16')
		document.trip_app.keyvalues2.value = KeyID;
	
	if(temp1 == '17' && KeyID == '74'){
		document.trip_app.desired_page.focus();
	}
	
	if((KeyID == '37' || KeyID == '39' || KeyID == '76' || KeyID == '83') && temp1 == '17'){
		document.trip_app.keyvalues1.value = KeyID;
		document.trip_app.submit();
	}
}

function KeyReleaseTripApps(){
	
	var KeyID = event.keyCode;
	
	if(KeyID == '17')
		document.trip_app.keyvalues1.value = "";
	else if(KeyID == '16')
		document.trip_app.keyvalues2.value = "";
	
}

function KeyCheckBoardApps(){
	
	var KeyID = event.keyCode;
	var temp1 = document.board_app.keyvalues1.value;
	var temp2 = document.board_app.keyvalues2.value;
	
	if(KeyID == '17')
		document.board_app.keyvalues1.value = KeyID;
	else if(KeyID == '16')
		document.board_app.keyvalues2.value = KeyID;
	
	if(temp1 == '17' && KeyID == '74'){
		document.board_app.desired_page.focus();
	}
	
	if((KeyID == '37' || KeyID == '39' || KeyID == '76' || KeyID == '83') && temp1 == '17'){
		document.board_app.keyvalues1.value = KeyID;
		document.board_app.submit();
	}
}

function KeyReleaseBoardApps(){
	
	var KeyID = event.keyCode;
	
	if(KeyID == '17')
		document.board_app.keyvalues1.value = "";
	else if(KeyID == '16')
		document.board_app.keyvalues2.value = "";
	
}

function highlight_checkbox(checkbox_name, form_name, always_submit){
	if(checkbox_name.checked == true || always_submit == 'Yes')
		form_name.submit();
}

function select_checkbox(checkbox_info, checkbox_name, numb_divs){
	var link_section = document.getElementById(checkbox_name+'_title');
	
	//Update color of link and 'check' in checkbox
	if(link_section.style.color == 'rgb(102, 102, 102)'){
		checkbox_info.checked = true;
		link_section.style.color = '#009';
	} else{
		checkbox_info.checked = false;
		link_section.style.color = '#666';
	}
	
	//Loop through divs related to checkbox
	for(i=1; i<=numb_divs; i++){
		var div_name = document.getElementById(checkbox_name+'_'+i);
		if(div_name != null){
			if(link_section.style.color == 'rgb(102, 102, 102)')
				div_name.style.display="none";
			else
				div_name.style.display="block";
		}
	}
}function positionInfo(object) {

  var p_elm = object;

  this.getElementLeft = getElementLeft;
  function getElementLeft() {
    var x = 0;
    var elm;
    if(typeof(p_elm) == "object"){
      elm = p_elm;
    } else {
      elm = document.getElementById(p_elm);
    }
    while (elm != null) {
      x+= elm.offsetLeft;
      elm = elm.offsetParent;
    }
    return parseInt(x);
  }

  this.getElementWidth = getElementWidth;
  function getElementWidth(){
    var elm;
    if(typeof(p_elm) == "object"){
      elm = p_elm;
    } else {
      elm = document.getElementById(p_elm);
    }
    return parseInt(elm.offsetWidth);
  }

  this.getElementRight = getElementRight;
  function getElementRight(){
    return getElementLeft(p_elm) + getElementWidth(p_elm);
  }

  this.getElementTop = getElementTop;
  function getElementTop() {
    var y = 0;
    var elm;
    if(typeof(p_elm) == "object"){
      elm = p_elm;
    } else {
      elm = document.getElementById(p_elm);
    }
    while (elm != null) {
      y+= elm.offsetTop;
      elm = elm.offsetParent;
    }
    return parseInt(y);
  }

  this.getElementHeight = getElementHeight;
  function getElementHeight(){
    var elm;
    if(typeof(p_elm) == "object"){
      elm = p_elm;
    } else {
      elm = document.getElementById(p_elm);
    }
    return parseInt(elm.offsetHeight);
  }

  this.getElementBottom = getElementBottom;
  function getElementBottom(){
    return getElementTop(p_elm) + getElementHeight(p_elm);
  }
}

function CalendarControl() {

  var calendarId = 'CalendarControl';
  var currentYear = 0;
  var currentMonth = 0;
  var currentDay = 0;

  var selectedYear = 0;
  var selectedMonth = 0;
  var selectedDay = 0;

  var months = ['January','February','March','April','May','June','July','August','September','October','November','December'];
  var dateField = null;

  function getProperty(p_property){
    var p_elm = calendarId;
    var elm = null;

    if(typeof(p_elm) == "object"){
      elm = p_elm;
    } else {
      elm = document.getElementById(p_elm);
    }
    if (elm != null){
      if(elm.style){
        elm = elm.style;
        if(elm[p_property]){
          return elm[p_property];
        } else {
          return null;
        }
      } else {
        return null;
      }
    }
  }

  function setElementProperty(p_property, p_value, p_elmId){
    var p_elm = p_elmId;
    var elm = null;

    if(typeof(p_elm) == "object"){
      elm = p_elm;
    } else {
      elm = document.getElementById(p_elm);
    }
    if((elm != null) && (elm.style != null)){
      elm = elm.style;
      elm[ p_property ] = p_value;
    }
  }

  function setProperty(p_property, p_value) {
    setElementProperty(p_property, p_value, calendarId);
  }

  function getDaysInMonth(year, month) {
    return [31,((!(year % 4 ) && ( (year % 100 ) || !( year % 400 ) ))?29:28),31,30,31,30,31,31,30,31,30,31][month-1];
  }

  function getDayOfWeek(year, month, day) {
    var date = new Date(year,month-1,day)
    return date.getDay();
  }

  this.clearDate = clearDate;
  function clearDate() {
    dateField.value = '';
    hide();
  }

  this.setDate = setDate;
  function setDate(year, month, day) {
    if (dateField) {
      if (month < 10) {month = "0" + month;}
      if (day < 10) {day = "0" + day;}

      var dateString = month+"-"+day+"-"+year;
      dateField.value = dateString;
      hide();
    }
    return;
  }

  this.changeMonth = changeMonth;
  function changeMonth(change) {
    currentMonth += change;
    currentDay = 0;
    if(currentMonth > 12) {
      currentMonth = 1;
      currentYear++;
    } else if(currentMonth < 1) {
      currentMonth = 12;
      currentYear--;
    }

    calendar = document.getElementById(calendarId);
    calendar.innerHTML = calendarDrawTable();
  }

  this.changeYear = changeYear;
  function changeYear(change) {
    currentYear += change;
    currentDay = 0;
    calendar = document.getElementById(calendarId);
    calendar.innerHTML = calendarDrawTable();
  }

  function getCurrentYear() {
    var year = new Date().getYear();
    if(year < 1900) year += 1900;
    return year;
  }

  function getCurrentMonth() {
    return new Date().getMonth() + 1;
  } 

  function getCurrentDay() {
    return new Date().getDate();
  }

  function calendarDrawTable() {

    var dayOfMonth = 1;
    var validDay = 0;
    var startDayOfWeek = getDayOfWeek(currentYear, currentMonth, dayOfMonth);
    var daysInMonth = getDaysInMonth(currentYear, currentMonth);
    var css_class = null; //CSS class for each day

    var table = "<table cellspacing='0' cellpadding='0' border='0'>";
    table = table + "<tr class='header'>";
    table = table + "  <td colspan='2' class='previous'><a href='javascript:changeCalendarControlMonth(-1);'>&lt;</a> <a href='javascript:changeCalendarControlYear(-1);'>&laquo;</a></td>";
    table = table + "  <td colspan='3' class='title'>" + months[currentMonth-1] + "<br>" + currentYear + "</td>";
    table = table + "  <td colspan='2' class='next'><a href='javascript:changeCalendarControlYear(1);'>&raquo;</a> <a href='javascript:changeCalendarControlMonth(1);'>&gt;</a></td>";
    table = table + "</tr>";
    table = table + "<tr><th>S</th><th>M</th><th>T</th><th>W</th><th>T</th><th>F</th><th>S</th></tr>";

    for(var week=0; week < 6; week++) {
      table = table + "<tr>";
      for(var dayOfWeek=0; dayOfWeek < 7; dayOfWeek++) {
        if(week == 0 && startDayOfWeek == dayOfWeek) {
          validDay = 1;
        } else if (validDay == 1 && dayOfMonth > daysInMonth) {
          validDay = 0;
        }

        if(validDay) {
          if (dayOfMonth == selectedDay && currentYear == selectedYear && currentMonth == selectedMonth) {
            css_class = 'current';
          } else if (dayOfWeek == 0 || dayOfWeek == 6) {
            css_class = 'weekend';
          } else {
            css_class = 'weekday';
          }

          table = table + "<td><a class='"+css_class+"' href=\"javascript:setCalendarControlDate("+currentYear+","+currentMonth+","+dayOfMonth+")\">"+dayOfMonth+"</a></td>";
          dayOfMonth++;
        } else {
          table = table + "<td class='empty'>&nbsp;</td>";
        }
      }
      table = table + "</tr>";
    }

    table = table + "<tr class='header'><th colspan='7' style='padding: 3px;'><a href='javascript:clearCalendarControl();'>Clear</a> | <a href='javascript:hideCalendarControl();'>Close</a></td></tr>";
    table = table + "</table>";

    return table;
  }

  this.show = show;
  function show(field) {
    can_hide = 0;
  
    // If the calendar is visible and associated with
    // this field do not do anything.
    if (dateField == field) {
      return;
    } else {
      dateField = field;
    }

    if(dateField) {
      try {
        var dateString = new String(dateField.value);
        var dateParts = dateString.split("-");
        
        selectedMonth = parseInt(dateParts[0],10);
        selectedDay = parseInt(dateParts[1],10);
        selectedYear = parseInt(dateParts[2],10);
      } catch(e) {}
    }

    if (!(selectedYear && selectedMonth && selectedDay)) {
      selectedMonth = getCurrentMonth();
      selectedDay = getCurrentDay();
      selectedYear = getCurrentYear();
    }

    currentMonth = selectedMonth;
    currentDay = selectedDay;
    currentYear = selectedYear;

    if(document.getElementById){

      calendar = document.getElementById(calendarId);
      calendar.innerHTML = calendarDrawTable(currentYear, currentMonth);

      setProperty('display', 'block');

      var fieldPos = new positionInfo(dateField);
      var calendarPos = new positionInfo(calendarId);

      var x = fieldPos.getElementLeft();
      var y = fieldPos.getElementBottom();

      setProperty('left', x + "px");
      setProperty('top', y + "px");
 
      if (document.all) {
        setElementProperty('display', 'block', 'CalendarControlIFrame');
        setElementProperty('left', x + "px", 'CalendarControlIFrame');
        setElementProperty('top', y + "px", 'CalendarControlIFrame');
        setElementProperty('width', calendarPos.getElementWidth() + "px", 'CalendarControlIFrame');
        setElementProperty('height', calendarPos.getElementHeight() + "px", 'CalendarControlIFrame');
      }
    }
  }

  this.hide = hide;
  function hide() {
    if(dateField) {
      setProperty('display', 'none');
      setElementProperty('display', 'none', 'CalendarControlIFrame');
      dateField = null;
    }
  }

  this.visible = visible;
  function visible() {
    return dateField
  }

  this.can_hide = can_hide;
  var can_hide = 0;
}

var calendarControl = new CalendarControl();

function showCalendarControl(textField) {
  // textField.onblur = hideCalendarControl;
  calendarControl.show(textField);
}

function clearCalendarControl() {
  calendarControl.clearDate();
}

function hideCalendarControl() {
  if (calendarControl.visible()) {
    calendarControl.hide();
  }
}

function setCalendarControlDate(year, month, day) {
  calendarControl.setDate(year, month, day);
}

function changeCalendarControlYear(change) {
  calendarControl.changeYear(change);
}

function changeCalendarControlMonth(change) {
  calendarControl.changeMonth(change);
}

document.write("<iframe id='CalendarControlIFrame' src='javascript:false;' frameBorder='0' scrolling='no'></iframe>");
document.write("<div id='CalendarControl'></div>");function expand_content(div, url, link_underline) {
	var ele = document.getElementById(div);
	var url = document.getElementById(url);
	
	
	if(ele.style.display == "block" || ele.style.display == "") {
    	ele.style.display = "none";
		if(link_underline == "Yes")
			url.style.textDecoration = "none";
  	}
	else {
		ele.style.display = "block";
		if(link_underline == "Yes")
			url.style.textDecoration = "underline";
	}
}	

function expand_all(a_tag, type, contentDiv, titleDiv, link_underline) {
	if (contentDiv.constructor == Array) {
		for(i=0; i < contentDiv.length; i++) {
			var ele = document.getElementById(contentDiv[i]);
			var url = document.getElementById(titleDiv[i]);
			var tag = document.getElementById(a_tag);
			
			if(tag.innerHTML == "Collapse All" || type == "collapse") {
				ele.style.display = "none";
				if(link_underline == "Yes")
					url.style.textDecoration = "none";
			} else if(tag.innerHTML == "Expand All" || type == "expand" || type == "both") {
				ele.style.display = "block";
				if(link_underline == "Yes")
					url.style.textDecoration = "underline";
			}
		}
		if(tag.innerHTML == "Collapse All" && type == "both") 
			tag.innerHTML = "Expand All";
		else if(tag.innerHTML == "Expand All" && type == "both")
			tag.innerHTML = "Collapse All";		
	}
	else {
		expand_content(contentDiv);
	}
}

function expand_trip_content(div1, div2){
	var ele1 = document.getElementById(div1);
	var ele2 = document.getElementById(div2);
	
	if(ele1.style.display == "block" || ele1.style.display == "") {
    		ele1.style.display = "none";
  	}
	else {
		ele1.style.display = "block";
	}

	if(ele2.style.display == "block" || ele2.style.display == "") {
    		ele2.style.display = "none";
  	}
	else {
		ele2.style.display = "block";
	}

}

function expand_all_trip_content(a_tag, div2, div1, type) {
	
	if (div1.constructor == Array) {
		for(i=0; i < div1.length; i++) {
			var ele1 = document.getElementById(div1[i]);
			var ele2 = document.getElementById(div2[i]);
			var tag = document.getElementById(a_tag);
			
			if(type == "collapse") {
				ele1.style.display = "none";
				ele2.style.display = "none";
			}
			else if (type == "expand"){
				ele1.style.display = "block";
				ele2.style.display = "block";
			}
		}
	}
}

function expand_contact_list(div, url, content_type) {
	var ele = document.getElementById(div);
	var url = document.getElementById(url);
	var content = document.getElementById(content_type);
	
	if(ele.style.display == "block" || ele.style.display == "") {
    	ele.style.display = "none";
		content.style.display = "none";
  	}
	else {
		ele.style.display = "block";
		content.style.display = "block";
	}
}

function swap_contact_list(content_a, content_b, title) {
	var content_a = document.getElementById(content_a);
	var content_b = document.getElementById(content_b);
	var url = document.getElementById(title);
	
	if(url.innerHTML == "View By Individual"){
    	content_a.style.display = "block";
    	content_b.style.display = "none";
		url.innerHTML = "View As List";
	}
	else if(url.innerHTML == "View As List"){
    	content_a.style.display = "none";
    	content_b.style.display = "block";
		url.innerHTML = "View By Individual";
	}
}

function swap_trip_list(content_a, content_b, title) {
	var content_a = document.getElementById(content_a);
	var content_b = document.getElementById(content_b);
	var url = document.getElementById(title);
	
	if(url.innerHTML == "View By Trip"){
    	content_a.style.display = "block";
    	content_b.style.display = "none";
		url.innerHTML = "View As List";
	}
	else if(url.innerHTML == "View As List"){
    	content_a.style.display = "none";
    	content_b.style.display = "block";
		url.innerHTML = "View By Trip";
	}
}

function display_placement_section(section, choices) {
	var div1 = document.getElementById(section);
	var div2 = document.getElementById(choices);
	
	if(div1.style.display == "block" || div1.style.display == "") {
    	div1.style.display = "none";
		div2.style.display = "none";
  	}
	else {
		div1.style.display = "block";
		div2.style.display = "block";
	}
}

function expand_placement_page(a_tag, type, contentDiv, choicesDiv) {
	if (contentDiv.constructor == Array) {
		for(i=0; i < contentDiv.length; i++) {
			var ele = document.getElementById(contentDiv[i]);
			var ele2 = document.getElementById(choicesDiv[i]);
			var tag = document.getElementById(a_tag);
			
			if(tag.innerHTML == "Collapse All" || type == "collapse") {
				ele.style.display = "none";
				ele2.style.display = "none";
			} else if(tag.innerHTML == "Expand All" || type == "expand" || type == "both") {
				ele.style.display = "block";
				ele2.style.display = "block";
			}
		}
		if(tag.innerHTML == "Collapse All" && type == "both") 
			tag.innerHTML = "Expand All";
		else if(tag.innerHTML == "Expand All" && type == "both")
			tag.innerHTML = "Collapse All";		
	}
	else {
		expand_content(contentDiv);
	}
}

function swap_content(content_a, content_b, title, text_a, text_b) {
	var content_a = document.getElementById(content_a);
	var content_b = document.getElementById(content_b);
	var url = document.getElementById(title);
	
	if(url.innerHTML == text_b){
    	content_a.style.display = "block";
    	content_b.style.display = "none";
		url.innerHTML = text_a;
	}
	else if(url.innerHTML == text_a){
    	content_a.style.display = "none";
    	content_b.style.display = "block";
		url.innerHTML = text_b;
	}
}

function swap_divs(content_a, content_b, title, text_a, text_b) {
	var content_a = document.getElementById(content_a);
	var content_b = document.getElementById(content_b);
	var url = document.getElementById(title);
	
	if(url.innerHTML == text_b){
    	content_a.style.display = "block";
    	content_b.style.display = "none";
		url.innerHTML = text_a;
	}
	else if(url.innerHTML == text_a){
    	content_a.style.display = "none";
    	content_b.style.display = "block";
		url.innerHTML = text_b;
	}
}

function select_divs(show_div, div1, div2, div3, div4) {
	var div1 = document.getElementById(div1);
	var div2 = document.getElementById(div2);
	var div3 = document.getElementById(div3);
	var div4 = document.getElementById(div4);
	
	if(show_div == 1){
    	div1.style.display = "block";
    	div2.style.display = "none";
    	div3.style.display = "none";
    	div4.style.display = "none";
	}
	else if(show_div == 2){
    	div1.style.display = "none";
    	div2.style.display = "block";
    	div3.style.display = "none";
    	div4.style.display = "none";
	}
	else if(show_div == 3){
    	div1.style.display = "none";
    	div2.style.display = "none";
    	div3.style.display = "block";
    	div4.style.display = "none";
	}
	else if(show_div == 4){
    	div1.style.display = "none";
    	div2.style.display = "none";
    	div3.style.display = "none";
    	div4.style.display = "block";
	}
}

var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));

var pageTracker = _gat._getTracker("UA-6260321-1");
pageTracker._trackPageview();function ie_alert(){
	
	alert("Your current version of Internet Explorer is no longer supported.\n\nYou can still navigate our site, but full functionality is not gauranteed.\n\nCurrent support for Internet Explorer includes versions 7 and above.\n\nPlease upgrade your current version of Internet Explorer or switch to another browser.\n");
	
}function submit_form(form_name, object_name){
	
	document.form[0].submit();
	
}var revert = new Array();
var inames = new Array('asblogo2','menuheader_b');

if (document.images) {
  var flipped = new Array(inames.length);
  for(i=0; i< 3; i++) {
    flipped[i] = new Image();
    if(i == 0)
		flipped[i].src = "/_resources/_images/menu_logo_b.gif";
	if(i == 1)
		flipped[i].src = "/_resources/_images/menu_active_b.gif";
  }
}

function over(num) {
  if(document.images) {
    revert[num] = document.images[inames[num]].src;
    document.images[inames[num]].src = flipped[num].src;
  }
}
function out(num) {
  if(document.images)
  	document.images[inames[num]].src = revert[num]; 
}function update_trip_list(option_list_name, name_list, issue_list, divider_list, wrapper_list){
	
	var name_list_array = name_list.split(", ");
	var issue_list_array = issue_list.split(", ");
	var divider_list_array = divider_list.split(", ");
	var wrapper_list_array = wrapper_list.split(", ");
		
	var obj = document.getElementById(option_list_name);
	var index = obj.selectedIndex;
	var value = obj.options[index].value;
	
	//Loop through list of trips
	for(x=0; x<name_list_array.length; x++){
		
		var name = document.getElementById(name_list_array[x]);
		var issue = document.getElementById(issue_list_array[x]);
		
		//Split string to determine which season(s) trip is on
		var temp = name_list_array[x].split("___");
		
		//alert(x+"\n"+temp.length);
		
		//Check to see if current trip is 'in season' / listed to show
		for(i=0; i < temp.length; i++){
			
			//alert(x+"\n"+value+" = "+temp[i]);
			
			if(temp[i] != 'name' && temp[i] != 'issue'){
				if(temp[i] == value || value == "entire"){
					name.style.display = "block";
					issue.style.display = "block";
					//alert(x);
				} else{
					test = temp[i].split("_");
					if(test.length != 1 || temp[i] == 'none'){
						name.style.display = "none";
						issue.style.display = "none";
					}
				}
			}
		}
	}
	
	//Check to see if issue section is empty [and 'hide' section wrapper and divider if empty]
	var issue_cnt = 0;
	var last_wrapper = "";
	var z = "";
	var issue = "";
	for(y=0; y<=wrapper_list_array.length; y++){
						
		//var name = document.getElementById(name_list_array[y]);
		issue = document.getElementById(issue_list_array[y]);
		
		//If change in ISSUE:  update wrapper and divider 'display'
		if(last_wrapper != wrapper_list_array[y] && y >= 1 || y == wrapper_list_array.length){
			
			wrapper = document.getElementById(wrapper_list_array[y-1]);
			divider = document.getElementById(divider_list_array[y-1]);
			
			if(issue_cnt == 0){
				wrapper.style.display = "none";
				divider.style.display = "none";
			} else{
				wrapper.style.display = "block";
				divider.style.display = "block";
			}
			
			issue_cnt = 0;
			
		}
		
		//Check to see display setting of current object/name
		if(issue.style.display == "block")
			issue_cnt++;
		
		//Record name of current wrapper
		last_wrapper = wrapper_list_array[y];
	}
}function expand_menu_editor(tag, type, occurence, list, max_list_size) {
	
	//Generate arra from data passed to function
	list = list.split(", ");
	
	//Initialize variables utilized by for loop
	var short_list = 0;
	var old_short_list = 0;
	var new_short_list = 0;
	var long_list = 0;
	var old_long_list = 0;
	var new_long_list = 0;
	
	//Update variable values with Cookie values
	if(getCookie('short_list') != "")
		old_short_list = getCookie('short_list');
	if(getCookie('long_list') != "")
		old_long_list = getCookie('long_list');
	
	//Loop through list of numbers
	for(i="0"; i < list.length; i++) {
		
		//Get elements in document
		var wrapper = document.getElementById("title_wrapper_"+list[i]);
		var title = document.getElementById("title_"+list[i]);
		var expand = document.getElementById("expand_"+list[i]);
		var short_details = document.getElementById("short_"+list[i]);
		var long_details = document.getElementById("long_"+list[i]);
		
		//If expanding/collpasing long
		if(tag == "expand_long" || tag == "collapse_long" || occurence == "single_long"){
			
			//Expand/Contract all details
			if((long_details.style.display == "block" || long_details.style.display == "") && type== "both" || type == "collapse") {
				long_details.style.display = "none";
				new_long_list = eval(new_long_list) - 1;
			} else {
				long_details.style.display = "block";
				new_long_list = eval(new_long_list) + 1;
			}
			
			//Change title
			if((expand.style.display == "block" || expand.style.display == "") && type == "both" || type == "expand"){
				//wrapper.style.display = "none";
				title.style.color = "#999";
				expand.style.display = "none";
				if(short_details.style.display == "block"){
					short_details.style.display = "none";
					new_short_list = eval(new_short_list) - 1;
				}
			} else {
				//wrapper.style.display = "block";
				title.style.color = "#009";
				expand.style.display = "block";
				expand.style.float = "right";
				expand.innerHTML = "&gt;&gt;";
				short_details.style.display = "none";
			}
			
		}
		
		//If expanding/collapsing short
		else if(tag == "expand_short" || tag == "collapse_short" || occurence == "single_short"){
			//Only expand short details if long details not already shown
			if(long_details.style.display == "none" || long_details.style.display == ""){
				//Expand/Contract short details
				if((short_details.style.display == "block" || short_details.style.display == "") && type == "both" || type == "collapse") {
					short_details.style.display = "none";
					new_short_list = eval(new_short_list) - 1;
				} else {
					short_details.style.display = "block";
					new_short_list = eval(new_short_list) + 1;
				}
				
				//Flip expand short details arrow
				if(expand.innerHTML == "&gt;&gt;" && type == "both" || type == "expand")
					expand.innerHTML = "&lt;&lt;";
				else if(expand.innerHTML == "&lt;&lt;" && type == "both" || type == "collapse")
					expand.innerHTML = "&gt;&gt;";
			}
		}
	}
	
	//Update short_list value
	if(tag == "expand_long" || (tag == "collapse_long" || tag == "collapse_short")){
		short_list = 0;
	} else if(tag == "expand_short"){
		short_list = new_short_list;
	} else{
		if(old_short_list != "")
			short_list = eval(new_short_list) + eval(old_short_list);
		else
			short_list = new_short_list;
	}
	
	//Update long_list value
	if(tag == "collapse_long"){
		long_list = 0;
	} else if(tag == "expand_long"){
		long_list = new_long_list;
	} else{
		if(old_long_list != "")
			long_list = eval(new_long_list) + eval(old_long_list);
		else
			long_list = new_long_list;
	}
	
	//Note total expanded
	total_expanded = eval(long_list) + eval(short_list);
	
	//Update cookie values
	setCookie('short_list', short_list, 365);
	setCookie('long_list', long_list, 365);
	
	//Get 'plus_minu' data
	var url = document.getElementById('plus_minus');
	
	//Get tag data
	var tag_exp_long =  document.getElementById('expand_long');
	var tag_col_long =  document.getElementById('collapse_long');
	var tag_exp_short =  document.getElementById('expand_short');
	var tag_col_short =  document.getElementById('collapse_short');
	
	//Set tag color / display info based for "expand_long"
	if(tag == "expand_long" || max_list_size == long_list){
		tag_exp_long.style.color = "#999";
		url.style.display = "none";
	} else{
		tag_exp_long.style.color = "#009";
		url.style.display = "block";
	}
	
	//Set tag color / display info based for "collapse_long"
	if(tag == "collapse_long" || long_list == 0){
		tag_col_long.style.color = "#999";
	} else{
		tag_col_long.style.color = "#009";
	}
	
	//Set tag color / display info based for "expand_short"
	if(tag == "expand_short" || max_list_size == total_expanded)
		tag_exp_short.style.color = "#999";
	else
		tag_exp_short.style.color = "#009";
	
	//Set tag color / display info based for "collapse_short"
	if(tag == "collapse_short" || tag == "collapse_long" || short_list == 0)
		tag_col_short.style.color = "#999";
	else
		tag_col_short.style.color = "#009";
	
}function setCookie(c_name,value,expiredays){
	var exdate=new Date();
	exdate.setDate(exdate.getDate()+expiredays);
	document.cookie=c_name+ "=" +escape(value)+
	((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}

function getCookie(c_name){
	if (document.cookie.length>0){
		c_start=document.cookie.indexOf(c_name + "=");
		if (c_start!=-1){
			c_start=c_start + c_name.length+1;
			c_end=document.cookie.indexOf(";",c_start);
			if (c_end==-1) c_end=document.cookie.length;
				return unescape(document.cookie.substring(c_start,c_end));
		}
	}
	return "";
}function createDiv(parentNmae, divName){
	
	var parentNodeInfo = document.getElementById(parentNmae);
	
	var divTag = document.createElement("div");
	
	divTag = addTextarea(divTag, divName);
	
	parentNodeInfo.appendChild(divTag);
	
}


function removeDiv(divName){
	
	var parentNodeInfo = document.getElementById(divName);
	
	parentNodeInfo.parentNode.removeChild(parentNodeInfo);
	
}



function addTextarea(divTag, divName){
	
	divTag.id = divName;
	
	//divTag.setAttribute("align","left");
	
	//divTag.style.margin = "0px auto";
	
	//divTag.className ="dynamicDiv";
	
	divTag.innerHTML = "This <b>HTML Div tag</b> is created using Javascdript DOM dynamically.";
		
	
	
	
	
	//var url="g";
	//divTag.innerHTML = url;
	
	
	
	
	
	return divTag;
	
}


/* Below conatins the functions in use on the 'display survey results' page. */
//This function selects which survey to view.
function parseSurveyResults(survey_size, eventType, prevInfo, nextInfo){
	
	//Get Info on current value in drop down list
	var obj = document.getElementById('current_survey');
	var index = obj.selectedIndex;
	var currentSurvey = obj.options[index].value;
	
	//Determine Previous/Next numbers based on currentNumb
	if(eventType == "previous" || eventType == "next"){
		//Determine current number of selected survey from currentSurvey
		var temp_array = currentSurvey.split("_");
		var currentNumb = temp_array[1];
		var prevNumb = (currentNumb)*1-1;
		var nextNumb = (currentNumb)*1+1;
	}
	
	//Loop through all surveys and select survey to display
	for(i=0, j=1; i<survey_size; i++, j++){
		
		//Get Info on current survey response
		var temp = 'survey_' + j;
		var surveyResponse = document.getElementById(temp);
		
		//Update which survey can be viewed
		if(j == prevNumb && eventType == "previous"){
			obj.selectedIndex = i;
			surveyResponse.style.display="block";
			newlySelectedSurvey = temp;
		} else if(j == nextNumb && eventType == "next"){
			obj.selectedIndex = i;
			surveyResponse.style.display="block";
			newlySelectedSurvey = temp;
		} else if(temp == currentSurvey && eventType == "current_survey"){
			surveyResponse.style.display="block";
			newlySelectedSurvey = temp;
		} else{
			surveyResponse.style.display="none";
		}
	}
	
	//Determine name of maximum suvery in survey list
	maxSurvey = "survey_" + survey_size;
	
	//Update 'disable' setting on next and previous buttons
	if(newlySelectedSurvey == "survey_1"){
		prevInfo.disabled=true;
		nextInfo.disabled=false;
	} else if(newlySelectedSurvey == maxSurvey){
		prevInfo.disabled=false;
		nextInfo.disabled=true;
	} else{
		prevInfo.disabled=false;
		nextInfo.disabled=false;
	}
}

//This function swaps between 'view summary of surveys' and 'view individual survey'.
function swapSurveyView(type){
	
	var summaryInfo = document.getElementById("display_summary");
	var summaryWrapper = document.getElementById("summary_wrapper");
	var individualInfo = document.getElementById("display_individual");
	var individualWrapper = document.getElementById("individual_wrapper");
	
	if(type == "summary"){
		summaryInfo.style.display = "block";
		summaryWrapper.style.display = "none";
		individualInfo.style.display = "none";
		individualWrapper.style.display = "block";
	} else if(type == "individual"){
		summaryInfo.style.display = "none";
		summaryWrapper.style.display = "block";
		individualInfo.style.display = "block";
		individualWrapper.style.display = "none";
	}
}

//This function expands a response that requires a "scroll"
function expandScrollList(wrapper, wrapper_link, outer_wrapper, resetFlag){
	
	var div = document.getElementById(wrapper);
	//var wrapper = document.getElementById(outer_wrapper);
	var url = document.getElementById(wrapper_link);
	
	if(div.offsetHeight < 500 && resetFlag == "initial_reset"){
		url.innerHTML = "";
	} else if(resetFlag != "initial_reset" && resetFlag != "expand" && resetFlag != "collapse"){
		
		if(div.offsetHeight >= 500 && url.innerHTML == "Expand View"){
			div.style.overflow = "visible";
			//wrapper.style.marginRight = "8px";
			url.innerHTML = "Collapse View";
		} else{
			div.style.overflow = "auto";
			//wrapper.style.marginRight = "0px";
			url.innerHTML = "Expand View";
		}
	} else{
		
		if(div.offsetHeight >= 500 && url.innerHTML == "Expand View" && resetFlag == "expand"){
			div.style.overflow = "visible";
			//wrapper.style.marginRight = "8px";
			if(url.innerHTML == "Expand View")
				url.innerHTML = "Collapse View";
		} else if(resetFlag == "collapse"){
			div.style.overflow = "auto";
			//wrapper.style.marginRight = "0px";
			if(url.innerHTML == "Collapse View")
				url.innerHTML = "Expand View";
		} else if(resetFlag == "initial_reset"){
			//if(url.innerHTML == "Expand View")
				//wrapper.style.marginRight = "0px";
		}
	}
}

//This function expands/collapses all response fields on a page
function expandScrollList_ALL(numbFields){
	
	var linkName = document.getElementById("expandAll");
	
	if(linkName.innerHTML == "Expand All Summary Responses"){
		linkName.innerHTML = "Collapse All Summary Responses";
		var resetFlag = "expand";
	} else{
		linkName.innerHTML = "Expand All Summary Responses";
		var resetFlag = "collapse";
	}
	
	for(i=1; i<=numbFields; i++){
		expandScrollList("questionWrapper_" + i, "questionWrapperTitle_" + i, "outer_wrapper_" + i, resetFlag);
	}
}

//This function checks to see if there is anything to expand/collapse on summary page
function checkSummaryLengths(numbFields){
	
	var expandedTextNeeded = "No";
	
	for(i=1; i < numbFields; i++){
		
		var div = document.getElementById("questionWrapper_" + i);
		
		if(div.offsetHeight >= 500)
			expandedTextNeeded = "Yes";
		
	}
	
	if(expandedTextNeeded == "No"){
		var temp = document.getElementById("expandAll");
		temp.innerHTML = "";
	}
	
}