var http_request = false;

function makeRequest(url,func_action) 
{
	http_request = false;

	if (window.XMLHttpRequest) 
	{ // Mozilla, Safari,...
    	http_request = new XMLHttpRequest();
    	if (http_request.overrideMimeType) 
    	{
        	http_request.overrideMimeType('text/xml');
    	}
	} 
	else if (window.ActiveXObject) 
	{ // IE
    	try {
        	http_request = new ActiveXObject("Msxml2.XMLHTTP");
    	} 
    	catch (e) 
    	{
        	try {
            	http_request = new ActiveXObject("Microsoft.XMLHTTP");
        	} catch (e) {}
    	}
	}
	if (!http_request) 
	{
    	alert('Giving up; Cannot create an XMLHTTP instance');
    	return false;
	}
	if(func_action!='')
	{
		eval ('http_request.onreadystatechange = ' + func_action);
	}
	http_request.open('GET', url, true);
	http_request.send(null);
}
    
function checkDomain() 
{
	if (http_request.readyState == 4) 
	{
		if (http_request.status == 200) 
		{
			var xmldoc = http_request.responseXML;
			
			var check_domain_result = xmldoc.getElementsByTagName('check_domain_result').item(0).firstChild.data;
			
			document.getElementById('check_domain').innerHTML=check_domain_result;
			
		} 
	}
}    

function checkMapDomain() 
{
	if (http_request.readyState == 4) 
	{
		if (http_request.status == 200) 
		{
			var xmldoc = http_request.responseXML;
			
			var check_domain_result = xmldoc.getElementsByTagName('check_domain_result').item(0).firstChild.data;
			
			document.getElementById('check_map_domain').innerHTML=check_domain_result;
			
		} 
	}
}

function showMapDomainAjax() 
{
	if (http_request.readyState == 4) 
	{
		if (http_request.status == 200) 
		{
			var xmldoc = http_request.responseXML;
			
			var show_map_domain = xmldoc.getElementsByTagName('show_map_domain').item(0).firstChild.data;
			var show_monthly = xmldoc.getElementsByTagName('show_monthly').item(0).firstChild.data;
			
			if (show_map_domain=='1')
			{
				document.getElementById('domain').disabled=false;
				document.getElementById('domain_table').className='domain_table_white';
			}
			else
			{
				document.getElementById('domain').value='';
				document.getElementById('check_map_domain').innerHTML='';
				document.getElementById('domain').disabled=true;
				document.getElementById('domain_table').className='domain_table_gray';
			}
			
			if (show_monthly=='1')
			{
				document.getElementById('show_monthly').style.display='block';
				if (document.getElementById('monthly1').checked)
				{
					document.getElementById('show_promotion_code').style.display='block';
				}
			}
			else
			{
				document.getElementById('show_monthly').style.display='none';
				document.getElementById('show_promotion_code').style.display='none';
			}
			
		} 
	}
}

function checkPromotionCodeT() 
{
	if (http_request.readyState == 4) 
	{
		if (http_request.status == 200) 
		{
			var xmldoc = http_request.responseXML;
			
			var  promotion_code_html= xmldoc.getElementsByTagName('promotion_code_html').item(0).firstChild.data;
			
			document.getElementById('promotion_code_html').innerHTML=promotion_code_html;
			
		} 
	}
}    

function changeStates()
{
	if (http_request.readyState == 4) 
	{
		if (http_request.status == 200) 
		{
			var xmldoc = http_request.responseXML;
			
			var states_html = xmldoc.getElementsByTagName('states_html').item(0).firstChild.data;
			
			document.getElementById('states_html').innerHTML=states_html;
		} 
	}
}            
