// JavaScript Document
function ajaxFunctionPrev(base_url)
{
 xmlHttp = ajaxHTTPObject();


   xmlHttp.onreadystatechange=function()
    {
	//	alert('on change');
		//alert(xmlHttp.readyState);
    if(xmlHttp.readyState==4)
      {
//	  	alert('here in');
		
		  document.getElementById("calendar").innerHTML=xmlHttp.responseText;
	  }
	  
    }
		var year = document.getElementById('sel_year');
		var month = document.getElementById('sel_month');
	
   xmlHttp.open("GET",base_url+"eventcalendar/get_calendar_prev/"+year.value+"/"+month.value,true);  

  xmlHttp.send(null);
  
 
  }
  
  function ajaxFunctionNext(base_url)
{
 xmlHttp = ajaxHTTPObject();


   xmlHttp.onreadystatechange=function()
    {
	//	alert('on change');
		//alert(xmlHttp.readyState);
    if(xmlHttp.readyState==4)
      {
//	  	alert('here in');
		
		  document.getElementById("calendar").innerHTML=xmlHttp.responseText;
	  }
	  
    }
		var year = document.getElementById('sel_year');
		var month = document.getElementById('sel_month');
		
   xmlHttp.open("GET",base_url+"eventcalendar/get_calendar_next/"+year.value+"/"+month.value,true);  
// xmlHttp.open("GET","calendar",true);
  xmlHttp.send(null);
 
  }
function update(text) {
	document.getElementById('source').value = text;
	document.getElementById('autocomplete-popup').style.display = "none";
}
function ajaxFunctionAuto(base_url)
{

 xmlHttp = ajaxHTTPObject();


   xmlHttp.onreadystatechange=function()
    {
	//	alert('on change');
		//alert(xmlHttp.readyState);
    if(xmlHttp.readyState==4)
      {
//	  	alert('here in');
		
		  document.getElementById("autocomplete-popup").innerHTML=xmlHttp.responseText;
		  document.getElementById("autocomplete-popup").style.display= '';
	  }
	  
    }
		
	
   xmlHttp.open("GET",base_url+"admin/news/auto_complete_for_source/",true);  

  xmlHttp.send(null);
  
 
  }
  
  
  
  function returnCurrencyRate(base_url)
  {
   xmlHttp = ajaxHTTPObject();
   xmlHttp.onreadystatechange=function()
    {
    
	if(xmlHttp.readyState==4)
      {
	  //alert(xmlHttp.responseText);
	  document.getElementById("cunvert_result").innerHTML=xmlHttp.responseText;
	  document.getElementById("cunvert_result").style.visibility= 'visible';
	  }else{
		  document.getElementById("cunvert_result").style.visibility= 'hidden';
	  }
	  
    }
	
	xmlHttp.open("GET",base_url+"forex/convertCurrency/"+document.getElementById("currencyFrom").options[document.getElementById("currencyFrom").selectedIndex].value+"/"+document.getElementById("currencyFrom").options[document.getElementById("currencyTo").selectedIndex].value,true);  
  	xmlHttp.send(null);
  }
  
   function reloadCalendar(base_url)
  {

   xmlHttp = ajaxHTTPObject();
   xmlHttp.onreadystatechange=function()
    {
    
	if(xmlHttp.readyState==4)
      {

	  document.getElementById("cal_drop").innerHTML=xmlHttp.responseText;
	//  document.getElementById("cunvert_result").style.visibility= 'visible';
	  }else{
		//  document.getElementById("cunvert_result").style.visibility= 'hidden';
	  }
	  
    }
	
	xmlHttp.open("GET",base_url+"home/get_new_calendar/"+document.getElementById("year").options[document.getElementById("year").selectedIndex].value+"/"+document.getElementById("month").options[document.getElementById("month").selectedIndex].value,true);  
  	xmlHttp.send(null);
  }
  
  
  
  
  function ajaxHTTPObject(){
	var xmlHttp;
	try
  	{
  	// Firefox, Opera 8.0+, Safari
  		xmlHttp=new XMLHttpRequest();
  	}
	catch (e)
  	{
	  // Internet Explorer
	  try
		{
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
	  catch (e)
		{
		try
		  {
		  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		  }
		catch (e)
		  {
		  alert("Your browser does not support AJAX!");
		  return false;
		  }
    	}
 	
 	}
	return xmlHttp;
  }
