function setFirstFocus() {
    var str = document.URL;
    // if we don't find a # which indicates going to an anchor in the page then go ahead and set focus.
    if (str.indexOf("#") < 0) {
        if (str.indexOf("page=") >= 0) {
            document.location = document.location + '#relevantListingsAnchor';
        } else {
            document.ia_public.elements["searchString"].focus();
        }
    }
}

function goHome() {
    document.ia_public.searchString.value='';
    document.ia_public.sortByPostalCode.value='';

    if(document.getElementById("communityImage") != null){
        document.getElementById("communityImage").style.display = 'none';
    }

    document.getElementById("refineYourSearch").style.display = 'none';
    document.getElementById("relevantListingsAndRHS").style.display = 'none';

    if(document.getElementById("postalCodeValidationMessage") != null){
        document.getElementById("postalCodeValidationMessage").style.display = 'none';
    }

    document.getElementById("errorMessageSection").style.display = 'none';

    if(document.getElementById("spellingSuggestionList") != null){
        document.getElementById("spellingSuggestionList").style.display = 'none';
    }

    if(document.getElementById("youSelected") != null){
        document.getElementById("youSelected").style.display = 'none';
    }

    setFirstFocus();
}

    function clearAll() {
        document.ia_public.searchString.value='';
        document.ia_public.limitByCity.value='';
        document.ia_public.sortByPostalCode.value='';
        $('searchResultContentWrapper').style.display = 'none';
        $('spacerForClearAll').style.display = 'block';
    }

function fadeToOpacity(element, opacity) {
    element = $(element);
    var oldOpacity = element.getInlineOpacity();
    var options = Object.extend({
        from: element.getOpacity() || 1.0,
        to:   opacity,
        afterFinishInternal: function(effect) {
            if (effect.options.to == 0) {
                effect.element.hide();
                effect.element.setStyle({opacity: oldOpacity});
            }
        }}, arguments[1] || {});
    return new Effect.Opacity(element, options);
}

function getPositionOfElement(el) {
    var SL = 0, ST = 0;
    var is_div = /^div$/i.test(el.tagName);
    if (is_div && el.scrollLeft)
        SL = el.scrollLeft;
    if (is_div && el.scrollTop)
        ST = el.scrollTop;
    var r = { x: el.offsetLeft - SL, y: el.offsetTop - ST };
    if (el.offsetParent) {
        var tmp = this.getPositionOfElement(el.offsetParent);
        r.x += tmp.x;
        r.y += tmp.y;
    }
    return r;
}

function floatTheTableDiv() {
    var floatLinkVariable = $('floatLink');
    var floatTableDivVariable = $('floatTableDiv');
    var allContent = $('allContentWrapperDiv');

    // get position of the link
    var pos = getPositionOfElement(floatLinkVariable);

    floatTableDivVariable.style.left = (pos.x - 100) + "px";
    floatTableDivVariable.style.top =  (pos.y - 100) + "px";

    new Effect.Appear(floatTableDivVariable, { duration: 3.0 });
    fadeToOpacity(allContent, 0.2);
}

function popUpSOLDefinition(url) {
	newwindow = window.open(url,'name','height=150,width=350');
    newwindow.moveTo(0,0);
    if (window.focus) {newwindow.focus()}
	return false;
}

function popUpTaxonomyDefinition(url) {
	newwindow = window.open(url,'name','scrollbars=1,height=520,width=700');
    newwindow.moveTo(0,0);
    if (window.focus) {newwindow.focus()}
	return false;
}

function popUpTaxonomyDefinitionUsingId(taxId) {
	var url = "../../public/common/taxonomyDefinition.do?taxonomyQueryId=" + taxId;
	newwindow = window.open(url,'name','scrollbars=1,height=520,width=700');
    newwindow.moveTo(0,0);
    if (window.focus) {newwindow.focus()}
    	$(taxId.toString()).style.color = getCSSElement('.visitedTaxonomyDefinition').style.color;
	return false;
}

function popUpPrintPage(url) {
	newwindow = window.open(url,'name','scrollbars=1,height=850,width=990,status=1,menubar=1,toolbar=1,resizable=1');
    newwindow.moveTo(0,0);
    if (window.focus) {newwindow.focus()}
	return false;
}

function targetopener(mylink, closeme, closeonly)
{
    if (! (window.focus && window.opener))return true;
    window.opener.focus();
    if (! closeonly)window.opener.location.href = mylink.href;
    if (closeme)window.close();
    return false;
}

function getBackgroundColor( element) {
    return getCSSElement(element).style.backgroundColor;
}

function getCSSElement( element) {
    var rules = document.styleSheets.item(0);
    rules = rules.cssRules || rules.rules;
    for (var i = 0; i < rules.length; i++) {
//                if (rules.item(i).selectorText.substr(0,1) == "."){
//                    alert(rules.item(i).selectorText);
//                }
        if (rules.item(i).selectorText == element) {
            return rules.item(i);
        }
    }
    return 'ElementNotFound';
}

function makeAppear(elementName) {
    if ($(elementName).style.display == 'none') {
        Effect.Appear(elementName);
    }
}

function showHide(elementName) {
    if ($(elementName).style.display == 'none') {
        set_cookie_tab(elementName,1,30);
        $(elementName).style.display = 'block'
//        Effect.Appear(elementName);
    }
    else {
        set_cookie_tab(elementName,0,30);
        $(elementName).style.display = 'none'
//        Effect.Fade(elementName);
    }
}

function show(elementName) {
    set_cookie_tab(elementName,1,30);
    $(elementName).style.display = 'block'
//    Effect.Appear(elementName);
}

function hide(elementName) {
    set_cookie_tab(elementName,0,30);
    $(elementName).style.display = 'none'
//    Effect.Fade(elementName);
}

// onload {
//  findElementsByClass(hidable);
//  foreach (hidable) {
// var showHide = read_cookie(elementName);
//  if (showHide == 1) {
//    show(elementName);
// }
//else {
//    hide(elementName);
//}


function set_cookie_tab(name,value,days) {
    if( days ) {
        var date = new Date() ;
        date.setTime(date.getTime()+(days*24*60*60*1000));
        var expires = " ; expires="+date.toGMTString();
    }

    else {
        var expires = "";
    }
    document.cookie = name+"="+value+expires+"; path=/" ;
}

function read_cookie_tab(name) {
    var cookieName = name + "=" ;
    var ca = document.cookie.split(';') ;
    for (var i = 0; i < ca.length; i++) {
        var c = ca[i];
        while (c.charAt(0) == ' ') c = c.substring(1, c.length);

        if (c.indexOf(cookieName) == 0) return c.substring(cookieName.length, c.length);
    }
}


function plus(elementName) {
    if($(elementName).src.match('icon_plus.gif')){
        set_cookie_tab(elementName,1,30);
        $(elementName).src = '../../images_public/ia_style/icon_min.gif';
    }
}

function minus(elementName) {
    if ($(elementName).src.match('icon_min.gif')) {
        set_cookie_tab(elementName,0,30);
        $(elementName).src = '../../images_public/ia_style/icon_plus.gif';
    }
}

function plusMinus(elementName) {
    if($(elementName).src.match('icon_plus.gif')){
        set_cookie_tab(elementName,1,30);
        $(elementName).src = '../../images_public/ia_style/icon_min.gif';
    }
    else {
        set_cookie_tab(elementName,0,30);
        $(elementName).src = '../../images_public/ia_style/icon_plus.gif';
    }
}

function plusMinusSmall(elementName) {
   plusMinus(elementName);
}



// ###############################
// Show Hide Javascript section
// ###############################


function highlightHeading(elementName) {
    $(elementName).style.backgroundColor = '#fafad2';
}

function unhighlightHeading(elementName) {
    $(elementName).style.backgroundColor = '#a9bfbd';
}

function unhighlightHeadingForLists(elementName) {
    $(elementName).style.backgroundColor = '#f0d456';
}

function onloadPopulateHintText() {
            hintForInputBox('searchBoxClass','eg: cancer');
            hintForInputBox('postalCodeBoxClass','eg: T2S 0G1');
            //hintForInputBox('cityComboBox','eg: Calgary');
            hintForInputBox('cityBoxClass','eg: Calgary');
}

function hintForInputBox(id, hintText)
{
	if (id == 'cityComboBox'){
		dojo.byId(id).value=hintText;
    	dojo.byId(id).style.color='#999999';
	} else {
	    var theElement = getElementsByClassName(id);
	    if (theElement[0].value == '' || theElement[0].value == 'undefined' || theElement[0].value == hintText ) {
	        theElement[0].style.color = '#999999';
	        theElement[0].value = hintText;
	    }
	}
}

function clearHint(id) {
	if (id == 'cityComboBox'){
    	if (dojo.byId(id).value.substring(0, 3) == 'eg:') {
	        dojo.byId(id).style.color = '#000000';
	        dojo.byId(id).value = '';
	    }
    } else {
	    var theElement = getElementsByClassName(id);
	    if (theElement[0].value.substring(0, 3) == 'eg:') {
	        theElement[0].style.color = '#000000';
	        theElement[0].value = '';
	    }
	}
}

function clearAllHintValues() {
    var what = getElementsByClassName('searchBoxClass');
    var postal = getElementsByClassName('postalCodeBoxClass');
    //var where = getElementsByClassName('cityComboBox');
    var where = getElementsByClassName('cityBoxClass');

    removeHintTextWhenAppropriate(what);
    removeHintTextWhenAppropriate(postal);
    removeHintTextWhenAppropriate(where);
}

function removeHintTextWhenAppropriate(anElement) {
	if (anElement == 'cityComboBox'){
		dojo.byId(anElement).style.color = '#000000';
	    dojo.byId(anElement).value = '';
	}
    if (anElement[0].value.substring(0, 3) == 'eg:') {
        anElement[0].style.color = '#000000';
        anElement[0].value = '';
    }
}

function submitAndPopupWindow()
{
    popupWindow('initialize_SelectOrganizationGeoArea.do', 'orgGeoArea', 800, 700);
}


function confirmDelete(isDirSpecialistOrHigher, url) {
    var message = "Are you sure you want to Delete this List? Once deleted, your list will no longer be available to you. Click OK to delete.";

    if(isDirSpecialistOrHigher){message = "Are you sure you want to Delete this? If this item is published Internally or Globally it will no longer remain published. Click OK to delete.";}

    if(confirm(message))
    {
         window.location = url;
    }
}

function loadDirectoryPageElements() {
//    this.directoryToggleElementsHash = $H();
//    this.directoryToggleChildElementsHash = $H();
//    this.directoryToggleElementsLevelHeadingsHash = $H();

    var allLevels = getElementsByClassName("expandLevelLists");
    var allChildLevels = getElementsByClassName("expandChildLevel");
    var allLevelsHeadings = getElementsByClassName("expander");

    var levelId;
    var childLevelId;
    var levelHeadingId;

    // Top Level Divs (under each main heading)
    for (var i = 0; i < allLevels.length; i++) {
        levelId = allLevels[i].id;
        var cookieValue = read_cookie_tab(levelId);
        if (cookieValue == 1) {
            show(levelId);
        } else {
            hide(levelId);
        }
    }

//     Child Level Divs
    for (var i = 0; i < allChildLevels.length; i++) {
        childLevelId = allChildLevels[i].id;
        var cookieValue = read_cookie_tab(childLevelId);
        if (cookieValue == 1) {
            show(childLevelId);
        } else {
            hide(childLevelId);
        }
    }

//     All Level Headings
    for (var i = 0; i < allLevelsHeadings.length; i++) {
        levelHeadingId = allLevelsHeadings[i].id;
        var cookieValue = read_cookie_tab(levelHeadingId);
        if (cookieValue == 1) {
            plus(levelHeadingId);
        } else {
            minus(levelHeadingId);
        }
    }
}

function expandAllDirectories() {
    var allLevels = getElementsByClassName("expandLevelLists");
    var allChildLevels = getElementsByClassName("expandChildLevel");
    var allLevelsHeadings = getElementsByClassName("expander");

    var levelId;
    var childLevelId;
    var levelHeadingId;

    // Top Level Divs (under each main heading)
    for (var i = 0; i < allLevels.length; i++) {
        levelId = allLevels[i].id;
        show(levelId);
    }

    // Child Level Divs
    for (var i = 0; i < allChildLevels.length; i++) {
        childLevelId = allChildLevels[i].id;
        show(childLevelId);
    }

    // All Level Headings
    for (var i = 0; i < allLevelsHeadings.length; i++) {
        levelHeadingId = allLevelsHeadings[i].id;
        plus(levelHeadingId);
        }
}

function collapseAllDirectories() {
    var allLevels = getElementsByClassName("expandLevelLists");
    var allChildLevels = getElementsByClassName("expandChildLevel");
    var allLevelsHeadings = getElementsByClassName("expander");

    var levelId;
    var childLevelId;
    var levelHeadingId;

    // Top Level Divs (under each main heading)
    for (var i = 0; i < allLevels.length; i++) {
        levelId = allLevels[i].id;
        hide(levelId);
    }

    // Child Level Divs
    for (var i = 0; i < allChildLevels.length; i++) {
        childLevelId = allChildLevels[i].id;
        hide(childLevelId);
    }

    // All Level Headings
    for (var i = 0; i < allLevelsHeadings.length; i++) {
        levelHeadingId = allLevelsHeadings[i].id;
        minus(levelHeadingId);
        }
}

function setMailListLink(name, id, url) {
    var stringBuffer = "";
    var mailListLinkId = "mailListLink" + id;

    stringBuffer += name + "  -  http://" + window.location.host + url + id + "%0A";

    document.getElementById(mailListLinkId).href = "mailto:?subject=InformAlberta.ca - List Name: " + name +
                                                   "&body=A user from InformAlberta.ca sent you a link to the following List:%0A%0A"
                                                 + stringBuffer
                                                 + "%0A%0A Note: If the above link does not work please copy and paste the link into your web browser"
                                                 + "%0A%0A%0A Message sent from InformAlberta.ca - Alberta's Province-Wide Service Directory %0A http://www.informAlberta.ca";
}

function setMailComboListLink(name, id, url) {
    var stringBuffer = "";
    var mailComboListLinkId = "mailComboListLink" + id;
    stringBuffer += name + "  -  http://" + window.location.host + url + id + "%0A";

    document.getElementById(mailComboListLinkId).href = "mailto:?subject=InformAlberta.ca - Combo List Name: " + name +
                                                   "&body=A user from InformAlberta.ca sent you a link to the following Combo List:%0A%0A"
                                                 + stringBuffer
                                                 + "%0A%0A Note: If the above link does not work please copy and paste the link into your web browser"
                                                 + "%0A%0A%0A Message sent from InformAlberta.ca - Alberta's Province-Wide Service Directory %0A http://www.informAlberta.ca";
}

function submitAndPopupWindow2(action)
{
    var theform = window.document.forms["ia_public"];
    theform.action = action;
    popupWindow('initialize_SelectOrganizationGeoArea.do', 'orgGeoArea', 800, 700);
    theform.submit();
}

function setElectronicCommunicationListOrder(containerId, hiddenField) {
    $(hiddenField).value = Sortable.sequence(containerId);
}

function fillInHttpForWebsiteSelection(contactMethodDropDownId, electronicAccessDataEntryBoxId) {
    if($F(contactMethodDropDownId) == "Website")
    {
        $(electronicAccessDataEntryBoxId).value = "http://";
        $(electronicAccessDataEntryBoxId).focus();
    } else {
        $(electronicAccessDataEntryBoxId).value = "";
        $(electronicAccessDataEntryBoxId).focus();
    }
}
function getRequestParameter(parameterName) {
    var queryString = window.top.location.search.substring(1)
    // Add "=" to the parameter name (i.e. parameterName=value)
    parameterName = parameterName + "=";
    if (queryString.length > 0) {
        // Find the beginning of the string
        begin = queryString.indexOf(parameterName);
        // If the parameter name is not found, skip it, otherwise return the value
        if (begin != -1) {
            // Add the length (integer) to the beginning
            begin += parameterName.length;
            // Multiple parameters are separated by the "&" sign
            end = queryString.indexOf("&", begin);
            if (end == -1) {
                end = queryString.length
            }
            // Return the string
            return unescape(queryString.substring(begin, end));
        }
    }
    // Return "null" if no parameter has been found
    return null;

}

    // Copyright (C) krikkit - krikkit@gmx.net
    // --> http://www.krikkit.net/
    //
    // This program is free software; you can redistribute it and/or
    // modify it under the terms of the GNU General Public License
    // as published by the Free Software Foundation; either version 2
    // of the License, or (at your option) any later version.
function copy_clip(meintext) {
//        meintext = meintext + document.URL;
//        alert('you are passing in ' + meintext);
 if (window.clipboardData)
   {

   // the IE-manier
   window.clipboardData.setData("Text", meintext);

   // waarschijnlijk niet de beste manier om Moz/NS te detecteren;
   // het is mij echter onbekend vanaf welke versie dit precies werkt:
   }
   else if (window.netscape)
   {

   // dit is belangrijk maar staat nergens duidelijk vermeld:
   // you have to sign the code to enable this, or see notes below
   netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');

   // maak een interface naar het clipboard
   var clip = Components.classes['@mozilla.org/widget/clipboard;1']
                 .createInstance(Components.interfaces.nsIClipboard);
   if (!clip) return;

   // maak een transferable
   var trans = Components.classes['@mozilla.org/widget/transferable;1']
                  .createInstance(Components.interfaces.nsITransferable);
   if (!trans) return;

   // specificeer wat voor soort data we op willen halen; text in dit geval
   trans.addDataFlavor('text/unicode');

   // om de data uit de transferable te halen hebben we 2 nieuwe objecten
   // nodig om het in op te slaan
   var str = new Object();
   var len = new Object();

   var str = Components.classes["@mozilla.org/supports-string;1"]
                .createInstance(Components.interfaces.nsISupportsString);

   var copytext=meintext;

   str.data=copytext;

   trans.setTransferData("text/unicode",str,copytext.length*2);

   var clipid=Components.interfaces.nsIClipboard;

   if (!clip) return false;

   clip.setData(trans,null,clipid.kGlobalClipboard);

   }
   alert("Following info was copied to your clipboard:\n\n" + meintext);
   return false;
}

function popupWindow(url, name, width, height) {
    // make sure the name parameter does not have spaces or IE will break.
  window.open(url, name, 'height=' +height+ ',width=' +width+ ',alwaysLowered=0,alwaysRaised=0,channelmode=0,dependent=0,directories=0,fullscreen=0,hotkeys=1,location=0,menubar=0,resizable=1,scrollbars=1,status=1,titlebar=1,toolbar=0,z-lock=0');
}

function selectTax(taxonomyCodeId) {
    unhighlightTaxonomyRow($('selectedTaxonomyCode').value);
    $('selectedTaxonomyCode').value = taxonomyCodeId;
    highlightTaxonomyRow(taxonomyCodeId);
}

function highlightTaxonomyRow(id) {
//    var salList = document.getElementsByClassName("locationRowClass");
//    for (var x = salList.length - 1; x >= 0; x--) {
//        salList[x].style.backgroundColor = getBackgroundColor('.unselectedLocationRow');
//        salList[x].style.color = getCSSElement('.unselectedLocationRow').style.color;
//    }
    $(id.toString()).style.backgroundColor = getBackgroundColor('.selectedLocationRow');
    $(id.toString()).style.color = getCSSElement('.selectedLocationRow').style.color;
}

function unhighlightTaxonomyRow(id) {
    if ($(id.toString())) {
        $(id.toString()).style.backgroundColor = getBackgroundColor('.unselectedLocationRow');
        $(id.toString()).style.color = getCSSElement('.unselectedLocationRow').style.color;
    }
}

function toggleTaxonomyRow(id) {
    if ($(id.toString())) {
        if ($(id.toString()).style.backgroundColor == getBackgroundColor('.selectedLocationRow')) {
            unhighlightTaxonomyRow(id);
        } else {
            highlightTaxonomyRow(id);
        }
    }
}

function highlightSelectedFirstRow() {
    if ($('selectedTaxonomyCode').value.length > 0) {
        highlightTaxonomyRow($('selectedTaxonomyCode').value);
    } else {
        var salList = getElementsByClassName("locationRowClass");
        if (salList) {
            selectTax(salList[0].id);
//            salList[0].style.backgroundColor = getBackgroundColor('.selectedLocationRow');
//            salList[0].style.color = getCSSElement('.selectedLocationRow').style.color;
        }
    }
}

function highlightFirstRow() {
        var salList = getElementsByClassName("locationRowClass");
        if (salList) {
            selectTax(salList[0].id);
//            salList[0].style.backgroundColor = getBackgroundColor('.selectedLocationRow');
//            salList[0].style.color = getCSSElement('.selectedLocationRow').style.color;
        }
}

function setSelectedRows(hiddenSelectName, className, idPrefix) {
    var selectItems = document.getElementById(hiddenSelectName);
    for (var x = selectItems.options.length - 1; x >= 0; x--) {
        selectItems.options[x].selected = false;
        selectItems.options[x].id = hiddenSelectName + idPrefix + selectItems.options[x].value;
    }

    var salList = getElementsByClassName(className);
    for (var x = salList.length - 1; x >= 0; x--) {
        if (salList[x].style.backgroundColor == getBackgroundColor('.selectedLocationRow')) {
            var elementToFind = hiddenSelectName + [salList[x].id];
            var curOption = document.getElementById(elementToFind);
            curOption.selected = true;
        }
    }
}

function swapIconsForItemsInTempList(stringOfAllIds) {
    var valuesArray = stringOfAllIds.split(",");
    for (var i = 0; i < valuesArray.length; i++) {
        if ($(valuesArray[i])) {
            $(valuesArray[i]).src = '../../images_public/ia_style/added_to_list.gif';
            if ($('linkAddedToList')) {
                $('linkAddedToList').innerHTML = 'added to list';
            }

        }
    }
}

function swapIconsForItemsInTempListIndex(stringOfAllIds) {
    var valuesArray = stringOfAllIds.split(",");

    for (var i = 0; i < valuesArray.length; i++) {
        if ($(valuesArray[i])) {
            $(valuesArray[i]).src = '../../images_public/ia_style/added_to_list_big.gif';
        }
    }
}

function showDivSection(elementID) {
    var element = document.getElementById(elementID);
    Effect.Appear(element);
}

function showDivSections(showElementID1, showElementID2, hideElementID1, hideElementID2 ) {
    var showElement1 = document.getElementById(showElementID1);
    var showElement2 = document.getElementById(showElementID2);
    var hideElement1 = document.getElementById(hideElementID1);
    var hideElement2 = document.getElementById(hideElementID2);
    Effect.Fade(hideElement1);
    Effect.Fade(hideElement2);
    Effect.Appear(showElement1);
    Effect.Appear(showElement2);
}

function hideDivSections(showElementID1, showElementID2, hideElementID1, hideElementID2) {
    var showElement1 = document.getElementById(showElementID1);
    var showElement2 = document.getElementById(showElementID2);
    var hideElement1 = document.getElementById(hideElementID1);
    var hideElement2 = document.getElementById(hideElementID2);
    Effect.Fade(hideElement1);
    Effect.Fade(hideElement2);
    Effect.Appear(showElement1);
    Effect.Appear(showElement2);
}

function resizeText(multiplier) {
  if (document.body.style.fontSize == "") {
    document.body.style.fontSize = "0.75em";
  }
  document.body.style.fontSize = parseFloat(document.body.style.fontSize) + (multiplier * 0.1) + "em";
}

function increaseFontSize() {
	var min=8;
	var max=18;
   	var div = document.getElementsByTagName('div');
   	var span = document.getElementsByTagName('span');
   	var count = 0;
   	for(i=0;i<div.length;i++) {
   		 if (count < 10)
         {
         	alert("size: "+div[i].style.fontSize);
         	count = count+1;
         }
      if(div[i].style.fontSize) {
         var s = parseInt(div[i].style.fontSize.replace("px",""));
      } else {
         var s = 12;
      }
      
      if(s!=max) {
         s += 1;
      }
      div[i].style.fontSize = s+"px"
   }
   
   for(i=0;i<span.length;i++) {
      if(span[i].style.fontSize) {
         var s = parseInt(span[i].style.fontSize.replace("px",""));
      } else {
         var s = 12;
      }
      
      if(s!=max) {
         s += 1;
      }
      span[i].style.fontSize = s+"px"
   }
}

function decreaseFontSize() {
	var min=8;
	var max=18;
   	var div = document.getElementsByTagName('div');
   	var span = document.getElementsByTagName('span');
   	for(i=0;i<div.length;i++) {
      if(div[i].style.fontSize) {
         var s = parseInt(div[i].style.fontSize.replace("px",""));
      } else {
         var s = 12;
      }
      
      if(s!=min) {
         s -= 1;
      }
      div[i].style.fontSize = s+"px"
   }   
   for(i=0;i<span.length;i++) {
      if(span[i].style.fontSize) {
         var s = parseInt(span[i].style.fontSize.replace("px",""));
      } else {
         var s = 12;
      }

      if(s!=min) {
         s -= 1;
      }
      span[i].style.fontSize = s+"px"
   }   
}

function resizeText(multiplier) {
  if (document.body.style.fontSize == "") {
    document.body.style.fontSize = "0.75em";
  }
  document.body.style.fontSize = parseFloat(document.body.style.fontSize) + (multiplier * 0.1) + "em";
}

function showDivSections(showElementID1, showElementID2, hideElementID1, hideElementID2 ) {
    var showElement1 = document.getElementById(showElementID1);
    var showElement2 = document.getElementById(showElementID2);
    var hideElement1 = document.getElementById(hideElementID1);
    var hideElement2 = document.getElementById(hideElementID2);
    Effect.Fade(hideElement1);
    Effect.Fade(hideElement2);
    Effect.Appear(showElement1);
    Effect.Appear(showElement2);
}

function hideDivSections(showElementID1, showElementID2, hideElementID1, hideElementID2) {
    var showElement1 = document.getElementById(showElementID1);
    var showElement2 = document.getElementById(showElementID2);
    var hideElement1 = document.getElementById(hideElementID1);
    var hideElement2 = document.getElementById(hideElementID2);
    Effect.Fade(hideElement1);
    Effect.Fade(hideElement2);
    Effect.Appear(showElement1);
    Effect.Appear(showElement2);
}