var xmlHttp;
var responseText;
var result;
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;
}

function setCurrency(lang)
{  	
	var param;
	xmlHttp=GetXmlHttpObject();
	param="?val="+lang;
	if (xmlHttp==null)
	{
	  alert ("Your browser does not support AJAX!");
	  return;
	}
    xmlHttp.onreadystatechange=function()
      {
      	if(xmlHttp.readyState==4)
      	{         		  
      		var result_string = xmlHttp.responseText; 	//alert(result_string);
      		if(result_string != "OK!")
      		{
      			alert(result_string);
      		}
      		else
      		{  
				if(window.location.href.indexOf("?",0)==-1){
					window.location.href=window.location.href+"?c=c";
				}else{
					window.location.href=window.location.href+"&c=c";
				}
      		}
      	}
      }
	 //alert(param);
		xmlHttp.open("GET","setcurrency.php"+param,true);
		xmlHttp.send(null); 
}
