// JavaScript Document
var xmlHttp;
function createXMLHttpRequest() 
{ 
if(window.XMLHttpRequest) 
{ 
xmlHttp=new XMLHttpRequest();
}
else if(window.ActiveXObject) 
{ 
try
{ 
xmlHttp=new ActiveX0bject("Msxml2.XMLHTTP");
} 
catch(e) 
{} 
try
{ 
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
catch(e)
{} 
if(!xmlHttp) 
{ 
window.alert("Can't create XMLHttpRequest"); 
return false; 
} 
} 
}
function startRequest(url) 
{ 
createXMLHttpRequest();
xmlHttp.open("GET",url,true); 
xmlHttp.onreadystatechange=handleStateChange; 
xmlHttp.send(null); 
//startRequest2();
} 

function GoHit(url)
{ 
createXMLHttpRequest();
xmlHttp.open("GET",url,true); 
xmlHttp.send(null);
} 

function handleStateChange() 
{ 
if(xmlHttp.readyState==4) 
{
if(xmlHttp.status==200) 
{   
  document.getElementById('format-search-form').innerHTML = xmlHttp.responseText; 
} 
} 
}

function showElementById(id)
{
	document.getElementById(id).style.display="";
}

function Get_next_item()
{
   var Value = document.formatitem.format1.options[document.formatitem.format1.selectedIndex].text; 
   startRequest('/format-search/search.php?format1='+Value);
}

function Get_url()
{
   var Value = document.formatitem.format1.options[document.formatitem.format1.selectedIndex].text; 
   var Value2 = document.formatitem.format2.options[document.formatitem.format2.selectedIndex].text; 
   startRequest('/format-search/search.php?format1='+Value+'&format2='+Value2);
}

function ToPage()
{
   	var url = document.getElementById('url').value;
	var ID = document.getElementById('id').value;
	GoHit('/format-search/hit.php?id='+ID);	
	setTimeout("window.location.href = '"+url+"'",1000);
	return false;
}
