//<![CDATA[
Array.prototype.in_array = function(p_val) {
	for(var i = 0, l = this.length; i < l; i++) {
		if(this[i] == p_val) {
			return true;
		}
	}
	return false;
}
function envoieRequete(file,div,arrParamsKeys,arrParamsValues,execFunction,exFunctionargs)
{
	var xhr_object = null;
	if(window.XMLHttpRequest) // Firefox
	   xhr_object = new XMLHttpRequest();
	else if(window.ActiveXObject) // Internet Explorer
	   xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
	else { // XMLHttpRequest non supporté par le navigateur
	   alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest...");
	   return;
	}	
	var div = div;
	var file = file;

	xhr_object.onreadystatechange = function() {
	   if(xhr_object.readyState == 4){
			if(div!="")
			{
				document.getElementById(div).innerHTML="";
				document.getElementById(div).innerHTML =xhr_object.responseText;
			}		   	
			if(execFunction!="" && exFunctionargs==""){
			   	execFunction(xhr_object.responseText);			
			}
			else if(execFunction!="")
			{
				execFunction(exFunctionargs);
			}
	   }
	}
	xhr_object.open("POST", file, true);
	xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	data="";
	for (i=0;i<arrParamsKeys.length;i++){
		data+="&"+arrParamsKeys[i]+"="+arrParamsValues[i];
	}
	xhr_object.send(data);
}

function xss_ajax(url) {
        var script_id = null;
        var script = document.createElement('script');
        script.setAttribute('type', 'text/javascript');
        script.setAttribute('src', url);
        script.setAttribute('id', 'script_id');

        script_id = document.getElementById('script_id');
        if(script_id){
            document.getElementsByTagName('head')[0].removeChild(script_id);
        }

        // Insert <script> into DOM
        document.getElementsByTagName('head')[0].appendChild(script);
    }

    function callback(data) {
        var txt = '';
        for(var key in data) {
            txt += key + " = " + data[key];
            txt += "\n";
        }
        alert(txt);
    }

    var url = "http://alvin.boldlygoingnowhere.org/examples/xss/callback_json.php";


//]]>