var ipm = {};

ipm.ajax = {
	
	onRequest: function(fieldID) {
		if($(fieldID)) $(fieldID).addClass('ipm_loader');
		$('docBody').setStyle('cursor','wait');
	},
	
	onComplete: function(fieldID) {
		if($(fieldID)) $(fieldID).removeClass('ipm_loader');
		$('docBody').setStyle('cursor','default');
	},
	
	addOption: function(selectId, txt, val, defSel){
		// if Safari/Konqueror
		if(window.webkit) {	
			var element = $(selectId);
			var newone = new Option(txt,val,defSel);
			element.add(newone,element.options[element.options.length]);
		// if Internet Explorer (any)
		} else if(window.ie) {
			var objOption = new Option(txt, val, defSel, defSel);
			$(selectId).options.add(objOption);
		// if Mozilla/Gecko/Opera
		} else {
			var objOption = new Option(txt, val, defSel);
			$(selectId).options.add(objOption);
		}
	},
	
	clearOptionList: function(selectId){
		if($(selectId)) $(selectId).empty();
	}
	
};
