
/*
* Fichier: functions.js
*/

function reload(img_id) {
	
	var img_el = document.getElementById(img_id);
	var new_url = new String('images/captcha.php?'+Math.random());
	
	img_el.src = new_url;
	new_url = null;
	
}


function highlight_flag(filename, img_id) {
	
	var new_url = new String(filename+'?'+Math.random());
	
	img_id.src = new_url;
	new_url = null;
	
}


/* @Ajax part */

function getXhr() {
	var xhr;
	
	if(window.XMLHttpRequest || window.ActiveXObject) {
		if(window.XMLHttpRequest) {
			xhr = new XMLHttpRequest(); 
		}
		else {
			try {
				xhr = new ActiveXObject("Msxml2.XMLHTTP");
			}
			catch(e) {
				xhr = new ActiveXObject("Microsoft.XMLHTTP");
			}
		}
	}
	else {
		alert("XMLHTTPRequest is not supported by your browser!");
		return;
	}
	
	return xhr;
}
