
/*
$(document).ready(function() {
	if ($.query.get('s')) {
		var s = '#' + $.query.get('s');
		
		$('.vscroll').scrollTo($(s), 0);
	}	
	$('div > ul a').click(function(e) {
		$('.vscroll').css('overflow-y', 'auto');									  
											  
		var a = $(this);
				
		if ($(a).attr('href') == '#')
			e.preventDefault();	
			//alert('test');
		var h6 = $(this).parent().children('h6')[0];
		var ul = $(a).parent().children('ul')[0];
		if (ul != undefined) {
			
			var hidden = $(ul).is(':hidden');
			if (hidden) {
				$(ul).show();
			} else {
				$(ul).hide();
				$(ul).find('ul').hide();
			}
		}
		if (h6 != undefined) {
			var hidden = $(h6).is(':hidden');
			if (hidden) {
				$(h6).show();
			} else {
				$(h6).hide();
				$(h6).find('h6').hide();
			}
		}
	}); 
	
});*/

$(document).ready(function() {
	if ($.query.get('s')) {
		var s = '#' + $.query.get('s');
		$('.vscroll').scrollTo($(s), 0);
	}	
	$('.content ul a').click(function(e) {
		$('.vscroll').css('overflow-y', 'auto');	
		var a = $(this);
		if ($(a).attr('href') == '#')
			e.preventDefault();															
		var h6 = $(this).parent().children('h6')[0];
		var ul = $(a).parent().children('ul')[0];
		if (ul != undefined) {
			var hidden = $(ul).is(':hidden');
			if (hidden) {
				$(ul).show();
			} else {
				$(ul).hide();
				$(ul).find('ul').hide();
			}
		}
		if (h6 != undefined) {
			var hidden = $(h6).is(':hidden');
			if (hidden) {
				$(h6).show();
			} else {
				$(h6).hide();
				$(h6).find('h6').hide();
			}
		}
	});  	
});

function drilldownResults($detailSic,$groupSic,$groupSector) {
	
	//define the div we are working with
	var detailDiv = $detailSic+'div';
	
	//check to see if the div exists
	if ( $('#'+detailDiv).length ) {
	//ifthe div exists check to see if it is hidden, if it is then show it, if it is not hidden then hide it
		if($('#'+detailDiv).is(":hidden")){
			$('#'+detailDiv).show(); 
		}else{
			$('#'+detailDiv).hide();
		}
		
	}else{
		//the div does not exist, make the call to get the details to show in the drilldown
		
				
		$('#'+$detailSic).html(' Loading...');
		
		//alert("drilldown.php?detailSic="+$detailSic+"&groupSic="+$groupSic+"&groupSector="+$groupSector);
		
		//make the request
		$.get("drilldown.php?detailSic="+$detailSic+"&groupSic="+$groupSic+"&groupSector="+$groupSector, function(data){
			//display the results from the request
			$('#'+$detailSic).html(data);});
		
	}
		
}



function drilldownClusterResults($subID) {
	
	//alert($subID);
	
	
	//define the div we are working with
	var subDiv = $subID+'clusterDiv';
	
	
	
	//check to see if the div exists
	if ( $('#'+subDiv).length) {
	//ifthe div exists check to see if it is hidden, if it is then show it, if it is not hidden then hide it
		if($('#'+subDiv).is(":hidden")){
			$('#'+subDiv).show(); 
		}else{
			$('#'+subDiv).hide();
		}
		
	}else{
		//the div does not exist, make the call to get the details to show in the drilldown
		var $subSpan = $subID+'cluster';
		
		$('#'+$subSpan).html(' Loading...');
		
		
		//make the request
		$.get("clusterdrilldown.php?subID="+$subID, function(data){
			//alert(data);
			//display the results from the request
			$('#'+$subID+'cluster').html(data);});
		
	}
	
	
}
