if(typeof(HTMLElement)!="undefined"){
    HTMLElement.prototype.contains=function(obj){
        if (obj==this) return true;
        while (obj=obj.parentNode){if (obj==this) return true;}
        return false;
    }
}
var accInterval = 20;
var accStepLength = 40;
var accExpandedDiv = null;
var assIsIE = (document.all==undefined)?false:true;
function accOnHeaderClick(e){
    var obj=e.target?e.target:e.srcElement;
    var divContainer = obj.parentNode.nextSibling;
    if (accExpandedDiv!=divContainer){
        if(accExpandedDiv!=null) setTimeout(function(){accCloseDiv(accExpandedDiv);},accInterval);
        setTimeout(function(){accOpenDiv(divContainer);},accInterval);
        changeStyleOpen( obj );
    }else{
        setTimeout(function(){accCloseDiv(divContainer);},accInterval);
    }
}
function accOpenDiv(div){
    accExpandedDiv = div;
    var h = ((assIsIE)?div.offsetHeight:document.defaultView.getComputedStyle(div,null).getPropertyValue('height').replace("px","")) * 1;
    var ch = 15+div.childNodes[0].offsetHeight;
    if (h < ch && div.getAttribute("closing")!="1"){
    	if ((h + accStepLength)<ch)
            div.style.height = (h + accStepLength) + "px";
        else
        	div.style.height = ch + "px";
        setTimeout(function(){accOpenDiv(div);},accInterval);
    }
}
function accCloseDiv(div){
    var h = ((assIsIE)?div.offsetHeight:document.defaultView.getComputedStyle(div,null).getPropertyValue('height').replace("px","")) * 1;
    if (h * 1 > 0){
        h -= accStepLength;
        if (h<=0){
            div.setAttribute("closing","");
            div.style.height = "0px";
            if (accExpandedDiv==div) accExpandedDiv = null;
            changeStyleClose(div);                    
        }else{
            div.setAttribute("closing","1");
            div.style.height = h + "px";
            setTimeout(function(){accCloseDiv(div);},accInterval);
        }
    }
}
function changeStyleOpen(obj){
    obj.parentNode.className="faqtitlehover";
    obj.className = "faqtitletexthover";
    var divdesc = obj.parentNode.nextSibling;
    divdesc.childNodes[0].className = "faqdesccontent faqdescopenstyle";
}
function changeStyleClose(desc){
    desc.previousSibling.className="faqtitle";
    desc.previousSibling.childNodes[0].className="faqtitletext";
    desc.childNodes[0].className = "faqdesccontent faqdescclosetyle";
}
