function $(pid, id)
{

	if(!id) {
		return document.getElementById(pid);
	} else {
		return jQuery('#'+pid+'frm').find('*[id='+id+']').get(0);
	}

	/*
	if(!pid || !id) {
		alert('E\' necessario chimare la funzione $ con i prarametri pid e id');
		return false;
	} else {
		return jQuery('#'+pid+'frm').find('*[id='+id+']').get(0);
		//return document.getElementById(id);
	}
	*/
}

function submitFormNs(pid)
{
	jQuery('#'+pid+'frm').submit();
}

function submitFormNsGA(pid, gaq)
{
	try
	{
		var action = jQuery('#'+pid+'frm').attr("action");
		
		if (gaq)
			if (action.indexOf('?')>0)	
				 action += '&gaq=' + encodeURIComponent(gaq);
			else action += '?gaq=' + encodeURIComponent(gaq);
			
		jQuery('#'+pid+'frm').attr("action", action);
	}
	catch(e) {}
	
	submitFormNs(pid);	
}

function openPopupNs(url)
{
	window.open(url, '', 'resizable=yes,width=840,status=no,location=no,toolbar=no,scrollbars=yes');
}

