function ShowCharacter(index, criteria, srcEl){
	srcEl.blur();
	var searchResults=document.getElementById("searchresults");
	var searchResultsHeight=searchResults.offsetHeight;
	var accordionBody=document.getElementById("accordionBody");
	var scrollControl = document.getElementById("scrollControl");
	scrollControl.style.display='none';
	searchResults.className="absolute";
	if(searchResultsHeight>312) searchResultsHeight=312;
	
	animeResults1 = new Animator({transition: Animator.makeEaseOut(1), duration: 800});
	animeResults1.options.onComplete=function(){searchResults.style.bottom='0px';getAuthor(index, criteria);};
	animeResults1.addSubject(new NumericalStyleSubject(accordionBody, 'height', searchResultsHeight, 0));
	animeResults1.seekTo(1);
}

function ShowAuthor(index, criteria, srcEl){
	srcEl.blur();
	var searchResults=document.getElementById("searchresults");
	var searchResultsHeight=searchResults.offsetHeight;
	var accordionBody=document.getElementById("accordionBody");
	var scrollControl = document.getElementById("scrollControl");
	scrollControl.style.display='none';
	searchResults.className="absolute";
	if(searchResultsHeight>312) searchResultsHeight=312;
	
	animeResults1 = new Animator({transition: Animator.makeEaseOut(1), duration: 800});
	animeResults1.options.onComplete=function(){searchResults.style.bottom='0px';getAuthor(index, criteria, srcEl);};
	animeResults1.addSubject(new NumericalStyleSubject(accordionBody, 'height', searchResultsHeight, 0));
	animeResults1.seekTo(1);
}
function stateChanged(){
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
		var searchResults=document.getElementById("searchresults");
		searchResults.innerHTML=xmlHttp.responseText;
		var searchResultsHeight=document.getElementById("searchresults").offsetHeight;
		if(searchResultsHeight>312) {
			searchResultsHeight=312;
			setAnimScroll();
		}
		document.getElementById("searchResutsBg").style.height=searchResultsHeight+'px';
		var accordionBody=document.getElementById("accordionBody");
		var animeResults = new Animator({transition: Animator.makeEaseOut(1), duration: 800});
		animeResults.addSubject(new NumericalStyleSubject(accordionBody, 'height', 0, searchResultsHeight));
		animeResults.seekTo(1);
		animeResults.options.onComplete=function(){completeScroll();};

	} 
}
function completeScroll(){
	var searchResults = document.getElementById("searchresults")
	var searchResultsHeight=searchResults.offsetHeight;
	if(searchResultsHeight>312) {
		var scrollControl = document.getElementById("scrollControl");
		scrollControl.style.display="block";
		var animeResults = new Animator({transition: Animator.makeEaseOut(1), duration: 800});
		animeResults.addSubject(new NumericalStyleSubject(searchResults, 'bottom', 0, (312-searchResultsHeight)));
		animeResults.seekTo(1);
	}
}
function expandBgHeight(){
	var searchResultsHeight=document.getElementById("searchresults").offsetHeight;
	if(searchResultsHeight>312) searchResultsHeight=312;
	document.getElementById("searchResutsBg").style.height=searchResultsHeight+'px';
	document.getElementById("accordionBody").style.height=searchResultsHeight+'px';
}
function getAuthor(index, criteria, srcEl){
	document.getElementById("accordionHeadingTitle").innerHTML=index;
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null){
		alert ("Browser does not support HTTP Request")
		return
	}
	var url="inc/getauthor.inc.php";
	url=url+"?index="+index;
	url=url+"&criteria="+criteria;
	url=url+"&lng="+srcEl.className;
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=stateChanged 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}
function GetXmlHttpObject()
{
var xmlHttp=null;
try
 {
 // Firefox, Opera 8.0+, Safari
 xmlHttp=new XMLHttpRequest();
 }
catch (e)
 {
 //Internet Explorer
 try
  {
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e)
  {
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }
return xmlHttp;
}

addLoadListener(expandBgHeight);