/*
function doRequest(where,post,doFunction,error) {
  this.Display = function(result) { doFunction(result.responseText); }
  this.Fail = function(result){ if(error) alert(error);}
  YAHOO.util.Connect.asyncRequest('POST',where,{success:this.Display,failure:this.Fail},post);       
}
*/

function list_setQuoteStatus(record, status) {
	if(typeof(record) == "string") {
		YAHOO.util.Connect.asyncRequest(
			'POST',
			'index.php',
			{ 
				success: function(results) {
					results = results.responseText;
					//alert(results);
					var obj = eval(results);
					if(obj[0]) obj = obj[0];
					if(typeof(obj) == "object") {
						alert(obj['message']);
						if(typeof(obj['record']) == "string" && obj['record'].length == 36) {
							var status = document.getElementById('statusListEcmService_'+obj['record']);
							if(status) status.innerHTML = obj['status']['image'];
							if(obj['list_images']) {
								var list_images = document.getElementById('optionsListEcmService_'+obj['record']);
								if(list_images && list_images.parentNode) list_images.parentNode.innerHTML = obj['list_images'];
							}
						}
					}
				},
				failure: function() {}
			},
			'module=EcmServices&action=SetStatus&to_pdf=1&status='+status+'&record='+record+'&ListQuotesModule='+ListQuotesModule+'&ListQuotesAction='+ListQuotesAction
		);
	}	
}

var UserAccessToListItems = new Object();


function list_showStatusMenu(record) {
	var div = document.getElementById('list_statusMenu');
	if(!div) {
		div = document.createElement('div');
		div.className = 'list_statusMenu';
		div.id = 'list_statusMenu';
		document.body.appendChild(div);
	}
	if(div) {
		var statusSpan = document.getElementById('statusListEcmService_'+record);	
		if(statusSpan) {
			var XY = YAHOO.util.Dom.getXY(statusSpan);
			div.style.left = XY[0]+statusSpan.offsetWidth;
			div.style.top = XY[1];
			if(typeof(EcmServicesStatusMenu) == "object") {
				var html = '';
				for(x in EcmServicesStatusMenu) {
					html += EcmServicesStatusMenu[x]['enabled'];
				}
				div.innerHTML = html;
			}
		}
	}
}

function list_hideStatusMenu(record) {
	alert('hide');
}


YAHOO.util.Event.addListener(
	window, 
	"load", 
	function() {
		//alert(EcmServicesStatusMenu);	
	}
);