var lastQ;
var lastTab = 0;

function showRecord(arg) { 
//arg = db/tbl/fld/arg
	lastQ = arg;
	if ($('recmenu')) {
		lastTab = $('recmenu').currenttab;
	}
	$('content').update("<div class='loader'><img src='resources/indicator.gif' alt='loading' width='16' height='16' /><br />loading...<br /><br /><br /><br /></div>");
	var url="ajax.php";
	myRand=parseInt(Math.random()*99999999);
	url=url+"?"+"fakecache="+myRand;
	new Ajax.Updater("content", url, { method: 'get', evalScripts: true, parameters: {args: arg, lastt: lastTab} });
	//var menutit = $('lftcl').firstChild;
	//menutit.innerHTML = "<a href='"+window.location.href+"'>"+menutit.innerHTML+"</a>";
	}
	
function recfield(id,fld,val) {
	if (fld=='public') $(fld+'_'+id).setAttribute('src','icm/resources/public.gif');
	var url ='change.php';
	myRand=parseInt(Math.random()*99999999);
	var vars = "ID="+id+"&fld="+fld+"&val="+val+"&fakecache="+myRand;
		new Ajax.Request(url, {method: 'post', postBody: vars,
		 onSuccess: function(transport) {
		 	var thisResp = transport.responseText.split(':');
		 	if (thisResp[1]==="1") {
		 		newsrc = 'icm/resources/public.gif';
		 		newtit = ' nascondi '
		 	} else {
		 		newsrc = 'icm/resources/not_public.gif';
		 		newtit = ' pubblica '
		 	}
		 	$(fld+'_'+id).setAttribute('src',newsrc);
		 	$(fld+'_'+id).setAttribute('title',newtit);
		}
	});
}

function showImageBrowser() {
	imWindow = window.open("imagebrowser.php?d=images/prodotti/hires","imWindow","width=284,height=800,location=0,resizable=0,scrollbars=1");
}