var xmlHttp
var temp = new Array();
var linkArray = new Array();
var titleArray = new Array();
function showRSS(str)
 { 
 xmlHttp=GetXmlHttpObject()
 if (xmlHttp==null)
  {
  alert ("Browser does not support HTTP Request")
  return
  }
 var url="getrss.php"
 url=url+"?q="+str
 url=url+"&sid="+Math.random()
 xmlHttp.onreadystatechange=stateChanged 
 xmlHttp.open("GET",url,true)
 xmlHttp.send(null)
 }
function addOption(selectbox,text,value, id)
{
	var optn = document.createElement("option");
	optn.text = text;
	optn.value = value;
	optn.id = id;
	selectbox.options.add(optn);
}
function stateChanged() 
 { 
 if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
  { 
	temp = xmlHttp.responseText.split('*');
	var linkposition=0;
	var titleposition=0;
	//resets the dropdown before populating it
	document.getElementById('title').options.length = 0;
	for (var i=0; i<temp.length; i++)
	{
		if(i%2==0)
		{
			linkArray[linkposition]=temp[i];
			linkposition++;
		}
		else
		{
			titleArray[titleposition]=temp[i];
			addOption(document.titleform.title, titleArray[titleposition], titleposition, titleposition);
			titleposition++;
		}
	}
	//set selected item to the first link
	var selectedTitle = document.getElementById( 0 );
	selectedTitle.selected = true;
	//set myframe to the first link
	document.getElementById("myframe").src=linkArray[0];
  } 
 }
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;
}
