var xmlhttpRecParola;

function GetXmlHttpObject(){
	var xmlhttp=null;
	try {
		// Firefox, Opera 8.0+, Safari
		xmlhttp=new XMLHttpRequest();
	} catch (e)  {
		// Internet Explorer
		try {
			xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
		} catch (e) {
			xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
	}
	return xmlhttp;
}

function printSwitch() {
	normalSwitch()
	linkel=document.createElement("link");
	linkel.href = '/www/around/style/style_print.css';
	linkel.type = 'text/css';
	linkel.rel = 'stylesheet';
	linkel.id = 'dinlink';
	document.getElementById('printLink').appendChild(linkel);
	document.getElementById('printBtn').style.display = 'none';
	document.getElementById('normalBtn').style.display = 'block';
}

function normalSwitch() {
	if (document.getElementById('printLink').firstChild)
		document.getElementById('printLink').firstChild.href = '';
	var len = document.getElementById('printLink').childNodes.length;
	for(var i = 0; i < len; i++) {
		document.getElementById('printLink').removeChild(document.getElementById('printLink').firstChild);
	}
	document.getElementById('printLink').innerHTML = '';
	document.getElementById('printBtn').style.display = 'block';
	document.getElementById('normalBtn').style.display = 'none';
}

function rec_parola(email,target_id,url) {
	xmlhttpRecParola=GetXmlHttpObject()
	if (xmlhttpRecParola==null) {
		alert ("Your browser does not support AJAX!");
		return;
	}
	xmlhttpRecParola.onreadystatechange = function() {
		if (xmlhttpRecParola.readyState==4 || xmlhttpRecParola.readyState=="complete") {
			document.getElementById(target_id).innerHTML = '';
			document.getElementById(target_id).innerHTML = xmlhttpRecParola.responseText;
		}
	}
	// Send the POST request
	xmlhttpRecParola.open('POST',url+'ajax/rec_parola.php', true);
	xmlhttpRecParola.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	xmlhttpRecParola.send('email='+email);
}
