	function ajax_get(adresa, handler, eroare) {
		var ajaxRequest;

		try {
			// Opera 8.0+, Firefox, Safari
			ajaxRequest = new XMLHttpRequest();
		} catch (e){
			// Internet Explorer
			try {
				ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
			} catch (e) {
				try {
					ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
				} catch (e) {
					if (eroare)
						eroare();
					//ajaxRequest = false;
					return false;
				}
			}
		}

		ajaxRequest.onreadystatechange = function() {
			if(ajaxRequest.readyState == 4) {
				//*alert(adresa + "  LOADED (GET)");
				if (handler)
					handler(ajaxRequest.responseText);
			}
		}

		ajaxRequest.open("GET", adresa, true);
		ajaxRequest.send(null);
		return true;
	}

	function ajax_post(adresa, date, handler, eroare) {
		//*alert("POST : " + adresa + " * " + date);

		var ajaxRequest;

		try {
			// Opera 8.0+, Firefox, Safari
			ajaxRequest = new XMLHttpRequest();
			if (ajaxRequest.overrideMimeType) {
				//http_request.overrideMimeType('text/xml');
				ajaxRequest.overrideMimeType('text/html');
			}
		} catch (e){
			// Internet Explorer
			try {
				ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
			} catch (e) {
				try {
					ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
				} catch (e) {
					if (eroare)
						eroare();
					//ajaxRequest = false;
					return false;
				}
			}
		}

		ajaxRequest.onreadystatechange = function() {
			if(ajaxRequest.readyState == 4) {
				//*alert(adresa + "  LOADED (POST)");
				if (handler)
					handler(ajaxRequest.responseText);
			}
		}

		ajaxRequest.open("POST", adresa, true);
		ajaxRequest.setRequestHeader("Referer", "www.sexyme.ro");
		ajaxRequest.setRequestHeader("Content-length", date.length);
		ajaxRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		ajaxRequest.setRequestHeader("Connection", "close");

		ajaxRequest.send(date);
		return true;
	}

//////////////////////////// ajax - script ////////////////////////////
function ajax_jump(adresa, tinta) {

	//*alert("GET JUMP : " + adresa);

	function myhandler(continut) {
		if (tinta)
			tinta.innerHTML = continut;
		else
			document.getElementById('page').innerHTML = continut;
		include_script(aux[1]);
		//*alert(continut);
	};

	var aux=adresa.split('?');
	ajax_get('page.php?'+aux[1], myhandler);

	return false;
}

function ajax_jump_post(adresa, date, tinta) {

	//*alert("POST JUMP : " + adresa);

	function myhandler(continut) {
		if (tinta)
			tinta.innerHTML = continut;
		else
			document.getElementById('page').innerHTML = continut;
	};

	var aux=adresa.split('?');
	ajax_post('page.php?'+aux[1], date, myhandler);
	include_script(aux[1]);

	return false;
}

function include_script(destinatie) {
	var parametrii = destinatie.split("&");
	var functie = parametrii[0].split("=");
	var fisier = new String();

	if (functie[0] != "page") {
		alert("parametru invalid pt functia include_script : " + destinatie);
		return;
	} else {
		fisier = "script.php?" + destinatie;
	}

	if (is_loaded(fisier)) {
		//*alert("script "+fisier+ " was already added");
	} else {
		//*alert("adding script : "+ fisier);
		var	js = document.createElement('script');
			js.setAttribute('language', 'javascript');
			js.setAttribute('type', 'text/javascript');
			js.setAttribute('src', fisier);
		//alert('loading script from : ' + fisier);
		var	html_doc = document.getElementsByTagName('head').item(0);
			html_doc.appendChild(js);
		window.script_list[window.script_list.length] = fisier;
		//*alert("adding script : "+ fisier + " DONE");
	}

	if ( !(window.run_script) )
		window.run_script = new Array();
	window.run_script.push(functie[1]);
/*
	alert(' looking for function ' + functie[1]);
	var comanda = functie[1] + "('" + 'nothing' + "');";
	eval("var test= typeof("+functie[1]+")");
	//alert(functie[1]+ " " + test);
	if (test == 'function') {
		alert("executing : " + functie[1] + "();");
		eval(functie[1] + "();");
	} else
		alert(test);
*/
}

function is_loaded(fisier) {
	if (window.script_list) {
		for (var i=0; i<window.script_list.length; i++)
			if (window.script_list[i] == fisier)
				return true;
		return false;
	} else {
		window.script_list = new Array();
		window.script_list[0] = fisier;
		return false;
	}
}

function ajax_init() {
	if (! (window.run_script) )
		return;

	while(window.run_script.length > 0) {
		var script_to_run = window.run_script.shift();
		eval("var test= typeof("+script_to_run+")");

		if (test == 'function') {
			alert("executing : " + script_to_run + "();");
			eval(script_to_run + "();");
		}
	}
}

function execute(functie, parametrii) {
	if (functie)
		functie(parametrii);
	else
		alert('pls wait a second till i load this :)');
}

function GET_HTTP_QueryString(Query_String_Name) {
	var i, pos, argname, argvalue, queryString, pairs;
	// get the string following the question mark
	queryString = location.href.substring(location.href.indexOf("?")+1);
	// split parameters into pairs, assuming pairs are separated by ampersands
	pairs = queryString.split("&");
	// for each pair, we get the name and the value
	for (i = 0; i < pairs.length; i++) { 
		pos = pairs[i].indexOf('='); 
		if (pos == -1) {
		continue; 
		}
		argname = pairs[i].substring(0,pos);
		argvalue = pairs[i].substring(pos+1); 
		// Replaces "Google-style" + signs with the spaces they represent
		if (argname == Query_String_Name) {
			return unescape(argvalue.replace(/\+/g, " "));
		}
	}
	return false;
}

function preg4post(str){
	return str.replace(/&/g,'[(:ampersand:)]');
}