//******************************************************************************************//
// Function used to switch a menu category between expanded and collapsed states
//******************************************************************************************//


	function toggle(divName, catNum){
		obj = document.getElementById(divName);
		icon = document.getElementById(catNum);
		
		
		/* If div is set to invisible, display. If displayed, set to invisible */
		
		if( obj.style.display == 'none' ){
		  	obj.style.display = 'block';
		}
		else{
			obj.style.display = 'none';
		}

		/* Toggle from plus to minus or vice versa */

		if( (icon.src).indexOf("plus.gif") != -1 ){
			icon.src = '/nchs/images/launch/minus.gif';
		}
		else{
			icon.src = '/nchs/images/launch/plus.gif';		
		}

		document.getElementById('fastats').innerHTML = document.getElementById('fastats').innerHTML;
		document.getElementById('about_nchs').innerHTML = document.getElementById('about_nchs').innerHTML;
		document.getElementById('tools_resources').innerHTML = document.getElementById('tools_resources').innerHTML;		
	}


//*********************************************************************************************//
// Function used for web scraping of WWW.CDC.GOV - inserts Data & Statistics module into page
//********************************************************************************************//

	function ajaxFunction(){
	
		var xmlHttp;
		
		try {  // Firefox, Opera 8.0+, Safari  
				xmlHttp=new XMLHttpRequest();  
		}
		catch (e){  // Internet Explorer  
			try{    
				xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");    
			}
		    catch (e){    
				try{      
					xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");      
				}
		 	    catch (e){         
					return false;      
				}    
			}  
		}
		
	  xmlHttp.onreadystatechange=function()
    		{
			    if(xmlHttp.readyState==4){
			    
			    	var index_page = xmlHttp.responseText;
			    	
					index_page = index_page.split('<h3>Data &amp; Statistics</h3>')[1];
					index_page = index_page.split('<div class="imageHover">')[1];
					index_page = '<div class="imageHover"><p>' + index_page;
					index_page = index_page.split('</div>')[0];
					index_page += "</p><p><a href='http://www.cdc.gov/DataStatistics/'>CDC Data &amp; Statistics</a></p></div>"
					
					
      				document.getElementById("syn-dataStats-001").innerHTML = index_page;  						
      			}	
    		}
			
	  xmlHttp.open("GET","/",true);
	  xmlHttp.send(null);  
	}