
// JavaScript Document

	


var selectedarea=null;

function selectnew(id){
	if (selectedarea!=null){selectedarea.removeAttribute("class", "current");}
	document.getElementById(id).setAttribute("class", "current");
	selectedarea = document.getElementById(id);
	document.getElementById('welcometoatoz').style.display = 'none';

	return;
}


function viewarticle(id, displayname){
window.location.hash=id+'::'+displayname;
var x = new Chain();
	var one = function(){
	animatedcollapse.hide('topicsbox');
	};
	var two = function(){
	animatedcollapse.hide('az-article');
	animatedcollapse.hide('welcometoatoz');

	};
	var three = function(){
	document.getElementById("azarticlebody").innerHTML = '<p style="text-align:center;"><img src="http://content.2mlpharmacare.com/imagestore/4.gif"/>&emsp;Loading "'+id+'"...</p>'; 
	ajaxpage('http://www.maghaberrypharmacy.com/atozarticle/'+id+'&version=D&display='+escape(displayname),'azarticlebody');
		
		
		

	};
	
	var four = function(){
			//document.getElementById("az-article").setAttribute("style", "height:"+(document.getElementById('azarticlebody').height)+'px; display:block; position:relative;');
			animatedcollapse.show('az-article');
		};

	
	x.chain(one);
	x.chain(two);
	x.chain(three);
	x.chain(four);


	x.callChain();
	x.callChain.delay(500, x);
	x.callChain.delay(1000, x);
	x.callChain.delay(1000, x);


	
	//document.getElementById("pagediv").setAttribute("style", "height:"+(200+(document.body.clientHeight -()))+"px"); 


	}
	
	function loadsection(id,displayname,section){
//window.location.hash=id;
var x = new Chain();
	var one = function(){
	animatedcollapse.hide('topicsbox');
	};
	var two = function(){
	animatedcollapse.hide('az-article');
	animatedcollapse.hide('welcometoatoz');

	};
	var three = function(){
	document.getElementById("azarticlebody").innerHTML = '<p style="text-align:center;"><img src="http://content.2mlpharmacare.com/imagestore/4.gif"/>&emsp;Loading "'+id+'"...</p>'; 
	ajaxpage('http://www.maghaberrypharmacy.com/atozarticle/'+id+'&version=D&section='+section+'&display='+escape(displayname),'azarticlebody');
		
		
		

	};
	
	var four = function(){
			//document.getElementById("az-article").setAttribute("style", "height:"+(document.getElementById('azarticlebody').height)+'px; display:block; position:relative;');
			animatedcollapse.show('az-article');
		};

	
	x.chain(one);
	x.chain(two);
	x.chain(three);
	x.chain(four);


	x.callChain();
	x.callChain.delay(500, x);
	x.callChain.delay(1000, x);
	x.callChain.delay(1000, x);


	
	//document.getElementById("pagediv").setAttribute("style", "height:"+(200+(document.body.clientHeight -()))+"px"); 


	}
	
var selectedletter=null;	

	function select_letter(letter){
	//document.getElementById("topicsbox").style.height = document.getElementById('toplist').style.height;
	var id = 'letter'+letter;
	var x = new Chain();
	var one = function(){
		
	animatedcollapse.hide('topicsbox');
		
	};
	var two = function(){
	document.getElementById("toplist").innerHTML = '<p style="text-align:center;">Compiling a list of topics for '+letter+'...<br/><img src="http://content.2mlpharmacare.com/imagestore/4.gif"/></p>'; 	
	ajaxpage('http://www.maghaberrypharmacy.com/atozsa/'+letter,'toplist');
		
		
	};
	var three = function(){
	document.getElementById("topicsbox").style.height = document.getElementById('toplist').style.height;
	
	
	};
	var four = function(){
		animatedcollapse.show('topicsbox');
		//document.getElementById("az-article").setAttribute("style", "height:"+(document.getElementById('azarticlebody').height)+'px; display:block; position:relative;');
			

	};

	
	x.chain(one);
	x.chain(two);
	x.chain(three);
	x.chain(four);

	x.callChain();
	x.callChain.delay(470, x);
	x.callChain.delay(800, x);
	x.callChain.delay(380, x);

	
	
	 
	if (selectedletter!=null){selectedletter.removeAttribute("class", "current");}
	document.getElementById(id).setAttribute("class", "current");
	selectedletter = document.getElementById(id);
	//document.getElementById('welcometoatoz').style.display = 'none';
	}
	




