INWORK1 = false;
function action()
{
	if(INWORK1==false)
	{
	var ors = document.getElementsByName("iconx");
	for(var i=0;i<ors.length;i++)
	{
		if(ors[i].checked)
		{
			tM = ors[i].value;
		}
	}
	
	e('URL').disabled = 'disabled';
	e('results').innerHTML = '<div align="center" style="padding:10px;color:#999999">Tikriname...<br /><div style="padding:2px" align="center"><img src="loading.gif" alt="" /></div></div>';
	
	ajax();
	}
}

function e(item)
{
	return document.getElementById(item);
}

function ajax(ijx)
{
	var http = false;
	if(navigator.appName == "Microsoft Internet Explorer")
	{
		http = new ActiveXObject("Microsoft.XMLHTTP");
	}
	else
	{
		http = new XMLHttpRequest();
	}
	
	if(ijx!=null)
	{
		LEVEL = 2;
		http.open("GET", "includes/calculator.php?icon="+encodeURIComponent(tM)+"&&URL="+encodeURIComponent(e('URL').value));
	}
	else
	{
		LEVEL = 1;
		http.open("GET", "includes/calculator.php?icon="+encodeURIComponent(tM)+"&&URL="+encodeURIComponent(e('URL').value));
	}
	http.onreadystatechange=function()
	{
		if(http.readyState == 4)
		{
			var res = http.responseText;
			if(LEVEL == 1)
			{
				e('URL').disabled = '';
				e('URL').value = 'http://';
				e('results').innerHTML = res;
				INWORK1 = false;
			}
			else if(LEVEL == 2)
			{
			   var a = res.split('__');
			   if(!a[0])
			   {
				   a[0] = "No response";
			   }
			   else if(a[0]=='noCurl')
			   {
				   a[0] = "no Curl";
			   }
			   GPR.e('myGPR'+a[1]).innerHTML = '<img src="img/pr_'+a[0]+'.png">';
			   if(TTC_COUNT > TTC_MAX)
			   {
				   clearTimeout(TTC_TIMER);
				}
				else
				{
					
					TTC_TIMER = setTimeout(TTC, 1000);
				}
			}
		}
	}
	http.send(null);
}

