var http_request = false;
var target_div="";
var temp=window.location.href.split("/");
var CurrentDomain="http://"+temp[2];

function makeRequest1(req, div_id, target_script, ajax_type)
{
	target_div=div_id;
	showLayer(target_div);
	if (http_request)
		http_request = false;
	// Standard way of initializing the HTTPRequest ------	
	if (window.XMLHttpRequest)
	{
		// Mozilla, Safari,...
		http_request = new XMLHttpRequest();
		if (http_request.overrideMimeType)
		{
			http_request.overrideMimeType('text/xml');
			// See note below about this line
		}
	}
	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('Oops, we are experiencing some technical difficulties. Please try again later!');
		return false;
	}
	// Standard way of initializing the HTTPRequest ------	

	http_request.onreadystatechange = alertContents;
	if (ajax_type=='GET')
	{
		if (req!="") {
			req="?"+req;
		}
//		alert(CurrentDomain+target_script+req);
//		http_request.open('GET', CurrentDomain+target_script+req, true);
		http_request.open('GET', target_script+req, true);
		http_request.send(null);
	}
	else
	{
//		http_request.open('POST', CurrentDomain+target_script, true);
		http_request.open('POST', target_script, true);
		http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		http_request.setRequestHeader("Content-length", req.length);
		http_request.setRequestHeader("Connection", "close");
		http_request.send(req);
	}	
}

var loading_content = "<img src='../../images/working.gif' />";
function alertContents()
{
	if (http_request.readyState == 4)
	{
//		if (http_request.status == 200)
			document.getElementById(target_div).innerHTML =	http_request.responseText;	
//		else
//			document.getElementById(target_div).innerHTML =	loading_content;
	}
	else
	{
		document.getElementById(target_div).innerHTML =	loading_content;
	}
}

function showLayer(whichLayer)
{
	if (document.getElementById)
	{
		document.getElementById(whichLayer).style.display="block";
		document.getElementById("ifrm").style.display="block";	
	}
	else if (document.all)
	{
		// this is the way old msie versions work
		document.all[whichLayer].style.display="block";
		document.all["ifrm"].style.display="block";	
	}
	else if (document.layers)
	{
		// this is the way nn4 works
		document.layers[whichLayer].style.display="block";
		document.layers["ifrm"].style.display="block";
	}
	return true;
}

function hideLayer(whichLayer)
{
	if (document.getElementById)
	{
		document.getElementById(whichLayer).style.display="none";
		document.getElementById("ifrm").style.display="none";	
	}
	else if (document.all)
	{
		// this is the way old msie versions work
		document.all[whichLayer].style.display="none";
		document.all["ifrm"].style.display="none";	
	}
	else if (document.layers)
	{
		// this is the way nn4 works
		document.layers[whichLayer].style.display="none";
		document.layers["ifrm"].style.display="none";
	}
	return true;		
}