function display_coverter()
{	
	var display_area = document.getElementById('c_converter');
		display_area.innerHTML = "<img src='layout_images/loading.gif' align='absmiddle' /> Please wait ..Loading currency converter...";
		var xmlhttp = zXmlHttp.createRequest();
		xmlhttp.open('GET', 'includes/inc_disp_curr_cov.php', true);
		xmlhttp.onreadystatechange=function() {
			if (xmlhttp.readyState == 4) 
			{
				if(xmlhttp.status == 200)
				{
					var resp = xmlhttp.responseText;
					if(resp != ""){
						display_area.innerHTML = resp;
						return 1;						
					}
				}
			}
			else
			{
				display_area.innerHTML = "<img src='layout_images/loading.gif' align='absmiddle'/> Please wait ..Loading currency converter...";
			}
		}
	xmlhttp.send(null);
}

function get_rate()
{	
	var curr_amount = document.getElementById('curr_amount'); 
	var from_curr = document.getElementById('from_curr'); 	
	var to_curr = document.getElementById('to_curr'); 
	var display_area = document.getElementById('c_converter');
	var f_v =from_curr.value;
	var t_v =to_curr.value;
	
	if(curr_amount.value.length == 0){
		alert("Please enter a currency value to convert!");
		curr_amount.focus();
	}

	if((curr_amount.value.length != 0))
	{
		display_area.innerHTML = "<img src='layout_images/loading.gif' align='absmiddle' /> Please wait ..Loading conversion results...";
		var xmlhttp = zXmlHttp.createRequest();
		var parameters = 'curr_amount='+curr_amount.value+'&from_curr='+f_v+'&to_curr='+t_v+'&t='+new Date().getTime(); 
		//var parameters = 'curr_amount=10&from_curr=AED&to_curr=PKR&t='+new Date().getTime(); 
		//alert(parameters);
		xmlhttp.open('POST', 'includes/inc_g_currency_api.php', true);
		xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		xmlhttp.setRequestHeader("Content-length", parameters.length);
		xmlhttp.setRequestHeader("Connection", "close");
		xmlhttp.send(parameters);
		
		xmlhttp.onreadystatechange=function() {
			if (xmlhttp.readyState == 4) 
			{
				if(xmlhttp.status == 200)
				{
					var data = xmlhttp.responseText;
					if(data != ""){
						display_area.innerHTML = "<div align=center><font color='red'>"+data+"</font><br /><br /><a href=\"javascript:display_coverter();\">Reload Converter</a><br /><br/><span class=\"greytext\">Disclaimer: This currency converter provides rates only for information purposes, we do not guarantee the accuracy of the exchange rates provided.Please confirm current rates before making any transactions.</span></div>";
						return 1;						
					}
				}
			}
			else
			{
				display_area.innerHTML = "<img src='layout_images/loading-sml.gif' align='absmiddle' /> Please wait ..Loading latest news...";
			}
		}
	
	}

}
//--------

function get_news_data(offset)
{	
		var scroll_area = document.getElementById('scroller');
		scroll_area.innerHTML = "<img src='layout_images/loading-sml.gif' align='absmiddle' /> Please wait ..Loading latest news...";
		var xmlhttp = zXmlHttp.createRequest();
		xmlhttp.open('GET', 'news-scroller.php?o='+offset, true);
		xmlhttp.onreadystatechange=function() {
			if (xmlhttp.readyState == 4) 
			{
				if(xmlhttp.status == 200)
				{
					var resp = xmlhttp.responseText;
					if(resp != ""){

						scroll_area.innerHTML = resp;
						return 1;						
					}
				}
			}
			else
			{
				scroll_area.innerHTML = "<img src='layout_images/loading-sml.gif' align='absmiddle'/> Please wait ..Loading latest news...";
			}
		}
	xmlhttp.send(null);

}