// JavaScript Document
//
// :: tree menu functions ::
function P7_swapClass(){ //v1.4 by PVII
 var i,x,tB,j=0,tA=new Array(),arg=P7_swapClass.arguments;
 if(document.getElementsByTagName){
	 for(i=4;i<arg.length;i++){
		tB=document.getElementsByTagName(arg[i]);
  			for(x=0;x<tB.length;x++){
				tA[j]=tB[x];
				j++;
			}
		}
		for(i=0;i<tA.length;i++){
			if(tA[i].className){
				if(tA[i].id==arg[1]){
					if(arg[0]==1){
						tA[i].className=(tA[i].className==arg[3])?arg[2]:arg[3];
					} else {
						tA[i].className=arg[2];
					}
				} else if(arg[0]==1 && arg[1]=='none'){
					if(tA[i].className==arg[2] || tA[i].className==arg[3]){
						tA[i].className=(tA[i].className==arg[3])?arg[2]:arg[3];
  					}
  				} else if(tA[i].className==arg[2]){
					if (enableAll==true) {
						tA[i].className=arg[3];
					}
				}
			}
		}
	}
}
//
var enableAll = true;
function closeFAQ() {
	var allSections = Array('p1','p2','p3','p4','p5');
		for (var i=0;i<=allSections.length; i++) {
			P7_swapClass(0,allSections[i],'open','closed','li');
	}
	enableAll = false;
}
function showAllFAQs() {
	var obj = document.getElementById("showHideBtn");
	enableAll = true;
	if (obj.value=="Show all FAQs") {
		var allSections = Array('p1','p2','p3','p4','p5');
			for (var i=0;i<=allSections.length; i++) {
				P7_swapClass(0,allSections[i],'closed','open','li');
		}
		enableAll = false;
		obj.value = "Hide all FAQs";
	} else {
		closeFAQ();
		obj.value = "Show all FAQs";
	}
}
//
var cpListing = null;
// :: submenu call functions ::
function hasClass(ele,cls) {
	return ele.className.match(new RegExp('(\\s|^)'+cls+'(\\s|$)'));
}
function removeClass(ele,cls) {
	if (hasClass(ele,cls)) {
		var reg = new RegExp('(\\s|^)'+cls+'(\\s|$)');
		ele.className=ele.className.replace(reg,'submenuactive');
	}
}
function toggle(el, sHiddenClass) {
		var oRegExp = new RegExp("(^|\\s)" + sHiddenClass + "(\\s|$)");
		el.className = (oRegExp.test(el.className)) ? el.className.replace(oRegExp, '') : el.className + ' ' + sHiddenClass; 
		// Add or remove the class name that hides the element
		/*el.parentNode.style.backgroundImage="url(menminus.gif)";
		el.parentNode.style.backgroundRepeat="no-repeat";
		el.parentNode.style.backgroundPositionX="0px";
		el.parentNode.style.backgroundPositionY="10px";*/
	}
// load external file into iframe
function loadIframe(iframeName, url) {
  if ( window.frames[iframeName] ) {
    window.frames[iframeName].location = url;   
    return false;
  }
  else return true;
}
// resize iframe upon load
function calcHeight(){
  //find the height of the internal page
  var the_height=document.getElementById('content_iframe').contentWindow.document.body.scrollHeight;
  var resolve_height = ((the_height)<=640) ? 640: the_height+50;
  //change the height of the iframe
  document.getElementById('content_iframe').height = resolve_height;
}
//
// :: Adobe functions ::
function MM_callJS(jsStr) { //v2.0
  return eval(jsStr)
}
