	function userinput_setfocus() {
		document.QuestionForm.BOTQuestion.focus();
	}
	
	function PopUp(newUrl) {
		parent.mainFrame.location.href="../" + newUrl;
	}

	function sessionTimeout() {
		var text = new Array();
		text[0] = "Non stai più parlando con me.<br>Fra un pò me ne vado.";
		text[1] = "A quanto pare non vuoi più chiedermi<br>niente. Penso che fra poco me ne andrò.";
		text[2] = "Non mi chiedi più niente?";
		document.getElementById('answer').innerHTML = '<p>'+text[Math.round(2*Math.random())]+'</p>';
		setTimeout('Close_bot(\'<p>Non mi stai chiedendo più niente,<br> quindi ti saluto e alla prossima!</p>\')', 60000);
	} 
	
	function verifyBotQuestion() {
		if (document.getElementById('BOTQuestion').value.length == 0) 
			return false;
		//else if (document.getElementById('BOTQuestion').value.length > 150)
			//document.getElementById('BOTQuestion').value = "bot_question_too_long";
		return true; 
	}
	
	// #----------> Funzioni richiamate da js_execute all'interno di NLI:
	function Open_Win(theURL,target,W,H,scroll) {
		var par;
		par = 'width=' + W + ',height=' + H + ',left=0,top=0,resizable=yes,toolbar=yes,directories=yes,menubar=yes,scrollbars=' + scroll;
		newWin = window.open(theURL,target,par);
		if (window.focus) 
			newWin.focus();
	}

	function Open_Popup(theURL,target,W,H,scroll) {
		var xPos;
		if (W != '') 
			xPos = screen.width - W;
		else
			xPos = W;
		var par;
		//par = 'width=' + W + ',height=' + H + ',left=0,top=0,toolbar=no,directories=no,menubar=no,scrollbars=' + scroll;
		par = 'width=' + W + ',height=' + H + ',left='+xPos+',top=0,toolbar=no,directories=no,menubar=no,scrollbars=' + scroll;
		newWin = window.open(theURL,target,par);
		if (window.focus) 
			newWin.focus();
	}

	function Shut_bot(str) {
		setTimeout('self.location.href=(\''+str+'\')', 6000);
	}
	
	function Close_bot() {
		setTimeout('self.close()', 10000);
	}
	
	function Close_bot(str) {
		document.getElementById('answer').innerHTML = str;
		setTimeout('self.close()', 5000);
	}

	// #----------> Funzioni per la gestione delle webaction quando il bot si trova in una popup
	
	function Open_Win_From_Popup(theURL,target,W,H,scroll) {
		window.opener.location.href=theURL;
		//passa il focus sulla nuova pagina e dopo un tot sul bot nuovamente
		if (window.focus)
			window.opener.focus();		
		window.setTimeout("window.focus()",5000);
	}
	
	function Open_Win_From_Popup_And_Close(theURL,target,W,H,scroll) {
		window.opener.location.href=theURL;
		window.setTimeout("self.close()",10000);
	}

	// #----------> Funzioni per i link cliccabili negli output del Bot:

	function sendInput(str) {
			//top.vaframes.document.QuestionForm.BOTQuestion.value=str;
			document.QuestionForm.BOTQuestion.value=str;
		/*try
		{
			top.vaframes.document.QuestionForm.BOTQuestion.value=str;
			//parent.set_recv_output();*/
			//top.vaframes.document.QuestionForm.submit();/*
			document.QuestionForm.submit();/*
		}
		catch(e)
		{
			document.write('Funzionalità di memoria utente temporaneamente disabilitata per motivi tecnici.');
		}*/
	}

	// #----------> Funzione per la parte audio del bot

	function PlaySound(what)
	{
		document.write ("<EMBED src='"+what+"' autostart='true' loop='false' volume='100' hidden='true'>");
		document.write ("<NOEMBED><BGSOUND src='"+what+"'></NOEMBED>");
	}
	
	function OperatoreVirtuale()
	{
		document.write ("<object type='application/x-shockwave-flash' data='./images/OperatoreVirtuale.swf' width='128' height='204'>");
		document.write ("<param name='movie' value='./images/OperatoreVirtuale.swf'>");
		document.write ("<param name='quality' value='high'>");
		document.write ("<param name='loop' value='off'>");
		document.write ("</object>");
	}
	
	function Dreams()
	{
		window.open ("http://www.dreams-co.com/operatore_cc/", "_new","resizable,toolbar=yes,directories=yes,menubar=yes,scrollbars=yes,url=yes");
	}
