// Function make_ajax_request(php_executor,settings)
// Handles an ajax request to server
// php_executor :: Php file to call
// settings :: list of settings to pass using the url

function make_ajax_request(php_executor,settings) {
	var random = new Date();
	var req = null; 
	if (window.XMLHttpRequest) { 
		req = new XMLHttpRequest();
		if (req.overrideMimeType) {req.overrideMimeType('text/xml');}
	} else if (window.ActiveXObject) {
		try { req = new ActiveXObject("Msxml2.XMLHTTP"); }
		catch (e) {
			try { req = new ActiveXObject("Microsoft.XMLHTTP"); }
			catch (e) {}
		}
	}

	req.onreadystatechange = function() { if(req.readyState == 4) { return(req.responseText); } }; 

	req.open("GET",php_executor+"?"+settings+'&random='+random.getTime(),true);
	req.send(null);

}





// Function end_visit()
// Makes an ajax request to update the "end" filed of table stats_visit
// Function called when the user closes the window, change his location, refresh the page, press alt+f4 ...

function end_visit() {

	make_ajax_request('fileadmin/php/flash/end_visit.php','abc=1');

}





// Function resize_window()
// Resizes the window if it is too small

function resize_window() {
	top.resizeTo(1024,800);
}