var xmlHttp

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 ajax_call(page)
{ 	
	xmlHttp.open("GET",page,true)
	xmlHttp.send(null)
}

function ajax_window(page, parameters, width)
{
	var f = document.getElementById('popup_window');
	
	if ( parameters === undefined ) 
		parameters = '';

	f.style.display='block';
	if ( width !== undefined ) 
		document.getElementById('ajax_content').style.width = width + 'px';
	else
		document.getElementById('ajax_content').style.width ='400px';
	
	f.style.height=f.parentNode.clientHeight+'px';
	
	if (window.scrollY>100)
		scroll(0,190);

	$.ajax({
	  	url: '/control/ajax_modules/ajax_pages/'+page+'.php?'+parameters,
		dataType: "html",
		async:false,
	  	success: function(data) {
			$('#ajax_content').html(data);
			form_events();
			//alert('Load was performed.');
	  	}
	});
	
}

function close_popup()
{
	document.getElementById('popup_window').style.display='none';
	document.getElementById('ajax_content').innerHTML = "<h1>Loading</h1><img src=\"/images/ajax_loader.gif\" />";
}
