﻿document.write('<style type="text/css">#content .answer {display:none;}#content #toggleAllButton{display:none;}</style>');
var open=true;
function addLoadEvent(func){
var oldonload = window.onload;  

if (typeof window.onload != 'function')  
	{
	window.onload = func;
	}
else 
	{
	window.onload = function()
		{
		oldonload(); func()
		} 
	} 
}

function toggleDisplay(element)
{
	if (!element) return false;
	if (element.style.display == 'none' || !element.style.display)
	{
		element.style.display = 'block';
	}
	else
	{
		element.style.display = 'none';
	}
}

function toggleAll(open)
{	
	if (!document.getElementById) return false;
	if (!document.getElementsByTagName) return false;

	var container = document.getElementById("faq_container");
	var divs = container.getElementsByTagName("p");

	for(var i=0; i < divs.length; i++) {
		var div = divs[i];
		if(div.className=="answer") {
			if(open){
			    div.style.display="block";
			} else {
			    div.style.display="none";
			}
		}
	}
}

function get_nextsibling(n)
{
        x=n.nextSibling;
        while (x.nodeType!=1)
        {
            x=x.nextSibling;
        }
        return x;
}

function get_firstchild(n)
{
    x=n.firstChild;
    while (x.nodeType!=1)
    {
        x=x.nextSibling;
    }
    return x;
}

function attachClickEvents()
{
	if (!document.getElementsByTagName) return;
	if (!document.getElementById) return;
	var container = document.getElementById("faq_container");
	if (!container) return;
	
    var questions = container.getElementsByTagName("li");
    var answers = container.getElementsByTagName("p");
	for (var index=0; index < questions.length; index++)
	{
	    var question = questions[index];
	    
	    question.onmouseover=function()
	    {
		this.style.textDecoration="underline";
	    }
	    question.onmouseout=function()
	    {
		this.style.textDecoration="none";
	    }	
	    question.style.cursor = 'pointer';
	    question.onclick = function()
	    {
		var browser = navigator.appName;
		if (browser != "Microsoft Internet Explorer") 
		{
		    var answer = get_nextsibling(this);
		    toggleDisplay(answer);
		}
		else 
		{
		    var answer = get_firstchild(this);
		    toggleDisplay(answer);
		}
	    }
  	
	}
	var Button = document.getElementById("toggleAllButton");
	Button.style.display="inline";
	Button.innerHTML='Show All Answers';
	Button.style.cursor="pointer";
	Button.onclick = function()
	{
	    toggleAll(open);
	    open = (open) ? false : true;
	    Button.innerHTML= (Button.innerHTML=="Show All Answers") ? "Hide All Answers" : "Show All Answers";
	}
}

addLoadEvent(attachClickEvents);