
// Script for the Chat portlet
function pop_it(the_form) 
{
   my_form = document.getElementById(the_form);
   window.open('blank', 'tchat', "height=440, width=640, menubar='no', toolbar='no', location='no', status='no', scrollbars='no'");
   my_form.target = "tchat";
   my_form.submit();
   popup.focus();
}

// Ajoute un module au portail utilisateur
function add_portal_module( module, number )
{
	sheet = document.getElementById( "cmbSheet_"+module ).value;
	if( sheet == "" ) {
		alert( "Vous devez sélectionnez l'onglet dans lequel le portlet doit être ajouté !" );
	} else if( module <= 0 || module == "" ) {
		alert( "Vous devez sélectionnez le module à ajouter au portail !" );
	} 
	else 
	{
		// alert( "Ajout du module "+module+" dans onglet "+sheet );
		var url = "index2.php?RID=31&ACT=AddPortalItem&sheet="+sheet+"&comp="+module;
		var params = "";
		new Ajax.Request(url, {
		  method: 'get',
		  onComplete: function(transport) {
			if (transport.status == 200) {
				status = transport.responseText;
				printInfoNs( status );
			}
			else printInfoNs('There was a problem with the request.');
		  }
		});
	}
}

function get_town(field,span,hid_f, n_div, p_typ) {
	if (field.value.length<4) return;
	var url = "_ajax_get_weather.php?town="+encodeURI(field.value)+"&field="+hid_f+"&div="+n_div+"&typ="+p_typ;
	var params = "";
	new Ajax.Request(url, {
		method: 'get',
		onComplete: function(transport) {
			if (transport.status == 200) {
				status = transport.responseText;
				if (status!="empty") document.getElementById(span).innerHTML = status;
			} else printInfoNs('There was a problem with the request: ' + url + 'and '+span);
		}
	});
}