var xmlHttp
//===================================================
 function save2mylist(member_id,institute_code,bib_id,catagories)
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 } 
 document.getElementById("save2mylist").innerHTML="<IMG SRC='ajax-loader.gif'>"
var url="ajax_save2mylist.php"
url=url+"?institute_code="+institute_code+"&bib_id="+bib_id+"&catagories="+catagories+"&member_id="+member_id
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=Save2MyListStateChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)

}
function Save2MyListStateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("save2mylist").innerHTML=xmlHttp.responseText 
 } 
}
//===================================================
 function change_passwd(memid,newpasswd)
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 } 
 document.getElementById("change_passwd").innerHTML="<IMG SRC='ajax-loader.gif'>"
var url="ajax_change_passwd.php"
url=url+"?id="+memid+"&newpasswd="+newpasswd
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=ChangeStateChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)

}
function ChangeStateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("change_passwd").innerHTML=xmlHttp.responseText 
 } 
}
//===================================================
 function viewflv(file,server,obj_id,int_code,recid)
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 } 
 //document.getElementById("show_signin_result").innerHTML="กรุณารอสักครู่ ...กำลังค้น "+passwd
var url="view_flv.php"
url=url+"?file="+file+"&obj_id="+obj_id+"&server="+server+"&institute_code="+int_code+"&recid="+recid
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=ViewStateChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)

}
function ViewStateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("view_flv").innerHTML=xmlHttp.responseText 
 } 
}
//===================================================
 function signin(login,passwd)
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 } 
 // document.getElementById("show_signin_result").innerHTML="กรุณารอสักครู่ ...กำลังค้น "+passwd
var url="ajax_signin.php"
url=url+"?login="+login+"&passwd="+passwd
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=SignInStateChanged 
xmlHttp.open("POST",url,true)
xmlHttp.send(null)

}
function SignInStateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("show_signin_result").innerHTML=xmlHttp.responseText 
 } 
}

//***********************************************************

 function search_z3950(str)
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 } 
  document.getElementById("show_z3950_result").innerHTML="<IMG SRC='ajax-loader.gif'>"+str
var url="search_z3950.php"
url=url+"?query="+str
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=SearchZ39StateChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)

}
function SearchZ39StateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("show_z3950_result").innerHTML=xmlHttp.responseText 
 } 
}
//*******************************************************************************************
 function showZ3950Target(str)
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 } 
if (str==true)
{
  document.getElementById("txtZ39Name").innerHTML="<IMG SRC='ajax-loader.gif'>"+str
var url="z3950_select.php"
url=url+"?str="+str
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=LoadZ39StateChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}
}
function LoadZ39StateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("txtZ39Name").innerHTML=xmlHttp.responseText 
 } 
}
//***********************************************************
 function load_nav(str,inst,opt,bib,display,titleid,browse_type,q)
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 } 
  document.getElementById("txt_nav").innerHTML="<IMG SRC='ajax-loader.gif'>"+inst
var url="browse_nav.php"
url=url+"?str="+str+"&option="+opt+"&institute_code="+inst+"&bib="+bib+"&display="+display+"&titleid="+titleid+"&browse_type="+browse_type+"&q="+q
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=LoadNavStateChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}
function LoadNavStateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("txt_nav").innerHTML=xmlHttp.responseText 
 } 
}
//***********************************************************************************************
 function report_error(bib,inst,access_from)
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 } 
  document.getElementById("report_error").innerHTML="<IMG SRC='ajax-loader.gif'>"
var url="report_error_form.php"
url=url+"?bib="+bib+"&access_from="+access_from+"&institute_code="+inst
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=ReportErrStateChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}
function ReportErrStateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("report_error").innerHTML=xmlHttp.responseText 
 } 
}
//**************************************************************************************************
 function gettype()
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 } 
  document.getElementById("txt_get_type").innerHTML="<IMG SRC='ajax-loader.gif'>";
var url="type_list.php"
url=url+"?institute_code="
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=TypeStateChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}
function TypeStateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("txt_get_type").innerHTML=xmlHttp.responseText 
 } 
}

//*************************************************
function showUser(str)
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 } 
var url="getuser.php"
url=url+"?q="+str
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}
//-----------------------------------------------------------------------------
function basic_search_by_institute(institute_code,query,field)
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 } 
  document.getElementById("display_search_result").innerHTML="<IMG SRC='ajax-loader.gif'>";
var url="search_basic_by_institute.php"
url=url+"?institute_code="+institute_code+"&query="+query+"&field="+field
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=SearchResultStateChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}
function SearchResultStateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("display_search_result").innerHTML=xmlHttp.responseText 
 } 
}
//-------------------------------------------------------------------------------
function show_list_object(institute_code,recid)
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 } 
  document.getElementById("txt_list_object").innerHTML="<IMG SRC='ajax-loader.gif'>";
var url="list_object.php"
url=url+"?institute_code="+institute_code+"&bib="+recid
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=ObjectStateChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}
function ObjectStateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("txt_list_object").innerHTML=xmlHttp.responseText 
 } 
}
//--------------------------------------------------------------------------------
function showMember(str)
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 } 
  document.getElementById("txt_member").innerHTML="<IMG SRC='ajax-loader.gif'>";
var url="member_list.php"
url=url+"?q="+str
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=MemberstateChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}
function MemberstateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("txt_member").innerHTML=xmlHttp.responseText 
 } 
}
function showCreator(str)
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 } 
  document.getElementById("txt_creator").innerHTML="<IMG SRC='ajax-loader.gif'>";

var url="creator_list.php"
url=url+"?q="+str
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=CreatorstateChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}
function CreatorstateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("txt_creator").innerHTML=xmlHttp.responseText 
 } 
}
function showContributor(str)
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 } 
  document.getElementById("txt_contributor").innerHTML="<IMG SRC='ajax-loader.gif'>";

var url="contributor_list.php"
url=url+"?q="+str
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=ContributorstateChanged
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}
function ContributorstateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("txt_contributor").innerHTML=xmlHttp.responseText 
 } 
}
function showTitle(str)
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 } 
  document.getElementById("txt_title").innerHTML="<IMG SRC='ajax-loader.gif'>";

var url="title_list.php"
url=url+"?q="+str
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=TitlestateChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}
function TitlestateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("txt_title").innerHTML=xmlHttp.responseText 
 } 
}
function showPop(str,atype,anum)
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 } 
 document.getElementById("txt_popular").innerHTML="<IMG SRC='ajax-loader.gif'>";
var url="popular_list.php"
url=url+"?q="+str+"&t="+atype+"&num_item="+anum
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=PopstateChanged
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}
function PopstateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("txt_popular").innerHTML=xmlHttp.responseText 
 } 
}
function shownew(str)
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 } 
  document.getElementById("txt_whatnew").innerHTML="<IMG SRC='ajax-loader.gif'>";

var url="whatnew_list.php"
url=url+"?q="+str
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=newstateChanged
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}
function newstateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("txt_whatnew").innerHTML=xmlHttp.responseText 
 } 
}
function showDownload(arange,atype)
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 } 
  document.getElementById("txt_download").innerHTML="<IMG SRC='ajax-loader.gif'>";

var url="download_stat_list.php"
url=url+"?arange="+arange+"&atype="+atype
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=DownloadStateChanged
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}
function DownloadStateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("txt_download").innerHTML=xmlHttp.responseText 
 } 
}
function showSubj(str)
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 } 
  document.getElementById("txtHint").innerHTML="<IMG SRC='ajax-loader.gif'>";

var url="subject_list.php"
url=url+"?q="+str
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=SubjstateChanged
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}
function SubjstateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("txtHint").innerHTML=xmlHttp.responseText 
 } 
}
function showmeta(xid,option)
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 } 
var url="ajaxtest.php"
url=url+"?xid="+xid+"&option="+option
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=MetastateChanged
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}
function MetastateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("txtDisplay").innerHTML=xmlHttp.responseText 
 } 
}
function stateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("txtHint").innerHTML=xmlHttp.responseText 
 } 
}
 
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;
}
