// JavaScript Document
var xmlHttp

function showRSS(str,page)
 { 
 xmlHttp=GetXmlHttpObject()
 if (xmlHttp==null)
  {
  alert ("Browser does not support HTTP Request")
  return
  }
 var url="getrss.php"
 url=url+"?q="+str+"&page="+page;
 url=url+"&sid="+Math.random()
 xmlHttp.onreadystatechange=stateChanged 
 xmlHttp.open("GET",url,true)
 xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded;charset=utf-8;");
 xmlHttp.send(null)
 }
 
 
 function addRSS(str,name)
 { 
 xmlHttp=GetXmlHttpObject()
 if (xmlHttp==null)
  {
  alert ("Browser does not support HTTP Request")
  return
  }
 var url="addrss.php"
 url=url+"?link="+str+"&name="+name;
 //url=url+"&sid="+Math.random()
 xmlHttp.onreadystatechange=stateChanged 
 xmlHttp.open("GET",url,true)
 xmlHttp.send(null)
 }
 
 
function saveRSS(title,description,link_rss,date,cannal_id)
 { 
//alert(cannal_id);
 xmlHttp=GetXmlHttpObject()
 if (xmlHttp==null)
  {
  alert ("Browser does not support HTTP Request")
  return
  }

 var url="save.php";
  url=url+"?title="+encodeURI(title)+"&description="+encodeURI(description)+"&link="+encodeURI(link_rss)+"&date="+encodeURI(date)+"&q="+cannal_id;
 //url=url+"&sid="+Math.random()
 xmlHttp.onreadystatechange=stateChanged ;
 xmlHttp.open('GET', url, true); 
 xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded;charset=UTF-8;");
 xmlHttp.setRequestHeader("Content-length", url.length);
 xmlHttp.setRequestHeader("Connection", "close");
 //xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded;charset=UTF-8;");
 //xmlHttp.open("GET",url,true)
 xmlHttp.send(null)
 }
 
 
function delRSS(user_id,rss_id)
 { 

 xmlHttp=GetXmlHttpObject()
 if (xmlHttp==null)
  {
  alert ("Browser does not support HTTP Request")
  return
  }

 var url="del.php";
  url=url+"?user_id="+user_id+"&rss_id="+rss_id;
 //url=url+"&sid="+Math.random()
 xmlHttp.onreadystatechange=stateChanged 
 xmlHttp.open("GET",url,true)
 xmlHttp.send(null)
 } 
 
 
 function printRSS(rss_id) {
	 var url="print.php";
	  url=url+"?title="+title+"&description="+description+"&link="+link_rss+"&date="+date+"&cannal_id="+cannal_id;

	 window.open(url,'','');
 }
 
 
 function searchRSS(search_text,search_type,old){
	 //alert(search_text)
	xmlHttp=GetXmlHttpObject()
	 if (xmlHttp==null)
	  {
	  alert ("Browser does not support HTTP Request")
	  return
	  }
	  //alert(old.checked);
	  if(!old.checked)
	  	old = '';
	  else
	  	old = 'on';
	 var url="getrss.php"
	 url=url+"?search_text="+encodeURI(search_text)+"&search_type="+encodeURI(search_type)+"&old="+old;
	 url=url+"&sid="+Math.random()
	 xmlHttp.onreadystatechange=stateChanged 	 
	 xmlHttp.open("GET",url,true)
	 xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded;charset=utf-8;");	 
	 xmlHttp.send(null)
 }
 
 
function stateChanged() 
 { 
 if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
  { 
  	 document.getElementById('ajax-loader-1').style.display = 'none'; 
	 document.getElementById("rssOutput").style.display = 'inline';	 
  	 document.getElementById("rssOutput").innerHTML=xmlHttp.responseText 
	 //alert(document.getElementById("rssOutput").innerHTML);
  } 
  else 
  {
	 document.getElementById("rssOutput").style.display = 'none';
	 document.getElementById('ajax-loader-1').style.display = 'inline'; 
  }
 }

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;
}