
var anchorFlag = 0;
var anchorTopic, anchorAnswer;

function MM_effectBlind(targetElement, duration, from, to, toggle)
{
	Spry.Effect.DoBlind(targetElement, {duration: duration, from: from, to: to, toggle: toggle});
}

//function to show or hide a layer
function MM_showHideLayers() { //v9.0
  var i,p,v,d,obj,args=MM_showHideLayers.arguments;
  d='text';
  for (i=0; i<(args.length-2); i+=3) 
  with (document) if (getElementById && ((obj=getElementById(args[i]))!=null)) { 
    v=args[i+2];
	//alert(obj.id+', '+obj.currentStyle.display);
	obj=obj.style;
	obj.display=(obj.display=='block')?'none':'block';  //this line enables us to toggle the function call
	//    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
	//    obj.visibility=v; 
	//   	d=(v=='visible')?'block':(v=='hidden')?'none':d; 
	//    obj.display=d; 
  }
}//end MM_showHideLayers

function myShowHide(num){

	MM_showHideLayers('topic'+num,'','show');
	MM_showHideLayers('plus'+num,'','show');
	MM_showHideLayers('minus'+num,'','show');
}


function topicShowHide(num){

	MM_showHideLayers('topic'+num,'','show');
	MM_showHideLayers('plus'+num,'','show');
	MM_showHideLayers('minus'+num,'','show');
}


function myanchor(topic,ans){
	
	// First, get the topic's collapsed state ('none', '', or 'block').
	var topic_id = "topic"+topic
	var topic_element = document.getElementById(topic_id);
	var currentState = topic_element.style.display;

	// If it is collapsed, then run the "topicShowHide" subroutine.
	if((currentState == '') || (currentState == 'none')) {
		topicShowHide(topic);		
	}

	// If it isn't collapsed (ie, expanded), there is no need to run the "topicShowHide" subroutine.
	if(currentState == 'block') {
		//topicShowHide(topic);		
	}
	
	MM_effectBlind(ans, 500, '0%', '100%', true);
	anchorFlag = 1;
}


function showall(){
	
	var x = document.getElementsByTagName('div');
    var mycount = 0;
    var sa = document.getElementById("chkShowAll");
    var chkd = sa.checked;
	var currentState = 0;
	var strTopicID;
	var intTopicNumber;
	
	//toggle all answers open / closed
	for (var i=0;i<x.length;i++){

		currentState = x[i].style.display;
		currentHeight = x[i].style.height;
	
		if(chkd){
			//open all
			
			if(x[i].className == 'mytopic') { 							//x[i].id = is topic1, topic2..the id value
				
				if((currentState == '') || (currentState == 'none')) {
					
					// Extract trailing integer from element id - for example, if element id is "topic12", 
					// extract the "12".
					strTopicID = x[i].id;
					intTopicNumber = strTopicID.substr(5, strTopicID.length-5);
					//alert("intTopicNumber: " + intTopicNumber);
					
					//topicShowHide(x[i].id.charAt(5));	
					topicShowHide(intTopicNumber);
					//topicX where X is a number
				}
			}//end if mytopic
			if(x[i].className == 'myanswer'){
				if((currentHeight == '') || (currentHeight == '0px'))
					//alert("effectBlind");
					MM_effectBlind(x[i].id, 500, '0%', '100%', true);
			}//end if myanswer
		}else{
			//close all
			
			if(x[i].className == 'mytopic') { 							//x[i].id = is topic1, topic2..the id value
				if(currentState == 'block')	  {

					// Extract trailing integer from element id - for example, if element id is "topic12", 
					// extract the "12".
					strTopicID = x[i].id;
					intTopicNumber = strTopicID.substr(5, strTopicID.length-5);
					//alert("intTopicNumber: " + intTopicNumber);

					// Use intTopicNumber to access this topic's question display status.
					//alert(arrTopicDisplayMode[intTopicNumber-1]);

					// If this topic's question display status is "Yes", then do NOT run the topicShowHide routine.
					if (arrTopicDisplayMode[intTopicNumber-1] == "Yes") {
							//topicShowHide(intTopicNumber);
						   //topicShowHide(x[i].id.charAt(5));
					}
					else {
						//topicShowHide(x[i].id.charAt(5));
						topicShowHide(intTopicNumber);
					}
				}
			}//end if mytopic
			if(x[i].className == 'myanswer'){
				if((currentHeight != '') && (currentHeight != '0px'))
					MM_effectBlind(x[i].id, 500, '0%', '100%', true);
			}//end if myanswer
		}//end if else chkd
	}//end for loop	

}//end function showall





// Array to hold "Yes" or "No" for each topic, to indicate whether it is to display the questions or not.
var arrTopicDisplayMode = new Array(1);



	
		arrTopicDisplayMode[0]="Yes";
		




