﻿//--- Common settings and functions

var OnLoadEventName;


//--- Function to select an object by name on different browsers.
function GetObject(name)
{
    if (document.getElementById) 
		return document.getElementById(name);
		
    if (document.all) 
		return document.all[name];
		
    if (document.forms) 
	{
        if (document.forms[name]) 
			return document.forms[name];
        else 
            for (var i=0; i<document.forms.length; i++)
                if (document.forms[i][name])
                    return document.forms[i][name];
    }
}

//--- Dump an object's properties
function Dump(obj)
{
  for (var list in obj)
  {
    if (list != "innerHTML" && list != "innerText")
        obj.innerHTML += list + " = \"" + obj[list] + "\"<br/>";
  }
}


//--- Expander function
function ExpanderClick(button, detailsId)
{
    //--- Check if div is open
    var div;
    
    if (detailsId)
        div = GetObject(detailsId);
    else
        div = GetObject("paDetails");
    
    if (div)
    {
        if (!div.style.display || div.style.display == "none")
        {
            //--- Expand
            div.style.display = "block";
            button.src = expanderHideImageUri;
        }
        else
        {
            //--- Contact
            div.style.display = "none";
            button.src = expanderShowImageUri;
        }
    }
    else
        alert("Expander Details div not found: " + detailsId);
}


function protectAddress(address)
{
    document.write('<a href="mailto:' + address + '">' + address + '</a>');
}

function protectAddress(address, title)
{
    document.write('<a href="mailto:' + address + '">' + title + '</a>');
}

