Index: controlies/trunk/applications/controlies/controllers/grupos.py
===================================================================
--- controlies/trunk/applications/controlies/controllers/grupos.py	(revision 240)
+++ controlies/trunk/applications/controlies/controllers/grupos.py	(revision 241)
@@ -48,6 +48,16 @@
     response = g.delete()
     l.close()
     return dict(response=response)
+
+@service.json  
+@auth.requires_login()    
+def getUsers():
+    l=conecta()
+    g = Groups(l,"",request.vars['row_id'],"")
+    a=request.vars
+    response = g.listUsers(a)
+    l.close()
+    return response  
     
 def search():
     return dict()
Index: controlies/trunk/applications/controlies/static/js/jdgrid/grid.locale-es.js
===================================================================
--- controlies/trunk/applications/controlies/static/js/jdgrid/grid.locale-es.js	(nonexistent)
+++ controlies/trunk/applications/controlies/static/js/jdgrid/grid.locale-es.js	(revision 241)
@@ -0,0 +1,128 @@
+;(function($){
+/**
+ * jqGrid Spanish Translation
+ * Traduccion jqGrid en Español por Yamil Bracho
+ * Traduccion corregida y ampliada por Faserline, S.L. 
+ * http://www.faserline.com
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl.html
+**/
+$.jgrid = {
+	defaults : {
+		recordtext: "Mostrando {0} - {1} de {2}",
+	    emptyrecords: "Sin registros que mostrar",
+		loadtext: "Cargando...",
+		pgtext : "Página {0} de {1}"
+	},
+	search : {
+	    caption: "Búsqueda...",
+	    Find: "Buscar",
+	    Reset: "Limpiar",
+	    odata : ['igual ', 'no igual a', 'menor que', 'menor o igual que','mayor que','mayor o igual a', 'empiece por','no empiece por','está en','no está en','termina por','no termina por','contiene','no contiene'],
+	    groupOps: [	{ op: "AND", text: "todo" },	{ op: "OR",  text: "cualquier" }	],
+		matchText: " match",
+		rulesText: " reglas"
+	},
+	edit : {
+	    addCaption: "Agregar registro",
+	    editCaption: "Modificar registro",
+	    bSubmit: "Guardar",
+	    bCancel: "Cancelar",
+		bClose: "Cerrar",
+		saveData: "Se han modificado los datos, ¿guardar cambios?",
+		bYes : "Si",
+		bNo : "No",
+		bExit : "Cancelar",
+	    msg: {
+	        required:"Campo obligatorio",
+	        number:"Introduzca un número",
+	        minValue:"El valor debe ser mayor o igual a ",
+	        maxValue:"El valor debe ser menor o igual a ",
+	        email: "no es una dirección de correo válida",
+	        integer: "Introduzca un valor entero",
+			date: "Introduza una fecha correcta ",
+			url: "no es una URL válida. Prefijo requerido ('http://' or 'https://')",
+			nodefined : " no está definido.",
+			novalue : " valor de retorno es requerido.",
+			customarray : "La función personalizada debe devolver un array.",
+			customfcheck : "La función personalizada debe estar presente en el caso de validación personalizada."
+		}
+	},
+	view : {
+	    caption: "Consultar registro",
+	    bClose: "Cerrar"
+	},
+	del : {
+	    caption: "Eliminar",
+	    msg: "¿Desea eliminar los registros seleccionados?",
+	    bSubmit: "Eliminar",
+	    bCancel: "Cancelar"
+	},
+	nav : {
+		edittext: " ",
+	    edittitle: "Modificar fila seleccionada",
+		addtext:" ",
+	    addtitle: "Agregar nueva fila",
+	    deltext: " ",
+	    deltitle: "Eliminar fila seleccionada",
+	    searchtext: " ",
+	    searchtitle: "Buscar información",
+	    refreshtext: "",
+	    refreshtitle: "Recargar datos",
+	    alertcap: "Aviso",
+	    alerttext: "Seleccione una fila",
+		viewtext: "",
+		viewtitle: "Ver fila seleccionada"
+	},
+	col : {
+	    caption: "Mostrar/ocultar columnas",
+	    bSubmit: "Enviar",
+	    bCancel: "Cancelar"	
+	},
+	errors : {
+		errcap : "Error",
+		nourl : "No se ha especificado una URL",
+		norecords: "No hay datos para procesar",
+	    model : "Las columnas de nombres son diferentes de las columnas de modelo"
+	},
+	formatter : {
+		integer : {thousandsSeparator: ".", defaultValue: '0'},
+		number : {decimalSeparator:",", thousandsSeparator: ".", decimalPlaces: 2, defaultValue: '0,00'},
+		currency : {decimalSeparator:",", thousandsSeparator: ".", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0,00'},
+		date : {
+			dayNames:   [
+				"Do", "Lu", "Ma", "Mi", "Ju", "Vi", "Sa",
+				"Domingo", "Lunes", "Martes", "Miercoles", "Jueves", "Viernes", "Sabado"
+			],
+			monthNames: [
+				"Ene", "Feb", "Mar", "Abr", "May", "Jun", "Jul", "Ago", "Sep", "Oct", "Nov", "Dic",
+				"Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"
+			],
+			AmPm : ["am","pm","AM","PM"],
+			S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'},
+			srcformat: 'Y-m-d',
+			newformat: 'd-m-Y',
+			masks : {
+	            ISO8601Long:"Y-m-d H:i:s",
+	            ISO8601Short:"Y-m-d",
+	            ShortDate: "n/j/Y",
+	            LongDate: "l, F d, Y",
+	            FullDateTime: "l, F d, Y g:i:s A",
+	            MonthDay: "F d",
+	            ShortTime: "g:i A",
+	            LongTime: "g:i:s A",
+	            SortableDateTime: "Y-m-d\\TH:i:s",
+	            UniversalSortableDateTime: "Y-m-d H:i:sO",
+	            YearMonth: "F, Y"
+	        },
+	        reformatAfterEdit : false
+		},
+		baseLinkUrl: '',
+		showAction: '',
+	    target: '',
+	    checkbox : {disabled:true},
+		idName : 'id'
+	}
+};
+})(jQuery);
Index: controlies/trunk/applications/controlies/static/js/jdgrid/src/grid.common.js
===================================================================
--- controlies/trunk/applications/controlies/static/js/jdgrid/src/grid.common.js	(revision 240)
+++ controlies/trunk/applications/controlies/static/js/jdgrid/src/grid.common.js	(revision 241)
@@ -1,629 +1,669 @@
-/*
- * jqGrid common function
- * Tony Tomov tony@trirand.com
- * http://trirand.com/blog/ 
- * Dual licensed under the MIT and GPL licenses:
- * http://www.opensource.org/licenses/mit-license.php
- * http://www.gnu.org/licenses/gpl-2.0.html
-*/ 
-// Modal functions
-var showModal = function(h) {
-	h.w.show();
-};
-var closeModal = function(h) {
-	h.w.hide().attr("aria-hidden","true");
-	if(h.o) { h.o.remove(); }
-};
-var hideModal = function (selector,o) {
-	o = jQuery.extend({jqm : true, gb :''}, o || {});
-    if(o.onClose) {
-		var oncret =  o.onClose(selector);
-		if (typeof oncret == 'boolean'  && !oncret ) { return; }
-    }	
-	if (jQuery.fn.jqm && o.jqm === true) {
-		jQuery(selector).attr("aria-hidden","true").jqmHide();
-	} else {
-		if(o.gb != '') {
-			try {jQuery(".jqgrid-overlay:first",o.gb).hide();} catch (e){}
-		}
-		jQuery(selector).hide().attr("aria-hidden","true");
-	}
-};
-//Helper functions
-function findPos(obj) {
-	var curleft = 0, curtop = 0;
-	if (obj.offsetParent) {
-		do {
-			curleft += obj.offsetLeft;
-			curtop += obj.offsetTop; 
-		} while (obj = obj.offsetParent);
-		//do not change obj == obj.offsetParent 
-	}
-	return [curleft,curtop];
-}
-var createModal = function(aIDs, content, p, insertSelector, posSelector, appendsel) {
-	var mw  = document.createElement('div'), rtlsup;
-	rtlsup = jQuery(p.gbox).attr("dir") == "rtl" ? true : false;
-	mw.className= "ui-widget ui-widget-content ui-corner-all ui-jqdialog";
-	mw.id = aIDs.themodal; 
-	var mh = document.createElement('div');
-	mh.className = "ui-jqdialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix";
-	mh.id = aIDs.modalhead;
-	jQuery(mh).append("<span class='ui-jqdialog-title'>"+p.caption+"</span>");
-	var ahr= jQuery("<a href='javascript:void(0)' class='ui-jqdialog-titlebar-close ui-corner-all'></a>")
-	.hover(function(){ahr.addClass('ui-state-hover');},
-		   function(){ahr.removeClass('ui-state-hover');})
-	.append("<span class='ui-icon ui-icon-closethick'></span>");
-	jQuery(mh).append(ahr);
-	if(rtlsup) {
-		mw.dir = "rtl";
-		jQuery(".ui-jqdialog-title",mh).css("float","right");
-		jQuery(".ui-jqdialog-titlebar-close",mh).css("left",0.3+"em");
-	} else {
-		mw.dir = "ltr";
-		jQuery(".ui-jqdialog-title",mh).css("float","left");
-		jQuery(".ui-jqdialog-titlebar-close",mh).css("right",0.3+"em");
-	}
-	var mc = document.createElement('div');
-	jQuery(mc).addClass("ui-jqdialog-content ui-widget-content").attr("id",aIDs.modalcontent);
-	jQuery(mc).append(content);
-	mw.appendChild(mc);
-	jQuery(mw).prepend(mh);
-	if(appendsel===true) { jQuery('body').append(mw); } //append as first child in body -for alert dialog
-	else {jQuery(mw).insertBefore(insertSelector);}
-	if(typeof p.jqModal === 'undefined') {p.jqModal = true;} // internal use
-	var coord = {};
-	if ( jQuery.fn.jqm && p.jqModal === true) {
-		if(p.left ===0 && p.top===0) {
-			var pos = [];
-			pos = findPos(posSelector);
-			p.left = pos[0] + 4;
-			p.top = pos[1] + 4;
-		}
-		coord.top = p.top+"px";
-		coord.left = p.left;
-	} else if(p.left !==0 || p.top!==0) {
-		coord.left = p.left;
-		coord.top = p.top+"px";
-	}
-	jQuery("a.ui-jqdialog-titlebar-close",mh).click(function(e){
-		var oncm = jQuery("#"+aIDs.themodal).data("onClose") || p.onClose;
-		var gboxclose = jQuery("#"+aIDs.themodal).data("gbox") || p.gbox;
-		hideModal("#"+aIDs.themodal,{gb:gboxclose,jqm:p.jqModal,onClose:oncm});
-		return false;
-	});
-	if (p.width === 0 || !p.width) {p.width = 300;}
-	if(p.height === 0 || !p.height) {p.height =200;}
-	if(!p.zIndex) {p.zIndex = 950;}
-	var rtlt = 0;
-	if( rtlsup && coord.left && !appendsel) {
-		rtlt = jQuery(p.gbox).width()- (!isNaN(p.width) ? parseInt(p.width,10) :0) - 8; // to do
-		// just in case
-		coord.left = parseInt(coord.left,10) + parseInt(rtlt,10);
-	}
-	if(coord.left) { coord.left += "px"; }
-	jQuery(mw).css(jQuery.extend({
-		width: isNaN(p.width) ? "auto": p.width+"px",
-		height:isNaN(p.height) ? "auto" : p.height + "px",
-		zIndex:p.zIndex,
-		overflow: 'hidden'
-	},coord))
-	.attr({tabIndex: "-1","role":"dialog","aria-labelledby":aIDs.modalhead,"aria-hidden":"true"});
-	if(typeof p.drag == 'undefined') { p.drag=true;}
-	if(typeof p.resize == 'undefined') {p.resize=true;}
-	if (p.drag) {
-		jQuery(mh).css('cursor','move');
-		if(jQuery.fn.jqDrag) {
-			jQuery(mw).jqDrag(mh);
-		} else {
-			try {
-				jQuery(mw).draggable({handle: jQuery("#"+mh.id)});
-			} catch (e) {}
-		}
-	}
-	if(p.resize) {
-		if(jQuery.fn.jqResize) {
-			jQuery(mw).append("<div class='jqResize ui-resizable-handle ui-resizable-se ui-icon ui-icon-gripsmall-diagonal-se ui-icon-grip-diagonal-se'></div>");
-			jQuery("#"+aIDs.themodal).jqResize(".jqResize",aIDs.scrollelm ? "#"+aIDs.scrollelm : false);
-		} else {
-			try {
-				jQuery(mw).resizable({handles: 'se, sw',alsoResize: aIDs.scrollelm ? "#"+aIDs.scrollelm : false});
-			} catch (e) {}
-		}
-	}
-	if(p.closeOnEscape === true){
-		jQuery(mw).keydown( function( e ) {
-			if( e.which == 27 ) {
-				var cone = jQuery("#"+aIDs.themodal).data("onClose") || p.onClose;
-				hideModal(this,{gb:p.gbox,jqm:p.jqModal,onClose: cone});
-			}
-		});
-	}
-};
-var viewModal = function (selector,o){
-	o = jQuery.extend({
-		toTop: true,
-		overlay: 10,
-		modal: false,
-		onShow: showModal,
-		onHide: closeModal,
-		gbox: '',
-		jqm : true,
-		jqM : true
-	}, o || {});
-	if (jQuery.fn.jqm && o.jqm === true) {
-		if(o.jqM) { jQuery(selector).attr("aria-hidden","false").jqm(o).jqmShow(); }
-		else {jQuery(selector).attr("aria-hidden","false").jqmShow();}
-	} else {
-		if(o.gbox != '') {
-			jQuery(".jqgrid-overlay:first",o.gbox).show();
-			jQuery(selector).data("gbox",o.gbox);
-		}
-		jQuery(selector).show().attr("aria-hidden","false");
-		try{jQuery(':input:visible',selector)[0].focus();}catch(_){}
-	}
-};
-
-function info_dialog(caption, content,c_b, modalopt) {
-	var mopt = {
-		width:290,
-		height:'auto',
-		dataheight: 'auto',
-		drag: true,
-		resize: false,
-		caption:"<b>"+caption+"</b>",
-		left:250,
-		top:170,
-		zIndex : 1000,
-		jqModal : true,
-		modal : false,
-		closeOnEscape : true,
-		align: 'center',
-		buttonalign : 'center',
-		buttons : []
-		// {text:'textbutt', id:"buttid", onClick : function(){...}}
-		// if the id is not provided we set it like info_button_+ the index in the array - i.e info_button_0,info_button_1...
-	};
-	jQuery.extend(mopt,modalopt || {});
-	var jm = mopt.jqModal;
-	if(jQuery.fn.jqm && !jm) { jm = false; }
-	// in case there is no jqModal
-	var buttstr ="";
-	if(mopt.buttons.length > 0) {
-		for(var i=0;i<mopt.buttons.length;i++) {
-			if(typeof mopt.buttons[i].id == "undefined") { mopt.buttons[i].id = "info_button_"+i; }
-			buttstr += "<a href='javascript:void(0)' id='"+mopt.buttons[i].id+"' class='fm-button ui-state-default ui-corner-all'>"+mopt.buttons[i].text+"</a>";
-		}
-	}
-	var dh = isNaN(mopt.dataheight) ? mopt.dataheight : mopt.dataheight+"px",
-	cn = "text-align:"+mopt.align+";";
-	var cnt = "<div id='info_id'>";
-	cnt += "<div id='infocnt' style='margin:0px;padding-bottom:1em;width:100%;overflow:auto;position:relative;height:"+dh+";"+cn+"'>"+content+"</div>";
-	cnt += c_b ? "<div class='ui-widget-content ui-helper-clearfix' style='text-align:"+mopt.buttonalign+";padding-bottom:0.8em;padding-top:0.5em;background-image: none;border-width: 1px 0 0 0;'><a href='javascript:void(0)' id='closedialog' class='fm-button ui-state-default ui-corner-all'>"+c_b+"</a>"+buttstr+"</div>" :
-		buttstr != ""  ? "<div class='ui-widget-content ui-helper-clearfix' style='text-align:"+mopt.buttonalign+";padding-bottom:0.8em;padding-top:0.5em;background-image: none;border-width: 1px 0 0 0;'>"+buttstr+"</div>" : "";
-	cnt += "</div>";
-
-	try {
-		if(jQuery("#info_dialog").attr("aria-hidden") == "false") {
-			hideModal("#info_dialog",{jqm:jm});
-		}
-		jQuery("#info_dialog").remove();
-	} catch (e){}
-	createModal({
-		themodal:'info_dialog',
-		modalhead:'info_head',
-		modalcontent:'info_content',
-		scrollelm: 'infocnt'},
-		cnt,
-		mopt,
-		'','',true
-	);
-	// attach onclick after inserting into the dom
-	if(buttstr) {
-		jQuery.each(mopt.buttons,function(i){
-			jQuery("#"+this.id,"#info_id").bind('click',function(){mopt.buttons[i].onClick.call(jQuery("#info_dialog")); return false;});
-		});
-	}
-	jQuery("#closedialog", "#info_id").click(function(e){
-		hideModal("#info_dialog",{jqm:jm});
-		return false;
-	});
-	jQuery(".fm-button","#info_dialog").hover(
-		function(){jQuery(this).addClass('ui-state-hover');}, 
-		function(){jQuery(this).removeClass('ui-state-hover');}
-	);
-	viewModal("#info_dialog",{
-		onHide: function(h) {
-			h.w.hide().remove();
-			if(h.o) { h.o.remove(); }
-		},
-		modal :mopt.modal,
-		jqm:jm
-	});
-	try{$("#info_dialog").focus();} catch (e){}
-}
-// Form Functions
-function createEl(eltype,options,vl,autowidth, ajaxso) {
-	var elem = "";
-	if(options.defaultValue) { delete options.defaultValue; }
-	function bindEv (el, opt) {
-		if(jQuery.isFunction(opt.dataInit)) {
-			// datepicker fix 
-			el.id = opt.id;
-			opt.dataInit(el);
-			delete opt.id;
-			delete opt.dataInit;
-		}
-		if(opt.dataEvents) {
-		    jQuery.each(opt.dataEvents, function() {
-		        if (this.data !== undefined) {
-			        jQuery(el).bind(this.type, this.data, this.fn);
-		        } else {
-		            jQuery(el).bind(this.type, this.fn);
-		        }
-		    });
-			delete opt.dataEvents;
-		}
-		return opt;
-	}
-	switch (eltype)
-	{
-		case "textarea" :
-				elem = document.createElement("textarea");
-				if(autowidth) {
-					if(!options.cols) { jQuery(elem).css({width:"98%"});}
-				} else if (!options.cols) { options.cols = 20; }
-				if(!options.rows) { options.rows = 2; }
-				if(vl=='&nbsp;' || vl=='&#160;' || (vl.length==1 && vl.charCodeAt(0)==160)) {vl="";}
-				elem.value = vl;
-				options = bindEv(elem,options);
-				jQuery(elem).attr(options).attr({"role":"textbox","multiline":"true"});
-				break;
-		case "checkbox" : //what code for simple checkbox
-			elem = document.createElement("input");
-			elem.type = "checkbox";
-			if( !options.value ) {
-				var vl1 = vl.toLowerCase();
-				if(vl1.search(/(false|0|no|off|undefined)/i)<0 && vl1!=="") {
-					elem.checked=true;
-					elem.defaultChecked=true;
-					elem.value = vl;
-				} else {
-					elem.value = "on";
-				}
-				jQuery(elem).attr("offval","off");
-			} else {
-				var cbval = options.value.split(":");
-				if(vl === cbval[0]) {
-					elem.checked=true;
-					elem.defaultChecked=true;
-				}
-				elem.value = cbval[0];
-				jQuery(elem).attr("offval",cbval[1]);
-				try {delete options.value;} catch (e){}
-			}
-			options = bindEv(elem,options);
-			jQuery(elem).attr(options).attr("role","checkbox");
-			break;
-		case "select" :
-			elem = document.createElement("select");
-			elem.setAttribute("role","select");
-			var msl, ovm = [];
-			if(options.multiple===true) {
-				msl = true;
-				elem.multiple="multiple";
-				$(elem).attr("aria-multiselectable","true");
-			} else { msl = false; }
-			if(typeof(options.dataUrl) != "undefined") {
-				jQuery.ajax(jQuery.extend({
-					url: options.dataUrl,
-					type : "GET",
-					complete: function(data,status){
-						try {delete options.dataUrl; delete options.value;} catch (e){}
-						var a;
-						if(typeof(options.buildSelect) != "undefined") {
-							var b = options.buildSelect(data);
-							a = jQuery(b).html();
-							delete options.buildSelect;
-						} else {
-							a = jQuery(data.responseText).html();
-						}
-						if(a) {
-							jQuery(elem).append(a);
-							options = bindEv(elem,options);
-							if(typeof options.size === 'undefined') { options.size =  msl ? 3 : 1;}
-							if(msl) {
-								ovm = vl.split(",");
-								ovm = jQuery.map(ovm,function(n){return jQuery.trim(n);});
-							} else {
-								ovm[0] = jQuery.trim(vl);
-							}
-							jQuery(elem).attr(options);
-							setTimeout(function(){
-								jQuery("option",elem).each(function(i){
-									if(i===0) { this.selected = ""; }
-									$(this).attr("role","option");
-									if(jQuery.inArray(jQuery.trim(jQuery(this).text()),ovm) > -1 || jQuery.inArray(jQuery.trim(jQuery(this).val()),ovm) > -1 ) {
-										this.selected= "selected";
-										if(!msl) { return false; }
-									}
-								});
-							},0);
-						}
-					}
-				},ajaxso || {}));
-			} else if(options.value) {
-				var i;
-				if(msl) {
-					ovm = vl.split(",");
-					ovm = jQuery.map(ovm,function(n){return jQuery.trim(n);});
-					if(typeof options.size === 'undefined') {options.size = 3;}
-				} else {
-					options.size = 1;
-				}
-				if(typeof options.value === 'function') { options.value = options.value(); }
-				var so,sv, ov;
-				if(typeof options.value === 'string') {
-					so = options.value.split(";");
-					for(i=0; i<so.length;i++){
-						sv = so[i].split(":");
-						if(sv.length > 2 ) {
-							sv[1] = jQuery.map(sv,function(n,i){if(i>0) { return n;} }).join(":");
-						}
-						ov = document.createElement("option");
-						ov.setAttribute("role","option");
-						ov.value = sv[0]; ov.innerHTML = sv[1];
-						if (!msl &&  (jQuery.trim(sv[0]) == jQuery.trim(vl) || jQuery.trim(sv[1]) == jQuery.trim(vl))) { ov.selected ="selected"; }
-						if (msl && (jQuery.inArray(jQuery.trim(sv[1]), ovm)>-1 || jQuery.inArray(jQuery.trim(sv[0]), ovm)>-1)) {ov.selected ="selected";}
-						elem.appendChild(ov);
-					}
-				} else if (typeof options.value === 'object') {
-					var oSv = options.value;
-					for ( var key in oSv) {
-						if (oSv.hasOwnProperty(key ) ){
-							ov = document.createElement("option");
-							ov.setAttribute("role","option");
-							ov.value = key; ov.innerHTML = oSv[key];
-							if (!msl &&  ( jQuery.trim(key) == jQuery.trim(vl) || jQuery.trim(oSv[key]) == jQuery.trim(vl)) ) { ov.selected ="selected"; }
-							if (msl && (jQuery.inArray(jQuery.trim(oSv[key]),ovm)>-1 || jQuery.inArray(jQuery.trim(key),ovm)>-1)) { ov.selected ="selected"; }
-							elem.appendChild(ov);
-						}
-					}
-				}
-				options = bindEv(elem,options);
-				try {delete options.value;} catch (e){}
-				jQuery(elem).attr(options);
-			}
-			break;
-		case "text" :
-		case "password" :
-		case "button" :
-			var role;
-			if(eltype=="button") { role = "button"; }
-			else { role = "textbox"; }
-			elem = document.createElement("input");
-			elem.type = eltype;
-			elem.value = vl;
-			options = bindEv(elem,options);
-			if(eltype != "button"){
-				if(autowidth) {
-					if(!options.size) { jQuery(elem).css({width:"98%"}); }
-				} else if (!options.size) { options.size = 20; }
-			}
-			jQuery(elem).attr(options).attr("role",role);
-			break;
-		case "image" :
-		case "file" :
-			elem = document.createElement("input");
-			elem.type = eltype;
-			options = bindEv(elem,options);
-			jQuery(elem).attr(options);
-			break;
-		case "custom" :
-			elem = document.createElement("span");
-			try {
-				if(jQuery.isFunction(options.custom_element)) {
-					var celm = options.custom_element.call(this,vl,options);
-					if(celm) {
-						celm = jQuery(celm).addClass("customelement").attr({id:options.id,name:options.name});
-						jQuery(elem).empty().append(celm);
-					} else {
-						throw "e2";
-					}
-				} else {
-					throw "e1";
-				}
-			} catch (e) {
-				if (e=="e1") { info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_element' "+jQuery.jgrid.edit.msg.nodefined, jQuery.jgrid.edit.bClose);}
-				if (e=="e2") { info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_element' "+jQuery.jgrid.edit.msg.novalue,jQuery.jgrid.edit.bClose);}
-				else { info_dialog(jQuery.jgrid.errors.errcap,e.message,jQuery.jgrid.edit.bClose); }
-			}
-			break;
-	}
-	return elem;
-}
-// Date Validation Javascript
-function daysInFebruary (year){
-	// February has 29 days in any year evenly divisible by four,
-    // EXCEPT for centurial years which are not also divisible by 400.
-    return (((year % 4 === 0) && ( year % 100 !== 0 || (year % 400 === 0))) ? 29 : 28 );
-}
-function DaysArray(n) {
-	for (var i = 1; i <= n; i++) {
-		this[i] = 31;
-		if (i==4 || i==6 || i==9 || i==11) {this[i] = 30;}
-		if (i==2) {this[i] = 29;}
-	} 
-	return this;
-}
-function checkDate (format, date) {
-	var tsp = {}, sep;
-	format = format.toLowerCase();
-	//we search for /,-,. for the date separator
-	if(format.indexOf("/") != -1) {
-		sep = "/";
-	} else if(format.indexOf("-") != -1) {
-		sep = "-";
-	} else if(format.indexOf(".") != -1) {
-		sep = ".";
-	} else {
-		sep = "/";
-	}
-	format = format.split(sep);
-	date = date.split(sep);
-	if (date.length != 3) { return false; }
-	var j=-1,yln, dln=-1, mln=-1;
-	for(var i=0;i<format.length;i++){
-		var dv =  isNaN(date[i]) ? 0 : parseInt(date[i],10); 
-		tsp[format[i]] = dv;
-		yln = format[i];
-		if(yln.indexOf("y") != -1) { j=i; }
-		if(yln.indexOf("m") != -1) { mln=i; }
-		if(yln.indexOf("d") != -1) { dln=i; }
-	}
-	if (format[j] == "y" || format[j] == "yyyy") {
-		yln=4;
-	} else if(format[j] =="yy"){
-		yln = 2;
-	} else {
-		yln = -1;
-	}
-	var daysInMonth = DaysArray(12);
-	var strDate;
-	if (j === -1) {
-		return false;
-	} else {
-		strDate = tsp[format[j]].toString();
-		if(yln == 2 && strDate.length == 1) {yln = 1;}
-		if (strDate.length != yln || (tsp[format[j]]===0 && date[j]!="00")){
-			return false;
-		}
-	}
-	if(mln === -1) {
-		return false;
-	} else {
-		strDate = tsp[format[mln]].toString();
-		if (strDate.length<1 || tsp[format[mln]]<1 || tsp[format[mln]]>12){
-			return false;
-		}
-	}
-	if(dln === -1) {
-		return false;
-	} else {
-		strDate = tsp[format[dln]].toString();
-		if (strDate.length<1 || tsp[format[dln]]<1 || tsp[format[dln]]>31 || (tsp[format[mln]]==2 && tsp[format[dln]]>daysInFebruary(tsp[format[j]])) || tsp[format[dln]] > daysInMonth[tsp[format[mln]]]){
-			return false;
-		}
-	}
-	return true;
-}
-
-function isEmpty(val)
-{
-	if (val.match(/^s+$/) || val == "")	{
-		return true;
-	} else {
-		return false;
-	} 
-}
-function checkTime(time){
-	// checks only hh:ss (and optional am/pm)
-	var re = /^(\d{1,2}):(\d{2})([ap]m)?$/,regs;
-	if(!isEmpty(time))
-	{
-		regs = time.match(re);
-		if(regs) {
-			if(regs[3]) {
-				if(regs[1] < 1 || regs[1] > 12) { return false; }
-			} else {
-				if(regs[1] > 23) { return false; }
-			}
-			if(regs[2] > 59) {
-				return false;
-			}
-		} else {
-			return false;
-		}
-	}
-	return true;
-}
-function checkValues(val, valref,g) {
-	var edtrul,i, nm;
-	if(typeof(valref)=='string'){
-		for( i =0, len=g.p.colModel.length;i<len; i++){
-			if(g.p.colModel[i].name==valref) {
-				edtrul = g.p.colModel[i].editrules;
-				valref = i;
-				try { nm = g.p.colModel[i].formoptions.label; } catch (e) {}
-				break;
-			}
-		}
-	} else if(valref >=0) {
-		edtrul = g.p.colModel[valref].editrules;
-	}
-	if(edtrul) {
-		if(!nm) { nm = g.p.colNames[valref]; }
-		if(edtrul.required === true) {
-			if( val.match(/^s+$/) || val == "" )  { return [false,nm+": "+jQuery.jgrid.edit.msg.required,""]; }
-		}
-		// force required
-		var rqfield = edtrul.required === false ? false : true;
-		if(edtrul.number === true) {
-			if( !(rqfield === false && isEmpty(val)) ) {
-				if(isNaN(val)) { return [false,nm+": "+jQuery.jgrid.edit.msg.number,""]; }
-			}
-		}
-		if(typeof edtrul.minValue != 'undefined' && !isNaN(edtrul.minValue)) {
-			if (parseFloat(val) < parseFloat(edtrul.minValue) ) { return [false,nm+": "+jQuery.jgrid.edit.msg.minValue+" "+edtrul.minValue,""];}
-		}
-		if(typeof edtrul.maxValue != 'undefined' && !isNaN(edtrul.maxValue)) {
-			if (parseFloat(val) > parseFloat(edtrul.maxValue) ) { return [false,nm+": "+jQuery.jgrid.edit.msg.maxValue+" "+edtrul.maxValue,""];}
-		}
-		var filter;
-		if(edtrul.email === true) {
-			if( !(rqfield === false && isEmpty(val)) ) {
-			// taken from jquery Validate plugin
-				filter = /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i;
-				if(!filter.test(val)) {return [false,nm+": "+jQuery.jgrid.edit.msg.email,""];}
-			}
-		}
-		if(edtrul.integer === true) {
-			if( !(rqfield === false && isEmpty(val)) ) {
-				if(isNaN(val)) { return [false,nm+": "+jQuery.jgrid.edit.msg.integer,""]; }
-				if ((val % 1 !== 0) || (val.indexOf('.') != -1)) { return [false,nm+": "+jQuery.jgrid.edit.msg.integer,""];}
-			}
-		}
-		if(edtrul.date === true) {
-			if( !(rqfield === false && isEmpty(val)) ) {
-				var dft = g.p.colModel[valref].datefmt || "Y-m-d";
-				if(!checkDate (dft, val)) { return [false,nm+": "+jQuery.jgrid.edit.msg.date+" - "+dft,""]; }
-			}
-		}
-		if(edtrul.time === true) {
-			if( !(rqfield === false && isEmpty(val)) ) {
-				if(!checkTime (val)) { return [false,nm+": "+jQuery.jgrid.edit.msg.date+" - hh:mm (am/pm)",""]; }
-			}
-		}
-        if(edtrul.url === true) {
-            if( !(rqfield === false && isEmpty(val)) ) {
-                filter = /^(((https?)|(ftp)):\/\/([\-\w]+\.)+\w{2,3}(\/[%\-\w]+(\.\w{2,})?)*(([\w\-\.\?\\\/+@&#;`~=%!]*)(\.\w{2,})?)*\/?)/i;
-                if(!filter.test(val)) {return [false,nm+": "+jQuery.jgrid.edit.msg.url,""];}
-            }
-        }
-		if(edtrul.custom === true) {
-            if( !(rqfield === false && isEmpty(val)) ) {
-				if(jQuery.isFunction(edtrul.custom_func)) {
-					var ret = edtrul.custom_func.call(g,val,nm);
-					if(jQuery.isArray(ret)) {
-						return ret;
-					} else {
-						return [false,jQuery.jgrid.edit.msg.customarray,""];
-					}
-				} else {
-					return [false,jQuery.jgrid.edit.msg.customfcheck,""];
-				}
-			}
-		}
-	}
-	return [true,"",""];
-}
+;(function($){
+/*
+ * jqGrid common function
+ * Tony Tomov tony@trirand.com
+ * http://trirand.com/blog/ 
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl-2.0.html
+*/
+/*global jQuery, $ */
+
+$.extend($.jgrid,{
+// Modal functions
+	showModal : function(h) {
+		h.w.show();
+	},
+	closeModal : function(h) {
+		h.w.hide().attr("aria-hidden","true");
+		if(h.o) {h.o.remove();}
+	},
+	hideModal : function (selector,o) {
+		o = $.extend({jqm : true, gb :''}, o || {});
+		if(o.onClose) {
+			var oncret =  o.onClose(selector);
+			if (typeof oncret == 'boolean'  && !oncret ) { return; }
+		}
+		if ($.fn.jqm && o.jqm === true) {
+			$(selector).attr("aria-hidden","true").jqmHide();
+		} else {
+			if(o.gb !== '') {
+				try {$(".jqgrid-overlay:first",o.gb).hide();} catch (e){}
+			}
+			$(selector).hide().attr("aria-hidden","true");
+		}
+	},
+//Helper functions
+	findPos : function(obj) {
+		var curleft = 0, curtop = 0;
+		if (obj.offsetParent) {
+			do {
+				curleft += obj.offsetLeft;
+				curtop += obj.offsetTop;
+			} while (obj = obj.offsetParent);
+			//do not change obj == obj.offsetParent
+		}
+		return [curleft,curtop];
+	},
+	createModal : function(aIDs, content, p, insertSelector, posSelector, appendsel, css) {		
+		var mw  = document.createElement('div'), rtlsup, self = this;
+		css = $.extend({}, css || {});
+		rtlsup = $(p.gbox).attr("dir") == "rtl" ? true : false;
+		mw.className= "ui-widget ui-widget-content ui-corner-all ui-jqdialog";
+		mw.id = aIDs.themodal;
+		var mh = document.createElement('div');
+		mh.className = "ui-jqdialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix";
+		mh.id = aIDs.modalhead;
+		$(mh).append("<span class='ui-jqdialog-title'>"+p.caption+"</span>");
+		var ahr= $("<a href='javascript:void(0)' class='ui-jqdialog-titlebar-close ui-corner-all'></a>")
+		.hover(function(){ahr.addClass('ui-state-hover');},
+			   function(){ahr.removeClass('ui-state-hover');})
+		.append("<span class='ui-icon ui-icon-closethick'></span>");
+		$(mh).append(ahr);
+		if(rtlsup) {
+			mw.dir = "rtl";
+			$(".ui-jqdialog-title",mh).css("float","right");
+			$(".ui-jqdialog-titlebar-close",mh).css("left",0.3+"em");
+		} else {
+			mw.dir = "ltr";
+			$(".ui-jqdialog-title",mh).css("float","left");
+			$(".ui-jqdialog-titlebar-close",mh).css("right",0.3+"em");
+		}
+		var mc = document.createElement('div');
+		$(mc).addClass("ui-jqdialog-content ui-widget-content").attr("id",aIDs.modalcontent);
+		$(mc).append(content);
+		mw.appendChild(mc);
+		$(mw).prepend(mh);
+		if(appendsel===true) { $('body').append(mw); } //append as first child in body -for alert dialog
+		else if (typeof appendsel == "string")
+			$(appendsel).append(mw);
+		else {$(mw).insertBefore(insertSelector);}
+		$(mw).css(css);
+		if(typeof p.jqModal === 'undefined') {p.jqModal = true;} // internal use
+		var coord = {};
+		if ( $.fn.jqm && p.jqModal === true) {
+			if(p.left ===0 && p.top===0 && p.overlay) {
+				var pos = [];
+				pos = this.findPos(posSelector);
+				p.left = pos[0] + 4;
+				p.top = pos[1] + 4;
+			}
+			coord.top = p.top+"px";
+			coord.left = p.left;
+		} else if(p.left !==0 || p.top!==0) {
+			coord.left = p.left;
+			coord.top = p.top+"px";
+		}
+		$("a.ui-jqdialog-titlebar-close",mh).click(function(e){
+			var oncm = $("#"+aIDs.themodal).data("onClose") || p.onClose;
+			var gboxclose = $("#"+aIDs.themodal).data("gbox") || p.gbox;
+			self.hideModal("#"+aIDs.themodal,{gb:gboxclose,jqm:p.jqModal,onClose:oncm});
+			return false;
+		});
+		if (p.width === 0 || !p.width) {p.width = 300;}
+		if(p.height === 0 || !p.height) {p.height =200;}
+		if(!p.zIndex) {
+			var parentZ = $(insertSelector).parents("*[role=dialog]").filter(':first').css("z-index");
+			if(parentZ) {
+				p.zIndex = parseInt(parentZ,10)+1;
+			} else {
+				p.zIndex = 950;
+		}
+		}
+		var rtlt = 0;
+		if( rtlsup && coord.left && !appendsel) {
+			rtlt = $(p.gbox).width()- (!isNaN(p.width) ? parseInt(p.width,10) :0) - 8; // to do
+		// just in case
+			coord.left = parseInt(coord.left,10) + parseInt(rtlt,10);
+		}
+		if(coord.left) { coord.left += "px"; }
+		$(mw).css($.extend({
+			width: isNaN(p.width) ? "auto": p.width+"px",
+			height:isNaN(p.height) ? "auto" : p.height + "px",
+			zIndex:p.zIndex,
+			overflow: 'hidden'
+		},coord))
+		.attr({tabIndex: "-1","role":"dialog","aria-labelledby":aIDs.modalhead,"aria-hidden":"true"});
+		if(typeof p.drag == 'undefined') { p.drag=true;}
+		if(typeof p.resize == 'undefined') {p.resize=true;}
+		if (p.drag) {
+			$(mh).css('cursor','move');
+			if($.fn.jqDrag) {
+				$(mw).jqDrag(mh);
+			} else {
+				try {
+					$(mw).draggable({handle: $("#"+mh.id)});
+				} catch (e) {}
+			}
+		}
+		if(p.resize) {
+			if($.fn.jqResize) {
+				$(mw).append("<div class='jqResize ui-resizable-handle ui-resizable-se ui-icon ui-icon-gripsmall-diagonal-se ui-icon-grip-diagonal-se'></div>");
+				$("#"+aIDs.themodal).jqResize(".jqResize",aIDs.scrollelm ? "#"+aIDs.scrollelm : false);
+			} else {
+				try {
+					$(mw).resizable({handles: 'se, sw',alsoResize: aIDs.scrollelm ? "#"+aIDs.scrollelm : false});
+				} catch (r) {}
+			}
+		}
+		if(p.closeOnEscape === true){
+			$(mw).keydown( function( e ) {
+				if( e.which == 27 ) {
+					var cone = $("#"+aIDs.themodal).data("onClose") || p.onClose;
+					self.hideModal(this,{gb:p.gbox,jqm:p.jqModal,onClose: cone});
+				}
+			});
+		}
+	},
+	viewModal : function (selector,o){
+		o = $.extend({
+			toTop: true,
+			overlay: 10,
+			modal: false,
+			overlayClass : 'ui-widget-overlay',
+			onShow: this.showModal,
+			onHide: this.closeModal,
+			gbox: '',
+			jqm : true,
+			jqM : true
+		}, o || {});
+		if ($.fn.jqm && o.jqm === true) {
+			if(o.jqM) { $(selector).attr("aria-hidden","false").jqm(o).jqmShow(); }
+			else {$(selector).attr("aria-hidden","false").jqmShow();}
+		} else {
+			if(o.gbox !== '') {
+				$(".jqgrid-overlay:first",o.gbox).show();
+				$(selector).data("gbox",o.gbox);
+			}
+			$(selector).show().attr("aria-hidden","false");
+			try{$(':input:visible',selector)[0].focus();}catch(_){}
+		}
+	},
+
+	info_dialog : function(caption, content,c_b, modalopt) {
+		var mopt = {
+			width:290,
+			height:'auto',
+			dataheight: 'auto',
+			drag: true,
+			resize: false,
+			caption:"<b>"+caption+"</b>",
+			left:250,
+			top:170,
+			zIndex : 1000,
+			jqModal : true,
+			modal : false,
+			closeOnEscape : true,
+			align: 'center',
+			buttonalign : 'center',
+			buttons : []
+		// {text:'textbutt', id:"buttid", onClick : function(){...}}
+		// if the id is not provided we set it like info_button_+ the index in the array - i.e info_button_0,info_button_1...
+		};
+		$.extend(mopt,modalopt || {});
+		var jm = mopt.jqModal, self = this;
+		if($.fn.jqm && !jm) { jm = false; }
+		// in case there is no jqModal
+		var buttstr ="";
+		if(mopt.buttons.length > 0) {
+			for(var i=0;i<mopt.buttons.length;i++) {
+				if(typeof mopt.buttons[i].id == "undefined") { mopt.buttons[i].id = "info_button_"+i; }
+				buttstr += "<a href='javascript:void(0)' id='"+mopt.buttons[i].id+"' class='fm-button ui-state-default ui-corner-all'>"+mopt.buttons[i].text+"</a>";
+			}
+		}
+		var dh = isNaN(mopt.dataheight) ? mopt.dataheight : mopt.dataheight+"px",
+		cn = "text-align:"+mopt.align+";";
+		var cnt = "<div id='info_id'>";
+		cnt += "<div id='infocnt' style='margin:0px;padding-bottom:1em;width:100%;overflow:auto;position:relative;height:"+dh+";"+cn+"'>"+content+"</div>";
+		cnt += c_b ? "<div class='ui-widget-content ui-helper-clearfix' style='text-align:"+mopt.buttonalign+";padding-bottom:0.8em;padding-top:0.5em;background-image: none;border-width: 1px 0 0 0;'><a href='javascript:void(0)' id='closedialog' class='fm-button ui-state-default ui-corner-all'>"+c_b+"</a>"+buttstr+"</div>" :
+			buttstr !== ""  ? "<div class='ui-widget-content ui-helper-clearfix' style='text-align:"+mopt.buttonalign+";padding-bottom:0.8em;padding-top:0.5em;background-image: none;border-width: 1px 0 0 0;'>"+buttstr+"</div>" : "";
+		cnt += "</div>";
+
+		try {
+			if($("#info_dialog").attr("aria-hidden") == "false") {
+				this.hideModal("#info_dialog",{jqm:jm});
+			}
+			$("#info_dialog").remove();
+		} catch (e){}
+		this.createModal({
+			themodal:'info_dialog',
+			modalhead:'info_head',
+			modalcontent:'info_content',
+			scrollelm: 'infocnt'},
+			cnt,
+			mopt,
+			'','',true
+		);
+		// attach onclick after inserting into the dom
+		if(buttstr) {
+			$.each(mopt.buttons,function(i){
+				$("#"+this.id,"#info_id").bind('click',function(){mopt.buttons[i].onClick.call($("#info_dialog")); return false;});
+			});
+		}
+		$("#closedialog", "#info_id").click(function(e){
+			self.hideModal("#info_dialog",{jqm:jm});
+			return false;
+		});
+		$(".fm-button","#info_dialog").hover(
+			function(){$(this).addClass('ui-state-hover');},
+			function(){$(this).removeClass('ui-state-hover');}
+		);
+		if($.isFunction(mopt.beforeOpen) ) { mopt.beforeOpen(); }
+		this.viewModal("#info_dialog",{
+			onHide: function(h) {
+				h.w.hide().remove();
+				if(h.o) { h.o.remove(); }
+			},
+			modal :mopt.modal,
+			jqm:jm
+		});
+		if($.isFunction(mopt.afterOpen) ) { mopt.afterOpen(); }
+		try{ $("#info_dialog").focus();} catch (m){}
+	},
+// Form Functions
+	createEl : function(eltype,options,vl,autowidth, ajaxso) {
+		var elem = "";
+		function bindEv (el, opt) {
+			if($.isFunction(opt.dataInit)) {
+				opt.dataInit(el);
+			}
+			if(opt.dataEvents) {
+				$.each(opt.dataEvents, function() {
+					if (this.data !== undefined) {
+						$(el).bind(this.type, this.data, this.fn);
+					} else {
+						$(el).bind(this.type, this.fn);
+					}
+				});
+			}
+			return opt;
+		}
+		function setAttributes(elm, atr, exl ) {
+			var exclude = ['dataInit','dataEvents','dataUrl', 'buildSelect','sopt', 'searchhidden', 'defaultValue', 'attr'];
+			if(typeof(exl) != "undefined" && $.isArray(exl)) {
+				exclude = $.extend(exclude, exl);
+			}
+			$.each(atr, function(key, value){
+				if($.inArray(key, exclude) === -1) {
+					$(elm).attr(key,value);
+				}
+			});
+			if(!atr.hasOwnProperty('id')) {
+				$(elm).attr('id', $.jgrid.randId());
+			}
+		}
+		switch (eltype)
+		{
+			case "textarea" :
+				elem = document.createElement("textarea");
+				if(autowidth) {
+					if(!options.cols) { $(elem).css({width:"98%"});}
+				} else if (!options.cols) { options.cols = 20; }
+				if(!options.rows) { options.rows = 2; }
+				if(vl=='&nbsp;' || vl=='&#160;' || (vl.length==1 && vl.charCodeAt(0)==160)) {vl="";}
+				elem.value = vl;
+				setAttributes(elem, options);
+				options = bindEv(elem,options);
+				$(elem).attr({"role":"textbox","multiline":"true"});
+			break;
+			case "checkbox" : //what code for simple checkbox
+				elem = document.createElement("input");
+				elem.type = "checkbox";
+				if( !options.value ) {
+					var vl1 = vl.toLowerCase();
+					if(vl1.search(/(false|0|no|off|undefined)/i)<0 && vl1!=="") {
+						elem.checked=true;
+						elem.defaultChecked=true;
+						elem.value = vl;
+					} else {
+						elem.value = "on";
+					}
+					$(elem).attr("offval","off");
+				} else {
+					var cbval = options.value.split(":");
+					if(vl === cbval[0]) {
+						elem.checked=true;
+						elem.defaultChecked=true;
+					}
+					elem.value = cbval[0];
+					$(elem).attr("offval",cbval[1]);
+				}
+				setAttributes(elem, options, ['value']);
+				options = bindEv(elem,options);
+				$(elem).attr("role","checkbox");
+			break;
+			case "select" :
+				elem = document.createElement("select");
+				elem.setAttribute("role","select");
+				var msl, ovm = [];
+				if(options.multiple===true) {
+					msl = true;
+					elem.multiple="multiple";
+					$(elem).attr("aria-multiselectable","true");
+				} else { msl = false; }
+				if(typeof(options.dataUrl) != "undefined") {
+					$.ajax($.extend({
+						url: options.dataUrl,
+						type : "GET",
+						dataType: "html",
+						context: {elem:elem, options:options, vl:vl},
+						success: function(data,status){
+							var a,	ovm = [], elem = this.elem, vl = this.vl,
+							options = $.extend({},this.options),
+							msl = options.multiple===true;
+							if(typeof(options.buildSelect) != "undefined") {
+								var b = options.buildSelect(data);
+								a = $(b).html();
+							} else {
+								a = $(data).html();
+							}
+							if(a) {
+								$(elem).append(a);
+								setAttributes(elem, options);
+								options = bindEv(elem,options);
+								if(typeof options.size === 'undefined') { options.size =  msl ? 3 : 1;}
+								if(msl) {
+									ovm = vl.split(",");
+									ovm = $.map(ovm,function(n){return $.trim(n);});
+								} else {
+									ovm[0] = $.trim(vl);
+								}
+								//$(elem).attr(options);
+								setTimeout(function(){
+									$("option",elem).each(function(i){
+										//if(i===0) { this.selected = ""; }
+										$(this).attr("role","option");
+										if($.inArray($.trim($(this).text()),ovm) > -1 || $.inArray($.trim($(this).val()),ovm) > -1 ) {
+											this.selected= "selected";
+										}
+									});
+								},0);
+							}
+						}
+					},ajaxso || {}));
+				} else if(options.value) {
+					var i;
+					if(typeof options.size === 'undefined') {
+						options.size = msl ? 3 : 1;
+					}
+					if(msl) {
+						ovm = vl.split(",");
+						ovm = $.map(ovm,function(n){return $.trim(n);});
+					}
+					if(typeof options.value === 'function') { options.value = options.value(); }
+					var so,sv, ov;
+					if(typeof options.value === 'string') {
+						so = options.value.split(";");
+						for(i=0; i<so.length;i++){
+							sv = so[i].split(":");
+							if(sv.length > 2 ) {
+								sv[1] = $.map(sv,function(n,ii){if(ii>0) { return n;} }).join(":");
+							}
+							ov = document.createElement("option");
+							ov.setAttribute("role","option");
+							ov.value = sv[0]; ov.innerHTML = sv[1];
+							elem.appendChild(ov);
+							if (!msl &&  ($.trim(sv[0]) == $.trim(vl) || $.trim(sv[1]) == $.trim(vl))) { ov.selected ="selected"; }
+							if (msl && ($.inArray($.trim(sv[1]), ovm)>-1 || $.inArray($.trim(sv[0]), ovm)>-1)) {ov.selected ="selected";}
+						}
+					} else if (typeof options.value === 'object') {
+						var oSv = options.value;
+						for ( var key in oSv) {
+							if (oSv.hasOwnProperty(key ) ){
+								ov = document.createElement("option");
+								ov.setAttribute("role","option");
+								ov.value = key; ov.innerHTML = oSv[key];
+								elem.appendChild(ov);
+								if (!msl &&  ( $.trim(key) == $.trim(vl) || $.trim(oSv[key]) == $.trim(vl)) ) { ov.selected ="selected"; }
+								if (msl && ($.inArray($.trim(oSv[key]),ovm)>-1 || $.inArray($.trim(key),ovm)>-1)) { ov.selected ="selected"; }
+							}
+						}
+					}
+					setAttributes(elem, options, ['value']);
+					options = bindEv(elem,options);
+				}
+			break;
+			case "text" :
+			case "password" :
+			case "button" :
+				var role;
+				if(eltype=="button") { role = "button"; }
+				else { role = "textbox"; }
+				elem = document.createElement("input");
+				elem.type = eltype;
+				elem.value = vl;
+				setAttributes(elem, options);
+				options = bindEv(elem,options);
+				if(eltype != "button"){
+					if(autowidth) {
+						if(!options.size) { $(elem).css({width:"98%"}); }
+					} else if (!options.size) { options.size = 20; }
+				}
+				$(elem).attr("role",role);
+			break;
+			case "image" :
+			case "file" :
+				elem = document.createElement("input");
+				elem.type = eltype;
+				setAttributes(elem, options);
+				options = bindEv(elem,options);
+				break;
+			case "custom" :
+				elem = document.createElement("span");
+				try {
+					if($.isFunction(options.custom_element)) {
+						var celm = options.custom_element.call(this,vl,options);
+						if(celm) {
+							celm = $(celm).addClass("customelement").attr({id:options.id,name:options.name});
+							$(elem).empty().append(celm);
+						} else {
+							throw "e2";
+						}
+					} else {
+						throw "e1";
+					}
+				} catch (e) {
+					if (e=="e1") { this.info_dialog($.jgrid.errors.errcap,"function 'custom_element' "+$.jgrid.edit.msg.nodefined, $.jgrid.edit.bClose);}
+					if (e=="e2") { this.info_dialog($.jgrid.errors.errcap,"function 'custom_element' "+$.jgrid.edit.msg.novalue,$.jgrid.edit.bClose);}
+					else { this.info_dialog($.jgrid.errors.errcap,typeof(e)==="string"?e:e.message,$.jgrid.edit.bClose); }
+				}
+			break;
+		}
+		return elem;
+	},
+// Date Validation Javascript
+	checkDate : function (format, date) {
+		var daysInFebruary = function(year){
+		// February has 29 days in any year evenly divisible by four,
+		// EXCEPT for centurial years which are not also divisible by 400.
+			return (((year % 4 === 0) && ( year % 100 !== 0 || (year % 400 === 0))) ? 29 : 28 );
+		},
+		DaysArray = function(n) {
+			for (var i = 1; i <= n; i++) {
+				this[i] = 31;
+				if (i==4 || i==6 || i==9 || i==11) {this[i] = 30;}
+				if (i==2) {this[i] = 29;}
+			}
+			return this;
+		};
+
+		var tsp = {}, sep;
+		format = format.toLowerCase();
+		//we search for /,-,. for the date separator
+		if(format.indexOf("/") != -1) {
+			sep = "/";
+		} else if(format.indexOf("-") != -1) {
+			sep = "-";
+		} else if(format.indexOf(".") != -1) {
+			sep = ".";
+		} else {
+			sep = "/";
+		}
+		format = format.split(sep);
+		date = date.split(sep);
+		if (date.length != 3) { return false; }
+		var j=-1,yln, dln=-1, mln=-1;
+		for(var i=0;i<format.length;i++){
+			var dv =  isNaN(date[i]) ? 0 : parseInt(date[i],10);
+			tsp[format[i]] = dv;
+			yln = format[i];
+			if(yln.indexOf("y") != -1) { j=i; }
+			if(yln.indexOf("m") != -1) { mln=i; }
+			if(yln.indexOf("d") != -1) { dln=i; }
+		}
+		if (format[j] == "y" || format[j] == "yyyy") {
+			yln=4;
+		} else if(format[j] =="yy"){
+			yln = 2;
+		} else {
+			yln = -1;
+		}
+		var daysInMonth = DaysArray(12),
+		strDate;
+		if (j === -1) {
+			return false;
+		} else {
+			strDate = tsp[format[j]].toString();
+			if(yln == 2 && strDate.length == 1) {yln = 1;}
+			if (strDate.length != yln || (tsp[format[j]]===0 && date[j]!="00")){
+				return false;
+			}
+		}
+		if(mln === -1) {
+			return false;
+		} else {
+			strDate = tsp[format[mln]].toString();
+			if (strDate.length<1 || tsp[format[mln]]<1 || tsp[format[mln]]>12){
+				return false;
+			}
+		}
+		if(dln === -1) {
+			return false;
+		} else {
+			strDate = tsp[format[dln]].toString();
+			if (strDate.length<1 || tsp[format[dln]]<1 || tsp[format[dln]]>31 || (tsp[format[mln]]==2 && tsp[format[dln]]>daysInFebruary(tsp[format[j]])) || tsp[format[dln]] > daysInMonth[tsp[format[mln]]]){
+				return false;
+			}
+		}
+		return true;
+	},
+	isEmpty : function(val)
+	{
+		if (val.match(/^\s+$/) || val === "")	{
+			return true;
+		} else {
+			return false;
+		}
+	},
+	checkTime : function(time){
+	// checks only hh:ss (and optional am/pm)
+		var re = /^(\d{1,2}):(\d{2})([ap]m)?$/,regs;
+		if(!this.isEmpty(time))
+		{
+			regs = time.match(re);
+			if(regs) {
+				if(regs[3]) {
+					if(regs[1] < 1 || regs[1] > 12) { return false; }
+				} else {
+					if(regs[1] > 23) { return false; }
+				}
+				if(regs[2] > 59) {
+					return false;
+				}
+			} else {
+				return false;
+			}
+		}
+		return true;
+	},
+	checkValues : function(val, valref,g, customobject, nam) {
+		var edtrul,i, nm, dft, len;
+		if(typeof(customobject) === "undefined") {
+			if(typeof(valref)=='string'){
+				for( i =0, len=g.p.colModel.length;i<len; i++){
+					if(g.p.colModel[i].name==valref) {
+						edtrul = g.p.colModel[i].editrules;
+						valref = i;
+						try { nm = g.p.colModel[i].formoptions.label; } catch (e) {}
+						break;
+					}
+				}
+			} else if(valref >=0) {
+				edtrul = g.p.colModel[valref].editrules;
+			}
+		} else {
+			edtrul = customobject;
+			nm = nam===undefined ? "_" : nam;
+		}
+		if(edtrul) {
+			if(!nm) { nm = g.p.colNames[valref]; }
+			if(edtrul.required === true) {
+				if( this.isEmpty(val) )  { return [false,nm+": "+$.jgrid.edit.msg.required,""]; }
+			}
+			// force required
+			var rqfield = edtrul.required === false ? false : true;
+			if(edtrul.number === true) {
+				if( !(rqfield === false && this.isEmpty(val)) ) {
+					if(isNaN(val)) { return [false,nm+": "+$.jgrid.edit.msg.number,""]; }
+				}
+			}
+			if(typeof edtrul.minValue != 'undefined' && !isNaN(edtrul.minValue)) {
+				if (parseFloat(val) < parseFloat(edtrul.minValue) ) { return [false,nm+": "+$.jgrid.edit.msg.minValue+" "+edtrul.minValue,""];}
+			}
+			if(typeof edtrul.maxValue != 'undefined' && !isNaN(edtrul.maxValue)) {
+				if (parseFloat(val) > parseFloat(edtrul.maxValue) ) { return [false,nm+": "+$.jgrid.edit.msg.maxValue+" "+edtrul.maxValue,""];}
+			}
+			var filter;
+			if(edtrul.email === true) {
+				if( !(rqfield === false && this.isEmpty(val)) ) {
+				// taken from $ Validate plugin
+					filter = /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i;
+					if(!filter.test(val)) {return [false,nm+": "+$.jgrid.edit.msg.email,""];}
+				}
+			}
+			if(edtrul.integer === true) {
+				if( !(rqfield === false && this.isEmpty(val)) ) {
+					if(isNaN(val)) { return [false,nm+": "+$.jgrid.edit.msg.integer,""]; }
+					if ((val % 1 !== 0) || (val.indexOf('.') != -1)) { return [false,nm+": "+$.jgrid.edit.msg.integer,""];}
+				}
+			}
+			if(edtrul.date === true) {
+				if( !(rqfield === false && this.isEmpty(val)) ) {
+					if(g.p.colModel[valref].formatoptions && g.p.colModel[valref].formatoptions.newformat) {
+						dft = g.p.colModel[valref].formatoptions.newformat;
+					} else {
+						dft = g.p.colModel[valref].datefmt || "Y-m-d";
+					}
+					if(!this.checkDate (dft, val)) { return [false,nm+": "+$.jgrid.edit.msg.date+" - "+dft,""]; }
+				}
+			}
+			if(edtrul.time === true) {
+				if( !(rqfield === false && this.isEmpty(val)) ) {
+					if(!this.checkTime (val)) { return [false,nm+": "+$.jgrid.edit.msg.date+" - hh:mm (am/pm)",""]; }
+				}
+			}
+			if(edtrul.url === true) {
+				if( !(rqfield === false && this.isEmpty(val)) ) {
+					filter = /^(((https?)|(ftp)):\/\/([\-\w]+\.)+\w{2,3}(\/[%\-\w]+(\.\w{2,})?)*(([\w\-\.\?\\\/+@&#;`~=%!]*)(\.\w{2,})?)*\/?)/i;
+					if(!filter.test(val)) {return [false,nm+": "+$.jgrid.edit.msg.url,""];}
+				}
+			}
+			if(edtrul.custom === true) {
+				if( !(rqfield === false && this.isEmpty(val)) ) {
+					if($.isFunction(edtrul.custom_func)) {
+						var ret = edtrul.custom_func.call(g,val,nm);
+						if($.isArray(ret)) {
+							return ret;
+						} else {
+							return [false,$.jgrid.edit.msg.customarray,""];
+						}
+					} else {
+						return [false,$.jgrid.edit.msg.customfcheck,""];
+					}
+				}
+			}
+		}
+		return [true,"",""];
+	}
+});
+})(jQuery);
\ No newline at end of file
Index: controlies/trunk/applications/controlies/static/js/jdgrid/src/css/ui.multiselect.css
===================================================================
--- controlies/trunk/applications/controlies/static/js/jdgrid/src/css/ui.multiselect.css	(revision 240)
+++ controlies/trunk/applications/controlies/static/js/jdgrid/src/css/ui.multiselect.css	(revision 241)
@@ -1,30 +1,30 @@
-/* Multiselect
-----------------------------------*/
-
-.ui-multiselect { border: solid 1px; font-size: 0.8em; }
-.ui-multiselect ul { -moz-user-select: none; }
-.ui-multiselect li { margin: 0; padding: 0; cursor: default; line-height: 20px; height: 20px; font-size: 11px; list-style: none; }
-.ui-multiselect li a { color: #999; text-decoration: none; padding: 0; display: block; float: left; cursor: pointer;}
-.ui-multiselect li.ui-draggable-dragging { padding-left: 10px; }
-
-.ui-multiselect div.selected { position: relative; padding: 0; margin: 0; border: 0; float:left; }
-.ui-multiselect ul.selected { position: relative; padding: 0; overflow: auto; overflow-x: hidden; background: #fff; margin: 0; list-style: none; border: 0; position: relative; width: 100%; }
-.ui-multiselect ul.selected li { }
-
-.ui-multiselect div.available { position: relative; padding: 0; margin: 0; border: 0; float:left; border-left: 1px solid; }
-.ui-multiselect ul.available { position: relative; padding: 0; overflow: auto; overflow-x: hidden; background: #fff; margin: 0; list-style: none; border: 0; width: 100%; }
-.ui-multiselect ul.available li { padding-left: 10px; }
- 
-.ui-multiselect .ui-state-default { border: none; margin-bottom: 1px; position: relative; padding-left: 20px;}
-.ui-multiselect .ui-state-hover { border: none; }
-.ui-multiselect .ui-widget-header {border: none; font-size: 11px; margin-bottom: 1px;}
- 
-.ui-multiselect .add-all { float: right; padding: 7px;}
-.ui-multiselect .remove-all { float: right; padding: 7px;}
-.ui-multiselect .search { float: left; padding: 4px;}
-.ui-multiselect .count { float: left; padding: 7px;}
-
-.ui-multiselect li span.ui-icon-arrowthick-2-n-s { position: absolute; left: 2px; }
-.ui-multiselect li a.action { position: absolute; right: 2px; top: 2px; }
- 
+/* Multiselect
+----------------------------------*/
+
+.ui-multiselect { border: solid 1px; font-size: 0.8em; }
+.ui-multiselect ul { -moz-user-select: none; }
+.ui-multiselect li { margin: 0; padding: 0; cursor: default; line-height: 20px; height: 20px; font-size: 11px; list-style: none; }
+.ui-multiselect li a { color: #999; text-decoration: none; padding: 0; display: block; float: left; cursor: pointer;}
+.ui-multiselect li.ui-draggable-dragging { padding-left: 10px; }
+
+.ui-multiselect div.selected { position: relative; padding: 0; margin: 0; border: 0; float:left; }
+.ui-multiselect ul.selected { position: relative; padding: 0; overflow: auto; overflow-x: hidden; background: #fff; margin: 0; list-style: none; border: 0; position: relative; width: 100%; }
+.ui-multiselect ul.selected li { }
+
+.ui-multiselect div.available { position: relative; padding: 0; margin: 0; border: 0; float:left; border-left: 1px solid; }
+.ui-multiselect ul.available { position: relative; padding: 0; overflow: auto; overflow-x: hidden; background: #fff; margin: 0; list-style: none; border: 0; width: 100%; }
+.ui-multiselect ul.available li { padding-left: 10px; }
+ 
+.ui-multiselect .ui-state-default { border: none; margin-bottom: 1px; position: relative; padding-left: 20px;}
+.ui-multiselect .ui-state-hover { border: none; }
+.ui-multiselect .ui-widget-header {border: none; font-size: 11px; margin-bottom: 1px;}
+ 
+.ui-multiselect .add-all { float: right; padding: 7px;}
+.ui-multiselect .remove-all { float: right; padding: 7px;}
+.ui-multiselect .search { float: left; padding: 4px;}
+.ui-multiselect .count { float: left; padding: 7px;}
+
+.ui-multiselect li span.ui-icon-arrowthick-2-n-s { position: absolute; left: 2px; }
+.ui-multiselect li a.action { position: absolute; right: 2px; top: 2px; }
+ 
 .ui-multiselect input.search { height: 14px; padding: 1px; opacity: 0.5; margin: 4px; width: 100px; }
\ No newline at end of file
Index: controlies/trunk/applications/controlies/static/js/jdgrid/src/css/ui.jqgrid.css
===================================================================
--- controlies/trunk/applications/controlies/static/js/jdgrid/src/css/ui.jqgrid.css	(revision 240)
+++ controlies/trunk/applications/controlies/static/js/jdgrid/src/css/ui.jqgrid.css	(revision 241)
@@ -1,129 +1,136 @@
-/*Grid*/
-.ui-jqgrid {position: relative; font-size:11px;}
-.ui-jqgrid .ui-jqgrid-view {position: relative;left:0px; top: 0px; padding: .0em;}
-/* caption*/
-.ui-jqgrid .ui-jqgrid-titlebar {padding: .3em .2em .2em .3em; position: relative; border-left: 0px none;border-right: 0px none; border-top: 0px none;}
-.ui-jqgrid .ui-jqgrid-title { float: left; margin: .1em 0 .2em; }
-.ui-jqgrid .ui-jqgrid-titlebar-close { position: absolute;top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height:18px;}.ui-jqgrid .ui-jqgrid-titlebar-close span { display: block; margin: 1px; }
-.ui-jqgrid .ui-jqgrid-titlebar-close:hover { padding: 0; }
-/* header*/
-.ui-jqgrid .ui-jqgrid-hdiv {position: relative; margin: 0em;padding: 0em; overflow-x: hidden; overflow-y: auto; border-left: 0px none !important; border-top : 0px none !important; border-right : 0px none !important;}
-.ui-jqgrid .ui-jqgrid-hbox {float: left; padding-right: 20px;}
-.ui-jqgrid .ui-jqgrid-htable {table-layout:fixed;margin:0em;}
-.ui-jqgrid .ui-jqgrid-htable th {height:22px;padding: 0 2px 0 2px;}
-.ui-jqgrid .ui-jqgrid-htable th div {overflow: hidden; position:relative; height:17px;}
-.ui-th-column, .ui-jqgrid .ui-jqgrid-htable th.ui-th-column {overflow: hidden;white-space: nowrap;text-align:center;border-top : 0px none;border-bottom : 0px none;}
-.ui-th-ltr, .ui-jqgrid .ui-jqgrid-htable th.ui-th-ltr {border-left : 0px none;}
-.ui-th-rtl, .ui-jqgrid .ui-jqgrid-htable th.ui-th-rtl {border-right : 0px none;}
-.ui-jqgrid .ui-th-div-ie {white-space: nowrap; zoom :1; height:17px;}
-.ui-jqgrid .ui-jqgrid-resize {height:20px !important;position: relative; cursor :e-resize;display: inline;overflow: hidden;}
-.ui-jqgrid .ui-grid-ico-sort {overflow:hidden;position:absolute;display:inline; cursor: pointer !important;}
-.ui-jqgrid .ui-icon-asc {margin-top:-3px; height:12px;}
-.ui-jqgrid .ui-icon-desc {margin-top:3px;height:12px;}
-.ui-jqgrid .ui-i-asc {margin-top:0px;height:16px;}
-.ui-jqgrid .ui-i-desc {margin-top:0px;margin-left:13px;height:16px;}
-.ui-jqgrid .ui-jqgrid-sortable {cursor:pointer;}
-.ui-jqgrid tr.ui-search-toolbar th { border-top-width: 1px !important; border-top-color: inherit !important; border-top-style: ridge !important }
-tr.ui-search-toolbar input {margin: 1px 0px 0px 0px}
-tr.ui-search-toolbar select {margin: 1px 0px 0px 0px}
-/* body */ 
-.ui-jqgrid .ui-jqgrid-bdiv {position: relative; margin: 0em; padding:0; overflow: auto; text-align:left;}
-.ui-jqgrid .ui-jqgrid-btable {table-layout:fixed; margin:0em;}
-.ui-jqgrid tr.jqgrow td {font-weight: normal; overflow: hidden; white-space: pre; height: 22px;padding: 0 2px 0 2px;border-bottom-width: 1px; border-bottom-color: inherit; border-bottom-style: solid;}
-.ui-jqgrid tr.ui-row-ltr td {text-align:left;border-right-width: 1px; border-right-color: inherit; border-right-style: solid;}
-.ui-jqgrid tr.ui-row-rtl td {text-align:right;border-left-width: 1px; border-left-color: inherit; border-left-style: solid;}
-.ui-jqgrid td.jqgrid-rownum { padding: 0 2px 0 2px; margin: 0px; border: 0px none;}
-.ui-jqgrid .ui-jqgrid-resize-mark { width:2px; left:0; background-color:#777; cursor: e-resize; cursor: col-resize; position:absolute; top:0; height:100px; overflow:hidden; display:none;	border:0 none;}
-/* footer */
-.ui-jqgrid .ui-jqgrid-sdiv {position: relative; margin: 0em;padding: 0em; overflow: hidden; border-left: 0px none !important; border-top : 0px none !important; border-right : 0px none !important;}
-.ui-jqgrid .ui-jqgrid-ftable {table-layout:fixed; margin-bottom:0em;}
-.ui-jqgrid tr.footrow td {font-weight: bold; overflow: hidden; white-space:nowrap; height: 21px;padding: 0 2px 0 2px;border-top-width: 1px; border-top-color: inherit; border-top-style: solid;}
-.ui-jqgrid tr.footrow-ltr td {text-align:left;border-right-width: 1px; border-right-color: inherit; border-right-style: solid;}
-.ui-jqgrid tr.footrow-rtl td {text-align:right;border-left-width: 1px; border-left-color: inherit; border-left-style: solid;}
-/* Pager*/
-.ui-jqgrid .ui-jqgrid-pager { border-left: 0px none !important;border-right: 0px none !important; border-bottom: 0px none !important; margin: 0px !important; padding: 0px !important; position: relative; height: 25px;white-space: nowrap;overflow: hidden;}
-.ui-jqgrid .ui-pager-control {position: relative;}
-.ui-jqgrid .ui-pg-table {position: relative; padding-bottom:2px; width:auto; margin: 0em;}
-.ui-jqgrid .ui-pg-table td {font-weight:normal; vertical-align:middle; padding:1px;}
-.ui-jqgrid .ui-pg-button  { height:19px !important;}
-.ui-jqgrid .ui-pg-button span { display: block; margin: 1px; float:left;}
-.ui-jqgrid .ui-pg-button:hover { padding: 0px; }
-.ui-jqgrid .ui-state-disabled:hover {padding:1px;}
-.ui-jqgrid .ui-pg-input { height:13px;font-size:.8em; margin: 0em;}
-.ui-jqgrid .ui-pg-selbox {font-size:.8em; line-height:18px; display:block; height:18px; margin: 0em;}
-.ui-jqgrid .ui-separator {height: 18px; border-left: 1px solid #ccc ; border-right: 1px solid #ccc ; margin: 1px; float: right;}
-.ui-jqgrid .ui-paging-info {font-weight: normal;height:19px; margin-top:3px;margin-right:4px;}
-.ui-jqgrid .ui-jqgrid-pager .ui-pg-div {padding:1px 0;float:left;list-style-image:none;list-style-position:outside;list-style-type:none;position:relative;}
-.ui-jqgrid .ui-jqgrid-pager .ui-pg-button { cursor:pointer; }
-.ui-jqgrid .ui-jqgrid-pager .ui-pg-div  span.ui-icon {float:left;margin:0 2px;}
-.ui-jqgrid td input, .ui-jqgrid td select .ui-jqgrid td textarea { margin: 0em;}
-.ui-jqgrid td textarea {width:auto;height:auto;}
-.ui-jqgrid .ui-jqgrid-toppager {border-left: 0px none !important;border-right: 0px none !important; border-top: 0px none !important; margin: 0px !important; padding: 0px !important; position: relative; height: 25px !important;white-space: nowrap;overflow: hidden;}
-/*subgrid*/
-.ui-jqgrid .ui-jqgrid-btable .ui-sgcollapsed span {display: block;}
-.ui-jqgrid .ui-subgrid {margin:0em;padding:0em; width:100%;}
-.ui-jqgrid .ui-subgrid table {table-layout: fixed;}
-.ui-jqgrid .ui-subgrid tr.ui-subtblcell td {height:18px;border-right-width: 1px; border-right-color: inherit; border-right-style: solid;border-bottom-width: 1px; border-bottom-color: inherit; border-bottom-style: solid;}
-.ui-jqgrid .ui-subgrid td.subgrid-data {border-top:  0px none !important;}
-.ui-jqgrid .ui-subgrid td.subgrid-cell {border-width: 0px 0px 1px 0px;}
-.ui-jqgrid .ui-th-subgrid {height:20px;}
-/* loading */
-.ui-jqgrid .loading {position: absolute; top: 45%;left: 45%;width: auto;z-index:101;padding: 6px; margin: 5px;text-align: center;font-weight: bold;display: none;border-width: 2px !important;}
-.ui-jqgrid .jqgrid-overlay {display:none;z-index:100;}
-* html .jqgrid-overlay {width: expression(this.parentNode.offsetWidth+'px');height: expression(this.parentNode.offsetHeight+'px');}
-* .jqgrid-overlay iframe {position:absolute;top:0;left:0;z-index:-1;width: expression(this.parentNode.offsetWidth+'px');height: expression(this.parentNode.offsetHeight+'px');}
-/* end loading div */
-/* toolbar */
-.ui-jqgrid .ui-userdata {border-left: 0px none;	border-right: 0px none;	height : 21px;overflow: hidden;	}
-/*Modal Window */
-.ui-jqdialog { display: none; width: 300px; position: absolute; padding: .2em; font-size:11px; overflow:visible;}
-.ui-jqdialog .ui-jqdialog-titlebar { padding: .3em .2em; position: relative;  }
-.ui-jqdialog .ui-jqdialog-title { margin: .1em 0 .2em; } 
-.ui-jqdialog .ui-jqdialog-titlebar-close { position: absolute;  top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; }
-
-.ui-jqdialog .ui-jqdialog-titlebar-close span { display: block; margin: 1px; }
-.ui-jqdialog .ui-jqdialog-titlebar-close:hover, .ui-jqdialog .ui-jqdialog-titlebar-close:focus { padding: 0; }
-.ui-jqdialog-content, .ui-jqdialog .ui-jqdialog-content { border: 0; padding: .3em .2em; background: none; height:auto;}
-.ui-jqdialog .ui-jqconfirm {padding: .4em 1em; border-width:3px;position:absolute;bottom:10px;right:10px;overflow:visible;display:none;height:80px;width:220px;text-align:center;}
-/* end Modal window*/
-/* Form edit */
-.ui-jqdialog-content .FormGrid {margin: 0px;}
-.ui-jqdialog-content .EditTable { width: 100%; margin-bottom:0em;}
-.ui-jqdialog-content .DelTable { width: 100%; margin-bottom:0em;}
-.EditTable td input, .EditTable td select, .EditTable td textarea {margin: 0em;}
-.EditTable td textarea { width:auto; height:auto;}
-.ui-jqdialog-content td.EditButton {text-align: right;border-top: 0px none;border-left: 0px none;border-right: 0px none; padding-bottom:5px; padding-top:5px;}
-.ui-jqdialog-content td.navButton {text-align: center; border-left: 0px none;border-top: 0px none;border-right: 0px none; padding-bottom:5px; padding-top:5px;}
-
-.ui-jqdialog-content .CaptionTD {text-align: left; vertical-align: top;border-left: 0px none;border-right: 0px none; border-bottom: 0px none; padding: 1px;white-space: nowrap;}
-.ui-jqdialog-content .DataTD {padding: 1px;border-left: 0px none;border-right: 0px none; border-bottom: 0px none; vertical-align: top;}
-.ui-jqdialog-content .form-view-data {white-space:pre}
-.fm-button { display: inline-block; margin:0 4px 0 0; padding: .4em .5em; text-decoration:none !important; cursor:pointer; position: relative; text-align: center; zoom: 1; }
-.fm-button-icon-left { padding-left: 1.9em; }
-.fm-button-icon-right { padding-right: 1.9em; }
-.fm-button-icon-left .ui-icon { right: auto; left: .2em; margin-left: 0; position: absolute; top: 50%; margin-top: -8px; }
-.fm-button-icon-right .ui-icon { left: auto; right: .2em; margin-left: 0; position: absolute; top: 50%; margin-top: -8px;}
-#nData, #pData { float: left; margin:3px;padding: 0; width: 15px; }
-/* End Eorm edit */
-/*.ui-jqgrid .edit-cell {}*/
-.ui-jqgrid .selected-row, div.ui-jqgrid .selected-row td {font-style : normal;border-left: 0px none;}
-/* Tree Grid */
-.ui-jqgrid .tree-wrap {float: left; position: relative;height: 18px;white-space: nowrap;overflow: hidden;}
-.ui-jqgrid .tree-minus {position: absolute; height: 18px; width: 18px; overflow: hidden;}
-.ui-jqgrid .tree-plus {position: absolute;	height: 18px; width: 18px;	overflow: hidden;}
-.ui-jqgrid .tree-leaf {position: absolute;	height: 18px; width: 18px;overflow: hidden;}
-.ui-jqgrid .treeclick {cursor: pointer;}
-/* moda dialog */
-.jqmOverlay { background-color: #000; }
-* iframe.jqm {position:absolute;top:0;left:0;z-index:-1;width: expression(this.parentNode.offsetWidth+'px');height: expression(this.parentNode.offsetHeight+'px');}
-.ui-jqgrid-dnd tr td {border-right-width: 1px; border-right-color: inherit; border-right-style: solid; height:20px}
-/* RTL Support */
-.ui-jqgrid .ui-jqgrid-title-rtl {float:right;margin: .1em 0 .2em; }
-.ui-jqgrid .ui-jqgrid-hbox-rtl {float: right; padding-left: 20px;}
-.ui-jqgrid .ui-jqgrid-resize-ltr {float: right;margin: -2px -2px -2px 0px;}
-.ui-jqgrid .ui-jqgrid-resize-rtl {float: left;margin: -2px 0px -1px -3px;}
-.ui-jqgrid .ui-sort-rtl {left:0px;}
-.ui-jqgrid .tree-wrap-ltr {float: left;}
-.ui-jqgrid .tree-wrap-rtl {float: right;}
-.ui-jqgrid .ui-ellipsis {text-overflow:ellipsis; -moz-binding:url('ellipsis-xbl.xml#ellipsis');}
-
+/*Grid*/
+.ui-jqgrid {position: relative; font-size:11px;}
+.ui-jqgrid .ui-jqgrid-view {position: relative;left:0px; top: 0px; padding: .0em;}
+/* caption*/
+.ui-jqgrid .ui-jqgrid-titlebar {padding: .3em .2em .2em .3em; position: relative; border-left: 0px none;border-right: 0px none; border-top: 0px none;}
+.ui-jqgrid .ui-jqgrid-title { float: left; margin: .1em 0 .2em; }
+.ui-jqgrid .ui-jqgrid-titlebar-close { position: absolute;top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height:18px;}.ui-jqgrid .ui-jqgrid-titlebar-close span { display: block; margin: 1px; }
+.ui-jqgrid .ui-jqgrid-titlebar-close:hover { padding: 0; }
+/* header*/
+.ui-jqgrid .ui-jqgrid-hdiv {position: relative; margin: 0em;padding: 0em; overflow-x: hidden; border-left: 0px none !important; border-top : 0px none !important; border-right : 0px none !important;}
+.ui-jqgrid .ui-jqgrid-hbox {float: left; padding-right: 20px;}
+.ui-jqgrid .ui-jqgrid-htable {table-layout:fixed;margin:0em;}
+.ui-jqgrid .ui-jqgrid-htable th {height:22px;padding: 0 2px 0 2px;}
+.ui-jqgrid .ui-jqgrid-htable th div {overflow: hidden; position:relative; height:17px;}
+.ui-th-column, .ui-jqgrid .ui-jqgrid-htable th.ui-th-column {overflow: hidden;white-space: nowrap;text-align:center;border-top : 0px none;border-bottom : 0px none;}
+.ui-th-ltr, .ui-jqgrid .ui-jqgrid-htable th.ui-th-ltr {border-left : 0px none;}
+.ui-th-rtl, .ui-jqgrid .ui-jqgrid-htable th.ui-th-rtl {border-right : 0px none;}
+.ui-first-th-ltr {border-right: 1px solid; }
+.ui-first-th-rtl {border-left: 1px solid; }
+.ui-jqgrid .ui-th-div-ie {white-space: nowrap; zoom :1; height:17px;}
+.ui-jqgrid .ui-jqgrid-resize {height:20px !important;position: relative; cursor :e-resize;display: inline;overflow: hidden;}
+.ui-jqgrid .ui-grid-ico-sort {overflow:hidden;position:absolute;display:inline; cursor: pointer !important;}
+.ui-jqgrid .ui-icon-asc {margin-top:-3px; height:12px;}
+.ui-jqgrid .ui-icon-desc {margin-top:3px;height:12px;}
+.ui-jqgrid .ui-i-asc {margin-top:0px;height:16px;}
+.ui-jqgrid .ui-i-desc {margin-top:0px;margin-left:13px;height:16px;}
+.ui-jqgrid .ui-jqgrid-sortable {cursor:pointer;}
+.ui-jqgrid tr.ui-search-toolbar th { border-top-width: 1px !important; border-top-color: inherit !important; border-top-style: ridge !important }
+tr.ui-search-toolbar input {margin: 1px 0px 0px 0px}
+tr.ui-search-toolbar select {margin: 1px 0px 0px 0px}
+/* body */ 
+.ui-jqgrid .ui-jqgrid-bdiv {position: relative; margin: 0em; padding:0; overflow: auto; text-align:left;}
+.ui-jqgrid .ui-jqgrid-btable {table-layout:fixed; margin:0em; outline-style: none; }
+.ui-jqgrid tr.jqgrow { outline-style: none; }
+.ui-jqgrid tr.jqgroup { outline-style: none; }
+.ui-jqgrid tr.jqgrow td {font-weight: normal; overflow: hidden; white-space: pre; height: 22px;padding: 0 2px 0 2px;border-bottom-width: 1px; border-bottom-color: inherit; border-bottom-style: solid;}
+.ui-jqgrid tr.jqgfirstrow td {padding: 0 2px 0 2px;border-right-width: 1px; border-right-style: solid;}
+.ui-jqgrid tr.jqgroup td {font-weight: normal; overflow: hidden; white-space: pre; height: 22px;padding: 0 2px 0 2px;border-bottom-width: 1px; border-bottom-color: inherit; border-bottom-style: solid;}
+.ui-jqgrid tr.jqfoot td {font-weight: bold; overflow: hidden; white-space: pre; height: 22px;padding: 0 2px 0 2px;border-bottom-width: 1px; border-bottom-color: inherit; border-bottom-style: solid;}
+.ui-jqgrid tr.ui-row-ltr td {text-align:left;border-right-width: 1px; border-right-color: inherit; border-right-style: solid;}
+.ui-jqgrid tr.ui-row-rtl td {text-align:right;border-left-width: 1px; border-left-color: inherit; border-left-style: solid;}
+.ui-jqgrid td.jqgrid-rownum { padding: 0 2px 0 2px; margin: 0px; border: 0px none;}
+.ui-jqgrid .ui-jqgrid-resize-mark { width:2px; left:0; background-color:#777; cursor: e-resize; cursor: col-resize; position:absolute; top:0; height:100px; overflow:hidden; display:none;	border:0 none;}
+/* footer */
+.ui-jqgrid .ui-jqgrid-sdiv {position: relative; margin: 0em;padding: 0em; overflow: hidden; border-left: 0px none !important; border-top : 0px none !important; border-right : 0px none !important;}
+.ui-jqgrid .ui-jqgrid-ftable {table-layout:fixed; margin-bottom:0em;}
+.ui-jqgrid tr.footrow td {font-weight: bold; overflow: hidden; white-space:nowrap; height: 21px;padding: 0 2px 0 2px;border-top-width: 1px; border-top-color: inherit; border-top-style: solid;}
+.ui-jqgrid tr.footrow-ltr td {text-align:left;border-right-width: 1px; border-right-color: inherit; border-right-style: solid;}
+.ui-jqgrid tr.footrow-rtl td {text-align:right;border-left-width: 1px; border-left-color: inherit; border-left-style: solid;}
+/* Pager*/
+.ui-jqgrid .ui-jqgrid-pager { border-left: 0px none !important;border-right: 0px none !important; border-bottom: 0px none !important; margin: 0px !important; padding: 0px !important; position: relative; height: 25px;white-space: nowrap;overflow: hidden;}
+.ui-jqgrid .ui-pager-control {position: relative;}
+.ui-jqgrid .ui-pg-table {position: relative; padding-bottom:2px; width:auto; margin: 0em;}
+.ui-jqgrid .ui-pg-table td {font-weight:normal; vertical-align:middle; padding:1px;}
+.ui-jqgrid .ui-pg-button  { height:19px !important;}
+.ui-jqgrid .ui-pg-button span { display: block; margin: 1px; float:left;}
+.ui-jqgrid .ui-pg-button:hover { padding: 0px; }
+.ui-jqgrid .ui-state-disabled:hover {padding:1px;}
+.ui-jqgrid .ui-pg-input { height:13px;font-size:.8em; margin: 0em;}
+.ui-jqgrid .ui-pg-selbox {font-size:.8em; line-height:18px; display:block; height:18px; margin: 0em;}
+.ui-jqgrid .ui-separator {height: 18px; border-left: 1px solid #ccc ; border-right: 1px solid #ccc ; margin: 1px; float: right;}
+.ui-jqgrid .ui-paging-info {font-weight: normal;height:19px; margin-top:3px;margin-right:4px;}
+.ui-jqgrid .ui-jqgrid-pager .ui-pg-div {padding:1px 0;float:left;list-style-image:none;list-style-position:outside;list-style-type:none;position:relative;}
+.ui-jqgrid .ui-jqgrid-pager .ui-pg-button { cursor:pointer; }
+.ui-jqgrid .ui-jqgrid-pager .ui-pg-div  span.ui-icon {float:left;margin:0 2px;}
+.ui-jqgrid td input, .ui-jqgrid td select .ui-jqgrid td textarea { margin: 0em;}
+.ui-jqgrid td textarea {width:auto;height:auto;}
+.ui-jqgrid .ui-jqgrid-toppager {border-left: 0px none !important;border-right: 0px none !important; border-top: 0px none !important; margin: 0px !important; padding: 0px !important; position: relative; height: 25px !important;white-space: nowrap;overflow: hidden;}
+/*subgrid*/
+.ui-jqgrid .ui-jqgrid-btable .ui-sgcollapsed span {display: block;}
+.ui-jqgrid .ui-subgrid {margin:0em;padding:0em; width:100%;}
+.ui-jqgrid .ui-subgrid table {table-layout: fixed;}
+.ui-jqgrid .ui-subgrid tr.ui-subtblcell td {height:18px;border-right-width: 1px; border-right-color: inherit; border-right-style: solid;border-bottom-width: 1px; border-bottom-color: inherit; border-bottom-style: solid;}
+.ui-jqgrid .ui-subgrid td.subgrid-data {border-top:  0px none !important;}
+.ui-jqgrid .ui-subgrid td.subgrid-cell {border-width: 0px 0px 1px 0px;}
+.ui-jqgrid .ui-th-subgrid {height:20px;}
+/* loading */
+.ui-jqgrid .loading {position: absolute; top: 45%;left: 45%;width: auto;z-index:101;padding: 6px; margin: 5px;text-align: center;font-weight: bold;display: none;border-width: 2px !important;}
+.ui-jqgrid .jqgrid-overlay {display:none;z-index:100;}
+* html .jqgrid-overlay {width: expression(this.parentNode.offsetWidth+'px');height: expression(this.parentNode.offsetHeight+'px');}
+* .jqgrid-overlay iframe {position:absolute;top:0;left:0;z-index:-1;width: expression(this.parentNode.offsetWidth+'px');height: expression(this.parentNode.offsetHeight+'px');}
+/* end loading div */
+/* toolbar */
+.ui-jqgrid .ui-userdata {border-left: 0px none;	border-right: 0px none;	height : 21px;overflow: hidden;	}
+/*Modal Window */
+.ui-jqdialog { display: none; width: 300px; position: absolute; padding: .2em; font-size:11px; overflow:visible;}
+.ui-jqdialog .ui-jqdialog-titlebar { padding: .3em .2em; position: relative;  }
+.ui-jqdialog .ui-jqdialog-title { margin: .1em 0 .2em; } 
+.ui-jqdialog .ui-jqdialog-titlebar-close { position: absolute;  top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; }
+
+.ui-jqdialog .ui-jqdialog-titlebar-close span { display: block; margin: 1px; }
+.ui-jqdialog .ui-jqdialog-titlebar-close:hover, .ui-jqdialog .ui-jqdialog-titlebar-close:focus { padding: 0; }
+.ui-jqdialog-content, .ui-jqdialog .ui-jqdialog-content { border: 0; padding: .3em .2em; background: none; height:auto;}
+.ui-jqdialog .ui-jqconfirm {padding: .4em 1em; border-width:3px;position:absolute;bottom:10px;right:10px;overflow:visible;display:none;height:80px;width:220px;text-align:center;}
+/* end Modal window*/
+/* Form edit */
+.ui-jqdialog-content .FormGrid {margin: 0px;}
+.ui-jqdialog-content .EditTable { width: 100%; margin-bottom:0em;}
+.ui-jqdialog-content .DelTable { width: 100%; margin-bottom:0em;}
+.EditTable td input, .EditTable td select, .EditTable td textarea {margin: 0em;}
+.EditTable td textarea { width:auto; height:auto;}
+.ui-jqdialog-content td.EditButton {text-align: right;border-top: 0px none;border-left: 0px none;border-right: 0px none; padding-bottom:5px; padding-top:5px;}
+.ui-jqdialog-content td.navButton {text-align: center; border-left: 0px none;border-top: 0px none;border-right: 0px none; padding-bottom:5px; padding-top:5px;}
+.ui-jqdialog-content input.FormElement {padding:.3em}
+.ui-jqdialog-content .data-line {padding-top:.1em;border: 0px none;}
+
+.ui-jqdialog-content .CaptionTD {text-align: left; vertical-align: middle;border: 0px none; padding: 2px;white-space: nowrap;}
+.ui-jqdialog-content .DataTD {padding: 2px; border: 0px none; vertical-align: top;}
+.ui-jqdialog-content .form-view-data {white-space:pre}
+.fm-button { display: inline-block; margin:0 4px 0 0; padding: .4em .5em; text-decoration:none !important; cursor:pointer; position: relative; text-align: center; zoom: 1; }
+.fm-button-icon-left { padding-left: 1.9em; }
+.fm-button-icon-right { padding-right: 1.9em; }
+.fm-button-icon-left .ui-icon { right: auto; left: .2em; margin-left: 0; position: absolute; top: 50%; margin-top: -8px; }
+.fm-button-icon-right .ui-icon { left: auto; right: .2em; margin-left: 0; position: absolute; top: 50%; margin-top: -8px;}
+#nData, #pData { float: left; margin:3px;padding: 0; width: 15px; }
+/* End Eorm edit */
+/*.ui-jqgrid .edit-cell {}*/
+.ui-jqgrid .selected-row, div.ui-jqgrid .selected-row td {font-style : normal;border-left: 0px none;}
+/* Tree Grid */
+.ui-jqgrid .tree-wrap {float: left; position: relative;height: 18px;white-space: nowrap;overflow: hidden;}
+.ui-jqgrid .tree-minus {position: absolute; height: 18px; width: 18px; overflow: hidden;}
+.ui-jqgrid .tree-plus {position: absolute;	height: 18px; width: 18px;	overflow: hidden;}
+.ui-jqgrid .tree-leaf {position: absolute;	height: 18px; width: 18px;overflow: hidden;}
+.ui-jqgrid .treeclick {cursor: pointer;}
+/* moda dialog */
+* iframe.jqm {position:absolute;top:0;left:0;z-index:-1;width: expression(this.parentNode.offsetWidth+'px');height: expression(this.parentNode.offsetHeight+'px');}
+.ui-jqgrid-dnd tr td {border-right-width: 1px; border-right-color: inherit; border-right-style: solid; height:20px}
+/* RTL Support */
+.ui-jqgrid .ui-jqgrid-title-rtl {float:right;margin: .1em 0 .2em; }
+.ui-jqgrid .ui-jqgrid-hbox-rtl {float: right; padding-left: 20px;}
+.ui-jqgrid .ui-jqgrid-resize-ltr {float: right;margin: -2px -2px -2px 0px;}
+.ui-jqgrid .ui-jqgrid-resize-rtl {float: left;margin: -2px 0px -1px -3px;}
+.ui-jqgrid .ui-sort-rtl {left:0px;}
+.ui-jqgrid .tree-wrap-ltr {float: left;}
+.ui-jqgrid .tree-wrap-rtl {float: right;}
+.ui-jqgrid .ui-ellipsis {text-overflow:ellipsis; -moz-binding:url('ellipsis-xbl.xml#ellipsis');}
Index: controlies/trunk/applications/controlies/static/js/jdgrid/src/css/ellipsis-xbl.xml
===================================================================
--- controlies/trunk/applications/controlies/static/js/jdgrid/src/css/ellipsis-xbl.xml	(revision 240)
+++ controlies/trunk/applications/controlies/static/js/jdgrid/src/css/ellipsis-xbl.xml	(revision 241)
@@ -1,13 +1,13 @@
-<?xml version="1.0"?>
-<bindings
-    xmlns="http://www.mozilla.org/xbl"
-    xmlns:xbl="http://www.mozilla.org/xbl"
-    xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
-    <binding id="ellipsis">
-        <content>
-            <xul:window><!-- xul:window tag required for FF2 -->
-                <xul:description crop="end" xbl:inherits="value=xbl:text"><children/></xul:description>
-            </xul:window>
-        </content>
-    </binding>
-</bindings>
+<?xml version="1.0"?>
+<bindings
+    xmlns="http://www.mozilla.org/xbl"
+    xmlns:xbl="http://www.mozilla.org/xbl"
+    xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+    <binding id="ellipsis">
+        <content>
+            <xul:window><!-- xul:window tag required for FF2 -->
+                <xul:description crop="end" xbl:inherits="value=xbl:text"><children/></xul:description>
+            </xul:window>
+        </content>
+    </binding>
+</bindings>
Index: controlies/trunk/applications/controlies/static/js/jdgrid/src/grid.tbltogrid.js
===================================================================
--- controlies/trunk/applications/controlies/static/js/jdgrid/src/grid.tbltogrid.js	(revision 240)
+++ controlies/trunk/applications/controlies/static/js/jdgrid/src/grid.tbltogrid.js	(revision 241)
@@ -1,106 +1,106 @@
-/*
- Transform a table to a jqGrid.
- Peter Romianowski <peter.romianowski@optivo.de> 
- If the first column of the table contains checkboxes or
- radiobuttons then the jqGrid is made selectable.
-*/
-// Addition - selector can be a class or id
-function tableToGrid(selector, options) {
-jQuery(selector).each(function() {
-	if(this.grid) {return;} //Adedd from Tony Tomov
-	// This is a small "hack" to make the width of the jqGrid 100%
-	jQuery(this).width("99%");
-	var w = jQuery(this).width();
-
-	// Text whether we have single or multi select
-	var inputCheckbox = jQuery('input[type=checkbox]:first', jQuery(this));
-	var inputRadio = jQuery('input[type=radio]:first', jQuery(this));
-	var selectMultiple = inputCheckbox.length > 0;
-	var selectSingle = !selectMultiple && inputRadio.length > 0;
-	var selectable = selectMultiple || selectSingle;
-	var inputName = inputCheckbox.attr("name") || inputRadio.attr("name");
-
-	// Build up the columnModel and the data
-	var colModel = [];
-	var colNames = [];
-	jQuery('th', jQuery(this)).each(function() {
-		if (colModel.length === 0 && selectable) {
-			colModel.push({
-				name: '__selection__',
-				index: '__selection__',
-				width: 0,
-				hidden: true
-			});
-			colNames.push('__selection__');
-		} else {
-			colModel.push({
-				name: jQuery(this).attr("id") || jQuery.trim(jQuery.jgrid.stripHtml(jQuery(this).html())).split(' ').join('_'),
-				index: jQuery(this).attr("id") || jQuery.trim(jQuery.jgrid.stripHtml(jQuery(this).html())).split(' ').join('_'),
-				width: jQuery(this).width() || 150
-			});
-			colNames.push(jQuery(this).html());
-		}
-	});
-	var data = [];
-	var rowIds = [];
-	var rowChecked = [];
-	jQuery('tbody > tr', jQuery(this)).each(function() {
-		var row = {};
-		var rowPos = 0;
-		jQuery('td', jQuery(this)).each(function() {
-			if (rowPos === 0 && selectable) {
-				var input = jQuery('input', jQuery(this));
-				var rowId = input.attr("value");
-				rowIds.push(rowId || data.length);
-				if (input.attr("checked")) {
-					rowChecked.push(rowId);
-				}
-				row[colModel[rowPos].name] = input.attr("value");
-			} else {
-				row[colModel[rowPos].name] = jQuery(this).html();
-			}
-			rowPos++;
-		});
-		if(rowPos >0) { data.push(row); }
-	});
-
-	// Clear the original HTML table
-	jQuery(this).empty();
-
-	// Mark it as jqGrid
-	jQuery(this).addClass("scroll");
-
-	jQuery(this).jqGrid($.extend({
-		datatype: "local",
-		width: w,
-		colNames: colNames,
-		colModel: colModel,
-		multiselect: selectMultiple
-		//inputName: inputName,
-		//inputValueCol: imputName != null ? "__selection__" : null
-	}, options || {}));
-
-	// Add data
-	var a;
-	for (a = 0; a < data.length; a++) {
-		var id = null;
-		if (rowIds.length > 0) {
-			id = rowIds[a];
-			if (id && id.replace) {
-				// We have to do this since the value of a checkbox
-				// or radio button can be anything 
-				id = encodeURIComponent(id).replace(/[.\-%]/g, "_");
-			}
-		}
-		if (id === null) {
-			id = a + 1;
-		}
-		jQuery(this).jqGrid("addRowData",id, data[a]);
-	}
-
-	// Set the selection
-	for (a = 0; a < rowChecked.length; a++) {
-		jQuery(this).jqGrid("setSelection",rowChecked[a]);
-	}
-});
-};
+/*
+ Transform a table to a jqGrid.
+ Peter Romianowski <peter.romianowski@optivo.de> 
+ If the first column of the table contains checkboxes or
+ radiobuttons then the jqGrid is made selectable.
+*/
+// Addition - selector can be a class or id
+function tableToGrid(selector, options) {
+jQuery(selector).each(function() {
+	if(this.grid) {return;} //Adedd from Tony Tomov
+	// This is a small "hack" to make the width of the jqGrid 100%
+	jQuery(this).width("99%");
+	var w = jQuery(this).width();
+
+	// Text whether we have single or multi select
+	var inputCheckbox = jQuery('tr td:first-child input[type=checkbox]:first', jQuery(this));
+	var inputRadio = jQuery('tr td:first-child input[type=radio]:first', jQuery(this));
+	var selectMultiple = inputCheckbox.length > 0;
+	var selectSingle = !selectMultiple && inputRadio.length > 0;
+	var selectable = selectMultiple || selectSingle;
+	//var inputName = inputCheckbox.attr("name") || inputRadio.attr("name");
+
+	// Build up the columnModel and the data
+	var colModel = [];
+	var colNames = [];
+	jQuery('th', jQuery(this)).each(function() {
+		if (colModel.length === 0 && selectable) {
+			colModel.push({
+				name: '__selection__',
+				index: '__selection__',
+				width: 0,
+				hidden: true
+			});
+			colNames.push('__selection__');
+		} else {
+			colModel.push({
+				name: jQuery(this).attr("id") || jQuery.trim(jQuery.jgrid.stripHtml(jQuery(this).html())).split(' ').join('_'),
+				index: jQuery(this).attr("id") || jQuery.trim(jQuery.jgrid.stripHtml(jQuery(this).html())).split(' ').join('_'),
+				width: jQuery(this).width() || 150
+			});
+			colNames.push(jQuery(this).html());
+		}
+	});
+	var data = [];
+	var rowIds = [];
+	var rowChecked = [];
+	jQuery('tbody > tr', jQuery(this)).each(function() {
+		var row = {};
+		var rowPos = 0;
+		jQuery('td', jQuery(this)).each(function() {
+			if (rowPos === 0 && selectable) {
+				var input = jQuery('input', jQuery(this));
+				var rowId = input.attr("value");
+				rowIds.push(rowId || data.length);
+				if (input.is(":checked")) {
+					rowChecked.push(rowId);
+				}
+				row[colModel[rowPos].name] = input.attr("value");
+			} else {
+				row[colModel[rowPos].name] = jQuery(this).html();
+			}
+			rowPos++;
+		});
+		if(rowPos >0) { data.push(row); }
+	});
+
+	// Clear the original HTML table
+	jQuery(this).empty();
+
+	// Mark it as jqGrid
+	jQuery(this).addClass("scroll");
+
+	jQuery(this).jqGrid(jQuery.extend({
+		datatype: "local",
+		width: w,
+		colNames: colNames,
+		colModel: colModel,
+		multiselect: selectMultiple
+		//inputName: inputName,
+		//inputValueCol: imputName != null ? "__selection__" : null
+	}, options || {}));
+
+	// Add data
+	var a;
+	for (a = 0; a < data.length; a++) {
+		var id = null;
+		if (rowIds.length > 0) {
+			id = rowIds[a];
+			if (id && id.replace) {
+				// We have to do this since the value of a checkbox
+				// or radio button can be anything 
+				id = encodeURIComponent(id).replace(/[.\-%]/g, "_");
+			}
+		}
+		if (id === null) {
+			id = a + 1;
+		}
+		jQuery(this).jqGrid("addRowData",id, data[a]);
+	}
+
+	// Set the selection
+	for (a = 0; a < rowChecked.length; a++) {
+		jQuery(this).jqGrid("setSelection",rowChecked[a]);
+	}
+});
+};
Index: controlies/trunk/applications/controlies/static/js/jdgrid/src/jqDnR.js
===================================================================
--- controlies/trunk/applications/controlies/static/js/jdgrid/src/jqDnR.js	(revision 240)
+++ controlies/trunk/applications/controlies/static/js/jdgrid/src/jqDnR.js	(revision 241)
@@ -1,68 +1,71 @@
-/*
- * jqDnR - Minimalistic Drag'n'Resize for jQuery.
- *
- * Copyright (c) 2007 Brice Burgess <bhb@iceburg.net>, http://www.iceburg.net
- * Licensed under the MIT License:
- * http://www.opensource.org/licenses/mit-license.php
- * 
- * $Version: 2007.08.19 +r2
- */
-
-(function($){
-$.fn.jqDrag=function(h){return i(this,h,'d');};
-$.fn.jqResize=function(h,ar){return i(this,h,'r',ar);};
-$.jqDnR={
-	dnr:{},
-	e:0,
-	drag:function(v){
- 		if(M.k == 'd')E.css({left:M.X+v.pageX-M.pX,top:M.Y+v.pageY-M.pY});
- 		else {
-			E.css({width:Math.max(v.pageX-M.pX+M.W,0),height:Math.max(v.pageY-M.pY+M.H,0)});
-			if(M1){E1.css({width:Math.max(v.pageX-M1.pX+M1.W,0),height:Math.max(v.pageY-M1.pY+M1.H,0)});}
-		}
-  		return false;
-  	},
-	stop:function(){
-		//E.css('opacity',M.o);
-		$(document).unbind('mousemove',J.drag).unbind('mouseup',J.stop);
-	}
-};
-var J=$.jqDnR,M=J.dnr,E=J.e,E1,
-i=function(e,h,k,aR){
-	return e.each(function(){
-		h=(h)?$(h,e):e;
- 		h.bind('mousedown',{e:e,k:k},function(v){
- 			var d=v.data,p={};E=d.e;E1 = aR ? $(aR) : false;
- 			// attempt utilization of dimensions plugin to fix IE issues
- 			if(E.css('position') != 'relative'){try{E.position(p);}catch(e){}}
- 			M={
- 				X:p.left||f('left')||0,
- 				Y:p.top||f('top')||0,
- 				W:f('width')||E[0].scrollWidth||0,
- 				H:f('height')||E[0].scrollHeight||0,
- 				pX:v.pageX,
- 				pY:v.pageY,
- 				k:d.k
- 				//o:E.css('opacity')
- 			};
-			// also resize
-			if(E1 && d.k != 'd'){
- 				M1={
-					X:p.left||f1('left')||0,
-					Y:p.top||f1('top')||0,
-					W:E1[0].offsetWidth||f1('width')||0,
-					H:E1[0].offsetHeight||f1('height')||0,
-					pX:v.pageX,
-					pY:v.pageY,
-					k:d.k
-				};
-			} else {M1 = false;}			
- 			//E.css({opacity:0.8});
- 			$(document).mousemove($.jqDnR.drag).mouseup($.jqDnR.stop);
- 			return false;
- 		});
-	});
-},
-f=function(k){return parseInt(E.css(k))||false;};
-f1=function(k){	return parseInt(E1.css(k))||false;};
+/*
+ * jqDnR - Minimalistic Drag'n'Resize for jQuery.
+ *
+ * Copyright (c) 2007 Brice Burgess <bhb@iceburg.net>, http://www.iceburg.net
+ * Licensed under the MIT License:
+ * http://www.opensource.org/licenses/mit-license.php
+ * 
+ * $Version: 2007.08.19 +r2
+ */
+
+(function($){
+$.fn.jqDrag=function(h){return i(this,h,'d');};
+$.fn.jqResize=function(h,ar){return i(this,h,'r',ar);};
+$.jqDnR={
+	dnr:{},
+	e:0,
+	drag:function(v){
+ 		if(M.k == 'd')E.css({left:M.X+v.pageX-M.pX,top:M.Y+v.pageY-M.pY});
+ 		else {
+			E.css({width:Math.max(v.pageX-M.pX+M.W,0),height:Math.max(v.pageY-M.pY+M.H,0)});
+			if(M1){E1.css({width:Math.max(v.pageX-M1.pX+M1.W,0),height:Math.max(v.pageY-M1.pY+M1.H,0)});}
+		}
+  		return false;
+  	},
+	stop:function(){
+		//E.css('opacity',M.o);
+		$(document).unbind('mousemove',J.drag).unbind('mouseup',J.stop);
+	}
+};
+var J=$.jqDnR,M=J.dnr,E=J.e,E1,
+i=function(e,h,k,aR){
+	return e.each(function(){
+		h=(h)?$(h,e):e;
+ 		h.bind('mousedown',{e:e,k:k},function(v){
+ 			var d=v.data,p={};E=d.e;E1 = aR ? $(aR) : false;
+ 			// attempt utilization of dimensions plugin to fix IE issues
+ 			if(E.css('position') != 'relative'){try{E.position(p);}catch(e){}}
+ 			M={
+ 				X:p.left||f('left')||0,
+ 				Y:p.top||f('top')||0,
+ 				W:f('width')||E[0].scrollWidth||0,
+ 				H:f('height')||E[0].scrollHeight||0,
+ 				pX:v.pageX,
+ 				pY:v.pageY,
+ 				k:d.k
+ 				//o:E.css('opacity')
+ 			};
+			// also resize
+			if(E1 && d.k != 'd'){
+ 				M1={
+					X:p.left||f1('left')||0,
+					Y:p.top||f1('top')||0,
+					W:E1[0].offsetWidth||f1('width')||0,
+					H:E1[0].offsetHeight||f1('height')||0,
+					pX:v.pageX,
+					pY:v.pageY,
+					k:d.k
+				};
+			} else {M1 = false;}			
+ 			//E.css({opacity:0.8});
+			if($("input.hasDatepicker",E[0])[0]) {
+			try {$("input.hasDatepicker",E[0]).datepicker('hide');}catch (dpe){}
+			}
+ 			$(document).mousemove($.jqDnR.drag).mouseup($.jqDnR.stop);
+ 			return false;
+ 		});
+	});
+},
+f=function(k){return parseInt(E.css(k))||false;};
+f1=function(k){	return parseInt(E1.css(k))||false;};
 })(jQuery);
\ No newline at end of file
Index: controlies/trunk/applications/controlies/static/js/jdgrid/src/grid.grouping.js
===================================================================
--- controlies/trunk/applications/controlies/static/js/jdgrid/src/grid.grouping.js	(nonexistent)
+++ controlies/trunk/applications/controlies/static/js/jdgrid/src/grid.grouping.js	(revision 241)
@@ -0,0 +1,295 @@
+// Grouping module
+;(function($){
+$.jgrid.extend({
+	groupingSetup : function () {
+		return this.each(function (){
+			var $t = this,
+			grp = $t.p.groupingView;
+			if(grp !== null && ( (typeof grp === 'object') || $.isFunction(grp) ) ) {
+				if(!grp.groupField.length) {
+					$t.p.grouping = false;
+				} else {
+					if ( typeof(grp.visibiltyOnNextGrouping) == 'undefined') {
+						grp.visibiltyOnNextGrouping = [];
+					}
+					for(var i=0;i<grp.groupField.length;i++) {
+						if(!grp.groupOrder[i]) {
+							grp.groupOrder[i] = 'asc';
+						}
+						if(!grp.groupText[i]) {
+							grp.groupText[i] = '{0}';
+						}
+						if( typeof(grp.groupColumnShow[i]) != 'boolean') {
+							grp.groupColumnShow[i] = true;
+						}
+						if( typeof(grp.groupSummary[i]) != 'boolean') {
+							grp.groupSummary[i] = false;
+						}
+						if(grp.groupColumnShow[i] === true) {
+							grp.visibiltyOnNextGrouping[i] = true;
+							$($t).jqGrid('showCol',grp.groupField[i]);
+						} else {
+							grp.visibiltyOnNextGrouping[i] = $("#"+$t.p.id+"_"+grp.groupField[i]).is(":visible");
+							$($t).jqGrid('hideCol',grp.groupField[i]);
+						}
+						grp.sortitems[i] = [];
+						grp.sortnames[i] = [];
+						grp.summaryval[i] = [];
+						if(grp.groupSummary[i]) {
+							grp.summary[i] =[];
+							var cm = $t.p.colModel;
+							for(var j=0, cml = cm.length; j < cml; j++) {
+								if(cm[j].summaryType) {
+									grp.summary[i].push({nm:cm[j].name,st:cm[j].summaryType, v:''});
+								}
+							}
+						}
+					}
+					$t.p.scroll = false;
+					$t.p.rownumbers = false;
+					$t.p.subGrid = false;
+					$t.p.treeGrid = false;
+					$t.p.gridview = true;
+				}
+			} else {
+				$t.p.grouping = false;
+			}
+		});
+	},
+	groupingPrepare : function (rData, items, gdata, record) {
+		this.each(function(){
+			// currently only one level
+			// Is this a good idea to do it so!!!!?????
+			items[0]  += "";
+			var itm = items[0].toString().split(' ').join('');
+			
+			var grp = this.p.groupingView, $t= this;
+			if(gdata.hasOwnProperty(itm)) {
+				gdata[itm].push(rData);
+			} else {
+				gdata[itm] = [];
+				gdata[itm].push(rData);
+				grp.sortitems[0].push(itm);
+				grp.sortnames[0].push($.trim(items[0].toString()));
+				grp.summaryval[0][itm] = $.extend(true,[],grp.summary[0]);
+			}
+			if(grp.groupSummary[0]) {
+				$.each(grp.summaryval[0][itm],function() {
+					if ($.isFunction(this.st)) {
+						this.v = this.st.call($t, this.v, this.nm, record);
+					} else {
+						this.v = $($t).jqGrid('groupingCalculations.'+this.st, this.v, this.nm, record);
+					}
+				});
+			}
+		});
+		return gdata;
+	},
+	groupingToggle : function(hid){
+		this.each(function(){
+			var $t = this,
+			grp = $t.p.groupingView,
+			strpos = hid.lastIndexOf('_'),
+			uid = hid.substring(0,strpos+1),
+			num = parseInt(hid.substring(strpos+1),10)+1,
+			minus = grp.minusicon,
+			plus = grp.plusicon,
+			tar = $("#"+hid),
+			r = tar.length ? tar[0].nextSibling : null,
+			tarspan = $("#"+hid+" span."+"tree-wrap-"+$t.p.direction),
+			collapsed = false;
+			if( tarspan.hasClass(minus) ) {
+				if(grp.showSummaryOnHide && grp.groupSummary[0]) {
+					if(r){
+						while(r) {
+							if($(r).hasClass('jqfoot') ) { break; }
+							$(r).hide();
+							r = r.nextSibling;
+						}
+					}
+				} else  {
+					if(r){
+						while(r) {
+							if($(r).attr('id') ==uid+String(num) ) { break; }
+							$(r).hide();
+							r = r.nextSibling;
+				}
+					}
+				}
+				tarspan.removeClass(minus).addClass(plus);
+				collapsed = true;
+			} else {
+				if(r){
+					while(r) {
+						if($(r).attr('id') ==uid+String(num) ) { break; }
+						$(r).show();
+						r = r.nextSibling;
+					}
+				}
+				tarspan.removeClass(plus).addClass(minus);
+			}
+			if( $.isFunction($t.p.onClickGroup)) { $t.p.onClickGroup.call($t, hid , collapsed); }
+
+		});
+		return false;
+	},
+	groupingRender : function (grdata, colspans ) {
+		return this.each(function(){
+			var $t = this,
+			grp = $t.p.groupingView,
+			str = "", icon = "", hid, pmrtl = grp.groupCollapse ? grp.plusicon : grp.minusicon, gv, cp, ii;
+			//only one level for now
+			if(!grp.groupDataSorted) {
+				// ???? TO BE IMPROVED
+				grp.sortitems[0].sort();
+				grp.sortnames[0].sort();
+				if(grp.groupOrder[0].toLowerCase() == 'desc')
+				{
+					grp.sortitems[0].reverse();
+					grp.sortnames[0].reverse();
+				}
+			}   
+			pmrtl += " tree-wrap-"+$t.p.direction; 
+			ii = 0;
+			while(ii < colspans) {
+				if($t.p.colModel[ii].name == grp.groupField[0]) {
+					cp = ii;
+					break;
+				}
+				ii++;
+			}
+			$.each(grp.sortitems[0],function(i,n){
+				hid = $t.p.id+"ghead_"+i;
+				icon = "<span style='cursor:pointer;' class='ui-icon "+pmrtl+"' onclick=\"jQuery('#"+$t.p.id+"').jqGrid('groupingToggle','"+hid+"');return false;\"></span>";
+				try {
+					gv = $t.formatter(hid, grp.sortnames[0][i], cp, grp.sortitems[0] );
+				} catch (egv) {
+					gv = grp.sortnames[0][i];
+				}
+				str += "<tr id=\""+hid+"\" role=\"row\" class= \"ui-widget-content jqgroup ui-row-"+$t.p.direction+"\"><td colspan=\""+colspans+"\">"+icon+$.jgrid.format(grp.groupText[0], gv, grdata[n].length)+"</td></tr>";
+				for(var kk=0;kk<grdata[n].length;kk++) {
+					str += grdata[n][kk].join('');
+				}
+				if(grp.groupSummary[0]) {
+					var hhdr = "";
+					if(grp.groupCollapse && !grp.showSummaryOnHide) {
+						hhdr = " style=\"display:none;\"";
+					}
+					str += "<tr"+hhdr+" role=\"row\" class=\"ui-widget-content jqfoot ui-row-"+$t.p.direction+"\">";
+					var fdata = grp.summaryval[0][n],
+					cm = $t.p.colModel,
+					vv, grlen = grdata[n].length;
+					for(var k=0; k<colspans;k++) {
+						var tmpdata = "<td "+$t.formatCol(k,1,'')+">&#160;</td>",
+						tplfld = "{0}";
+						$.each(fdata,function(){
+							if(this.nm == cm[k].name) {
+								if(cm[k].summaryTpl)  {
+									tplfld = cm[k].summaryTpl;
+								}
+								if(this.st == 'avg') {
+									if(this.v && grlen > 0) {
+										this.v = (this.v/grlen);
+									}
+								}
+								try {
+									vv = $t.formatter('', this.v, k, this);
+								} catch (ef) {
+									vv = this.v;
+								}
+								tmpdata= "<td "+$t.formatCol(k,1,'')+">"+$.jgrid.format(tplfld,vv)+ "</td>";
+								return false;
+							}
+						});
+						str += tmpdata;
+					}
+					str += "</tr>";
+				}
+			});
+			$("#"+$t.p.id+" tbody:first").append(str);
+			// free up memory
+			str = null;
+		});
+	},
+	groupingGroupBy : function (name, options ) {
+		return this.each(function(){
+			var $t = this;
+			if(typeof(name) == "string") {
+				name = [name];
+			}
+			var grp = $t.p.groupingView;
+			$t.p.grouping = true;
+
+			//Set default, in case visibilityOnNextGrouping is undefined 
+			if (typeof grp.visibiltyOnNextGrouping == "undefined") {
+				grp.visibiltyOnNextGrouping = [];
+			}
+			var i;
+			// show previous hidden groups if they are hidden and weren't removed yet
+			for(i=0;i<grp.groupField.length;i++) {
+				if(!grp.groupColumnShow[i] && grp.visibiltyOnNextGrouping[i]) {
+				$($t).jqGrid('showCol',grp.groupField[i]);
+				}
+			}
+			// set visibility status of current group columns on next grouping
+			for(i=0;i<name.length;i++) {
+				grp.visibiltyOnNextGrouping[i] = $("#"+$t.p.id+"_"+name[i]).is(":visible");
+			}
+			$t.p.groupingView = $.extend($t.p.groupingView, options || {});
+			grp.groupField = name;
+			$($t).trigger("reloadGrid");
+		});
+	},
+	groupingRemove : function (current) {
+		return this.each(function(){
+			var $t = this;
+			if(typeof(current) == 'undefined') {
+				current = true;
+			}
+			$t.p.grouping = false;
+			if(current===true) {
+        var grp = $t.p.groupingView;
+        // show previous hidden groups if they are hidden and weren't removed yet
+        for(var i=0;i<grp.groupField.length;i++) {
+          if (!grp.groupColumnShow[i] && grp.visibiltyOnNextGrouping[i]) {
+            $($t).jqGrid('showCol', grp.groupField);
+          }
+        }
+				$("tr.jqgroup, tr.jqfoot","#"+$t.p.id+" tbody:first").remove();
+				$("tr.jqgrow:hidden","#"+$t.p.id+" tbody:first").show();
+			} else {
+				$($t).trigger("reloadGrid");
+			}
+		});
+	},
+	groupingCalculations : {
+		"sum" : function(v, field, rc) {
+			return parseFloat(v||0) + parseFloat((rc[field]||0));
+		},
+		"min" : function(v, field, rc) {
+			if(v==="") {
+				return parseFloat(rc[field]||0);
+			}
+			return Math.min(parseFloat(v),parseFloat(rc[field]||0));
+		},
+		"max" : function(v, field, rc) {
+			if(v==="") {
+				return parseFloat(rc[field]||0);
+			}
+			return Math.max(parseFloat(v),parseFloat(rc[field]||0));
+		},
+		"count" : function(v, field, rc) {
+			if(v==="") {v=0;}
+			if(rc.hasOwnProperty(field)) {
+				return v+1;
+			} else {
+				return 0;
+			}
+		},
+		"avg" : function(v, field, rc) {
+			// the same as sum, but at end we divide it
+			return parseFloat(v||0) + parseFloat((rc[field]||0));
+		}
+	}
+});
+})(jQuery);
Index: controlies/trunk/applications/controlies/static/js/jdgrid/src/jquery.fmatter.js
===================================================================
--- controlies/trunk/applications/controlies/static/js/jdgrid/src/jquery.fmatter.js	(revision 240)
+++ controlies/trunk/applications/controlies/static/js/jdgrid/src/jquery.fmatter.js	(revision 241)
@@ -1,526 +1,580 @@
-/*
-**
- * formatter for values but most of the values if for jqGrid
- * Some of this was inspired and based on how YUI does the table datagrid but in jQuery fashion
- * we are trying to keep it as light as possible
- * Joshua Burnett josh@9ci.com	
- * http://www.greenbill.com
- *
- * Changes from Tony Tomov tony@trirand.com
- * Dual licensed under the MIT and GPL licenses:
- * http://www.opensource.org/licenses/mit-license.php
- * http://www.gnu.org/licenses/gpl-2.0.html
- * 
-**/
-
-;(function($) {
-	$.fmatter = {};
-	//opts can be id:row id for the row, rowdata:the data for the row, colmodel:the column model for this column
-	//example {id:1234,}
-	$.fn.fmatter = function(formatType, cellval, opts, rwd, act) {
-		//debug(this);
-		//debug(cellval);
-		// build main options before element iteration
-		opts = $.extend({}, $.jgrid.formatter, opts);
-		return fireFormatter(formatType,cellval, opts, rwd, act); 
-	};
-	$.fmatter.util = {
-		// Taken from YAHOO utils
-		NumberFormat : function(nData,opts) {
-			if(!isNumber(nData)) {
-				nData *= 1;
-			}
-			if(isNumber(nData)) {
-		        var bNegative = (nData < 0);
-				var sOutput = nData + "";
-				var sDecimalSeparator = (opts.decimalSeparator) ? opts.decimalSeparator : ".";
-				var nDotIndex;
-				if(isNumber(opts.decimalPlaces)) {
-					// Round to the correct decimal place
-					var nDecimalPlaces = opts.decimalPlaces;
-					var nDecimal = Math.pow(10, nDecimalPlaces);
-					sOutput = Math.round(nData*nDecimal)/nDecimal + "";
-					nDotIndex = sOutput.lastIndexOf(".");
-					if(nDecimalPlaces > 0) {
-                    // Add the decimal separator
-						if(nDotIndex < 0) {
-							sOutput += sDecimalSeparator;
-							nDotIndex = sOutput.length-1;
-						}
-						// Replace the "."
-						else if(sDecimalSeparator !== "."){
-							sOutput = sOutput.replace(".",sDecimalSeparator);
-						}
-                    // Add missing zeros
-						while((sOutput.length - 1 - nDotIndex) < nDecimalPlaces) {
-						    sOutput += "0";
-						}
-	                }
-	            }
-	            if(opts.thousandsSeparator) {
-	                var sThousandsSeparator = opts.thousandsSeparator;
-	                nDotIndex = sOutput.lastIndexOf(sDecimalSeparator);
-	                nDotIndex = (nDotIndex > -1) ? nDotIndex : sOutput.length;
-	                var sNewOutput = sOutput.substring(nDotIndex);
-	                var nCount = -1;
-	                for (var i=nDotIndex; i>0; i--) {
-	                    nCount++;
-	                    if ((nCount%3 === 0) && (i !== nDotIndex) && (!bNegative || (i > 1))) {
-	                        sNewOutput = sThousandsSeparator + sNewOutput;
-	                    }
-	                    sNewOutput = sOutput.charAt(i-1) + sNewOutput;
-	                }
-	                sOutput = sNewOutput;
-	            }
-	            // Prepend prefix
-	            sOutput = (opts.prefix) ? opts.prefix + sOutput : sOutput;
-	            // Append suffix
-	            sOutput = (opts.suffix) ? sOutput + opts.suffix : sOutput;
-	            return sOutput;
-				
-			} else {
-				return nData;
-			}
-		},
-		// Tony Tomov
-		// PHP implementation. Sorry not all options are supported.
-		// Feel free to add them if you want
-		DateFormat : function (format, date, newformat, opts)  {
-			var	token = /\\.|[dDjlNSwzWFmMntLoYyaABgGhHisueIOPTZcrU]/g,
-			timezone = /\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,
-			timezoneClip = /[^-+\dA-Z]/g,
-			pad = function (value, length) {
-				value = String(value);
-				length = parseInt(length,10) || 2;
-				while (value.length < length)  { value = '0' + value; }
-				return value;
-			},
-		    ts = {m : 1, d : 1, y : 1970, h : 0, i : 0, s : 0, u:0},
-		    timestamp=0, dM, k,hl,
-		    dateFormat=["i18n"];
-			// Internationalization strings
-		    dateFormat["i18n"] = {
-				dayNames: opts.dayNames,
-				monthNames: opts.monthNames
-			};
-			if( format in opts.masks ) { format = opts.masks[format]; }
-			if(date.constructor === Date) {
-				timestamp = date;
-			} else {
-				date = date.split(/[\\\/:_;.\t\T\s-]/);
-				format = format.split(/[\\\/:_;.\t\T\s-]/);
-				// parsing for month names
-				for(k=0,hl=format.length;k<hl;k++){
-					if(format[k] == 'M') {
-						dM = $.inArray(date[k],dateFormat.i18n.monthNames);
-						if(dM !== -1 && dM < 12){date[k] = dM+1;}
-					}
-					if(format[k] == 'F') {
-						dM = $.inArray(date[k],dateFormat.i18n.monthNames);
-						if(dM !== -1 && dM > 11){date[k] = dM+1-12;}
-					}
-				    ts[format[k].toLowerCase()] = parseInt(date[k],10);
-				}
-				ts.m = parseInt(ts.m,10)-1;
-				var ty = ts.y;
-				if (ty >= 70 && ty <= 99) { ts.y = 1900+ts.y; }
-				else if (ty >=0 && ty <=69) { ts.y= 2000+ts.y; }
-				timestamp = new Date(ts.y, ts.m, ts.d, ts.h, ts.i, ts.s, ts.u);
-			}
-			
-			if( newformat in opts.masks )  {
-				newformat = opts.masks[newformat];
-			} else if ( !newformat ) {
-				newformat = 'Y-m-d';
-			}
-		    var 
-		        G = timestamp.getHours(),
-		        i = timestamp.getMinutes(),
-		        j = timestamp.getDate(),
-				n = timestamp.getMonth() + 1,
-				o = timestamp.getTimezoneOffset(),
-				s = timestamp.getSeconds(),
-				u = timestamp.getMilliseconds(),
-				w = timestamp.getDay(),
-				Y = timestamp.getFullYear(),
-				N = (w + 6) % 7 + 1,
-				z = (new Date(Y, n - 1, j) - new Date(Y, 0, 1)) / 86400000,
-				flags = {
-					// Day
-					d: pad(j),
-					D: dateFormat.i18n.dayNames[w],
-					j: j,
-					l: dateFormat.i18n.dayNames[w + 7],
-					N: N,
-					S: opts.S(j),
-					//j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th',
-					w: w,
-					z: z,
-					// Week
-					W: N < 5 ? Math.floor((z + N - 1) / 7) + 1 : Math.floor((z + N - 1) / 7) || ((new Date(Y - 1, 0, 1).getDay() + 6) % 7 < 4 ? 53 : 52),
-					// Month
-					F: dateFormat.i18n.monthNames[n - 1 + 12],
-					m: pad(n),
-					M: dateFormat.i18n.monthNames[n - 1],
-					n: n,
-					t: '?',
-					// Year
-					L: '?',
-					o: '?',
-					Y: Y,
-					y: String(Y).substring(2),
-					// Time
-					a: G < 12 ? opts.AmPm[0] : opts.AmPm[1],
-					A: G < 12 ? opts.AmPm[2] : opts.AmPm[3],
-					B: '?',
-					g: G % 12 || 12,
-					G: G,
-					h: pad(G % 12 || 12),
-					H: pad(G),
-					i: pad(i),
-					s: pad(s),
-					u: u,
-					// Timezone
-					e: '?',
-					I: '?',
-					O: (o > 0 ? "-" : "+") + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4),
-					P: '?',
-					T: (String(timestamp).match(timezone) || [""]).pop().replace(timezoneClip, ""),
-					Z: '?',
-					// Full Date/Time
-					c: '?',
-					r: '?',
-					U: Math.floor(timestamp / 1000)
-				};	
-			return newformat.replace(token, function ($0) {
-				return $0 in flags ? flags[$0] : $0.substring(1);
-			});			
-		}
-	};
-	$.fn.fmatter.defaultFormat = function(cellval, opts) {
-		return (isValue(cellval) && cellval!=="" ) ?  cellval : opts.defaultValue ? opts.defaultValue : "&#160;";
-	};
-	$.fn.fmatter.email = function(cellval, opts) {
-		if(!isEmpty(cellval)) {
-			return "<a href=\"mailto:" + cellval + "\">" + cellval + "</a>";
-        }else {
-			return $.fn.fmatter.defaultFormat(cellval,opts );
-        }
-	};
-	$.fn.fmatter.checkbox =function(cval, opts) {
-		var op = $.extend({},opts.checkbox), ds;
-		if(!isUndefined(opts.colModel.formatoptions)) {
-			op = $.extend({},op,opts.colModel.formatoptions);
-		}
-		if(op.disabled===true) {ds = "disabled";} else {ds="";}
-		if(isEmpty(cval) || isUndefined(cval) ) { cval = $.fn.fmatter.defaultFormat(cval,op); }
-		cval=cval+""; cval=cval.toLowerCase();
-		var bchk = cval.search(/(false|0|no|off)/i)<0 ? " checked='checked' " : "";
-        return "<input type=\"checkbox\" " + bchk  + " value=\""+ cval+"\" offval=\"no\" "+ds+ "/>";
-    };
-	$.fn.fmatter.link = function(cellval, opts) {
-		var op = {target:opts.target };
-		var target = "";
-		if(!isUndefined(opts.colModel.formatoptions)) {
-            op = $.extend({},op,opts.colModel.formatoptions);
-        }
-		if(op.target) {target = 'target=' + op.target;}
-        if(!isEmpty(cellval)) {
-			return "<a "+target+" href=\"" + cellval + "\">" + cellval + "</a>";
-        }else {
-            return $.fn.fmatter.defaultFormat(cellval,opts);
-        }
-    };
-	$.fn.fmatter.showlink = function(cellval, opts) {
-		var op = {baseLinkUrl: opts.baseLinkUrl,showAction:opts.showAction, addParam: opts.addParam || "", target: opts.target, idName: opts.idName },
-		target = "", idUrl;
-		if(!isUndefined(opts.colModel.formatoptions)) {
-			op = $.extend({},op,opts.colModel.formatoptions);
-		}
-		if(op.target) {target = 'target=' + op.target;}
-		idUrl = op.baseLinkUrl+op.showAction + '?'+ op.idName+'='+opts.rowId+op.addParam;
-        if(isString(cellval)) {	//add this one even if its blank string
-			return "<a "+target+" href=\"" + idUrl + "\">" + cellval + "</a>";
-        }else {
-			return $.fn.fmatter.defaultFormat(cellval,opts);
-	    }
-    };
-	$.fn.fmatter.integer = function(cellval, opts) {
-		var op = $.extend({},opts.integer);
-		if(!isUndefined(opts.colModel.formatoptions)) {
-			op = $.extend({},op,opts.colModel.formatoptions);
-		}
-		if(isEmpty(cellval)) {
-			return op.defaultValue;
-		}
-		return $.fmatter.util.NumberFormat(cellval,op);
-	};
-	$.fn.fmatter.number = function (cellval, opts) {
-		var op = $.extend({},opts.number);
-		if(!isUndefined(opts.colModel.formatoptions)) {
-			op = $.extend({},op,opts.colModel.formatoptions);
-		}
-		if(isEmpty(cellval)) {
-			return op.defaultValue;
-		}
-		return $.fmatter.util.NumberFormat(cellval,op);
-	};
-	$.fn.fmatter.currency = function (cellval, opts) {
-		var op = $.extend({},opts.currency);
-		if(!isUndefined(opts.colModel.formatoptions)) {
-			op = $.extend({},op,opts.colModel.formatoptions);
-		}
-		if(isEmpty(cellval)) {
-			return op.defaultValue;
-		}
-		return $.fmatter.util.NumberFormat(cellval,op);
-	};
-	$.fn.fmatter.date = function (cellval, opts, rwd, act) {
-		var op = $.extend({},opts.date);
-		if(!isUndefined(opts.colModel.formatoptions)) {
-			op = $.extend({},op,opts.colModel.formatoptions);
-		}
-		if(!op.reformatAfterEdit && act=='edit'){
-			return $.fn.fmatter.defaultFormat(cellval, opts);
-		} else if(!isEmpty(cellval)) {
-			return  $.fmatter.util.DateFormat(op.srcformat,cellval,op.newformat,op);
-		} else {
-			return $.fn.fmatter.defaultFormat(cellval, opts);
-		}
-	};
-	$.fn.fmatter.select = function (cellval,opts, rwd, act) {
-		// jqGrid specific
-		cellval = cellval + "";
-		var oSelect = false, ret=[];
-		if(!isUndefined(opts.colModel.editoptions)){
-			oSelect= opts.colModel.editoptions.value;
-		}
-		if (oSelect) {
-			var	msl =  opts.colModel.editoptions.multiple === true ? true : false,
-			scell = [], sv;
-			if(msl) {scell = cellval.split(",");scell = $.map(scell,function(n){return $.trim(n);});}
-			if (isString(oSelect)) {
-				// mybe here we can use some caching with care ????
-				var so = oSelect.split(";"), j=0;
-				for(var i=0; i<so.length;i++){
-					sv = so[i].split(":");
-					if(sv.length > 2 ) {
-						sv[1] = jQuery.map(sv,function(n,i){if(i>0) { return n; } }).join(":");
-					}
-					if(msl) {
-						if(jQuery.inArray(sv[0],scell)>-1) {
-							ret[j] = sv[1];
-							j++;
-						}
-					} else if($.trim(sv[0])==$.trim(cellval)) {
-						ret[0] = sv[1];
-						break;
-					}
-				}
-			} else if(isObject(oSelect)) {
-				// this is quicker
-				if(msl) {
-					ret = jQuery.map(scell, function(n, i){
-						return oSelect[n];
-					});
-				} else {
-					ret[0] = oSelect[cellval] || "";
-				}
-			}
-		}
-		cellval = ret.join(", ");
-		return  cellval == "" ? $.fn.fmatter.defaultFormat(cellval,opts) : cellval;
-	};
-	$.fn.fmatter.rowactions = function(rid,gid,act,keys) {
-		switch(act)
-		{
-			case 'edit':
-				var restorerow = function()	{
-					$("tr#"+rid+" div.ui-inline-edit, "+"tr#"+rid+" div.ui-inline-del","#"+gid).show();
-					$("tr#"+rid+" div.ui-inline-save, "+"tr#"+rid+" div.ui-inline-cancel","#"+gid).hide();
-				};
-				$('#'+gid).jqGrid('editRow',rid,keys,null,null,null,{oper:'edit'},restorerow,null,restorerow);
-				$("tr#"+rid+" div.ui-inline-edit, "+"tr#"+rid+" div.ui-inline-del","#"+gid).hide();
-				$("tr#"+rid+" div.ui-inline-save, "+"tr#"+rid+" div.ui-inline-cancel","#"+gid).show();
-			break;
-			case 'save':
-				$('#'+gid).jqGrid('saveRow',rid,null,null );
-				$("tr#"+rid+" div.ui-inline-edit, "+"tr#"+rid+" div.ui-inline-del","#"+gid).show();
-				$("tr#"+rid+" div.ui-inline-save, "+"tr#"+rid+" div.ui-inline-cancel","#"+gid).hide();
-				break;
-			case 'cancel' :
-				$('#'+gid).jqGrid('restoreRow',rid);
-				$("tr#"+rid+" div.ui-inline-edit, "+"tr#"+rid+" div.ui-inline-del","#"+gid).show();
-				$("tr#"+rid+" div.ui-inline-save, "+"tr#"+rid+" div.ui-inline-cancel","#"+gid).hide();
-				break;
-		}
-	};
-	$.fn.fmatter.actions = function(cellval,opts, rwd) {
-		var op ={keys:false, editbutton:true, delbutton:true};
-		if(!isUndefined(opts.colModel.formatoptions)) {
-			op = $.extend(op,opts.colModel.formatoptions);
-		}
-		var rowid = opts.rowId, str="",ocl;
-		if(typeof(rowid) =='undefined' || isEmpty(rowid)) { return ""; }
-		if(op.editbutton){
-			ocl = "onclick=$.fn.fmatter.rowactions('"+rowid+"','"+opts.gid+"','edit',"+op.keys+");";
-			str =str+ "<div style='margin-left:8px;'><div title='"+$.jgrid.nav.edittitle+"' style='float:left;cursor:pointer;' class='ui-pg-div ui-inline-edit' "+ocl+"><span class='ui-icon ui-icon-pencil'></span></div>";
-		}
-		if(op.delbutton) {
-			ocl = "onclick=jQuery('#"+opts.gid+"').jqGrid('delGridRow','"+rowid+"');";
-			str = str+"<div title='"+$.jgrid.nav.deltitle+"' style='float:left;margin-left:5px;' class='ui-pg-div ui-inline-del' "+ocl+"><span class='ui-icon ui-icon-trash'></span></div>";
-		}
-		ocl = "onclick=$.fn.fmatter.rowactions('"+rowid+"','"+opts.gid+"','save',false);";
-		str = str+"<div title='"+$.jgrid.edit.bSubmit+"' style='float:left;display:none' class='ui-pg-div ui-inline-save'><span class='ui-icon ui-icon-disk' "+ocl+"></span></div>";
-		ocl = "onclick=$.fn.fmatter.rowactions('"+rowid+"','"+opts.gid+"','cancel',false);";
-		str = str+"<div title='"+$.jgrid.edit.bCancel+"' style='float:left;display:none;margin-left:5px;' class='ui-pg-div ui-inline-cancel'><span class='ui-icon ui-icon-cancel' "+ocl+"></span></div></div>";
-		return str;
-	};
-	$.unformat = function (cellval,options,pos,cnt) {
-		// specific for jqGrid only
-		var ret, formatType = options.colModel.formatter,
-		op =options.colModel.formatoptions || {}, sep,
-		re = /([\.\*\_\'\(\)\{\}\+\?\\])/g;
-		unformatFunc = options.colModel.unformat||($.fn.fmatter[formatType] && $.fn.fmatter[formatType].unformat);
-		if(typeof unformatFunc !== 'undefined' && isFunction(unformatFunc) ) {
-			ret = unformatFunc($(cellval).text(), options, cellval);
-		} else if(typeof formatType !== 'undefined' && isString(formatType) ) {
-			var opts = $.jgrid.formatter || {}, stripTag;
-			switch(formatType) {
-				case 'integer' :
-					op = $.extend({},opts.integer,op);
-					sep = op.thousandsSeparator.replace(re,"\\$1");
-					stripTag = new RegExp(sep, "g");
-					ret = $(cellval).text().replace(stripTag,'');
-					break;
-				case 'number' :
-					op = $.extend({},opts.number,op);
-					sep = op.thousandsSeparator.replace(re,"\\$1");
-					stripTag = new RegExp(sep, "g");
-					ret = $(cellval).text().replace(stripTag,"").replace(op.decimalSeparator,'.');
-					break;
-				case 'currency':
-					op = $.extend({},opts.currency,op);
-					sep = op.thousandsSeparator.replace(re,"\\$1");
-					stripTag = new RegExp(sep, "g");
-					ret = $(cellval).text().replace(stripTag,'').replace(op.decimalSeparator,'.').replace(op.prefix,'').replace(op.suffix,'');
-					break;
-				case 'checkbox':
-					var cbv = (options.colModel.editoptions) ? options.colModel.editoptions.value.split(":") : ["Yes","No"];
-					ret = $('input',cellval).attr("checked") ? cbv[0] : cbv[1];
-					break;
-				case 'select' :
-					ret = $.unformat.select(cellval,options,pos,cnt);
-					break;
-				case 'actions':
-					return "";
-				default:
-					ret= $(cellval).text();
-			}
-		}
-		return ret ? ret : cnt===true ? $(cellval).text() : $.jgrid.htmlDecode($(cellval).html());
-	};
-	$.unformat.select = function (cellval,options,pos,cnt) {
-		// Spacial case when we have local data and perform a sort
-		// cnt is set to true only in sortDataArray
-		var ret = [];
-		var cell = $(cellval).text();
-		if(cnt===true) { return cell; }
-		var op = $.extend({},options.colModel.editoptions);
-		if(op.value){
-			var oSelect = op.value,
-			msl =  op.multiple === true ? true : false,
-			scell = [], sv;
-			if(msl) { scell = cell.split(","); scell = $.map(scell,function(n){return $.trim(n);}); }
-			if (isString(oSelect)) {
-				var so = oSelect.split(";"), j=0;
-				for(var i=0; i<so.length;i++){
-					sv = so[i].split(":");
-					if(msl) {
-						if(jQuery.inArray(sv[1],scell)>-1) {
-							ret[j] = sv[0];
-							j++;
-						}
-					} else if($.trim(sv[1])==$.trim(cell)) {
-						ret[0] = sv[0];
-						break;
-					}
-				}
-			} else if(isObject(oSelect)) {
-				if(!msl) { scell[0] =  cell; }
-				ret = jQuery.map(scell, function(n){
-					var rv;
-					$.each(oSelect, function(i,val){
-						if (val == n) {
-							rv = i;
-							return false;
-						}
-					});
-					if( rv) { return rv; }
-				});
-			}
-			return ret.join(", ");
-		} else {
-			return cell || "";
-		}
-	};
-	function fireFormatter(formatType,cellval, opts, rwd, act) {
-		var v=cellval;
-
-        if ($.fn.fmatter[formatType]){
-            v = $.fn.fmatter[formatType](cellval, opts, rwd, act);
-        }
-
-        return v;
-	}
-	//private methods and data
-	function debug($obj) {
-		if (window.console && window.console.log) { window.console.log($obj); }
-	}
-	/**
-     * A convenience method for detecting a legitimate non-null value.
-     * Returns false for null/undefined/NaN, true for other values, 
-     * including 0/false/''
-	 *  --taken from the yui.lang
-     */
-    isValue= function(o) {
-		return (isObject(o) || isString(o) || isNumber(o) || isBoolean(o));
-    };
-	isBoolean= function(o) {
-        return typeof o === 'boolean';
-    };
-    isNull= function(o) {
-        return o === null;
-    };
-    isNumber= function(o) {
-        return typeof o === 'number' && isFinite(o);
-    };
-    isString= function(o) {
-        return typeof o === 'string';
-    };
-	/**
-	* check if its empty trim it and replace \&nbsp and \&#160 with '' and check if its empty ===""
-	* if its is not a string but has a value then it returns false, Returns true for null/undefined/NaN
-	essentailly this provdes a way to see if it has any value to format for things like links
-	*/
-	isEmpty= function(o) {
-		if(!isString(o) && isValue(o)) {
-			return false;
-		}else if (!isValue(o)){
-			return true;
-		}
-		o = $.trim(o).replace(/\&nbsp\;/ig,'').replace(/\&#160\;/ig,'');
-        return o==="";
-		
-    };
-    isUndefined= function(o) {
-        return typeof o === 'undefined';
-    };
-	isObject= function(o) {
-		return (o && (typeof o === 'object' || isFunction(o))) || false;
-    };
-	isFunction= function(o) {
-        return typeof o === 'function';
-    };
-
-})(jQuery);
\ No newline at end of file
+/*
+**
+ * formatter for values but most of the values if for jqGrid
+ * Some of this was inspired and based on how YUI does the table datagrid but in jQuery fashion
+ * we are trying to keep it as light as possible
+ * Joshua Burnett josh@9ci.com	
+ * http://www.greenbill.com
+ *
+ * Changes from Tony Tomov tony@trirand.com
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl-2.0.html
+ * 
+**/
+
+;(function($) {
+	$.fmatter = {};
+	//opts can be id:row id for the row, rowdata:the data for the row, colmodel:the column model for this column
+	//example {id:1234,}
+	$.extend($.fmatter,{
+		isBoolean : function(o) {
+			return typeof o === 'boolean';
+		},
+		isObject : function(o) {
+			return (o && (typeof o === 'object' || $.isFunction(o))) || false;
+		},
+		isString : function(o) {
+			return typeof o === 'string';
+		},
+		isNumber : function(o) {
+			return typeof o === 'number' && isFinite(o);
+		},
+		isNull : function(o) {
+			return o === null;
+		},
+		isUndefined : function(o) {
+			return typeof o === 'undefined';
+		},
+		isValue : function (o) {
+			return (this.isObject(o) || this.isString(o) || this.isNumber(o) || this.isBoolean(o));
+		},
+		isEmpty : function(o) {
+			if(!this.isString(o) && this.isValue(o)) {
+				return false;
+			}else if (!this.isValue(o)){
+				return true;
+			}
+			o = $.trim(o).replace(/\&nbsp\;/ig,'').replace(/\&#160\;/ig,'');
+			return o==="";	
+		}
+	});
+	$.fn.fmatter = function(formatType, cellval, opts, rwd, act) {
+		// build main options before element iteration
+		var v=cellval;
+		opts = $.extend({}, $.jgrid.formatter, opts);
+
+		if ($.fn.fmatter[formatType]){
+			v = $.fn.fmatter[formatType](cellval, opts, rwd, act);
+		}
+		return v;
+	};
+	$.fmatter.util = {
+		// Taken from YAHOO utils
+		NumberFormat : function(nData,opts) {
+			if(!$.fmatter.isNumber(nData)) {
+				nData *= 1;
+			}
+			if($.fmatter.isNumber(nData)) {
+				var bNegative = (nData < 0);
+				var sOutput = nData + "";
+				var sDecimalSeparator = (opts.decimalSeparator) ? opts.decimalSeparator : ".";
+				var nDotIndex;
+				if($.fmatter.isNumber(opts.decimalPlaces)) {
+					// Round to the correct decimal place
+					var nDecimalPlaces = opts.decimalPlaces;
+					var nDecimal = Math.pow(10, nDecimalPlaces);
+					sOutput = Math.round(nData*nDecimal)/nDecimal + "";
+					nDotIndex = sOutput.lastIndexOf(".");
+					if(nDecimalPlaces > 0) {
+					// Add the decimal separator
+						if(nDotIndex < 0) {
+							sOutput += sDecimalSeparator;
+							nDotIndex = sOutput.length-1;
+						}
+						// Replace the "."
+						else if(sDecimalSeparator !== "."){
+							sOutput = sOutput.replace(".",sDecimalSeparator);
+						}
+					// Add missing zeros
+						while((sOutput.length - 1 - nDotIndex) < nDecimalPlaces) {
+							sOutput += "0";
+						}
+					}
+				}
+				if(opts.thousandsSeparator) {
+					var sThousandsSeparator = opts.thousandsSeparator;
+					nDotIndex = sOutput.lastIndexOf(sDecimalSeparator);
+					nDotIndex = (nDotIndex > -1) ? nDotIndex : sOutput.length;
+					var sNewOutput = sOutput.substring(nDotIndex);
+					var nCount = -1;
+					for (var i=nDotIndex; i>0; i--) {
+						nCount++;
+						if ((nCount%3 === 0) && (i !== nDotIndex) && (!bNegative || (i > 1))) {
+							sNewOutput = sThousandsSeparator + sNewOutput;
+						}
+						sNewOutput = sOutput.charAt(i-1) + sNewOutput;
+					}
+					sOutput = sNewOutput;
+				}
+				// Prepend prefix
+				sOutput = (opts.prefix) ? opts.prefix + sOutput : sOutput;
+				// Append suffix
+				sOutput = (opts.suffix) ? sOutput + opts.suffix : sOutput;
+				return sOutput;
+				
+			} else {
+				return nData;
+			}
+		},
+		// Tony Tomov
+		// PHP implementation. Sorry not all options are supported.
+		// Feel free to add them if you want
+		DateFormat : function (format, date, newformat, opts)  {
+			var	token = /\\.|[dDjlNSwzWFmMntLoYyaABgGhHisueIOPTZcrU]/g,
+			timezone = /\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,
+			timezoneClip = /[^-+\dA-Z]/g,
+			msDateRegExp = new RegExp("^\/Date\\((([-+])?[0-9]+)(([-+])([0-9]{2})([0-9]{2}))?\\)\/$"),
+			msMatch = ((typeof date === 'string') ? date.match(msDateRegExp): null),
+			pad = function (value, length) {
+				value = String(value);
+				length = parseInt(length,10) || 2;
+				while (value.length < length)  { value = '0' + value; }
+				return value;
+			},
+			ts = {m : 1, d : 1, y : 1970, h : 0, i : 0, s : 0, u:0},
+			timestamp=0, dM, k,hl,
+			dateFormat=["i18n"];
+			// Internationalization strings
+			dateFormat.i18n = {
+				dayNames: opts.dayNames,
+				monthNames: opts.monthNames
+			};
+			if( format in opts.masks ) { format = opts.masks[format]; }
+			if( !isNaN( date - 0 ) && String(format).toLowerCase() == "u") {
+				//Unix timestamp
+			    timestamp = new Date( parseFloat(date)*1000 );
+			} else if(date.constructor === Date) {
+				timestamp = date;
+				// Microsoft date format support
+			} else if( msMatch !== null ) {
+				timestamp = new Date(parseInt(msMatch[1], 10));
+				if (msMatch[3]) {
+					var offset = Number(msMatch[5]) * 60 + Number(msMatch[6]);
+					offset *= ((msMatch[4] == '-') ? 1 : -1);
+					offset -= timestamp.getTimezoneOffset();
+					timestamp.setTime(Number(Number(timestamp) + (offset * 60 * 1000)));
+				}
+			} else {
+				date = String(date).split(/[\\\/:_;.,\t\T\s-]/);
+				format = format.split(/[\\\/:_;.,\t\T\s-]/);
+				// parsing for month names
+				for(k=0,hl=format.length;k<hl;k++){
+					if(format[k] == 'M') {
+						dM = $.inArray(date[k],dateFormat.i18n.monthNames);
+						if(dM !== -1 && dM < 12){date[k] = dM+1;}
+					}
+					if(format[k] == 'F') {
+						dM = $.inArray(date[k],dateFormat.i18n.monthNames);
+						if(dM !== -1 && dM > 11){date[k] = dM+1-12;}
+					}
+					if(date[k]) {
+						ts[format[k].toLowerCase()] = parseInt(date[k],10);
+					}
+				}
+				if(ts.f) {ts.m = ts.f;}
+				if( ts.m === 0 && ts.y === 0 && ts.d === 0) {
+					return "&#160;" ;
+				}
+				ts.m = parseInt(ts.m,10)-1;
+				var ty = ts.y;
+				if (ty >= 70 && ty <= 99) {ts.y = 1900+ts.y;}
+				else if (ty >=0 && ty <=69) {ts.y= 2000+ts.y;}
+				timestamp = new Date(ts.y, ts.m, ts.d, ts.h, ts.i, ts.s, ts.u);
+			}
+			
+			if( newformat in opts.masks )  {
+				newformat = opts.masks[newformat];
+			} else if ( !newformat ) {
+				newformat = 'Y-m-d';
+			}
+			var 
+				G = timestamp.getHours(),
+				i = timestamp.getMinutes(),
+				j = timestamp.getDate(),
+				n = timestamp.getMonth() + 1,
+				o = timestamp.getTimezoneOffset(),
+				s = timestamp.getSeconds(),
+				u = timestamp.getMilliseconds(),
+				w = timestamp.getDay(),
+				Y = timestamp.getFullYear(),
+				N = (w + 6) % 7 + 1,
+				z = (new Date(Y, n - 1, j) - new Date(Y, 0, 1)) / 86400000,
+				flags = {
+					// Day
+					d: pad(j),
+					D: dateFormat.i18n.dayNames[w],
+					j: j,
+					l: dateFormat.i18n.dayNames[w + 7],
+					N: N,
+					S: opts.S(j),
+					//j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th',
+					w: w,
+					z: z,
+					// Week
+					W: N < 5 ? Math.floor((z + N - 1) / 7) + 1 : Math.floor((z + N - 1) / 7) || ((new Date(Y - 1, 0, 1).getDay() + 6) % 7 < 4 ? 53 : 52),
+					// Month
+					F: dateFormat.i18n.monthNames[n - 1 + 12],
+					m: pad(n),
+					M: dateFormat.i18n.monthNames[n - 1],
+					n: n,
+					t: '?',
+					// Year
+					L: '?',
+					o: '?',
+					Y: Y,
+					y: String(Y).substring(2),
+					// Time
+					a: G < 12 ? opts.AmPm[0] : opts.AmPm[1],
+					A: G < 12 ? opts.AmPm[2] : opts.AmPm[3],
+					B: '?',
+					g: G % 12 || 12,
+					G: G,
+					h: pad(G % 12 || 12),
+					H: pad(G),
+					i: pad(i),
+					s: pad(s),
+					u: u,
+					// Timezone
+					e: '?',
+					I: '?',
+					O: (o > 0 ? "-" : "+") + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4),
+					P: '?',
+					T: (String(timestamp).match(timezone) || [""]).pop().replace(timezoneClip, ""),
+					Z: '?',
+					// Full Date/Time
+					c: '?',
+					r: '?',
+					U: Math.floor(timestamp / 1000)
+				};	
+			return newformat.replace(token, function ($0) {
+				return $0 in flags ? flags[$0] : $0.substring(1);
+			});			
+		}
+	};
+	$.fn.fmatter.defaultFormat = function(cellval, opts) {
+		return ($.fmatter.isValue(cellval) && cellval!=="" ) ?  cellval : opts.defaultValue ? opts.defaultValue : "&#160;";
+	};
+	$.fn.fmatter.email = function(cellval, opts) {
+		if(!$.fmatter.isEmpty(cellval)) {
+			return "<a href=\"mailto:" + cellval + "\">" + cellval + "</a>";
+		}else {
+			return $.fn.fmatter.defaultFormat(cellval,opts );
+		}
+	};
+	$.fn.fmatter.checkbox =function(cval, opts) {
+		var op = $.extend({},opts.checkbox), ds;
+		if(!$.fmatter.isUndefined(opts.colModel.formatoptions)) {
+			op = $.extend({},op,opts.colModel.formatoptions);
+		}
+		if(op.disabled===true) {ds = "disabled=\"disabled\"";} else {ds="";}
+		if($.fmatter.isEmpty(cval) || $.fmatter.isUndefined(cval) ) {cval = $.fn.fmatter.defaultFormat(cval,op);}
+		cval=cval+"";cval=cval.toLowerCase();
+		var bchk = cval.search(/(false|0|no|off)/i)<0 ? " checked='checked' " : "";
+		return "<input type=\"checkbox\" " + bchk  + " value=\""+ cval+"\" offval=\"no\" "+ds+ "/>";
+	};
+	$.fn.fmatter.link = function(cellval, opts) {
+		var op = {target:opts.target};
+		var target = "";
+		if(!$.fmatter.isUndefined(opts.colModel.formatoptions)) {
+			op = $.extend({},op,opts.colModel.formatoptions);
+		}
+		if(op.target) {target = 'target=' + op.target;}
+		if(!$.fmatter.isEmpty(cellval)) {
+			return "<a "+target+" href=\"" + cellval + "\">" + cellval + "</a>";
+		}else {
+			return $.fn.fmatter.defaultFormat(cellval,opts);
+		}
+	};
+	$.fn.fmatter.showlink = function(cellval, opts) {
+		var op = {baseLinkUrl: opts.baseLinkUrl,showAction:opts.showAction, addParam: opts.addParam || "", target: opts.target, idName: opts.idName},
+		target = "", idUrl;
+		if(!$.fmatter.isUndefined(opts.colModel.formatoptions)) {
+			op = $.extend({},op,opts.colModel.formatoptions);
+		}
+		if(op.target) {target = 'target=' + op.target;}
+		idUrl = op.baseLinkUrl+op.showAction + '?'+ op.idName+'='+opts.rowId+op.addParam;
+		if($.fmatter.isString(cellval) || $.fmatter.isNumber(cellval)) {	//add this one even if its blank string
+			return "<a "+target+" href=\"" + idUrl + "\">" + cellval + "</a>";
+		}else {
+			return $.fn.fmatter.defaultFormat(cellval,opts);
+		}
+	};
+	$.fn.fmatter.integer = function(cellval, opts) {
+		var op = $.extend({},opts.integer);
+		if(!$.fmatter.isUndefined(opts.colModel.formatoptions)) {
+			op = $.extend({},op,opts.colModel.formatoptions);
+		}
+		if($.fmatter.isEmpty(cellval)) {
+			return op.defaultValue;
+		}
+		return $.fmatter.util.NumberFormat(cellval,op);
+	};
+	$.fn.fmatter.number = function (cellval, opts) {
+		var op = $.extend({},opts.number);
+		if(!$.fmatter.isUndefined(opts.colModel.formatoptions)) {
+			op = $.extend({},op,opts.colModel.formatoptions);
+		}
+		if($.fmatter.isEmpty(cellval)) {
+			return op.defaultValue;
+		}
+		return $.fmatter.util.NumberFormat(cellval,op);
+	};
+	$.fn.fmatter.currency = function (cellval, opts) {
+		var op = $.extend({},opts.currency);
+		if(!$.fmatter.isUndefined(opts.colModel.formatoptions)) {
+			op = $.extend({},op,opts.colModel.formatoptions);
+		}
+		if($.fmatter.isEmpty(cellval)) {
+			return op.defaultValue;
+		}
+		return $.fmatter.util.NumberFormat(cellval,op);
+	};
+	$.fn.fmatter.date = function (cellval, opts, rwd, act) {
+		var op = $.extend({},opts.date);
+		if(!$.fmatter.isUndefined(opts.colModel.formatoptions)) {
+			op = $.extend({},op,opts.colModel.formatoptions);
+		}
+		if(!op.reformatAfterEdit && act=='edit'){
+			return $.fn.fmatter.defaultFormat(cellval, opts);
+		} else if(!$.fmatter.isEmpty(cellval)) {
+			return  $.fmatter.util.DateFormat(op.srcformat,cellval,op.newformat,op);
+		} else {
+			return $.fn.fmatter.defaultFormat(cellval, opts);
+		}
+	};
+	$.fn.fmatter.select = function (cellval,opts, rwd, act) {
+		// jqGrid specific
+		cellval = cellval + "";
+		var oSelect = false, ret=[];
+		if(!$.fmatter.isUndefined(opts.colModel.formatoptions)){
+			oSelect= opts.colModel.formatoptions.value;
+		} else if(!$.fmatter.isUndefined(opts.colModel.editoptions)){
+			oSelect= opts.colModel.editoptions.value;
+		}
+		if (oSelect) {
+			var	msl =  opts.colModel.editoptions.multiple === true ? true : false,
+			scell = [], sv;
+			if(msl) {scell = cellval.split(",");scell = $.map(scell,function(n){return $.trim(n);});}
+			if ($.fmatter.isString(oSelect)) {
+				// mybe here we can use some caching with care ????
+				var so = oSelect.split(";"), j=0;
+				for(var i=0; i<so.length;i++){
+					sv = so[i].split(":");
+					if(sv.length > 2 ) {
+						sv[1] = jQuery.map(sv,function(n,i){if(i>0) {return n;}}).join(":");
+					}
+					if(msl) {
+						if(jQuery.inArray(sv[0],scell)>-1) {
+							ret[j] = sv[1];
+							j++;
+						}
+					} else if($.trim(sv[0])==$.trim(cellval)) {
+						ret[0] = sv[1];
+						break;
+					}
+				}
+			} else if($.fmatter.isObject(oSelect)) {
+				// this is quicker
+				if(msl) {
+					ret = jQuery.map(scell, function(n, i){
+						return oSelect[n];
+					});
+				} else {
+					ret[0] = oSelect[cellval] || "";
+				}
+			}
+		}
+		cellval = ret.join(", ");
+		return  cellval === "" ? $.fn.fmatter.defaultFormat(cellval,opts) : cellval;
+	};
+	$.fn.fmatter.rowactions = function(rid,gid,act,pos) {
+		var op ={
+			keys:false,
+			onEdit : null, 
+			onSuccess: null, 
+			afterSave:null,
+			onError: null,
+			afterRestore: null,
+			extraparam: {oper:'edit'},
+			url: null,
+			delOptions: {},
+			editOptions : {}
+		};
+		rid = $.jgrid.jqID( rid );
+		gid = $.jgrid.jqID( gid );
+		var cm = $('#'+gid)[0].p.colModel[pos];
+		if(!$.fmatter.isUndefined(cm.formatoptions)) {
+			op = $.extend(op,cm.formatoptions);
+		}
+		if( !$.fmatter.isUndefined($('#'+gid)[0].p.editOptions) ) {
+			op.editOptions = $('#'+gid)[0].p.editOptions;
+		}
+		if( !$.fmatter.isUndefined($('#'+gid)[0].p.delOptions) ) {
+			op.delOptions = $('#'+gid)[0].p.delOptions;
+		}
+		var saverow = function( rowid)	{
+			if(op.afterSave) op.afterSave(rowid);
+			$("tr#"+rid+" div.ui-inline-edit, "+"tr#"+rid+" div.ui-inline-del","#"+gid + ".ui-jqgrid-btable:first").show();
+			$("tr#"+rid+" div.ui-inline-save, "+"tr#"+rid+" div.ui-inline-cancel","#"+gid+ ".ui-jqgrid-btable:first").hide();
+		},
+		restorerow = function( rowid)	{
+			if(op.afterRestore) op.afterRestore(rowid);
+			$("tr#"+rid+" div.ui-inline-edit, "+"tr#"+rid+" div.ui-inline-del","#"+gid+ ".ui-jqgrid-btable:first").show();
+			$("tr#"+rid+" div.ui-inline-save, "+"tr#"+rid+" div.ui-inline-cancel","#"+gid+ ".ui-jqgrid-btable:first").hide();
+		};
+
+		switch(act)
+		{
+			case 'edit':
+				$('#'+gid).jqGrid('editRow',rid, op.keys, op.onEdit, op.onSuccess, op.url, op.extraparam, saverow, op.onError,restorerow);
+				$("tr#"+rid+" div.ui-inline-edit, "+"tr#"+rid+" div.ui-inline-del","#"+gid+ ".ui-jqgrid-btable:first").hide();
+				$("tr#"+rid+" div.ui-inline-save, "+"tr#"+rid+" div.ui-inline-cancel","#"+gid+ ".ui-jqgrid-btable:first").show();
+				break;
+			case 'save':
+				if ( $('#'+gid).jqGrid('saveRow',rid,  op.onSuccess,op.url, op.extraparam, saverow, op.onError,restorerow) ) {
+				$("tr#"+rid+" div.ui-inline-edit, "+"tr#"+rid+" div.ui-inline-del","#"+gid+ ".ui-jqgrid-btable:first").show();
+				$("tr#"+rid+" div.ui-inline-save, "+"tr#"+rid+" div.ui-inline-cancel","#"+gid+ ".ui-jqgrid-btable:first").hide();
+				}
+				break;
+			case 'cancel' :
+				$('#'+gid).jqGrid('restoreRow',rid, restorerow);
+				$("tr#"+rid+" div.ui-inline-edit, "+"tr#"+rid+" div.ui-inline-del","#"+gid+ ".ui-jqgrid-btable:first").show();
+				$("tr#"+rid+" div.ui-inline-save, "+"tr#"+rid+" div.ui-inline-cancel","#"+gid+ ".ui-jqgrid-btable:first").hide();
+				break;
+			case 'del':
+				$('#'+gid).jqGrid('delGridRow',rid, op.delOptions);
+				break;
+			case 'formedit':
+				$('#'+gid).jqGrid('setSelection',rid);
+				$('#'+gid).jqGrid('editGridRow',rid, op.editOptions);
+				break;
+		}
+	};
+	$.fn.fmatter.actions = function(cellval,opts, rwd) {
+		var op ={keys:false, editbutton:true, delbutton:true, editformbutton: false};
+		if(!$.fmatter.isUndefined(opts.colModel.formatoptions)) {
+			op = $.extend(op,opts.colModel.formatoptions);
+		}
+		var rowid = opts.rowId, str="",ocl;
+		if(typeof(rowid) =='undefined' || $.fmatter.isEmpty(rowid)) {return "";}
+		if(op.editformbutton){
+			ocl = "onclick=jQuery.fn.fmatter.rowactions('"+rowid+"','"+opts.gid+"','formedit',"+opts.pos+"); onmouseover=jQuery(this).addClass('ui-state-hover'); onmouseout=jQuery(this).removeClass('ui-state-hover'); "
+			str =str+ "<div title='"+$.jgrid.nav.edittitle+"' style='float:left;cursor:pointer;' class='ui-pg-div ui-inline-edit' "+ocl+"><span class='ui-icon ui-icon-pencil'></span></div>";
+		} else 	if(op.editbutton){
+			ocl = "onclick=jQuery.fn.fmatter.rowactions('"+rowid+"','"+opts.gid+"','edit',"+opts.pos+"); onmouseover=jQuery(this).addClass('ui-state-hover'); onmouseout=jQuery(this).removeClass('ui-state-hover') ";
+			str =str+ "<div title='"+$.jgrid.nav.edittitle+"' style='float:left;cursor:pointer;' class='ui-pg-div ui-inline-edit' "+ocl+"><span class='ui-icon ui-icon-pencil'></span></div>";
+		}
+		if(op.delbutton) {
+			ocl = "onclick=jQuery.fn.fmatter.rowactions('"+rowid+"','"+opts.gid+"','del',"+opts.pos+"); onmouseover=jQuery(this).addClass('ui-state-hover'); onmouseout=jQuery(this).removeClass('ui-state-hover'); ";
+			str = str+"<div title='"+$.jgrid.nav.deltitle+"' style='float:left;margin-left:5px;' class='ui-pg-div ui-inline-del' "+ocl+"><span class='ui-icon ui-icon-trash'></span></div>";
+		}
+		ocl = "onclick=jQuery.fn.fmatter.rowactions('"+rowid+"','"+opts.gid+"','save',"+opts.pos+"); onmouseover=jQuery(this).addClass('ui-state-hover'); onmouseout=jQuery(this).removeClass('ui-state-hover'); ";
+		str = str+"<div title='"+$.jgrid.edit.bSubmit+"' style='float:left;display:none' class='ui-pg-div ui-inline-save' "+ocl+"><span class='ui-icon ui-icon-disk'></span></div>";
+		ocl = "onclick=jQuery.fn.fmatter.rowactions('"+rowid+"','"+opts.gid+"','cancel',"+opts.pos+"); onmouseover=jQuery(this).addClass('ui-state-hover'); onmouseout=jQuery(this).removeClass('ui-state-hover'); ";
+		str = str+"<div title='"+$.jgrid.edit.bCancel+"' style='float:left;display:none;margin-left:5px;' class='ui-pg-div ui-inline-cancel' "+ocl+"><span class='ui-icon ui-icon-cancel'></span></div>";
+		return "<div style='margin-left:8px;'>" + str + "</div>";
+	};
+	$.unformat = function (cellval,options,pos,cnt) {
+		// specific for jqGrid only
+		var ret, formatType = options.colModel.formatter,
+		op =options.colModel.formatoptions || {}, sep,
+		re = /([\.\*\_\'\(\)\{\}\+\?\\])/g,
+		unformatFunc = options.colModel.unformat||($.fn.fmatter[formatType] && $.fn.fmatter[formatType].unformat);
+		if(typeof unformatFunc !== 'undefined' && $.isFunction(unformatFunc) ) {
+			ret = unformatFunc($(cellval).text(), options, cellval);
+		} else if(!$.fmatter.isUndefined(formatType) && $.fmatter.isString(formatType) ) {
+			var opts = $.jgrid.formatter || {}, stripTag;
+			switch(formatType) {
+				case 'integer' :
+					op = $.extend({},opts.integer,op);
+					sep = op.thousandsSeparator.replace(re,"\\$1");
+					stripTag = new RegExp(sep, "g");
+					ret = $(cellval).text().replace(stripTag,'');
+					break;
+				case 'number' :
+					op = $.extend({},opts.number,op);
+					sep = op.thousandsSeparator.replace(re,"\\$1");
+					stripTag = new RegExp(sep, "g");
+					ret = $(cellval).text().replace(stripTag,"").replace(op.decimalSeparator,'.');
+					break;
+				case 'currency':
+					op = $.extend({},opts.currency,op);
+					sep = op.thousandsSeparator.replace(re,"\\$1");
+					stripTag = new RegExp(sep, "g");
+					ret = $(cellval).text().replace(stripTag,'').replace(op.decimalSeparator,'.').replace(op.prefix,'').replace(op.suffix,'');
+					break;
+				case 'checkbox':
+					var cbv = (options.colModel.editoptions) ? options.colModel.editoptions.value.split(":") : ["Yes","No"];
+					ret = $('input',cellval).is(":checked") ? cbv[0] : cbv[1];
+					break;
+				case 'select' :
+					ret = $.unformat.select(cellval,options,pos,cnt);
+					break;
+				case 'actions':
+					return "";
+				default:
+					ret= $(cellval).text();
+			}
+		}
+		return ret !== undefined ? ret : cnt===true ? $(cellval).text() : $.jgrid.htmlDecode($(cellval).html());
+	};
+	$.unformat.select = function (cellval,options,pos,cnt) {
+		// Spacial case when we have local data and perform a sort
+		// cnt is set to true only in sortDataArray
+		var ret = [];
+		var cell = $(cellval).text();
+		if(cnt===true) {return cell;}
+		var op = $.extend({},options.colModel.editoptions);
+		if(op.value){
+			var oSelect = op.value,
+			msl =  op.multiple === true ? true : false,
+			scell = [], sv;
+			if(msl) {scell = cell.split(",");scell = $.map(scell,function(n){return $.trim(n);});}
+			if ($.fmatter.isString(oSelect)) {
+				var so = oSelect.split(";"), j=0;
+				for(var i=0; i<so.length;i++){
+					sv = so[i].split(":");
+					if(sv.length > 2 ) {
+						sv[1] = jQuery.map(sv,function(n,i){if(i>0) {return n;}}).join(":");
+					}					
+					if(msl) {
+						if(jQuery.inArray(sv[1],scell)>-1) {
+							ret[j] = sv[0];
+							j++;
+						}
+					} else if($.trim(sv[1])==$.trim(cell)) {
+						ret[0] = sv[0];
+						break;
+					}
+				}
+			} else if($.fmatter.isObject(oSelect) || $.isArray(oSelect) ){
+				if(!msl) {scell[0] =  cell;}
+				ret = jQuery.map(scell, function(n){
+					var rv;
+					$.each(oSelect, function(i,val){
+						if (val == n) {
+							rv = i;
+							return false;
+						}
+					});
+					if( typeof(rv) != 'undefined' ) {return rv;}
+				});
+			}
+			return ret.join(", ");
+		} else {
+			return cell || "";
+		}
+	};
+	$.unformat.date = function (cellval, opts) {
+		var op = $.jgrid.formatter.date || {};
+		if(!$.fmatter.isUndefined(opts.formatoptions)) {
+			op = $.extend({},op,opts.formatoptions);
+		}		
+		if(!$.fmatter.isEmpty(cellval)) {
+			return  $.fmatter.util.DateFormat(op.newformat,cellval,op.srcformat,op);
+		} else {
+			return $.fn.fmatter.defaultFormat(cellval, opts);
+		}
+	};
+})(jQuery);
Index: controlies/trunk/applications/controlies/static/js/jdgrid/src/grid.subgrid.js
===================================================================
--- controlies/trunk/applications/controlies/static/js/jdgrid/src/grid.subgrid.js	(revision 240)
+++ controlies/trunk/applications/controlies/static/js/jdgrid/src/grid.subgrid.js	(revision 241)
@@ -1,260 +1,292 @@
-;(function($){
-/**
- * jqGrid extension for SubGrid Data
- * Tony Tomov tony@trirand.com
- * http://trirand.com/blog/ 
- * Dual licensed under the MIT and GPL licenses:
- * http://www.opensource.org/licenses/mit-license.php
- * http://www.gnu.org/licenses/gpl-2.0.html
-**/
-$.jgrid.extend({
-setSubGrid : function () {
-	return this.each(function (){
-		var $t = this, cm;
-		$t.p.colNames.unshift("");
-		$t.p.colModel.unshift({name:'subgrid',width: $.browser.safari ?  $t.p.subGridWidth+$t.p.cellLayout : $t.p.subGridWidth,sortable: false,resizable:false,hidedlg:true,search:false,fixed:true});
-		cm = $t.p.subGridModel;
-		if(cm[0]) {
-			cm[0].align = $.extend([],cm[0].align || []);
-			for(var i=0;i<cm[0].name.length;i++) { cm[0].align[i] = cm[0].align[i] || 'left';}
-		}
-	});
-},
-addSubGridCell :function (pos,iRow) {
-	var prp='',gv,sid;
-	this.each(function(){
-		prp = this.formatCol(pos,iRow);
-		gv = this.p.gridview;
-		sid= this.p.id;
-	});
-	if( gv === false ){
-		return "<td role=\"grid\" aria-describedby=\""+sid+"_subgrid\" class=\"ui-sgcollapsed sgcollapsed\" "+prp+"><a href='javascript:void(0);'><span class='ui-icon ui-icon-plus'></span></a></td>";
-	} else  {
-		return "<td role=\"grid\" aria-describedby=\""+sid+"_subgrid\" " +prp +"></td>";
-	}
-},
-addSubGrid : function(t,pos) {
-	return this.each(function(){
-		var ts = this;
-		if (!ts.grid ) { return; }
-		var res,_id, pID,atd, nhc, subdata, bfsc;
-		$("td:eq("+pos+")",t).click( function(e) {
-			if($(this).hasClass("sgcollapsed")) {
-				pID = ts.p.id;
-				res = $(this).parent();
-				atd = pos >=1 ? "<td colspan='"+pos+"'>&#160;</td>":"";
-				_id = $(res).attr("id");
-				bfsc =true;
-				if($.isFunction(ts.p.subGridBeforeExpand)) {
-					bfsc = ts.p.subGridBeforeExpand(pID+"_"+_id,_id);
-				}
-				if(bfsc === false) {return false;}
-				nhc = 0;
-				$.each(ts.p.colModel,function(i,v){
-					if(this.hidden === true || this.name == 'rn' || this.name == 'cb') {nhc++;}
-				});
-				subdata = "<tr role='row' class='ui-subgrid'>"+atd+"<td class='ui-widget-content subgrid-cell'><span class='ui-icon ui-icon-carat-1-sw'/></td><td colspan='"+parseInt(ts.p.colNames.length-1-nhc,10)+"' class='ui-widget-content subgrid-data'><div id="+pID+"_"+_id+" class='tablediv'>";
-				$(this).parent().after( subdata+ "</div></td></tr>" );
-				if( $.isFunction(ts.p.subGridRowExpanded)) {
-					ts.p.subGridRowExpanded(pID+"_"+ _id,_id);
-				} else {
-					populatesubgrid(res);
-				}
-				$(this).html("<a href='javascript:void(0);'><span class='ui-icon ui-icon-minus'></span></a>").removeClass("sgcollapsed").addClass("sgexpanded");
-			} else if($(this).hasClass("sgexpanded")) {
-				bfsc = true;
-				if( $.isFunction(ts.p.subGridRowColapsed)) {
-					res = $(this).parent();
-					_id = $(res).attr("id");
-					bfsc = ts.p.subGridRowColapsed(pID+"_"+_id,_id );
-				}
-				if(bfsc===false) {return false;}
-				$(this).parent().next().remove(".ui-subgrid");
-				$(this).html("<a href='javascript:void(0);'><span class='ui-icon ui-icon-plus'></span></a>").removeClass("sgexpanded").addClass("sgcollapsed");
-			}
-			return false;
-		});
-		//-------------------------
-		var populatesubgrid = function( rd ) {
-			var res,sid,dp, i, j;
-			sid = $(rd).attr("id");
-			dp = {nd_: (new Date().getTime())};
-			dp[ts.p.prmNames.subgridid]=sid;
-			if(!ts.p.subGridModel[0]) { return false; }
-			if(ts.p.subGridModel[0].params) {
-				for(j=0; j < ts.p.subGridModel[0].params.length; j++) {
-					for(i=0; i<ts.p.colModel.length; i++) {
-						if(ts.p.colModel[i].name == ts.p.subGridModel[0].params[j]) {
-							dp[ts.p.colModel[i].name]= $("td:eq("+i+")",rd).text().replace(/\&#160\;/ig,'');
-						}
-					}
-				}
-			}
-			if(!ts.grid.hDiv.loading) {
-				ts.grid.hDiv.loading = true;
-				$("#load_"+ts.p.id).show();
-				if(!ts.p.subgridtype) { ts.p.subgridtype = ts.p.datatype; }
-				if($.isFunction(ts.p.subgridtype)) {
-					ts.p.subgridtype(dp);
-				} else {
-					ts.p.subgridtype = ts.p.subgridtype.toLowerCase();
-				}
-				switch(ts.p.subgridtype) {
-					case "xml":
-					case "json":
-					$.ajax($.extend({
-						type:ts.p.mtype,
-						url: ts.p.subGridUrl,
-						dataType:ts.p.subgridtype,
-						data: $.isFunction(ts.p.serializeSubGridData)? ts.p.serializeSubGridData(dp) : dp,
-						complete: function(sxml) {
-							if(ts.p.subgridtype == "xml") {
-								subGridXml(sxml.responseXML, sid);
-							} else {
-								subGridJson($.jgrid.parse(sxml.responseText),sid);
-							}
-							sxml=null;
-						}
-					}, $.jgrid.ajaxOptions, ts.p.ajaxSubgridOptions || {}));
-					break;
-				}
-			}
-			return false;
-		};
-		var subGridCell = function(trdiv,cell,pos){
-			var tddiv = $("<td align='"+ts.p.subGridModel[0].align[pos]+"'></td>").html(cell);
-			$(trdiv).append(tddiv);
-		};
-		var subGridXml = function(sjxml, sbid){
-			var tddiv, i, cur, sgmap,
-			dummy = $("<table cellspacing='0' cellpadding='0' border='0'><tbody></tbody></table>"),
-			trdiv = $("<tr></tr>");
-			for (i = 0; i<ts.p.subGridModel[0].name.length; i++) {
-				tddiv = $("<th class='ui-state-default ui-th-subgrid ui-th-column ui-th-"+ts.p.direction+"'></th>");
-				$(tddiv).html(ts.p.subGridModel[0].name[i]);
-				$(tddiv).width( ts.p.subGridModel[0].width[i]);
-				$(trdiv).append(tddiv);
-			}
-			$(dummy).append(trdiv);
-			if (sjxml){
-				sgmap = ts.p.xmlReader.subgrid;
-				$(sgmap.root+" "+sgmap.row, sjxml).each( function(){
-					trdiv = $("<tr class='ui-widget-content ui-subtblcell'></tr>");
-					if(sgmap.repeatitems === true) {
-						$(sgmap.cell,this).each( function(i) {
-							subGridCell(trdiv, $(this).text() || '&#160;',i);
-						});
-					} else {
-						var f = ts.p.subGridModel[0].mapping || ts.p.subGridModel[0].name;
-						if (f) {
-							for (i=0;i<f.length;i++) {
-								subGridCell(trdiv, $(f[i],this).text() || '&#160;',i);
-							}
-						}
-					}
-					$(dummy).append(trdiv);
-				});
-			}
-			var pID = $("table:first",ts.grid.bDiv).attr("id")+"_";
-			$("#"+pID+sbid).append(dummy);
-			ts.grid.hDiv.loading = false;
-			$("#load_"+ts.p.id).hide();
-			return false;
-		};
-		var subGridJson = function(sjxml, sbid){
-			var tddiv,result , i,cur, sgmap,j,
-			dummy = $("<table cellspacing='0' cellpadding='0' border='0'><tbody></tbody></table>"),
-			trdiv = $("<tr></tr>");
-			for (i = 0; i<ts.p.subGridModel[0].name.length; i++) {
-				tddiv = $("<th class='ui-state-default ui-th-subgrid ui-th-column ui-th-"+ts.p.direction+"'></th>");
-				$(tddiv).html(ts.p.subGridModel[0].name[i]);
-				$(tddiv).width( ts.p.subGridModel[0].width[i]);
-				$(trdiv).append(tddiv);
-			}
-			$(dummy).append(trdiv);
-			if (sjxml){
-				sgmap = ts.p.jsonReader.subgrid;
-				result = sjxml[sgmap.root];
-				if ( typeof result !== 'undefined' ) {
-					for (i=0;i<result.length;i++) {
-						cur = result[i];
-						trdiv = $("<tr class='ui-widget-content ui-subtblcell'></tr>");
-						if(sgmap.repeatitems === true) {
-							if(sgmap.cell) { cur=cur[sgmap.cell]; }
-							for (j=0;j<cur.length;j++) {
-								subGridCell(trdiv, cur[j] || '&#160;',j);
-							}
-						} else {
-							var f = ts.p.subGridModel[0].mapping || ts.p.subGridModel[0].name;
-							if(f.length) {
-								for (j=0;j<f.length;j++) {
-									subGridCell(trdiv, cur[f[j]] || '&#160;',j);
-								}
-							}
-						}
-						$(dummy).append(trdiv);
-					}
-				}
-			}
-			var pID = $("table:first",ts.grid.bDiv).attr("id")+"_";
-			$("#"+pID+sbid).append(dummy);
-			ts.grid.hDiv.loading = false;
-			$("#load_"+ts.p.id).hide();
-			return false;
-		};
-		ts.subGridXml = function(xml,sid) {subGridXml(xml,sid);};
-		ts.subGridJson = function(json,sid) {subGridJson(json,sid);};
-	});
-},
-expandSubGridRow : function(rowid) {
-	return this.each(function () {
-		var $t = this;
-		if(!$t.grid && !rowid) {return;}
-		if($t.p.subGrid===true) {
-			var rc = $(this).jqGrid("getInd",rowid,true);
-			if(rc) {
-				var sgc = $("td.sgcollapsed",rc)[0];
-				if(sgc) {
-					$(sgc).trigger("click");
-				}
-			}
-		}
-	});
-},
-collapseSubGridRow : function(rowid) {
-	return this.each(function () {
-		var $t = this;
-		if(!$t.grid && !rowid) {return;}
-		if($t.p.subGrid===true) {
-			var rc = $(this).jqGrid("getInd",rowid,true);
-			if(rc) {
-				var sgc = $("td.sgexpanded",rc)[0];
-				if(sgc) {
-					$(sgc).trigger("click");
-				}
-			}
-		}
-	});
-},
-toggleSubGridRow : function(rowid) {
-	return this.each(function () {
-		var $t = this;
-		if(!$t.grid && !rowid) {return;}
-		if($t.p.subGrid===true) {
-			var rc = $(this).jqGrid("getInd",rowid,true);
-			if(rc) {
-				var sgc = $("td.sgcollapsed",rc)[0];
-				if(sgc) {
-					$(sgc).trigger("click");
-				} else {
-					sgc = $("td.sgexpanded",rc)[0];
-					if(sgc) {
-						$(sgc).trigger("click");
-					}
-				}
-			}
-		}
-	});
-}
-});
-})(jQuery);
+;(function($){
+/**
+ * jqGrid extension for SubGrid Data
+ * Tony Tomov tony@trirand.com
+ * http://trirand.com/blog/ 
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl-2.0.html
+**/
+$.jgrid.extend({
+setSubGrid : function () {
+	return this.each(function (){
+		var $t = this, cm,
+		suboptions = {
+			plusicon : "ui-icon-plus",
+			minusicon : "ui-icon-minus",
+			openicon: "ui-icon-carat-1-sw",
+			expandOnLoad:  false,
+			delayOnLoad : 50,
+			selectOnExpand : false,
+			reloadOnExpand : true
+		};
+		$t.p.subGridOptions = $.extend(suboptions, $t.p.subGridOptions || {});
+		$t.p.colNames.unshift("");
+		$t.p.colModel.unshift({name:'subgrid',width: $.browser.safari ?  $t.p.subGridWidth+$t.p.cellLayout : $t.p.subGridWidth,sortable: false,resizable:false,hidedlg:true,search:false,fixed:true});
+		cm = $t.p.subGridModel;
+		if(cm[0]) {
+			cm[0].align = $.extend([],cm[0].align || []);
+			for(var i=0;i<cm[0].name.length;i++) { cm[0].align[i] = cm[0].align[i] || 'left';}
+		}
+	});
+},
+addSubGridCell :function (pos,iRow) {
+	var prp='',ic,sid;
+	this.each(function(){
+		prp = this.formatCol(pos,iRow);
+		sid= this.p.id;
+		ic = this.p.subGridOptions.plusicon;
+	});
+	return "<td role=\"grid\" aria-describedby=\""+sid+"_subgrid\" class=\"ui-sgcollapsed sgcollapsed\" "+prp+"><a href='javascript:void(0);'><span class='ui-icon "+ic+"'></span></a></td>";
+},
+addSubGrid : function( pos, sind ) {
+	return this.each(function(){
+		var ts = this;
+		if (!ts.grid ) { return; }
+		//-------------------------
+		var subGridCell = function(trdiv,cell,pos)
+		{
+			var tddiv = $("<td align='"+ts.p.subGridModel[0].align[pos]+"'></td>").html(cell);
+			$(trdiv).append(tddiv);
+		};
+		var subGridXml = function(sjxml, sbid){
+			var tddiv, i,  sgmap,
+			dummy = $("<table cellspacing='0' cellpadding='0' border='0'><tbody></tbody></table>"),
+			trdiv = $("<tr></tr>");
+			for (i = 0; i<ts.p.subGridModel[0].name.length; i++) {
+				tddiv = $("<th class='ui-state-default ui-th-subgrid ui-th-column ui-th-"+ts.p.direction+"'></th>");
+				$(tddiv).html(ts.p.subGridModel[0].name[i]);
+				$(tddiv).width( ts.p.subGridModel[0].width[i]);
+				$(trdiv).append(tddiv);
+			}
+			$(dummy).append(trdiv);
+			if (sjxml){
+				sgmap = ts.p.xmlReader.subgrid;
+				$(sgmap.root+" "+sgmap.row, sjxml).each( function(){
+					trdiv = $("<tr class='ui-widget-content ui-subtblcell'></tr>");
+					if(sgmap.repeatitems === true) {
+						$(sgmap.cell,this).each( function(i) {
+							subGridCell(trdiv, $(this).text() || '&#160;',i);
+						});
+					} else {
+						var f = ts.p.subGridModel[0].mapping || ts.p.subGridModel[0].name;
+						if (f) {
+							for (i=0;i<f.length;i++) {
+								subGridCell(trdiv, $(f[i],this).text() || '&#160;',i);
+							}
+						}
+					}
+					$(dummy).append(trdiv);
+				});
+			}
+			var pID = $("table:first",ts.grid.bDiv).attr("id")+"_";
+			$("#"+pID+sbid).append(dummy);
+			ts.grid.hDiv.loading = false;
+			$("#load_"+ts.p.id).hide();
+			return false;
+		};
+		var subGridJson = function(sjxml, sbid){
+			var tddiv,result , i,cur, sgmap,j,
+			dummy = $("<table cellspacing='0' cellpadding='0' border='0'><tbody></tbody></table>"),
+			trdiv = $("<tr></tr>");
+			for (i = 0; i<ts.p.subGridModel[0].name.length; i++) {
+				tddiv = $("<th class='ui-state-default ui-th-subgrid ui-th-column ui-th-"+ts.p.direction+"'></th>");
+				$(tddiv).html(ts.p.subGridModel[0].name[i]);
+				$(tddiv).width( ts.p.subGridModel[0].width[i]);
+				$(trdiv).append(tddiv);
+			}
+			$(dummy).append(trdiv);
+			if (sjxml){
+				sgmap = ts.p.jsonReader.subgrid;
+				result = sjxml[sgmap.root];
+				if ( typeof result !== 'undefined' ) {
+					for (i=0;i<result.length;i++) {
+						cur = result[i];
+						trdiv = $("<tr class='ui-widget-content ui-subtblcell'></tr>");
+						if(sgmap.repeatitems === true) {
+							if(sgmap.cell) { cur=cur[sgmap.cell]; }
+							for (j=0;j<cur.length;j++) {
+								subGridCell(trdiv, cur[j] || '&#160;',j);
+							}
+						} else {
+							var f = ts.p.subGridModel[0].mapping || ts.p.subGridModel[0].name;
+							if(f.length) {
+								for (j=0;j<f.length;j++) {
+									subGridCell(trdiv, cur[f[j]] || '&#160;',j);
+								}
+							}
+						}
+						$(dummy).append(trdiv);
+					}
+				}
+			}
+			var pID = $("table:first",ts.grid.bDiv).attr("id")+"_";
+			$("#"+pID+sbid).append(dummy);
+			ts.grid.hDiv.loading = false;
+			$("#load_"+ts.p.id).hide();
+			return false;
+		};
+		var populatesubgrid = function( rd )
+		{
+			var sid,dp, i, j;
+			sid = $(rd).attr("id");
+			dp = {nd_: (new Date().getTime())};
+			dp[ts.p.prmNames.subgridid]=sid;
+			if(!ts.p.subGridModel[0]) { return false; }
+			if(ts.p.subGridModel[0].params) {
+				for(j=0; j < ts.p.subGridModel[0].params.length; j++) {
+					for(i=0; i<ts.p.colModel.length; i++) {
+						if(ts.p.colModel[i].name == ts.p.subGridModel[0].params[j]) {
+							dp[ts.p.colModel[i].name]= $("td:eq("+i+")",rd).text().replace(/\&#160\;/ig,'');
+						}
+					}
+				}
+			}
+			if(!ts.grid.hDiv.loading) {
+				ts.grid.hDiv.loading = true;
+				$("#load_"+ts.p.id).show();
+				if(!ts.p.subgridtype) { ts.p.subgridtype = ts.p.datatype; }
+				if($.isFunction(ts.p.subgridtype)) {
+					ts.p.subgridtype.call(ts, dp);
+				} else {
+					ts.p.subgridtype = ts.p.subgridtype.toLowerCase();
+				}
+				switch(ts.p.subgridtype) {
+					case "xml":
+					case "json":
+					$.ajax($.extend({
+						type:ts.p.mtype,
+						url: ts.p.subGridUrl,
+						dataType:ts.p.subgridtype,
+						data: $.isFunction(ts.p.serializeSubGridData)? ts.p.serializeSubGridData.call(ts, dp) : dp,
+						complete: function(sxml) {
+							if(ts.p.subgridtype == "xml") {
+								subGridXml(sxml.responseXML, sid);
+							} else {
+								subGridJson($.jgrid.parse(sxml.responseText),sid);
+							}
+							sxml=null;
+						}
+					}, $.jgrid.ajaxOptions, ts.p.ajaxSubgridOptions || {}));
+					break;
+				}
+			}
+			return false;
+		};
+		var _id, pID,atd, nhc=0, bfsc, r;
+		$.each(ts.p.colModel,function(i,v){
+			if(this.hidden === true || this.name == 'rn' || this.name == 'cb') {
+				nhc++;
+			}
+		});
+		var len = ts.rows.length, i=1;
+		if( sind !== undefined && sind > 0) {
+			i = sind;
+			len = sind+1;
+		}
+		while(i < len) {
+			if($(ts.rows[i]).hasClass('jqgrow')) {
+				$(ts.rows[i].cells[pos]).bind('click', function(e) {
+					var tr = $(this).parent("tr")[0];
+					r = tr.nextSibling;
+					if($(this).hasClass("sgcollapsed")) {
+						pID = ts.p.id;
+						_id = tr.id;
+						if(ts.p.subGridOptions.reloadOnExpand === true || ( ts.p.subGridOptions.reloadOnExpand === false && !$(r).hasClass('ui-subgrid') ) ) {
+							atd = pos >=1 ? "<td colspan='"+pos+"'>&#160;</td>":"";
+							bfsc =true;
+							if($.isFunction(ts.p.subGridBeforeExpand)) {
+								bfsc = ts.p.subGridBeforeExpand.call(ts, pID+"_"+_id,_id);
+							}
+							if(bfsc === false) {return false;}
+								$(tr).after( "<tr role='row' class='ui-subgrid'>"+atd+"<td class='ui-widget-content subgrid-cell'><span class='ui-icon "+ts.p.subGridOptions.openicon+"'></span></td><td colspan='"+parseInt(ts.p.colNames.length-1-nhc,10)+"' class='ui-widget-content subgrid-data'><div id="+pID+"_"+_id+" class='tablediv'></div></td></tr>" );
+							if( $.isFunction(ts.p.subGridRowExpanded)) {
+								ts.p.subGridRowExpanded.call(ts, pID+"_"+ _id,_id);
+							} else {
+								populatesubgrid(tr);
+							}
+						} else {
+							$(r).show();
+						}
+						$(this).html("<a href='javascript:void(0);'><span class='ui-icon "+ts.p.subGridOptions.minusicon+"'></span></a>").removeClass("sgcollapsed").addClass("sgexpanded");
+						if(ts.p.subGridOptions.selectOnExpand) {
+							$(ts).jqGrid('setSelection',_id);
+						}
+					} else if($(this).hasClass("sgexpanded")) {
+						bfsc = true;
+						if( $.isFunction(ts.p.subGridRowColapsed)) {
+							_id = tr.id;
+							bfsc = ts.p.subGridRowColapsed.call(ts, pID+"_"+_id,_id );
+						}
+						if(bfsc===false) {return false;}
+							if(ts.p.subGridOptions.reloadOnExpand === true) {
+								$(r).remove(".ui-subgrid");
+							} else if($(r).hasClass('ui-subgrid')) { // incase of dynamic deleting
+								$(r).hide();
+							}
+							$(this).html("<a href='javascript:void(0);'><span class='ui-icon "+ts.p.subGridOptions.plusicon+"'></span></a>").removeClass("sgexpanded").addClass("sgcollapsed");
+					}
+					return false;
+				});
+			}
+			if(ts.p.subGridOptions.expandOnLoad === true) {
+				$(ts.rows[i].cells[pos]).trigger('click');
+				}
+			i++;
+		}
+		ts.subGridXml = function(xml,sid) {subGridXml(xml,sid);};
+		ts.subGridJson = function(json,sid) {subGridJson(json,sid);};
+	});
+},
+expandSubGridRow : function(rowid) {
+	return this.each(function () {
+		var $t = this;
+		if(!$t.grid && !rowid) {return;}
+		if($t.p.subGrid===true) {
+			var rc = $(this).jqGrid("getInd",rowid,true);
+			if(rc) {
+				var sgc = $("td.sgcollapsed",rc)[0];
+				if(sgc) {
+					$(sgc).trigger("click");
+				}
+			}
+		}
+	});
+},
+collapseSubGridRow : function(rowid) {
+	return this.each(function () {
+		var $t = this;
+		if(!$t.grid && !rowid) {return;}
+		if($t.p.subGrid===true) {
+			var rc = $(this).jqGrid("getInd",rowid,true);
+			if(rc) {
+				var sgc = $("td.sgexpanded",rc)[0];
+				if(sgc) {
+					$(sgc).trigger("click");
+				}
+			}
+		}
+	});
+},
+toggleSubGridRow : function(rowid) {
+	return this.each(function () {
+		var $t = this;
+		if(!$t.grid && !rowid) {return;}
+		if($t.p.subGrid===true) {
+			var rc = $(this).jqGrid("getInd",rowid,true);
+			if(rc) {
+				var sgc = $("td.sgcollapsed",rc)[0];
+				if(sgc) {
+					$(sgc).trigger("click");
+				} else {
+					sgc = $("td.sgexpanded",rc)[0];
+					if(sgc) {
+						$(sgc).trigger("click");
+					}
+				}
+			}
+		}
+	});
+}
+});
+})(jQuery);
Index: controlies/trunk/applications/controlies/static/js/jdgrid/src/jqModal.js
===================================================================
--- controlies/trunk/applications/controlies/static/js/jdgrid/src/jqModal.js	(revision 240)
+++ controlies/trunk/applications/controlies/static/js/jdgrid/src/jqModal.js	(revision 241)
@@ -1,69 +1,69 @@
-/*
- * jqModal - Minimalist Modaling with jQuery
- *   (http://dev.iceburg.net/jquery/jqmodal/)
- *
- * Copyright (c) 2007,2008 Brice Burgess <bhb@iceburg.net>
- * Dual licensed under the MIT and GPL licenses:
- *   http://www.opensource.org/licenses/mit-license.php
- *   http://www.gnu.org/licenses/gpl.html
- * 
- * $Version: 07/06/2008 +r13
- */
-(function($) {
-$.fn.jqm=function(o){
-var p={
-overlay: 50,
-closeoverlay : true,
-overlayClass: 'jqmOverlay',
-closeClass: 'jqmClose',
-trigger: '.jqModal',
-ajax: F,
-ajaxText: '',
-target: F,
-modal: F,
-toTop: F,
-onShow: F,
-onHide: F,
-onLoad: F
-};
-return this.each(function(){if(this._jqm)return H[this._jqm].c=$.extend({},H[this._jqm].c,o);s++;this._jqm=s;
-H[s]={c:$.extend(p,$.jqm.params,o),a:F,w:$(this).addClass('jqmID'+s),s:s};
-if(p.trigger)$(this).jqmAddTrigger(p.trigger);
-});};
-
-$.fn.jqmAddClose=function(e){return hs(this,e,'jqmHide');};
-$.fn.jqmAddTrigger=function(e){return hs(this,e,'jqmShow');};
-$.fn.jqmShow=function(t){return this.each(function(){$.jqm.open(this._jqm,t);});};
-$.fn.jqmHide=function(t){return this.each(function(){$.jqm.close(this._jqm,t)});};
-
-$.jqm = {
-hash:{},
-open:function(s,t){var h=H[s],c=h.c,cc='.'+c.closeClass,z=(parseInt(h.w.css('z-index')));z=(z>0)?z:3000;var o=$('<div></div>').css({height:'100%',width:'100%',position:'fixed',left:0,top:0,'z-index':z-1,opacity:c.overlay/100});if(h.a)return F;h.t=t;h.a=true;h.w.css('z-index',z);
- if(c.modal) {if(!A[0])setTimeout(function(){L('bind');},1);A.push(s);}
- else if(c.overlay > 0) {if(c.closeoverlay) h.w.jqmAddClose(o);}
- else o=F;
-
- h.o=(o)?o.addClass(c.overlayClass).prependTo('body'):F;
- if(ie6){$('html,body').css({height:'100%',width:'100%'});if(o){o=o.css({position:'absolute'})[0];for(var y in {Top:1,Left:1})o.style.setExpression(y.toLowerCase(),"(_=(document.documentElement.scroll"+y+" || document.body.scroll"+y+"))+'px'");}}
-
- if(c.ajax) {var r=c.target||h.w,u=c.ajax;r=(typeof r == 'string')?$(r,h.w):$(r);u=(u.substr(0,1) == '@')?$(t).attr(u.substring(1)):u;
-  r.html(c.ajaxText).load(u,function(){if(c.onLoad)c.onLoad.call(this,h);if(cc)h.w.jqmAddClose($(cc,h.w));e(h);});}
- else if(cc)h.w.jqmAddClose($(cc,h.w));
-
- if(c.toTop&&h.o)h.w.before('<span id="jqmP'+h.w[0]._jqm+'"></span>').insertAfter(h.o);	
- (c.onShow)?c.onShow(h):h.w.show();e(h);return F;
-},
-close:function(s){var h=H[s];if(!h.a)return F;h.a=F;
- if(A[0]){A.pop();if(!A[0])L('unbind');}
- if(h.c.toTop&&h.o)$('#jqmP'+h.w[0]._jqm).after(h.w).remove();
- if(h.c.onHide)h.c.onHide(h);else{h.w.hide();if(h.o)h.o.remove();} return F;
-},
-params:{}};
-var s=0,H=$.jqm.hash,A=[],ie6=$.browser.msie&&($.browser.version == "6.0"),F=false,
-e=function(h){var i=$('<iframe src="javascript:false;document.write(\'\');" class="jqm"></iframe>').css({opacity:0});if(ie6)if(h.o)h.o.html('<p style="width:100%;height:100%"/>').prepend(i);else if(!$('iframe.jqm',h.w)[0])h.w.prepend(i); f(h);},
-f=function(h){try{$(':input:visible',h.w)[0].focus();}catch(_){}},
-L=function(t){$(document)[t]("keypress",m)[t]("keydown",m)[t]("mousedown",m);},
-m=function(e){var h=H[A[A.length-1]],r=(!$(e.target).parents('.jqmID'+h.s)[0]);if(r)f(h);return !r;},
-hs=function(w,t,c){return w.each(function(){var s=this._jqm;$(t).each(function() {
- if(!this[c]){this[c]=[];$(this).click(function(){for(var i in {jqmShow:1,jqmHide:1})for(var s in this[i])if(H[this[i][s]])H[this[i][s]].w[i](this);return F;});}this[c].push(s);});});};
+/*
+ * jqModal - Minimalist Modaling with jQuery
+ *   (http://dev.iceburg.net/jquery/jqmodal/)
+ *
+ * Copyright (c) 2007,2008 Brice Burgess <bhb@iceburg.net>
+ * Dual licensed under the MIT and GPL licenses:
+ *   http://www.opensource.org/licenses/mit-license.php
+ *   http://www.gnu.org/licenses/gpl.html
+ * 
+ * $Version: 07/06/2008 +r13
+ */
+(function($) {
+$.fn.jqm=function(o){
+var p={
+overlay: 50,
+closeoverlay : true,
+overlayClass: 'jqmOverlay',
+closeClass: 'jqmClose',
+trigger: '.jqModal',
+ajax: F,
+ajaxText: '',
+target: F,
+modal: F,
+toTop: F,
+onShow: F,
+onHide: F,
+onLoad: F
+};
+return this.each(function(){if(this._jqm)return H[this._jqm].c=$.extend({},H[this._jqm].c,o);s++;this._jqm=s;
+H[s]={c:$.extend(p,$.jqm.params,o),a:F,w:$(this).addClass('jqmID'+s),s:s};
+if(p.trigger)$(this).jqmAddTrigger(p.trigger);
+});};
+
+$.fn.jqmAddClose=function(e){return hs(this,e,'jqmHide');};
+$.fn.jqmAddTrigger=function(e){return hs(this,e,'jqmShow');};
+$.fn.jqmShow=function(t){return this.each(function(){$.jqm.open(this._jqm,t);});};
+$.fn.jqmHide=function(t){return this.each(function(){$.jqm.close(this._jqm,t)});};
+
+$.jqm = {
+hash:{},
+open:function(s,t){var h=H[s],c=h.c,cc='.'+c.closeClass,z=(parseInt(h.w.css('z-index')));z=(z>0)?z:3000;var o=$('<div></div>').css({height:'100%',width:'100%',position:'fixed',left:0,top:0,'z-index':z-1,opacity:c.overlay/100});if(h.a)return F;h.t=t;h.a=true;h.w.css('z-index',z);
+ if(c.modal) {if(!A[0])setTimeout(function(){L('bind');},1);A.push(s);}
+ else if(c.overlay > 0) {if(c.closeoverlay) h.w.jqmAddClose(o);}
+ else o=F;
+
+ h.o=(o)?o.addClass(c.overlayClass).prependTo('body'):F;
+ if(ie6){$('html,body').css({height:'100%',width:'100%'});if(o){o=o.css({position:'absolute'})[0];for(var y in {Top:1,Left:1})o.style.setExpression(y.toLowerCase(),"(_=(document.documentElement.scroll"+y+" || document.body.scroll"+y+"))+'px'");}}
+
+ if(c.ajax) {var r=c.target||h.w,u=c.ajax;r=(typeof r == 'string')?$(r,h.w):$(r);u=(u.substr(0,1) == '@')?$(t).attr(u.substring(1)):u;
+  r.html(c.ajaxText).load(u,function(){if(c.onLoad)c.onLoad.call(this,h);if(cc)h.w.jqmAddClose($(cc,h.w));e(h);});}
+ else if(cc)h.w.jqmAddClose($(cc,h.w));
+
+ if(c.toTop&&h.o)h.w.before('<span id="jqmP'+h.w[0]._jqm+'"></span>').insertAfter(h.o);	
+ (c.onShow)?c.onShow(h):h.w.show();e(h);return F;
+},
+close:function(s){var h=H[s];if(!h.a)return F;h.a=F;
+ if(A[0]){A.pop();if(!A[0])L('unbind');}
+ if(h.c.toTop&&h.o)$('#jqmP'+h.w[0]._jqm).after(h.w).remove();
+ if(h.c.onHide)h.c.onHide(h);else{h.w.hide();if(h.o)h.o.remove();} return F;
+},
+params:{}};
+var s=0,H=$.jqm.hash,A=[],ie6=$.browser.msie&&($.browser.version == "6.0"),F=false,
+e=function(h){var i=$('<iframe src="javascript:false;document.write(\'\');" class="jqm"></iframe>').css({opacity:0});if(ie6)if(h.o)h.o.html('<p style="width:100%;height:100%"/>').prepend(i);else if(!$('iframe.jqm',h.w)[0])h.w.prepend(i); f(h);},
+f=function(h){try{$(':input:visible',h.w)[0].focus();}catch(_){}},
+L=function(t){$(document)[t]("keypress",m)[t]("keydown",m)[t]("mousedown",m);},
+m=function(e){var h=H[A[A.length-1]],r=(!$(e.target).parents('.jqmID'+h.s)[0]);if(r)f(h);return !r;},
+hs=function(w,t,c){return w.each(function(){var s=this._jqm;$(t).each(function() {
+ if(!this[c]){this[c]=[];$(this).click(function(){for(var i in {jqmShow:1,jqmHide:1})for(var s in this[i])if(H[this[i][s]])H[this[i][s]].w[i](this);return F;});}this[c].push(s);});});};
 })(jQuery);
\ No newline at end of file
Index: controlies/trunk/applications/controlies/static/js/jdgrid/src/grid.treegrid.js
===================================================================
--- controlies/trunk/applications/controlies/static/js/jdgrid/src/grid.treegrid.js	(revision 240)
+++ controlies/trunk/applications/controlies/static/js/jdgrid/src/grid.treegrid.js	(revision 241)
@@ -1,445 +1,667 @@
-;(function($) {
-/*
-**
- * jqGrid extension - Tree Grid
- * Tony Tomov tony@trirand.com
- * http://trirand.com/blog/ 
- * Dual licensed under the MIT and GPL licenses:
- * http://www.opensource.org/licenses/mit-license.php
- * http://www.gnu.org/licenses/gpl-2.0.html
-**/ 
-$.jgrid.extend({
-	setTreeNode : function(rd, row){
-		return this.each(function(){
-			var $t = this;
-			if( !$t.grid || !$t.p.treeGrid ) { return; }
-			var expCol = $t.p.expColInd;
-			var expanded = $t.p.treeReader.expanded_field;
-			var isLeaf = $t.p.treeReader.leaf_field;
-			var level = $t.p.treeReader.level_field;
-			row.level = rd[level];
-			
-			if($t.p.treeGridModel == 'nested') {
-				row.lft = rd[$t.p.treeReader.left_field];
-				row.rgt = rd[$t.p.treeReader.right_field];
-				if(!rd[isLeaf]) {
-				// NS Model
-					rd[isLeaf] = (parseInt(row.rgt,10) === parseInt(row.lft,10)+1) ? 'true' : 'false';
-				}
-			} else {
-				row.parent_id = rd[$t.p.treeReader.parent_id_field];
-			}
-			var curLevel = parseInt(row.level,10), ident,lftpos;
-			if($t.p.tree_root_level === 0) {
-				ident = curLevel+1;
-				lftpos = curLevel;
-			} else {
-				ident = curLevel;
-				lftpos = curLevel -1;
-			}
-			var twrap = "<div class='tree-wrap tree-wrap-"+$t.p.direction+"' style='width:"+(ident*18)+"px;'>";
-			twrap += "<div style='"+($t.p.direction=="rtl" ? "right:" : "left:")+(lftpos*18)+"px;' class='ui-icon ";
-
-			if(rd[isLeaf] == "true" || rd[isLeaf] === true) {
-				twrap += $t.p.treeIcons.leaf+" tree-leaf'";
-				row.isLeaf = true;
-			} else {
-				if(rd[expanded] == "true" || rd[expanded] === true) {
-					twrap += $t.p.treeIcons.minus+" tree-minus treeclick'";
-					row.expanded = true;
-				} else {
-					twrap += $t.p.treeIcons.plus+" tree-plus treeclick'";
-					row.expanded = false;
-				}
-				row.isLeaf = false;
-			}
-			twrap += "</div></div>";
-			if(parseInt(rd[level],10) !== parseInt($t.p.tree_root_level,10)) {                
-				if(!$($t).jqGrid("isVisibleNode",row)){ 
-					$(row).css("display","none");
-				}
-			}
-			$("td:eq("+expCol+")",row).wrapInner("<span></span>").prepend(twrap);
-			$(".treeclick",row).bind("click",function(e){
-				var target = e.target || e.srcElement;
-				var ind =$(target,$t.rows).parents("tr.jqgrow")[0].rowIndex;
-				if(!$t.rows[ind].isLeaf){
-					if($t.rows[ind].expanded){
-						$($t).jqGrid("collapseRow",$t.rows[ind]);
-						$($t).jqGrid("collapseNode",$t.rows[ind]);
-					} else {
-						$($t).jqGrid("expandRow",$t.rows[ind]);
-						$($t).jqGrid("expandNode",$t.rows[ind]);
-					}
-				}
-				return false;
-			});
-			if($t.p.ExpandColClick === true) {
-			$("span", row).css("cursor","pointer").bind("click",function(e){
-				var target = e.target || e.srcElement;
-				var ind =$(target,$t.rows).parents("tr.jqgrow")[0].rowIndex;
-				if(!$t.rows[ind].isLeaf){
-					if($t.rows[ind].expanded){
-						$($t).jqGrid("collapseRow",$t.rows[ind]);
-						$($t).jqGrid("collapseNode",$t.rows[ind]);
-					} else {
-						$($t).jqGrid("expandRow",$t.rows[ind]);
-						$($t).jqGrid("expandNode",$t.rows[ind]);
-					}
-				}
-				$($t).jqGrid("setSelection",$t.rows[ind].id);
-				return false;
-			});
-			}
-		});
-	},
-	setTreeGrid : function() {
-		return this.each(function (){
-			var $t = this, i=0, pico;
-			if(!$t.p.treeGrid) { return; }
-			if(!$t.p.treedatatype ) { $.extend($t.p,{treedatatype: $t.p.datatype}); }
-			$t.p.subGrid = false; $t.p.altRows =false;
-			$t.p.pgbuttons = false; $t.p.pginput = false;
-			$t.p.multiselect = false; $t.p.rowList = [];
-			pico = 'ui-icon-triangle-1-' + ($t.p.direction=="rtl" ? 'w' : 'e');
-			$t.p.treeIcons = $.extend({plus:pico,minus:'ui-icon-triangle-1-s',leaf:'ui-icon-radio-off'},$t.p.treeIcons || {});
-			if($t.p.treeGridModel == 'nested') {
-				$t.p.treeReader = $.extend({
-					level_field: "level",
-					left_field:"lft",
-					right_field: "rgt",
-					leaf_field: "isLeaf",
-					expanded_field: "expanded"
-				},$t.p.treeReader);
-			} else
-				if($t.p.treeGridModel == 'adjacency') {
-				$t.p.treeReader = $.extend({
-						level_field: "level",
-						parent_id_field: "parent",
-						leaf_field: "isLeaf",
-						expanded_field: "expanded"
-				},$t.p.treeReader );
-			}
-			for (var key in $t.p.colModel){
-				if($t.p.colModel.hasOwnProperty(key)) {
-					if($t.p.colModel[key].name == $t.p.ExpandColumn) {
-						$t.p.expColInd = i;
-						break;
-					}
-					i++;
-				}
-			}
-			if(!$t.p.expColInd) { $t.p.expColInd = 0; }
-			$.each($t.p.treeReader,function(i,n){
-				if(n){
-					$t.p.colNames.push(n);
-					$t.p.colModel.push({name:n,width:1,hidden:true,sortable:false,resizable:false,hidedlg:true,editable:true,search:false});
-				}
-			});			
-		});
-	},
-	expandRow: function (record){
-		this.each(function(){
-			var $t = this;
-			if(!$t.grid || !$t.p.treeGrid) { return; }
-			var childern = $($t).jqGrid("getNodeChildren",record);
-			//if ($($t).jqGrid("isVisibleNode",record)) {
-			$(childern).each(function(i){
-				$(this).css("display","");
-				if(this.expanded) {
-					$($t).jqGrid("expandRow",this);
-				}
-			});
-			//}
-		});
-	},
-	collapseRow : function (record) {
-		this.each(function(){
-			var $t = this;
-			if(!$t.grid || !$t.p.treeGrid) { return; }
-			var childern = $($t).jqGrid("getNodeChildren",record);
-			$(childern).each(function(i){
-				$(this).css("display","none");
-				if(this.expanded){
-					$($t).jqGrid("collapseRow",this);
-				}
-			});
-		});
-	},
-	// NS ,adjacency models
-	getRootNodes : function() {
-		var result = [];
-		this.each(function(){
-			var $t = this;
-			if(!$t.grid || !$t.p.treeGrid) { return; }
-			switch ($t.p.treeGridModel) {
-				case 'nested' :
-					var level = $t.p.treeReader.level_field;
-					$($t.rows).each(function(i){
-						if(parseInt(this[level],10) === parseInt($t.p.tree_root_level,10)) {
-							result.push(this);
-						}
-					});
-					break;
-				case 'adjacency' :
-					$($t.rows).each(function(i){
-						if(this.parent_id === null || String(this.parent_id).toLowerCase() == "null") {
-							result.push(this);
-						}
-					});
-					break;
-			}
-		});
-		return result;
-	},
-	getNodeDepth : function(rc) {
-		var ret = null;
-		this.each(function(){
-			var $t = this;
-			if(!this.grid || !this.p.treeGrid) { return; }
-			switch ($t.p.treeGridModel) {
-				case 'nested' :
-					ret = parseInt(rc.level,10) - parseInt(this.p.tree_root_level,10);
-					break;
-				case 'adjacency' :
-					ret = $($t).jqGrid("getNodeAncestors",rc).length;
-					break;
-			}
-		});
-		return ret;
-	},
-	getNodeParent : function(rc) {
-		var result = null;
-		this.each(function(){
-			var $t = this;
-			if(!$t.grid || !$t.p.treeGrid) { return; }
-			switch ($t.p.treeGridModel) {
-				case 'nested' :
-					var lft = parseInt(rc.lft,10), rgt = parseInt(rc.rgt,10), level = parseInt(rc.level,10);
-					$(this.rows).each(function(){
-						if(parseInt(this.level,10) === level-1 && parseInt(this.lft,10) < lft && parseInt(this.rgt,10) > rgt) {
-							result = this;
-							return false;
-						}
-					});
-					break;
-				case 'adjacency' :
-					$(this.rows).each(function(){
-						if(this.id == rc.parent_id ) {
-							result = this;
-							return false;
-						}
-					});
-					break;
-			}
-		});
-		return result;
-	},
-	getNodeChildren : function(rc) {
-		var result = [];
-		this.each(function(){
-			var $t = this;
-			if(!$t.grid || !$t.p.treeGrid) { return; }
-			switch ($t.p.treeGridModel) {
-				case 'nested' :
-					var lft = parseInt(rc.lft,10), rgt = parseInt(rc.rgt,10), level = parseInt(rc.level,10);
-					$(this.rows).each(function(i){
-						if(parseInt(this.level,10) === level+1 && parseInt(this.lft,10) > lft && parseInt(this.rgt,10) < rgt) {
-							result.push(this);
-						}
-					});
-					break;
-				case 'adjacency' :
-					$(this.rows).each(function(i){
-						if(this.parent_id == rc.id) {
-							result.push(this);
-						}
-					});
-					break;
-			}
-		});
-		return result;
-	},
-	getFullTreeNode : function(rc) {
-		var result = [];
-		this.each(function(){
-			var $t = this, len;
-			if(!$t.grid || !$t.p.treeGrid) { return; }
-			switch ($t.p.treeGridModel) {
-				case 'nested' :
-					var lft = parseInt(rc.lft,10), rgt = parseInt(rc.rgt,10), level = parseInt(rc.level,10);
-					$(this.rows).each(function(i){
-						if(parseInt(this.level,10) >= level && parseInt(this.lft,10) >= lft && parseInt(this.lft,10) <= rgt) {
-							result.push(this);
-						}
-					});
-					break;
-				case 'adjacency' :
-					result.push(rc);
-					$(this.rows).each(function(i){
-						len = result.length;
-						for (i = 0; i < len; i++) {
-							if (result[i].id == this.parent_id) {
-								result.push(this);
-								break;
-							}
-						}
-					});
-					break;
-			}
-		});
-		return result;
-	},	
-	// End NS, adjacency Model
-	getNodeAncestors : function(rc) {
-		var ancestors = [];
-		this.each(function(){
-			if(!this.grid || !this.p.treeGrid) { return; }
-			var parent = $(this).jqGrid("getNodeParent",rc);
-			while (parent) {
-				ancestors.push(parent);
-				parent = $(this).jqGrid("getNodeParent",parent);	
-			}
-		});
-		return ancestors;
-	},
-	isVisibleNode : function(rc) {
-		var result = true;
-		this.each(function(){
-			var $t = this;
-			if(!$t.grid || !$t.p.treeGrid) { return; }
-			var ancestors = $($t).jqGrid("getNodeAncestors",rc);
-			$(ancestors).each(function(){
-				result = result && this.expanded;
-				if(!result) {return false;}
-			});
-		});
-		return result;
-	},
-	isNodeLoaded : function(rc) {
-		var result;
-		this.each(function(){
-			var $t = this;
-			if(!$t.grid || !$t.p.treeGrid) { return; }
-			if(rc.loaded !== undefined) {
-				result = rc.loaded;
-			} else if( rc.isLeaf || $($t).jqGrid("getNodeChildren",rc).length > 0){
-				result = true;
-			} else {
-				result = false;
-			}
-		});
-		return result;
-	},
-	expandNode : function(rc) {
-		return this.each(function(){
-			if(!this.grid || !this.p.treeGrid) { return; }
-			if(!rc.expanded) {
-				if( $(this).jqGrid("isNodeLoaded",rc) ) {
-					rc.expanded = true;
-					$("div.treeclick",rc).removeClass(this.p.treeIcons.plus+" tree-plus").addClass(this.p.treeIcons.minus+" tree-minus");
-				} else {
-					rc.expanded = true;
-					$("div.treeclick",rc).removeClass(this.p.treeIcons.plus+" tree-plus").addClass(this.p.treeIcons.minus+" tree-minus");
-					this.p.treeANode = rc.rowIndex;
-					this.p.datatype = this.p.treedatatype;
-					if(this.p.treeGridModel == 'nested') {
-						$(this).jqGrid("setGridParam",{postData:{nodeid:rc.id,n_left:rc.lft,n_right:rc.rgt,n_level:rc.level}});
-					} else {
-						$(this).jqGrid("setGridParam",{postData:{nodeid:rc.id,parentid:rc.parent_id,n_level:rc.level}});
-					}
-					$(this).trigger("reloadGrid");
-					if(this.p.treeGridModel == 'nested') {
-						$(this).jqGrid("setGridParam",{postData:{nodeid:'',n_left:'',n_right:'',n_level:''}});
-					} else {
-						$(this).jqGrid("setGridParam",{postData:{nodeid:'',parentid:'',n_level:''}}); 
-					}
-				}
-			}
-		});
-	},
-	collapseNode : function(rc) {
-		return this.each(function(){
-			if(!this.grid || !this.p.treeGrid) { return; }
-			if(rc.expanded) {
-				rc.expanded = false;
-				$("div.treeclick",rc).removeClass(this.p.treeIcons.minus+" tree-minus").addClass(this.p.treeIcons.plus+" tree-plus");
-			}
-		});
-	},
-	SortTree : function( newDir) {
-		return this.each(function(){
-			if(!this.grid || !this.p.treeGrid) { return; }
-			var i, len,
-			rec, records = [], $t = this,
-			roots = $(this).jqGrid("getRootNodes");
-			// Sorting roots
-			roots.sort(function(a, b) {
-				if (a.sortKey < b.sortKey) {return -newDir;}
-				if (a.sortKey > b.sortKey) {return newDir;}
-				return 0;
-			});
-			if(roots[0]){
-				$("td",roots[0]).each( function( k ) {
-					$(this).css("width",$t.grid.headers[k].width+"px");
-				});
-				$t.grid.cols = roots[0].cells;
-			}
-			// Sorting children
-			for (i = 0, len = roots.length; i < len; i++) {
-				rec = roots[i];
-				records.push(rec);
-				$(this).jqGrid("collectChildrenSortTree",records, rec, newDir);
-			}
-			$.each(records, function(index, row) {
-				$('tbody',$t.grid.bDiv).append(row);
-				row.sortKey = null;
-			});
-		});
-	},
-	collectChildrenSortTree : function(records, rec, newDir) {
-		return this.each(function(){
-			if(!this.grid || !this.p.treeGrid) { return; }
-			var i, len,
-			child, 
-			children = $(this).jqGrid("getNodeChildren",rec);
-			children.sort(function(a, b) {
-				if (a.sortKey < b.sortKey) {return -newDir;}
-				if (a.sortKey > b.sortKey) {return newDir;}
-				return 0;
-			});
-			for (i = 0, len = children.length; i < len; i++) {
-				child = children[i];
-				records.push(child);
-				$(this).jqGrid("collectChildrenSortTree",records, child,newDir); 
-			}
-		});
-	},
-	// experimental 
-	setTreeRow : function(rowid, data) {
-		var nm, success=false;
-		this.each(function(){
-			var t = this;
-			if(!t.grid || !t.p.treeGrid) { return; }
-			success = $(t).jqGrid("setRowData",rowid,data);
-		});
-		return success;
-	},
-	delTreeNode : function (rowid) {
-		return this.each(function () {
-			var $t = this;
-			if(!$t.grid || !$t.p.treeGrid) { return; }
-			var rc = $($t).jqGrid("getInd",rowid,true);
-			if (rc) {
-				var dr = $($t).jqGrid("getNodeChildren",rc);
-				if(dr.length>0){
-					for (var i=0;i<dr.length;i++){
-						$($t).jqGrid("delRowData",dr[i].id);
-					}
-				}
-				$($t).jqGrid("delRowData",rc.id);
-			}
-		});
-	}
-});
+/**
+ * jqGrid extension - Tree Grid
+ * Tony Tomov tony@trirand.com
+ * http://trirand.com/blog/
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl.html
+**/
+
+/*global document, jQuery, $ */
+(function($) {
+$.jgrid.extend({
+	setTreeNode : function(i, len){
+		return this.each(function(){
+			var $t = this;
+			if( !$t.grid || !$t.p.treeGrid ) {return;}
+			var expCol = $t.p.expColInd,
+			expanded = $t.p.treeReader.expanded_field,
+			isLeaf = $t.p.treeReader.leaf_field,
+			level = $t.p.treeReader.level_field,
+			icon = $t.p.treeReader.icon_field,
+			loaded = $t.p.treeReader.loaded,  lft, rgt, curLevel, ident,lftpos, twrap,
+			ldat, lf;
+			while(i<len) {
+				var ind = $t.rows[i].id, dind = $t.p._index[ind], expan;
+				ldat = $t.p.data[dind];
+				//$t.rows[i].level = ldat[level];
+				if($t.p.treeGridModel == 'nested') {
+					if(!ldat[isLeaf]) {
+					lft = parseInt(ldat[$t.p.treeReader.left_field],10);
+					rgt = parseInt(ldat[$t.p.treeReader.right_field],10);
+					// NS Model
+						ldat[isLeaf] = (rgt === lft+1) ? 'true' : 'false';
+						$t.rows[i].cells[$t.p._treeleafpos].innerHTML = ldat[isLeaf];
+					}
+				}
+				//else {
+					//row.parent_id = rd[$t.p.treeReader.parent_id_field];
+				//}
+				curLevel = parseInt(ldat[level],10);
+				if($t.p.tree_root_level === 0) {
+					ident = curLevel+1;
+					lftpos = curLevel;
+				} else {
+					ident = curLevel;
+					lftpos = curLevel -1;
+				}
+				twrap = "<div class='tree-wrap tree-wrap-"+$t.p.direction+"' style='width:"+(ident*18)+"px;'>";
+				twrap += "<div style='"+($t.p.direction=="rtl" ? "right:" : "left:")+(lftpos*18)+"px;' class='ui-icon ";
+
+
+				if(ldat[loaded] !== undefined) {
+					if(ldat[loaded]=="true" || ldat[loaded]===true) {
+						ldat[loaded] = true;
+					} else {
+						ldat[loaded] = false;
+					}
+				}
+				if(ldat[isLeaf] == "true" || ldat[isLeaf] === true) {
+					twrap += ((ldat[icon] !== undefined && ldat[icon] !== "") ? ldat[icon] : $t.p.treeIcons.leaf)+" tree-leaf treeclick";
+					ldat[isLeaf] = true;
+					lf="leaf";
+				} else {
+					ldat[isLeaf] = false;
+					lf="";
+				}
+				ldat[expanded] = ((ldat[expanded] == "true" || ldat[expanded] === true) ? true : false) && ldat[loaded];
+				if(ldat[expanded] === false) {
+					twrap += ((ldat[isLeaf] === true) ? "'" : $t.p.treeIcons.plus+" tree-plus treeclick'");
+				} else {
+					twrap += ((ldat[isLeaf] === true) ? "'" : $t.p.treeIcons.minus+" tree-minus treeclick'");
+				}
+				
+				twrap += "></div></div>";
+				$($t.rows[i].cells[expCol]).wrapInner("<span class='cell-wrapper"+lf+"'></span>").prepend(twrap);
+
+				if(curLevel !== parseInt($t.p.tree_root_level,10)) {
+					var pn = $($t).jqGrid('getNodeParent',ldat);
+					expan = pn && pn.hasOwnProperty(expanded) ? pn[expanded] : true;
+					if( !expan ){
+						$($t.rows[i]).css("display","none");
+					}
+				}
+				$($t.rows[i].cells[expCol])
+					.find("div.treeclick")
+					.bind("click",function(e){
+						var target = e.target || e.srcElement,
+						ind2 =$(target,$t.rows).closest("tr.jqgrow")[0].id,
+						pos = $t.p._index[ind2];
+						if(!$t.p.data[pos][isLeaf]){
+							if($t.p.data[pos][expanded]){
+								$($t).jqGrid("collapseRow",$t.p.data[pos]);
+								$($t).jqGrid("collapseNode",$t.p.data[pos]);
+							} else {
+								$($t).jqGrid("expandRow",$t.p.data[pos]);
+								$($t).jqGrid("expandNode",$t.p.data[pos]);
+							}
+						}
+						return false;
+					});
+				if($t.p.ExpandColClick === true) {
+					$($t.rows[i].cells[expCol])
+						.find("span.cell-wrapper")
+						.css("cursor","pointer")
+						.bind("click",function(e) {
+							var target = e.target || e.srcElement,
+							ind2 =$(target,$t.rows).closest("tr.jqgrow")[0].id,
+							pos = $t.p._index[ind2];
+							if(!$t.p.data[pos][isLeaf]){
+								if($t.p.data[pos][expanded]){
+									$($t).jqGrid("collapseRow",$t.p.data[pos]);
+									$($t).jqGrid("collapseNode",$t.p.data[pos]);
+								} else {
+									$($t).jqGrid("expandRow",$t.p.data[pos]);
+									$($t).jqGrid("expandNode",$t.p.data[pos]);
+								}
+							}
+							$($t).jqGrid("setSelection",ind2);
+							return false;
+						});
+				}
+				i++;
+			}
+
+		});
+	},
+	setTreeGrid : function() {
+		return this.each(function (){
+			var $t = this, i=0, pico, ecol = false, nm, key, dupcols=[];
+			if(!$t.p.treeGrid) {return;}
+			if(!$t.p.treedatatype ) {$.extend($t.p,{treedatatype: $t.p.datatype});}
+			$t.p.subGrid = false;$t.p.altRows =false;
+			$t.p.pgbuttons = false;$t.p.pginput = false;
+			$t.p.gridview =  true;
+			if($t.p.rowTotal === null ) { $t.p.rowNum = 10000; }
+			$t.p.multiselect = false;$t.p.rowList = [];
+			$t.p.expColInd = 0;
+			pico = 'ui-icon-triangle-1-' + ($t.p.direction=="rtl" ? 'w' : 'e');
+			$t.p.treeIcons = $.extend({plus:pico,minus:'ui-icon-triangle-1-s',leaf:'ui-icon-radio-off'},$t.p.treeIcons || {});
+			if($t.p.treeGridModel == 'nested') {
+				$t.p.treeReader = $.extend({
+					level_field: "level",
+					left_field:"lft",
+					right_field: "rgt",
+					leaf_field: "isLeaf",
+					expanded_field: "expanded",
+					loaded: "loaded",
+					icon_field: "icon"
+				},$t.p.treeReader);
+			} else if($t.p.treeGridModel == 'adjacency') {
+				$t.p.treeReader = $.extend({
+						level_field: "level",
+						parent_id_field: "parent",
+						leaf_field: "isLeaf",
+						expanded_field: "expanded",
+						loaded: "loaded",
+						icon_field: "icon"
+				},$t.p.treeReader );
+			}
+			for ( key in $t.p.colModel){
+				if($t.p.colModel.hasOwnProperty(key)) {
+					nm = $t.p.colModel[key].name;
+					if( nm == $t.p.ExpandColumn && !ecol ) {
+						ecol = true;
+						$t.p.expColInd = i;
+					}
+					i++;
+					//
+					for(var tkey in $t.p.treeReader) {
+						if($t.p.treeReader[tkey] == nm)
+							dupcols.push(nm);
+				}
+
+			}
+			}
+			$.each($t.p.treeReader,function(j,n){
+				if(n && $.inArray(n, dupcols) === -1){
+					if(j==='leaf_field') { $t.p._treeleafpos= i; }
+				i++;
+					$t.p.colNames.push(n);
+					$t.p.colModel.push({name:n,width:1,hidden:true,sortable:false,resizable:false,hidedlg:true,editable:true,search:false});
+				}
+			});			
+		});
+	},
+	expandRow: function (record){
+		this.each(function(){
+			var $t = this;
+			if(!$t.grid || !$t.p.treeGrid) {return;}
+			var childern = $($t).jqGrid("getNodeChildren",record),
+			//if ($($t).jqGrid("isVisibleNode",record)) {
+			expanded = $t.p.treeReader.expanded_field;
+			$(childern).each(function(i){
+				var id  = $.jgrid.getAccessor(this,$t.p.localReader.id);
+				$("#"+id,$t.grid.bDiv).css("display","");
+				if(this[expanded]) {
+					$($t).jqGrid("expandRow",this);
+				}
+			});
+			//}
+		});
+	},
+	collapseRow : function (record) {
+		this.each(function(){
+			var $t = this;
+			if(!$t.grid || !$t.p.treeGrid) {return;}
+			var childern = $($t).jqGrid("getNodeChildren",record),
+			expanded = $t.p.treeReader.expanded_field;
+			$(childern).each(function(i){
+				var id  = $.jgrid.getAccessor(this,$t.p.localReader.id);
+				$("#"+id,$t.grid.bDiv).css("display","none");
+				if(this[expanded]){
+					$($t).jqGrid("collapseRow",this);
+				}
+			});
+		});
+	},
+	// NS ,adjacency models
+	getRootNodes : function() {
+		var result = [];
+		this.each(function(){
+			var $t = this;
+			if(!$t.grid || !$t.p.treeGrid) {return;}
+			switch ($t.p.treeGridModel) {
+				case 'nested' :
+					var level = $t.p.treeReader.level_field;
+					$($t.p.data).each(function(i){
+						if(parseInt(this[level],10) === parseInt($t.p.tree_root_level,10)) {
+							result.push(this);
+						}
+					});
+					break;
+				case 'adjacency' :
+					var parent_id = $t.p.treeReader.parent_id_field;
+					$($t.p.data).each(function(i){
+						if(this[parent_id] === null || String(this[parent_id]).toLowerCase() == "null") {
+							result.push(this);
+						}
+					});
+					break;
+			}
+		});
+		return result;
+	},
+	getNodeDepth : function(rc) {
+		var ret = null;
+		this.each(function(){
+			if(!this.grid || !this.p.treeGrid) {return;}
+			var $t = this;
+			switch ($t.p.treeGridModel) {
+				case 'nested' :
+					var level = $t.p.treeReader.level_field;
+					ret = parseInt(rc[level],10) - parseInt($t.p.tree_root_level,10);
+					break;
+				case 'adjacency' :
+					ret = $($t).jqGrid("getNodeAncestors",rc).length;
+					break;
+			}
+		});
+		return ret;
+	},
+	getNodeParent : function(rc) {
+		var result = null;
+		this.each(function(){
+			var $t = this;
+			if(!$t.grid || !$t.p.treeGrid) {return;}
+			switch ($t.p.treeGridModel) {
+				case 'nested' :
+					var lftc = $t.p.treeReader.left_field,
+					rgtc = $t.p.treeReader.right_field,
+					levelc = $t.p.treeReader.level_field,
+					lft = parseInt(rc[lftc],10), rgt = parseInt(rc[rgtc],10), level = parseInt(rc[levelc],10);
+					$(this.p.data).each(function(){
+						if(parseInt(this[levelc],10) === level-1 && parseInt(this[lftc],10) < lft && parseInt(this[rgtc],10) > rgt) {
+							result = this;
+							return false;
+						}
+					});
+					break;
+				case 'adjacency' :
+					var parent_id = $t.p.treeReader.parent_id_field,
+					dtid = $t.p.localReader.id;
+					$(this.p.data).each(function(i,val){
+						if(this[dtid] == rc[parent_id] ) {
+							result = this;
+							return false;
+						}
+					});
+					break;
+			}
+		});
+		return result;
+	},
+	getNodeChildren : function(rc) {
+		var result = [];
+		this.each(function(){
+			var $t = this;
+			if(!$t.grid || !$t.p.treeGrid) {return;}
+			switch ($t.p.treeGridModel) {
+				case 'nested' :
+					var lftc = $t.p.treeReader.left_field,
+					rgtc = $t.p.treeReader.right_field,
+					levelc = $t.p.treeReader.level_field,
+					lft = parseInt(rc[lftc],10), rgt = parseInt(rc[rgtc],10), level = parseInt(rc[levelc],10);
+					$(this.p.data).each(function(i){
+						if(parseInt(this[levelc],10) === level+1 && parseInt(this[lftc],10) > lft && parseInt(this[rgtc],10) < rgt) {
+							result.push(this);
+						}
+					});
+					break;
+				case 'adjacency' :
+					var parent_id = $t.p.treeReader.parent_id_field,
+					dtid = $t.p.localReader.id;
+					$(this.p.data).each(function(i,val){
+						if(this[parent_id] == rc[dtid]) {
+							result.push(this);
+						}
+					});
+					break;
+			}
+		});
+		return result;
+	},
+	getFullTreeNode : function(rc) {
+		var result = [];
+		this.each(function(){
+			var $t = this, len;
+			if(!$t.grid || !$t.p.treeGrid) {return;}
+			switch ($t.p.treeGridModel) {
+				case 'nested' :
+					var lftc = $t.p.treeReader.left_field,
+					rgtc = $t.p.treeReader.right_field,
+					levelc = $t.p.treeReader.level_field,
+					lft = parseInt(rc[lftc],10), rgt = parseInt(rc[rgtc],10), level = parseInt(rc[levelc],10);
+					$(this.p.data).each(function(i){
+						if(parseInt(this[levelc],10) >= level && parseInt(this[lftc],10) >= lft && parseInt(this[lftc],10) <= rgt) {
+							result.push(this);
+						}
+					});
+					break;
+				case 'adjacency' :
+					if(rc) {
+					result.push(rc);
+					var parent_id = $t.p.treeReader.parent_id_field,
+					dtid = $t.p.localReader.id;
+					$(this.p.data).each(function(i){
+						len = result.length;
+						for (i = 0; i < len; i++) {
+							if (result[i][dtid] == this[parent_id]) {
+								result.push(this);
+								break;
+							}
+						}
+					});
+					}
+					break;
+			}
+		});
+		return result;
+	},	
+	// End NS, adjacency Model
+	getNodeAncestors : function(rc) {
+		var ancestors = [];
+		this.each(function(){
+			if(!this.grid || !this.p.treeGrid) {return;}
+			var parent = $(this).jqGrid("getNodeParent",rc);
+			while (parent) {
+				ancestors.push(parent);
+				parent = $(this).jqGrid("getNodeParent",parent);	
+			}
+		});
+		return ancestors;
+	},
+	isVisibleNode : function(rc) {
+		var result = true;
+		this.each(function(){
+			var $t = this;
+			if(!$t.grid || !$t.p.treeGrid) {return;}
+			var ancestors = $($t).jqGrid("getNodeAncestors",rc),
+			expanded = $t.p.treeReader.expanded_field;
+			$(ancestors).each(function(){
+				result = result && this[expanded];
+				if(!result) {return false;}
+			});
+		});
+		return result;
+	},
+	isNodeLoaded : function(rc) {
+		var result;
+		this.each(function(){
+			var $t = this;
+			if(!$t.grid || !$t.p.treeGrid) {return;}
+			var isLeaf = $t.p.treeReader.leaf_field;
+			if(rc !== undefined ) {
+				if(rc.loaded !== undefined) {
+					result = rc.loaded;
+				} else if( rc[isLeaf] || $($t).jqGrid("getNodeChildren",rc).length > 0){
+					result = true;
+				} else {
+					result = false;
+				}
+			} else {
+				result = false;
+			}
+		});
+		return result;
+	},
+	expandNode : function(rc) {
+		return this.each(function(){
+			if(!this.grid || !this.p.treeGrid) {return;}
+			var expanded = this.p.treeReader.expanded_field,
+			parent = this.p.treeReader.parent_id_field,
+			loaded = this.p.treeReader.loaded,
+			level = this.p.treeReader.level_field,
+			lft = this.p.treeReader.left_field,
+			rgt = this.p.treeReader.right_field;
+
+			if(!rc[expanded]) {
+				var id = $.jgrid.getAccessor(rc,this.p.localReader.id);
+				var rc1 = $("#"+id,this.grid.bDiv)[0];
+				var position = this.p._index[id];
+				if( $(this).jqGrid("isNodeLoaded",this.p.data[position]) ) {
+					rc[expanded] = true;
+					$("div.treeclick",rc1).removeClass(this.p.treeIcons.plus+" tree-plus").addClass(this.p.treeIcons.minus+" tree-minus");
+				} else {
+					rc[expanded] = true;
+					$("div.treeclick",rc1).removeClass(this.p.treeIcons.plus+" tree-plus").addClass(this.p.treeIcons.minus+" tree-minus");
+					this.p.treeANode = rc1.rowIndex;
+					this.p.datatype = this.p.treedatatype;
+					if(this.p.treeGridModel == 'nested') {
+						$(this).jqGrid("setGridParam",{postData:{nodeid:id,n_left:rc[lft],n_right:rc[rgt],n_level:rc[level]}});
+					} else {
+						$(this).jqGrid("setGridParam",{postData:{nodeid:id,parentid:rc[parent],n_level:rc[level]}} );
+					}
+					$(this).trigger("reloadGrid");
+					rc[loaded] = true;
+					if(this.p.treeGridModel == 'nested') {
+						$(this).jqGrid("setGridParam",{postData:{nodeid:'',n_left:'',n_right:'',n_level:''}});
+					} else {
+						$(this).jqGrid("setGridParam",{postData:{nodeid:'',parentid:'',n_level:''}}); 
+					}
+				}
+			}
+		});
+	},
+	collapseNode : function(rc) {
+		return this.each(function(){
+			if(!this.grid || !this.p.treeGrid) {return;}
+			if(rc.expanded) {
+				rc.expanded = false;
+				var id = $.jgrid.getAccessor(rc,this.p.localReader.id);
+				var rc1 = $("#"+id,this.grid.bDiv)[0];
+				$("div.treeclick",rc1).removeClass(this.p.treeIcons.minus+" tree-minus").addClass(this.p.treeIcons.plus+" tree-plus");
+			}
+		});
+	},
+	SortTree : function( sortname, newDir, st, datefmt) {
+		return this.each(function(){
+			if(!this.grid || !this.p.treeGrid) {return;}
+			var i, len,
+			rec, records = [], $t = this, query, roots,
+			rt = $(this).jqGrid("getRootNodes");
+			// Sorting roots
+			query = $.jgrid.from(rt);
+			query.orderBy(sortname,newDir,st, datefmt);
+			roots = query.select();
+
+			// Sorting children
+			for (i = 0, len = roots.length; i < len; i++) {
+				rec = roots[i];
+				records.push(rec);
+				$(this).jqGrid("collectChildrenSortTree",records, rec, sortname, newDir,st, datefmt);
+			}
+			$.each(records, function(index, row) {
+				var id  = $.jgrid.getAccessor(this,$t.p.localReader.id);
+				$('#'+$t.p.id+ ' tbody tr:eq('+index+')').after($('tr#'+id,$t.grid.bDiv));
+			});
+			query = null;roots=null;records=null;
+		});
+	},
+	collectChildrenSortTree : function(records, rec, sortname, newDir,st, datefmt) {
+		return this.each(function(){
+			if(!this.grid || !this.p.treeGrid) {return;}
+			var i, len,
+			child, ch, query, children;
+			ch = $(this).jqGrid("getNodeChildren",rec);
+			query = $.jgrid.from(ch);
+			query.orderBy(sortname, newDir, st, datefmt);
+			children = query.select();
+			for (i = 0, len = children.length; i < len; i++) {
+				child = children[i];
+				records.push(child);
+				$(this).jqGrid("collectChildrenSortTree",records, child, sortname, newDir, st, datefmt); 
+			}
+		});
+	},
+	// experimental 
+	setTreeRow : function(rowid, data) {
+		var success=false;
+		this.each(function(){
+			var t = this;
+			if(!t.grid || !t.p.treeGrid) {return;}
+			success = $(t).jqGrid("setRowData",rowid,data);
+		});
+		return success;
+	},
+	delTreeNode : function (rowid) {
+		return this.each(function () {
+			var $t = this, rid = $t.p.localReader.id,
+			left = $t.p.treeReader.left_field,
+			right = $t.p.treeReader.right_field, myright, width, res, key;
+			if(!$t.grid || !$t.p.treeGrid) {return;}
+			var rc = $t.p._index[rowid];
+			if (rc !== undefined) {
+				// nested
+				myright = parseInt($t.p.data[rc][right],10);
+				width = myright -  parseInt($t.p.data[rc][left],10) + 1;
+				var dr = $($t).jqGrid("getFullTreeNode",$t.p.data[rc]);
+				if(dr.length>0){
+					for (var i=0;i<dr.length;i++){
+						$($t).jqGrid("delRowData",dr[i][rid]);
+					}
+				}
+				if( $t.p.treeGridModel === "nested") {
+					// ToDo - update grid data
+					res = $.jgrid.from($t.p.data)
+						.greater(left,myright,{stype:'integer'})
+						.select();
+					if(res.length) {
+						for( key in res) {
+							res[key][left] = parseInt(res[key][left],10) - width ;
+			}
+					}
+					res = $.jgrid.from($t.p.data)
+						.greater(right,myright,{stype:'integer'})
+						.select();
+					if(res.length) {
+						for( key in res) {
+							res[key][right] = parseInt(res[key][right],10) - width ;
+						}
+					}
+				}
+			}
+		});
+	},
+	addChildNode : function( nodeid, parentid, data ) {
+		//return this.each(function(){
+		var $t = this[0];
+		if(data) {
+			// we suppose tha the id is autoincremet and
+			var expanded = $t.p.treeReader.expanded_field,
+			isLeaf = $t.p.treeReader.leaf_field,
+			level = $t.p.treeReader.level_field,
+			icon = $t.p.treeReader.icon_field,
+			parent = $t.p.treeReader.parent_id_field,
+			left = $t.p.treeReader.left_field,
+			right = $t.p.treeReader.right_field,
+			loaded = $t.p.treeReader.loaded,
+			method, parentindex, parentdata, parentlevel, i, len, max=0, rowind = parentid, leaf, maxright;
+
+			if ( !nodeid ) {
+				i = $t.p.data.length-1;
+				if(	i>= 0 ) {
+					while(i>=0){max = Math.max(max, parseInt($t.p.data[i][$t.p.localReader.id],10)); i--;}
+				}
+				nodeid = max+1;
+			}
+			var prow = $($t).jqGrid('getInd', parentid);
+				leaf = false;
+				// if not a parent we assume root
+				if ( parentid === undefined  || parentid === null || parentid==="") {
+					parentid = null;
+					rowind = null;
+					method = 'last';
+					parentlevel = $t.p.tree_root_level;
+					i = $t.p.data.length+1;
+				} else {
+					method = 'after';
+					parentindex = $t.p._index[parentid];
+					parentdata = $t.p.data[parentindex];
+					parentid = parentdata[$t.p.localReader.id];
+					parentlevel = parseInt(parentdata[level],10)+1;
+					var childs = $($t).jqGrid('getFullTreeNode', parentdata);
+					// if there are child nodes get the last index of it
+					if(childs.length) {
+						i = childs[childs.length-1][$t.p.localReader.id];
+						rowind = i;
+						i = $($t).jqGrid('getInd',rowind)+1;
+					} else {
+						i = $($t).jqGrid('getInd', parentid)+1;
+					}
+					// if the node is leaf
+					if(parentdata[isLeaf]) {
+						leaf = true;
+						parentdata[expanded] = true;
+						//var prow = $($t).jqGrid('getInd', parentid);
+						$($t.rows[prow])
+							.find("span.cell-wrapperleaf").removeClass("cell-wrapperleaf").addClass("cell-wrapper")
+							.end()
+							.find("div.tree-leaf").removeClass($t.p.treeIcons.leaf+" tree-leaf").addClass($t.p.treeIcons.minus+" tree-minus");
+						$t.p.data[parentindex][isLeaf] = false;
+						parentdata[loaded] = true;
+					}
+				}
+				len = i+1;
+
+			data[expanded] = false;
+			data[loaded] = true;
+			data[level] = parentlevel;
+			data[isLeaf] = true;
+			if( $t.p.treeGridModel === "adjacency") {
+				data[parent] = parentid;
+			}
+			if( $t.p.treeGridModel === "nested") {
+				// this method requiere more attention
+				var query, res, key;
+				//maxright = parseInt(maxright,10);
+				// ToDo - update grid data
+				if(parentid !== null) {
+					maxright = parseInt(parentdata[right],10);
+					query = $.jgrid.from($t.p.data);
+					query = query.greaterOrEquals(right,maxright,{stype:'integer'});
+					res = query.select();
+					if(res.length) {
+						for( key in res) {
+							res[key][left] = res[key][left] > maxright ? parseInt(res[key][left],10) +2 : res[key][left];
+							res[key][right] = res[key][right] >= maxright ? parseInt(res[key][right],10) +2 : res[key][right];
+						}
+					}
+					data[left] = maxright;
+					data[right]= maxright+1;
+				} else {
+					maxright = parseInt( $($t).jqGrid('getCol', right, false, 'max'), 10);
+					res = $.jgrid.from($t.p.data)
+						.greater(left,maxright,{stype:'integer'})
+						.select();
+					if(res.length) {
+						for( key in res) {
+							res[key][left] = parseInt(res[key][left],10) +2 ;
+						}
+					}
+					res = $.jgrid.from($t.p.data)
+						.greater(right,maxright,{stype:'integer'})
+						.select();
+					if(res.length) {
+						for( key in res) {
+							res[key][right] = parseInt(res[key][right],10) +2 ;
+						}
+					}
+					data[left] = maxright+1;
+					data[right] = maxright + 2;
+				}
+			}
+			if( parentid === null || $($t).jqGrid("isNodeLoaded",parentdata) || leaf ) {
+					$($t).jqGrid('addRowData', nodeid, data, method, rowind);
+					$($t).jqGrid('setTreeNode', i, len);
+			}
+			if(parentdata && !parentdata[expanded]) {
+				$($t.rows[prow])
+					.find("div.treeclick")
+					.click();
+			}
+		}
+		//});
+	}
+});
 })(jQuery);
\ No newline at end of file
Index: controlies/trunk/applications/controlies/static/js/jdgrid/src/JsonXml.js
===================================================================
--- controlies/trunk/applications/controlies/static/js/jdgrid/src/JsonXml.js	(revision 240)
+++ controlies/trunk/applications/controlies/static/js/jdgrid/src/JsonXml.js	(revision 241)
@@ -1,330 +1,339 @@
-/*
-	The below work is licensed under Creative Commons GNU LGPL License.
-
-	Original work:
-
-	License:     http://creativecommons.org/licenses/LGPL/2.1/
-	Author:      Stefan Goessner/2006
-	Web:         http://goessner.net/ 
-
-	Modifications made:
-
-	Version:     0.9-p5
-	Description: Restructured code, JSLint validated (no strict whitespaces),
-	             added handling of empty arrays, empty strings, and int/floats values.
-	Author:      Michael Schøler/2008-01-29
-	Web:         http://michael.hinnerup.net/blog/2008/01/26/converting-json-to-xml-and-xml-to-json/
-	
-	Description: json2xml added support to convert functions as CDATA
-	             so it will be easy to write characters that cause some problems when convert
-	Author:      Tony Tomov
-*/
-
-/*global alert */
-var xmlJsonClass = {
-	// Param "xml": Element or document DOM node.
-	// Param "tab": Tab or indent string for pretty output formatting omit or use empty string "" to supress.
-	// Returns:     JSON string
-	xml2json: function(xml, tab) {
-		if (xml.nodeType === 9) {
-			// document node
-			xml = xml.documentElement;
-		}
-		var nws = this.removeWhite(xml);
-		var obj = this.toObj(nws);
-		var json = this.toJson(obj, xml.nodeName, "\t");
-		return "{\n" + tab + (tab ? json.replace(/\t/g, tab) : json.replace(/\t|\n/g, "")) + "\n}";
-	},
-
-	// Param "o":   JavaScript object
-	// Param "tab": tab or indent string for pretty output formatting omit or use empty string "" to supress.
-	// Returns:     XML string
-	json2xml: function(o, tab) {
-		var toXml = function(v, name, ind) {
-			var xml = "";
-			var i, n;
-			if (v instanceof Array) {
-				if (v.length === 0) {
-					xml += ind + "<"+name+">__EMPTY_ARRAY_</"+name+">\n";
-				}
-				else {
-					for (i = 0, n = v.length; i < n; i += 1) {
-						var sXml = ind + toXml(v[i], name, ind+"\t") + "\n";
-						xml += sXml;
-					}
-				}
-			}
-			else if (typeof(v) === "object") {
-				var hasChild = false;
-				xml += ind + "<" + name;
-				var m;
-				for (m in v) if (v.hasOwnProperty(m)) {
-					if (m.charAt(0) === "@") {
-						xml += " " + m.substr(1) + "=\"" + v[m].toString() + "\"";
-					}
-					else {
-						hasChild = true;
-					}
-				}
-				xml += hasChild ? ">" : "/>";
-				if (hasChild) {
-					for (m in v) if (v.hasOwnProperty(m)) {
-						if (m === "#text") {
-							xml += v[m];
-						}
-						else if (m === "#cdata") {
-							xml += "<![CDATA[" + v[m] + "]]>";
-						}
-						else if (m.charAt(0) !== "@") {
-							xml += toXml(v[m], m, ind+"\t");
-						}
-					}
-					xml += (xml.charAt(xml.length - 1) === "\n" ? ind : "") + "</" + name + ">";
-				}
-			}
-			else if (typeof(v) === "function") {
-				xml += ind + "<" + name + ">" + "<![CDATA[" + v + "]]>" + "</" + name + ">";
-			}
-			else {
-				if (v.toString() === "\"\"" || v.toString().length === 0) {
-					xml += ind + "<" + name + ">__EMPTY_STRING_</" + name + ">";
-				} 
-				else {
-					xml += ind + "<" + name + ">" + v.toString() + "</" + name + ">";
-				}
-			}
-			return xml;
-		};
-		var xml = "";
-		var m;
-		for (m in o) if (o.hasOwnProperty(m)) {
-			xml += toXml(o[m], m, "");
-		}
-		return tab ? xml.replace(/\t/g, tab) : xml.replace(/\t|\n/g, "");
-	},
-	// Internal methods
-	toObj: function(xml) {
-		var o = {};
-		var FuncTest = /function/i;
-		if (xml.nodeType === 1) {
-			// element node ..
-			if (xml.attributes.length) {
-				// element with attributes ..
-				var i;
-				for (i = 0; i < xml.attributes.length; i += 1) {
-					o["@" + xml.attributes[i].nodeName] = (xml.attributes[i].nodeValue || "").toString();
-				}
-			}
-			if (xml.firstChild) {
-				// element has child nodes ..
-				var textChild = 0, cdataChild = 0, hasElementChild = false;
-				var n;
-				for (n = xml.firstChild; n; n = n.nextSibling) {
-					if (n.nodeType === 1) {
-						hasElementChild = true;
-					}
-					else if (n.nodeType === 3 && n.nodeValue.match(/[^ \f\n\r\t\v]/)) {
-						// non-whitespace text
-						textChild += 1;
-					}
-					else if (n.nodeType === 4) {
-						// cdata section node
-						cdataChild += 1;
-					}
-				}
-				if (hasElementChild) {
-					if (textChild < 2 && cdataChild < 2) {
-						// structured element with evtl. a single text or/and cdata node ..
-						this.removeWhite(xml);
-						for (n = xml.firstChild; n; n = n.nextSibling) {
-							if (n.nodeType === 3) {
-								// text node
-								o["#text"] = this.escape(n.nodeValue);
-							}
-							else if (n.nodeType === 4) {
-								// cdata node
-								if (FuncTest.test(n.nodeValue)) {
-									o[n.nodeName] = [o[n.nodeName], n.nodeValue];
-								} else {
-									o["#cdata"] = this.escape(n.nodeValue);
-								}
-							}
-							else if (o[n.nodeName]) {
-								// multiple occurence of element ..
-								if (o[n.nodeName] instanceof Array) {
-									o[n.nodeName][o[n.nodeName].length] = this.toObj(n);
-								}
-								else {
-									o[n.nodeName] = [o[n.nodeName], this.toObj(n)];
-								}
-							}
-							else {
-								// first occurence of element ..
-								o[n.nodeName] = this.toObj(n);
-							}
-						}
-					}
-					else {
-						// mixed content
-						if (!xml.attributes.length) {
-							o = this.escape(this.innerXml(xml));
-						}
-						else {
-							o["#text"] = this.escape(this.innerXml(xml));
-						}
-					}
-				}
-				else if (textChild) {
-					// pure text
-					if (!xml.attributes.length) {
-						o = this.escape(this.innerXml(xml));
-						if (o === "__EMPTY_ARRAY_") {
-							o = "[]";
-						} else if (o === "__EMPTY_STRING_") {
-							o = "";
-						}
-					}
-					else {
-						o["#text"] = this.escape(this.innerXml(xml));
-					}
-				}
-				else if (cdataChild) {
-					// cdata
-					if (cdataChild > 1) {
-						o = this.escape(this.innerXml(xml));
-					}
-					else {
-						for (n = xml.firstChild; n; n = n.nextSibling) {
-							if(FuncTest.test(xml.firstChild.nodeValue)) {
-								o = xml.firstChild.nodeValue;
-								break;
-							} else {
-								o["#cdata"] = this.escape(n.nodeValue);
-							}
-						}
-					}
-				}
-			}
-			if (!xml.attributes.length && !xml.firstChild) {
-				o = null;
-			}
-		}
-		else if (xml.nodeType === 9) {
-			// document.node
-			o = this.toObj(xml.documentElement);
-		}
-		else {
-			alert("unhandled node type: " + xml.nodeType);
-		}
-		return o;
-	},
-	toJson: function(o, name, ind) {
-		var json = name ? ("\"" + name + "\"") : "";
-		if (o === "[]") {
-			json += (name ? ":[]" : "[]");
-		}
-		else if (o instanceof Array) {
-			var n, i, ar=[];
-			for (i = 0, n = o.length; i < n; i += 1) {
-				ar[i] = this.toJson(o[i], "", ind + "\t");
-			}
-			json += (name ? ":[" : "[") + (ar.length > 1 ? ("\n" + ind + "\t" + ar.join(",\n" + ind + "\t") + "\n" + ind) : ar.join("")) + "]";
-		}
-		else if (o === null) {
-			json += (name && ":") + "null";
-		}
-		else if (typeof(o) === "object") {
-			var arr = [];
-			var m;
-			for (m in o) if (o.hasOwnProperty(m)) {
-				arr[arr.length] = this.toJson(o[m], m, ind + "\t");
-			}
-			json += (name ? ":{" : "{") + (arr.length > 1 ? ("\n" + ind + "\t" + arr.join(",\n" + ind + "\t") + "\n" + ind) : arr.join("")) + "}";
-		}
-		else if (typeof(o) === "string") {
-			var objRegExp  = /(^-?\d+\.?\d*$)/;
-			var FuncTest = /function/i;
-			var os = o.toString();
-			if (objRegExp.test(os) || FuncTest.test(os) || os==="false" || os==="true") {
-				// int or float
-				json += (name && ":") + os;
-			} 
-			else {
-				json += (name && ":") + "\"" + o + "\"";
-			}
-		}
-		else {
-			json += (name && ":") + o.toString();
-		}
-		return json;
-	},
-	innerXml: function(node) {
-		var s = "";
-		if ("innerHTML" in node) {
-			s = node.innerHTML;
-		}
-		else {
-			var asXml = function(n) {
-				var s = "", i;
-				if (n.nodeType === 1) {
-					s += "<" + n.nodeName;
-					for (i = 0; i < n.attributes.length; i += 1) {
-						s += " " + n.attributes[i].nodeName + "=\"" + (n.attributes[i].nodeValue || "").toString() + "\"";
-					}
-					if (n.firstChild) {
-						s += ">";
-						for (var c = n.firstChild; c; c = c.nextSibling) {
-							s += asXml(c);
-						}
-						s += "</" + n.nodeName + ">";
-					}
-					else {
-						s += "/>";
-					}
-				}
-				else if (n.nodeType === 3) {
-					s += n.nodeValue;
-				}
-				else if (n.nodeType === 4) {
-					s += "<![CDATA[" + n.nodeValue + "]]>";
-				}
-				return s;
-			};
-			for (var c = node.firstChild; c; c = c.nextSibling) {
-				s += asXml(c);
-			}
-		}
-		return s;
-	},
-	escape: function(txt) {
-		return txt.replace(/[\\]/g, "\\\\").replace(/[\"]/g, '\\"').replace(/[\n]/g, '\\n').replace(/[\r]/g, '\\r');
-	},
-	removeWhite: function(e) {
-		e.normalize();
-		var n;
-		for (n = e.firstChild; n; ) {
-			if (n.nodeType === 3) {
-				// text node
-				if (!n.nodeValue.match(/[^ \f\n\r\t\v]/)) {
-					// pure whitespace text node
-					var nxt = n.nextSibling;
-					e.removeChild(n);
-					n = nxt;
-				}
-				else {
-					n = n.nextSibling;
-				}
-			}
-			else if (n.nodeType === 1) {
-				// element node
-				this.removeWhite(n);
-				n = n.nextSibling;
-			}
-			else {
-				// any other node
-				n = n.nextSibling;
-			}
-		}
-		return e;
-	}
+/*
+	The below work is licensed under Creative Commons GNU LGPL License.
+
+	Original work:
+
+	License:     http://creativecommons.org/licenses/LGPL/2.1/
+	Author:      Stefan Goessner/2006
+	Web:         http://goessner.net/ 
+
+	Modifications made:
+
+	Version:     0.9-p5
+	Description: Restructured code, JSLint validated (no strict whitespaces),
+	             added handling of empty arrays, empty strings, and int/floats values.
+	Author:      Michael Schøler/2008-01-29
+	Web:         http://michael.hinnerup.net/blog/2008/01/26/converting-json-to-xml-and-xml-to-json/
+	
+	Description: json2xml added support to convert functions as CDATA
+	             so it will be easy to write characters that cause some problems when convert
+	Author:      Tony Tomov
+*/
+
+/*global alert */
+var xmlJsonClass = {
+	// Param "xml": Element or document DOM node.
+	// Param "tab": Tab or indent string for pretty output formatting omit or use empty string "" to supress.
+	// Returns:     JSON string
+	xml2json: function(xml, tab) {
+		if (xml.nodeType === 9) {
+			// document node
+			xml = xml.documentElement;
+		}
+		var nws = this.removeWhite(xml);
+		var obj = this.toObj(nws);
+		var json = this.toJson(obj, xml.nodeName, "\t");
+		return "{\n" + tab + (tab ? json.replace(/\t/g, tab) : json.replace(/\t|\n/g, "")) + "\n}";
+	},
+
+	// Param "o":   JavaScript object
+	// Param "tab": tab or indent string for pretty output formatting omit or use empty string "" to supress.
+	// Returns:     XML string
+	json2xml: function(o, tab) {
+		var toXml = function(v, name, ind) {
+			var xml = "";
+			var i, n;
+			if (v instanceof Array) {
+				if (v.length === 0) {
+					xml += ind + "<"+name+">__EMPTY_ARRAY_</"+name+">\n";
+				}
+				else {
+					for (i = 0, n = v.length; i < n; i += 1) {
+						var sXml = ind + toXml(v[i], name, ind+"\t") + "\n";
+						xml += sXml;
+					}
+				}
+			}
+			else if (typeof(v) === "object") {
+				var hasChild = false;
+				xml += ind + "<" + name;
+				var m;
+				for (m in v) if (v.hasOwnProperty(m)) {
+					if (m.charAt(0) === "@") {
+						xml += " " + m.substr(1) + "=\"" + v[m].toString() + "\"";
+					}
+					else {
+						hasChild = true;
+					}
+				}
+				xml += hasChild ? ">" : "/>";
+				if (hasChild) {
+					for (m in v) if (v.hasOwnProperty(m)) {
+						if (m === "#text") {
+							xml += v[m];
+						}
+						else if (m === "#cdata") {
+							xml += "<![CDATA[" + v[m] + "]]>";
+						}
+						else if (m.charAt(0) !== "@") {
+							xml += toXml(v[m], m, ind+"\t");
+						}
+					}
+					xml += (xml.charAt(xml.length - 1) === "\n" ? ind : "") + "</" + name + ">";
+				}
+			}
+			else if (typeof(v) === "function") {
+				xml += ind + "<" + name + ">" + "<![CDATA[" + v + "]]>" + "</" + name + ">";
+			}
+			else {
+				if (v === undefined ) { v = ""; }
+				if (v.toString() === "\"\"" || v.toString().length === 0) {
+					xml += ind + "<" + name + ">__EMPTY_STRING_</" + name + ">";
+				} 
+				else {
+					xml += ind + "<" + name + ">" + v.toString() + "</" + name + ">";
+				}
+			}
+			return xml;
+		};
+		var xml = "";
+		var m;
+		for (m in o) if (o.hasOwnProperty(m)) {
+			xml += toXml(o[m], m, "");
+		}
+		return tab ? xml.replace(/\t/g, tab) : xml.replace(/\t|\n/g, "");
+	},
+	// Internal methods
+	toObj: function(xml) {
+		var o = {};
+		var FuncTest = /function/i;
+		if (xml.nodeType === 1) {
+			// element node ..
+			if (xml.attributes.length) {
+				// element with attributes ..
+				var i;
+				for (i = 0; i < xml.attributes.length; i += 1) {
+					o["@" + xml.attributes[i].nodeName] = (xml.attributes[i].nodeValue || "").toString();
+				}
+			}
+			if (xml.firstChild) {
+				// element has child nodes ..
+				var textChild = 0, cdataChild = 0, hasElementChild = false;
+				var n;
+				for (n = xml.firstChild; n; n = n.nextSibling) {
+					if (n.nodeType === 1) {
+						hasElementChild = true;
+					}
+					else if (n.nodeType === 3 && n.nodeValue.match(/[^ \f\n\r\t\v]/)) {
+						// non-whitespace text
+						textChild += 1;
+					}
+					else if (n.nodeType === 4) {
+						// cdata section node
+						cdataChild += 1;
+					}
+				}
+				if (hasElementChild) {
+					if (textChild < 2 && cdataChild < 2) {
+						// structured element with evtl. a single text or/and cdata node ..
+						this.removeWhite(xml);
+						for (n = xml.firstChild; n; n = n.nextSibling) {
+							if (n.nodeType === 3) {
+								// text node
+								o["#text"] = this.escape(n.nodeValue);
+							}
+							else if (n.nodeType === 4) {
+								// cdata node
+								if (FuncTest.test(n.nodeValue)) {
+									o[n.nodeName] = [o[n.nodeName], n.nodeValue];
+								} else {
+									o["#cdata"] = this.escape(n.nodeValue);
+								}
+							}
+							else if (o[n.nodeName]) {
+								// multiple occurence of element ..
+								if (o[n.nodeName] instanceof Array) {
+									o[n.nodeName][o[n.nodeName].length] = this.toObj(n);
+								}
+								else {
+									o[n.nodeName] = [o[n.nodeName], this.toObj(n)];
+								}
+							}
+							else {
+								// first occurence of element ..
+								o[n.nodeName] = this.toObj(n);
+							}
+						}
+					}
+					else {
+						// mixed content
+						if (!xml.attributes.length) {
+							o = this.escape(this.innerXml(xml));
+						}
+						else {
+							o["#text"] = this.escape(this.innerXml(xml));
+						}
+					}
+				}
+				else if (textChild) {
+					// pure text
+					if (!xml.attributes.length) {
+						o = this.escape(this.innerXml(xml));
+						if (o === "__EMPTY_ARRAY_") {
+							o = "[]";
+						} else if (o === "__EMPTY_STRING_") {
+							o = "";
+						}
+					}
+					else {
+						o["#text"] = this.escape(this.innerXml(xml));
+					}
+				}
+				else if (cdataChild) {
+					// cdata
+					if (cdataChild > 1) {
+						o = this.escape(this.innerXml(xml));
+					}
+					else {
+						for (n = xml.firstChild; n; n = n.nextSibling) {
+							if(FuncTest.test(xml.firstChild.nodeValue)) {
+								o = xml.firstChild.nodeValue;
+								break;
+							} else {
+								o["#cdata"] = this.escape(n.nodeValue);
+							}
+						}
+					}
+				}
+			}
+			if (!xml.attributes.length && !xml.firstChild) {
+				o = null;
+			}
+		}
+		else if (xml.nodeType === 9) {
+			// document.node
+			o = this.toObj(xml.documentElement);
+		}
+		else {
+			alert("unhandled node type: " + xml.nodeType);
+		}
+		return o;
+	},
+	toJson: function(o, name, ind, wellform) {
+		if(wellform === undefined) wellform = true;
+		var json = name ? ("\"" + name + "\"") : "", tab = "\t", newline = "\n";
+		if(!wellform) {
+			tab= ""; newline= "";
+		}
+
+		if (o === "[]") {
+			json += (name ? ":[]" : "[]");
+		}
+		else if (o instanceof Array) {
+			var n, i, ar=[];
+			for (i = 0, n = o.length; i < n; i += 1) {
+				ar[i] = this.toJson(o[i], "", ind + tab, wellform);
+			}
+			json += (name ? ":[" : "[") + (ar.length > 1 ? (newline + ind + tab + ar.join(","+newline + ind + tab) + newline + ind) : ar.join("")) + "]";
+		}
+		else if (o === null) {
+			json += (name && ":") + "null";
+		}
+		else if (typeof(o) === "object") {
+			var arr = [], m;
+			for (m in o) {
+				if (o.hasOwnProperty(m)) {
+					arr[arr.length] = this.toJson(o[m], m, ind + tab, wellform);
+			}
+		}
+			json += (name ? ":{" : "{") + (arr.length > 1 ? (newline + ind + tab + arr.join(","+newline + ind + tab) + newline + ind) : arr.join("")) + "}";
+		}
+		else if (typeof(o) === "string") {
+			/*
+			var objRegExp  = /(^-?\d+\.?\d*$)/;
+			var FuncTest = /function/i;
+			var os = o.toString();
+			if (objRegExp.test(os) || FuncTest.test(os) || os==="false" || os==="true") {
+				// int or float
+				json += (name && ":")  + "\"" +os + "\"";
+			} 
+			else {
+			*/
+				json += (name && ":") + "\"" + o.replace(/\\/g,'\\\\').replace(/\"/g,'\\"') + "\"";
+			//}
+			}
+		else {
+			json += (name && ":") +  "\"" + o.toString()+ "\"";
+		}
+		return json;
+	},
+	innerXml: function(node) {
+		var s = "";
+		if ("innerHTML" in node) {
+			s = node.innerHTML;
+		}
+		else {
+			var asXml = function(n) {
+				var s = "", i;
+				if (n.nodeType === 1) {
+					s += "<" + n.nodeName;
+					for (i = 0; i < n.attributes.length; i += 1) {
+						s += " " + n.attributes[i].nodeName + "=\"" + (n.attributes[i].nodeValue || "").toString() + "\"";
+					}
+					if (n.firstChild) {
+						s += ">";
+						for (var c = n.firstChild; c; c = c.nextSibling) {
+							s += asXml(c);
+						}
+						s += "</" + n.nodeName + ">";
+					}
+					else {
+						s += "/>";
+					}
+				}
+				else if (n.nodeType === 3) {
+					s += n.nodeValue;
+				}
+				else if (n.nodeType === 4) {
+					s += "<![CDATA[" + n.nodeValue + "]]>";
+				}
+				return s;
+			};
+			for (var c = node.firstChild; c; c = c.nextSibling) {
+				s += asXml(c);
+			}
+		}
+		return s;
+	},
+	escape: function(txt) {
+		return txt.replace(/[\\]/g, "\\\\").replace(/[\"]/g, '\\"').replace(/[\n]/g, '\\n').replace(/[\r]/g, '\\r');
+	},
+	removeWhite: function(e) {
+		e.normalize();
+		var n;
+		for (n = e.firstChild; n; ) {
+			if (n.nodeType === 3) {
+				// text node
+				if (!n.nodeValue.match(/[^ \f\n\r\t\v]/)) {
+					// pure whitespace text node
+					var nxt = n.nextSibling;
+					e.removeChild(n);
+					n = nxt;
+				}
+				else {
+					n = n.nextSibling;
+				}
+			}
+			else if (n.nodeType === 1) {
+				// element node
+				this.removeWhite(n);
+				n = n.nextSibling;
+			}
+			else {
+				// any other node
+				n = n.nextSibling;
+			}
+		}
+		return e;
+	}
 };
\ No newline at end of file
Index: controlies/trunk/applications/controlies/static/js/jdgrid/src/grid.loader.js
===================================================================
--- controlies/trunk/applications/controlies/static/js/jdgrid/src/grid.loader.js	(revision 240)
+++ controlies/trunk/applications/controlies/static/js/jdgrid/src/grid.loader.js	(revision 241)
@@ -1,4 +1,4 @@
-// This file should be used if you want to debug
+//This file should be used if you want to debug and develop
 function jqGridInclude()
 {
     var pathtojsfiles = "js/"; // need to be ajusted
@@ -12,36 +12,39 @@
         { include: true, incfile:'grid.celledit.js'}, // jqGrid cell editing
         { include: true, incfile:'grid.subgrid.js'}, //jqGrid subgrid
         { include: true, incfile:'grid.treegrid.js'}, //jqGrid treegrid
+	{ include: true, incfile:'grid.grouping.js'}, //jqGrid grouping
         { include: true, incfile:'grid.custom.js'}, //jqGrid custom 
-        { include: true, incfile:'grid.postext.js'}, //jqGrid postext
         { include: true, incfile:'grid.tbltogrid.js'}, //jqGrid table to grid 
-        { include: true, incfile:'grid.setcolumns.js'}, //jqGrid setcolumns
         { include: true, incfile:'grid.import.js'}, //jqGrid import
         { include: true, incfile:'jquery.fmatter.js'}, //jqGrid formater
         { include: true, incfile:'JsonXml.js'}, //xmljson utils
-        { include: true, incfile:'jquery.searchFilter.js'} // search Plugin
+        { include: true, incfile:'grid.jqueryui.js'}, //jQuery UI utils
+        { include: true, incfile:'grid.filter.js'} // filter Plugin
     ];
     var filename;
     for(var i=0;i<modules.length; i++)
     {
         if(modules[i].include === true) {
-        	
         	filename = pathtojsfiles+modules[i].incfile;
-       		if(jQuery.browser.safari) {
-       			jQuery.ajax({url:filename,dataType:'script', async:false, cache: true});
-       		} else {
-       			IncludeJavaScript(filename);
-       		}
-        }
+			if(jQuery.browser.safari) {
+				jQuery.ajax({url:filename,dataType:'script', async:false, cache: true});
+			} else {
+				if (jQuery.browser.msie) {
+					document.write('<script charset="utf-8" type="text/javascript" src="'+filename+'"></script>');
+				} else {
+					IncludeJavaScript(filename);
+				}
+			}
+		}
     }
-    function IncludeJavaScript(jsFile)
+	function IncludeJavaScript(jsFile)
     {
         var oHead = document.getElementsByTagName('head')[0];
         var oScript = document.createElement('script');
-        oScript.type = 'text/javascript';
-        oScript.charset = 'utf-8';
-        oScript.src = jsFile;
-        oHead.appendChild(oScript);        
-    };
-};
-jqGridInclude();
\ No newline at end of file
+        oScript.setAttribute('type', 'text/javascript');
+        oScript.setAttribute('language', 'javascript');
+        oScript.setAttribute('src', jsFile);
+        oHead.appendChild(oScript);
+    }
+}
+jqGridInclude();
Index: controlies/trunk/applications/controlies/static/js/jdgrid/src/grid.formedit.js
===================================================================
--- controlies/trunk/applications/controlies/static/js/jdgrid/src/grid.formedit.js	(revision 240)
+++ controlies/trunk/applications/controlies/static/js/jdgrid/src/grid.formedit.js	(revision 241)
@@ -1,1869 +1,2016 @@
-;(function($){
-/**
- * jqGrid extension for form editing Grid Data
- * Tony Tomov tony@trirand.com
- * http://trirand.com/blog/ 
- * Dual licensed under the MIT and GPL licenses:
- * http://www.opensource.org/licenses/mit-license.php
- * http://www.gnu.org/licenses/gpl-2.0.html
-**/
-var rp_ge = null;
-$.jgrid.extend({
-	searchGrid : function (p) {
-		p = $.extend({
-			recreateFilter: false,
-			drag: true,
-			sField:'searchField',
-			sValue:'searchString',
-			sOper: 'searchOper',
-			sFilter: 'filters',
-            loadDefaults: true, // this options activates loading of default filters from grid's postData for Multipe Search only.
-			beforeShowSearch: null,
-			afterShowSearch : null,
-			onInitializeSearch: null,
-			closeAfterSearch : false,
-			closeAfterReset: false,
-			closeOnEscape : false,
-			multipleSearch : false,
-			cloneSearchRowOnAdd: true,
-			// translation
-			// if you want to change or remove the order change it in sopt
-			// ['bw','eq','ne','lt','le','gt','ge','ew','cn']
-			sopt: null,
-			// Note: stringResult is intentionally declared "undefined by default".
-			//  you are velcome to define stringResult expressly in the options you pass to searchGrid()
-			//  stringResult is a "safeguard" measure to insure we post sensible data when communicated as form-encoded
-			//  see http://github.com/tonytomov/jqGrid/issues/#issue/36
-			//
-			//  If this value is not expressly defined in the incoming options,
-			// lower in the code we will infer the value based on value of multipleSearch
-			stringResult: undefined,
-			onClose : null,
-			// useDataProxy allows ADD, EDIT and DEL code to bypass calling $.ajax
-			// directly when grid's 'dataProxy' property (grid.p.dataProxy) is a function.
-			// Used for "editGridRow" and "delGridRow" below and automatically flipped to TRUE
-			// when ajax setting's 'url' (grid's 'editurl') property is undefined.
-			// When 'useDataProxy' is true, instead of calling $.ajax.call(gridDOMobj, o, i) we call
-			// gridDOMobj.p.dataProxy.call(gridDOMobj, o, i)
-			//
-			// Behavior is extremely similar to when 'datatype' is a function, but arguments are slightly different.
-			// Normally the following is fed to datatype.call(a, b, c):
-			//   a = Pointer to grid's table DOM element, b = grid.p.postdata, c = "load_"+grid's ID
-			// In cases of "edit" and "del" the following is fed:
-			//   a = Pointer to grid's table DOM element (same),
-			//   b = extended Ajax Options including postdata in "data" property. (different object type)
-			//   c = "set_"+grid's ID in case of "edit" and "del_"+grid's ID in case of "del" (same type, different content)
-			// The major difference is that complete ajax options object, with attached "complete" and "error"
-			// callback functions is fed instead of only post data.
-			// This allows you to emulate a $.ajax call (including calling "complete"/"error"),
-			// while retrieving the data locally in the browser.
-			useDataProxy: false,
-			overlay : true
-		}, $.jgrid.search, p || {});
-		return this.each(function() {
-			var $t = this;
-			if(!$t.grid) {return;}
-            function applyDefaultFilters(gridDOMobj, filterSettings) {
-				/*
-                gridDOMobj = ointer to grid DOM object ( $(#list)[0] )
-                What we need from gridDOMobj:
-                gridDOMobj.SearchFilter is the pointer to the Search box, once it's created.
-                gridDOMobj.p.postData - dictionary of post settings. These can be overriden at grid creation to
-                contain default filter settings. We will parse these and will populate the search with defaults.
-                filterSettings - same settings object you (would) pass to $().jqGrid('searchGrid', filterSettings);
-                */
-
-                // Pulling default filter settings out of postData property of grid's properties.:
-                var defaultFilters = gridDOMobj.p.postData[filterSettings.sFilter];
-                // example of what we might get: {"groupOp":"and","rules":[{"field":"amount","op":"eq","data":"100"}]}
-				// suppose we have imported this with grid import, the this is a string.
-				if(typeof(defaultFilters) == "string") {
-					defaultFilters = $.jgrid.parse(defaultFilters);
-				}
-                if (defaultFilters) {
-                    if (defaultFilters.groupOp) {
-                        gridDOMobj.SearchFilter.setGroupOp(defaultFilters.groupOp);
-                    }
-                    if (defaultFilters.rules) {
-                        var f
-							, i = 0
-							, li = defaultFilters.rules.length
-							, success = false;
-                        for (; i < li; i++) {
-                            f = defaultFilters.rules[i];
-                            // we are not trying to counter all issues with filter declaration here. Just the basics to avoid lookup exceptions.
-                            if (f.field !== undefined && f.op !== undefined && f.data !== undefined) {
-                                success = gridDOMobj.SearchFilter.setFilter({
-                                    'sfref':gridDOMobj.SearchFilter.$.find(".sf:last"),
-                                    'filter':$.extend({},f)
-                                });
-								if (success) { gridDOMobj.SearchFilter.add(); }
-                            }
-                        }
-                    }
-				}
-            } // end of applyDefaultFilters
-			
-			if($.fn.searchFilter) {
-				var fid = "fbox_"+$t.p.id;
-				if(p.recreateFilter===true) {$("#"+fid).remove();}
-				if( $("#"+fid).html() != null ) {
-					if ( $.isFunction(p.beforeShowSearch) ) { p.beforeShowSearch($("#"+fid)); }
-					showFilter();
-					if( $.isFunction(p.afterShowSearch) ) { p.afterShowSearch($("#"+fid)); }
-				} else {
-					var fields = [],
-					colNames = $("#"+$t.p.id).jqGrid("getGridParam","colNames"),
-					colModel = $("#"+$t.p.id).jqGrid("getGridParam","colModel"),
-					stempl = ['eq','ne','lt','le','gt','ge','bw','bn','in','ni','ew','en','cn','nc'],
-					j,pos,k,oprtr=[];
-					if (p.sopt !==null) {
-						k=0;
-						for(j=0;j<p.sopt.length;j++) {
-							if( (pos= $.inArray(p.sopt[j],stempl)) != -1 ){
-								oprtr[k] = {op:p.sopt[j],text: p.odata[pos]};
-								k++;
-							}
-						}
-					} else {
-						for(j=0;j<stempl.length;j++) {
-							oprtr[j] = {op:stempl[j],text: p.odata[j]};
-						}
-					}
-					var searchable;
-				    $.each(colModel, function(i, v) {
-				        var searchable = (typeof v.search === 'undefined') ?  true: v.search ,
-				        hidden = (v.hidden === true),
-						soptions = $.extend({}, {text: colNames[i], itemval: v.index || v.name}, this.searchoptions),
-						ignoreHiding = (soptions.searchhidden === true);
-						if(typeof soptions.sopt !== 'undefined') { 
-							k=0;
-							soptions.ops =[];
-							if(soptions.sopt.length>0) {
-								for(j=0;j<soptions.sopt.length;j++) {
-									if( (pos= $.inArray(soptions.sopt[j],stempl)) != -1 ){
-										soptions.ops[k] = {op:soptions.sopt[j],text: p.odata[pos]};
-										k++;
-									}
-								}
-							}
-						}
-						if(typeof(this.stype) === 'undefined') { this.stype='text'; }
-						if(this.stype == 'select') {
-							if ( soptions.dataUrl !== undefined) {}
-							else {
-								var eov;
-								if(soptions.value) {
-									eov = soptions.value;
-								} else if(this.editoptions) {
-									eov = this.editoptions.value;
-								}
-								if(eov) {
-									soptions.dataValues =[];
-									if(typeof(eov) === 'string') {
-										var so = eov.split(";"),sv;
-										for(j=0;j<so.length;j++) {
-											sv = so[j].split(":");
-											soptions.dataValues[j] ={value:sv[0],text:sv[1]};
-										}
-									} else if (typeof(eov) === 'object') {
-										j=0;
-										for (var key in eov) {
-											if(eov.hasOwnProperty(key)) {
-												soptions.dataValues[j] ={value:key,text:eov[key]};
-												j++;
-											}
-										}
-									}
-								}
-							}
-						}
-				        if ((ignoreHiding && searchable) || (searchable && !hidden)) {
-							fields.push(soptions);
-						}
-					});
-					if(fields.length>0){
-						$("<div id='"+fid+"' role='dialog' tabindex='-1'></div>").insertBefore("#gview_"+$t.p.id);
-						// Before we create searchFilter we need to decide if we want to get back a string or a JS object.
-						//  see http://github.com/tonytomov/jqGrid/issues/#issue/36 for background on the issue.
-						// If p.stringResult is defined, it was explisitly passed to us by user. Honor the choice, whatever it is.
-						if (p.stringResult===undefined) {
-							// to provide backward compatibility, inferring stringResult value from multipleSearch
-							p.stringResult = p.multipleSearch;
-						}
-						// we preserve the return value here to retain access to .add() and other good methods of search form.
-						$t.SearchFilter = $("#"+fid).searchFilter(fields, { groupOps: p.groupOps, operators: oprtr, onClose:hideFilter, resetText: p.Reset, searchText: p.Find, windowTitle: p.caption,  rulesText:p.rulesText, matchText:p.matchText, onSearch: searchFilters, onReset: resetFilters,stringResult:p.stringResult, ajaxSelectOptions: $.extend({},$.jgrid.ajaxOptions,$t.p.ajaxSelectOptions ||{}), clone: p.cloneSearchRowOnAdd });
-						$(".ui-widget-overlay","#"+fid).remove();
-						if($t.p.direction=="rtl") { $(".ui-closer","#"+fid).css("float","left"); }
-						if (p.drag===true) {
-							$("#"+fid+" table thead tr:first td:first").css('cursor','move');
-							if(jQuery.fn.jqDrag) {
-								$("#"+fid).jqDrag($("#"+fid+" table thead tr:first td:first"));
-							} else {
-								try {
-									$("#"+fid).draggable({handle: $("#"+fid+" table thead tr:first td:first")});
-								} catch (e) {}
-							}
-						}
-						if(p.multipleSearch === false) {
-							$(".ui-del, .ui-add, .ui-del, .ui-add-last, .matchText, .rulesText", "#"+fid).hide();
-							$("select[name='groupOp']","#"+fid).hide();
-						}
-                        if (p.multipleSearch === true && p.loadDefaults === true) {
-                            applyDefaultFilters($t, p);
-                        }
-						if ( $.isFunction(p.onInitializeSearch) ) { p.onInitializeSearch( $("#"+fid) ); }
-						if ( $.isFunction(p.beforeShowSearch) ) { p.beforeShowSearch($("#"+fid)); }
-						showFilter();
-						if( $.isFunction(p.afterShowSearch) ) { p.afterShowSearch($("#"+fid)); }
-						if(p.closeOnEscape===true){
-							$("#"+fid).keydown( function( e ) {
-								if( e.which == 27 ) {
-									hideFilter($("#"+fid));
-								}
-							});
-						}
-					}
-				}
-			}
-			function searchFilters(filters) {
-				var hasFilters = (filters !== undefined),
-				grid = $("#"+$t.p.id), sdata={};
-				if(p.multipleSearch===false) {
-					sdata[p.sField] = filters.rules[0].field;
-					sdata[p.sValue] = filters.rules[0].data;
-					sdata[p.sOper] = filters.rules[0].op;
-				} else {
-					sdata[p.sFilter] = filters;
-				}
-				grid[0].p.search = hasFilters;
-				$.extend(grid[0].p.postData,sdata);
-				grid.trigger("reloadGrid",[{page:1}]);
-				if(p.closeAfterSearch) { hideFilter($("#"+fid)); }
-			}
-			function resetFilters(filters) {
-				var hasFilters = (filters !== undefined),
-				grid = $("#"+$t.p.id), sdata=[];
-				grid[0].p.search = hasFilters;
-				if(p.multipleSearch===false) {
-					sdata[p.sField] = sdata[p.sValue] = sdata[p.sOper] = "";
-				} else {
-					sdata[p.sFilter] = "";
-				}
-				$.extend(grid[0].p.postData,sdata);
-				grid.trigger("reloadGrid",[{page:1}]);
-				if(p.closeAfterReset) { hideFilter($("#"+fid)); }
-			}
-			function hideFilter(selector) {
-				if(p.onClose){
-					var fclm = p.onClose(selector);
-					if(typeof fclm == 'boolean' && !fclm) { return; }
-				}
-				selector.hide();
-				if(p.overlay === true) {
-					$(".jqgrid-overlay:first","#gbox_"+$t.p.id).hide();
-				}
-			}
-			function showFilter(){
-				var fl = $(".ui-searchFilter").length;
-				if(fl > 1) {
-					var zI = $("#"+fid).css("zIndex");
-					$("#"+fid).css({zIndex:parseInt(zI,10)+fl});
-				}
-				$("#"+fid).show();
-				if(p.overlay === true) {
-					$(".jqgrid-overlay:first","#gbox_"+$t.p.id).show();
-				}
-				try{$(':input:visible',"#"+fid)[0].focus();}catch(_){}
-			}
-		});
-	},
-	editGridRow : function(rowid, p){
-		p = $.extend({
-			top : 0,
-			left: 0,
-			width: 300,
-			height: 'auto',
-			dataheight: 'auto',
-			modal: false,
-			drag: true,
-			resize: true,
-			url: null,
-			mtype : "POST",
-			clearAfterAdd :true,
-			closeAfterEdit : false,
-			reloadAfterSubmit : true,
-			onInitializeForm: null,
-			beforeInitData: null,
-			beforeShowForm: null,
-			afterShowForm: null,
-			beforeSubmit: null,
-			afterSubmit: null,
-			onclickSubmit: null,
-			afterComplete: null,
-			onclickPgButtons : null,
-			afterclickPgButtons: null,
-			editData : {},
-			recreateForm : false,
-			jqModal : true,
-			closeOnEscape : false,
-			addedrow : "first",
-			topinfo : '',
-			bottominfo: '',
-			saveicon : [],
-			closeicon : [],
-			savekey: [false,13],
-			navkeys: [false,38,40],
-			checkOnSubmit : false,
-			checkOnUpdate : false,
-			_savedData : {},
-			processing : false,
-			onClose : null,
-			ajaxEditOptions : {},
-			serializeEditData : null,
-			viewPagerButtons : true
-		}, $.jgrid.edit, p || {});
-		rp_ge = p;
-		return this.each(function(){
-			var $t = this;
-			if (!$t.grid || !rowid) { return; }
-			var gID = $t.p.id,
-			frmgr = "FrmGrid_"+gID,frmtb = "TblGrid_"+gID,
-			IDs = {themodal:'editmod'+gID,modalhead:'edithd'+gID,modalcontent:'editcnt'+gID, scrollelm : frmgr},
-			onBeforeShow = $.isFunction(rp_ge.beforeShowForm) ? rp_ge.beforeShowForm : false,
-			onAfterShow = $.isFunction(rp_ge.afterShowForm) ? rp_ge.afterShowForm : false,
-			onBeforeInit = $.isFunction(rp_ge.beforeInitData) ? rp_ge.beforeInitData : false,
-			onInitializeForm = $.isFunction(rp_ge.onInitializeForm) ? rp_ge.onInitializeForm : false,
-			copydata = null,
-			maxCols = 1, maxRows=0,	gurl, postdata, ret, extpost, newData, diff;
-			if (rowid=="new") {
-				rowid = "_empty";
-				p.caption=p.addCaption;
-			} else {
-				p.caption=p.editCaption;
-			}
-			if(p.recreateForm===true && $("#"+IDs.themodal).html() != null) {
-				$("#"+IDs.themodal).remove();
-			}
-			var closeovrl = true;
-			if(p.checkOnUpdate && p.jqModal && !p.modal) {
-				closeovrl = false;
-			}
-			if ( $("#"+IDs.themodal).html() != null ) {
-				$(".ui-jqdialog-title","#"+IDs.modalhead).html(p.caption);
-				$("#FormError","#"+frmtb).hide();
-				if(rp_ge.topinfo) {
-					$(".topinfo","#"+frmtb+"_2").html(rp_ge.topinfo);
-					$(".tinfo","#"+frmtb+"_2").show();
-				} else {
-					$(".tinfo","#"+frmtb+"_2").hide();
-				}
-				if(rp_ge.bottominfo) {
-					$(".bottominfo","#"+frmtb+"_2").html(rp_ge.bottominfo);
-					$(".binfo","#"+frmtb+"_2").show();
-				} else {
-					$(".binfo","#"+frmtb+"_2").hide();
-				}
-				if(onBeforeInit) { onBeforeInit($("#"+frmgr)); }
-				// filldata
-				fillData(rowid,$t,frmgr);
-				///
-				if(rowid=="_empty" || !rp_ge.viewPagerButtons) {
-					$("#pData, #nData","#"+frmtb+"_2").hide();
-				} else { 
-					$("#pData, #nData","#"+frmtb+"_2").show();
-				}
-				if(rp_ge.processing===true) {
-					rp_ge.processing=false;
-					$("#sData", "#"+frmtb+"_2").removeClass('ui-state-active');
-				}
-				if($("#"+frmgr).data("disabled")===true) {
-					$(".confirm","#"+IDs.themodal).hide();
-					$("#"+frmgr).data("disabled",false);
-				}
-				if(onBeforeShow) { onBeforeShow($("#"+frmgr)); }
-				$("#"+IDs.themodal).data("onClose",rp_ge.onClose);
-				viewModal("#"+IDs.themodal,{gbox:"#gbox_"+gID,jqm:p.jqModal, jqM: false, closeoverlay: closeovrl, modal:p.modal});
-				if(!closeovrl) {
-					$(".jqmOverlay").click(function(){
-						if(!checkUpdates()) { return false; }
-						hideModal("#"+IDs.themodal,{gb:"#gbox_"+gID,jqm:p.jqModal, onClose: rp_ge.onClose});
-						return false;
-					});
-				}
-				if(onAfterShow) { onAfterShow($("#"+frmgr)); }
-			} else {
-				$($t.p.colModel).each( function(i) {
-					var fmto = this.formoptions;
-					maxCols = Math.max(maxCols, fmto ? fmto.colpos || 0 : 0 );
-					maxRows = Math.max(maxRows, fmto ? fmto.rowpos || 0 : 0 );
-				});
-				var dh = isNaN(p.dataheight) ? p.dataheight : p.dataheight+"px";
-				var flr, frm = $("<form name='FormPost' id='"+frmgr+"' class='FormGrid' onSubmit='return false;' style='width:100%;overflow:auto;position:relative;height:"+dh+";'></form>").data("disabled",false),
-				tbl =$("<table id='"+frmtb+"' class='EditTable' cellspacing='0' cellpading='0' border='0'><tbody></tbody></table>");
-				$(frm).append(tbl);
-				flr = $("<tr id='FormError' style='display:none'><td class='ui-state-error' colspan='"+(maxCols*2)+"'></td></tr>");
-				flr[0].rp = 0;
-				$(tbl).append(flr);
-				//topinfo
-				flr = $("<tr style='display:none' class='tinfo'><td class='topinfo' colspan='"+(maxCols*2)+"'>"+rp_ge.topinfo+"</td></tr>");
-				flr[0].rp = 0;
-				$(tbl).append(flr);
-				// set the id.
-				// use carefull only to change here colproperties.
-				if(onBeforeInit) { onBeforeInit($("#"+frmgr)); }
-				// create data
-				var rtlb = $t.p.direction == "rtl" ? true :false,
-				bp = rtlb ? "nData" : "pData",
-				bn = rtlb ? "pData" : "nData",
-				valref = createData(rowid,$t,tbl,maxCols),
-				// buttons at footer
-				bP = "<a href='javascript:void(0)' id='"+bp+"' class='fm-button ui-state-default ui-corner-left'><span class='ui-icon ui-icon-triangle-1-w'></span></div>",
-				bN = "<a href='javascript:void(0)' id='"+bn+"' class='fm-button ui-state-default ui-corner-right'><span class='ui-icon ui-icon-triangle-1-e'></span></div>",
-				bS  ="<a href='javascript:void(0)' id='sData' class='fm-button ui-state-default ui-corner-all'>"+p.bSubmit+"</a>",
-				bC  ="<a href='javascript:void(0)' id='cData' class='fm-button ui-state-default ui-corner-all'>"+p.bCancel+"</a>";
-				var bt = "<table border='0' class='EditTable' id='"+frmtb+"_2'><tbody><tr id='Act_Buttons'><td class='navButton ui-widget-content'>"+(rtlb ? bN+bP : bP+bN)+"</td><td class='EditButton ui-widget-content'>"+bS+bC+"</td></tr>";
-				bt += "<tr style='display:none' class='binfo'><td class='bottominfo' colspan='2'>"+rp_ge.bottominfo+"</td></tr>";
-				bt += "</tbody></table>";
-				if(maxRows >  0) {
-					var sd=[];
-					$.each($(tbl)[0].rows,function(i,r){
-						sd[i] = r;
-					});
-					sd.sort(function(a,b){
-						if(a.rp > b.rp) {return 1;}
-						if(a.rp < b.rp) {return -1;}
-						return 0;
-					});
-					$.each(sd, function(index, row) {
-						$('tbody',tbl).append(row);
-					});
-				}
-				p.gbox = "#gbox_"+gID;
-				var cle = false;
-				if(p.closeOnEscape===true){
-					p.closeOnEscape = false;
-					cle = true;
-				}
-				var tms = $("<span></span>").append(frm).append(bt);
-				createModal(IDs,tms,p,"#gview_"+$t.p.id,$("#gview_"+$t.p.id)[0]);
-				if(rtlb) {
-					$("#pData, #nData","#"+frmtb+"_2").css("float","right");
-					$(".EditButton","#"+frmtb+"_2").css("text-align","left");
-				}
-				if(rp_ge.topinfo) { $(".tinfo","#"+frmtb+"_2").show(); }
-				if(rp_ge.bottominfo) { $(".binfo","#"+frmtb+"_2").show(); } 
-				tms = null; bt=null;
-				$("#"+IDs.themodal).keydown( function( e ) {
-					var wkey = e.target;
-					if ($("#"+frmgr).data("disabled")===true ) { return false; }//??
-					if(rp_ge.savekey[0] === true && e.which == rp_ge.savekey[1]) { // save
-						if(wkey.tagName != "TEXTAREA") {
-							$("#sData", "#"+frmtb+"_2").trigger("click");
-							return false;
-						}
-					}
-					if(e.which === 27) {
-						if(!checkUpdates()) { return false; }
-						if(cle)	{ hideModal(this,{gb:p.gbox,jqm:p.jqModal, onClose: rp_ge.onClose}); }
-						return false;
-					}
-					if(rp_ge.navkeys[0]===true) {
-						if($("#id_g","#"+frmtb).val() == "_empty") { return true; }
-						if(e.which == rp_ge.navkeys[1]){ //up
-							$("#pData", "#"+frmtb+"_2").trigger("click");
-							return false;
-						}
-						if(e.which == rp_ge.navkeys[2]){ //down
-							$("#nData", "#"+frmtb+"_2").trigger("click");
-							return false;
-						}
-					}
-				});
-				if(p.checkOnUpdate) {
-					$("a.ui-jqdialog-titlebar-close span","#"+IDs.themodal).removeClass("jqmClose");
-					$("a.ui-jqdialog-titlebar-close","#"+IDs.themodal).unbind("click")
-					.click(function(){
-						if(!checkUpdates()) { return false; }
-						hideModal("#"+IDs.themodal,{gb:"#gbox_"+gID,jqm:p.jqModal,onClose: rp_ge.onClose});
-						return false;
-					});
-				}
-				p.saveicon = $.extend([true,"left","ui-icon-disk"],p.saveicon);
-				p.closeicon = $.extend([true,"left","ui-icon-close"],p.closeicon);
-				// beforeinitdata after creation of the form
-				if(p.saveicon[0]===true) {
-					$("#sData","#"+frmtb+"_2").addClass(p.saveicon[1] == "right" ? 'fm-button-icon-right' : 'fm-button-icon-left')
-					.append("<span class='ui-icon "+p.saveicon[2]+"'></span>");
-				}
-				if(p.closeicon[0]===true) {
-					$("#cData","#"+frmtb+"_2").addClass(p.closeicon[1] == "right" ? 'fm-button-icon-right' : 'fm-button-icon-left')
-					.append("<span class='ui-icon "+p.closeicon[2]+"'></span>");
-				}
-				if(rp_ge.checkOnSubmit || rp_ge.checkOnUpdate) {
-					bS  ="<a href='javascript:void(0)' id='sNew' class='fm-button ui-state-default ui-corner-all' style='z-index:1002'>"+p.bYes+"</a>";
-					bN  ="<a href='javascript:void(0)' id='nNew' class='fm-button ui-state-default ui-corner-all' style='z-index:1002'>"+p.bNo+"</a>";
-					bC  ="<a href='javascript:void(0)' id='cNew' class='fm-button ui-state-default ui-corner-all' style='z-index:1002'>"+p.bExit+"</a>";
-					var ii, zI = p.zIndex  || 999; zI ++;
-					if ($.browser.msie && $.browser.version ==6) {
-						ii = '<iframe style="display:block;position:absolute;z-index:-1;filter:Alpha(Opacity=\'0\');" src="javascript:false;"></iframe>';
-					} else { ii="";}
-					$("<div class='ui-widget-overlay jqgrid-overlay confirm' style='z-index:"+zI+";display:none;'>&#160;"+ii+"</div><div class='confirm ui-widget-content ui-jqconfirm' style='z-index:"+(zI+1)+"'>"+p.saveData+"<br/><br/>"+bS+bN+bC+"</div>").insertAfter("#"+frmgr);
-					$("#sNew","#"+IDs.themodal).click(function(){
-						postIt();
-						$("#"+frmgr).data("disabled",false);
-						$(".confirm","#"+IDs.themodal).hide();
-						return false;
-					});
-					$("#nNew","#"+IDs.themodal).click(function(){
-						$(".confirm","#"+IDs.themodal).hide();
-						$("#"+frmgr).data("disabled",false);
-						setTimeout(function(){$(":input","#"+frmgr)[0].focus();},0);
-						return false;
-					});
-					$("#cNew","#"+IDs.themodal).click(function(){
-						$(".confirm","#"+IDs.themodal).hide();
-						$("#"+frmgr).data("disabled",false);
-						hideModal("#"+IDs.themodal,{gb:"#gbox_"+gID,jqm:p.jqModal,onClose: rp_ge.onClose});
-						return false;
-					});
-				}
-				// here initform - only once
-				if(onInitializeForm) { onInitializeForm($("#"+frmgr)); }
-				if(rowid=="_empty" || !rp_ge.viewPagerButtons) { $("#pData,#nData","#"+frmtb+"_2").hide(); } else { $("#pData,#nData","#"+frmtb+"_2").show(); }
-				if(onBeforeShow) { onBeforeShow($("#"+frmgr)); }
-				$("#"+IDs.themodal).data("onClose",rp_ge.onClose);
-				viewModal("#"+IDs.themodal,{gbox:"#gbox_"+gID,jqm:p.jqModal,closeoverlay:closeovrl,modal:p.modal});
-				if(!closeovrl) {
-					$(".jqmOverlay").click(function(){
-						if(!checkUpdates()) { return false; }
-						hideModal("#"+IDs.themodal,{gb:"#gbox_"+gID,jqm:p.jqModal, onClose: rp_ge.onClose});
-						return false;
-					});
-				}
-				if(onAfterShow) { onAfterShow($("#"+frmgr)); }
-				$(".fm-button","#"+IDs.themodal).hover(
-				   function(){$(this).addClass('ui-state-hover');}, 
-				   function(){$(this).removeClass('ui-state-hover');}
-				);
-				$("#sData", "#"+frmtb+"_2").click(function(e){
-					postdata = {}; extpost={};
-					$("#FormError","#"+frmtb).hide();
-					// all depend on ret array
-					//ret[0] - succes
-					//ret[1] - msg if not succes
-					//ret[2] - the id  that will be set if reload after submit false
-					getFormData();
-					if(postdata[$t.p.id+"_id"] == "_empty")	{ postIt(); }
-					else if(p.checkOnSubmit===true ) {
-						newData = $.extend({},postdata,extpost);
-						diff = compareData(newData,rp_ge._savedData);
-						if(diff) {
-							$("#"+frmgr).data("disabled",true);
-							$(".confirm","#"+IDs.themodal).show();
-						} else {
-							postIt();
-						}
-					} else {
-						postIt();
-					}
-					return false;
-				});
-				$("#cData", "#"+frmtb+"_2").click(function(e){
-					if(!checkUpdates()) { return false; }
-					hideModal("#"+IDs.themodal,{gb:"#gbox_"+gID,jqm:p.jqModal,onClose: rp_ge.onClose});
-					return false;
-				});
-				$("#nData", "#"+frmtb+"_2").click(function(e){
-					if(!checkUpdates()) { return false; }
-					$("#FormError","#"+frmtb).hide();
-					var npos = getCurrPos();
-					npos[0] = parseInt(npos[0],10);
-					if(npos[0] != -1 && npos[1][npos[0]+1]) {
-						if($.isFunction(p.onclickPgButtons)) {
-							p.onclickPgButtons('next',$("#"+frmgr),npos[1][npos[0]]);
-						}
-						fillData(npos[1][npos[0]+1],$t,frmgr);
-						$($t).jqGrid("setSelection",npos[1][npos[0]+1]);
-						if($.isFunction(p.afterclickPgButtons)) {
-							p.afterclickPgButtons('next',$("#"+frmgr),npos[1][npos[0]+1]);
-						}
-						updateNav(npos[0]+1,npos[1].length-1);
-					}
-					return false;
-				});
-				$("#pData", "#"+frmtb+"_2").click(function(e){
-					if(!checkUpdates()) { return false; }
-					$("#FormError","#"+frmtb).hide();
-					var ppos = getCurrPos();
-					if(ppos[0] != -1 && ppos[1][ppos[0]-1]) {
-						if($.isFunction(p.onclickPgButtons)) {
-							p.onclickPgButtons('prev',$("#"+frmgr),ppos[1][ppos[0]]);
-						}
-						fillData(ppos[1][ppos[0]-1],$t,frmgr);
-						$($t).jqGrid("setSelection",ppos[1][ppos[0]-1]);
-						if($.isFunction(p.afterclickPgButtons)) {
-							p.afterclickPgButtons('prev',$("#"+frmgr),ppos[1][ppos[0]-1]);
-						}
-						updateNav(ppos[0]-1,ppos[1].length-1);
-					}
-					return false;
-				});
-			}
-			var posInit =getCurrPos();
-			updateNav(posInit[0],posInit[1].length-1);
-			function updateNav(cr,totr,rid){
-				if (cr===0) { $("#pData","#"+frmtb+"_2").addClass('ui-state-disabled'); } else { $("#pData","#"+frmtb+"_2").removeClass('ui-state-disabled'); }
-				if (cr==totr) { $("#nData","#"+frmtb+"_2").addClass('ui-state-disabled'); } else { $("#nData","#"+frmtb+"_2").removeClass('ui-state-disabled'); }
-			}
-			function getCurrPos() {
-				var rowsInGrid = $($t).jqGrid("getDataIDs"),
-				selrow = $("#id_g","#"+frmtb).val(),
-				pos = $.inArray(selrow,rowsInGrid);
-				return [pos,rowsInGrid];
-			}
-			function checkUpdates () {
-				var stat = true;
-				$("#FormError","#"+frmtb).hide();
-				if(rp_ge.checkOnUpdate) {
-					postdata = {}; extpost={};
-					getFormData();
-					newData = $.extend({},postdata,extpost);
-					diff = compareData(newData,rp_ge._savedData);
-					if(diff) {
-						$("#"+frmgr).data("disabled",true);
-						$(".confirm","#"+IDs.themodal).show();
-						stat = false;
-					}
-				}
-				return stat;
-			}
-			function getFormData(){
-				$(".FormElement", "#"+frmtb).each(function(i) {
-					var celm = $(".customelement", this);
-					if (celm.length) {
-						var  elem = celm[0], nm = elem.name;
-						$.each($t.p.colModel, function(i,n){
-							if(this.name == nm && this.editoptions && $.isFunction(this.editoptions.custom_value)) {
-								try {
-									postdata[nm] = this.editoptions.custom_value($("#"+nm,"#"+frmtb),'get');
-									if (postdata[nm] === undefined) { throw "e1"; }
-								} catch (e) {
-									if (e=="e1") { info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+$.jgrid.edit.msg.novalue,jQuery.jgrid.edit.bClose);}
-									else { info_dialog(jQuery.jgrid.errors.errcap,e.message,jQuery.jgrid.edit.bClose); }
-								}
-								return true;
-							}
-						});
-					} else {
-					switch ($(this).get(0).type) {
-						case "checkbox":
-							if($(this).attr("checked")) {
-								postdata[this.name]= $(this).val();
-							}else {
-								var ofv = $(this).attr("offval");
-								postdata[this.name]= ofv;
-							}
-						break;
-						case "select-one":
-							postdata[this.name]= $("option:selected",this).val();
-							extpost[this.name]= $("option:selected",this).text();
-						break;
-						case "select-multiple":
-							postdata[this.name]= $(this).val();
-							if(postdata[this.name]) { postdata[this.name] = postdata[this.name].join(","); }
-							else { postdata[this.name] =""; }
-							var selectedText = [];
-							$("option:selected",this).each(
-								function(i,selected){
-									selectedText[i] = $(selected).text();
-								}
-							);
-							extpost[this.name]= selectedText.join(",");
-						break;								
-						case "password":
-						case "text":
-						case "textarea":
-						case "button":
-							postdata[this.name] = $(this).val();
-							
-						break;
-					}
-					if($t.p.autoencode) { postdata[this.name] = $.jgrid.htmlEncode(postdata[this.name]); }
-					}
-				});
-				return true;
-			}
-			function createData(rowid,obj,tb,maxcols){
-				var nm, hc,trdata, cnt=0,tmp, dc,elc, retpos=[], ind=false,
-				tdtmpl = "<td class='CaptionTD ui-widget-content'>&#160;</td><td class='DataTD ui-widget-content' style='white-space:pre'>&#160;</td>", tmpl=""; //*2
-				for (var i =1;i<=maxcols;i++) {
-					tmpl += tdtmpl;
-				}
-				if(rowid != '_empty') {
-					ind = $(obj).jqGrid("getInd",rowid);
-				}
-				$(obj.p.colModel).each( function(i) {
-					nm = this.name;
-					// hidden fields are included in the form
-					if(this.editrules && this.editrules.edithidden === true) {
-						hc = false;
-					} else {
-						hc = this.hidden === true ? true : false;
-					}
-					dc = hc ? "style='display:none'" : "";
-					if ( nm !== 'cb' && nm !== 'subgrid' && this.editable===true && nm !== 'rn') {
-						if(ind === false) {
-							tmp = "";
-						} else {
-							if(nm == obj.p.ExpandColumn && obj.p.treeGrid === true) {
-								tmp = $("td:eq("+i+")",obj.rows[ind]).text();
-							} else {
-								try {
-									tmp =  $.unformat($("td:eq("+i+")",obj.rows[ind]),{rowId:rowid, colModel:this},i);
-								} catch (_) {
-									tmp = $("td:eq("+i+")",obj.rows[ind]).html();
-								}
-							}
-						}
-						var opt = $.extend({}, this.editoptions || {} ,{id:nm,name:nm}),
-						frmopt = $.extend({}, {elmprefix:'',elmsuffix:'',rowabove:false,rowcontent:''}, this.formoptions || {}),
-						rp = parseInt(frmopt.rowpos,10) || cnt+1,
-						cp = parseInt((parseInt(frmopt.colpos,10) || 1)*2,10);
-						if(rowid == "_empty" && opt.defaultValue ) {
-							tmp = $.isFunction(opt.defaultValue) ? opt.defaultValue() : opt.defaultValue; 
-						}
-						if(!this.edittype) { this.edittype = "text"; }
-						if($t.p.autoencode) { tmp = $.jgrid.htmlDecode(tmp); }
-						elc = createEl(this.edittype,opt,tmp,false,$.extend({},$.jgrid.ajaxOptions,obj.p.ajaxSelectOptions || {}));
-						if(tmp == "" && this.edittype == "checkbox") {tmp = $(elc).attr("offval");}
-						if(tmp == "" && this.edittype == "select") {tmp = $("option:eq(0)",elc).text();}
-						if(rp_ge.checkOnSubmit || rp_ge.checkOnUpdate) { rp_ge._savedData[nm] = tmp; }
-						$(elc).addClass("FormElement");
-						trdata = $(tb).find("tr[rowpos="+rp+"]");
-						if(frmopt.rowabove) {
-							var newdata = $("<tr><td class='contentinfo' colspan='"+(maxcols*2)+"'>"+frmopt.rowcontent+"</td></tr>");
-							$(tb).append(newdata);
-							newdata[0].rp = rp;
-						}
-						if ( trdata.length===0 ) {
-							trdata = $("<tr "+dc+" rowpos='"+rp+"'></tr>").addClass("FormData").attr("id","tr_"+nm);
-							$(trdata).append(tmpl);
-							$(tb).append(trdata);
-							trdata[0].rp = rp;
-						}
-						$("td:eq("+(cp-2)+")",trdata[0]).html( typeof frmopt.label === 'undefined' ? obj.p.colNames[i]: frmopt.label);
-						$("td:eq("+(cp-1)+")",trdata[0]).append(frmopt.elmprefix).append(elc).append(frmopt.elmsuffix);
-						retpos[cnt] = i;
-						cnt++;
-					}
-				});
-				if( cnt > 0) {
-					var idrow = $("<tr class='FormData' style='display:none'><td class='CaptionTD'></td><td colspan='"+ (maxcols*2-1)+"' class='DataTD'><input class='FormElement' id='id_g' type='text' name='"+obj.p.id+"_id' value='"+rowid+"'/></td></tr>");
-					idrow[0].rp = cnt+999;
-					$(tb).append(idrow);
-					if(rp_ge.checkOnSubmit || rp_ge.checkOnUpdate) { rp_ge._savedData[obj.p.id+"_id"] = rowid; }
-				}
-				return retpos;
-			}
-			function fillData(rowid,obj,fmid){
-				var nm,cnt=0,tmp, fld,opt,vl,vlc;
-				if(rp_ge.checkOnSubmit || rp_ge.checkOnUpdate) {rp_ge._savedData = {};rp_ge._savedData[obj.p.id+"_id"]=rowid;}
-				var cm = obj.p.colModel;
-				if(rowid == '_empty') {
-					$(cm).each(function(i){
-						nm = this.name;
-						opt = $.extend({}, this.editoptions || {} );
-						fld = $("#"+$.jgrid.jqID(nm),"#"+fmid);
-						if(fld[0] != null) {
-							vl = "";
-							if(opt.defaultValue ) {
-								vl = $.isFunction(opt.defaultValue) ? opt.defaultValue() : opt.defaultValue;
-								if(fld[0].type=='checkbox') {
-									vlc = vl.toLowerCase();
-									if(vlc.search(/(false|0|no|off|undefined)/i)<0 && vlc!=="") {
-										fld[0].checked = true;
-										fld[0].defaultChecked = true;
-										fld[0].value = vl;
-									} else {
-										fld.attr({checked:"",defaultChecked:""});
-									}
-								} else {fld.val(vl); }
-							} else {
-								if( fld[0].type=='checkbox' ) {
-									fld[0].checked = false;
-									fld[0].defaultChecked = false;
-									vl = $(fld).attr("offval");
-								} else if (fld[0].type.substr(0,6)=='select') {
-									fld[0].selectedIndex = 0; 
-								} else {
-									fld.val(vl);
-								}
-							}
-							if(rp_ge.checkOnSubmit===true || rp_ge.checkOnUpdate) { rp_ge._savedData[nm] = vl; }
-						}
-					});
-					$("#id_g","#"+fmid).val(rowid);
-					return;
-				}
-				var tre = $(obj).jqGrid("getInd",rowid,true);
-				if(!tre) { return; }
-				$('td',tre).each( function(i) {
-					nm = cm[i].name;
-					// hidden fields are included in the form
-					if ( nm !== 'cb' && nm !== 'subgrid' && nm !== 'rn' && cm[i].editable===true) {
-						if(nm == obj.p.ExpandColumn && obj.p.treeGrid === true) {
-							tmp = $(this).text();
-						} else {
-							try {
-								tmp =  $.unformat(this,{rowId:rowid, colModel:cm[i]},i);
-							} catch (_) {
-								tmp = $(this).html();
-							}
-						}
-						if($t.p.autoencode) { tmp = $.jgrid.htmlDecode(tmp); }
-						if(rp_ge.checkOnSubmit===true || rp_ge.checkOnUpdate) { rp_ge._savedData[nm] = tmp; }
-						nm = $.jgrid.jqID(nm);
-						switch (cm[i].edittype) {
-							case "password":
-							case "text":
-							case "button" :
-							case "image":
-								$("#"+nm,"#"+fmid).val(tmp);
-								break;
-							case "textarea":
-								if(tmp == "&nbsp;" || tmp == "&#160;" || (tmp.length==1 && tmp.charCodeAt(0)==160) ) {tmp='';}
-								$("#"+nm,"#"+fmid).val(tmp);
-								break;
-							case "select":
-								var opv = tmp.split(",");
-								opv = $.map(opv,function(n){return $.trim(n);});
-								$("#"+nm+" option","#"+fmid).each(function(j){
-									if (!cm[i].editoptions.multiple && (opv[0] == $.trim($(this).text()) || opv[0] == $.trim($(this).val())) ){
-										this.selected= true;
-									} else if (cm[i].editoptions.multiple){
-										if(  $.inArray($.trim($(this).text()), opv ) > -1 || $.inArray($.trim($(this).val()), opv ) > -1  ){
-											this.selected = true;
-										}else{
-											this.selected = false;
-										}
-									} else {
-										this.selected = false;
-									}
-								});
-								break;
-							case "checkbox":
-								tmp = tmp+"";
-								if(cm[i].editoptions && cm[i].editoptions.value) {
-									var cb = cm[i].editoptions.value.split(":");
-									if(cb[0] == tmp) {
-										$("#"+nm,"#"+fmid).attr("checked",true);
-										$("#"+nm,"#"+fmid).attr("defaultChecked",true); //ie
-									} else {
-										$("#"+nm,"#"+fmid).attr("checked",false);
-										$("#"+nm,"#"+fmid).attr("defaultChecked",""); //ie
-									}
-								} else {
-									tmp = tmp.toLowerCase();
-									if(tmp.search(/(false|0|no|off|undefined)/i)<0 && tmp!=="") {
-										$("#"+nm,"#"+fmid).attr("checked",true);
-										$("#"+nm,"#"+fmid).attr("defaultChecked",true); //ie
-									} else {
-										$("#"+nm,"#"+fmid).attr("checked",false);
-										$("#"+nm,"#"+fmid).attr("defaultChecked",""); //ie
-									}
-								}
-								break;
-							case 'custom' :
-								try {
-									if(cm[i].editoptions && $.isFunction(cm[i].editoptions.custom_value)) {
-										var dummy = cm[i].editoptions.custom_value($("#"+nm,"#"+fmid),'set',tmp);
-									} else { throw "e1"; }
-								} catch (e) {
-									if (e=="e1") { info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+$.jgrid.edit.msg.nodefined,jQuery.jgrid.edit.bClose);}
-									else { info_dialog(jQuery.jgrid.errors.errcap,e.message,jQuery.jgrid.edit.bClose); }
-								}
-								break;
-						}
-						cnt++;
-					}
-				});
-				if(cnt>0) { $("#id_g","#"+frmtb).val(rowid); }
-			}
-			function postIt() {
-				var copydata, ret=[true,"",""], onCS = {}, opers = $t.p.prmNames, idname, oper;
-				if($.isFunction(rp_ge.beforeCheckValues)) {
-					var retvals = rp_ge.beforeCheckValues(postdata,$("#"+frmgr),postdata[$t.p.id+"_id"] == "_empty" ? opers.addoper : opers.editoper);
-					if(retvals && typeof(retvals) === 'object') { postdata = retvals; }
-				}
-				for( var key in postdata ){
-					if(postdata.hasOwnProperty(key)) {
-						ret = checkValues(postdata[key],key,$t);
-						if(ret[0] === false) { break; }
-					}
-				}
-				if(ret[0]) {
-					if( $.isFunction( rp_ge.onclickSubmit)) { onCS = rp_ge.onclickSubmit(rp_ge,postdata) || {}; }
-					if( $.isFunction(rp_ge.beforeSubmit))  { ret = rp_ge.beforeSubmit(postdata,$("#"+frmgr)); }
-				}
-
-				if(ret[0] && !rp_ge.processing) {
-					rp_ge.processing = true;
-					$("#sData", "#"+frmtb+"_2").addClass('ui-state-active');
-					oper = opers.oper;
-					idname = opers.id;
-					// we add to pos data array the action - the name is oper
-					postdata[oper] = ($.trim(postdata[$t.p.id+"_id"]) == "_empty") ? opers.addoper : opers.editoper;
-					if(postdata[oper] != opers.addoper) {
-						postdata[idname] = postdata[$t.p.id+"_id"];
-					} else {
-						// check to see if we have allredy this field in the form and if yes lieve it
-						if( postdata[idname] === undefined ) { postdata[idname] = postdata[$t.p.id+"_id"]; }
-					}
-					delete postdata[$t.p.id+"_id"];
-					postdata = $.extend(postdata,rp_ge.editData,onCS);
-
-					var ajaxOptions = $.extend({
-						url: rp_ge.url ? rp_ge.url : $($t).jqGrid('getGridParam','editurl'),
-						type: rp_ge.mtype,
-						data: $.isFunction(rp_ge.serializeEditData) ? rp_ge.serializeEditData(postdata) :  postdata,
-						complete:function(data,Status){
-							if(Status != "success") {
-							    ret[0] = false;
-							    if ($.isFunction(rp_ge.errorTextFormat)) {
-							        ret[1] = rp_ge.errorTextFormat(data);
-							    } else {
-							        ret[1] = Status + " Status: '" + data.statusText + "'. Error code: " + data.status;
-								}
-							} else {
-								// data is posted successful
-								// execute aftersubmit with the returned data from server
-								if( $.isFunction(rp_ge.afterSubmit) ) {
-									ret = rp_ge.afterSubmit(data,postdata);
-								}
-							}
-							if(ret[0] === false) {
-								$("#FormError>td","#"+frmtb).html(ret[1]);
-								$("#FormError","#"+frmtb).show();
-							} else {
-								// remove some values if formattaer select or checkbox
-								$.each($t.p.colModel, function(i,n){
-									if(extpost[this.name] && this.formatter && this.formatter=='select') {
-										try {delete extpost[this.name];} catch (e) {}
-									}
-								});
-								postdata = $.extend(postdata,extpost);
-								if($t.p.autoencode) {
-									$.each(postdata,function(n,v){
-										postdata[n] = $.jgrid.htmlDecode(v);
-									});
-								}
-								// the action is add
-								if(postdata[oper] == opers.addoper ) {
-									//id processing
-									// user not set the id ret[2]
-									if(!ret[2]) { ret[2] = parseInt($t.p.records,10)+1; }
-									postdata[idname] = ret[2];
-									if(rp_ge.closeAfterAdd) {
-										if(rp_ge.reloadAfterSubmit) { $($t).trigger("reloadGrid"); }
-										else {
-											$($t).jqGrid("addRowData",ret[2],postdata,p.addedrow);
-											$($t).jqGrid("setSelection",ret[2]);
-										}
-										hideModal("#"+IDs.themodal,{gb:"#gbox_"+gID,jqm:p.jqModal,onClose: rp_ge.onClose});
-									} else if (rp_ge.clearAfterAdd) {
-										if(rp_ge.reloadAfterSubmit) { $($t).trigger("reloadGrid"); }
-										else { $($t).jqGrid("addRowData",ret[2],postdata,p.addedrow); }
-										fillData("_empty",$t,frmgr);
-									} else {
-										if(rp_ge.reloadAfterSubmit) { $($t).trigger("reloadGrid"); }
-										else { $($t).jqGrid("addRowData",ret[2],postdata,p.addedrow); }
-									}
-								} else {
-									// the action is update
-									if(rp_ge.reloadAfterSubmit) {
-										$($t).trigger("reloadGrid");
-										if( !rp_ge.closeAfterEdit ) { setTimeout(function(){$($t).jqGrid("setSelection",postdata[idname]);},1000); }
-									} else {
-										if($t.p.treeGrid === true) {
-											$($t).jqGrid("setTreeRow",postdata[idname],postdata);
-										} else {
-											$($t).jqGrid("setRowData",postdata[idname],postdata);
-										}
-									}
-									if(rp_ge.closeAfterEdit) { hideModal("#"+IDs.themodal,{gb:"#gbox_"+gID,jqm:p.jqModal,onClose: rp_ge.onClose}); }
-								}
-								if($.isFunction(rp_ge.afterComplete)) {
-									copydata = data;
-									setTimeout(function(){rp_ge.afterComplete(copydata,postdata,$("#"+frmgr));copydata=null;},500);
-								}
-							}
-							rp_ge.processing=false;
-							if(rp_ge.checkOnSubmit || rp_ge.checkOnUpdate) {
-								$("#"+frmgr).data("disabled",false);
-								if(rp_ge._savedData[$t.p.id+"_id"] !="_empty"){
-									for(var key in rp_ge._savedData) {
-										if(postdata[key]) {
-											rp_ge._savedData[key] = postdata[key];
-										}
-									}
-								}
-							}
-							$("#sData", "#"+frmtb+"_2").removeClass('ui-state-active');
-							try{$(':input:visible',"#"+frmgr)[0].focus();} catch (e){}
-						},
-						error:function(xhr,st,err){
-							$("#FormError>td","#"+frmtb).html(st+ " : "+err);
-							$("#FormError","#"+frmtb).show();
-							rp_ge.processing=false;
-							$("#"+frmgr).data("disabled",false);
-							$("#sData", "#"+frmtb+"_2").removeClass('ui-state-active');
-						}
-					}, $.jgrid.ajaxOptions, rp_ge.ajaxEditOptions )
-					
-					if (!ajaxOptions['url'] && !rp_ge['useDataProxy']) {
-						if ($.isFunction($t.p.dataProxy)) {
-							rp_ge['useDataProxy'] = true;
-						} else {
-							ret[0]=false; ret[1] += " "+$.jgrid.errors.nourl;
-						}
-					}
-					if (ret[0]) { 
-						if (rp_ge['useDataProxy']) { $t.p.dataProxy.call($t, ajaxOptions, "set_"+$t.p.id) }
-						else { $.ajax(ajaxOptions) }
-					}
-				}
-				if(ret[0] === false) {
-					$("#FormError>td","#"+frmtb).html(ret[1]);
-					$("#FormError","#"+frmtb).show();
-					// return; 
-				}
-			}
-			function compareData(nObj, oObj ) {
-				var ret = false,key;
-				for (key in nObj) {
-					if(nObj[key] != oObj[key]) {
-						ret = true;
-						break;
-					}
-				}
-				return ret;
-			}
-		});
-	},
-	viewGridRow : function(rowid, p){
-		p = $.extend({
-			top : 0,
-			left: 0,
-			width: 0,
-			height: 'auto',
-			dataheight: 'auto',
-			modal: false,
-			drag: true,
-			resize: true,
-			jqModal: true,
-			closeOnEscape : false,
-			labelswidth: '30%',
-			closeicon: [],
-			navkeys: [false,38,40],
-			onClose: null,
-			beforeShowForm : null,
-			viewPagerButtons : true
-		}, $.jgrid.view, p || {});
-		return this.each(function(){
-			var $t = this;
-			if (!$t.grid || !rowid) { return; }
-			if(!p.imgpath) { p.imgpath= $t.p.imgpath; }
-			// I hate to rewrite code, but ...
-			var gID = $t.p.id,
-			frmgr = "ViewGrid_"+gID , frmtb = "ViewTbl_"+gID,
-			IDs = {themodal:'viewmod'+gID,modalhead:'viewhd'+gID,modalcontent:'viewcnt'+gID, scrollelm : frmgr},
-			maxCols = 1, maxRows=0;
-			if ( $("#"+IDs.themodal).html() != null ) {
-				$(".ui-jqdialog-title","#"+IDs.modalhead).html(p.caption);
-				$("#FormError","#"+frmtb).hide();
-				fillData(rowid,$t);
-				if($.isFunction(p.beforeShowForm)) { p.beforeShowForm($("#"+frmgr)); }
-				viewModal("#"+IDs.themodal,{gbox:"#gbox_"+gID,jqm:p.jqModal, jqM: false, modal:p.modal});
-				focusaref();
-			} else {
-				$($t.p.colModel).each( function(i) {
-					var fmto = this.formoptions;
-					maxCols = Math.max(maxCols, fmto ? fmto.colpos || 0 : 0 );
-					maxRows = Math.max(maxRows, fmto ? fmto.rowpos || 0 : 0 );
-				});
-				var dh = isNaN(p.dataheight) ? p.dataheight : p.dataheight+"px";
-				var flr, frm = $("<form name='FormPost' id='"+frmgr+"' class='FormGrid' style='width:100%;overflow:auto;position:relative;height:"+dh+";'></form>"),
-				tbl =$("<table id='"+frmtb+"' class='EditTable' cellspacing='1' cellpading='2' border='0' style='table-layout:fixed'><tbody></tbody></table>");
-				// set the id.
-				$(frm).append(tbl);
-				var valref = createData(rowid, $t, tbl, maxCols),
-				rtlb = $t.p.direction == "rtl" ? true :false,
-				bp = rtlb ? "nData" : "pData",
-				bn = rtlb ? "pData" : "nData",
-
-				// buttons at footer
-				bP = "<a href='javascript:void(0)' id='"+bp+"' class='fm-button ui-state-default ui-corner-left'><span class='ui-icon ui-icon-triangle-1-w'></span></div>",
-				bN = "<a href='javascript:void(0)' id='"+bn+"' class='fm-button ui-state-default ui-corner-right'><span class='ui-icon ui-icon-triangle-1-e'></span></div>",
-				bC  ="<a href='javascript:void(0)' id='cData' class='fm-button ui-state-default ui-corner-all'>"+p.bClose+"</a>";
-				if(maxRows >  0) {
-					var sd=[];
-					$.each($(tbl)[0].rows,function(i,r){
-						sd[i] = r;
-					});
-					sd.sort(function(a,b){
-						if(a.rp > b.rp) {return 1;}
-						if(a.rp < b.rp) {return -1;}
-						return 0;
-					});
-					$.each(sd, function(index, row) {
-						$('tbody',tbl).append(row);
-					});
-				}
-				p.gbox = "#gbox_"+gID;
-				var cle = false;
-				if(p.closeOnEscape===true){
-					p.closeOnEscape = false;
-					cle = true;
-				}				
-				var bt = $("<span></span>").append(frm).append("<table border='0' class='EditTable' id='"+frmtb+"_2'><tbody><tr id='Act_Buttons'><td class='navButton ui-widget-content' width='"+p.labelswidth+"'>"+(rtlb ? bN+bP : bP+bN)+"</td><td class='EditButton ui-widget-content'>"+bC+"</td></tr></tbody></table>");
-				createModal(IDs,bt,p,"#gview_"+$t.p.id,$("#gview_"+$t.p.id)[0]);
-				if(rtlb) {
-					$("#pData, #nData","#"+frmtb+"_2").css("float","right");
-					$(".EditButton","#"+frmtb+"_2").css("text-align","left");
-				}
-				if(!p.viewPagerButtons) { $("#pData, #nData","#"+frmtb+"_2").hide(); }
-				bt = null;
-				$("#"+IDs.themodal).keydown( function( e ) {
-					if(e.which === 27) {
-						if(cle)	{ hideModal(this,{gb:p.gbox,jqm:p.jqModal, onClose: p.onClose}); }
-						return false;
-					}
-					if(p.navkeys[0]===true) {
-						if(e.which === p.navkeys[1]){ //up
-							$("#pData", "#"+frmtb+"_2").trigger("click");
-							return false;
-						}
-						if(e.which === p.navkeys[2]){ //down
-							$("#nData", "#"+frmtb+"_2").trigger("click");
-							return false;
-						}
-					}
-				});
-				p.closeicon = $.extend([true,"left","ui-icon-close"],p.closeicon);
-				if(p.closeicon[0]===true) {
-					$("#cData","#"+frmtb+"_2").addClass(p.closeicon[1] == "right" ? 'fm-button-icon-right' : 'fm-button-icon-left')
-					.append("<span class='ui-icon "+p.closeicon[2]+"'></span>");
-				}
-				if($.isFunction(p.beforeShowForm)) { p.beforeShowForm($("#"+frmgr)); }
-				viewModal("#"+IDs.themodal,{gbox:"#gbox_"+gID,jqm:p.jqModal, modal:p.modal});
-				$(".fm-button:not(.ui-state-disabled)","#"+frmtb+"_2").hover(
-				   function(){$(this).addClass('ui-state-hover');}, 
-				   function(){$(this).removeClass('ui-state-hover');}
-				);
-				focusaref();
-				$("#cData", "#"+frmtb+"_2").click(function(e){
-					hideModal("#"+IDs.themodal,{gb:"#gbox_"+gID,jqm:p.jqModal, onClose: p.onClose});
-					return false;
-				});
-				$("#nData", "#"+frmtb+"_2").click(function(e){
-					$("#FormError","#"+frmtb).hide();
-					var npos = getCurrPos();
-					npos[0] = parseInt(npos[0],10);
-					if(npos[0] != -1 && npos[1][npos[0]+1]) {
-						if($.isFunction(p.onclickPgButtons)) {
-							p.onclickPgButtons('next',$("#"+frmgr),npos[1][npos[0]]);
-						}
-						fillData(npos[1][npos[0]+1],$t);
-						$($t).jqGrid("setSelection",npos[1][npos[0]+1]);
-						if($.isFunction(p.afterclickPgButtons)) {
-							p.afterclickPgButtons('next',$("#"+frmgr),npos[1][npos[0]+1]);
-						}
-						updateNav(npos[0]+1,npos[1].length-1);
-					}
-					focusaref();
-					return false;
-				});
-				$("#pData", "#"+frmtb+"_2").click(function(e){
-					$("#FormError","#"+frmtb).hide();
-					var ppos = getCurrPos();
-					if(ppos[0] != -1 && ppos[1][ppos[0]-1]) {
-						if($.isFunction(p.onclickPgButtons)) {
-							p.onclickPgButtons('prev',$("#"+frmgr),ppos[1][ppos[0]]);
-						}
-						fillData(ppos[1][ppos[0]-1],$t);
-						$($t).jqGrid("setSelection",ppos[1][ppos[0]-1]);
-						if($.isFunction(p.afterclickPgButtons)) {
-							p.afterclickPgButtons('prev',$("#"+frmgr),ppos[1][ppos[0]-1]);
-						}
-						updateNav(ppos[0]-1,ppos[1].length-1);
-					}
-					focusaref();
-					return false;
-				});
-			}
-			function focusaref(){ //Sfari 3 issues
-				if(p.closeOnEscape===true || p.navkeys[0]===true) {
-					setTimeout(function(){$(".ui-jqdialog-titlebar-close","#"+IDs.modalhead).focus();},0);
-				}
-			}
-			var posInit =getCurrPos();
-			updateNav(posInit[0],posInit[1].length-1);
-			function updateNav(cr,totr,rid){
-				if (cr===0) { $("#pData","#"+frmtb+"_2").addClass('ui-state-disabled'); } else { $("#pData","#"+frmtb+"_2").removeClass('ui-state-disabled'); }
-				if (cr==totr) { $("#nData","#"+frmtb+"_2").addClass('ui-state-disabled'); } else { $("#nData","#"+frmtb+"_2").removeClass('ui-state-disabled'); }
-			}
-			function getCurrPos() {
-				var rowsInGrid = $($t).jqGrid("getDataIDs"),
-				selrow = $("#id_g","#"+frmtb).val(),
-				pos = $.inArray(selrow,rowsInGrid);
-				return [pos,rowsInGrid];
-			}
-			function createData(rowid,obj,tb,maxcols){
-				var nm, hc,trdata, tdl, tde, cnt=0,tmp, dc, retpos=[], ind=false,
-				tdtmpl = "<td class='CaptionTD form-view-label ui-widget-content' width='"+p.labelswidth+"'>&#160;</td><td class='DataTD form-view-data ui-helper-reset ui-widget-content'>&#160;</td>", tmpl="",
-				tdtmpl2 = "<td class='CaptionTD form-view-label ui-widget-content'>&#160;</td><td class='DataTD form-view-data ui-widget-content'>&#160;</td>",
-				fmtnum = ['integer','number','currency'],max1 =0, max2=0 ,maxw,setme, viewfld;
-				for (var i =1;i<=maxcols;i++) {
-					tmpl += i == 1 ? tdtmpl : tdtmpl2;
-				}
-				// find max number align rigth with property formatter
-				$(obj.p.colModel).each( function(i) {
-					if(this.editrules && this.editrules.edithidden === true) {
-						hc = false;
-					} else {
-						hc = this.hidden === true ? true : false;
-					}
-					if(!hc && this.align==='right') {
-						if(this.formatter && $.inArray(this.formatter,fmtnum) !== -1 ) {
-							max1 = Math.max(max1,parseInt(this.width,10));
-						} else {
-							max2 = Math.max(max2,parseInt(this.width,10));
-						}
-					}
-				});
-				maxw  = max1 !==0 ? max1 : max2 !==0 ? max2 : 0;
-				ind = $(obj).jqGrid("getInd",rowid);
-				$(obj.p.colModel).each( function(i) {
-					nm = this.name;
-					setme = false;
-					// hidden fields are included in the form
-					if(this.editrules && this.editrules.edithidden === true) {
-						hc = false;
-					} else {
-						hc = this.hidden === true ? true : false;
-					}
-					dc = hc ? "style='display:none'" : "";
-					viewfld = (typeof this.viewable != 'boolean') ? true : this.viewable;
-					if ( nm !== 'cb' && nm !== 'subgrid' && nm !== 'rn' && viewfld) {
-						if(ind === false) {
-							tmp = "";
-						} else {
-							if(nm == obj.p.ExpandColumn && obj.p.treeGrid === true) {
-								tmp = $("td:eq("+i+")",obj.rows[ind]).text();
-							} else {
-								tmp = $("td:eq("+i+")",obj.rows[ind]).html();
-							}
-						}
-						setme = this.align === 'right' && maxw !==0 ? true : false;
-						var opt = $.extend({}, this.editoptions || {} ,{id:nm,name:nm}),
-						frmopt = $.extend({},{rowabove:false,rowcontent:''}, this.formoptions || {}),
-						rp = parseInt(frmopt.rowpos,10) || cnt+1,
-						cp = parseInt((parseInt(frmopt.colpos,10) || 1)*2,10);
-						if(frmopt.rowabove) {
-							var newdata = $("<tr><td class='contentinfo' colspan='"+(maxcols*2)+"'>"+frmopt.rowcontent+"</td></tr>");
-							$(tb).append(newdata);
-							newdata[0].rp = rp;
-						}
-						trdata = $(tb).find("tr[rowpos="+rp+"]");
-						if ( trdata.length===0 ) {
-							trdata = $("<tr "+dc+" rowpos='"+rp+"'></tr>").addClass("FormData").attr("id","trv_"+nm);
-							$(trdata).append(tmpl);
-							$(tb).append(trdata);
-							trdata[0].rp = rp;
-						}
-						$("td:eq("+(cp-2)+")",trdata[0]).html('<b>'+ (typeof frmopt.label === 'undefined' ? obj.p.colNames[i]: frmopt.label)+'</b>');
-						$("td:eq("+(cp-1)+")",trdata[0]).append("<span>"+tmp+"</span>").attr("id","v_"+nm);
-						if(setme){
-							$("td:eq("+(cp-1)+") span",trdata[0]).css({'text-align':'right',width:maxw+"px"});
-						}
-						retpos[cnt] = i;
-						cnt++;
-					}
-				});
-				if( cnt > 0) {
-					var idrow = $("<tr class='FormData' style='display:none'><td class='CaptionTD'></td><td colspan='"+ (maxcols*2-1)+"' class='DataTD'><input class='FormElement' id='id_g' type='text' name='id' value='"+rowid+"'/></td></tr>");
-					idrow[0].rp = cnt+99;
-					$(tb).append(idrow);
-				}
-				return retpos;
-			}
-			function fillData(rowid,obj){
-				var nm, hc,cnt=0,tmp, opt,trv;
-				trv = $(obj).jqGrid("getInd",rowid,true);
-				if(!trv) { return; }
-				$('td',trv).each( function(i) {
-					nm = obj.p.colModel[i].name;
-					// hidden fields are included in the form
-					if(obj.p.colModel[i].editrules && obj.p.colModel[i].editrules.edithidden === true) {
-						hc = false;
-					} else {
-						hc = obj.p.colModel[i].hidden === true ? true : false;
-					}
-					if ( nm !== 'cb' && nm !== 'subgrid' && nm !== 'rn') {
-						if(nm == obj.p.ExpandColumn && obj.p.treeGrid === true) {
-							tmp = $(this).text();
-						} else {
-							tmp = $(this).html();
-						}
-						opt = $.extend({},obj.p.colModel[i].editoptions || {});
-						nm = $.jgrid.jqID("v_"+nm);
-						$("#"+nm+" span","#"+frmtb).html(tmp);
-						if (hc) { $("#"+nm,"#"+frmtb).parents("tr:first").hide(); }
-						cnt++;
-					}
-				});
-				if(cnt>0) { $("#id_g","#"+frmtb).val(rowid); }
-			}
-		});
-	},
-	delGridRow : function(rowids,p) {
-		p = $.extend({
-			top : 0,
-			left: 0,
-			width: 240,
-			height: 'auto',
-			dataheight : 'auto',
-			modal: false,
-			drag: true,
-			resize: true,
-			url : '',
-			mtype : "POST",
-			reloadAfterSubmit: true,
-			beforeShowForm: null,
-			afterShowForm: null,
-			beforeSubmit: null,
-			onclickSubmit: null,
-			afterSubmit: null,
-			jqModal : true,
-			closeOnEscape : false,
-			delData: {},
-			delicon : [],
-			cancelicon : [],
-			onClose : null,
-			ajaxDelOptions : {},
-			processing : false,
-			serializeDelData : null,
-			useDataProxy : false
-		}, $.jgrid.del, p ||{});
-		rp_ge = p;
-		return this.each(function(){
-			var $t = this;
-			if (!$t.grid ) { return; }
-			if(!rowids) { return; }
-			var onBeforeShow = typeof p.beforeShowForm === 'function' ? true: false,
-			onAfterShow = typeof p.afterShowForm === 'function' ? true: false,
-			gID = $t.p.id, onCS = {},
-			dtbl = "DelTbl_"+gID,postd, idname, opers, oper,
-			IDs = {themodal:'delmod'+gID,modalhead:'delhd'+gID,modalcontent:'delcnt'+gID, scrollelm: dtbl};
-			if (jQuery.isArray(rowids)) { rowids = rowids.join(); }
-			if ( $("#"+IDs.themodal).html() != null ) {
-				$("#DelData>td","#"+dtbl).text(rowids);
-				$("#DelError","#"+dtbl).hide();
-				if( rp_ge.processing === true) {
-					rp_ge.processing=false;
-					$("#dData", "#"+dtbl).removeClass('ui-state-active');
-				}
-				if(onBeforeShow) { p.beforeShowForm($("#"+dtbl)); }
-				viewModal("#"+IDs.themodal,{gbox:"#gbox_"+gID,jqm:p.jqModal,jqM: false, modal:p.modal});
-				if(onAfterShow) { p.afterShowForm($("#"+dtbl)); }
-			} else {
-				var dh = isNaN(p.dataheight) ? p.dataheight : p.dataheight+"px";
-				var tbl = "<div id='"+dtbl+"' class='formdata' style='width:100%;overflow:auto;position:relative;height:"+dh+";'>";
-				tbl += "<table class='DelTable'><tbody>";
-				// error data 
-				tbl += "<tr id='DelError' style='display:none'><td class='ui-state-error'></td></tr>";
-				tbl += "<tr id='DelData' style='display:none'><td >"+rowids+"</td></tr>";
-				tbl += "<tr><td class=\"delmsg\" style=\"white-space:pre;\">"+p.msg+"</td></tr><tr><td >&#160;</td></tr>";
-				// buttons at footer
-				tbl += "</tbody></table></div>";
-				var bS  = "<a href='javascript:void(0)' id='dData' class='fm-button ui-state-default ui-corner-all'>"+p.bSubmit+"</a>",
-				bC  = "<a href='javascript:void(0)' id='eData' class='fm-button ui-state-default ui-corner-all'>"+p.bCancel+"</a>";
-				tbl += "<table cellspacing='0' cellpadding='0' border='0' class='EditTable' id='"+dtbl+"_2'><tbody><tr><td class='DataTD ui-widget-content'></td></tr><tr style='display:block;height:3px;'><td></td></tr><tr><td class='DelButton EditButton'>"+bS+"&#160;"+bC+"</td></tr></tbody></table>";
-				p.gbox = "#gbox_"+gID;
-				createModal(IDs,tbl,p,"#gview_"+$t.p.id,$("#gview_"+$t.p.id)[0]);
-				$(".fm-button","#"+dtbl+"_2").hover(
-				   function(){$(this).addClass('ui-state-hover');}, 
-				   function(){$(this).removeClass('ui-state-hover');}
-				);
-				p.delicon = $.extend([true,"left","ui-icon-scissors"],p.delicon);
-				p.cancelicon = $.extend([true,"left","ui-icon-cancel"],p.cancelicon);
-				if(p.delicon[0]===true) {
-					$("#dData","#"+dtbl+"_2").addClass(p.delicon[1] == "right" ? 'fm-button-icon-right' : 'fm-button-icon-left')
-					.append("<span class='ui-icon "+p.delicon[2]+"'></span>");
-				}
-				if(p.cancelicon[0]===true) {
-					$("#eData","#"+dtbl+"_2").addClass(p.cancelicon[1] == "right" ? 'fm-button-icon-right' : 'fm-button-icon-left')
-					.append("<span class='ui-icon "+p.cancelicon[2]+"'></span>");
-				}				
-				$("#dData","#"+dtbl+"_2").click(function(e){
-					var ret=[true,""]; onCS = {};
-					var postdata = $("#DelData>td","#"+dtbl).text(); //the pair is name=val1,val2,...
-					if( typeof p.onclickSubmit === 'function' ) { onCS = p.onclickSubmit(rp_ge, postdata) || {}; }
-					if( typeof p.beforeSubmit === 'function' ) { ret = p.beforeSubmit(postdata); }
-					if(ret[0] && !rp_ge.processing) {
-						rp_ge.processing = true;
-						$(this).addClass('ui-state-active');
-						opers = $t.p.prmNames;
-						postd = $.extend({},rp_ge.delData, onCS);
-						oper = opers.oper;
-						postd[oper] = opers.deloper;
-						idname = opers.id;
-						postd[idname] = postdata;
-
-						var ajaxOptions = $.extend({
-							url: rp_ge.url ? rp_ge.url : $($t).jqGrid('getGridParam','editurl'),
-							type: p.mtype,
-							data: $.isFunction(p.serializeDelData) ? p.serializeDelData(postd) : postd,
-							complete:function(data,Status){
-								if(Status != "success") {
-									ret[0] = false;
-									if ($.isFunction(rp_ge.errorTextFormat)) {
-										ret[1] = rp_ge.errorTextFormat(data);
-									} else {
-										ret[1] = Status + " Status: '" + data.statusText + "'. Error code: " + data.status;
-									}
-								} else {
-									// data is posted successful
-									// execute aftersubmit with the returned data from server
-									if( typeof rp_ge.afterSubmit === 'function' ) {
-										ret = rp_ge.afterSubmit(data,postd);
-									}
-								}
-								if(ret[0] === false) {
-									$("#DelError>td","#"+dtbl).html(ret[1]);
-									$("#DelError","#"+dtbl).show();
-								} else {
-									if(rp_ge.reloadAfterSubmit) {
-										$($t).trigger("reloadGrid");
-									} else {
-										var toarr = [];
-										toarr = postdata.split(",");
-										if($t.p.treeGrid===true){
-												try {$($t).jqGrid("delTreeNode",toarr[0]);} catch(e){}
-										} else {
-											for(var i=0;i<toarr.length;i++) {
-												$($t).jqGrid("delRowData",toarr[i]);
-											}
-										}
-										$t.p.selrow = null;
-										$t.p.selarrrow = [];
-									}
-									if($.isFunction(rp_ge.afterComplete)) {
-										setTimeout(function(){rp_ge.afterComplete(data,postdata);},500);
-									}
-								}
-								rp_ge.processing=false;
-								$("#dData", "#"+dtbl+"_2").removeClass('ui-state-active');
-								if(ret[0]) { hideModal("#"+IDs.themodal,{gb:"#gbox_"+gID,jqm:p.jqModal, onClose: rp_ge.onClose}); }
-							},
-							error:function(xhr,st,err){
-								$("#DelError>td","#"+dtbl).html(st+ " : "+err);
-								$("#DelError","#"+dtbl).show();
-								rp_ge.processing=false;
-									$("#dData", "#"+dtbl+"_2").removeClass('ui-state-active');
-							}
-						}, $.jgrid.ajaxOptions, p.ajaxDelOptions);
-
-
-						if (!ajaxOptions['url'] && !rp_ge['useDataProxy']) {
-							if ($.isFunction($t.p.dataProxy)) {
-								rp_ge['useDataProxy'] = true;
-							} else {
-								ret[0]=false; ret[1] += " "+$.jgrid.errors.nourl;
-							}
-						}
-						if (ret[0]) {
-							if (rp_ge['useDataProxy']) { $t.p.dataProxy.call($t, ajaxOptions, "del_"+$t.p.id) }
-							else { $.ajax(ajaxOptions) }
-						}
-					}
-
-					if(ret[0] === false) {
-						$("#DelError>td","#"+dtbl).html(ret[1]);
-						$("#DelError","#"+dtbl).show();
-					}
-					return false;
-				});
-				$("#eData", "#"+dtbl+"_2").click(function(e){
-					hideModal("#"+IDs.themodal,{gb:"#gbox_"+gID,jqm:p.jqModal, onClose: rp_ge.onClose});
-					return false;
-				});
-				if(onBeforeShow) { p.beforeShowForm($("#"+dtbl)); }
-				viewModal("#"+IDs.themodal,{gbox:"#gbox_"+gID,jqm:p.jqModal,modal:p.modal});
-				if(onAfterShow) { p.afterShowForm($("#"+dtbl)); }
-			}
-			if(p.closeOnEscape===true) {
-				setTimeout(function(){$(".ui-jqdialog-titlebar-close","#"+IDs.modalhead).focus();},0);
-			}
-		});
-	},
-	navGrid : function (elem, o, pEdit,pAdd,pDel,pSearch, pView) {
-		o = $.extend({
-			edit: true,
-			editicon: "ui-icon-pencil",
-			add: true,
-			addicon:"ui-icon-plus",
-			del: true,
-			delicon:"ui-icon-trash",
-			search: true,
-			searchicon:"ui-icon-search",
-			refresh: true,
-			refreshicon:"ui-icon-refresh",
-			refreshstate: 'firstpage',
-			view: false,
-			viewicon : "ui-icon-document",
-			position : "left",
-			closeOnEscape : true,
-			beforeRefresh : null,
-			afterRefresh : null,
-			cloneToTop : false
-		}, $.jgrid.nav, o ||{});
-		return this.each(function() {       
-			var alertIDs = {themodal:'alertmod',modalhead:'alerthd',modalcontent:'alertcnt'},
-			$t = this, vwidth, vheight, twd, tdw;
-			if(!$t.grid || typeof elem != 'string') { return; }
-			if ($("#"+alertIDs.themodal).html() === null) {
-				if (typeof window.innerWidth != 'undefined') {
-					vwidth = window.innerWidth;
-					vheight = window.innerHeight;
-				} else if (typeof document.documentElement != 'undefined' && typeof document.documentElement.clientWidth != 'undefined' && document.documentElement.clientWidth !== 0) {
-					vwidth = document.documentElement.clientWidth;
-					vheight = document.documentElement.clientHeight;
-				} else {
-					vwidth=1024;
-					vheight=768;
-				}
-				createModal(alertIDs,"<div>"+o.alerttext+"</div><span tabindex='0'><span tabindex='-1' id='jqg_alrt'></span></span>",{gbox:"#gbox_"+$t.p.id,jqModal:true,drag:true,resize:true,caption:o.alertcap,top:vheight/2-25,left:vwidth/2-100,width:200,height:'auto',closeOnEscape:o.closeOnEscape},"","",true);
-			}
-			var clone = 1;
-			if(o.cloneToTop && $t.p.toppager) { clone = 2; }
-			for(var i = 0; i<clone; i++) {
-				var tbd,
-				navtbl = $("<table cellspacing='0' cellpadding='0' border='0' class='ui-pg-table navtable' style='float:left;table-layout:auto;'><tbody><tr></tr></tbody></table>"),
-				sep = "<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='ui-separator'></span></td>",
-				pgid, elemids;
-				if(i===0) {
-					pgid = elem;
-					elemids = $t.p.id;
-					if(pgid == $t.p.toppager) {
-						elemids += "_top";
-						clone = 1;
-					}
-				} else {
-					pgid = $t.p.toppager;
-					elemids = $t.p.id+"_top";
-				}
-				if($t.p.direction == "rtl") { $(navtbl).attr("dir","rtl").css("float","right"); }
-				if (o.add) {
-					pAdd = pAdd || {};
-					tbd = $("<td class='ui-pg-button ui-corner-all'></td>");
-					$(tbd).append("<div class='ui-pg-div'><span class='ui-icon "+o.addicon+"'></span>"+o.addtext+"</div>");
-					$("tr",navtbl).append(tbd);
-					$(tbd,navtbl)
-					.attr({"title":o.addtitle || "",id : pAdd.id || "add_"+elemids})
-					.click(function(){
-						if (!$(this).hasClass('ui-state-disabled')) {
-							if (typeof o.addfunc == 'function') {
-								o.addfunc();
-							} else {
-								$($t).jqGrid("editGridRow","new",pAdd);
-							}
-						}
-						return false;
-					}).hover(
-						function () {
-							if (!$(this).hasClass('ui-state-disabled')) {
-								$(this).addClass("ui-state-hover");
-							}
-						},
-						function () {$(this).removeClass("ui-state-hover");}
-					);
-					tbd = null;
-				}
-				if (o.edit) {
-					tbd = $("<td class='ui-pg-button ui-corner-all'></td>");
-					pEdit = pEdit || {};
-					$(tbd).append("<div class='ui-pg-div'><span class='ui-icon "+o.editicon+"'></span>"+o.edittext+"</div>");
-					$("tr",navtbl).append(tbd);
-					$(tbd,navtbl)
-					.attr({"title":o.edittitle || "",id: pEdit.id || "edit_"+elemids})
-					.click(function(){
-						if (!$(this).hasClass('ui-state-disabled')) {
-							var sr = $t.p.selrow;
-							if (sr) {
-								if(typeof o.editfunc == 'function') {
-									o.editfunc(sr);
-								} else {
-									$($t).jqGrid("editGridRow",sr,pEdit);
-								}
-							} else {
-								viewModal("#"+alertIDs.themodal,{gbox:"#gbox_"+$t.p.id,jqm:true});
-								$("#jqg_alrt").focus();
-							}
-						}
-						return false;
-					}).hover(
-						function () {
-							if (!$(this).hasClass('ui-state-disabled')) {
-								$(this).addClass("ui-state-hover");
-							}
-						},
-						function () {$(this).removeClass("ui-state-hover");}
-					);
-					tbd = null;
-				}
-				if (o.view) {
-					tbd = $("<td class='ui-pg-button ui-corner-all'></td>");
-					pView = pView || {};
-					$(tbd).append("<div class='ui-pg-div'><span class='ui-icon "+o.viewicon+"'></span>"+o.viewtext+"</div>");
-					$("tr",navtbl).append(tbd);
-					$(tbd,navtbl)
-					.attr({"title":o.viewtitle || "",id: pView.id || "view_"+elemids})
-					.click(function(){
-						if (!$(this).hasClass('ui-state-disabled')) {
-							var sr = $t.p.selrow;
-							if (sr) {
-								$($t).jqGrid("viewGridRow",sr,pView);
-							} else {
-								viewModal("#"+alertIDs.themodal,{gbox:"#gbox_"+$t.p.id,jqm:true});
-								$("#jqg_alrt").focus();
-							}
-						}
-						return false;
-					}).hover(
-						function () {
-							if (!$(this).hasClass('ui-state-disabled')) {
-								$(this).addClass("ui-state-hover");
-							}
-						},
-						function () {$(this).removeClass("ui-state-hover");}
-					);
-					tbd = null;
-				}
-				if (o.del) {
-					tbd = $("<td class='ui-pg-button ui-corner-all'></td>");
-					pDel = pDel || {};
-					$(tbd).append("<div class='ui-pg-div'><span class='ui-icon "+o.delicon+"'></span>"+o.deltext+"</div>");
-					$("tr",navtbl).append(tbd);
-					$(tbd,navtbl)
-					.attr({"title":o.deltitle || "",id: pDel.id || "del_"+elemids})
-					.click(function(){
-						if (!$(this).hasClass('ui-state-disabled')) {
-							var dr;
-							if($t.p.multiselect) {
-								dr = $t.p.selarrrow;
-								if(dr.length===0) { dr = null; }
-							} else {
-								dr = $t.p.selrow;
-							}
-							if(dr){
-								if("function" == typeof o.delfunc){
-									o.delfunc(dr);
-								}else{
-									$($t).jqGrid("delGridRow",dr,pDel);
-								}
-							} else  {
-								viewModal("#"+alertIDs.themodal,{gbox:"#gbox_"+$t.p.id,jqm:true}); $("#jqg_alrt").focus();
-							}
-						}
-						return false;
-					}).hover(
-						function () {
-							if (!$(this).hasClass('ui-state-disabled')) {
-								$(this).addClass("ui-state-hover");
-							}
-						},
-						function () {$(this).removeClass("ui-state-hover");}
-					);
-					tbd = null;
-				}
-				if(o.add || o.edit || o.del || o.view) { $("tr",navtbl).append(sep); }
-				if (o.search) {
-					tbd = $("<td class='ui-pg-button ui-corner-all'></td>");
-					pSearch = pSearch || {};
-					$(tbd).append("<div class='ui-pg-div'><span class='ui-icon "+o.searchicon+"'></span>"+o.searchtext+"</div>");
-					$("tr",navtbl).append(tbd);
-					$(tbd,navtbl)
-					.attr({"title":o.searchtitle  || "",id:pSearch.id || "search_"+elemids})
-					.click(function(){
-						if (!$(this).hasClass('ui-state-disabled')) {
-							$($t).jqGrid("searchGrid",pSearch);
-						}
-						return false;
-					}).hover(
-						function () {
-							if (!$(this).hasClass('ui-state-disabled')) {
-								$(this).addClass("ui-state-hover");
-							}
-						},
-						function () {$(this).removeClass("ui-state-hover");}
-					);
-					tbd = null;
-				}
-				if (o.refresh) {
-					tbd = $("<td class='ui-pg-button ui-corner-all'></td>");
-					$(tbd).append("<div class='ui-pg-div'><span class='ui-icon "+o.refreshicon+"'></span>"+o.refreshtext+"</div>");
-					$("tr",navtbl).append(tbd);
-					$(tbd,navtbl)
-					.attr({"title":o.refreshtitle  || "",id: "refresh_"+elemids})
-					.click(function(){
-						if (!$(this).hasClass('ui-state-disabled')) {
-							if($.isFunction(o.beforeRefresh)) { o.beforeRefresh(); }
-							$t.p.search = false;
-							try {
-								var gID = $t.p.id;
-								$("#fbox_"+gID).searchFilter().reset();
-							    if($.isFunction($t.clearToolbar)) { $t.clearToolbar(false); }
-							} catch (e) {}
-							switch (o.refreshstate) {
-								case 'firstpage':
-								    $($t).trigger("reloadGrid", [{page:1}]);
-									break;
-								case 'current':
-								    $($t).trigger("reloadGrid", [{current:true}]);
-									break;
-							}
-							if($.isFunction(o.afterRefresh)) { o.afterRefresh(); }
-						}
-						return false;
-					}).hover(
-						function () {
-							if (!$(this).hasClass('ui-state-disabled')) {
-								$(this).addClass("ui-state-hover");
-							}
-						},
-						function () {$(this).removeClass("ui-state-hover");}
-					);
-					tbd = null;
-				}
-				tdw = $(".ui-jqgrid").css("font-size") || "11px";
-				$('body').append("<div id='testpg2' class='ui-jqgrid ui-widget ui-widget-content' style='font-size:"+tdw+";visibility:hidden;' ></div>");
-				twd = $(navtbl).clone().appendTo("#testpg2").width();
-				$("#testpg2").remove();
-				$(pgid+"_"+o.position,pgid).append(navtbl);
-				if($t.p._nvtd) {
-					if(twd > $t.p._nvtd[0] ) {
-						$(pgid+"_"+o.position,pgid).width(twd);
-						$t.p._nvtd[0] = twd;
-					}
-					$t.p._nvtd[1] = twd;
-				}
-				tdw =null; twd=null; navtbl =null;
-			}
-		});
-	},
-	navButtonAdd : function (elem, p) {
-		p = $.extend({
-			caption : "newButton",
-			title: '',
-			buttonicon : 'ui-icon-newwin',
-			onClickButton: null,
-			position : "last",
-			cursor : 'pointer'
-		}, p ||{});
-		return this.each(function() {
-			if( !this.grid)  { return; }
-			if( elem.indexOf("#") !== 0) { elem = "#"+elem; }
-			var findnav = $(".navtable",elem)[0], $t = this;
-			if (findnav) {
-				var tbd = $("<td></td>");
-				if(p.buttonicon.toString().toUpperCase() == "NONE") {
-                    $(tbd).addClass('ui-pg-button ui-corner-all').append("<div class='ui-pg-div'>"+p.caption+"</div>");
-				} else	{
-					$(tbd).addClass('ui-pg-button ui-corner-all').append("<div class='ui-pg-div'><span class='ui-icon "+p.buttonicon+"'></span>"+p.caption+"</div>");
-				}
-				if(p.id) {$(tbd).attr("id",p.id);}
-				if(p.position=='first'){
-					if(findnav.rows[0].cells.length ===0 ) {
-						$("tr",findnav).append(tbd);
-					} else {
-						$("tr td:eq(0)",findnav).before(tbd);
-					}
-				} else {
-					$("tr",findnav).append(tbd);
-				}
-				$(tbd,findnav)
-				.attr("title",p.title  || "")
-				.click(function(e){
-					if (!$(this).hasClass('ui-state-disabled')) {
-						if ($.isFunction(p.onClickButton) ) { p.onClickButton.call($t,e); }
-					}
-					return false;
-				})
-				.hover(
-					function () {
-						if (!$(this).hasClass('ui-state-disabled')) {
-							$(this).addClass('ui-state-hover');
-						}
-					},
-					function () {$(this).removeClass("ui-state-hover");}
-				);
-			}
-		});
-	},
-	navSeparatorAdd:function (elem,p) {
-		p = $.extend({
-			sepclass : "ui-separator",
-			sepcontent: ''
-		}, p ||{});		
-		return this.each(function() {
-			if( !this.grid)  { return; }
-			if( elem.indexOf("#") !== 0) { elem = "#"+elem; }
-			var findnav = $(".navtable",elem)[0];
-			if(findnav) {
-				var sep = "<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='"+p.sepclass+"'></span>"+p.sepcontent+"</td>";
-				$("tr",findnav).append(sep);
-			}
-		});
-	},
-	GridToForm : function( rowid, formid ) {
-		return this.each(function(){
-			var $t = this;
-			if (!$t.grid) { return; } 
-			var rowdata = $($t).jqGrid("getRowData",rowid);
-			if (rowdata) {
-				for(var i in rowdata) {
-					if ( $("[name="+i+"]",formid).is("input:radio") || $("[name="+i+"]",formid).is("input:checkbox"))  {
-						$("[name="+i+"]",formid).each( function() {
-							if( $(this).val() == rowdata[i] ) {
-								$(this).attr("checked","checked");
-							} else {
-								$(this).attr("checked","");
-							}
-						});
-					} else {
-					// this is very slow on big table and form.
-						$("[name="+i+"]",formid).val(rowdata[i]);
-					}
-				}
-			}
-		});
-	},
-	FormToGrid : function(rowid, formid, mode, position){
-		return this.each(function() {
-			var $t = this;
-			if(!$t.grid) { return; }
-			if(!mode) { mode = 'set'; }
-			if(!position) { position = 'first'; }
-			var fields = $(formid).serializeArray();
-			var griddata = {};
-			$.each(fields, function(i, field){
-				griddata[field.name] = field.value;
-			});
-			if(mode=='add') { $($t).jqGrid("addRowData",rowid,griddata, position); }
-			else if(mode=='set') { $($t).jqGrid("setRowData",rowid,griddata); }
-		});
-	}
-});
-})(jQuery);
+(function($){
+/**
+ * jqGrid extension for form editing Grid Data
+ * Tony Tomov tony@trirand.com
+ * http://trirand.com/blog/
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl-2.0.html
+**/
+/*global xmlJsonClass, jQuery, $  */
+var rp_ge = {};
+$.jgrid.extend({
+	searchGrid : function (p) {
+		p = $.extend({
+			recreateFilter: false,
+			drag: true,
+			sField:'searchField',
+			sValue:'searchString',
+			sOper: 'searchOper',
+			sFilter: 'filters',
+            loadDefaults: true, // this options activates loading of default filters from grid's postData for Multipe Search only.
+			beforeShowSearch: null,
+			afterShowSearch : null,
+			onInitializeSearch: null,
+			afterRedraw : null,
+			closeAfterSearch : false,
+			closeAfterReset: false,
+			closeOnEscape : false,
+			multipleSearch : false,
+			multipleGroup : false,
+			//cloneSearchRowOnAdd: true,
+			top : 0,
+			left: 0,
+			jqModal : true,
+			modal: false,
+			resize : true,
+			width: 450,
+			height: 'auto',
+			dataheight: 'auto',
+			showQuery: false,
+			errorcheck : true,
+			// translation
+			// if you want to change or remove the order change it in sopt
+			// ['eq','ne','lt','le','gt','ge','bw','bn','in','ni','ew','en','cn','nc'],
+			sopt: null,
+			stringResult: undefined,
+			onClose : null,
+			onSearch : null,
+			onReset : null,
+			toTop : true,
+			overlay : 30,
+			columns : [],
+			tmplNames : null,
+			tmplFilters : null,
+			// translations - later in lang file
+			tmplLabel : ' Template: ',
+            showOnLoad: false,
+            layer: null
+		}, $.jgrid.search, p || {});
+		return this.each(function() {
+			var $t = this;
+			if(!$t.grid) {return;}
+			var fid = "fbox_"+$t.p.id,
+			showFrm = true,
+			IDs = {themodal:'searchmod'+fid,modalhead:'searchhd'+fid,modalcontent:'searchcnt'+fid, scrollelm : fid},
+			defaultFilters  = $t.p.postData[p.sFilter];
+			if(typeof(defaultFilters) === "string") {
+				defaultFilters = $.jgrid.parse( defaultFilters );
+			}
+			if(p.recreateFilter === true) {
+				$("#"+IDs.themodal).remove();
+			}
+			function showFilter() {
+				if($.isFunction(p.beforeShowSearch)) {
+					showFrm = p.beforeShowSearch($("#"+fid));
+					if(typeof(showFrm) === "undefined") {
+						showFrm = true;
+					}
+				}
+				if(showFrm) {
+					$.jgrid.viewModal("#"+IDs.themodal,{gbox:"#gbox_"+fid,jqm:p.jqModal, modal:p.modal, overlay: p.overlay, toTop: p.toTop});
+					if($.isFunction(p.afterShowSearch)) {
+						p.afterShowSearch($("#"+fid));
+					}
+				}
+			}
+			if ( $("#"+IDs.themodal).html() !== null ) {
+				showFilter();
+			} else {
+				var fil = $("<div><div id='"+fid+"' class='searchFilter' style='overflow:auto'></div></div>").insertBefore("#gview_"+$t.p.id),
+				align = "left", butleft =""; 
+				if($t.p.direction == "rtl") {
+					align = "right";
+					butleft = " style='text-align:left'";
+					fil.attr("dir","rtl");
+				}
+				if($.isFunction(p.onInitializeSearch) ) {
+					p.onInitializeSearch($("#"+fid));
+				}
+				var columns = $.extend([],$t.p.colModel),
+				bS  ="<a href='javascript:void(0)' id='"+fid+"_search' class='fm-button ui-state-default ui-corner-all fm-button-icon-right ui-reset'><span class='ui-icon ui-icon-search'></span>"+p.Find+"</a>",
+				bC  ="<a href='javascript:void(0)' id='"+fid+"_reset' class='fm-button ui-state-default ui-corner-all fm-button-icon-left ui-search'><span class='ui-icon ui-icon-arrowreturnthick-1-w'></span>"+p.Reset+"</a>",
+				bQ = "", tmpl="", colnm, found = false, bt, cmi=-1;
+				if(p.showQuery) {
+					bQ ="<a href='javascript:void(0)' id='"+fid+"_query' class='fm-button ui-state-default ui-corner-all fm-button-icon-left'><span class='ui-icon ui-icon-comment'></span>Query</a>";
+				}
+				if(!p.columns.length) {
+					$.each(columns, function(i,n){
+						if(!n.label) {
+							n.label = $t.p.colNames[i];
+						}
+						// find first searchable column and set it if no default filter
+						if(!found) {
+							var searchable = (typeof n.search === 'undefined') ?  true: n.search ,
+							hidden = (n.hidden === true),
+							ignoreHiding = (n.searchoptions && n.searchoptions.searchhidden === true);
+							if ((ignoreHiding && searchable) || (searchable && !hidden)) {
+								found = true;
+								colnm = n.index || n.name;
+								cmi =i;
+							}
+						}
+					});
+				} else {
+					columns = p.columns;
+				}
+				// old behaviour
+				if( (!defaultFilters && colnm) || p.multipleSearch === false  ) {
+					var cmop = "eq";
+					if(cmi >=0 && columns[cmi].searchoptions && columns[cmi].searchoptions.sopt) {
+						cmop = columns[cmi].searchoptions.sopt[0];
+					} else if(p.sopt && p.sopt.length) {
+						cmop = p.sopt[0];
+					}
+					defaultFilters = {"groupOp": "AND",rules:[{"field":colnm,"op":cmop,"data":""}]};
+				}
+				found = false;
+				if(p.tmplNames && p.tmplNames.length) {
+					found = true;
+					tmpl = p.tmplLabel;
+					tmpl += "<select class='ui-template'>";
+					tmpl += "<option value='default'>Default</option>";
+					$.each(p.tmplNames, function(i,n){
+						tmpl += "<option value='"+i+"'>"+n+"</option>";
+					});
+					tmpl += "</select>";
+				}
+
+				bt = "<table class='EditTable' style='border:0px none;margin-top:5px' id='"+fid+"_2'><tbody><tr><td colspan='2'><hr class='ui-widget-content' style='margin:1px'/></td></tr><tr><td class='EditButton' style='text-align:"+align+"'>"+bC+tmpl+"</td><td class='EditButton' "+butleft+">"+bQ+bS+"</td></tr></tbody></table>";
+
+				$("#"+fid).jqFilter({
+					columns : columns,
+					filter: p.loadDefaults ? defaultFilters : null,
+					showQuery: p.showQuery,
+					errorcheck : p.errorcheck,
+					sopt: p.sopt,
+					groupButton : p.multipleGroup,
+					ruleButtons : p.multipleSearch,
+					afterRedraw : p.afterRedraw,
+					_gridsopt : $.jgrid.search.odata,
+					onChange : function( sp ) {
+						if(this.p.showQuery) {
+							$('.query',this).html(this.toUserFriendlyString());
+						}
+					},
+					direction : $t.p.direction
+				});
+				fil.append( bt );
+				if(found && p.tmplFilters && p.tmplFilters.length) {
+					$(".ui-template", fil).bind('change', function(e){
+						var curtempl = $(this).val();
+						if(curtempl=="default") {
+							$("#"+fid).jqFilter('addFilter', defaultFilters);
+						} else {
+							$("#"+fid).jqFilter('addFilter', p.tmplFilters[parseInt(curtempl,10)]);
+						}
+						return false;
+					});
+				}
+				if(p.multipleGroup === true) p.multipleSearch = true;
+				if($.isFunction(p.onInitializeSearch) ) {
+					p.onInitializeSearch($("#"+fid));
+				}
+				p.gbox = "#gbox_"+fid;
+				if (p.layer)
+					$.jgrid.createModal(IDs ,fil,p,"#gview_"+$t.p.id,$("#gbox_"+$t.p.id)[0], "#"+p.layer, {position: "relative"});
+				else
+					$.jgrid.createModal(IDs ,fil,p,"#gview_"+$t.p.id,$("#gbox_"+$t.p.id)[0]);
+				if(bQ) {
+					$("#"+fid+"_query").bind('click', function(e){
+						$(".queryresult", fil).toggle();
+						return false;
+					});
+				}
+				if (p.stringResult===undefined) {
+					// to provide backward compatibility, inferring stringResult value from multipleSearch
+					p.stringResult = p.multipleSearch;
+				}
+				$("#"+fid+"_search").bind('click', function(){
+					var fl = $("#"+fid),
+					sdata={}, res ,
+					filters = fl.jqFilter('filterData');
+					if(p.errorcheck) {
+						fl[0].hideError();
+						if(!p.showQuery) {fl.jqFilter('toSQLString');}
+						if(fl[0].p.error) {
+							fl[0].showError();
+							return false;
+						}
+					}
+
+					if(p.stringResult) {
+						try {
+							// xmlJsonClass or JSON.stringify
+							res = xmlJsonClass.toJson(filters, '', '', false);
+						} catch (e) {
+							try {
+								res = JSON.stringify(filters);
+							} catch (e2) { }
+						}
+						if(typeof(res)==="string") {
+							sdata[p.sFilter] = res;
+							$.each([p.sField,p.sValue, p.sOper], function() {sdata[this] = "";});
+						}
+					} else {
+						if(p.multipleSearch) {
+							sdata[p.sFilter] = filters;
+							$.each([p.sField,p.sValue, p.sOper], function() {sdata[this] = "";});
+						} else {
+							sdata[p.sField] = filters.rules[0].field;
+							sdata[p.sValue] = filters.rules[0].data;
+							sdata[p.sOper] = filters.rules[0].op;
+							sdata[p.sFilter] = "";
+						}
+					}
+					$t.p.search = true;
+					$.extend($t.p.postData,sdata);
+					if($.isFunction(p.onSearch) ) {
+						p.onSearch();
+					}
+					$($t).trigger("reloadGrid",[{page:1}]);
+					if(p.closeAfterSearch) {
+						$.jgrid.hideModal("#"+IDs.themodal,{gb:"#gbox_"+$t.p.id,jqm:p.jqModal,onClose: p.onClose});
+					}
+					return false;
+				});
+				$("#"+fid+"_reset").bind('click', function(){
+					var sdata={},
+					fl = $("#"+fid);
+					$t.p.search = false;
+					if(p.multipleSearch===false) {
+						sdata[p.sField] = sdata[p.sValue] = sdata[p.sOper] = "";
+					} else {
+						sdata[p.sFilter] = "";
+					}
+					fl[0].resetFilter();
+					if(found) {
+						$(".ui-template", fil).val("default");
+					}
+					$.extend($t.p.postData,sdata);
+					if($.isFunction(p.onReset) ) {
+						p.onReset();
+					}
+					$($t).trigger("reloadGrid",[{page:1}]);
+					return false;
+				});
+				showFilter();
+				$(".fm-button:not(.ui-state-disabled)",fil).hover(
+				   function(){$(this).addClass('ui-state-hover');},
+				   function(){$(this).removeClass('ui-state-hover');}
+				);
+			}
+		});
+	},
+	editGridRow : function(rowid, p){
+		p = $.extend({
+			top : 0,
+			left: 0,
+			width: 300,
+			height: 'auto',
+			dataheight: 'auto',
+			modal: false,
+			overlay : 30,
+			drag: true,
+			resize: true,
+			url: null,
+			mtype : "POST",
+			clearAfterAdd :true,
+			closeAfterEdit : false,
+			reloadAfterSubmit : true,
+			onInitializeForm: null,
+			beforeInitData: null,
+			beforeShowForm: null,
+			afterShowForm: null,
+			beforeSubmit: null,
+			afterSubmit: null,
+			onclickSubmit: null,
+			afterComplete: null,
+			onclickPgButtons : null,
+			afterclickPgButtons: null,
+			editData : {},
+			recreateForm : false,
+			jqModal : true,
+			closeOnEscape : false,
+			addedrow : "first",
+			topinfo : '',
+			bottominfo: '',
+			saveicon : [],
+			closeicon : [],
+			savekey: [false,13],
+			navkeys: [false,38,40],
+			checkOnSubmit : false,
+			checkOnUpdate : false,
+			_savedData : {},
+			processing : false,
+			onClose : null,
+			ajaxEditOptions : {},
+			serializeEditData : null,
+			viewPagerButtons : true
+		}, $.jgrid.edit, p || {});
+		rp_ge[$(this)[0].p.id] = p;
+		return this.each(function(){
+			var $t = this;
+			if (!$t.grid || !rowid) {return;}
+			var gID = $t.p.id,
+			frmgr = "FrmGrid_"+gID,frmtb = "TblGrid_"+gID,
+			IDs = {themodal:'editmod'+gID,modalhead:'edithd'+gID,modalcontent:'editcnt'+gID, scrollelm : frmgr},
+			onBeforeShow = $.isFunction(rp_ge[$t.p.id].beforeShowForm) ? rp_ge[$t.p.id].beforeShowForm : false,
+			onAfterShow = $.isFunction(rp_ge[$t.p.id].afterShowForm) ? rp_ge[$t.p.id].afterShowForm : false,
+			onBeforeInit = $.isFunction(rp_ge[$t.p.id].beforeInitData) ? rp_ge[$t.p.id].beforeInitData : false,
+			onInitializeForm = $.isFunction(rp_ge[$t.p.id].onInitializeForm) ? rp_ge[$t.p.id].onInitializeForm : false,
+			copydata = null,
+			showFrm = true,
+			maxCols = 1, maxRows=0,	postdata, extpost, newData, diff;
+			if (rowid === "new") {
+				rowid = "_empty";
+				p.caption=rp_ge[$t.p.id].addCaption;
+			} else {
+				p.caption=rp_ge[$t.p.id].editCaption;
+			}
+			if(p.recreateForm===true && $("#"+IDs.themodal).html() !== null) {
+				$("#"+IDs.themodal).remove();
+			}
+			var closeovrl = true;
+			if(p.checkOnUpdate && p.jqModal && !p.modal) {
+				closeovrl = false;
+			}
+			function getFormData(){
+				$("#"+frmtb+" > tbody > tr > td > .FormElement").each(function(i) {
+					var celm = $(".customelement", this);
+					if (celm.length) {
+						var  elem = celm[0], nm = $(elem).attr('name');
+						$.each($t.p.colModel, function(i,n){
+							if(this.name === nm && this.editoptions && $.isFunction(this.editoptions.custom_value)) {
+								try {
+									postdata[nm] = this.editoptions.custom_value($("#"+$.jgrid.jqID(nm),"#"+frmtb),'get');
+									if (postdata[nm] === undefined) {throw "e1";}
+								} catch (e) {
+									if (e==="e1") {$.jgrid.info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+$.jgrid.edit.msg.novalue,jQuery.jgrid.edit.bClose);}
+									else {$.jgrid.info_dialog(jQuery.jgrid.errors.errcap,e.message,jQuery.jgrid.edit.bClose);}
+								}
+								return true;
+							}
+						});
+					} else {
+					switch ($(this).get(0).type) {
+						case "checkbox":
+							if($(this).is(":checked")) {
+								postdata[this.name]= $(this).val();
+							}else {
+								var ofv = $(this).attr("offval");
+								postdata[this.name]= ofv;
+							}
+						break;
+						case "select-one":
+							postdata[this.name]= $("option:selected",this).val();
+							extpost[this.name]= $("option:selected",this).text();
+						break;
+						case "select-multiple":
+							postdata[this.name]= $(this).val();
+							if(postdata[this.name]) {postdata[this.name] = postdata[this.name].join(",");}
+							else {postdata[this.name] ="";}
+							var selectedText = [];
+							$("option:selected",this).each(
+								function(i,selected){
+									selectedText[i] = $(selected).text();
+								}
+							);
+							extpost[this.name]= selectedText.join(",");
+						break;
+						case "password":
+						case "text":
+						case "textarea":
+						case "button":
+							postdata[this.name] = $(this).val();
+
+						break;
+					}
+					if($t.p.autoencode) {postdata[this.name] = $.jgrid.htmlEncode(postdata[this.name]);}
+					}
+				});
+				return true;
+			}
+			function createData(rowid,obj,tb,maxcols){
+				var nm, hc,trdata, cnt=0,tmp, dc,elc, retpos=[], ind=false,
+				tdtmpl = "<td class='CaptionTD'>&#160;</td><td class='DataTD'>&#160;</td>", tmpl="", i; //*2
+				for (i =1; i<=maxcols;i++) {
+					tmpl += tdtmpl;
+				}
+				if(rowid != '_empty') {
+					ind = $(obj).jqGrid("getInd",rowid);
+				}
+				$(obj.p.colModel).each( function(i) {
+					nm = this.name;
+					// hidden fields are included in the form
+					if(this.editrules && this.editrules.edithidden === true) {
+						hc = false;
+					} else {
+						hc = this.hidden === true ? true : false;
+					}
+					dc = hc ? "style='display:none'" : "";
+					if ( nm !== 'cb' && nm !== 'subgrid' && this.editable===true && nm !== 'rn') {
+						if(ind === false) {
+							tmp = "";
+						} else {
+							if(nm == obj.p.ExpandColumn && obj.p.treeGrid === true) {
+								tmp = $("td:eq("+i+")",obj.rows[ind]).text();
+							} else {
+								try {
+									tmp =  $.unformat($("td:eq("+i+")",obj.rows[ind]),{rowId:rowid, colModel:this},i);
+								} catch (_) {
+									tmp =  (this.edittype && this.edittype == "textarea") ? $("td:eq("+i+")",obj.rows[ind]).text() : $("td:eq("+i+")",obj.rows[ind]).html();
+								}
+								if(!tmp || tmp == "&nbsp;" || tmp == "&#160;" || (tmp.length==1 && tmp.charCodeAt(0)==160) ) {tmp='';}
+							}
+						}
+						var opt = $.extend({}, this.editoptions || {} ,{id:nm,name:nm}),
+						frmopt = $.extend({}, {elmprefix:'',elmsuffix:'',rowabove:false,rowcontent:''}, this.formoptions || {}),
+						rp = parseInt(frmopt.rowpos,10) || cnt+1,
+						cp = parseInt((parseInt(frmopt.colpos,10) || 1)*2,10);
+						if(rowid == "_empty" && opt.defaultValue ) {
+							tmp = $.isFunction(opt.defaultValue) ? opt.defaultValue() : opt.defaultValue;
+						}
+						if(!this.edittype) {this.edittype = "text";}
+						if($t.p.autoencode) {tmp = $.jgrid.htmlDecode(tmp);}
+						elc = $.jgrid.createEl(this.edittype,opt,tmp,false,$.extend({},$.jgrid.ajaxOptions,obj.p.ajaxSelectOptions || {}));
+						if(tmp === "" && this.edittype == "checkbox") {tmp = $(elc).attr("offval");}
+						if(tmp === "" && this.edittype == "select") {tmp = $("option:eq(0)",elc).text();}
+						if(rp_ge[$t.p.id].checkOnSubmit || rp_ge[$t.p.id].checkOnUpdate) {rp_ge[$t.p.id]._savedData[nm] = tmp;}
+						$(elc).addClass("FormElement");
+						if(this.edittype == 'text' || this.edittype == 'textarea') {
+							$(elc).addClass("ui-widget-content ui-corner-all");
+						}
+						trdata = $(tb).find("tr[rowpos="+rp+"]");
+						if(frmopt.rowabove) {
+							var newdata = $("<tr><td class='contentinfo' colspan='"+(maxcols*2)+"'>"+frmopt.rowcontent+"</td></tr>");
+							$(tb).append(newdata);
+							newdata[0].rp = rp;
+						}
+						if ( trdata.length===0 ) {
+							trdata = $("<tr "+dc+" rowpos='"+rp+"'></tr>").addClass("FormData").attr("id","tr_"+nm);
+							$(trdata).append(tmpl);
+							$(tb).append(trdata);
+							trdata[0].rp = rp;
+						}
+						$("td:eq("+(cp-2)+")",trdata[0]).html( typeof frmopt.label === 'undefined' ? obj.p.colNames[i]: frmopt.label);
+						$("td:eq("+(cp-1)+")",trdata[0]).append(frmopt.elmprefix).append(elc).append(frmopt.elmsuffix);
+						retpos[cnt] = i;
+						cnt++;
+					}
+				});
+				if( cnt > 0) {
+					var idrow = $("<tr class='FormData' style='display:none'><td class='CaptionTD'></td><td colspan='"+ (maxcols*2-1)+"' class='DataTD'><input class='FormElement' id='id_g' type='text' name='"+obj.p.id+"_id' value='"+rowid+"'/></td></tr>");
+					idrow[0].rp = cnt+999;
+					$(tb).append(idrow);
+					if(rp_ge[$t.p.id].checkOnSubmit || rp_ge[$t.p.id].checkOnUpdate) {rp_ge[$t.p.id]._savedData[obj.p.id+"_id"] = rowid;}
+				}
+				return retpos;
+			}
+			function fillData(rowid,obj,fmid){
+				var nm,cnt=0,tmp, fld,opt,vl,vlc;
+				if(rp_ge[$t.p.id].checkOnSubmit || rp_ge[$t.p.id].checkOnUpdate) {rp_ge[$t.p.id]._savedData = {};rp_ge[$t.p.id]._savedData[obj.p.id+"_id"]=rowid;}
+				var cm = obj.p.colModel;
+				if(rowid == '_empty') {
+					$(cm).each(function(i){
+						nm = this.name;
+						opt = $.extend({}, this.editoptions || {} );
+						fld = $("#"+$.jgrid.jqID(nm),"#"+fmid);
+						if(fld && fld.length && fld[0] !== null) {
+							vl = "";
+							if(opt.defaultValue ) {
+								vl = $.isFunction(opt.defaultValue) ? opt.defaultValue() : opt.defaultValue;
+								if(fld[0].type=='checkbox') {
+									vlc = vl.toLowerCase();
+									if(vlc.search(/(false|0|no|off|undefined)/i)<0 && vlc!=="") {
+										fld[0].checked = true;
+										fld[0].defaultChecked = true;
+										fld[0].value = vl;
+									} else {
+										fld[0].checked = false;
+										fld[0].defaultChecked = false;
+									}
+								} else {fld.val(vl);}
+							} else {
+								if( fld[0].type=='checkbox' ) {
+									fld[0].checked = false;
+									fld[0].defaultChecked = false;
+									vl = $(fld).attr("offval");
+								} else if (fld[0].type && fld[0].type.substr(0,6)=='select') {
+									fld[0].selectedIndex = 0;
+								} else {
+									fld.val(vl);
+								}
+							}
+							if(rp_ge[$t.p.id].checkOnSubmit===true || rp_ge[$t.p.id].checkOnUpdate) {rp_ge[$t.p.id]._savedData[nm] = vl;}
+						}
+					});
+					$("#id_g","#"+fmid).val(rowid);
+					return;
+				}
+				var tre = $(obj).jqGrid("getInd",rowid,true);
+				if(!tre) {return;}
+				$('td',tre).each( function(i) {
+					nm = cm[i].name;
+					// hidden fields are included in the form
+					if ( nm !== 'cb' && nm !== 'subgrid' && nm !== 'rn' && cm[i].editable===true) {
+						if(nm == obj.p.ExpandColumn && obj.p.treeGrid === true) {
+							tmp = $(this).text();
+						} else {
+							try {
+								tmp =  $.unformat($(this),{rowId:rowid, colModel:cm[i]},i);
+							} catch (_) {
+								tmp = cm[i].edittype=="textarea" ? $(this).text() : $(this).html();
+							}
+						}
+						if($t.p.autoencode) {tmp = $.jgrid.htmlDecode(tmp);}
+						if(rp_ge[$t.p.id].checkOnSubmit===true || rp_ge[$t.p.id].checkOnUpdate) {rp_ge[$t.p.id]._savedData[nm] = tmp;}
+						nm = $.jgrid.jqID(nm);
+						switch (cm[i].edittype) {
+							case "password":
+							case "text":
+							case "button" :
+							case "image":
+							case "textarea":
+								if(tmp == "&nbsp;" || tmp == "&#160;" || (tmp.length==1 && tmp.charCodeAt(0)==160) ) {tmp='';}
+								$("#"+nm,"#"+fmid).val(tmp);
+								break;
+							case "select":
+								var opv = tmp.split(",");
+								opv = $.map(opv,function(n){return $.trim(n);});
+								$("#"+nm+" option","#"+fmid).each(function(j){
+									if (!cm[i].editoptions.multiple && ($.trim(tmp) == $.trim($(this).text()) || opv[0] == $.trim($(this).text()) || opv[0] == $.trim($(this).val())) ){
+										this.selected= true;
+									} else if (cm[i].editoptions.multiple){
+										if(  $.inArray($.trim($(this).text()), opv ) > -1 || $.inArray($.trim($(this).val()), opv ) > -1  ){
+											this.selected = true;
+										}else{
+											this.selected = false;
+										}
+									} else {
+										this.selected = false;
+									}
+								});
+								break;
+							case "checkbox":
+								tmp = tmp+"";
+								if(cm[i].editoptions && cm[i].editoptions.value) {
+									var cb = cm[i].editoptions.value.split(":");
+									if(cb[0] == tmp) {
+										$("#"+nm,"#"+fmid)[$t.p.useProp ? 'prop': 'attr']("checked",true);
+										$("#"+nm,"#"+fmid)[$t.p.useProp ? 'prop': 'attr']("defaultChecked",true); //ie
+									} else {
+										$("#"+nm,"#"+fmid)[$t.p.useProp ? 'prop': 'attr']("checked", false);
+										$("#"+nm,"#"+fmid)[$t.p.useProp ? 'prop': 'attr']("defaultChecked", false); //ie
+									}
+								} else {
+									tmp = tmp.toLowerCase();
+									if(tmp.search(/(false|0|no|off|undefined)/i)<0 && tmp!=="") {
+										$("#"+nm,"#"+fmid)[$t.p.useProp ? 'prop': 'attr']("checked",true);
+										$("#"+nm,"#"+fmid)[$t.p.useProp ? 'prop': 'attr']("defaultChecked",true); //ie
+									} else {
+										$("#"+nm,"#"+fmid)[$t.p.useProp ? 'prop': 'attr']("checked", false);
+										$("#"+nm,"#"+fmid)[$t.p.useProp ? 'prop': 'attr']("defaultChecked", false); //ie
+									}
+								}
+								break;
+							case 'custom' :
+								try {
+									if(cm[i].editoptions && $.isFunction(cm[i].editoptions.custom_value)) {
+										cm[i].editoptions.custom_value($("#"+nm,"#"+fmid),'set',tmp);
+									} else {throw "e1";}
+								} catch (e) {
+									if (e=="e1") {$.jgrid.info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+$.jgrid.edit.msg.nodefined,jQuery.jgrid.edit.bClose);}
+									else {$.jgrid.info_dialog(jQuery.jgrid.errors.errcap,e.message,jQuery.jgrid.edit.bClose);}
+								}
+								break;
+						}
+						cnt++;
+					}
+				});
+				if(cnt>0) {$("#id_g","#"+frmtb).val(rowid);}
+			}
+			function postIt() {
+				var copydata, ret=[true,"",""], onCS = {}, opers = $t.p.prmNames, idname, oper, key, selr;
+				if($.isFunction(rp_ge[$t.p.id].beforeCheckValues)) {
+					var retvals = rp_ge[$t.p.id].beforeCheckValues(postdata,$("#"+frmgr),postdata[$t.p.id+"_id"] == "_empty" ? opers.addoper : opers.editoper);
+					if(retvals && typeof(retvals) === 'object') {postdata = retvals;}
+				}
+				for( key in postdata ){
+					if(postdata.hasOwnProperty(key)) {
+						ret = $.jgrid.checkValues(postdata[key],key,$t);
+						if(ret[0] === false) {break;}
+					}
+				}
+				setNulls();
+				if(ret[0]) {
+					if( $.isFunction( rp_ge[$t.p.id].onclickSubmit)) { onCS = rp_ge[$t.p.id].onclickSubmit(rp_ge[$t.p.id],postdata) || {} }
+					if( $.isFunction(rp_ge[$t.p.id].beforeSubmit))  {ret = rp_ge[$t.p.id].beforeSubmit(postdata,$("#"+frmgr));}
+				}
+
+				if(ret[0] && !rp_ge[$t.p.id].processing) {
+					rp_ge[$t.p.id].processing = true;
+					$("#sData", "#"+frmtb+"_2").addClass('ui-state-active');
+					oper = opers.oper;
+					idname = opers.id;
+					// we add to pos data array the action - the name is oper
+					postdata[oper] = ($.trim(postdata[$t.p.id+"_id"]) == "_empty") ? opers.addoper : opers.editoper;
+					if(postdata[oper] != opers.addoper) {
+						postdata[idname] = postdata[$t.p.id+"_id"];
+					} else {
+						// check to see if we have allredy this field in the form and if yes lieve it
+						if( postdata[idname] === undefined ) {postdata[idname] = postdata[$t.p.id+"_id"];}
+					}
+					delete postdata[$t.p.id+"_id"];
+					postdata = $.extend(postdata,rp_ge[$t.p.id].editData,onCS);
+					if($t.p.treeGrid === true)  {
+						if(postdata[oper] == opers.addoper) {
+						selr = $($t).jqGrid("getGridParam", 'selrow');
+							var tr_par_id = $t.p.treeGridModel == 'adjacency' ? $t.p.treeReader.parent_id_field : 'parent_id';
+							postdata[tr_par_id] = selr;
+						}
+						for(i in $t.p.treeReader){
+							var itm = $t.p.treeReader[i];
+							if(postdata.hasOwnProperty(itm)) {
+								if(postdata[oper] == opers.addoper && i === 'parent_id_field') {continue;}
+								delete postdata[itm];
+							}
+						}
+					}
+					
+					postdata[idname] = $.jgrid.stripPref($t.p.idPrefix, postdata[idname]);
+					var ajaxOptions = $.extend({
+						url: rp_ge[$t.p.id].url ? rp_ge[$t.p.id].url : $($t).jqGrid('getGridParam','editurl'),
+						type: rp_ge[$t.p.id].mtype,
+						data: $.isFunction(rp_ge[$t.p.id].serializeEditData) ? rp_ge[$t.p.id].serializeEditData(postdata) :  postdata,
+						complete:function(data,Status){
+							postdata[idname] = $t.p.idPrefix + postdata[idname];
+							if(Status != "success") {
+							    ret[0] = false;
+							    if ($.isFunction(rp_ge[$t.p.id].errorTextFormat)) {
+							        ret[1] = rp_ge[$t.p.id].errorTextFormat(data);
+							    } else {
+							        ret[1] = Status + " Status: '" + data.statusText + "'. Error code: " + data.status;
+								}
+							} else {
+								// data is posted successful
+								// execute aftersubmit with the returned data from server
+								if( $.isFunction(rp_ge[$t.p.id].afterSubmit) ) {
+									ret = rp_ge[$t.p.id].afterSubmit(data,postdata);
+								}
+							}
+							if(ret[0] === false) {
+								$("#FormError>td","#"+frmtb).html(ret[1]);
+								$("#FormError","#"+frmtb).show();
+							} else {
+								// remove some values if formattaer select or checkbox
+								$.each($t.p.colModel, function(i,n){
+									if(extpost[this.name] && this.formatter && this.formatter=='select') {
+										try {delete extpost[this.name];} catch (e) {}
+									}
+								});
+								postdata = $.extend(postdata,extpost);
+								if($t.p.autoencode) {
+									$.each(postdata,function(n,v){
+										postdata[n] = $.jgrid.htmlDecode(v);
+									});
+								}
+								//rp_ge[$t.p.id].reloadAfterSubmit = rp_ge[$t.p.id].reloadAfterSubmit && $t.p.datatype != "local";
+								// the action is add
+								if(postdata[oper] == opers.addoper ) {
+									//id processing
+									// user not set the id ret[2]
+									if(!ret[2]) {ret[2] = $.jgrid.randId();}
+									postdata[idname] = ret[2];
+									if(rp_ge[$t.p.id].closeAfterAdd) {
+										if(rp_ge[$t.p.id].reloadAfterSubmit) {$($t).trigger("reloadGrid");}
+										else {
+											if($t.p.treeGrid === true){
+												$($t).jqGrid("addChildNode",ret[2],selr,postdata );
+											} else {
+											$($t).jqGrid("addRowData",ret[2],postdata,p.addedrow);
+											$($t).jqGrid("setSelection",ret[2]);
+										}
+										}
+										$.jgrid.hideModal("#"+IDs.themodal,{gb:"#gbox_"+gID,jqm:p.jqModal,onClose: rp_ge[$t.p.id].onClose});
+									} else if (rp_ge[$t.p.id].clearAfterAdd) {
+										if(rp_ge[$t.p.id].reloadAfterSubmit) {$($t).trigger("reloadGrid");}
+										else {
+											if($t.p.treeGrid === true){
+												$($t).jqGrid("addChildNode",ret[2],selr,postdata );
+											} else {
+												$($t).jqGrid("addRowData",ret[2],postdata,p.addedrow);
+											}
+										}
+										fillData("_empty",$t,frmgr);
+									} else {
+										if(rp_ge[$t.p.id].reloadAfterSubmit) {$($t).trigger("reloadGrid");}
+										else {
+											if($t.p.treeGrid === true){
+												$($t).jqGrid("addChildNode",ret[2],selr,postdata );
+											} else {
+												$($t).jqGrid("addRowData",ret[2],postdata,p.addedrow);
+									}
+										}
+									}
+								} else {
+									// the action is update
+									if(rp_ge[$t.p.id].reloadAfterSubmit) {
+										$($t).trigger("reloadGrid");
+										if( !rp_ge[$t.p.id].closeAfterEdit ) {setTimeout(function(){$($t).jqGrid("setSelection",postdata[idname]);},1000);}
+									} else {
+										if($t.p.treeGrid === true) {
+											$($t).jqGrid("setTreeRow", postdata[idname],postdata);
+										} else {
+											$($t).jqGrid("setRowData", postdata[idname],postdata);
+										}
+									}
+									if(rp_ge[$t.p.id].closeAfterEdit) {$.jgrid.hideModal("#"+IDs.themodal,{gb:"#gbox_"+gID,jqm:p.jqModal,onClose: rp_ge[$t.p.id].onClose});}
+								}
+								if($.isFunction(rp_ge[$t.p.id].afterComplete)) {
+									copydata = data;
+									setTimeout(function(){rp_ge[$t.p.id].afterComplete(copydata,postdata,$("#"+frmgr));copydata=null;},500);
+								}
+							if(rp_ge[$t.p.id].checkOnSubmit || rp_ge[$t.p.id].checkOnUpdate) {
+								$("#"+frmgr).data("disabled",false);
+								if(rp_ge[$t.p.id]._savedData[$t.p.id+"_id"] !="_empty"){
+									for(var key in rp_ge[$t.p.id]._savedData) {
+										if(postdata[key]) {
+											rp_ge[$t.p.id]._savedData[key] = postdata[key];
+										}
+									}
+								}
+							}
+							}
+							rp_ge[$t.p.id].processing=false;
+							$("#sData", "#"+frmtb+"_2").removeClass('ui-state-active');
+							try{$(':input:visible',"#"+frmgr)[0].focus();} catch (e){}
+						}
+					}, $.jgrid.ajaxOptions, rp_ge[$t.p.id].ajaxEditOptions );
+
+					if (!ajaxOptions.url && !rp_ge[$t.p.id].useDataProxy) {
+						if ($.isFunction($t.p.dataProxy)) {
+							rp_ge[$t.p.id].useDataProxy = true;
+						} else {
+							ret[0]=false;ret[1] += " "+$.jgrid.errors.nourl;
+						}
+					}
+					if (ret[0]) {
+						if (rp_ge[$t.p.id].useDataProxy) {
+							var dpret = $t.p.dataProxy.call($t, ajaxOptions, "set_"+$t.p.id); 
+							if(typeof(dpret) == "undefined") {
+								dpret = [true, ""];
+							}
+							if(dpret[0] === false ) {
+								ret[0] = false;
+								ret[1] = dpret[1] || "Error deleting the selected row!" 
+							} else {
+								if(ajaxOptions.data.oper == opers.addoper && rp_ge[$t.p.id].closeAfterAdd ) {
+									$.jgrid.hideModal("#"+IDs.themodal,{gb:"#gbox_"+gID,jqm:p.jqModal, onClose: rp_ge[$t.p.id].onClose});
+								}
+								if(ajaxOptions.data.oper == opers.editoper && rp_ge[$t.p.id].closeAfterEdit ) {
+									$.jgrid.hideModal("#"+IDs.themodal,{gb:"#gbox_"+gID,jqm:p.jqModal, onClose: rp_ge[$t.p.id].onClose});
+								}
+							}
+						} else {
+							$.ajax(ajaxOptions); 
+						}
+					}
+				}
+				if(ret[0] === false) {
+					$("#FormError>td","#"+frmtb).html(ret[1]);
+					$("#FormError","#"+frmtb).show();
+					// return;
+				}
+			}
+			function compareData(nObj, oObj ) {
+				var ret = false,key;
+				for (key in nObj) {
+					if(nObj[key] != oObj[key]) {
+						ret = true;
+						break;
+					}
+				}
+				return ret;
+			}
+			function setNulls() {
+				$.each($t.p.colModel, function(i,n){
+					if(n.editoptions && n.editoptions.NullIfEmpty === true) {
+						if(postdata.hasOwnProperty(n.name) && postdata[n.name] == "") {
+							postdata[n.name] = 'null';
+						}
+					}
+				});
+			}
+			function checkUpdates () {
+				var stat = true;
+				$("#FormError","#"+frmtb).hide();
+				if(rp_ge[$t.p.id].checkOnUpdate) {
+					postdata = {};extpost={};
+					getFormData();
+					newData = $.extend({},postdata,extpost);
+					diff = compareData(newData,rp_ge[$t.p.id]._savedData);
+					if(diff) {
+						$("#"+frmgr).data("disabled",true);
+						$(".confirm","#"+IDs.themodal).show();
+						stat = false;
+					}
+				}
+				return stat;
+			}
+			function restoreInline()
+			{
+				if (rowid !== "_empty" && typeof($t.p.savedRow) !== "undefined" && $t.p.savedRow.length > 0 && $.isFunction($.fn.jqGrid.restoreRow)) {
+					for (var i=0;i<$t.p.savedRow.length;i++) {
+						if ($t.p.savedRow[i].id == rowid) {
+							$($t).jqGrid('restoreRow',rowid);
+							break;
+						}
+					}
+				}
+			}
+			function updateNav(cr,totr){
+				if (cr===0) {$("#pData","#"+frmtb+"_2").addClass('ui-state-disabled');} else {$("#pData","#"+frmtb+"_2").removeClass('ui-state-disabled');}
+				if (cr==totr) {$("#nData","#"+frmtb+"_2").addClass('ui-state-disabled');} else {$("#nData","#"+frmtb+"_2").removeClass('ui-state-disabled');}
+			}
+			function getCurrPos() {
+				var rowsInGrid = $($t).jqGrid("getDataIDs"),
+				selrow = $("#id_g","#"+frmtb).val(),
+				pos = $.inArray(selrow,rowsInGrid);
+				return [pos,rowsInGrid];
+			}
+
+			if ( $("#"+IDs.themodal).html() !== null ) {
+				if(onBeforeInit) {
+					showFrm = onBeforeInit($("#"+frmgr));
+					if(typeof(showFrm) == "undefined") {
+						showFrm = true;
+					}
+				}
+				if(showFrm === false) {return;}
+				restoreInline();
+				$(".ui-jqdialog-title","#"+IDs.modalhead).html(p.caption);
+				$("#FormError","#"+frmtb).hide();
+				if(rp_ge[$t.p.id].topinfo) {
+					$(".topinfo","#"+frmtb).html(rp_ge[$t.p.id].topinfo);
+					$(".tinfo","#"+frmtb).show();
+				} else {
+					$(".tinfo","#"+frmtb).hide();
+				}
+				if(rp_ge[$t.p.id].bottominfo) {
+					$(".bottominfo","#"+frmtb+"_2").html(rp_ge[$t.p.id].bottominfo);
+					$(".binfo","#"+frmtb+"_2").show();
+				} else {
+					$(".binfo","#"+frmtb+"_2").hide();
+				}
+				// filldata
+				fillData(rowid,$t,frmgr);
+				///
+				if(rowid=="_empty" || !rp_ge[$t.p.id].viewPagerButtons) {
+					$("#pData, #nData","#"+frmtb+"_2").hide();
+				} else {
+					$("#pData, #nData","#"+frmtb+"_2").show();
+				}
+				if(rp_ge[$t.p.id].processing===true) {
+					rp_ge[$t.p.id].processing=false;
+					$("#sData", "#"+frmtb+"_2").removeClass('ui-state-active');
+				}
+				if($("#"+frmgr).data("disabled")===true) {
+					$(".confirm","#"+IDs.themodal).hide();
+					$("#"+frmgr).data("disabled",false);
+				}
+				if(onBeforeShow) {onBeforeShow($("#"+frmgr));}
+				$("#"+IDs.themodal).data("onClose",rp_ge[$t.p.id].onClose);
+				$.jgrid.viewModal("#"+IDs.themodal,{gbox:"#gbox_"+gID,jqm:p.jqModal, jqM: false, overlay: p.overlay, modal:p.modal});
+				if(!closeovrl) {
+					$(".jqmOverlay").click(function(){
+						if(!checkUpdates()) {return false;}
+						$.jgrid.hideModal("#"+IDs.themodal,{gb:"#gbox_"+gID,jqm:p.jqModal, onClose: rp_ge[$t.p.id].onClose});
+						return false;
+					});
+				}
+				if(onAfterShow) {onAfterShow($("#"+frmgr));}
+			} else {
+				var dh = isNaN(p.dataheight) ? p.dataheight : p.dataheight+"px",
+				frm = $("<form name='FormPost' id='"+frmgr+"' class='FormGrid' onSubmit='return false;' style='width:100%;overflow:auto;position:relative;height:"+dh+";'></form>").data("disabled",false),
+				tbl = $("<table id='"+frmtb+"' class='EditTable' cellspacing='0' cellpadding='0' border='0'><tbody></tbody></table>");
+				if(onBeforeInit) {
+					showFrm = onBeforeInit($("#"+frmgr));
+					if(typeof(showFrm) == "undefined") {
+						showFrm = true;
+					}
+				}
+				if(showFrm === false) {return;}
+				restoreInline();
+				$($t.p.colModel).each( function(i) {
+					var fmto = this.formoptions;
+					maxCols = Math.max(maxCols, fmto ? fmto.colpos || 0 : 0 );
+					maxRows = Math.max(maxRows, fmto ? fmto.rowpos || 0 : 0 );
+				});
+				$(frm).append(tbl);
+				var flr = $("<tr id='FormError' style='display:none'><td class='ui-state-error' colspan='"+(maxCols*2)+"'></td></tr>");
+				flr[0].rp = 0;
+				$(tbl).append(flr);
+				//topinfo
+				flr = $("<tr style='display:none' class='tinfo'><td class='topinfo' colspan='"+(maxCols*2)+"'>"+rp_ge[$t.p.id].topinfo+"</td></tr>");
+				flr[0].rp = 0;
+				$(tbl).append(flr);
+				// set the id.
+				// use carefull only to change here colproperties.
+				// create data
+				var rtlb = $t.p.direction == "rtl" ? true :false,
+				bp = rtlb ? "nData" : "pData",
+				bn = rtlb ? "pData" : "nData";
+				createData(rowid,$t,tbl,maxCols);
+				// buttons at footer
+				var bP = "<a href='javascript:void(0)' id='"+bp+"' class='fm-button ui-state-default ui-corner-left'><span class='ui-icon ui-icon-triangle-1-w'></span></a>",
+				bN = "<a href='javascript:void(0)' id='"+bn+"' class='fm-button ui-state-default ui-corner-right'><span class='ui-icon ui-icon-triangle-1-e'></span></a>",
+				bS  ="<a href='javascript:void(0)' id='sData' class='fm-button ui-state-default ui-corner-all'>"+p.bSubmit+"</a>",
+				bC  ="<a href='javascript:void(0)' id='cData' class='fm-button ui-state-default ui-corner-all'>"+p.bCancel+"</a>";
+				var bt = "<table border='0' cellspacing='0' cellpadding='0' class='EditTable' id='"+frmtb+"_2'><tbody><tr><td colspan='2'><hr class='ui-widget-content' style='margin:1px'/></td></tr><tr id='Act_Buttons'><td class='navButton'>"+(rtlb ? bN+bP : bP+bN)+"</td><td class='EditButton'>"+bS+bC+"</td></tr>";
+				bt += "<tr style='display:none' class='binfo'><td class='bottominfo' colspan='2'>"+rp_ge[$t.p.id].bottominfo+"</td></tr>";
+				bt += "</tbody></table>";
+				if(maxRows >  0) {
+					var sd=[], div={};
+					$.each($(tbl)[0].rows,function(i,r){
+						sd[i] = r;
+					});
+					sd.sort(function(a,b){
+						if(a.rp > b.rp) {return 1;}
+						if(a.rp < b.rp) {return -1;}
+						return 0;
+					});
+					$.each(sd, function(index, row) {
+						div.html += row;
+					});
+					$('tbody',tbl).append(div.html);
+				}
+				p.gbox = "#gbox_"+gID;
+				var cle = false;
+				if(p.closeOnEscape===true){
+					p.closeOnEscape = false;
+					cle = true;
+				}
+				var tms = $("<span></span>").append(frm).append(bt);
+				$.jgrid.createModal(IDs,tms,p,"#gview_"+$t.p.id,$("#gbox_"+$t.p.id)[0]);
+				if(rtlb) {
+					$("#pData, #nData","#"+frmtb+"_2").css("float","right");
+					$(".EditButton","#"+frmtb+"_2").css("text-align","left");
+				}
+				if(rp_ge[$t.p.id].topinfo) {$(".tinfo","#"+frmtb).show();}
+				if(rp_ge[$t.p.id].bottominfo) {$(".binfo","#"+frmtb+"_2").show();}
+				tms = null;bt=null;
+				$("#"+IDs.themodal).keydown( function( e ) {
+					var wkey = e.target;
+					if ($("#"+frmgr).data("disabled")===true ) {return false;}//??
+					if(rp_ge[$t.p.id].savekey[0] === true && e.which == rp_ge[$t.p.id].savekey[1]) { // save
+						if(wkey.tagName != "TEXTAREA") {
+							$("#sData", "#"+frmtb+"_2").trigger("click");
+							return false;
+						}
+					}
+					if(e.which === 27) {
+						if(!checkUpdates()) {return false;}
+						if(cle)	{$.jgrid.hideModal(this,{gb:p.gbox,jqm:p.jqModal, onClose: rp_ge[$t.p.id].onClose});}
+						return false;
+					}
+					if(rp_ge[$t.p.id].navkeys[0]===true) {
+						if($("#id_g","#"+frmtb).val() == "_empty") {return true;}
+						if(e.which == rp_ge[$t.p.id].navkeys[1]){ //up
+							$("#pData", "#"+frmtb+"_2").trigger("click");
+							return false;
+						}
+						if(e.which == rp_ge[$t.p.id].navkeys[2]){ //down
+							$("#nData", "#"+frmtb+"_2").trigger("click");
+							return false;
+						}
+					}
+				});
+				if(p.checkOnUpdate) {
+					$("a.ui-jqdialog-titlebar-close span","#"+IDs.themodal).removeClass("jqmClose");
+					$("a.ui-jqdialog-titlebar-close","#"+IDs.themodal).unbind("click")
+					.click(function(){
+						if(!checkUpdates()) {return false;}
+						$.jgrid.hideModal("#"+IDs.themodal,{gb:"#gbox_"+gID,jqm:p.jqModal,onClose: rp_ge[$t.p.id].onClose});
+						return false;
+					});
+				}
+				p.saveicon = $.extend([true,"left","ui-icon-disk"],p.saveicon);
+				p.closeicon = $.extend([true,"left","ui-icon-close"],p.closeicon);
+				// beforeinitdata after creation of the form
+				if(p.saveicon[0]===true) {
+					$("#sData","#"+frmtb+"_2").addClass(p.saveicon[1] == "right" ? 'fm-button-icon-right' : 'fm-button-icon-left')
+					.append("<span class='ui-icon "+p.saveicon[2]+"'></span>");
+				}
+				if(p.closeicon[0]===true) {
+					$("#cData","#"+frmtb+"_2").addClass(p.closeicon[1] == "right" ? 'fm-button-icon-right' : 'fm-button-icon-left')
+					.append("<span class='ui-icon "+p.closeicon[2]+"'></span>");
+				}
+				if(rp_ge[$t.p.id].checkOnSubmit || rp_ge[$t.p.id].checkOnUpdate) {
+					bS  ="<a href='javascript:void(0)' id='sNew' class='fm-button ui-state-default ui-corner-all' style='z-index:1002'>"+p.bYes+"</a>";
+					bN  ="<a href='javascript:void(0)' id='nNew' class='fm-button ui-state-default ui-corner-all' style='z-index:1002'>"+p.bNo+"</a>";
+					bC  ="<a href='javascript:void(0)' id='cNew' class='fm-button ui-state-default ui-corner-all' style='z-index:1002'>"+p.bExit+"</a>";
+					var ii, zI = p.zIndex  || 999;zI ++;
+					if ($.browser.msie && $.browser.version ==6) {
+						ii = '<iframe style="display:block;position:absolute;z-index:-1;filter:Alpha(Opacity=\'0\');" src="javascript:false;"></iframe>';
+					} else {ii="";}
+					$("<div class='ui-widget-overlay jqgrid-overlay confirm' style='z-index:"+zI+";display:none;'>&#160;"+ii+"</div><div class='confirm ui-widget-content ui-jqconfirm' style='z-index:"+(zI+1)+"'>"+p.saveData+"<br/><br/>"+bS+bN+bC+"</div>").insertAfter("#"+frmgr);
+					$("#sNew","#"+IDs.themodal).click(function(){
+						postIt();
+						$("#"+frmgr).data("disabled",false);
+						$(".confirm","#"+IDs.themodal).hide();
+						return false;
+					});
+					$("#nNew","#"+IDs.themodal).click(function(){
+						$(".confirm","#"+IDs.themodal).hide();
+						$("#"+frmgr).data("disabled",false);
+						setTimeout(function(){$(":input","#"+frmgr)[0].focus();},0);
+						return false;
+					});
+					$("#cNew","#"+IDs.themodal).click(function(){
+						$(".confirm","#"+IDs.themodal).hide();
+						$("#"+frmgr).data("disabled",false);
+						$.jgrid.hideModal("#"+IDs.themodal,{gb:"#gbox_"+gID,jqm:p.jqModal,onClose: rp_ge[$t.p.id].onClose});
+						return false;
+					});
+				}
+				// here initform - only once
+				if(onInitializeForm) {onInitializeForm($("#"+frmgr));}
+				if(rowid=="_empty" || !rp_ge[$t.p.id].viewPagerButtons) {$("#pData,#nData","#"+frmtb+"_2").hide();} else {$("#pData,#nData","#"+frmtb+"_2").show();}
+				if(onBeforeShow) {onBeforeShow($("#"+frmgr));}
+				$("#"+IDs.themodal).data("onClose",rp_ge[$t.p.id].onClose);
+				$.jgrid.viewModal("#"+IDs.themodal,{gbox:"#gbox_"+gID,jqm:p.jqModal, overlay: p.overlay,modal:p.modal});
+				if(!closeovrl) {
+					$(".jqmOverlay").click(function(){
+						if(!checkUpdates()) {return false;}
+						$.jgrid.hideModal("#"+IDs.themodal,{gb:"#gbox_"+gID,jqm:p.jqModal, onClose: rp_ge[$t.p.id].onClose});
+						return false;
+					});
+				}
+				if(onAfterShow) {onAfterShow($("#"+frmgr));}
+				$(".fm-button","#"+IDs.themodal).hover(
+				   function(){$(this).addClass('ui-state-hover');},
+				   function(){$(this).removeClass('ui-state-hover');}
+				);
+				$("#sData", "#"+frmtb+"_2").click(function(e){
+					postdata = {};extpost={};
+					$("#FormError","#"+frmtb).hide();
+					// all depend on ret array
+					//ret[0] - succes
+					//ret[1] - msg if not succes
+					//ret[2] - the id  that will be set if reload after submit false
+					getFormData();
+					if(postdata[$t.p.id+"_id"] == "_empty")	{postIt();}
+					else if(p.checkOnSubmit===true ) {
+						newData = $.extend({},postdata,extpost);
+						diff = compareData(newData,rp_ge[$t.p.id]._savedData);
+						if(diff) {
+							$("#"+frmgr).data("disabled",true);
+							$(".confirm","#"+IDs.themodal).show();
+						} else {
+							postIt();
+						}
+					} else {
+						postIt();
+					}
+					return false;
+				});
+				$("#cData", "#"+frmtb+"_2").click(function(e){
+					if(!checkUpdates()) {return false;}
+					$.jgrid.hideModal("#"+IDs.themodal,{gb:"#gbox_"+gID,jqm:p.jqModal,onClose: rp_ge[$t.p.id].onClose});
+					return false;
+				});
+				$("#nData", "#"+frmtb+"_2").click(function(e){
+					if(!checkUpdates()) {return false;}
+					$("#FormError","#"+frmtb).hide();
+					var npos = getCurrPos();
+					npos[0] = parseInt(npos[0],10);
+					if(npos[0] != -1 && npos[1][npos[0]+1]) {
+						if($.isFunction(p.onclickPgButtons)) {
+							p.onclickPgButtons('next',$("#"+frmgr),npos[1][npos[0]]);
+						}
+						fillData(npos[1][npos[0]+1],$t,frmgr);
+						$($t).jqGrid("setSelection",npos[1][npos[0]+1]);
+						if($.isFunction(p.afterclickPgButtons)) {
+							p.afterclickPgButtons('next',$("#"+frmgr),npos[1][npos[0]+1]);
+						}
+						updateNav(npos[0]+1,npos[1].length-1);
+					}
+					return false;
+				});
+				$("#pData", "#"+frmtb+"_2").click(function(e){
+					if(!checkUpdates()) {return false;}
+					$("#FormError","#"+frmtb).hide();
+					var ppos = getCurrPos();
+					if(ppos[0] != -1 && ppos[1][ppos[0]-1]) {
+						if($.isFunction(p.onclickPgButtons)) {
+							p.onclickPgButtons('prev',$("#"+frmgr),ppos[1][ppos[0]]);
+						}
+						fillData(ppos[1][ppos[0]-1],$t,frmgr);
+						$($t).jqGrid("setSelection",ppos[1][ppos[0]-1]);
+						if($.isFunction(p.afterclickPgButtons)) {
+							p.afterclickPgButtons('prev',$("#"+frmgr),ppos[1][ppos[0]-1]);
+						}
+						updateNav(ppos[0]-1,ppos[1].length-1);
+					}
+					return false;
+				});
+			}
+			var posInit =getCurrPos();
+			updateNav(posInit[0],posInit[1].length-1);
+
+		});
+	},
+	viewGridRow : function(rowid, p){
+		p = $.extend({
+			top : 0,
+			left: 0,
+			width: 0,
+			height: 'auto',
+			dataheight: 'auto',
+			modal: false,
+			overlay: 30,
+			drag: true,
+			resize: true,
+			jqModal: true,
+			closeOnEscape : false,
+			labelswidth: '30%',
+			closeicon: [],
+			navkeys: [false,38,40],
+			onClose: null,
+			beforeShowForm : null,
+			beforeInitData : null,
+			viewPagerButtons : true
+		}, $.jgrid.view, p || {});
+		return this.each(function(){
+			var $t = this;
+			if (!$t.grid || !rowid) {return;}
+			var gID = $t.p.id,
+			frmgr = "ViewGrid_"+gID , frmtb = "ViewTbl_"+gID,
+			IDs = {themodal:'viewmod'+gID,modalhead:'viewhd'+gID,modalcontent:'viewcnt'+gID, scrollelm : frmgr},
+			onBeforeInit = $.isFunction(p.beforeInitData) ? p.beforeInitData : false,
+			showFrm = true,
+			maxCols = 1, maxRows=0;
+			function focusaref(){ //Sfari 3 issues
+				if(p.closeOnEscape===true || p.navkeys[0]===true) {
+					setTimeout(function(){$(".ui-jqdialog-titlebar-close","#"+IDs.modalhead).focus();},0);
+				}
+			}
+			function createData(rowid,obj,tb,maxcols){
+				var nm, hc,trdata, cnt=0,tmp, dc, retpos=[], ind=false,
+				tdtmpl = "<td class='CaptionTD form-view-label ui-widget-content' width='"+p.labelswidth+"'>&#160;</td><td class='DataTD form-view-data ui-helper-reset ui-widget-content'>&#160;</td>", tmpl="",
+				tdtmpl2 = "<td class='CaptionTD form-view-label ui-widget-content'>&#160;</td><td class='DataTD form-view-data ui-widget-content'>&#160;</td>",
+				fmtnum = ['integer','number','currency'],max1 =0, max2=0 ,maxw,setme, viewfld;
+				for (var i =1;i<=maxcols;i++) {
+					tmpl += i == 1 ? tdtmpl : tdtmpl2;
+				}
+				// find max number align rigth with property formatter
+				$(obj.p.colModel).each( function(i) {
+					if(this.editrules && this.editrules.edithidden === true) {
+						hc = false;
+					} else {
+						hc = this.hidden === true ? true : false;
+					}
+					if(!hc && this.align==='right') {
+						if(this.formatter && $.inArray(this.formatter,fmtnum) !== -1 ) {
+							max1 = Math.max(max1,parseInt(this.width,10));
+						} else {
+							max2 = Math.max(max2,parseInt(this.width,10));
+						}
+					}
+				});
+				maxw  = max1 !==0 ? max1 : max2 !==0 ? max2 : 0;
+				ind = $(obj).jqGrid("getInd",rowid);
+				$(obj.p.colModel).each( function(i) {
+					nm = this.name;
+					setme = false;
+					// hidden fields are included in the form
+					if(this.editrules && this.editrules.edithidden === true) {
+						hc = false;
+					} else {
+						hc = this.hidden === true ? true : false;
+					}
+					dc = hc ? "style='display:none'" : "";
+					viewfld = (typeof this.viewable != 'boolean') ? true : this.viewable;
+					if ( nm !== 'cb' && nm !== 'subgrid' && nm !== 'rn' && viewfld) {
+						if(ind === false) {
+							tmp = "";
+						} else {
+							if(nm == obj.p.ExpandColumn && obj.p.treeGrid === true) {
+								tmp = $("td:eq("+i+")",obj.rows[ind]).text();
+							} else {
+								tmp = $("td:eq("+i+")",obj.rows[ind]).html();
+							}
+						}
+						setme = this.align === 'right' && maxw !==0 ? true : false;
+						var opt = $.extend({}, this.editoptions || {} ,{id:nm,name:nm}),
+						frmopt = $.extend({},{rowabove:false,rowcontent:''}, this.formoptions || {}),
+						rp = parseInt(frmopt.rowpos,10) || cnt+1,
+						cp = parseInt((parseInt(frmopt.colpos,10) || 1)*2,10);
+						if(frmopt.rowabove) {
+							var newdata = $("<tr><td class='contentinfo' colspan='"+(maxcols*2)+"'>"+frmopt.rowcontent+"</td></tr>");
+							$(tb).append(newdata);
+							newdata[0].rp = rp;
+						}
+						trdata = $(tb).find("tr[rowpos="+rp+"]");
+						if ( trdata.length===0 ) {
+							trdata = $("<tr "+dc+" rowpos='"+rp+"'></tr>").addClass("FormData").attr("id","trv_"+nm);
+							$(trdata).append(tmpl);
+							$(tb).append(trdata);
+							trdata[0].rp = rp;
+						}
+						$("td:eq("+(cp-2)+")",trdata[0]).html('<b>'+ (typeof frmopt.label === 'undefined' ? obj.p.colNames[i]: frmopt.label)+'</b>');
+						$("td:eq("+(cp-1)+")",trdata[0]).append("<span>"+tmp+"</span>").attr("id","v_"+nm);
+						if(setme){
+							$("td:eq("+(cp-1)+") span",trdata[0]).css({'text-align':'right',width:maxw+"px"});
+						}
+						retpos[cnt] = i;
+						cnt++;
+					}
+				});
+				if( cnt > 0) {
+					var idrow = $("<tr class='FormData' style='display:none'><td class='CaptionTD'></td><td colspan='"+ (maxcols*2-1)+"' class='DataTD'><input class='FormElement' id='id_g' type='text' name='id' value='"+rowid+"'/></td></tr>");
+					idrow[0].rp = cnt+99;
+					$(tb).append(idrow);
+				}
+				return retpos;
+			}
+			function fillData(rowid,obj){
+				var nm, hc,cnt=0,tmp, opt,trv;
+				trv = $(obj).jqGrid("getInd",rowid,true);
+				if(!trv) {return;}
+				$('td',trv).each( function(i) {
+					nm = obj.p.colModel[i].name;
+					// hidden fields are included in the form
+					if(obj.p.colModel[i].editrules && obj.p.colModel[i].editrules.edithidden === true) {
+						hc = false;
+					} else {
+						hc = obj.p.colModel[i].hidden === true ? true : false;
+					}
+					if ( nm !== 'cb' && nm !== 'subgrid' && nm !== 'rn') {
+						if(nm == obj.p.ExpandColumn && obj.p.treeGrid === true) {
+							tmp = $(this).text();
+						} else {
+							tmp = $(this).html();
+						}
+						opt = $.extend({},obj.p.colModel[i].editoptions || {});
+						nm = $.jgrid.jqID("v_"+nm);
+						$("#"+nm+" span","#"+frmtb).html(tmp);
+						if (hc) {$("#"+nm,"#"+frmtb).parents("tr:first").hide();}
+						cnt++;
+					}
+				});
+				if(cnt>0) {$("#id_g","#"+frmtb).val(rowid);}
+			}
+			function updateNav(cr,totr){
+				if (cr===0) {$("#pData","#"+frmtb+"_2").addClass('ui-state-disabled');} else {$("#pData","#"+frmtb+"_2").removeClass('ui-state-disabled');}
+				if (cr==totr) {$("#nData","#"+frmtb+"_2").addClass('ui-state-disabled');} else {$("#nData","#"+frmtb+"_2").removeClass('ui-state-disabled');}
+			}
+			function getCurrPos() {
+				var rowsInGrid = $($t).jqGrid("getDataIDs"),
+				selrow = $("#id_g","#"+frmtb).val(),
+				pos = $.inArray(selrow,rowsInGrid);
+				return [pos,rowsInGrid];
+			}
+
+			if ( $("#"+IDs.themodal).html() !== null ) {
+				if(onBeforeInit) {
+					showFrm = onBeforeInit($("#"+frmgr));
+					if(typeof(showFrm) == "undefined") {
+						showFrm = true;
+					}
+				}
+				if(showFrm === false) {return;}
+				$(".ui-jqdialog-title","#"+IDs.modalhead).html(p.caption);
+				$("#FormError","#"+frmtb).hide();
+				fillData(rowid,$t);
+				if($.isFunction(p.beforeShowForm)) {p.beforeShowForm($("#"+frmgr));}
+				$.jgrid.viewModal("#"+IDs.themodal,{gbox:"#gbox_"+gID,jqm:p.jqModal, jqM: false, overlay: p.overlay, modal:p.modal});
+				focusaref();
+			} else {
+				var dh = isNaN(p.dataheight) ? p.dataheight : p.dataheight+"px";
+				var frm = $("<form name='FormPost' id='"+frmgr+"' class='FormGrid' style='width:100%;overflow:auto;position:relative;height:"+dh+";'></form>"),
+				tbl =$("<table id='"+frmtb+"' class='EditTable' cellspacing='1' cellpadding='2' border='0' style='table-layout:fixed'><tbody></tbody></table>");
+				if(onBeforeInit) {
+					showFrm = onBeforeInit($("#"+frmgr));
+					if(typeof(showFrm) == "undefined") {
+						showFrm = true;
+					}
+				}
+				if(showFrm === false) {return;}
+				$($t.p.colModel).each( function(i) {
+					var fmto = this.formoptions;
+					maxCols = Math.max(maxCols, fmto ? fmto.colpos || 0 : 0 );
+					maxRows = Math.max(maxRows, fmto ? fmto.rowpos || 0 : 0 );
+				});
+				// set the id.
+				$(frm).append(tbl);
+				createData(rowid, $t, tbl, maxCols);
+				var rtlb = $t.p.direction == "rtl" ? true :false,
+				bp = rtlb ? "nData" : "pData",
+				bn = rtlb ? "pData" : "nData",
+
+				// buttons at footer
+				bP = "<a href='javascript:void(0)' id='"+bp+"' class='fm-button ui-state-default ui-corner-left'><span class='ui-icon ui-icon-triangle-1-w'></span></a>",
+				bN = "<a href='javascript:void(0)' id='"+bn+"' class='fm-button ui-state-default ui-corner-right'><span class='ui-icon ui-icon-triangle-1-e'></span></a>",
+				bC  ="<a href='javascript:void(0)' id='cData' class='fm-button ui-state-default ui-corner-all'>"+p.bClose+"</a>";
+				if(maxRows >  0) {
+					var sd=[];
+					$.each($(tbl)[0].rows,function(i,r){
+						sd[i] = r;
+					});
+					sd.sort(function(a,b){
+						if(a.rp > b.rp) {return 1;}
+						if(a.rp < b.rp) {return -1;}
+						return 0;
+					});
+					$.each(sd, function(index, row) {
+						$('tbody',tbl).append(row);
+					});
+				}
+				p.gbox = "#gbox_"+gID;
+				var cle = false;
+				if(p.closeOnEscape===true){
+					p.closeOnEscape = false;
+					cle = true;
+				}
+				var bt = $("<span></span>").append(frm).append("<table border='0' class='EditTable' id='"+frmtb+"_2'><tbody><tr id='Act_Buttons'><td class='navButton' width='"+p.labelswidth+"'>"+(rtlb ? bN+bP : bP+bN)+"</td><td class='EditButton'>"+bC+"</td></tr></tbody></table>");
+				$.jgrid.createModal(IDs,bt,p,"#gview_"+$t.p.id,$("#gview_"+$t.p.id)[0]);
+				if(rtlb) {
+					$("#pData, #nData","#"+frmtb+"_2").css("float","right");
+					$(".EditButton","#"+frmtb+"_2").css("text-align","left");
+				}
+				if(!p.viewPagerButtons) {$("#pData, #nData","#"+frmtb+"_2").hide();}
+				bt = null;
+				$("#"+IDs.themodal).keydown( function( e ) {
+					if(e.which === 27) {
+						if(cle)	{$.jgrid.hideModal(this,{gb:p.gbox,jqm:p.jqModal, onClose: p.onClose});}
+						return false;
+					}
+					if(p.navkeys[0]===true) {
+						if(e.which === p.navkeys[1]){ //up
+							$("#pData", "#"+frmtb+"_2").trigger("click");
+							return false;
+						}
+						if(e.which === p.navkeys[2]){ //down
+							$("#nData", "#"+frmtb+"_2").trigger("click");
+							return false;
+						}
+					}
+				});
+				p.closeicon = $.extend([true,"left","ui-icon-close"],p.closeicon);
+				if(p.closeicon[0]===true) {
+					$("#cData","#"+frmtb+"_2").addClass(p.closeicon[1] == "right" ? 'fm-button-icon-right' : 'fm-button-icon-left')
+					.append("<span class='ui-icon "+p.closeicon[2]+"'></span>");
+				}
+				if($.isFunction(p.beforeShowForm)) {p.beforeShowForm($("#"+frmgr));}
+				$.jgrid.viewModal("#"+IDs.themodal,{gbox:"#gbox_"+gID,jqm:p.jqModal, modal:p.modal});
+				$(".fm-button:not(.ui-state-disabled)","#"+frmtb+"_2").hover(
+				   function(){$(this).addClass('ui-state-hover');},
+				   function(){$(this).removeClass('ui-state-hover');}
+				);
+				focusaref();
+				$("#cData", "#"+frmtb+"_2").click(function(e){
+					$.jgrid.hideModal("#"+IDs.themodal,{gb:"#gbox_"+gID,jqm:p.jqModal, onClose: p.onClose});
+					return false;
+				});
+				$("#nData", "#"+frmtb+"_2").click(function(e){
+					$("#FormError","#"+frmtb).hide();
+					var npos = getCurrPos();
+					npos[0] = parseInt(npos[0],10);
+					if(npos[0] != -1 && npos[1][npos[0]+1]) {
+						if($.isFunction(p.onclickPgButtons)) {
+							p.onclickPgButtons('next',$("#"+frmgr),npos[1][npos[0]]);
+						}
+						fillData(npos[1][npos[0]+1],$t);
+						$($t).jqGrid("setSelection",npos[1][npos[0]+1]);
+						if($.isFunction(p.afterclickPgButtons)) {
+							p.afterclickPgButtons('next',$("#"+frmgr),npos[1][npos[0]+1]);
+						}
+						updateNav(npos[0]+1,npos[1].length-1);
+					}
+					focusaref();
+					return false;
+				});
+				$("#pData", "#"+frmtb+"_2").click(function(e){
+					$("#FormError","#"+frmtb).hide();
+					var ppos = getCurrPos();
+					if(ppos[0] != -1 && ppos[1][ppos[0]-1]) {
+						if($.isFunction(p.onclickPgButtons)) {
+							p.onclickPgButtons('prev',$("#"+frmgr),ppos[1][ppos[0]]);
+						}
+						fillData(ppos[1][ppos[0]-1],$t);
+						$($t).jqGrid("setSelection",ppos[1][ppos[0]-1]);
+						if($.isFunction(p.afterclickPgButtons)) {
+							p.afterclickPgButtons('prev',$("#"+frmgr),ppos[1][ppos[0]-1]);
+						}
+						updateNav(ppos[0]-1,ppos[1].length-1);
+					}
+					focusaref();
+					return false;
+				});
+			}
+			var posInit =getCurrPos();
+			updateNav(posInit[0],posInit[1].length-1);
+		});
+	},
+	delGridRow : function(rowids,p) {
+		p = $.extend({
+			top : 0,
+			left: 0,
+			width: 240,
+			height: 'auto',
+			dataheight : 'auto',
+			modal: false,
+			overlay: 30,
+			drag: true,
+			resize: true,
+			url : '',
+			mtype : "POST",
+			reloadAfterSubmit: true,
+			beforeShowForm: null,
+			beforeInitData : null,
+			afterShowForm: null,
+			beforeSubmit: null,
+			onclickSubmit: null,
+			afterSubmit: null,
+			jqModal : true,
+			closeOnEscape : false,
+			delData: {},
+			delicon : [],
+			cancelicon : [],
+			onClose : null,
+			ajaxDelOptions : {},
+			processing : false,
+			serializeDelData : null,
+			useDataProxy : false
+		}, $.jgrid.del, p ||{});
+		rp_ge[$(this)[0].p.id] = p;
+		return this.each(function(){
+			var $t = this;
+			if (!$t.grid ) {return;}
+			if(!rowids) {return;}
+			var onBeforeShow = $.isFunction( rp_ge[$t.p.id].beforeShowForm  ),
+			onAfterShow = $.isFunction( rp_ge[$t.p.id].afterShowForm ),
+			onBeforeInit = $.isFunction(rp_ge[$t.p.id].beforeInitData) ? rp_ge[$t.p.id].beforeInitData : false,
+			gID = $t.p.id, onCS = {},
+			showFrm = true,
+			dtbl = "DelTbl_"+gID,postd, idname, opers, oper,
+			IDs = {themodal:'delmod'+gID,modalhead:'delhd'+gID,modalcontent:'delcnt'+gID, scrollelm: dtbl};
+			if (jQuery.isArray(rowids)) {rowids = rowids.join();}
+			if ( $("#"+IDs.themodal).html() !== null ) {
+				if(onBeforeInit) {
+					showFrm = onBeforeInit( $("#"+dtbl));
+					if(typeof(showFrm) == "undefined") {
+						showFrm = true;
+					}
+				}
+				if(showFrm === false) {return;}
+				$("#DelData>td","#"+dtbl).text(rowids);
+				$("#DelError","#"+dtbl).hide();
+				if( rp_ge[$t.p.id].processing === true) {
+					rp_ge[$t.p.id].processing=false;
+					$("#dData", "#"+dtbl).removeClass('ui-state-active');
+				}
+				if(onBeforeShow) {rp_ge[$t.p.id].beforeShowForm($("#"+dtbl));}
+				$.jgrid.viewModal("#"+IDs.themodal,{gbox:"#gbox_"+gID,jqm:rp_ge[$t.p.id].jqModal,jqM: false, overlay: rp_ge[$t.p.id].overlay, modal:rp_ge[$t.p.id].modal});
+				if(onAfterShow) {rp_ge[$t.p.id].afterShowForm($("#"+dtbl));}
+			} else {
+				var dh = isNaN(rp_ge[$t.p.id].dataheight) ? rp_ge[$t.p.id].dataheight : rp_ge[$t.p.id].dataheight+"px";
+				var tbl = "<div id='"+dtbl+"' class='formdata' style='width:100%;overflow:auto;position:relative;height:"+dh+";'>";
+				tbl += "<table class='DelTable'><tbody>";
+				// error data
+				tbl += "<tr id='DelError' style='display:none'><td class='ui-state-error'></td></tr>";
+				tbl += "<tr id='DelData' style='display:none'><td >"+rowids+"</td></tr>";
+				tbl += "<tr><td class=\"delmsg\" style=\"white-space:pre;\">"+rp_ge[$t.p.id].msg+"</td></tr><tr><td >&#160;</td></tr>";
+				// buttons at footer
+				tbl += "</tbody></table></div>";
+				var bS  = "<a href='javascript:void(0)' id='dData' class='fm-button ui-state-default ui-corner-all'>"+p.bSubmit+"</a>",
+				bC  = "<a href='javascript:void(0)' id='eData' class='fm-button ui-state-default ui-corner-all'>"+p.bCancel+"</a>";
+				tbl += "<table cellspacing='0' cellpadding='0' border='0' class='EditTable' id='"+dtbl+"_2'><tbody><tr><td><hr class='ui-widget-content' style='margin:1px'/></td></tr><tr><td class='DelButton EditButton'>"+bS+"&#160;"+bC+"</td></tr></tbody></table>";
+				p.gbox = "#gbox_"+gID;
+				$.jgrid.createModal(IDs,tbl,p,"#gview_"+$t.p.id,$("#gview_"+$t.p.id)[0]);
+
+				if(onBeforeInit) {
+					showFrm = onBeforeInit( $("#"+dtbl) );
+					if(typeof(showFrm) == "undefined") {
+						showFrm = true;
+					}
+				}
+				if(showFrm === false) {return;}
+
+				$(".fm-button","#"+dtbl+"_2").hover(
+				   function(){$(this).addClass('ui-state-hover');},
+				   function(){$(this).removeClass('ui-state-hover');}
+				);
+				p.delicon = $.extend([true,"left","ui-icon-scissors"],rp_ge[$t.p.id].delicon);
+				p.cancelicon = $.extend([true,"left","ui-icon-cancel"],rp_ge[$t.p.id].cancelicon);
+				if(p.delicon[0]===true) {
+					$("#dData","#"+dtbl+"_2").addClass(p.delicon[1] == "right" ? 'fm-button-icon-right' : 'fm-button-icon-left')
+					.append("<span class='ui-icon "+p.delicon[2]+"'></span>");
+				}
+				if(p.cancelicon[0]===true) {
+					$("#eData","#"+dtbl+"_2").addClass(p.cancelicon[1] == "right" ? 'fm-button-icon-right' : 'fm-button-icon-left')
+					.append("<span class='ui-icon "+p.cancelicon[2]+"'></span>");
+				}
+				$("#dData","#"+dtbl+"_2").click(function(e){
+					var ret=[true,""];onCS = {};
+					var postdata = $("#DelData>td","#"+dtbl).text(); //the pair is name=val1,val2,...
+					if( $.isFunction( rp_ge[$t.p.id].onclickSubmit ) ) {onCS = rp_ge[$t.p.id].onclickSubmit(rp_ge[$t.p.id], postdata) || {} }
+					if( $.isFunction( rp_ge[$t.p.id].beforeSubmit ) ) {ret = rp_ge[$t.p.id].beforeSubmit(postdata);}
+					if(ret[0] && !rp_ge[$t.p.id].processing) {
+						rp_ge[$t.p.id].processing = true;
+						$(this).addClass('ui-state-active');
+						opers = $t.p.prmNames;
+						postd = $.extend({},rp_ge[$t.p.id].delData, onCS);
+						oper = opers.oper;
+						postd[oper] = opers.deloper;
+						idname = opers.id;
+						postdata = postdata.split(",");
+						for( var pk in postdata) {
+							if(postdata.hasOwnProperty(pk)) {
+								postdata[pk] = $.jgrid.stripPref($t.p.idPrefix, postdata[pk]);
+							}
+						}
+						postd[idname] = postdata.join();
+						
+						var ajaxOptions = $.extend({
+							url: rp_ge[$t.p.id].url ? rp_ge[$t.p.id].url : $($t).jqGrid('getGridParam','editurl'),
+							type: rp_ge[$t.p.id].mtype,
+							data: $.isFunction(rp_ge[$t.p.id].serializeDelData) ? rp_ge[$t.p.id].serializeDelData(postd) : postd,
+							complete:function(data,Status){
+								if(Status != "success") {
+									ret[0] = false;
+									if ($.isFunction(rp_ge[$t.p.id].errorTextFormat)) {
+										ret[1] = rp_ge[$t.p.id].errorTextFormat(data);
+									} else {
+										ret[1] = Status + " Status: '" + data.statusText + "'. Error code: " + data.status;
+									}
+								} else {
+									// data is posted successful
+									// execute aftersubmit with the returned data from server
+									if( $.isFunction( rp_ge[$t.p.id].afterSubmit ) ) {
+										ret = rp_ge[$t.p.id].afterSubmit(data,postd);
+									}
+								}
+								if(ret[0] === false) {
+									$("#DelError>td","#"+dtbl).html(ret[1]);
+									$("#DelError","#"+dtbl).show();
+								} else {
+									if(rp_ge[$t.p.id].reloadAfterSubmit && $t.p.datatype != "local") {
+										$($t).trigger("reloadGrid");
+									} else {
+										var toarr = [];
+										toarr = postdata.split(",");
+										if($t.p.treeGrid===true){
+												try {$($t).jqGrid("delTreeNode",$t.p.idPrefix+toarr[0]);} catch(e){}
+										} else {
+											for(var i=0;i<toarr.length;i++) {
+												$($t).jqGrid("delRowData",$t.p.idPrefix+ toarr[i]);
+											}
+										}
+										$t.p.selrow = null;
+										$t.p.selarrrow = [];
+									}
+									if($.isFunction(rp_ge[$t.p.id].afterComplete)) {
+										setTimeout(function(){rp_ge[$t.p.id].afterComplete(data,postdata);},500);
+									}
+								}
+								rp_ge[$t.p.id].processing=false;
+								$("#dData", "#"+dtbl+"_2").removeClass('ui-state-active');
+								if(ret[0]) {$.jgrid.hideModal("#"+IDs.themodal,{gb:"#gbox_"+gID,jqm:p.jqModal, onClose: rp_ge[$t.p.id].onClose});}
+							}
+						}, $.jgrid.ajaxOptions, rp_ge[$t.p.id].ajaxDelOptions);
+
+
+						if (!ajaxOptions.url && !rp_ge[$t.p.id].useDataProxy) {
+							if ($.isFunction($t.p.dataProxy)) {
+								rp_ge[$t.p.id].useDataProxy = true;
+							} else {
+								ret[0]=false;ret[1] += " "+$.jgrid.errors.nourl;
+							}
+						}
+						if (ret[0]) {
+							if (rp_ge[$t.p.id].useDataProxy) {
+								var dpret = $t.p.dataProxy.call($t, ajaxOptions, "del_"+$t.p.id); 
+								if(typeof(dpret) == "undefined") {
+									dpret = [true, ""];
+								}
+								if(dpret[0] === false ) {
+									ret[0] = false;
+									ret[1] = dpret[1] || "Error deleting the selected row!" 
+								} else {
+									$.jgrid.hideModal("#"+IDs.themodal,{gb:"#gbox_"+gID,jqm:p.jqModal, onClose: rp_ge[$t.p.id].onClose});
+								}
+							}
+							else {$.ajax(ajaxOptions);}
+						}
+					}
+
+					if(ret[0] === false) {
+						$("#DelError>td","#"+dtbl).html(ret[1]);
+						$("#DelError","#"+dtbl).show();
+					}
+					return false;
+				});
+				$("#eData", "#"+dtbl+"_2").click(function(e){
+					$.jgrid.hideModal("#"+IDs.themodal,{gb:"#gbox_"+gID,jqm:rp_ge[$t.p.id].jqModal, onClose: rp_ge[$t.p.id].onClose});
+					return false;
+				});
+				if(onBeforeShow) {rp_ge[$t.p.id].beforeShowForm($("#"+dtbl));}
+				$.jgrid.viewModal("#"+IDs.themodal,{gbox:"#gbox_"+gID,jqm:rp_ge[$t.p.id].jqModal, overlay: rp_ge[$t.p.id].overlay, modal:rp_ge[$t.p.id].modal});
+				if(onAfterShow) {rp_ge[$t.p.id].afterShowForm($("#"+dtbl));}
+			}
+			if(rp_ge[$t.p.id].closeOnEscape===true) {
+				setTimeout(function(){$(".ui-jqdialog-titlebar-close","#"+IDs.modalhead).focus();},0);
+			}
+		});
+	},
+	navGrid : function (elem, o, pEdit,pAdd,pDel,pSearch, pView) {
+		o = $.extend({
+			edit: true,
+			editicon: "ui-icon-pencil",
+			add: true,
+			addicon:"ui-icon-plus",
+			del: true,
+			delicon:"ui-icon-trash",
+			search: true,
+			searchicon:"ui-icon-search",
+			refresh: true,
+			refreshicon:"ui-icon-refresh",
+			refreshstate: 'firstpage',
+			view: false,
+			viewicon : "ui-icon-document",
+			position : "left",
+			closeOnEscape : true,
+			beforeRefresh : null,
+			afterRefresh : null,
+			cloneToTop : false,
+			alertwidth : 200,
+			alertheight : 'auto',
+			alerttop: null,
+			alertleft: null,
+			alertzIndex : null
+		}, $.jgrid.nav, o ||{});
+		return this.each(function() {
+			if(this.nav) {return;}
+			var alertIDs = {themodal:'alertmod',modalhead:'alerthd',modalcontent:'alertcnt'},
+			$t = this, twd, tdw;
+			if(!$t.grid || typeof elem != 'string') {return;}
+			if ($("#"+alertIDs.themodal).html() === null) {
+				if(!o.alerttop && !o.alertleft) {
+					if (typeof window.innerWidth != 'undefined') {
+						o.alertleft = window.innerWidth;
+						o.alerttop = window.innerHeight;
+					} else if (typeof document.documentElement != 'undefined' && typeof document.documentElement.clientWidth != 'undefined' && document.documentElement.clientWidth !== 0) {
+						o.alertleft = document.documentElement.clientWidth;
+						o.alerttop = document.documentElement.clientHeight;
+					} else {
+						o.alertleft=1024;
+						o.alerttop=768;
+					}
+					o.alertleft = o.alertleft/2 - parseInt(o.alertwidth,10)/2;
+					o.alerttop = o.alerttop/2-25;
+				}
+				$.jgrid.createModal(alertIDs,"<div>"+o.alerttext+"</div><span tabindex='0'><span tabindex='-1' id='jqg_alrt'></span></span>",{gbox:"#gbox_"+$t.p.id,jqModal:true,drag:true,resize:true,caption:o.alertcap,top:o.alerttop,left:o.alertleft,width:o.alertwidth,height: o.alertheight,closeOnEscape:o.closeOnEscape, zIndex: o.alertzIndex},"","",true);
+			}
+			var clone = 1;
+			if(o.cloneToTop && $t.p.toppager) {clone = 2;}
+			for(var i = 0; i<clone; i++) {
+				var tbd,
+				navtbl = $("<table cellspacing='0' cellpadding='0' border='0' class='ui-pg-table navtable' style='float:left;table-layout:auto;'><tbody><tr></tr></tbody></table>"),
+				sep = "<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='ui-separator'></span></td>",
+				pgid, elemids;
+				if(i===0) {
+					pgid = elem;
+					elemids = $t.p.id;
+					if(pgid == $t.p.toppager) {
+						elemids += "_top";
+						clone = 1;
+					}
+				} else {
+					pgid = $t.p.toppager;
+					elemids = $t.p.id+"_top";
+				}
+				if($t.p.direction == "rtl") {$(navtbl).attr("dir","rtl").css("float","right");}
+				if (o.add) {
+					pAdd = pAdd || {};
+					tbd = $("<td class='ui-pg-button ui-corner-all'></td>");
+					$(tbd).append("<div class='ui-pg-div'><span class='ui-icon "+o.addicon+"'></span>"+o.addtext+"</div>");
+					$("tr",navtbl).append(tbd);
+					$(tbd,navtbl)
+					.attr({"title":o.addtitle || "",id : pAdd.id || "add_"+elemids})
+					.click(function(){
+						if (!$(this).hasClass('ui-state-disabled')) {
+							if ($.isFunction( o.addfunc )) {
+								o.addfunc();
+							} else {
+								$($t).jqGrid("editGridRow","new",pAdd);
+							}
+						}
+						return false;
+					}).hover(
+						function () {
+							if (!$(this).hasClass('ui-state-disabled')) {
+								$(this).addClass("ui-state-hover");
+							}
+						},
+						function () {$(this).removeClass("ui-state-hover");}
+					);
+					tbd = null;
+				}
+				if (o.edit) {
+					tbd = $("<td class='ui-pg-button ui-corner-all'></td>");
+					pEdit = pEdit || {};
+					$(tbd).append("<div class='ui-pg-div'><span class='ui-icon "+o.editicon+"'></span>"+o.edittext+"</div>");
+					$("tr",navtbl).append(tbd);
+					$(tbd,navtbl)
+					.attr({"title":o.edittitle || "",id: pEdit.id || "edit_"+elemids})
+					.click(function(){
+						if (!$(this).hasClass('ui-state-disabled')) {
+							var sr = $t.p.selrow;
+							if (sr) {
+								if($.isFunction( o.editfunc ) ) {
+									o.editfunc(sr);
+								} else {
+									$($t).jqGrid("editGridRow",sr,pEdit);
+								}
+							} else {
+								$.jgrid.viewModal("#"+alertIDs.themodal,{gbox:"#gbox_"+$t.p.id,jqm:true});
+								$("#jqg_alrt").focus();
+							}
+						}
+						return false;
+					}).hover(
+						function () {
+							if (!$(this).hasClass('ui-state-disabled')) {
+								$(this).addClass("ui-state-hover");
+							}
+						},
+						function () {$(this).removeClass("ui-state-hover");}
+					);
+					tbd = null;
+				}
+				if (o.view) {
+					tbd = $("<td class='ui-pg-button ui-corner-all'></td>");
+					pView = pView || {};
+					$(tbd).append("<div class='ui-pg-div'><span class='ui-icon "+o.viewicon+"'></span>"+o.viewtext+"</div>");
+					$("tr",navtbl).append(tbd);
+					$(tbd,navtbl)
+					.attr({"title":o.viewtitle || "",id: pView.id || "view_"+elemids})
+					.click(function(){
+						if (!$(this).hasClass('ui-state-disabled')) {
+							var sr = $t.p.selrow;
+							if (sr) {
+								if($.isFunction( o.viewfunc ) ) {
+									o.viewfunc(sr);
+								} else {
+									$($t).jqGrid("viewGridRow",sr,pView);
+								}
+							} else {
+								$.jgrid.viewModal("#"+alertIDs.themodal,{gbox:"#gbox_"+$t.p.id,jqm:true});
+								$("#jqg_alrt").focus();
+							}
+						}
+						return false;
+					}).hover(
+						function () {
+							if (!$(this).hasClass('ui-state-disabled')) {
+								$(this).addClass("ui-state-hover");
+							}
+						},
+						function () {$(this).removeClass("ui-state-hover");}
+					);
+					tbd = null;
+				}
+				if (o.del) {
+					tbd = $("<td class='ui-pg-button ui-corner-all'></td>");
+					pDel = pDel || {};
+					$(tbd).append("<div class='ui-pg-div'><span class='ui-icon "+o.delicon+"'></span>"+o.deltext+"</div>");
+					$("tr",navtbl).append(tbd);
+					$(tbd,navtbl)
+					.attr({"title":o.deltitle || "",id: pDel.id || "del_"+elemids})
+					.click(function(){
+						if (!$(this).hasClass('ui-state-disabled')) {
+							var dr;
+							if($t.p.multiselect) {
+								dr = $t.p.selarrrow;
+								if(dr.length===0) {dr = null;}
+							} else {
+								dr = $t.p.selrow;
+							}
+							if(dr){
+								if("function" == typeof o.delfunc){
+									o.delfunc(dr);
+								}else{
+									$($t).jqGrid("delGridRow",dr,pDel);
+								}
+							} else  {
+								$.jgrid.viewModal("#"+alertIDs.themodal,{gbox:"#gbox_"+$t.p.id,jqm:true});$("#jqg_alrt").focus();
+							}
+						}
+						return false;
+					}).hover(
+						function () {
+							if (!$(this).hasClass('ui-state-disabled')) {
+								$(this).addClass("ui-state-hover");
+							}
+						},
+						function () {$(this).removeClass("ui-state-hover");}
+					);
+					tbd = null;
+				}
+				if(o.add || o.edit || o.del || o.view) {$("tr",navtbl).append(sep);}
+				if (o.search) {
+					tbd = $("<td class='ui-pg-button ui-corner-all'></td>");
+					pSearch = pSearch || {};
+					$(tbd).append("<div class='ui-pg-div'><span class='ui-icon "+o.searchicon+"'></span>"+o.searchtext+"</div>");
+					$("tr",navtbl).append(tbd);
+					$(tbd,navtbl)
+					.attr({"title":o.searchtitle  || "",id:pSearch.id || "search_"+elemids})
+					.click(function(){
+						if (!$(this).hasClass('ui-state-disabled')) {
+							$($t).jqGrid("searchGrid",pSearch);
+						}
+						return false;
+					}).hover(
+						function () {
+							if (!$(this).hasClass('ui-state-disabled')) {
+								$(this).addClass("ui-state-hover");
+							}
+						},
+						function () {$(this).removeClass("ui-state-hover");}
+					);
+					if (pSearch.showOnLoad && pSearch.showOnLoad === true)
+						$(tbd,navtbl).click();
+					tbd = null;
+				}
+				if (o.refresh) {
+					tbd = $("<td class='ui-pg-button ui-corner-all'></td>");
+					$(tbd).append("<div class='ui-pg-div'><span class='ui-icon "+o.refreshicon+"'></span>"+o.refreshtext+"</div>");
+					$("tr",navtbl).append(tbd);
+					$(tbd,navtbl)
+					.attr({"title":o.refreshtitle  || "",id: "refresh_"+elemids})
+					.click(function(){
+						if (!$(this).hasClass('ui-state-disabled')) {
+							if($.isFunction(o.beforeRefresh)) {o.beforeRefresh();}
+							$t.p.search = false;
+							try {
+								var gID = $t.p.id;
+								$t.p.postData.filters ="";
+								$("#fbox_"+gID).jqFilter('resetFilter');
+							    if($.isFunction($t.clearToolbar)) {$t.clearToolbar(false);}
+							} catch (e) {}
+							switch (o.refreshstate) {
+								case 'firstpage':
+								    $($t).trigger("reloadGrid", [{page:1}]);
+									break;
+								case 'current':
+								    $($t).trigger("reloadGrid", [{current:true}]);
+									break;
+							}
+							if($.isFunction(o.afterRefresh)) {o.afterRefresh();}
+						}
+						return false;
+					}).hover(
+						function () {
+							if (!$(this).hasClass('ui-state-disabled')) {
+								$(this).addClass("ui-state-hover");
+							}
+						},
+						function () {$(this).removeClass("ui-state-hover");}
+					);
+					tbd = null;
+				}
+				tdw = $(".ui-jqgrid").css("font-size") || "11px";
+				$('body').append("<div id='testpg2' class='ui-jqgrid ui-widget ui-widget-content' style='font-size:"+tdw+";visibility:hidden;' ></div>");
+				twd = $(navtbl).clone().appendTo("#testpg2").width();
+				$("#testpg2").remove();
+				$(pgid+"_"+o.position,pgid).append(navtbl);
+				if($t.p._nvtd) {
+					if(twd > $t.p._nvtd[0] ) {
+						$(pgid+"_"+o.position,pgid).width(twd);
+						$t.p._nvtd[0] = twd;
+					}
+					$t.p._nvtd[1] = twd;
+				}
+				tdw =null;twd=null;navtbl =null;
+				this.nav = true;
+			}
+		});
+	},
+	navButtonAdd : function (elem, p) {
+		p = $.extend({
+			caption : "newButton",
+			title: '',
+			buttonicon : 'ui-icon-newwin',
+			onClickButton: null,
+			position : "last",
+			cursor : 'pointer'
+		}, p ||{});
+		return this.each(function() {
+			if( !this.grid)  {return;}
+			if( elem.indexOf("#") !== 0) {elem = "#"+elem;}
+			var findnav = $(".navtable",elem)[0], $t = this;
+			if (findnav) {
+				if( p.id && $("#"+p.id, findnav).html() !== null )  {return;}
+				var tbd = $("<td></td>");
+				if(p.buttonicon.toString().toUpperCase() == "NONE") {
+                    $(tbd).addClass('ui-pg-button ui-corner-all').append("<div class='ui-pg-div'>"+p.caption+"</div>");
+				} else	{
+					$(tbd).addClass('ui-pg-button ui-corner-all').append("<div class='ui-pg-div'><span class='ui-icon "+p.buttonicon+"'></span>"+p.caption+"</div>");
+				}
+				if(p.id) {$(tbd).attr("id",p.id);}
+				if(p.position=='first'){
+					if(findnav.rows[0].cells.length ===0 ) {
+						$("tr",findnav).append(tbd);
+					} else {
+						$("tr td:eq(0)",findnav).before(tbd);
+					}
+				} else {
+					$("tr",findnav).append(tbd);
+				}
+				$(tbd,findnav)
+				.attr("title",p.title  || "")
+				.click(function(e){
+					if (!$(this).hasClass('ui-state-disabled')) {
+						if ($.isFunction(p.onClickButton) ) {p.onClickButton.call($t,e);}
+					}
+					return false;
+				})
+				.hover(
+					function () {
+						if (!$(this).hasClass('ui-state-disabled')) {
+							$(this).addClass('ui-state-hover');
+						}
+					},
+					function () {$(this).removeClass("ui-state-hover");}
+				);
+			}
+		});
+	},
+	navSeparatorAdd:function (elem,p) {
+		p = $.extend({
+			sepclass : "ui-separator",
+			sepcontent: ''
+		}, p ||{});
+		return this.each(function() {
+			if( !this.grid)  {return;}
+			if( elem.indexOf("#") !== 0) {elem = "#"+elem;}
+			var findnav = $(".navtable",elem)[0];
+			if(findnav) {
+				var sep = "<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='"+p.sepclass+"'></span>"+p.sepcontent+"</td>";
+				$("tr",findnav).append(sep);
+			}
+		});
+	},
+	GridToForm : function( rowid, formid ) {
+		return this.each(function(){
+			var $t = this;
+			if (!$t.grid) {return;}
+			var rowdata = $($t).jqGrid("getRowData",rowid);
+			if (rowdata) {
+				for(var i in rowdata) {
+					if ( $("[name="+$.jgrid.jqID(i)+"]",formid).is("input:radio") || $("[name="+$.jgrid.jqID(i)+"]",formid).is("input:checkbox"))  {
+						$("[name="+$.jgrid.jqID(i)+"]",formid).each( function() {
+							if( $(this).val() == rowdata[i] ) {
+								$(this)[$t.p.useProp ? 'prop': 'attr']("checked",true);
+							} else {
+								$(this)[$t.p.useProp ? 'prop': 'attr']("checked", false);
+							}
+						});
+					} else {
+					// this is very slow on big table and form.
+						$("[name="+$.jgrid.jqID(i)+"]",formid).val(rowdata[i]);
+					}
+				}
+			}
+		});
+	},
+	FormToGrid : function(rowid, formid, mode, position){
+		return this.each(function() {
+			var $t = this;
+			if(!$t.grid) {return;}
+			if(!mode) {mode = 'set';}
+			if(!position) {position = 'first';}
+			var fields = $(formid).serializeArray();
+			var griddata = {};
+			$.each(fields, function(i, field){
+				griddata[field.name] = field.value;
+			});
+			if(mode=='add') {$($t).jqGrid("addRowData",rowid,griddata, position);}
+			else if(mode=='set') {$($t).jqGrid("setRowData",rowid,griddata);}
+		});
+	}
+});
+})(jQuery);
Index: controlies/trunk/applications/controlies/static/js/jdgrid/src/grid.base.js
===================================================================
--- controlies/trunk/applications/controlies/static/js/jdgrid/src/grid.base.js	(revision 240)
+++ controlies/trunk/applications/controlies/static/js/jdgrid/src/grid.base.js	(revision 241)
@@ -1,2360 +1,3366 @@
-;(function ($) {
-/*
- * jqGrid  3.6.5 - jQuery Grid
- * Copyright (c) 2008, Tony Tomov, tony@trirand.com
- * Dual licensed under the MIT and GPL licenses
- * http://www.opensource.org/licenses/mit-license.php
- * http://www.gnu.org/licenses/gpl-2.0.html
- * Date: 2010-05-05 
- */
-$.jgrid = $.jgrid || {};
-$.extend($.jgrid,{
-	htmlDecode : function(value){
-		if(value=='&nbsp;' || value=='&#160;' || (value.length==1 && value.charCodeAt(0)==160)) { return "";}
-		return !value ? value : String(value).replace(/&amp;/g, "&").replace(/&gt;/g, ">").replace(/&lt;/g, "<").replace(/&quot;/g, '"');
-	},
-	htmlEncode : function (value){
-		return !value ? value : String(value).replace(/&/g, "&amp;").replace(/>/g, "&gt;").replace(/</g, "&lt;").replace(/\"/g, "&quot;");
-	},
-	format : function(format){ //jqgformat
-		var args = $.makeArray(arguments).slice(1);
-		if(format===undefined) { format = ""; }
-		return format.replace(/\{(\d+)\}/g, function(m, i){
-			return args[i];
-		});
-	},
-	getCellIndex : function (cell) {
-		cell = $(cell);
-		cell = (!cell.is('td') && !cell.is('th') ? cell.closest("td,th") : cell)[0];
-		if ($.browser.msie) { return $.inArray(cell, cell.parentNode.cells); }
-		return cell.cellIndex;
-	},
-	stripHtml : function(v) {
-		v = v+"";
-		var regexp = /<("[^"]*"|'[^']*'|[^'">])*>/gi;
-		if (v) {
-			v = v.replace(regexp,"");
-			return (v && v !== '&nbsp;' && v !== '&#160;') ? v.replace(/\"/g,"'") : "";
-		} else {
-			return v;
-		}
-	},
-	stringToDoc : function (xmlString) {
-		var xmlDoc;
-		if(typeof xmlString !== 'string') { return xmlString; }
-		try	{
-			var parser = new DOMParser();
-			xmlDoc = parser.parseFromString(xmlString,"text/xml");
-		}
-		catch(e) {
-			xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
-			xmlDoc.async=false;
-			xmlDoc.loadXML(xmlString);
-		}
-		return (xmlDoc && xmlDoc.documentElement && xmlDoc.documentElement.tagName != 'parsererror') ? xmlDoc : null;
-	},
-	parse : function(jsonString) {
-		var js = jsonString;
-		if (js.substr(0,9) == "while(1);") { js = js.substr(9); }
-		if (js.substr(0,2) == "/*") { js = js.substr(2,js.length-4); }
-		if(!js) { js = "{}"; }
-		return ($.jgrid.useJSON===true && typeof (JSON) === 'object' && typeof (JSON.parse) === 'function') ?
-		    JSON.parse(js) :
-		    eval('(' + js + ')');
-	},
-	jqID : function(sid){
-		sid = sid + "";
-		return sid.replace(/([\.\:\[\]])/g,"\\$1");
-	},
-	ajaxOptions: {},
-	extend : function(methods) {
-		$.extend($.fn.jqGrid,methods);
-		if (!this.no_legacy_api) {
-			$.fn.extend(methods);
-		}
-	}
-});
-
-$.fn.jqGrid = function( pin ) {
-	if (typeof pin == 'string') {
-		var fn = $.fn.jqGrid[pin];
-		if (!fn) {
-			throw ("jqGrid - No such method: " + pin);
-		}
-		var args = $.makeArray(arguments).slice(1);
-		return fn.apply(this,args);
-	}
-	return this.each( function() {
-		if(this.grid) {return;}
-
-		var p = $.extend(true,{
-			url: "",
-			height: 150,
-			page: 1,
-			rowNum: 20,
-			records: 0,
-			pager: "",
-			pgbuttons: true,
-			pginput: true,
-			colModel: [],
-			rowList: [],
-			colNames: [],
-			sortorder: "asc",
-			sortname: "",
-			datatype: "xml",
-			mtype: "GET",
-			altRows: false,
-			selarrrow: [],
-			savedRow: [],
-			shrinkToFit: true,
-			xmlReader: {},
-			jsonReader: {},
-			subGrid: false,
-			subGridModel :[],
-			reccount: 0,
-			lastpage: 0,
-			lastsort: 0,
-			selrow: null,
-			beforeSelectRow: null,
-			onSelectRow: null,
-			onSortCol: null,
-			ondblClickRow: null,
-			onRightClickRow: null,
-			onPaging: null,
-			onSelectAll: null,
-			loadComplete: null,
-			gridComplete: null,
-			loadError: null,
-			loadBeforeSend: null,
-			afterInsertRow: null,
-			beforeRequest: null,
-			onHeaderClick: null,
-			viewrecords: false,
-			loadonce: false,
-			multiselect: false,
-			multikey: false,
-			editurl: null,
-			search: false,
-			caption: "",
-			hidegrid: true,
-			hiddengrid: false,
-			postData: {},
-			userData: {},
-			treeGrid : false,
-			treeGridModel : 'nested',
-			treeReader : {},
-			treeANode : -1,
-			ExpandColumn: null,
-			tree_root_level : 0,
-			prmNames: {page:"page",rows:"rows", sort: "sidx",order: "sord", search:"_search", nd:"nd", id:"id",oper:"oper",editoper:"edit",addoper:"add",deloper:"del", subgridid:"id", npage: null},
-			forceFit : false,
-			gridstate : "visible",
-			cellEdit: false,
-			cellsubmit: "remote",
-			nv:0,
-			loadui: "enable",
-			toolbar: [false,""],
-			scroll: false,
-			multiboxonly : false,
-			deselectAfterSort : true,
-			scrollrows : false,
-			autowidth: false,
-			scrollOffset :18,
-			cellLayout: 5,
-			subGridWidth: 20,
-			multiselectWidth: 20,
-			gridview: false,
-			rownumWidth: 25,
-			rownumbers : false,
-			pagerpos: 'center',
-			recordpos: 'right',
-			footerrow : false,
-			userDataOnFooter : false,
-			hoverrows : true,
-			altclass : 'ui-priority-secondary',
-			viewsortcols : [false,'vertical',true],
-			resizeclass : '',
-			autoencode : false,
-			remapColumns : [],
-			ajaxGridOptions :{},
-			direction : "ltr",
-			toppager: false,
-			headertitles: false,
-			scrollTimeout: 200
-		}, $.jgrid.defaults, pin || {});
-		var grid={
-			headers:[],
-			cols:[],
-			footers: [],
-			dragStart: function(i,x,y) {
-				this.resizing = { idx: i, startX: x.clientX, sOL : y[0]};
-				this.hDiv.style.cursor = "col-resize";
-				this.curGbox = $("#rs_m"+p.id,"#gbox_"+p.id);
-				this.curGbox.css({display:"block",left:y[0],top:y[1],height:y[2]});
-				if($.isFunction(p.resizeStart)) { p.resizeStart.call(this,x,i); }
-				document.onselectstart=function(){return false;};
-			},
-			dragMove: function(x) {
-				if(this.resizing) {
-					var diff = x.clientX-this.resizing.startX,
-					h = this.headers[this.resizing.idx],
-					newWidth = p.direction === "ltr" ? h.width + diff : h.width - diff, hn, nWn;
-					if(newWidth > 33) {
-						this.curGbox.css({left:this.resizing.sOL+diff});
-						if(p.forceFit===true ){
-							hn = this.headers[this.resizing.idx+p.nv];
-							nWn = p.direction === "ltr" ? hn.width - diff : hn.width + diff;
-							if(nWn >33) {
-								h.newWidth = newWidth;
-								hn.newWidth = nWn;
-							}
-						} else {
-							this.newWidth = p.direction === "ltr" ? p.tblwidth+diff : p.tblwidth-diff;
-							h.newWidth = newWidth;
-						}
-					}
-				}
-			},
-			dragEnd: function() {
-				this.hDiv.style.cursor = "default";
-				if(this.resizing) {
-					var idx = this.resizing.idx,
-					nw = this.headers[idx].newWidth || this.headers[idx].width;
-					nw = parseInt(nw,10);
-					this.resizing = false;
-					$("#rs_m"+p.id).css("display","none");
-					p.colModel[idx].width = nw;
-					this.headers[idx].width = nw;
-					this.headers[idx].el.style.width = nw + "px";
-					if(this.cols.length>0) {this.cols[idx].style.width = nw+"px";}
-					if(this.footers.length>0) {this.footers[idx].style.width = nw+"px";}
-					if(p.forceFit===true){
-						nw = this.headers[idx+p.nv].newWidth || this.headers[idx+p.nv].width;
-						this.headers[idx+p.nv].width = nw;
-						this.headers[idx+p.nv].el.style.width = nw + "px";
-						if(this.cols.length>0) { this.cols[idx+p.nv].style.width = nw+"px"; }
-						if(this.footers.length>0) {this.footers[idx+p.nv].style.width = nw+"px";}
-						p.colModel[idx+p.nv].width = nw;
-					} else {
-						p.tblwidth = this.newWidth || p.tblwidth;
-						$('table:first',this.bDiv).css("width",p.tblwidth+"px");
-						$('table:first',this.hDiv).css("width",p.tblwidth+"px");
-						this.hDiv.scrollLeft = this.bDiv.scrollLeft;
-						if(p.footerrow) {
-							$('table:first',this.sDiv).css("width",p.tblwidth+"px");
-							this.sDiv.scrollLeft = this.bDiv.scrollLeft;
-						}
-					}
-					if($.isFunction(p.resizeStop)) { p.resizeStop.call(this,nw,idx); }
-				}
-				this.curGbox = null;
-				document.onselectstart=function(){return true;};
-			},
-			populateVisible: function() {
-				if (grid.timer) { clearTimeout(grid.timer); }
-				grid.timer = null;
-
-				var dh = $(grid.bDiv).height();
-				if (!dh) { return; }
-				var table = $("table:first", grid.bDiv);
-				var rows = $("> tbody > tr:visible:first", table);
-				var rh = rows.outerHeight() || grid.prevRowHeight;
-				if (!rh) { return; }
-				grid.prevRowHeight = rh;
-				var rn = p.rowNum;
-				var scrollTop = grid.scrollTop = grid.bDiv.scrollTop;
-				var ttop = Math.round(table.position().top) - scrollTop;
-				var tbot = ttop + table.height();
-				var div = rh * rn;
-				var page, npage, empty;
-				// tbot < dh &&
-			    if (ttop <= 0 &&  
-                    (p.lastpage===undefined||parseInt((tbot + scrollTop + div - 1) / div,10) <= p.lastpage))
-                {
-					npage = parseInt((dh - tbot + div - 1) / div,10);
-					if (tbot >= 0 || npage < 2 || p.scroll === true) {
-						page = Math.round((tbot + scrollTop) / div) + 1;
-						ttop = -1;
-					} else {
-						ttop = 1;
-					}
-				}
-				if (ttop > 0) {
-					page = parseInt(scrollTop / div,10) + 1;
-					npage = parseInt((scrollTop + dh) / div,10) + 2 - page;
-					empty = true;
-				}
-				if (npage) {
-					if (p.lastpage && page > p.lastpage) {
-						return;
-					}
-					if (grid.hDiv.loading) {
-						grid.timer = setTimeout(grid.populateVisible, p.scrollTimeout);
-					} else {
-						p.page = page;
-						if (empty) {
-							grid.selectionPreserver(table[0]);
-							grid.emptyRows(grid.bDiv,false);
-						}
-						grid.populate(npage);
-					}
-				}
-			},
-			scrollGrid: function() {
-				if(p.scroll) {
-					var scrollTop = grid.bDiv.scrollTop;
-					if (scrollTop != grid.scrollTop) {
-						grid.scrollTop = scrollTop;
-						if (grid.timer) { clearTimeout(grid.timer); }
-						grid.timer = setTimeout(grid.populateVisible, 200);
-					}
-				}
-				grid.hDiv.scrollLeft = grid.bDiv.scrollLeft;
-				if(p.footerrow) {
-					grid.sDiv.scrollLeft = grid.bDiv.scrollLeft;
-				}
-			},
-			selectionPreserver : function(ts) {
-				var p = ts.p;
-				var sr = p.selrow, sra = p.selarrrow ? $.makeArray(p.selarrrow) : null;
-				var left = ts.grid.bDiv.scrollLeft;
-				var complete = p.gridComplete;
-				p.gridComplete = function() {
-					p.selrow = null;
-					p.selarrrow = [];
-					if(p.multiselect && sra && sra.length>0) {
-						for(var i=0;i<sra.length;i++){
-							if (sra[i] != sr) {
-								$(ts).jqGrid("setSelection",sra[i],false);
-							}
-						}
-					}
-					if (sr) {
-						$(ts).jqGrid("setSelection",sr,false);
-					}
-					ts.grid.bDiv.scrollLeft = left;
-					p.gridComplete = complete;
-					if (p.gridComplete) {
-						complete();
-					}
-				};
-			}
-		};
-		this.p = p ;
-		var i, dir,ts;
-		if(this.p.colNames.length === 0) {
-			for (i=0;i<this.p.colModel.length;i++){
-				this.p.colNames[i] = this.p.colModel[i].label || this.p.colModel[i].name;
-			}
-		}
-		if( this.p.colNames.length !== this.p.colModel.length ) {
-			alert($.jgrid.errors.model);
-			return;
-		}
-		var gv = $("<div class='ui-jqgrid-view'></div>"), ii,
-		isMSIE = $.browser.msie ? true:false,
-		isSafari = $.browser.safari ? true : false;
-		ts = this;
-		ts.p.direction = $.trim(ts.p.direction.toLowerCase());
-		if($.inArray(ts.p.direction,["ltr","rtl"]) == -1) { ts.p.direction = "ltr"; }
-		dir = ts.p.direction;
-
-		$(gv).insertBefore(this);
-		$(this).appendTo(gv).removeClass("scroll");
-		var eg = $("<div class='ui-jqgrid ui-widget ui-widget-content ui-corner-all'></div>");
-		$(eg).insertBefore(gv).attr({"id" : "gbox_"+this.id,"dir":dir});
-		$(gv).appendTo(eg).attr("id","gview_"+this.id);
-		if (isMSIE && $.browser.version <= 6) {
-			ii = '<iframe style="display:block;position:absolute;z-index:-1;filter:Alpha(Opacity=\'0\');" src="javascript:false;"></iframe>';
-		} else { ii="";}
-		$("<div class='ui-widget-overlay jqgrid-overlay' id='lui_"+this.id+"'></div>").append(ii).insertBefore(gv);
-		$("<div class='loading ui-state-default ui-state-active' id='load_"+this.id+"'>"+this.p.loadtext+"</div>").insertBefore(gv);
-		$(this).attr({cellSpacing:"0",cellPadding:"0",border:"0","role":"grid","aria-multiselectable":!!this.p.multiselect,"aria-labelledby":"gbox_"+this.id});
-		var sortkeys = ["shiftKey","altKey","ctrlKey"],
-		intNum = function(val,defval) {
-			val = parseInt(val,10);
-			if (isNaN(val)) { return defval ? defval : 0;}
-			else {return val;}
-		},
-		formatCol = function (pos, rowInd, tv){
-			var cm = ts.p.colModel[pos],
-			ral = cm.align, result="style=\"", clas = cm.classes, nm = cm.name;
-			if(ral) { result += "text-align:"+ral+";"; }
-			if(cm.hidden===true) { result += "display:none;"; }
-			if(rowInd===0) {
-				result += "width: "+grid.headers[pos].width+"px;";
-			}
-			result += "\"" + (clas !== undefined ? (" class=\""+clas+"\"") :"") + ((cm.title && tv) ? (" title=\""+$.jgrid.stripHtml(tv)+"\"") :"");
-			result += " aria-describedby=\""+ts.p.id+"_"+nm+"\"";
-			return result;
-		},
-		cellVal =  function (val) {
-			return val === undefined || val === null || val === "" ? "&#160;" : (ts.p.autoencode ? $.jgrid.htmlEncode(val) : val+"");
-		},
-		formatter = function (rowId, cellval , colpos, rwdat, _act){
-			var cm = ts.p.colModel[colpos],v;
-			if(typeof cm.formatter !== 'undefined') {
-				var opts= {rowId: rowId, colModel:cm, gid:ts.p.id };
-				if($.isFunction( cm.formatter ) ) {
-					v = cm.formatter.call(ts,cellval,opts,rwdat,_act);
-				} else if($.fmatter){
-					v = $.fn.fmatter(cm.formatter, cellval,opts, rwdat, _act);
-				} else {
-					v = cellVal(cellval);
-				}
-			} else {
-				v = cellVal(cellval);
-			}
-			return v;
-		},
-		addCell = function(rowId,cell,pos,irow, srvr) {
-			var v,prp;
-			v = formatter(rowId,cell,pos,srvr,'add');
-			prp = formatCol( pos,irow, v);
-			return "<td role=\"gridcell\" "+prp+">"+v+"</td>";
-		},
-		addMulti = function(rowid,pos,irow){
-			var	v = "<input role=\"checkbox\" type=\"checkbox\""+" id=\"jqg_"+rowid+"\" class=\"cbox\" name=\"jqg_"+rowid+"\"/>",
-			prp = formatCol(pos,irow,'');
-			return "<td role=\"gridcell\" aria-describedby=\""+ts.p.id+"_cb\" "+prp+">"+v+"</td>";
-		},
-		addRowNum = function (pos,irow,pG,rN) {
-			var v =  (parseInt(pG,10)-1)*parseInt(rN,10)+1+irow,
-			prp = formatCol(pos,irow,'');
-			return "<td role=\"gridcell\" aria-describedby=\""+ts.p.id+"_rn\" class=\"ui-state-default jqgrid-rownum\" "+prp+">"+v+"</td>";
-		},
-		reader = function (datatype) {
-			var field, f=[], j=0, i;
-			for(i =0; i<ts.p.colModel.length; i++){
-				field = ts.p.colModel[i];
-				if (field.name !== 'cb' && field.name !=='subgrid' && field.name !=='rn') {
-					f[j] = (datatype=="xml") ? field.xmlmap || field.name : field.jsonmap || field.name;
-					j++;
-				}
-			}
-			return f;
-		},
-		orderedCols = function (offset) {
-			var order = ts.p.remapColumns;
-			if (!order || !order.length) {
-				order = $.map(ts.p.colModel, function(v,i) { return i; });
-			}
-			if (offset) {
-				order = $.map(order, function(v) { return v<offset?null:v-offset; });
-			}
-			return order;
-		},
-		emptyRows = function (parent, scroll) {
-			if(ts.p.deepempty) { $("tbody:first tr", parent).remove(); }
-			else { $("tbody:first", parent).empty(); }
-			if (scroll && ts.p.scroll) {
-				$(">div:first", parent).css({height:"auto"}).children("div:first").css({height:0,display:"none"});
-				parent.scrollTop = 0;
-			}
-		},
-		getAccessor = function(obj, expr) {
-			var ret,p,prm, i;
-			if( typeof expr === 'function') { return expr(obj); }
-			ret = obj[expr];
-			if(ret===undefined) {
-			    if ( typeof expr === 'string' ) {
-					prm = expr.split('.');
-				}
-				try {
-					i = prm.length; 
-					if( i ) {
-						ret = obj;
-					    while (ret && i--) {
-							p = prm.shift();
-							ret = ret[p];
-						}
-					}
-				} catch (e) {}
-			}
-			return ret;
-		},
-		addXmlData = function (xml,t, rcnt, more, adjust) {
-			var startReq = new Date();
-			ts.p.reccount = 0;
-			if($.isXMLDoc(xml)) {
-				if(ts.p.treeANode===-1 && !ts.p.scroll) {
-					emptyRows(t,false);
-					rcnt=0;
-				} else { rcnt = rcnt > 0 ? rcnt :0; }
-			} else { return; }
-			var i,fpos,ir=0,v,row,gi=0,si=0,ni=0,idn, getId,f=[],F,rd ={}, rl= ts.rows.length, xmlr,rid, rowData=[],ari=0, cn=(ts.p.altRows === true) ? " "+ts.p.altclass:"",cn1;
-			if(!ts.p.xmlReader.repeatitems) {f = reader("xml");}
-			if( ts.p.keyIndex===false) {
-				idn = ts.p.xmlReader.id;
-			} else {
-				idn = ts.p.keyIndex;
-			}
-			if(f.length>0 && !isNaN(idn)) {
-				if (ts.p.remapColumns && ts.p.remapColumns.length) {
-					idn = $.inArray(idn, ts.p.remapColumns);
-				}
-				idn=f[idn];
-			}
-			if( (idn+"").indexOf("[") === -1 ) {
-				if (f.length) {
-					getId = function( trow, k) {return $(idn,trow).text() || k;};
-				} else {
-					getId = function( trow, k) {return $(ts.p.xmlReader.cell,trow).eq(idn).text() || k;};
-				}
-			}
-			else {
-				getId = function( trow, k) {return trow.getAttribute(idn.replace(/[\[\]]/g,"")) || k;};
-			}
-			ts.p.userData = {};
-			$(ts.p.xmlReader.page,xml).each(function() {ts.p.page = this.textContent  || this.text || 0; });
-			$(ts.p.xmlReader.total,xml).each(function() {ts.p.lastpage = this.textContent  || this.text; if(ts.p.lastpage===undefined) { ts.p.lastpage=1; } }  );
-			$(ts.p.xmlReader.records,xml).each(function() {ts.p.records = this.textContent  || this.text  || 0; }  );
-			$(ts.p.xmlReader.userdata,xml).each(function() {ts.p.userData[this.getAttribute("name")]=this.textContent || this.text;});
-			var gxml = $(ts.p.xmlReader.root+" "+ts.p.xmlReader.row,xml),gl = gxml.length, j=0;
-			if(gxml && gl){
-			var rn = parseInt(ts.p.rowNum,10),br=ts.p.scroll?(parseInt(ts.p.page,10)-1)*rn+1:1,altr;
-			if (adjust) { rn *= adjust+1; }
-			var afterInsRow = $.isFunction(ts.p.afterInsertRow);
-			while (j<gl) {
-				xmlr = gxml[j];
-				rid = getId(xmlr,br+j);
-				altr = rcnt === 0 ? 0 : rcnt+1;
-				cn1 = (altr+j)%2 == 1 ? cn : '';
-				rowData[ari++] = "<tr id=\""+rid+"\" role=\"row\" class =\"ui-widget-content jqgrow ui-row-"+ts.p.direction+""+cn1+"\">";
-				if(ts.p.rownumbers===true) {
-					rowData[ari++] = addRowNum(0,j,ts.p.page,ts.p.rowNum);
-					ni=1;
-				}
-				if(ts.p.multiselect===true) {
-					rowData[ari++] = addMulti(rid,ni,j);
-					gi=1;
-				}
-				if (ts.p.subGrid===true) {
-					rowData[ari++]= $(ts).jqGrid("addSubGridCell",gi+ni,j+rcnt);
-					si= 1;
-				}
-				if(ts.p.xmlReader.repeatitems){
-					if (!F) { F=orderedCols(gi+si+ni); }
-					var cells = $(ts.p.xmlReader.cell,xmlr);
-					$.each(F, function (k) {
-						var cell = cells[this];
-						if (!cell) { return false; }
-						v = cell.textContent || cell.text;
-						rd[ts.p.colModel[k+gi+si+ni].name] = v;
-						rowData[ari++] = addCell(rid,v,k+gi+si+ni,j+rcnt,xmlr);
-					});
-				} else {
-					for(i = 0; i < f.length;i++) {
-						v = $(f[i],xmlr).text();
-						rd[ts.p.colModel[i+gi+si+ni].name] = v;
-						rowData[ari++] = addCell(rid, v, i+gi+si+ni, j+rcnt, xmlr);
-					}
-				}
-				rowData[ari++] = "</tr>";
-				if(ts.p.gridview === false ) {
-					if( ts.p.treeGrid === true) {
-						fpos = ts.p.treeANode >= -1 ? ts.p.treeANode: 0;
-						row = $(rowData.join(''))[0]; // speed overhead
-						try {$(ts).jqGrid("setTreeNode",rd,row);} catch (e) {}
-						if(rl ===  0) { $("tbody:first",t).append(row); } else { $(ts.rows[j+fpos+rcnt]).after(row); }
-					} else {
-						$("tbody:first",t).append(rowData.join(''));
-					}
-					if (ts.p.subGrid===true) {
-						try {$(ts).jqGrid("addSubGrid",ts.rows[ts.rows.length-1],gi+ni);} catch (_){}
-					}
-					if(afterInsRow) {ts.p.afterInsertRow.call(ts,rid,rd,xmlr);}
-					rowData=[];ari=0;
-				}
-				rd={};
-				ir++;
-				j++;
-				if(ir==rn) {break;}
-			}
-			}
-			if(ts.p.gridview === true) {
-				$("tbody:first",t).append(rowData.join(''));
-			}
-			ts.p.totaltime = new Date() - startReq;
-			if(ir>0) { ts.grid.cols = ts.rows[0].cells; if(ts.p.records===0) { ts.p.records=gl;} }
-			rowData =null;
-			if(!ts.p.treeGrid && !ts.p.scroll) {ts.grid.bDiv.scrollTop = 0;}
-			ts.p.reccount=ir;
-			ts.p.treeANode = -1;
-			if(ts.p.userDataOnFooter) { $(ts).jqGrid("footerData","set",ts.p.userData,true); }
-			if (!more) { updatepager(false,true); }
-		},
-		addJSONData = function(data,t, rcnt, more, adjust) {
-			var startReq = new Date();
-			ts.p.reccount = 0;
-			if(data) {
-				if(ts.p.treeANode === -1 && !ts.p.scroll) {
-					emptyRows(t,false);
-					rcnt=0;
-				} else { rcnt = rcnt > 0 ? rcnt :0; }
-			} else { return; }
-			var ir=0,v,i,j,row,f=[],F,cur,gi=0,si=0,ni=0,len,drows,idn,rd={}, fpos,rl = ts.rows.length,idr,rowData=[],ari=0,cn=(ts.p.altRows === true) ? " "+ts.p.altclass:"",cn1,lp;
-			ts.p.page = getAccessor(data,ts.p.jsonReader.page) || 0;
-			lp = getAccessor(data,ts.p.jsonReader.total);
-			ts.p.lastpage= lp === undefined ? 1 : lp;
-			ts.p.records= getAccessor(data,ts.p.jsonReader.records) || 0;
-			ts.p.userData = getAccessor(data,ts.p.jsonReader.userdata) || {};
-			if(!ts.p.jsonReader.repeatitems) {
-				F = f = reader("json");
-			}
-			if( ts.p.keyIndex===false ) {
-				idn = ts.p.jsonReader.id;
-			} else {
-				idn = ts.p.keyIndex;
-			}
-			if(f.length>0 && !isNaN(idn)) {
-				if (ts.p.remapColumns && ts.p.remapColumns.length) {
-					idn = $.inArray(idn, ts.p.remapColumns);
-				}
-				idn=f[idn];
-			}
-			drows = getAccessor(data,ts.p.jsonReader.root);
-			if (drows) {
-			len = drows.length; i=0;
-			var rn = parseInt(ts.p.rowNum,10),br=ts.p.scroll?(parseInt(ts.p.page,10)-1)*rn+1:1, altr;
-			if (adjust) { rn *= adjust+1; }
-			var afterInsRow = $.isFunction(ts.p.afterInsertRow);
-			while (i<len) {
-				cur = drows[i];
-				idr = getAccessor(cur,idn);
-				if(idr === undefined) {
-					idr = br+i;
-					if(f.length===0){
-						if(ts.p.jsonReader.cell){
-							var ccur = cur[ts.p.jsonReader.cell];
-							idr = ccur[idn] || idr;
-							ccur=null;
-						}
-					}
-				}
-				altr = rcnt === 0 ? 0 : rcnt+1;
-				cn1 = (altr+i)%2 == 1 ? cn : '';
-				rowData[ari++] = "<tr id=\""+ idr +"\" role=\"row\" class= \"ui-widget-content jqgrow ui-row-"+ts.p.direction+""+cn1+"\">";
-				if(ts.p.rownumbers===true) {
-					rowData[ari++] = addRowNum(0,i,ts.p.page,ts.p.rowNum);
-					ni=1;
-				}
-				if(ts.p.multiselect){
-					rowData[ari++] = addMulti(idr,ni,i);
-					gi = 1;
-				}
-				if (ts.p.subGrid) {
-					rowData[ari++]= $(ts).jqGrid("addSubGridCell",gi+ni,i+rcnt);
-					si= 1;
-				}
-				if (ts.p.jsonReader.repeatitems) {
-					if(ts.p.jsonReader.cell) {cur = getAccessor(cur,ts.p.jsonReader.cell);}
-					if (!F) { F=orderedCols(gi+si+ni); }
-				}
-				for (j=0;j<F.length;j++) {
-					v = getAccessor(cur,F[j]);
-					rowData[ari++] = addCell(idr,v,j+gi+si+ni,i+rcnt,cur);
-					rd[ts.p.colModel[j+gi+si+ni].name] = v;
-				}
-				rowData[ari++] = "</tr>";
-				if(ts.p.gridview === false ) {
-					if( ts.p.treeGrid === true) {
-						fpos = ts.p.treeANode >= -1 ? ts.p.treeANode: 0;
-						row = $(rowData.join(''))[0];
-						try {$(ts).jqGrid("setTreeNode",rd,row);} catch (e) {}
-						if(rl ===  0) { $("tbody:first",t).append(row); } else { $(ts.rows[i+fpos+rcnt]).after(row); }
-					} else {
-						$("tbody:first",t).append(rowData.join(''));
-					}
-					if(ts.p.subGrid === true ) {
-						try { $(ts).jqGrid("addSubGrid",ts.rows[ts.rows.length-1],gi+ni);} catch (_){}
-					}
-					if(afterInsRow) {ts.p.afterInsertRow.call(ts,idr,rd,cur);}
-					rowData=[];ari=0;
-				}
-				rd={};
-				ir++;
-				i++;
-				if(ir==rn) { break; }
-			}
-			if(ts.p.gridview === true ) {
-				$("tbody:first",t).append(rowData.join(''));
-			}
-			ts.p.totaltime = new Date() - startReq;
-			if(ir>0) {ts.grid.cols = ts.rows[0].cells; if(ts.p.records===0) { ts.p.records=len; } }
-			}
-			if(!ts.p.treeGrid && !ts.p.scroll) {ts.grid.bDiv.scrollTop = 0;}
-			ts.p.reccount=ir;
-			ts.p.treeANode = -1;
-			if(ts.p.userDataOnFooter) { $(ts).jqGrid("footerData","set",ts.p.userData,true); }
-			if (!more) { updatepager(false,true); }
-		},
-		updatepager = function(rn, dnd) {
-			var cp, last, base, from,to,tot,fmt, pgboxes = "";
-			base = parseInt(ts.p.page,10)-1;
-			if(base < 0) { base = 0; }
-			base = base*parseInt(ts.p.rowNum,10);
-			to = base + ts.p.reccount;
-			if (ts.p.scroll) {
-				var rows = $("tbody:first > tr", ts.grid.bDiv);
-				base = to - rows.length;
-				var rh = rows.outerHeight();
-				if (rh) {
-					var top = base * rh;
-					var height = parseInt(ts.p.records,10) * rh;
-				    $(">div:first",ts.grid.bDiv).css({height : height}).children("div:first").css({height:top,display:top?"":"none"});
-				}
-			}
-			pgboxes = ts.p.pager ? ts.p.pager : "";
-			pgboxes += ts.p.toppager ?  (pgboxes ? "," + ts.p.toppager : ts.p.toppager) : "";
-			if(pgboxes) {
-				fmt = $.jgrid.formatter.integer || {};
-				if (ts.p.loadonce) {
-					cp = last = 1;
-					ts.p.lastpage = ts.page =1;
-					$(".selbox",pgboxes).attr("disabled",true);
-				} else {
-					cp = intNum(ts.p.page);
-					last = intNum(ts.p.lastpage);
-					$(".selbox",pgboxes).attr("disabled",false);
-				}
-				if(ts.p.pginput===true) {
-					$('.ui-pg-input',pgboxes).val(ts.p.page);
-					$('#sp_1',pgboxes).html($.fmatter ? $.fmatter.util.NumberFormat(ts.p.lastpage,fmt):ts.p.lastpage);
-					
-				}
-				if (ts.p.viewrecords){
-					if(ts.p.reccount === 0) {
-						$(".ui-paging-info",pgboxes).html(ts.p.emptyrecords);
-					} else {
-						from = base+1;
-						tot=ts.p.records;
-						if($.fmatter) {
-							from = $.fmatter.util.NumberFormat(from,fmt);
-							to = $.fmatter.util.NumberFormat(to,fmt);
-							tot = $.fmatter.util.NumberFormat(tot,fmt);
-						}
-						$(".ui-paging-info",pgboxes).html($.jgrid.format(ts.p.recordtext,from,to,tot));
-					}
-				}
-				if(ts.p.pgbuttons===true) {
-					if(cp<=0) {cp = last = 0;}
-					if(cp==1 || cp === 0) {
-						$("#first, #prev",ts.p.pager).addClass('ui-state-disabled').removeClass('ui-state-hover');
-						if(ts.p.toppager) { $("#first_t, #prev_t",ts.p.toppager).addClass('ui-state-disabled').removeClass('ui-state-hover'); }
-					} else {
-						$("#first, #prev",ts.p.pager).removeClass('ui-state-disabled');
-						if(ts.p.toppager) { $("#first_t, #prev_t",ts.p.toppager).removeClass('ui-state-disabled'); }
-					}
-					if(cp==last || cp === 0) {
-						$("#next, #last",ts.p.pager).addClass('ui-state-disabled').removeClass('ui-state-hover');
-						if(ts.p.toppager) { $("#next_t, #last_t",ts.p.toppager).addClass('ui-state-disabled').removeClass('ui-state-hover'); }
-					} else {
-						$("#next, #last",ts.p.pager).removeClass('ui-state-disabled');
-						if(ts.p.toppager) { $("#next_t, #last_t",ts.p.toppager).removeClass('ui-state-disabled'); }
-					}
-				}
-			}
-			if(rn===true && ts.p.rownumbers === true) {
-				$("td.jqgrid-rownum",ts.rows).each(function(i){
-					$(this).html(base+1+i);
-				});
-			}
-			if(dnd && ts.p.jqgdnd) { $(ts).jqGrid('gridDnD','updateDnD');}
-			if($.isFunction(ts.p.gridComplete)) {ts.p.gridComplete.call(ts);}
-		},
-		populate = function (npage) {
-			if(!ts.grid.hDiv.loading) {
-				var pvis = ts.p.scroll && npage === false;
-				var prm = {}, dt, dstr, pN=ts.p.prmNames;
-				if(ts.p.page <=0) { ts.p.page = 1; }
-				if(pN.search !== null) {prm[pN.search] = ts.p.search;} if(pN.nd !== null) {prm[pN.nd] = new Date().getTime();}
-				if(pN.rows !== null) {prm[pN.rows]= ts.p.rowNum;} if(pN.page !== null) {prm[pN.page]= ts.p.page;}
-				if(pN.sort !== null) {prm[pN.sort]= ts.p.sortname;} if(pN.order !== null) {prm[pN.order]= ts.p.sortorder;}
-				var lc = ts.p.loadComplete;
-				var lcf = $.isFunction(lc);
-				if (!lcf) { lc = null; }
-				var adjust = 0;
-				npage = npage || 1;
-				if (npage > 1) {
-					if(pN.npage !== null) {
-						prm[pN.npage] = npage;
-						adjust = npage - 1;
-						npage = 1;
-					} else {
-						lc = function(req) {
-							if (lcf) {
-								ts.p.loadComplete.call(ts,req);
-							}
-							ts.grid.hDiv.loading = false;
-							ts.p.page++;
-							populate(npage-1);
-						};
-					}
-				} else if (pN.npage !== null) {
-					delete ts.p.postData[pN.npage];
-				}
-				$.extend(ts.p.postData,prm);
-				var rcnt = !ts.p.scroll ? 0 : ts.rows.length-1; 
-				if ($.isFunction(ts.p.datatype)) { ts.p.datatype.call(ts,ts.p.postData,"load_"+ts.p.id); return;}
-				else if($.isFunction(ts.p.beforeRequest)) {ts.p.beforeRequest.call(ts);}
-				dt = ts.p.datatype.toLowerCase();
-				switch(dt)
-				{
-				case "json":
-				case "jsonp":
-				case "xml":
-				case "script":
-					$.ajax($.extend({
-						url:ts.p.url,
-						type:ts.p.mtype,
-						dataType: dt ,
-						data: $.isFunction(ts.p.serializeGridData)? ts.p.serializeGridData.call(ts,ts.p.postData) : ts.p.postData,
-						success:function(req,st) {
-							if(dt === "xml") { addXmlData(req,ts.grid.bDiv,rcnt,npage>1,adjust); }
-							else { addJSONData(req,ts.grid.bDiv,rcnt,npage>1,adjust); }
-							if(lc) { lc.call(ts,req); }
-							if (pvis) { ts.grid.populateVisible(); }
-							if( ts.p.loadonce || ts.p.treeGrid) {ts.p.datatype = "local";}
-							req=null;
-							endReq();
-						},
-						error:function(xhr,st,err){
-							if($.isFunction(ts.p.loadError)) { ts.p.loadError.call(ts,xhr,st,err); }
-							endReq();
-							xhr=null;
-						},
-						beforeSend: function(xhr){
-							beginReq();
-							if($.isFunction(ts.p.loadBeforeSend)) { ts.p.loadBeforeSend.call(ts,xhr); }
-						}
-					},$.jgrid.ajaxOptions, ts.p.ajaxGridOptions));
-				break;
-				case "xmlstring":
-					beginReq();
-					dstr = $.jgrid.stringToDoc(ts.p.datastr);
-					if(lcf) {ts.p.loadComplete.call(ts,dstr);}
-					addXmlData(dstr,ts.grid.bDiv);
-					ts.p.datatype = "local";
-					ts.p.datastr = null;
-					endReq();
-				break;
-				case "jsonstring":
-					beginReq();
-					if(typeof ts.p.datastr == 'string') { dstr = $.jgrid.parse(ts.p.datastr); }
-					else { dstr = ts.p.datastr; }
-					if(lcf) {ts.p.loadComplete.call(ts,dstr);}
-					addJSONData(dstr,ts.grid.bDiv);
-					ts.p.datatype = "local";
-					ts.p.datastr = null;
-					endReq();
-				break;
-				case "local":
-				case "clientside":
-					beginReq();
-					ts.p.datatype = "local";
-					if(lcf) {ts.p.loadComplete.call(ts,"");}
-					sortArrayData();
-					updatepager(true,true);
-					endReq();
-				break;
-				}
-			}
-		},
-		beginReq = function() {
-			ts.grid.hDiv.loading = true;
-			if(ts.p.hiddengrid) { return;}
-			switch(ts.p.loadui) {
-				case "disable":
-					break;
-				case "enable":
-					$("#load_"+ts.p.id).show();
-					break;
-				case "block":
-					$("#lui_"+ts.p.id).show();
-					$("#load_"+ts.p.id).show();
-					break;
-			}
-		},
-		endReq = function() {
-			ts.grid.hDiv.loading = false;
-			switch(ts.p.loadui) {
-				case "disable":
-					break;
-				case "enable":
-					$("#load_"+ts.p.id).hide();
-					break;
-				case "block":
-					$("#lui_"+ts.p.id).hide();
-					$("#load_"+ts.p.id).hide();
-					break;
-			}
-		},
-		sortArrayData = function() {
-			var stripNum = /[\$,%]/g;
-			var rows=[], col=0, st, sv, findSortKey,newDir = (ts.p.sortorder == "asc") ? 1 :-1, reverse=false, cm;
-			$.each(ts.p.colModel,function(i,v){
-				if(this.index == ts.p.sortname || this.name == ts.p.sortname){
-					if(ts.p.lastsort == i) { reverse = true; }
-					col = i;
-					st = this.sorttype;
-					return false;
-				}
-			});
-			if (st == 'float' || st== 'number' || st== 'currency') {
-				findSortKey = function($cell) {
-					var key = parseFloat($cell.replace(stripNum, ''));
-					return isNaN(key) ? 0 : key;
-				};
-			} else if (st=='int' || st=='integer') {
-				findSortKey = function($cell) {
-					return intNum($cell.replace(stripNum, ''),0);
-				};
-			} else if(st == 'date' || st == 'datetime') {
-				findSortKey = function($cell) {
-					var fd = ts.p.colModel[col].datefmt || "Y-m-d";
-					return parseDate(fd,$cell).getTime();
-				};
-			} else if($.isFunction(st)) {
-				findSortKey = st;
-			} else {
-				findSortKey = function($cell) {
-					return $.trim($cell.toUpperCase());
-				};
-			}
-			cm = ts.p.colModel[col];
-			$.each(ts.rows, function(index, row) {
-				try { sv = $.unformat($(row).children('td').eq(col),{rowId:row.id, colModel:cm},col,true);}
-				catch (_) { sv = $(row).children('td').eq(col).text(); }
-				row.sortKey = findSortKey(sv);
-				rows[index] = this;
-			});
-			if(ts.p.treeGrid) {
-				$(ts).jqGrid("SortTree",newDir);
-			} else {
-				if(reverse) {
-					rows.reverse();
-				} else {
-					rows.sort(function(a, b) {
-						if (a.sortKey < b.sortKey) {return -newDir;}
-						if (a.sortKey > b.sortKey) {return newDir;}
-						return 0;
-					});
-				}
-				if(rows[0]){
-					$("td",rows[0]).each( function( k ) {
-						$(this).css("width",grid.headers[k].width+"px");
-					});
-					ts.grid.cols = rows[0].cells;
-				}
-				var cn = "";
-				if(ts.p.altRows) { cn = ts.p.altclass; }
-				$.each(rows, function(i, row) {
-					if(cn) {
-						if(i%2 ==1) {$(row).addClass(cn);}
-						else {$(row).removeClass(cn);}
-					}
-					$('tbody',ts.grid.bDiv).append(row);
-					row.sortKey = null;
-				});
-			}
-			ts.grid.bDiv.scrollTop = 0;
-		},
-		parseDate = function(format, date) {
-			var tsp = {m : 1, d : 1, y : 1970, h : 0, i : 0, s : 0},k,hl,dM;
-			date = $.trim(date);
-			if(date){
-				date = date.split(/[\\\/:_;.\t\T\s-]/);
-				format = format.split(/[\\\/:_;.\t\T\s-]/);
-				var dfmt  = $.jgrid.formatter.date.monthNames;
-				var afmt  = $.jgrid.formatter.date.AmPm;
-				var h12to24 = function(ampm, h){
-					if (ampm === 0){ if (h == 12) { h = 0;} }
-					          else { if (h != 12) { h += 12; } }
-					return h;
-				}; 
-				for(k=0,hl=format.length;k<hl;k++){
-					if(format[k] == 'M') {
-						dM = $.inArray(date[k],dfmt);
-						if(dM !== -1 && dM < 12){date[k] = dM+1;}
-					}
-					if(format[k] == 'F') {
-						dM = $.inArray(date[k],dfmt);
-						if(dM !== -1 && dM > 11){date[k] = dM+1-12;}
-					}
-					if(format[k] == 'a') {
-						dM = $.inArray(date[k],afmt);
-						if(dM !== -1 && dM < 2 && date[k] == afmt[dM]){
-							date[k] = dM;
-							tsp.h = h12to24(date[k], tsp.h);
-						}
-					}
-					if(format[k] == 'A') {
-						dM = $.inArray(date[k],afmt);
-						if(dM !== -1 && dM > 1 && date[k] == afmt[dM]){
-							date[k] = dM-2;
-							tsp.h = h12to24(date[k], tsp.h);
-						}
-					}
-					tsp[format[k].toLowerCase()] = parseInt(date[k],10);
-				}
-				tsp.m = parseInt(tsp.m,10)-1;
-				var ty = tsp.y;
-				if (ty >= 70 && ty <= 99) {tsp.y = 1900+tsp.y;}
-				else if (ty >=0 && ty <=69) {tsp.y= 2000+tsp.y;}
-			}
-			return new Date(tsp.y, tsp.m, tsp.d, tsp.h, tsp.i, tsp.s,0);
-		},
-		setPager = function (pgid, tp){
-			var sep = "<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='ui-separator'></span></td>",
-			pginp = "",
-			pgl="<table cellspacing='0' cellpadding='0' border='0' style='table-layout:auto;' class='ui-pg-table'><tbody><tr>",
-			str="", pgcnt, lft, cent, rgt, twd, tdw, i,
-			clearVals = function(onpaging){
-				var ret;
-				if ($.isFunction(ts.p.onPaging) ) { ret = ts.p.onPaging.call(ts,onpaging); }
-				ts.p.selrow = null;
-				if(ts.p.multiselect) {ts.p.selarrrow =[];$('#cb_'+$.jgrid.jqID(ts.p.id),ts.grid.hDiv).attr("checked",false);}
-				ts.p.savedRow = [];
-				if(ret=='stop') {return false;}
-				return true;
-			};
-			//pgid= $(ts.p.pager).attr("id") || 'pager',
-			pgid = pgid.substr(1);
-			pgcnt = "pg_"+pgid;
-			lft = pgid+"_left"; cent = pgid+"_center"; rgt = pgid+"_right";
-			$("#"+pgid)
-			.append("<div id='"+pgcnt+"' class='ui-pager-control' role='group'><table cellspacing='0' cellpadding='0' border='0' class='ui-pg-table' style='width:100%;table-layout:fixed;' role='row'><tbody><tr><td id='"+lft+"' align='left'></td><td id='"+cent+"' align='center' style='white-space:pre;'></td><td id='"+rgt+"' align='right'></td></tr></tbody></table></div>")
-			.attr("dir","ltr"); //explicit setting
-			if(ts.p.rowList.length >0){
-				str = "<td dir='"+dir+"'>";
-				str +="<select class='ui-pg-selbox' role='listbox'>";
-				for(i=0;i<ts.p.rowList.length;i++){
-					str +="<option role='option' value='"+ts.p.rowList[i]+"'"+((ts.p.rowNum == ts.p.rowList[i])?' selected':'')+">"+ts.p.rowList[i]+"</option>";
-				}
-				str +="</select></td>";
-			}
-			if(dir=="rtl") { pgl += str; }
-			if(ts.p.pginput===true) { pginp= "<td dir='"+dir+"'>"+$.jgrid.format(ts.p.pgtext || "","<input class='ui-pg-input' type='text' size='2' maxlength='7' value='0' role='textbox'/>","<span id='sp_1'></span>")+"</td>";}
-			if(ts.p.pgbuttons===true) {
-				var po=["first"+tp,"prev"+tp, "next"+tp,"last"+tp]; if(dir=="rtl") { po.reverse(); }
-				pgl += "<td id='"+po[0]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-first'></span></td>";
-				pgl += "<td id='"+po[1]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-prev'></span></td>";
-				pgl += pginp !="" ? sep+pginp+sep:"";
-				pgl += "<td id='"+po[2]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-next'></span></td>";
-				pgl += "<td id='"+po[3]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-end'></span></td>";
-			} else if (pginp !="") { pgl += pginp; }
-			if(dir=="ltr") { pgl += str; }
-			pgl += "</tr></tbody></table>";
-			if(ts.p.viewrecords===true) {$("td#"+pgid+"_"+ts.p.recordpos,"#"+pgcnt).append("<div dir='"+dir+"' style='text-align:"+ts.p.recordpos+"' class='ui-paging-info'></div>");}
-			$("td#"+pgid+"_"+ts.p.pagerpos,"#"+pgcnt).append(pgl);
-			tdw = $(".ui-jqgrid").css("font-size") || "11px";
-			$('body').append("<div id='testpg' class='ui-jqgrid ui-widget ui-widget-content' style='font-size:"+tdw+";visibility:hidden;' ></div>");
-			twd = $(pgl).clone().appendTo("#testpg").width();
-			$("#testpg").remove();
-			if(twd > 0) {
-				if(pginp !="") { twd += 50; } //should be param
-				$("td#"+pgid+"_"+ts.p.pagerpos,"#"+pgcnt).width(twd);
-			}
-			ts.p._nvtd = [];
-			ts.p._nvtd[0] = twd ? Math.floor((ts.p.width - twd)/2) : Math.floor(ts.p.width/3);
-			ts.p._nvtd[1] = 0;
-			pgl=null;
-			$('.ui-pg-selbox',"#"+pgcnt).bind('change',function() { 
-				ts.p.page = Math.round(ts.p.rowNum*(ts.p.page-1)/this.value-0.5)+1;
-				ts.p.rowNum = this.value;
-				if(tp) { $('.ui-pg-selbox',ts.p.pager).val(this.value); }
-				else if(ts.p.toppager) { $('.ui-pg-selbox',ts.p.toppager).val(this.value); }
-				if(!clearVals('records')) { return false; }
-				populate();
-				return false;
-			});
-			if(ts.p.pgbuttons===true) {
-			$(".ui-pg-button","#"+pgcnt).hover(function(e){
-				if($(this).hasClass('ui-state-disabled')) {
-					this.style.cursor='default';
-				} else {
-					$(this).addClass('ui-state-hover');
-					this.style.cursor='pointer';
-				}
-			},function(e) {
-				if($(this).hasClass('ui-state-disabled')) {
-				} else {
-					$(this).removeClass('ui-state-hover');
-					this.style.cursor= "default";
-				}
-			});
-			$("#first"+tp+", #prev"+tp+", #next"+tp+", #last"+tp,"#"+pgid).click( function(e) {
-				var cp = intNum(ts.p.page,1),
-				last = intNum(ts.p.lastpage,1), selclick = false,
-				fp=true, pp=true, np=true,lp=true;
-				if(last ===0 || last===1) {fp=false;pp=false;np=false;lp=false; }
-				else if( last>1 && cp >=1) {
-					if( cp === 1) { fp=false; pp=false; } 
-					else if( cp>1 && cp <last){ }
-					else if( cp===last){ np=false;lp=false; }
-				} else if( last>1 && cp===0 ) { np=false;lp=false; cp=last-1;}
-				if( this.id === 'first'+tp && fp ) { ts.p.page=1; selclick=true;} 
-				if( this.id === 'prev'+tp && pp) { ts.p.page=(cp-1); selclick=true;} 
-				if( this.id === 'next'+tp && np) { ts.p.page=(cp+1); selclick=true;} 
-				if( this.id === 'last'+tp && lp) { ts.p.page=last; selclick=true;}
-				if(selclick) {
-					if(!clearVals(this.id)) { return false; }
-					populate();
-				}
-				return false;
-			});
-			}
-			if(ts.p.pginput===true) {
-			$('input.ui-pg-input',"#"+pgcnt).keypress( function(e) {
-				var key = e.charCode ? e.charCode : e.keyCode ? e.keyCode : 0;
-				if(key == 13) {
-					ts.p.page = ($(this).val()>0) ? $(this).val():ts.p.page;
-					if(!clearVals('user')) { return false; }
-					populate();
-					return false;
-				}
-				return this;
-			});
-			}
-		},
-		sortData = function (index, idxcol,reload,sor){
-			if(!ts.p.colModel[idxcol].sortable) { return; }
-			var so;
-			if(ts.p.savedRow.length > 0) {return;}
-			if(!reload) {
-				if( ts.p.lastsort == idxcol ) {
-					if( ts.p.sortorder == 'asc') {
-						ts.p.sortorder = 'desc';
-					} else if(ts.p.sortorder == 'desc') { ts.p.sortorder = 'asc';}
-				} else { ts.p.sortorder = ts.p.colModel[idxcol].firstsortorder || 'asc'; }
-				ts.p.page = 1;
-			}
-			if(sor) {
-				if(ts.p.lastsort == idxcol && ts.p.sortorder == sor && !reload) { return; }
-				else { ts.p.sortorder = sor; }
-			}
-			var thd= $("thead:first",ts.grid.hDiv).get(0);
-			$("tr th:eq("+ts.p.lastsort+") span.ui-grid-ico-sort",thd).addClass('ui-state-disabled');
-			$("tr th:eq("+ts.p.lastsort+")",thd).attr("aria-selected","false");
-			$("tr th:eq("+idxcol+") span.ui-icon-"+ts.p.sortorder,thd).removeClass('ui-state-disabled');
-			$("tr th:eq("+idxcol+")",thd).attr("aria-selected","true");
-			if(!ts.p.viewsortcols[0]) {
-				if(ts.p.lastsort != idxcol) {
-					$("tr th:eq("+ts.p.lastsort+") span.s-ico",thd).hide();
-					$("tr th:eq("+idxcol+") span.s-ico",thd).show();
-				}
-			}
-			index = index.substring(5);
-			ts.p.sortname = ts.p.colModel[idxcol].index || index;
-			so = ts.p.sortorder;
-			if($.isFunction(ts.p.onSortCol)) {if (ts.p.onSortCol.call(ts,index,idxcol,so)=='stop') {ts.p.lastsort = idxcol; return;}}
-			if(ts.p.datatype == "local") {
-				if(ts.p.deselectAfterSort) {$(ts).jqGrid("resetSelection");}
-			} else {
-				ts.p.selrow = null;
-				if(ts.p.multiselect){$("#cb_"+$.jgrid.jqID(ts.p.id),ts.grid.hDiv).attr("checked",false);}
-				ts.p.selarrrow =[];
-				ts.p.savedRow =[];
-				if(ts.p.scroll) {emptyRows(ts.grid.bDiv,true);}
-			}
-			if(ts.p.subGrid && ts.p.datatype=='local') {
-				$("td.sgexpanded","#"+ts.p.id).each(function(){
-					$(this).trigger("click");
-				});
-			}
-			populate();
-			ts.p.lastsort = idxcol;
-			if(ts.p.sortname != index && idxcol) {ts.p.lastsort = idxcol;}
-		},
-		setColWidth = function () {
-			var initwidth = 0, brd=ts.p.cellLayout, vc=0, lvc, scw=ts.p.scrollOffset,cw,hs=false,aw,tw=0,gw=0,
-			cl = 0, cr;
-			if (isSafari) { brd=0; }
-			$.each(ts.p.colModel, function(i) {
-				if(typeof this.hidden === 'undefined') {this.hidden=false;}
-				if(this.hidden===false){
-					initwidth += intNum(this.width,0);
-					if(this.fixed) {
-						tw += this.width;
-						gw += this.width+brd;
-					} else {
-						vc++;
-					}
-					cl++;
-				}
-			});
-			if(isNaN(ts.p.width)) {ts.p.width = grid.width = initwidth;}
-			else { grid.width = ts.p.width;}
-			ts.p.tblwidth = initwidth;
-			if(ts.p.shrinkToFit ===false && ts.p.forceFit === true) {ts.p.forceFit=false;}
-			if(ts.p.shrinkToFit===true && vc > 0) {
-				aw = grid.width-brd*vc-gw;
-				if(isNaN(ts.p.height)) {
-				} else {
-					aw -= scw;
-					hs = true;
-				}
-				initwidth =0;
-				$.each(ts.p.colModel, function(i) {
-					if(this.hidden === false && !this.fixed){
-						cw = Math.round(aw*this.width/(ts.p.tblwidth-tw));
-						this.width =cw;
-						initwidth += cw;
-						lvc = i;
-					}
-				});
-				cr =0;
-				if (hs) {
-					if(grid.width-gw-(initwidth+brd*vc) !== scw){
-						cr = grid.width-gw-(initwidth+brd*vc)-scw;
-					}
-				} else if(!hs && Math.abs(grid.width-gw-(initwidth+brd*vc)) !== 1) {
-					cr = grid.width-gw-(initwidth+brd*vc);
-				}
-				ts.p.colModel[lvc].width += cr;
-				ts.p.tblwidth = initwidth+cr+tw+cl*brd;
-				if(ts.p.tblwidth > ts.p.width) {
-					ts.p.colModel[lvc].width -= (ts.p.tblwidth - parseInt(ts.p.width,10));
-					ts.p.tblwidth = ts.p.width;
-				}
-			}
-		},
-		nextVisible= function(iCol) {
-			var ret = iCol, j=iCol, i;
-			for (i = iCol+1;i<ts.p.colModel.length;i++){
-				if(ts.p.colModel[i].hidden !== true ) {
-					j=i; break;
-				}
-			}
-			return j-ret;
-		},
-		getOffset = function (iCol) {
-			var i, ret = {}, brd1 = isSafari ? 0 : ts.p.cellLayout;
-			ret[0] =  ret[1] = ret[2] = 0;
-			for(i=0;i<=iCol;i++){
-				if(ts.p.colModel[i].hidden === false ) {
-					ret[0] += ts.p.colModel[i].width+brd1;
-				}
-			}
-			if(ts.p.direction=="rtl") { ret[0] = ts.p.width - ret[0]; }
-			ret[0] = ret[0] - ts.grid.bDiv.scrollLeft;
-			if($(ts.grid.cDiv).is(":visible")) {ret[1] += $(ts.grid.cDiv).height() +parseInt($(ts.grid.cDiv).css("padding-top"),10)+parseInt($(ts.grid.cDiv).css("padding-bottom"),10);}
-			if(ts.p.toolbar[0]===true && (ts.p.toolbar[1]=='top' || ts.p.toolbar[1]=='both')) {ret[1] += $(ts.grid.uDiv).height()+parseInt($(ts.grid.uDiv).css("border-top-width"),10)+parseInt($(ts.grid.uDiv).css("border-bottom-width"),10);}
-			if(ts.p.toppager) {ret[1] += $(ts.grid.topDiv).height()+parseInt($(ts.grid.topDiv).css("border-bottom-width"),10);}
-			ret[2] += $(ts.grid.bDiv).height() + $(ts.grid.hDiv).height();
-			return ret;
-		};
-		this.p.id = this.id;
-		if ($.inArray(ts.p.multikey,sortkeys) == -1 ) {ts.p.multikey = false;}
-		ts.p.keyIndex=false;
-		for (i=0; i<ts.p.colModel.length;i++) {
-			if (ts.p.colModel[i].key===true) {
-				ts.p.keyIndex = i;
-				break;
-			}
-		}
-		ts.p.sortorder = ts.p.sortorder.toLowerCase();
-		if(this.p.treeGrid === true) {
-			try { $(this).jqGrid("setTreeGrid");} catch (_) {}
-		}
-		if(this.p.subGrid) {
-			try { $(ts).jqGrid("setSubGrid");} catch (_){}
-		}
-		if(this.p.multiselect) {
-			this.p.colNames.unshift("<input role='checkbox' id='cb_"+this.p.id+"' class='cbox' type='checkbox'/>");
-			this.p.colModel.unshift({name:'cb',width:isSafari ? ts.p.multiselectWidth+ts.p.cellLayout : ts.p.multiselectWidth,sortable:false,resizable:false,hidedlg:true,search:false,align:'center',fixed:true});
-		}
-		if(this.p.rownumbers) {
-			this.p.colNames.unshift("");
-			this.p.colModel.unshift({name:'rn',width:ts.p.rownumWidth,sortable:false,resizable:false,hidedlg:true,search:false,align:'center',fixed:true});
-		}
-		ts.p.xmlReader = $.extend(true,{
-			root: "rows",
-			row: "row",
-			page: "rows>page",
-			total: "rows>total",
-			records : "rows>records",
-			repeatitems: true,
-			cell: "cell",
-			id: "[id]",
-			userdata: "userdata",
-			subgrid: {root:"rows", row: "row", repeatitems: true, cell:"cell"}
-		}, ts.p.xmlReader);
-		ts.p.jsonReader = $.extend(true,{
-			root: "rows",
-			page: "page",
-			total: "total",
-			records: "records",
-			repeatitems: true,
-			cell: "cell",
-			id: "id",
-			userdata: "userdata",
-			subgrid: {root:"rows", repeatitems: true, cell:"cell"}
-		},ts.p.jsonReader);
-		if(ts.p.scroll){
-			ts.p.pgbuttons = false; ts.p.pginput=false; ts.p.rowList=[];
-		}
-		var thead = "<thead><tr class='ui-jqgrid-labels' role='rowheader'>",
-		tdc, idn, w, res, sort,
-		td, ptr, tbody, imgs,iac="",idc="";
-		if(ts.p.shrinkToFit===true && ts.p.forceFit===true) {
-			for (i=ts.p.colModel.length-1;i>=0;i--){
-				if(!ts.p.colModel[i].hidden) {
-					ts.p.colModel[i].resizable=false;
-					break;
-				}
-			}
-		}
-		if(ts.p.viewsortcols[1] == 'horizontal') {iac=" ui-i-asc";idc=" ui-i-desc";}
-		tdc = isMSIE ?  "class='ui-th-div-ie'" :"";
-		imgs = "<span class='s-ico' style='display:none'><span sort='asc' class='ui-grid-ico-sort ui-icon-asc"+iac+" ui-state-disabled ui-icon ui-icon-triangle-1-n ui-sort-"+dir+"'></span>";
-		imgs += "<span sort='desc' class='ui-grid-ico-sort ui-icon-desc"+idc+" ui-state-disabled ui-icon ui-icon-triangle-1-s ui-sort-"+dir+"'></span></span>";
-		for(i=0;i<this.p.colNames.length;i++){
-			var tooltip = ts.p.headertitles ? (" title=\""+$.jgrid.stripHtml(ts.p.colNames[i])+"\"") :"";
-			thead += "<th id='"+ts.p.id+"_"+ts.p.colModel[i].name+"' role='columnheader' class='ui-state-default ui-th-column ui-th-"+dir+"'"+ tooltip+">";
-			idn = ts.p.colModel[i].index || ts.p.colModel[i].name;
-			thead += "<div id='jqgh_"+ts.p.colModel[i].name+"' "+tdc+">"+ts.p.colNames[i];
-			if(!ts.p.colModel[i].width)  { ts.p.colModel[i].width = 150; }
-			else { ts.p.colModel[i].width = parseInt(ts.p.colModel[i].width,10); }
-			if(typeof(ts.p.colModel[i].title) !== "boolean") { ts.p.colModel[i].title = true; }
-			if (idn == ts.p.sortname) {
-				ts.p.lastsort = i;
-			} 
-			thead += imgs+"</div></th>";
-		}
-		thead += "</tr></thead>";
-		$(this).append(thead);
-		$("thead tr:first th",this).hover(function(){$(this).addClass('ui-state-hover');},function(){$(this).removeClass('ui-state-hover');});
-		if(this.p.multiselect) {
-			var emp=[], chk;
-			$('#cb_'+$.jgrid.jqID(ts.p.id),this).bind('click',function(){
-				if (this.checked) {
-					$("[id^=jqg_]",ts.rows).attr("checked",true);
-					$(ts.rows).each(function(i) {
-						if(!$(this).hasClass("subgrid")){
-						$(this).addClass("ui-state-highlight").attr("aria-selected","true");
-						ts.p.selarrrow[i]= ts.p.selrow = this.id; 
-						}
-					});
-					chk=true;
-					emp=[];
-				}
-				else {
-					$("[id^=jqg_]",ts.rows).attr("checked",false);
-					$(ts.rows).each(function(i) {
-						if(!$(this).hasClass("subgrid")){
-							$(this).removeClass("ui-state-highlight").attr("aria-selected","false");
-							emp[i] = this.id;
-						}
-					});
-					ts.p.selarrrow = []; ts.p.selrow = null;
-					chk=false;
-				}
-				if($.isFunction(ts.p.onSelectAll)) {ts.p.onSelectAll.call(ts, chk ? ts.p.selarrrow : emp,chk);}
-			});
-		}
-		
-		if(ts.p.autowidth===true) {
-			var pw = $(eg).innerWidth();
-			ts.p.width = pw > 0?  pw: 'nw';
-		}
-		setColWidth();
-		$(eg).css("width",grid.width+"px").append("<div class='ui-jqgrid-resize-mark' id='rs_m"+ts.p.id+"'>&#160;</div>");
-		$(gv).css("width",grid.width+"px");
-		thead = $("thead:first",ts).get(0);
-		var	tfoot = "<table role='grid' style='width:"+ts.p.tblwidth+"px' class='ui-jqgrid-ftable' cellspacing='0' cellpadding='0' border='0'><tbody><tr role='row' class='ui-widget-content footrow footrow-"+dir+"'>";
-		var thr = $("tr:first",thead);
-		ts.p.disableClick=false;
-		$("th",thr).each(function ( j ) {
-			w = ts.p.colModel[j].width;
-			if(typeof ts.p.colModel[j].resizable === 'undefined') {ts.p.colModel[j].resizable = true;}
-			if(ts.p.colModel[j].resizable){
-				res = document.createElement("span");
-				$(res).html("&#160;").addClass('ui-jqgrid-resize ui-jqgrid-resize-'+dir);
-				if(!$.browser.opera) { $(res).css("cursor","col-resize"); }
-				$(this).addClass(ts.p.resizeclass);
-			} else {
-				res = "";
-			}
-			$(this).css("width",w+"px").prepend(res);
-			if( ts.p.colModel[j].hidden ) { $(this).css("display","none"); }
-			grid.headers[j] = { width: w, el: this };
-			sort = ts.p.colModel[j].sortable;
-			if( typeof sort !== 'boolean') {ts.p.colModel[j].sortable =  true; sort=true;}
-			var nm = ts.p.colModel[j].name;
-			if( !(nm == 'cb' || nm=='subgrid' || nm=='rn') ) {
-				if(ts.p.viewsortcols[2]){
-					$("div",this).addClass('ui-jqgrid-sortable');
-				}
-			}
-			if(sort) {
-				if(ts.p.viewsortcols[0]) {$("div span.s-ico",this).show(); if(j==ts.p.lastsort){ $("div span.ui-icon-"+ts.p.sortorder,this).removeClass("ui-state-disabled");}}
-				else if( j == ts.p.lastsort) {$("div span.s-ico",this).show();$("div span.ui-icon-"+ts.p.sortorder,this).removeClass("ui-state-disabled");}
-			}
-			tfoot += "<td role='gridcell' "+formatCol(j,0,'')+">&#160;</td>";
-		}).mousedown(function(e) {
-			if ($(e.target).closest("th>span.ui-jqgrid-resize").length != 1) { return; }
-			var ci = $.jgrid.getCellIndex(this);
-			if(ts.p.forceFit===true) {ts.p.nv= nextVisible(ci);}
-			grid.dragStart(ci, e, getOffset(ci));
-			return false;
-		}).click(function(e) {
-			if (ts.p.disableClick) {
-				ts.p.disableClick = false;
-				return false;
-			}
-			var s = "th>div.ui-jqgrid-sortable",r,d;
-			if (!ts.p.viewsortcols[2]) { s = "th>div>span>span.ui-grid-ico-sort"; }
-			var t = $(e.target).closest(s);
-			if (t.length != 1) { return; }
-			var ci = $.jgrid.getCellIndex(this);
-			if (!ts.p.viewsortcols[2]) { r=true;d=t.attr("sort"); }
-			sortData($('div',this)[0].id,ci,r,d);
-			return false;
-		});
-		if (ts.p.sortable && $.fn.sortable) {
-			try {
-				$(ts).jqGrid("sortableColumns", thr);
-			} catch (e){}
-		}
-		tfoot += "</tr></tbody></table>";
-		
-		tbody = document.createElement("tbody");
-		this.appendChild(tbody);
-		$(this).addClass('ui-jqgrid-btable');
-		var hTable = $("<table class='ui-jqgrid-htable' style='width:"+ts.p.tblwidth+"px' role='grid' aria-labelledby='gbox_"+this.id+"' cellspacing='0' cellpadding='0' border='0'></table>").append(thead),
-		hg = (ts.p.caption && ts.p.hiddengrid===true) ? true : false,
-		hb = $("<div class='ui-jqgrid-hbox" + (dir=="rtl" ? "-rtl" : "" )+"'></div>");
-		grid.hDiv = document.createElement("div");
-		$(grid.hDiv)
-			.css({ width: grid.width+"px"})
-			.addClass("ui-state-default ui-jqgrid-hdiv")
-			.append(hb);
-		$(hb).append(hTable);
-		if(hg) { $(grid.hDiv).hide(); }
-		if(ts.p.pager){
-			if(typeof ts.p.pager == "string") {if(ts.p.pager.substr(0,1) !="#") { ts.p.pager = "#"+ts.p.pager;} }
-			else { ts.p.pager = "#"+ $(ts.p.pager).attr("id");}
-			$(ts.p.pager).css({width: grid.width+"px"}).appendTo(eg).addClass('ui-state-default ui-jqgrid-pager ui-corner-bottom');
-			if(hg) {$(ts.p.pager).hide();}
-			setPager(ts.p.pager,'');
-		}
-		if( ts.p.cellEdit === false && ts.p.hoverrows === true) {
-		$(ts).bind('mouseover',function(e) {
-			ptr = $(e.target).closest("tr.jqgrow");
-			if($(ptr).attr("class") !== "subgrid") {
-				$(ptr).addClass("ui-state-hover");
-			}
-			return false;
-		}).bind('mouseout',function(e) {
-			ptr = $(e.target).closest("tr.jqgrow");
-			$(ptr).removeClass("ui-state-hover");
-			return false;
-		});
-		}
-		var ri,ci;
-		$(ts).before(grid.hDiv).click(function(e) {
-			td = e.target;
-			var scb = $(td).hasClass("cbox");
-			ptr = $(td,ts.rows).closest("tr.jqgrow");
-			if($(ptr).length === 0 ) {
-				return this;
-			}
-			var cSel = true;
-			if($.isFunction(ts.p.beforeSelectRow)) { cSel = ts.p.beforeSelectRow.call(ts,ptr[0].id, e); }
-			if (td.tagName == 'A' || ((td.tagName == 'INPUT' || td.tagName == 'TEXTAREA' || td.tagName == 'OPTION' || td.tagName == 'SELECT' ) && !scb) ) { return this; }
-			if(cSel === true) {
-				if(ts.p.cellEdit === true) {
-					if(ts.p.multiselect && scb){
-						$(ts).jqGrid("setSelection",ptr[0].id,true);
-					} else {
-						ri = ptr[0].rowIndex;
-						ci = $.jgrid.getCellIndex(td);
-						try {$(ts).jqGrid("editCell",ri,ci,true);} catch (_) {}
-					}
-				} else if ( !ts.p.multikey ) {
-					if(ts.p.multiselect && ts.p.multiboxonly) {
-						if(scb){$(ts).jqGrid("setSelection",ptr[0].id,true);}
-						else {
-							$(ts.p.selarrrow).each(function(i,n){
-								var ind = ts.rows.namedItem(n);
-								$(ind).removeClass("ui-state-highlight");
-								$("#jqg_"+$.jgrid.jqID(n),ind).attr("checked",false);
-							});
-							ts.p.selarrrow = [];
-							$("#cb_"+$.jgrid.jqID(ts.p.id),ts.grid.hDiv).attr("checked",false);
-							$(ts).jqGrid("setSelection",ptr[0].id,true);
-						}
-					} else {
-						$(ts).jqGrid("setSelection",ptr[0].id,true);
-					}
-				} else {
-					if(e[ts.p.multikey]) {
-						$(ts).jqGrid("setSelection",ptr[0].id,true);
-					} else if(ts.p.multiselect && scb) {
-						scb = $("[id^=jqg_]",ptr).attr("checked");
-						$("[id^=jqg_]",ptr).attr("checked",!scb);
-					}
-				}
-				if($.isFunction(ts.p.onCellSelect)) {
-					ri = ptr[0].id;
-					ci = $.jgrid.getCellIndex(td);
-					ts.p.onCellSelect.call(ts,ri,ci,$(td).html(),e);
-				}
-				e.stopPropagation();
-			} else {
-				return this;
-			}
-		}).bind('reloadGrid', function(e,opts) {
-			if(ts.p.treeGrid ===true) {	ts.p.datatype = ts.p.treedatatype;}
-			if (opts && opts.current) {
-				ts.grid.selectionPreserver(ts);
-			}
-			if(ts.p.datatype=="local"){ $(ts).jqGrid("resetSelection");}
-			else if(!ts.p.treeGrid) {
-				ts.p.selrow=null;
-				if(ts.p.multiselect) {ts.p.selarrrow =[];$('#cb_'+$.jgrid.jqID(ts.p.id),ts.grid.hDiv).attr("checked",false);}
-				ts.p.savedRow = [];
-				if(ts.p.scroll) {emptyRows(ts.grid.bDiv,true);}
-			}
-			if (opts && opts.page) {
-				var page = opts.page;
-				if (page > ts.p.lastpage) { page = ts.p.lastpage; }
-				if (page < 1) { page = 1; }
-				ts.p.page = page;
-				if (ts.grid.prevRowHeight) {
-					ts.grid.bDiv.scrollTop = (page - 1) * ts.grid.prevRowHeight * ts.p.rowNum;
-				} else {
-					ts.grid.bDiv.scrollTop = 0;
-				}
-			}
-			if (ts.grid.prevRowHeight && ts.p.scroll) {
-                delete ts.p.lastpage;
-				ts.grid.populateVisible();
-			} else {
-				ts.grid.populate();
-			}
-			return false;
-		});
-		if( $.isFunction(this.p.ondblClickRow) ) {
-			$(this).dblclick(function(e) {
-				td = e.target;
-				ptr = $(td,ts.rows).closest("tr.jqgrow");
-				if($(ptr).length === 0 ){return false;}
-				ri = ptr[0].rowIndex;
-				ci = $.jgrid.getCellIndex(td);
-				ts.p.ondblClickRow.call(ts,$(ptr).attr("id"),ri,ci, e);
-				return false;
-			});
-		}
-		if ($.isFunction(this.p.onRightClickRow)) {
-			$(this).bind('contextmenu', function(e) {
-				td = e.target;
-				ptr = $(td,ts.rows).closest("tr.jqgrow");
-				if($(ptr).length === 0 ){return false;}
-				if(!ts.p.multiselect) {	$(ts).jqGrid("setSelection",ptr[0].id,true);	}
-				ri = ptr[0].rowIndex;
-				ci = $.jgrid.getCellIndex(td);
-				ts.p.onRightClickRow.call(ts,$(ptr).attr("id"),ri,ci, e);
-				return false;
-			});
-		}
-		grid.bDiv = document.createElement("div");
-		$(grid.bDiv)
-			.append($('<div style="position:relative;'+(isMSIE && $.browser.version < 8 ? "height:0.01%;" : "")+'"></div>').append('<div></div>').append(this))
-			.addClass("ui-jqgrid-bdiv")
-			.css({ height: ts.p.height+(isNaN(ts.p.height)?"":"px"), width: (grid.width)+"px"})
-			.scroll(grid.scrollGrid);
-		$("table:first",grid.bDiv).css({width:ts.p.tblwidth+"px"});
-		if( isMSIE ) {
-			if( $("tbody",this).size() == 2 ) { $("tbody:first",this).remove();}
-			if( ts.p.multikey) {$(grid.bDiv).bind("selectstart",function(){return false;});}
-		} else {
-			if( ts.p.multikey) {$(grid.bDiv).bind("mousedown",function(){return false;});}
-		}
-		if(hg) {$(grid.bDiv).hide();}
-		grid.cDiv = document.createElement("div");
-		var arf = ts.p.hidegrid===true ? $("<a role='link' href='javascript:void(0)'/>").addClass('ui-jqgrid-titlebar-close HeaderButton').hover(
-			function(){ arf.addClass('ui-state-hover');},
-			function() {arf.removeClass('ui-state-hover');})
-		.append("<span class='ui-icon ui-icon-circle-triangle-n'></span>").css((dir=="rtl"?"left":"right"),"0px") : "";
-		$(grid.cDiv).append(arf).append("<span class='ui-jqgrid-title"+(dir=="rtl" ? "-rtl" :"" )+"'>"+ts.p.caption+"</span>")
-		.addClass("ui-jqgrid-titlebar ui-widget-header ui-corner-top ui-helper-clearfix");
-		$(grid.cDiv).insertBefore(grid.hDiv);
-		if( ts.p.toolbar[0] ) {
-			grid.uDiv = document.createElement("div");
-			if(ts.p.toolbar[1] == "top") {$(grid.uDiv).insertBefore(grid.hDiv);}
-			else if (ts.p.toolbar[1]=="bottom" ) {$(grid.uDiv).insertAfter(grid.hDiv);}
-			if(ts.p.toolbar[1]=="both") {
-				grid.ubDiv = document.createElement("div");
-				$(grid.uDiv).insertBefore(grid.hDiv).addClass("ui-userdata ui-state-default").attr("id","t_"+this.id);
-				$(grid.ubDiv).insertAfter(grid.hDiv).addClass("ui-userdata ui-state-default").attr("id","tb_"+this.id);
-				if(hg)  {$(grid.ubDiv).hide();}
-			} else {
-				$(grid.uDiv).width(grid.width).addClass("ui-userdata ui-state-default").attr("id","t_"+this.id);
-			}
-			if(hg) {$(grid.uDiv).hide();}
-		}
-		if(ts.p.toppager) {
-			ts.p.toppager = ts.p.id+"_toppager";
-			grid.topDiv = $("<div id='"+ts.p.toppager+"'></div>")[0];
-			ts.p.toppager = "#"+ts.p.toppager;
-			$(grid.topDiv).insertBefore(grid.hDiv).addClass('ui-state-default ui-jqgrid-toppager').width(grid.width);
-			setPager(ts.p.toppager,'_t');
-		}
-		if(ts.p.footerrow) {
-			grid.sDiv = $("<div class='ui-jqgrid-sdiv'></div>")[0];
-			hb = $("<div class='ui-jqgrid-hbox"+(dir=="rtl"?"-rtl":"")+"'></div>");
-			$(grid.sDiv).append(hb).insertAfter(grid.hDiv).width(grid.width);
-			$(hb).append(tfoot);
-			grid.footers = $(".ui-jqgrid-ftable",grid.sDiv)[0].rows[0].cells;
-			if(ts.p.rownumbers) { grid.footers[0].className = 'ui-state-default jqgrid-rownum'; }
-			if(hg) {$(grid.sDiv).hide();}
-		}
-		if(ts.p.caption) {
-			var tdt = ts.p.datatype;
-			if(ts.p.hidegrid===true) {
-				$(".ui-jqgrid-titlebar-close",grid.cDiv).click( function(e){
-					var onHdCl = $.isFunction(ts.p.onHeaderClick);
-					if(ts.p.gridstate == 'visible') {
-						$(".ui-jqgrid-bdiv, .ui-jqgrid-hdiv","#gview_"+ts.p.id).slideUp("fast");
-						if(ts.p.pager) {$(ts.p.pager).slideUp("fast");}
-						if(ts.p.toppager) {$(ts.p.toppager).slideUp("fast");}
-						if(ts.p.toolbar[0]===true) {
-							if( ts.p.toolbar[1]=='both') {
-								$(grid.ubDiv).slideUp("fast");
-							}
-							$(grid.uDiv).slideUp("fast");
-						}
-						if(ts.p.footerrow) { $(".ui-jqgrid-sdiv","#gbox_"+ts.p.id).slideUp("fast"); }
-						$("span",this).removeClass("ui-icon-circle-triangle-n").addClass("ui-icon-circle-triangle-s");
-						ts.p.gridstate = 'hidden';
-						if($("#gbox_"+ts.p.id).hasClass("ui-resizable")) { $(".ui-resizable-handle","#gbox_"+ts.p.id).hide(); }
-						if(onHdCl) {if(!hg) {ts.p.onHeaderClick.call(ts,ts.p.gridstate,e);}}
-					} else if(ts.p.gridstate == 'hidden'){
-						$(".ui-jqgrid-hdiv, .ui-jqgrid-bdiv","#gview_"+ts.p.id).slideDown("fast");
-						if(ts.p.pager) {$(ts.p.pager).slideDown("fast");}
-						if(ts.p.toppager) {$(ts.p.toppager).slideDown("fast");}
-						if(ts.p.toolbar[0]===true) {
-							if( ts.p.toolbar[1]=='both') {
-								$(grid.ubDiv).slideDown("fast");
-							}
-							$(grid.uDiv).slideDown("fast");
-						}
-						if(ts.p.footerrow) { $(".ui-jqgrid-sdiv","#gbox_"+ts.p.id).slideDown("fast"); }
-						$("span",this).removeClass("ui-icon-circle-triangle-s").addClass("ui-icon-circle-triangle-n");
-						if(hg) {ts.p.datatype = tdt;populate();hg=false;}
-						ts.p.gridstate = 'visible';
-						if($("#gbox_"+ts.p.id).hasClass("ui-resizable")) { $(".ui-resizable-handle","#gbox_"+ts.p.id).show(); }
-						if(onHdCl) {ts.p.onHeaderClick.call(ts,ts.p.gridstate,e);}
-					}
-					return false;
-				});
-				if(hg) {ts.p.datatype="local"; $(".ui-jqgrid-titlebar-close",grid.cDiv).trigger("click");}
-			}
-		} else {$(grid.cDiv).hide();}
-		$(grid.hDiv).after(grid.bDiv)
-		.mousemove(function (e) {
-			if(grid.resizing){grid.dragMove(e);return false;}
-		});
-		$(".ui-jqgrid-labels",grid.hDiv).bind("selectstart", function () { return false; });
-		$(document).mouseup(function (e) {
-			if(grid.resizing) {	grid.dragEnd(); return false;}
-			return true;
-		});
-		this.updateColumns = function () {
-			var r = this.rows[0], self =this;
-			if(r) {
-				$("td",r).each( function( k ) {
-					$(this).css("width",self.grid.headers[k].width+"px");
-				});
-				this.grid.cols = r.cells;
-			}
-			return this;
-		};
-		ts.formatCol = formatCol;
-		ts.sortData = sortData;
-		ts.updatepager = updatepager;
-		ts.formatter = function ( rowId, cellval , colpos, rwdat, act){return formatter(rowId, cellval , colpos, rwdat, act);};
-		$.extend(grid,{populate : populate, emptyRows: emptyRows});
-		this.grid = grid;
-		ts.addXmlData = function(d) {addXmlData(d,ts.grid.bDiv);};
-		ts.addJSONData = function(d) {addJSONData(d,ts.grid.bDiv);};
-		populate();ts.p.hiddengrid=false;
-		$(window).unload(function () {
-			ts = null;
-		});
-	});
-};
-$.jgrid.extend({
-	getGridParam : function(pName) {
-		var $t = this[0];
-		if (!$t.grid) {return;}
-		if (!pName) { return $t.p; }
-		else {return typeof($t.p[pName]) != "undefined" ? $t.p[pName] : null;}
-	},
-	setGridParam : function (newParams){
-		return this.each(function(){
-			if (this.grid && typeof(newParams) === 'object') {$.extend(true,this.p,newParams);}
-		});
-	},
-	getDataIDs : function () {
-		var ids=[], i=0, len;
-		this.each(function(){
-			len = this.rows.length;
-			if(len && len>0){
-				while(i<len) {
-					ids[i] = this.rows[i].id;
-					i++;
-				}
-			}
-		});
-		return ids;
-	},
-	setSelection : function(selection,onsr) {
-		return this.each(function(){
-			var $t = this, stat,pt, ner, ia, tpsr;
-			if(selection === undefined) { return; }
-			onsr = onsr === false ? false : true;
-			pt=$t.rows.namedItem(selection+"");
-			if(!pt) { return; }
-			function scrGrid(iR){
-				var ch = $($t.grid.bDiv)[0].clientHeight,
-				st = $($t.grid.bDiv)[0].scrollTop,
-				rpos = $t.rows[iR].offsetTop,
-				rh = $t.rows[iR].clientHeight;
-				if(rpos+rh >= ch+st) { $($t.grid.bDiv)[0].scrollTop = rpos-(ch+st)+rh+st; }
-				else if(rpos < ch+st) {
-					if(rpos < st) {
-						$($t.grid.bDiv)[0].scrollTop = rpos;
-					}
-				}
-			}
-			if($t.p.scrollrows===true) {
-				ner = $t.rows.namedItem(selection).rowIndex;
-				if(ner >=0 ){
-					scrGrid(ner);
-				}
-			}
-			if(!$t.p.multiselect) {
-				if(pt.className !== "ui-subgrid") {
-				if( $t.p.selrow ) { $($t.rows.namedItem($t.p.selrow)).removeClass("ui-state-highlight").attr("aria-selected","false"); }
-				$t.p.selrow = pt.id;
-				$(pt).addClass("ui-state-highlight").attr("aria-selected","true");
-				if( $t.p.onSelectRow && onsr) { $t.p.onSelectRow.call($t,$t.p.selrow, true); }
-				}
-			} else {
-				$t.p.selrow = pt.id;
-				ia = $.inArray($t.p.selrow,$t.p.selarrrow);
-				if (  ia === -1 ){ 
-					if(pt.className !== "ui-subgrid") { $(pt).addClass("ui-state-highlight").attr("aria-selected","true");}
-					stat = true;
-					$("#jqg_"+$.jgrid.jqID($t.p.selrow),$t.rows[pt.rowIndex]).attr("checked",stat);
-					$t.p.selarrrow.push($t.p.selrow);
-					if( $t.p.onSelectRow && onsr) { $t.p.onSelectRow.call($t,$t.p.selrow, stat); }
-				} else {
-					if(pt.className !== "ui-subgrid") { $(pt).removeClass("ui-state-highlight").attr("aria-selected","false");}
-					stat = false;
-					$("#jqg_"+$.jgrid.jqID($t.p.selrow),$t.rows[pt.rowIndex]).attr("checked",stat);
-					$t.p.selarrrow.splice(ia,1);
-					if( $t.p.onSelectRow && onsr) { $t.p.onSelectRow.call($t,$t.p.selrow, stat); }
-					tpsr = $t.p.selarrrow[0];
-					$t.p.selrow = (tpsr === undefined) ? null : tpsr;
-				}
-			}
-		});
-	},
-	resetSelection : function(){
-		return this.each(function(){
-			var t = this, ind;
-			if(!t.p.multiselect) {
-				if(t.p.selrow) {
-					$("tr#"+$.jgrid.jqID(t.p.selrow),t.grid.bDiv).removeClass("ui-state-highlight").attr("aria-selected","false");
-					t.p.selrow = null;
-				}
-			} else {
-				$(t.p.selarrrow).each(function(i,n){
-					ind = t.rows.namedItem(n);
-					$(ind).removeClass("ui-state-highlight").attr("aria-selected","false");
-					$("#jqg_"+$.jgrid.jqID(n),ind).attr("checked",false);
-				});
-				$("#cb_"+$.jgrid.jqID(t.p.id),t.grid.hDiv).attr("checked",false);
-				t.p.selarrrow = [];
-			}
-			t.p.savedRow = [];
-		});
-	},
-	getRowData : function( rowid ) {
-		var res = {}, resall, getall=false, len, j=0;
-		this.each(function(){
-			var $t = this,nm,ind;
-			if(typeof(rowid) == 'undefined') {
-				getall = true;
-				resall = [];
-				len = $t.rows.length;
-			} else {
-				ind = $t.rows.namedItem(rowid);
-				if(!ind) { return res; }
-				len = 1;
-			}
-			while(j<len){
-				if(getall) { ind = $t.rows[j]; }
-				$('td',ind).each( function(i) {
-					nm = $t.p.colModel[i].name; 
-					if ( nm !== 'cb' && nm !== 'subgrid') {
-						if($t.p.treeGrid===true && nm == $t.p.ExpandColumn) {
-							res[nm] = $.jgrid.htmlDecode($("span:first",this).html());
-						} else {
-							try {
-								res[nm] = $.unformat(this,{rowId:ind.id, colModel:$t.p.colModel[i]},i);
-							} catch (e){
-								res[nm] = $.jgrid.htmlDecode($(this).html());
-							}
-						}
-					}
-				});
-				j++;
-				if(getall) { resall.push(res); res={}; }
-			}
-		});
-		return resall ? resall: res;
-	},
-	delRowData : function(rowid) {
-		var success = false, rowInd, ia, ri;
-		this.each(function() {
-			var $t = this;
-			rowInd = $t.rows.namedItem(rowid);
-			if(!rowInd) {return false;}
-			else {
-				ri = rowInd.rowIndex;
-				$(rowInd).remove();
-				$t.p.records--;
-				$t.p.reccount--;
-				$t.updatepager(true,false);
-				success=true;
-				if($t.p.multiselect) {
-					ia = $.inArray(rowid,$t.p.selarrrow);
-					if(ia != -1) { $t.p.selarrrow.splice(ia,1);}
-				}  
-				if(rowid == $t.p.selrow) {$t.p.selrow=null;}
-			}
-			if( ri === 0 && success ) {
-				$t.updateColumns();
-			}
-			if( $t.p.altRows === true && success ) {
-				var cn = $t.p.altclass;
-				$($t.rows).each(function(i){
-					if(i % 2 ==1) { $(this).addClass(cn); }
-					else { $(this).removeClass(cn); }
-				});
-			}
-		});
-		return success;
-	},
-	setRowData : function(rowid, data, cssp) {
-		var nm, success=false, title;
-		this.each(function(){
-			var t = this, vl, ind, cp = typeof cssp;
-			if(!t.grid) {return false;}
-			ind = t.rows.namedItem(rowid);
-			if(!ind) { return false; }
-			if( data ) {
-				$(this.p.colModel).each(function(i){
-					nm = this.name;
-					if( data[nm] !== undefined) {
-						vl = t.formatter( rowid, data[nm], i, data, 'edit');
-						title = this.title ? {"title":$.jgrid.stripHtml(vl)} : {};
-						if(t.p.treeGrid===true && nm == t.p.ExpandColumn) {
-							$("td:eq("+i+") > span:first",ind).html(vl).attr(title);
-						} else {
-							$("td:eq("+i+")",ind).html(vl).attr(title); 
-						}
-						success = true;
-					}
-				});
-			}
-			if(cp === 'string') {$(ind).addClass(cssp);} else if(cp === 'object') {$(ind).css(cssp);}
-		});
-		return success;
-	},
-	addRowData : function(rowid,rdata,pos,src) {
-		if(!pos) {pos = "last";}
-		var success = false, nm, row, gi, si, ni,sind, i, v, prp="", aradd, cnm, cn, data;
-		if(rdata) {
-			if($.isArray(rdata)) {
-				aradd=true;
-				pos = "last";
-				cnm = rowid;
-			} else {
-				rdata = [rdata];
-				aradd = false;
-			}
-			this.each(function() {
-				var t = this, datalen = rdata.length;
-				ni = t.p.rownumbers===true ? 1 :0;
-				gi = t.p.multiselect ===true ? 1 :0;
-				si = t.p.subGrid===true ? 1 :0;
-				if(!aradd) {
-					if(typeof(rowid) != 'undefined') { rowid = rowid+"";}
-					else {
-						rowid = (t.p.records+1)+"";
-						if(t.p.keyIndex !== false) {
-							cnm = t.p.colModel[t.p.keyIndex+gi+si+ni].name;
-							if(typeof rdata[0][cnm] != "undefined") { rowid = rdata[0][cnm]; }
-						}
-					}
-				}
-				cn = t.p.altclass;
-				var k = 0, cna ="",
-				air = $.isFunction(t.p.afterInsertRow) ? true : false;
-				while(k < datalen) {
-					data = rdata[k];
-					row="";
-					if(aradd) {
-						try {rowid = data[cnm];}
-						catch (e) {rowid = t.p.records+1;}
-						cna = t.p.altRows === true ?  (t.rows.length-1)%2 === 0 ? cn : "" : "";
-					}
-					if(ni){
-						prp = t.formatCol(ni,1,'');
-						row += "<td role=\"gridcell\" aria-describedby=\""+t.p.id+"_rn\" class=\"ui-state-default jqgrid-rownum\" "+prp+">0</td>";
-					}
-					if(gi) {
-						v = "<input role=\"checkbox\" type=\"checkbox\""+" id=\"jqg_"+rowid+"\" class=\"cbox\"/>";
-						prp = t.formatCol(ni,1,'');
-						row += "<td role=\"gridcell\" aria-describedby=\""+t.p.id+"_cb\" "+prp+">"+v+"</td>";
-					}
-					if(si) {
-						row += $(t).jqGrid("addSubGridCell",gi+ni,1);
-					}
-					for(i = gi+si+ni; i < this.p.colModel.length;i++){
-						nm = this.p.colModel[i].name;
-						v = t.formatter( rowid, data[nm], i, data, 'add');
-						prp = t.formatCol(i,1,v);
-						row += "<td role=\"gridcell\" aria-describedby=\""+t.p.id+"_"+nm+"\" "+prp+">"+v+"</td>";
-					}
-					row = "<tr id=\""+rowid+"\" role=\"row\" class=\"ui-widget-content jqgrow ui-row-"+t.p.direction+" "+cna+"\">" + row+"</tr>";
-					if(t.p.subGrid===true) {
-						row = $(row)[0]; 
-						$(t).jqGrid("addSubGrid",row,gi+ni);
-					}
-					if(t.rows.length === 0){
-						$("table:first",t.grid.bDiv).append(row);
-					} else {
-					switch (pos) {
-						case 'last':
-							$(t.rows[t.rows.length-1]).after(row);
-							break;
-						case 'first':
-							$(t.rows[0]).before(row);
-							break;
-						case 'after':
-							sind = t.rows.namedItem(src);
-							if (sind) {
-								if($(t.rows[sind.rowIndex+1]).hasClass("ui-subgrid")) { $(t.rows[sind.rowIndex+1]).after(row); }
-								else { $(sind).after(row); }
-							}
-							break;
-						case 'before':
-							sind = t.rows.namedItem(src);
-							if(sind) {$(sind).before(row);sind=sind.rowIndex;}
-							break;
-					}
-					}
-					t.p.records++;
-					t.p.reccount++;
-					if(!t.grid.cols || !t.grid.cols.length) { t.grid.cols = t.rows[0].cells; }
-					if(pos==='first' || (pos==='before' && sind <= 1) ||  t.rows.length === 1 ){
-						t.updateColumns();
-					}
-					if(air) { t.p.afterInsertRow.call(t,rowid,data,data); }
-					k++;
-				}
-				if( t.p.altRows === true && !aradd) {
-					if (pos == "last") {
-						if ((t.rows.length-1)%2 == 1)  {$(t.rows[t.rows.length-1]).addClass(cn);}
-					} else {
-						$(t.rows).each(function(i){
-							if(i % 2 ==1) { $(this).addClass(cn); }
-							else { $(this).removeClass(cn); }
-						});
-					}
-				}
-				t.updatepager(true,true);
-				success = true;
-			});
-		}
-		return success;
-	},
-	footerData : function(action,data, format) {
-		var nm, success=false, res={}, title;
-		function isEmpty(obj) {
-			for(var i in obj) {
-				if (obj.hasOwnProperty(i)) { return false; }
-			}
-			return true;
-		}
-		if(typeof(action) == "undefined") { action = "get"; }
-		if(typeof(format) != "boolean") { format  = true; }
-		action = action.toLowerCase();
-		this.each(function(){
-			var t = this, vl;
-			if(!t.grid || !t.p.footerrow) {return false;}
-			if(action == "set") { if(isEmpty(data)) { return false; } }
-			success=true;
-			$(this.p.colModel).each(function(i){
-				nm = this.name;
-				if(action == "set") {
-					if( data[nm] !== undefined) {
-						vl = format ? t.formatter( "", data[nm], i, data, 'edit') : data[nm];
-						title = this.title ? {"title":$.jgrid.stripHtml(vl)} : {};
-						$("tr.footrow td:eq("+i+")",t.grid.sDiv).html(vl).attr(title); 
-						success = true;
-					}
-				} else if(action == "get") {
-					res[nm] = $("tr.footrow td:eq("+i+")",t.grid.sDiv).html();
-				}
-			});
-		});
-		return action == "get" ? res : success;
-	},
-	ShowHideCol : function(colname,show) {
-		return this.each(function() {
-			var $t = this, fndh=false;
-			if (!$t.grid ) {return;}
-			if( typeof colname === 'string') {colname=[colname];}
-			show = show !="none" ? "" : "none";
-			var sw = show == "" ? true :false;
-			$(this.p.colModel).each(function(i) {
-				if ($.inArray(this.name,colname) !== -1 && this.hidden === sw) {
-					$("tr",$t.grid.hDiv).each(function(){
-						$("th:eq("+i+")",this).css("display",show);
-					});
-					$($t.rows).each(function(j){
-						$("td:eq("+i+")",$t.rows[j]).css("display",show);
-					});
-					if($t.p.footerrow) { $("td:eq("+i+")",$t.grid.sDiv).css("display", show); }
-					if(show == "none") { $t.p.tblwidth -= this.width;} else {$t.p.tblwidth += this.width;}
-					this.hidden = !sw;
-					fndh=true;
-				}
-			});
-			if(fndh===true) {
-				$("table:first",$t.grid.hDiv).width($t.p.tblwidth);
-				$("table:first",$t.grid.bDiv).width($t.p.tblwidth);
-				$t.grid.hDiv.scrollLeft = $t.grid.bDiv.scrollLeft;
-				if($t.p.footerrow) {
-					$("table:first",$t.grid.sDiv).width($t.p.tblwidth);
-					$t.grid.sDiv.scrollLeft = $t.grid.bDiv.scrollLeft;
-				}
-			}
-		});
-	},
-	hideCol : function (colname) {
-		return this.each(function(){$(this).jqGrid("ShowHideCol",colname,"none");});
-	},
-	showCol : function(colname) {
-		return this.each(function(){$(this).jqGrid("ShowHideCol",colname,"");});
-	},
-	remapColumns : function(permutation, updateCells, keepHeader)
-	{
-		function resortArray(a) {
-			var ac;
-			if (a.length) {
-				ac = $.makeArray(a);
-			} else {
-				ac = $.extend({}, a);
-			}
-			$.each(permutation, function(i) {
-				a[i] = ac[this];
-			});
-		}
-		var ts = this.get(0);
-		function resortRows(parent, clobj) {
-			$(">tr"+(clobj||""), parent).each(function() {
-				var row = this;
-				var elems = $.makeArray(row.cells);
-				$.each(permutation, function() {
-					var e = elems[this];
-					if (e) {
-						row.appendChild(e);
-					}
-				});
-			});
-		}
-		resortArray(ts.p.colModel);
-		resortArray(ts.p.colNames);
-		resortArray(ts.grid.headers);
-		resortRows($("thead:first", ts.grid.hDiv), keepHeader && ":not(.ui-jqgrid-labels)");
-		if (updateCells) {
-			resortRows($("tbody:first", ts.grid.bDiv), ".jqgrow");
-		}
-		if (ts.p.footerrow) {
-			resortRows($("tbody:first", ts.grid.sDiv));
-		}
-		if (ts.p.remapColumns) {
-			if (!ts.p.remapColumns.length){
-				ts.p.remapColumns = $.makeArray(permutation);
-			} else {
-				resortArray(ts.p.remapColumns);
-			}
-		}
-		ts.p.lastsort = $.inArray(ts.p.lastsort, permutation);
-		if(ts.p.treeGrid) { ts.p.expColInd = $.inArray(ts.p.expColInd, permutation); }
-	},
-	setGridWidth : function(nwidth, shrink) {
-		return this.each(function(){
-			var $t = this, cw,
-			initwidth = 0, brd=$t.p.cellLayout, lvc, vc=0, hs=false, scw=$t.p.scrollOffset, aw, gw=0, tw=0,
-			cl = 0,cr;
-			if (!$t.grid ) {return;}
-			if(typeof shrink != 'boolean') {
-				shrink=$t.p.shrinkToFit;
-			}
-			if(isNaN(nwidth)) {return;}
-			else { nwidth = parseInt(nwidth,10); $t.grid.width = $t.p.width = nwidth;}
-			$("#gbox_"+$t.p.id).css("width",nwidth+"px");
-			$("#gview_"+$t.p.id).css("width",nwidth+"px");
-			$($t.grid.bDiv).css("width",nwidth+"px");
-			$($t.grid.hDiv).css("width",nwidth+"px");
-			if($t.p.pager ) {$($t.p.pager).css("width",nwidth+"px");}
-			if($t.p.toppager ) {$($t.p.toppager).css("width",nwidth+"px");}
-			if($t.p.toolbar[0] === true){
-				$($t.grid.uDiv).css("width",nwidth+"px");
-				if($t.p.toolbar[1]=="both") {$($t.grid.ubDiv).css("width",nwidth+"px");}
-			}
-			if($t.p.footerrow) { $($t.grid.sDiv).css("width",nwidth+"px"); }
-			if(shrink ===false && $t.p.forceFit === true) {$t.p.forceFit=false;}			
-			if(shrink===true) {
-				if ($.browser.safari) { brd=0;}
-				$.each($t.p.colModel, function(i) {
-					if(this.hidden===false){
-						initwidth += parseInt(this.width,10);
-						if(this.fixed) {
-							tw += this.width;
-							gw += this.width+brd;
-						} else {
-							vc++;
-						}
-						cl++;
-					}
-				});
-				if(vc  === 0) { return; }
-				$t.p.tblwidth = initwidth;
-				aw = nwidth-brd*vc-gw;
-				if(!isNaN($t.p.height)) {
-					if($($t.grid.bDiv)[0].clientHeight < $($t.grid.bDiv)[0].scrollHeight){
-						hs = true;
-						aw -= scw;
-					}
-				}
-				initwidth =0;
-				var cle = $t.grid.cols.length >0;
-				$.each($t.p.colModel, function(i) {
-					if(this.hidden === false && !this.fixed){
-						cw = Math.round(aw*this.width/($t.p.tblwidth-tw));
-						if (cw < 0) { return; }
-						this.width =cw;
-						initwidth += cw;
-						$t.grid.headers[i].width=cw;
-						$t.grid.headers[i].el.style.width=cw+"px";
-						if($t.p.footerrow) { $t.grid.footers[i].style.width = cw+"px"; }
-						if(cle) { $t.grid.cols[i].style.width = cw+"px"; }
-						lvc = i;
-					}
-				});
-				cr =0;
-				if (hs) {
-					if(nwidth-gw-(initwidth+brd*vc) !== scw){
-						cr = nwidth-gw-(initwidth+brd*vc)-scw;
-					}
-				} else if( Math.abs(nwidth-gw-(initwidth+brd*vc)) !== 1) {
-					cr = nwidth-gw-(initwidth+brd*vc);
-				}
-				$t.p.colModel[lvc].width += cr;
-				$t.p.tblwidth = initwidth+cr+tw+brd*cl;
-				if($t.p.tblwidth > nwidth) {
-					var delta = $t.p.tblwidth - parseInt(nwidth,10);
-					$t.p.tblwidth = nwidth;
-					cw = $t.p.colModel[lvc].width = $t.p.colModel[lvc].width-delta;
-				} else {
-					cw= $t.p.colModel[lvc].width;
-				}
-				$t.grid.headers[lvc].width = cw;
-				$t.grid.headers[lvc].el.style.width=cw+"px";
-				if(cle) { $t.grid.cols[lvc].style.width = cw+"px"; }
-				$('table:first',$t.grid.bDiv).css("width",$t.p.tblwidth+"px");
-				$('table:first',$t.grid.hDiv).css("width",$t.p.tblwidth+"px");
-				$t.grid.hDiv.scrollLeft = $t.grid.bDiv.scrollLeft;
-				if($t.p.footerrow) {
-					$t.grid.footers[lvc].style.width = cw+"px";
-					$('table:first',$t.grid.sDiv).css("width",$t.p.tblwidth+"px");
-				}
-			}
-		});
-	},
-	setGridHeight : function (nh) {
-		return this.each(function (){
-			var $t = this;
-			if(!$t.grid) {return;}
-			$($t.grid.bDiv).css({height: nh+(isNaN(nh)?"":"px")});
-			$t.p.height = nh;
-			if ($t.p.scroll) { $t.grid.populateVisible(); }
-		});
-	},
-	setCaption : function (newcap){
-		return this.each(function(){
-			this.p.caption=newcap;
-			$("span.ui-jqgrid-title",this.grid.cDiv).html(newcap);
-			$(this.grid.cDiv).show();
-		});
-	},
-	setLabel : function(colname, nData, prop, attrp ){
-		return this.each(function(){
-			var $t = this, pos=-1;
-			if(!$t.grid) {return;}
-			if(isNaN(colname)) {
-				$($t.p.colModel).each(function(i){
-					if (this.name == colname) {
-						pos = i;return false;
-					}
-				});
-			} else {pos = parseInt(colname,10);}
-			if(pos>=0) {
-				var thecol = $("tr.ui-jqgrid-labels th:eq("+pos+")",$t.grid.hDiv);
-				if (nData){
-					var ico = $(".s-ico",thecol);
-					$("[id^=jqgh_]",thecol).empty().html(nData).append(ico);
-					$t.p.colNames[pos] = nData;
-				}
-				if (prop) {
-					if(typeof prop === 'string') {$(thecol).addClass(prop);} else {$(thecol).css(prop);}
-				}
-				if(typeof attrp === 'object') {$(thecol).attr(attrp);}
-			}
-		});
-	},
-	setCell : function(rowid,colname,nData,cssp,attrp, forceupd) {
-		return this.each(function(){
-			var $t = this, pos =-1,v, title;
-			if(!$t.grid) {return;}
-			if(isNaN(colname)) {
-				$($t.p.colModel).each(function(i){
-					if (this.name == colname) {
-						pos = i;return false;
-					}
-				});
-			} else {pos = parseInt(colname,10);}
-			if(pos>=0) {
-				var ind = $t.rows.namedItem(rowid);
-				if (ind){
-					var tcell = $("td:eq("+pos+")",ind);
-					if(nData !== "" || forceupd === true) {
-						v = $t.formatter(rowid, nData, pos,ind,'edit');
-						title = $t.p.colModel[pos].title ? {"title":$.jgrid.stripHtml(v)} : {};
-						if($t.p.treeGrid && $(".tree-wrap",$(tcell)).length>0) {
-							$("span",$(tcell)).html(v).attr(title);
-						} else {
-							$(tcell).html(v).attr(title);
-						}
-					}
-					if(typeof cssp === 'string'){
-						$(tcell).addClass(cssp);
-					} else if(cssp) {
-						$(tcell).css(cssp);
-					}
-					if(typeof attrp === 'object') {$(tcell).attr(attrp);}
-				}
-			}
-		});
-	},
-	getCell : function(rowid,col) {
-		var ret = false;
-		this.each(function(){
-			var $t=this, pos=-1;
-			if(!$t.grid) {return;}
-			if(isNaN(col)) {
-				$($t.p.colModel).each(function(i){
-					if (this.name === col) {
-						pos = i;return false;
-					}
-				});
-			} else {pos = parseInt(col,10);}
-			if(pos>=0) {
-				var ind = $t.rows.namedItem(rowid);
-				if(ind) {
-					try {
-						ret = $.unformat($("td:eq("+pos+")",ind),{rowId:ind.id, colModel:$t.p.colModel[pos]},pos);
-					} catch (e){
-						ret = $.jgrid.htmlDecode($("td:eq("+pos+")",ind).html());
-					}
-				}
-			}
-		});
-		return ret;
-	},
-	getCol : function (col, obj, mathopr) {
-		var ret = [], val, sum=0;
-		obj = typeof (obj) != 'boolean' ? false : obj;
-		if(typeof mathopr == 'undefined') { mathopr = false; }
-		this.each(function(){
-			var $t=this, pos=-1;
-			if(!$t.grid) {return;}
-			if(isNaN(col)) {
-				$($t.p.colModel).each(function(i){
-					if (this.name === col) {
-						pos = i;return false;
-					}
-				});
-			} else {pos = parseInt(col,10);}
-			if(pos>=0) {
-				var ln = $t.rows.length, i =0;
-				if (ln && ln>0){
-					while(i<ln){
-						try {
-							val = $.unformat($($t.rows[i].cells[pos]),{rowId:$t.rows[i].id, colModel:$t.p.colModel[pos]},pos);
-						} catch (e) {
-							val = $.jgrid.htmlDecode($t.rows[i].cells[pos].innerHTML);
-						}
-						if(mathopr) { sum += parseFloat(val); }
-						else if(obj) { ret.push({id:$t.rows[i].id,value:val}); }
-						else { ret[i]=val; }
-						i++;
-					}
-					if(mathopr) {
-						switch(mathopr.toLowerCase()){
-							case 'sum': ret =sum; break;
-							case 'avg': ret = sum/ln; break;
-							case 'count': ret = ln; break;
-						}
-					}
-				}
-			}
-		});
-		return ret;
-	},
-	clearGridData : function(clearfooter) {
-		return this.each(function(){
-			var $t = this;
-			if(!$t.grid) {return;}
-			if(typeof clearfooter != 'boolean') { clearfooter = false; }
-			$("tbody:first tr", $t.grid.bDiv).remove();
-			if($t.p.footerrow && clearfooter) { $(".ui-jqgrid-ftable td",$t.grid.sDiv).html("&#160;"); }
-			$t.p.selrow = null; $t.p.selarrrow= []; $t.p.savedRow = [];
-			$t.p.records = 0;$t.p.page='0';$t.p.lastpage='0';$t.p.reccount=0;
-			$t.updatepager(true,false);
-		});
-	},
-	getInd : function(rowid,rc){
-		var ret =false,rw;
-		this.each(function(){
-			rw = this.rows.namedItem(rowid);
-			if(rw) {
-				ret = rc===true ? rw: rw.rowIndex;
-			}
-		});
-		return ret;
-	}
-});
-})(jQuery);
+// ==ClosureCompiler==
+// @compilation_level SIMPLE_OPTIMIZATIONS
+
+/**
+ * @license jqGrid  4.2.0  - jQuery Grid
+ * Copyright (c) 2008, Tony Tomov, tony@trirand.com
+ * Dual licensed under the MIT and GPL licenses
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl-2.0.html
+ * Date: 2011-10-11
+ */
+//jsHint options
+/*global document, window, jQuery, DOMParser, ActiveXObject $ */
+
+(function ($) {
+
+$.jgrid = $.jgrid || {};
+$.extend($.jgrid,{
+	htmlDecode : function(value){
+		if(value && (value=='&nbsp;' || value=='&#160;' || (value.length==1 && value.charCodeAt(0)==160))) { return "";}
+		return !value ? value : String(value).replace(/&gt;/g, ">").replace(/&lt;/g, "<").replace(/&quot;/g, '"').replace(/&amp;/g, "&");		
+	},
+	htmlEncode : function (value){
+		return !value ? value : String(value).replace(/&/g, "&amp;").replace(/\"/g, "&quot;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
+	},
+	format : function(format){ //jqgformat
+		var args = $.makeArray(arguments).slice(1);
+		if(format===undefined) { format = ""; }
+		return format.replace(/\{(\d+)\}/g, function(m, i){
+			return args[i];
+		});
+	},
+	getCellIndex : function (cell) {
+		var c = $(cell);
+		if (c.is('tr')) { return -1; }
+		c = (!c.is('td') && !c.is('th') ? c.closest("td,th") : c)[0];
+		if ($.browser.msie) { return $.inArray(c, c.parentNode.cells); }
+		return c.cellIndex;
+	},
+	stripHtml : function(v) {
+		v = v+"";
+		var regexp = /<("[^"]*"|'[^']*'|[^'">])*>/gi;
+		if (v) {
+			v = v.replace(regexp,"");
+			return (v && v !== '&nbsp;' && v !== '&#160;') ? v.replace(/\"/g,"'") : "";
+		} else {
+			return v;
+		}
+	},
+	stripPref : function (pref, id) {
+		var obj = Object.prototype.toString.call(pref).slice(8, -1);
+		if( obj == "String" || obj =="Number") {
+			pref =  String(pref);
+			id = pref != "" ? String(id).replace(String(pref), "") : id;
+		}
+		return id;
+	},
+	stringToDoc : function (xmlString) {
+		var xmlDoc;
+		if(typeof xmlString !== 'string') { return xmlString; }
+		try	{
+			var parser = new DOMParser();
+			xmlDoc = parser.parseFromString(xmlString,"text/xml");
+		}
+		catch(e) {
+			xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
+			xmlDoc.async=false;
+			xmlDoc.loadXML(xmlString);
+		}
+		return (xmlDoc && xmlDoc.documentElement && xmlDoc.documentElement.tagName != 'parsererror') ? xmlDoc : null;
+	},
+	parse : function(jsonString) {
+		var js = jsonString;
+		if (js.substr(0,9) == "while(1);") { js = js.substr(9); }
+		if (js.substr(0,2) == "/*") { js = js.substr(2,js.length-4); }
+		if(!js) { js = "{}"; }
+		return ($.jgrid.useJSON===true && typeof (JSON) === 'object' && typeof (JSON.parse) === 'function') ?
+		    JSON.parse(js) :
+		    eval('(' + js + ')');
+	},
+	parseDate : function(format, date) {
+		var tsp = {m : 1, d : 1, y : 1970, h : 0, i : 0, s : 0},k,hl,dM, regdate = /[\\\/:_;.,\t\T\s-]/;
+		if(date && date !== null && date !== undefined){
+			date = $.trim(date);
+			date = date.split(regdate);
+			format = format.split(regdate);
+			var dfmt  = $.jgrid.formatter.date.monthNames;
+			var afmt  = $.jgrid.formatter.date.AmPm;
+			var h12to24 = function(ampm, h){
+				if (ampm === 0){ if (h == 12) { h = 0;} }
+				          else { if (h != 12) { h += 12; } }
+				return h;
+			};
+			for(k=0,hl=format.length;k<hl;k++){
+				if(format[k] == 'M') {
+					dM = $.inArray(date[k],dfmt);
+					if(dM !== -1 && dM < 12){date[k] = dM+1;}
+				}
+				if(format[k] == 'F') {
+					dM = $.inArray(date[k],dfmt);
+					if(dM !== -1 && dM > 11){date[k] = dM+1-12;}
+				}
+				if(format[k] == 'a') {
+					dM = $.inArray(date[k],afmt);
+					if(dM !== -1 && dM < 2 && date[k] == afmt[dM]){
+						date[k] = dM;
+						tsp.h = h12to24(date[k], tsp.h);
+					}
+				}
+				if(format[k] == 'A') {
+					dM = $.inArray(date[k],afmt);
+					if(dM !== -1 && dM > 1 && date[k] == afmt[dM]){
+						date[k] = dM-2;
+						tsp.h = h12to24(date[k], tsp.h);
+					}
+				}
+				if(date[k] !== undefined) {
+					tsp[format[k].toLowerCase()] = parseInt(date[k],10);
+				}
+			}
+			tsp.m = parseInt(tsp.m,10)-1;
+			var ty = tsp.y;
+			if (ty >= 70 && ty <= 99) {tsp.y = 1900+tsp.y;}
+			else if (ty >=0 && ty <=69) {tsp.y= 2000+tsp.y;}
+		}
+		return new Date(tsp.y, tsp.m, tsp.d, tsp.h, tsp.i, tsp.s,0);
+	},
+	jqID : function(sid){
+		return String(sid).replace(/[!"#$%&'()*+,.\/:;<=>?@\[\\\]\^`{|}~]/g,"\\$&");
+	},
+	guid : 1,
+	uidPref: 'jqg',
+	randId : function( prefix )	{
+		return (prefix? prefix: $.jgrid.uidPref) + ($.jgrid.guid++);
+	},
+	getAccessor : function(obj, expr) {
+		var ret,p,prm = [], i;
+		if( typeof expr === 'function') { return expr(obj); }
+		ret = obj[expr];
+		if(ret===undefined) {
+			try {
+				if ( typeof expr === 'string' ) {
+					prm = expr.split('.');
+				}
+				i = prm.length;
+				if( i ) {
+					ret = obj;
+				    while (ret && i--) {
+						p = prm.shift();
+						ret = ret[p];
+					}
+				}
+			} catch (e) {}
+		}
+		return ret;
+	},
+	ajaxOptions: {},
+	from : function(source,initalQuery){
+		// Original Author Hugo Bonacci
+		// License MIT http://jlinq.codeplex.com/license
+		var queryObject=function(d,q){
+		if(typeof(d)=="string"){
+			d=$.data(d);
+		}
+		var self=this,
+		_data=d,
+		_usecase=true,
+		_trim=false,
+		_query=q,
+		_stripNum = /[\$,%]/g,
+		_lastCommand=null,
+		_lastField=null,
+		_orDepth=0,
+		_negate=false,
+		_queuedOperator="",
+		_sorting=[],
+		_useProperties=true;
+		if(typeof(d)=="object"&&d.push) {
+			if(d.length>0){
+				if(typeof(d[0])!="object"){
+					_useProperties=false;
+				}else{
+					_useProperties=true;
+				}
+			}
+		}else{
+			throw "data provides is not an array";
+		}
+		this._hasData=function(){
+			return _data===null?false:_data.length===0?false:true;
+		};
+		this._getStr=function(s){
+			var phrase=[];
+			if(_trim){
+				phrase.push("jQuery.trim(");
+			}
+			phrase.push("String("+s+")");
+			if(_trim){
+				phrase.push(")");
+			}
+			if(!_usecase){
+				phrase.push(".toLowerCase()");
+			}
+			return phrase.join("");
+		};
+		this._strComp=function(val){
+			if(typeof(val)=="string"){
+				return".toString()";
+			}else{
+				return"";
+			}
+		};
+		this._group=function(f,u){
+			return({field:f.toString(),unique:u,items:[]});
+		};
+		this._toStr=function(phrase){
+			if(_trim){
+				phrase=$.trim(phrase);
+			}
+			if(!_usecase){
+				phrase=phrase.toLowerCase();
+			}
+			phrase=phrase.toString().replace(/\\/g,'\\\\').replace(/\"/g,'\\"');
+			return phrase;
+		};
+		this._funcLoop=function(func){
+			var results=[];
+			$.each(_data,function(i,v){
+				results.push(func(v));
+			});
+			return results;
+		};
+		this._append=function(s){
+			var i;
+			if(_query===null){
+				_query="";
+			} else {
+				_query+=_queuedOperator === "" ? " && " :_queuedOperator;
+			}
+			for (i=0;i<_orDepth;i++){
+				_query+="(";
+			}
+			if(_negate){
+				_query+="!";
+			}
+			_query+="("+s+")";
+			_negate=false;
+			_queuedOperator="";
+			_orDepth=0;
+		};
+		this._setCommand=function(f,c){
+			_lastCommand=f;
+			_lastField=c;
+		};
+		this._resetNegate=function(){
+			_negate=false;
+		};
+		this._repeatCommand=function(f,v){
+			if(_lastCommand===null){
+				return self;
+			}
+			if(f!==null&&v!==null){
+				return _lastCommand(f,v);
+			}
+			if(_lastField===null){
+				return _lastCommand(f);
+			}
+			if(!_useProperties){
+				return _lastCommand(f);
+			}
+			return _lastCommand(_lastField,f);
+		};
+		this._equals=function(a,b){
+			return(self._compare(a,b,1)===0);
+		};
+		this._compare=function(a,b,d){
+			if( d === undefined) { d = 1; }
+			if(a===undefined) { a = null; }
+			if(b===undefined) { b = null; }
+			if(a===null && b===null){
+				return 0;
+			}
+			if(a===null&&b!==null){
+				return 1;
+			}
+			if(a!==null&&b===null){
+				return -1;
+			}
+			if(!_usecase && typeof(a) !== "number" && typeof(b) !== "number" ) {
+				a=String(a).toLowerCase();
+				b=String(b).toLowerCase();
+			}
+			if(a<b){return -d;}
+			if(a>b){return d;}
+			return 0;
+		};
+		this._performSort=function(){
+			if(_sorting.length===0){return;}
+			_data=self._doSort(_data,0);
+		};
+		this._doSort=function(d,q){
+			var by=_sorting[q].by,
+			dir=_sorting[q].dir,
+			type = _sorting[q].type,
+			dfmt = _sorting[q].datefmt;
+			if(q==_sorting.length-1){
+				return self._getOrder(d, by, dir, type, dfmt);
+			}
+			q++;
+			var values=self._getGroup(d,by,dir,type,dfmt);
+			var results=[];
+			for(var i=0;i<values.length;i++){
+				var sorted=self._doSort(values[i].items,q);
+				for(var j=0;j<sorted.length;j++){
+					results.push(sorted[j]);
+				}
+			}
+			return results;
+		};
+		this._getOrder=function(data,by,dir,type, dfmt){
+			var sortData=[],_sortData=[], newDir = dir=="a" ? 1 : -1, i,ab,j,
+			findSortKey;
+
+			if(type === undefined ) { type = "text"; }
+			if (type == 'float' || type== 'number' || type== 'currency' || type== 'numeric') {
+				findSortKey = function($cell, a) {
+					var key = parseFloat( String($cell).replace(_stripNum, ''));
+					return isNaN(key) ? 0.00 : key;
+				};
+			} else if (type=='int' || type=='integer') {
+				findSortKey = function($cell, a) {
+					return $cell ? parseFloat(String($cell).replace(_stripNum, '')) : 0;
+				};
+			} else if(type == 'date' || type == 'datetime') {
+				findSortKey = function($cell, a) {
+					return $.jgrid.parseDate(dfmt,$cell).getTime();
+				};
+			} else if($.isFunction(type)) {
+				findSortKey = type;
+			} else {
+				findSortKey = function($cell, a) {
+					if(!$cell) {$cell ="";}
+					return $.trim(String($cell).toUpperCase());
+				};
+			}
+			$.each(data,function(i,v){
+				ab = by!=="" ? $.jgrid.getAccessor(v,by) : v;
+				if(ab === undefined) { ab = ""; }
+				ab = findSortKey(ab, v);
+				_sortData.push({ 'vSort': ab,'index':i});
+			});
+
+			_sortData.sort(function(a,b){
+				a = a.vSort;
+				b = b.vSort;
+				return self._compare(a,b,newDir);
+			});
+			j=0;
+			var nrec= data.length;
+			// overhead, but we do not change the original data.
+			while(j<nrec) {
+				i = _sortData[j].index;
+				sortData.push(data[i]);
+				j++;
+			}
+			return sortData;
+		};
+		this._getGroup=function(data,by,dir,type, dfmt){
+			var results=[],
+			group=null,
+			last=null, val;
+			$.each(self._getOrder(data,by,dir,type, dfmt),function(i,v){
+				val = $.jgrid.getAccessor(v, by);
+				if(val === undefined) { val = ""; }
+				if(!self._equals(last,val)){
+					last=val;
+					if(group !== null){
+						results.push(group);
+					}
+					group=self._group(by,val);
+				}
+				group.items.push(v);
+			});
+			if(group !== null){
+				results.push(group);
+			}
+			return results;
+		};
+		this.ignoreCase=function(){
+			_usecase=false;
+			return self;
+		};
+		this.useCase=function(){
+			_usecase=true;
+			return self;
+		};
+		this.trim=function(){
+			_trim=true;
+			return self;
+		};
+		this.noTrim=function(){
+			_trim=false;
+			return self;
+		};
+		this.execute=function(){
+			var match=_query, results=[];
+			if(match === null){
+				return self;
+			}
+			$.each(_data,function(){
+				if(eval(match)){results.push(this);}
+			});
+			_data=results;
+			return self;
+		};
+		this.data=function(){
+			return _data;
+		};
+		this.select=function(f){
+			self._performSort();
+			if(!self._hasData()){ return[]; }
+			self.execute();
+			if($.isFunction(f)){
+				var results=[];
+				$.each(_data,function(i,v){
+					results.push(f(v));
+				});
+				return results;
+			}
+			return _data;
+		};
+		this.hasMatch=function(f){
+			if(!self._hasData()) { return false; }
+			self.execute();
+			return _data.length>0;
+		};
+		this.andNot=function(f,v,x){
+			_negate=!_negate;
+			return self.and(f,v,x);
+		};
+		this.orNot=function(f,v,x){
+			_negate=!_negate;
+			return self.or(f,v,x);
+		};
+		this.not=function(f,v,x){
+			return self.andNot(f,v,x);
+		};
+		this.and=function(f,v,x){
+			_queuedOperator=" && ";
+			if(f===undefined){
+				return self;
+			}
+			return self._repeatCommand(f,v,x);
+		};
+		this.or=function(f,v,x){
+			_queuedOperator=" || ";
+			if(f===undefined) { return self; }
+			return self._repeatCommand(f,v,x);
+		};
+		this.orBegin=function(){
+			_orDepth++;
+			return self;
+		};
+		this.orEnd=function(){
+			if (_query !== null){
+				_query+=")";
+			}
+			return self;
+		};
+		this.isNot=function(f){
+			_negate=!_negate;
+			return self.is(f);
+		};
+		this.is=function(f){
+			self._append('this.'+f);
+			self._resetNegate();
+			return self;
+		};
+		this._compareValues=function(func,f,v,how,t){
+			var fld;
+			if(_useProperties){
+				fld='jQuery.jgrid.getAccessor(this,\''+f+'\')';
+			}else{
+				fld='this';
+			}
+			if(v===undefined) { v = null; }
+			//var val=v===null?f:v,
+			var val =v,
+			swst = t.stype === undefined ? "text" : t.stype;
+			if(v !== null) {
+			switch(swst) {
+				case 'int':
+				case 'integer':
+					val = (isNaN(Number(val)) || val==="") ? '0' : val; // To be fixed with more inteligent code
+					fld = 'parseInt('+fld+',10)';
+					val = 'parseInt('+val+',10)';
+					break;
+				case 'float':
+				case 'number':
+				case 'numeric':
+					val = String(val).replace(_stripNum, '');
+					val = (isNaN(Number(val)) || val==="") ? '0' : val; // To be fixed with more inteligent code
+					fld = 'parseFloat('+fld+')';
+					val = 'parseFloat('+val+')';
+					break;
+				case 'date':
+				case 'datetime':
+					val = String($.jgrid.parseDate(t.newfmt || 'Y-m-d',val).getTime());
+					fld = 'jQuery.jgrid.parseDate("'+t.srcfmt+'",'+fld+').getTime()';
+					break;
+				default :
+					fld=self._getStr(fld);
+					val=self._getStr('"'+self._toStr(val)+'"');
+			}
+			}
+			self._append(fld+' '+how+' '+val);
+			self._setCommand(func,f);
+			self._resetNegate();
+			return self;
+		};
+		this.equals=function(f,v,t){
+			return self._compareValues(self.equals,f,v,"==",t);
+		};
+		this.notEquals=function(f,v,t){
+			return self._compareValues(self.equals,f,v,"!==",t);
+		};
+		this.isNull = function(f,v,t){
+			return self._compareValues(self.equals,f,null,"===",t);
+		};
+		this.greater=function(f,v,t){
+			return self._compareValues(self.greater,f,v,">",t);
+		};
+		this.less=function(f,v,t){
+			return self._compareValues(self.less,f,v,"<",t);
+		};
+		this.greaterOrEquals=function(f,v,t){
+			return self._compareValues(self.greaterOrEquals,f,v,">=",t);
+		};
+		this.lessOrEquals=function(f,v,t){
+			return self._compareValues(self.lessOrEquals,f,v,"<=",t);
+		};
+		this.startsWith=function(f,v){
+			var val = (v===undefined || v===null) ? f: v,
+			length=_trim ? $.trim(val.toString()).length : val.toString().length;
+			if(_useProperties){
+				self._append(self._getStr('jQuery.jgrid.getAccessor(this,\''+f+'\')')+'.substr(0,'+length+') == '+self._getStr('"'+self._toStr(v)+'"'));
+			}else{
+				length=_trim?$.trim(v.toString()).length:v.toString().length;
+				self._append(self._getStr('this')+'.substr(0,'+length+') == '+self._getStr('"'+self._toStr(f)+'"'));
+			}
+			self._setCommand(self.startsWith,f);
+			self._resetNegate();
+			return self;
+		};
+		this.endsWith=function(f,v){
+			var val = (v===undefined || v===null) ? f: v,
+			length=_trim ? $.trim(val.toString()).length:val.toString().length;
+			if(_useProperties){
+				self._append(self._getStr('jQuery.jgrid.getAccessor(this,\''+f+'\')')+'.substr('+self._getStr('jQuery.jgrid.getAccessor(this,\''+f+'\')')+'.length-'+length+','+length+') == "'+self._toStr(v)+'"');
+			} else {
+				self._append(self._getStr('this')+'.substr('+self._getStr('this')+'.length-"'+self._toStr(f)+'".length,"'+self._toStr(f)+'".length) == "'+self._toStr(f)+'"');
+			}
+			self._setCommand(self.endsWith,f);self._resetNegate();
+			return self;
+		};
+		this.contains=function(f,v){
+			if(_useProperties){
+				self._append(self._getStr('jQuery.jgrid.getAccessor(this,\''+f+'\')')+'.indexOf("'+self._toStr(v)+'",0) > -1');
+			}else{
+				self._append(self._getStr('this')+'.indexOf("'+self._toStr(f)+'",0) > -1');
+			}
+			self._setCommand(self.contains,f);
+			self._resetNegate();
+			return self;
+		};
+		this.groupBy=function(by,dir,type, datefmt){
+			if(!self._hasData()){
+				return null;
+			}
+			return self._getGroup(_data,by,dir,type, datefmt);
+		};
+		this.orderBy=function(by,dir,stype, dfmt){
+			dir =  dir === undefined || dir === null ? "a" :$.trim(dir.toString().toLowerCase());
+			if(stype === null || stype === undefined) { stype = "text"; }
+			if(dfmt === null || dfmt === undefined) { dfmt = "Y-m-d"; }
+			if(dir=="desc"||dir=="descending"){dir="d";}
+			if(dir=="asc"||dir=="ascending"){dir="a";}
+			_sorting.push({by:by,dir:dir,type:stype, datefmt: dfmt});
+			return self;
+		};
+		return self;
+		};
+	return new queryObject(source,null);
+	},
+	extend : function(methods) {
+		$.extend($.fn.jqGrid,methods);
+		if (!this.no_legacy_api) {
+			$.fn.extend(methods);
+		}
+	}
+});
+
+$.fn.jqGrid = function( pin ) {
+	if (typeof pin == 'string') {
+		//var fn = $.fn.jqGrid[pin];
+		var fn = $.jgrid.getAccessor($.fn.jqGrid,pin);
+		if (!fn) {
+			throw ("jqGrid - No such method: " + pin);
+		}
+		var args = $.makeArray(arguments).slice(1);
+		return fn.apply(this,args);
+	}
+	return this.each( function() {
+		if(this.grid) {return;}
+
+		var p = $.extend(true,{
+			url: "",
+			height: 150,
+			page: 1,
+			rowNum: 20,
+			rowTotal : null,
+			records: 0,
+			pager: "",
+			pgbuttons: true,
+			pginput: true,
+			colModel: [],
+			rowList: [],
+			colNames: [],
+			sortorder: "asc",
+			sortname: "",
+			datatype: "xml",
+			mtype: "GET",
+			altRows: false,
+			selarrrow: [],
+			savedRow: [],
+			shrinkToFit: true,
+			xmlReader: {},
+			jsonReader: {},
+			subGrid: false,
+			subGridModel :[],
+			reccount: 0,
+			lastpage: 0,
+			lastsort: 0,
+			selrow: null,
+			beforeSelectRow: null,
+			onSelectRow: null,
+			onSortCol: null,
+			ondblClickRow: null,
+			onRightClickRow: null,
+			onPaging: null,
+			onSelectAll: null,
+			loadComplete: null,
+			gridComplete: null,
+			loadError: null,
+			loadBeforeSend: null,
+			afterInsertRow: null,
+			beforeRequest: null,
+			beforeProcessing : null,
+			onHeaderClick: null,
+			viewrecords: false,
+			loadonce: false,
+			multiselect: false,
+			multikey: false,
+			editurl: null,
+			search: false,
+			caption: "",
+			hidegrid: true,
+			hiddengrid: false,
+			postData: {},
+			userData: {},
+			treeGrid : false,
+			treeGridModel : 'nested',
+			treeReader : {},
+			treeANode : -1,
+			ExpandColumn: null,
+			tree_root_level : 0,
+			prmNames: {page:"page",rows:"rows", sort: "sidx",order: "sord", search:"_search", nd:"nd", id:"id",oper:"oper",editoper:"edit",addoper:"add",deloper:"del", subgridid:"id", npage: null, totalrows:"totalrows"},
+			forceFit : false,
+			gridstate : "visible",
+			cellEdit: false,
+			cellsubmit: "remote",
+			nv:0,
+			loadui: "enable",
+			toolbar: [false,""],
+			scroll: false,
+			multiboxonly : false,
+			deselectAfterSort : true,
+			scrollrows : false,
+			autowidth: false,
+			scrollOffset :18,
+			cellLayout: 5,
+			subGridWidth: 20,
+			multiselectWidth: 20,
+			gridview: false,
+			rownumWidth: 25,
+			rownumbers : false,
+			pagerpos: 'center',
+			recordpos: 'right',
+			footerrow : false,
+			userDataOnFooter : false,
+			hoverrows : true,
+			altclass : 'ui-priority-secondary',
+			viewsortcols : [false,'vertical',true],
+			resizeclass : '',
+			autoencode : false,
+			remapColumns : [],
+			ajaxGridOptions :{},
+			direction : "ltr",
+			toppager: false,
+			headertitles: false,
+			scrollTimeout: 40,
+			data : [],
+			_index : {},
+			grouping : false,
+			groupingView : {groupField:[],groupOrder:[], groupText:[],groupColumnShow:[],groupSummary:[], showSummaryOnHide: false, sortitems:[], sortnames:[], groupDataSorted : false, summary:[],summaryval:[], plusicon: 'ui-icon-circlesmall-plus', minusicon: 'ui-icon-circlesmall-minus'},
+			ignoreCase : false,
+			cmTemplate : {},
+			idPrefix : ""
+		}, $.jgrid.defaults, pin || {});
+		var grid={
+			headers:[],
+			cols:[],
+			footers: [],
+			dragStart: function(i,x,y) {
+				this.resizing = { idx: i, startX: x.clientX, sOL : y[0]};
+				this.hDiv.style.cursor = "col-resize";
+				this.curGbox = $("#rs_m"+$.jgrid.jqID(p.id),"#gbox_"+$.jgrid.jqID(p.id));
+				this.curGbox.css({display:"block",left:y[0],top:y[1],height:y[2]});
+				if($.isFunction(p.resizeStart)) { p.resizeStart.call(this,x,i); }
+				document.onselectstart=function(){return false;};
+			},
+			dragMove: function(x) {
+				if(this.resizing) {
+					var diff = x.clientX-this.resizing.startX,
+					h = this.headers[this.resizing.idx],
+					newWidth = p.direction === "ltr" ? h.width + diff : h.width - diff, hn, nWn;
+					if(newWidth > 33) {
+						this.curGbox.css({left:this.resizing.sOL+diff});
+						if(p.forceFit===true ){
+							hn = this.headers[this.resizing.idx+p.nv];
+							nWn = p.direction === "ltr" ? hn.width - diff : hn.width + diff;
+							if(nWn >33) {
+								h.newWidth = newWidth;
+								hn.newWidth = nWn;
+							}
+						} else {
+							this.newWidth = p.direction === "ltr" ? p.tblwidth+diff : p.tblwidth-diff;
+							h.newWidth = newWidth;
+						}
+					}
+				}
+			},
+			dragEnd: function() {
+				this.hDiv.style.cursor = "default";
+				if(this.resizing) {
+					var idx = this.resizing.idx,
+					nw = this.headers[idx].newWidth || this.headers[idx].width;
+					nw = parseInt(nw,10);
+					this.resizing = false;
+					$("#rs_m"+$.jgrid.jqID(p.id)).css("display","none");
+					p.colModel[idx].width = nw;
+					this.headers[idx].width = nw;
+					this.headers[idx].el.style.width = nw + "px";
+					this.cols[idx].style.width = nw+"px";
+					if(this.footers.length>0) {this.footers[idx].style.width = nw+"px";}
+					if(p.forceFit===true){
+						nw = this.headers[idx+p.nv].newWidth || this.headers[idx+p.nv].width;
+						this.headers[idx+p.nv].width = nw;
+						this.headers[idx+p.nv].el.style.width = nw + "px";
+						this.cols[idx+p.nv].style.width = nw+"px";
+						if(this.footers.length>0) {this.footers[idx+p.nv].style.width = nw+"px";}
+						p.colModel[idx+p.nv].width = nw;
+					} else {
+						p.tblwidth = this.newWidth || p.tblwidth;
+						$('table:first',this.bDiv).css("width",p.tblwidth+"px");
+						$('table:first',this.hDiv).css("width",p.tblwidth+"px");
+						this.hDiv.scrollLeft = this.bDiv.scrollLeft;
+						if(p.footerrow) {
+							$('table:first',this.sDiv).css("width",p.tblwidth+"px");
+							this.sDiv.scrollLeft = this.bDiv.scrollLeft;
+						}
+					}
+					if($.isFunction(p.resizeStop)) { p.resizeStop.call(this,nw,idx); }
+				}
+				this.curGbox = null;
+				document.onselectstart=function(){return true;};
+			},
+			populateVisible: function() {
+				if (grid.timer) { clearTimeout(grid.timer); }
+				grid.timer = null;
+				var dh = $(grid.bDiv).height();
+				if (!dh) { return; }
+				var table = $("table:first", grid.bDiv);
+				var rows, rh;
+				if(table[0].rows.length) {
+					try {
+						rows = table[0].rows[1];
+						rh = rows ? $(rows).outerHeight() || grid.prevRowHeight : grid.prevRowHeight;
+					} catch (pv) {
+						rh = grid.prevRowHeight;
+					}
+				}
+				if (!rh) { return; }
+				grid.prevRowHeight = rh;
+				var rn = p.rowNum;
+				var scrollTop = grid.scrollTop = grid.bDiv.scrollTop;
+				var ttop = Math.round(table.position().top) - scrollTop;
+				var tbot = ttop + table.height();
+				var div = rh * rn;
+				var page, npage, empty;
+			    if ( tbot < dh && ttop <= 0 &&
+					(p.lastpage===undefined||parseInt((tbot + scrollTop + div - 1) / div,10) <= p.lastpage))
+				{
+					npage = parseInt((dh - tbot + div - 1) / div,10);
+					if (tbot >= 0 || npage < 2 || p.scroll === true) {
+						page = Math.round((tbot + scrollTop) / div) + 1;
+						ttop = -1;
+					} else {
+						ttop = 1;
+					}
+				}
+				if (ttop > 0) {
+					page = parseInt(scrollTop / div,10) + 1;
+					npage = parseInt((scrollTop + dh) / div,10) + 2 - page;
+					empty = true;
+				}
+				if (npage) {
+					if (p.lastpage && page > p.lastpage || p.lastpage==1 || (page === p.page && page===p.lastpage) ) {
+						return;
+					}
+					if (grid.hDiv.loading) {
+						grid.timer = setTimeout(grid.populateVisible, p.scrollTimeout);
+					} else {
+						p.page = page;
+						if (empty) {
+							grid.selectionPreserver(table[0]);
+							grid.emptyRows(grid.bDiv,false, false);
+						}
+						grid.populate(npage);
+					}
+				}
+			},
+			scrollGrid: function( e ) {
+				if(p.scroll) {
+					var scrollTop = grid.bDiv.scrollTop;
+					if(grid.scrollTop === undefined) { grid.scrollTop = 0; }
+					if (scrollTop != grid.scrollTop) {
+						grid.scrollTop = scrollTop;
+						if (grid.timer) { clearTimeout(grid.timer); }
+						grid.timer = setTimeout(grid.populateVisible, p.scrollTimeout);
+					}
+				}
+				grid.hDiv.scrollLeft = grid.bDiv.scrollLeft;
+				if(p.footerrow) {
+					grid.sDiv.scrollLeft = grid.bDiv.scrollLeft;
+				}
+				if( e ) { e.stopPropagation(); }
+			},
+			selectionPreserver : function(ts) {
+				var p = ts.p;
+				var sr = p.selrow, sra = p.selarrrow ? $.makeArray(p.selarrrow) : null;
+				var left = ts.grid.bDiv.scrollLeft;
+				var complete = p.gridComplete;
+				p.gridComplete = function() {
+					p.selrow = null;
+					p.selarrrow = [];
+					if(p.multiselect && sra && sra.length>0) {
+						for(var i=0;i<sra.length;i++){
+							if (sra[i] != sr) {
+								$(ts).jqGrid("setSelection",sra[i],false);
+							}
+						}
+					}
+					if (sr) {
+						$(ts).jqGrid("setSelection",sr,false);
+					}
+					ts.grid.bDiv.scrollLeft = left;
+					p.gridComplete = complete;
+					if (p.gridComplete) {
+						complete();
+					}
+				};
+			}
+		};
+		if(this.tagName.toUpperCase()!='TABLE') {
+			alert("Element is not a table");
+			return;
+		}
+		$(this).empty().attr("tabindex","1");
+		this.p = p ;
+		this.p.useProp = !!$.fn.prop;
+		var i, dir,ts;
+		if(this.p.colNames.length === 0) {
+			for (i=0;i<this.p.colModel.length;i++){
+				this.p.colNames[i] = this.p.colModel[i].label || this.p.colModel[i].name;
+			}
+		}
+		if( this.p.colNames.length !== this.p.colModel.length ) {
+			alert($.jgrid.errors.model);
+			return;
+		}
+		var gv = $("<div class='ui-jqgrid-view'></div>"), ii,
+		isMSIE = $.browser.msie ? true:false,
+		isSafari = $.browser.webkit || $.browser.safari ? true : false;
+		ts = this;
+		ts.p.direction = $.trim(ts.p.direction.toLowerCase());
+		if($.inArray(ts.p.direction,["ltr","rtl"]) == -1) { ts.p.direction = "ltr"; }
+		dir = ts.p.direction;
+
+		$(gv).insertBefore(this);
+		$(this).appendTo(gv).removeClass("scroll");
+		var eg = $("<div class='ui-jqgrid ui-widget ui-widget-content ui-corner-all'></div>");
+		$(eg).insertBefore(gv).attr({"id" : "gbox_"+this.id,"dir":dir});
+		$(gv).appendTo(eg).attr("id","gview_"+this.id);
+		if (isMSIE && $.browser.version <= 6) {
+			ii = '<iframe style="display:block;position:absolute;z-index:-1;filter:Alpha(Opacity=\'0\');" src="javascript:false;"></iframe>';
+		} else { ii="";}
+		$("<div class='ui-widget-overlay jqgrid-overlay' id='lui_"+this.id+"'></div>").append(ii).insertBefore(gv);
+		$("<div class='loading ui-state-default ui-state-active' id='load_"+this.id+"'>"+this.p.loadtext+"</div>").insertBefore(gv);
+		$(this).attr({cellspacing:"0",cellpadding:"0",border:"0","role":"grid","aria-multiselectable":!!this.p.multiselect,"aria-labelledby":"gbox_"+this.id});
+		var sortkeys = ["shiftKey","altKey","ctrlKey"],
+		intNum = function(val,defval) {
+			val = parseInt(val,10);
+			if (isNaN(val)) { return defval ? defval : 0;}
+			else {return val;}
+		},
+		formatCol = function (pos, rowInd, tv, rawObject, rowId, rdata){
+			var cm = ts.p.colModel[pos],
+			ral = cm.align, result="style=\"", clas = cm.classes, nm = cm.name, celp, acp=[];
+			if(ral) { result += "text-align:"+ral+";"; }
+			if(cm.hidden===true) { result += "display:none;"; }
+			if(rowInd===0) {
+				result += "width: "+grid.headers[pos].width+"px;";
+			} else if (cm.cellattr && $.isFunction(cm.cellattr))
+			{
+				celp = cm.cellattr.call(ts, rowId, tv, rawObject, cm, rdata);
+				if(celp && typeof(celp) === "string") {
+					celp = celp.replace(/style/i,'style').replace(/title/i,'title');
+					if(celp.indexOf('title') > -1) { cm.title=false;}
+					if(celp.indexOf('class') > -1) { clas = undefined;}
+					acp = celp.split("style");
+					if(acp.length === 2 ) {
+						acp[1] =  $.trim(acp[1].replace("=",""));
+						if(acp[1].indexOf("'") === 0 || acp[1].indexOf('"') === 0) {
+							acp[1] = acp[1].substring(1);
+						}
+						result += acp[1].replace(/'/gi,'"');
+					} else {
+						result += "\"";
+					}
+				}
+			}
+			if(!acp.length) { acp[0] = ""; result += "\"";}
+			result += (clas !== undefined ? (" class=\""+clas+"\"") :"") + ((cm.title && tv) ? (" title=\""+$.jgrid.stripHtml(tv)+"\"") :"");
+			result += " aria-describedby=\""+ts.p.id+"_"+nm+"\"";
+			return result + acp[0];
+		},
+		cellVal =  function (val) {
+			return val === undefined || val === null || val === "" ? "&#160;" : (ts.p.autoencode ? $.jgrid.htmlEncode(val) : val+"");
+		},
+		formatter = function (rowId, cellval , colpos, rwdat, _act){
+			var cm = ts.p.colModel[colpos],v;
+			if(typeof cm.formatter !== 'undefined') {
+				var opts= {rowId: rowId, colModel:cm, gid:ts.p.id, pos:colpos };
+				if($.isFunction( cm.formatter ) ) {
+					v = cm.formatter.call(ts,cellval,opts,rwdat,_act);
+				} else if($.fmatter){
+					v = $.fn.fmatter(cm.formatter, cellval,opts, rwdat, _act);
+				} else {
+					v = cellVal(cellval);
+				}
+			} else {
+				v = cellVal(cellval);
+			}
+			return v;
+		},
+		addCell = function(rowId,cell,pos,irow, srvr) {
+			var v,prp;
+			v = formatter(rowId,cell,pos,srvr,'add');
+			prp = formatCol( pos,irow, v, srvr, rowId, true);
+			return "<td role=\"gridcell\" "+prp+">"+v+"</td>";
+		},
+		addMulti = function(rowid,pos,irow){
+			var	v = "<input role=\"checkbox\" type=\"checkbox\""+" id=\"jqg_"+ts.p.id+"_"+rowid+"\" class=\"cbox\" name=\"jqg_"+ts.p.id+"_"+rowid+"\"/>",
+			prp = formatCol( pos,irow,'',null, rowid, true);
+			return "<td role=\"gridcell\" "+prp+">"+v+"</td>";
+		},
+		addRowNum = function (pos,irow,pG,rN) {
+			var v =  (parseInt(pG,10)-1)*parseInt(rN,10)+1+irow,
+			prp = formatCol( pos,irow,v, null, irow, true);
+			return "<td role=\"gridcell\" class=\"ui-state-default jqgrid-rownum\" "+prp+">"+v+"</td>";
+		},
+		reader = function (datatype) {
+			var field, f=[], j=0, i;
+			for(i =0; i<ts.p.colModel.length; i++){
+				field = ts.p.colModel[i];
+				if (field.name !== 'cb' && field.name !=='subgrid' && field.name !=='rn') {
+					if(datatype == "local") {
+						f[j] = field.name;
+					} else {
+						f[j] = (datatype=="xml") ? field.xmlmap || field.name : field.jsonmap || field.name;
+					}
+					j++;
+				}
+			}
+			return f;
+		},
+		orderedCols = function (offset) {
+			var order = ts.p.remapColumns;
+			if (!order || !order.length) {
+				order = $.map(ts.p.colModel, function(v,i) { return i; });
+			}
+			if (offset) {
+				order = $.map(order, function(v) { return v<offset?null:v-offset; });
+			}
+			return order;
+		},
+		emptyRows = function (parent, scroll, locdata) {
+			if(ts.p.deepempty) {$("#"+$.jgrid.jqID(ts.p.id)+" tbody:first tr:gt(0)").remove();}
+			else {
+				var trf = $("#"+$.jgrid.jqID(ts.p.id)+" tbody:first tr:first")[0];
+				$("#"+$.jgrid.jqID(ts.p.id)+" tbody:first").empty().append(trf);
+			}
+			if (scroll && ts.p.scroll) {
+				$(">div:first", parent).css({height:"auto"}).children("div:first").css({height:0,display:"none"});
+				parent.scrollTop = 0;
+			}
+			if(locdata === true) {
+				if(ts.p.treeGrid === true ) {
+				ts.p.data = []; ts.p._index = {};
+			}
+			}
+		},
+		refreshIndex = function() {
+			var datalen = ts.p.data.length, idname, i, val,
+			ni = ts.p.rownumbers===true ? 1 :0,
+			gi = ts.p.multiselect ===true ? 1 :0,
+			si = ts.p.subGrid===true ? 1 :0;
+
+			if(ts.p.keyIndex === false || ts.p.loadonce === true) {
+				idname = ts.p.localReader.id;
+			} else {
+				idname = ts.p.colModel[ts.p.keyIndex+gi+si+ni].name;
+			}
+			for(i =0;i < datalen; i++) {
+				val = $.jgrid.getAccessor(ts.p.data[i],idname);
+				ts.p._index[val] = i;
+			}
+		},
+		addXmlData = function (xml,t, rcnt, more, adjust) {
+			var startReq = new Date(),
+			locdata = (ts.p.datatype != "local" && ts.p.loadonce) || ts.p.datatype == "xmlstring",
+			xmlid = "_id_",
+			frd = ts.p.datatype == "local" ? "local" : "xml";
+			if(locdata) {
+				ts.p.data = [];
+				ts.p._index = {};
+				ts.p.localReader.id = xmlid;
+			}
+			ts.p.reccount = 0;
+			if($.isXMLDoc(xml)) {
+				if(ts.p.treeANode===-1 && !ts.p.scroll) {
+					emptyRows(t,false, true);
+					rcnt=1;
+				} else { rcnt = rcnt > 1 ? rcnt :1; }
+			} else { return; }
+			var i,fpos,ir=0,v,row,gi=0,si=0,ni=0,idn, getId,f=[],F,rd ={}, xmlr,rid, rowData=[], cn=(ts.p.altRows === true) ? " "+ts.p.altclass:"",cn1;
+			if(!ts.p.xmlReader.repeatitems) {f = reader(frd);}
+			if( ts.p.keyIndex===false) {
+				idn = ts.p.xmlReader.id;
+			} else {
+				idn = ts.p.keyIndex;
+			}
+			if(f.length>0 && !isNaN(idn)) {
+				if (ts.p.remapColumns && ts.p.remapColumns.length) {
+					idn = $.inArray(idn, ts.p.remapColumns);
+				}
+				idn=f[idn];
+			}
+			if( (idn+"").indexOf("[") === -1 ) {
+				if (f.length) {
+					getId = function( trow, k) {return $(idn,trow).text() || k;};
+				} else {
+					getId = function( trow, k) {return $(ts.p.xmlReader.cell,trow).eq(idn).text() || k;};
+				}
+			}
+			else {
+				getId = function( trow, k) {return trow.getAttribute(idn.replace(/[\[\]]/g,"")) || k;};
+			}
+			ts.p.userData = {};
+			$(ts.p.xmlReader.page,xml).each(function() {ts.p.page = this.textContent  || this.text || 0; });
+			$(ts.p.xmlReader.total,xml).each(function() {ts.p.lastpage = this.textContent  || this.text; if(ts.p.lastpage===undefined) { ts.p.lastpage=1; } }  );
+			$(ts.p.xmlReader.records,xml).each(function() {ts.p.records = this.textContent  || this.text  || 0; }  );
+			$(ts.p.xmlReader.userdata,xml).each(function() {ts.p.userData[this.getAttribute("name")]= $(this).text();});
+			var gxml = $(ts.p.xmlReader.root+" "+ts.p.xmlReader.row,xml);
+			if (!gxml) { gxml = []; }
+			var gl = gxml.length, j=0, grpdata={}, rn;
+			if(gxml && gl){
+			rn = parseInt(ts.p.rowNum,10);
+			var br=ts.p.scroll?$.jgrid.randId():1,altr;
+			if (adjust) { rn *= adjust+1; }
+			var afterInsRow = $.isFunction(ts.p.afterInsertRow), hiderow="";
+			if(ts.p.grouping && ts.p.groupingView.groupCollapse === true) {
+				hiderow = " style=\"display:none;\"";
+			}
+			while (j<gl) {
+				xmlr = gxml[j];
+				rid = getId(xmlr,br+j);
+				rid  = ts.p.idPrefix + rid;
+				altr = rcnt === 0 ? 0 : rcnt+1;
+				cn1 = (altr+j)%2 == 1 ? cn : '';
+				rowData.push( "<tr"+hiderow+" id=\""+rid+"\" tabindex=\"-1\" role=\"row\" class =\"ui-widget-content jqgrow ui-row-"+ts.p.direction+""+cn1+"\">" );
+				if(ts.p.rownumbers===true) {
+					rowData.push( addRowNum(0,j,ts.p.page,ts.p.rowNum) );
+					ni=1;
+				}
+				if(ts.p.multiselect===true) {
+					rowData.push( addMulti(rid,ni,j) );
+					gi=1;
+				}
+				if (ts.p.subGrid===true) {
+					rowData.push( $(ts).jqGrid("addSubGridCell",gi+ni,j+rcnt) );
+					si= 1;
+				}
+				if(ts.p.xmlReader.repeatitems){
+					if (!F) { F=orderedCols(gi+si+ni); }
+					var cells = $(ts.p.xmlReader.cell,xmlr);
+					$.each(F, function (k) {
+						var cell = cells[this];
+						if (!cell) { return false; }
+						v = cell.textContent || cell.text;
+						rd[ts.p.colModel[k+gi+si+ni].name] = v;
+						rowData.push( addCell(rid,v,k+gi+si+ni,j+rcnt,xmlr) );
+					});
+				} else {
+					for(i = 0; i < f.length;i++) {
+						v = $(f[i],xmlr).text();
+						rd[ts.p.colModel[i+gi+si+ni].name] = v;
+						rowData.push( addCell(rid, v, i+gi+si+ni, j+rcnt, xmlr) );
+					}
+				}
+				rowData.push("</tr>");
+				if(ts.p.grouping) {
+					var grlen = ts.p.groupingView.groupField.length, grpitem = [];
+					for(var z=0;z<grlen;z++) {
+						grpitem.push(rd[ts.p.groupingView.groupField[z]]);
+					}
+					grpdata = $(ts).jqGrid('groupingPrepare',rowData, grpitem, grpdata, rd);
+					rowData = [];
+				}
+				if(locdata || ts.p.treeGrid === true) {
+					rd[xmlid] = rid;
+					ts.p.data.push(rd);
+					ts.p._index[rid] = ts.p.data.length-1;
+				}
+				if(ts.p.gridview === false ) {
+					$("tbody:first",t).append(rowData.join(''));
+					if(afterInsRow) {ts.p.afterInsertRow.call(ts,rid,rd,xmlr);}
+					rowData=[];
+				}
+				rd={};
+				ir++;
+				j++;
+				if(ir==rn) {break;}
+			}
+			}
+			if(ts.p.gridview === true) {
+				fpos = ts.p.treeANode > -1 ? ts.p.treeANode: 0;
+				if(ts.p.grouping) {
+					$(ts).jqGrid('groupingRender',grpdata,ts.p.colModel.length);
+					grpdata = null;
+				} else if(ts.p.treeGrid === true && fpos > 0) {
+					$(ts.rows[fpos]).after(rowData.join(''));
+				} else {
+					$("tbody:first",t).append(rowData.join(''));
+				}
+			}
+			if(ts.p.subGrid === true ) {
+				try {$(ts).jqGrid("addSubGrid",gi+ni);} catch (_){}
+			}
+			ts.p.totaltime = new Date() - startReq;
+			if(ir>0) { if(ts.p.records===0) { ts.p.records=gl;} }
+			rowData =null;
+			if( ts.p.treeGrid === true) {
+				try {$(ts).jqGrid("setTreeNode", fpos+1, ir+fpos+1);} catch (e) {}
+			}
+			if(!ts.p.treeGrid && !ts.p.scroll) {ts.grid.bDiv.scrollTop = 0;}
+			ts.p.reccount=ir;
+			ts.p.treeANode = -1;
+			if(ts.p.userDataOnFooter) { $(ts).jqGrid("footerData","set",ts.p.userData,true); }
+			if(locdata) {
+				ts.p.records = gl;
+				ts.p.lastpage = Math.ceil(gl/ rn);
+			}
+			if (!more) { ts.updatepager(false,true); }
+			if(locdata) {
+				while (ir<gl) {
+					xmlr = gxml[ir];
+					rid = getId(xmlr,ir);
+					rid  = ts.p.idPrefix + rid;
+					if(ts.p.xmlReader.repeatitems){
+						if (!F) { F=orderedCols(gi+si+ni); }
+						var cells2 = $(ts.p.xmlReader.cell,xmlr);
+						$.each(F, function (k) {
+							var cell = cells2[this];
+							if (!cell) { return false; }
+							v = cell.textContent || cell.text;
+							rd[ts.p.colModel[k+gi+si+ni].name] = v;
+						});
+					} else {
+						for(i = 0; i < f.length;i++) {
+							v = $(f[i],xmlr).text();
+							rd[ts.p.colModel[i+gi+si+ni].name] = v;
+						}
+					}
+					rd[xmlid] = rid;
+					ts.p.data.push(rd);
+					ts.p._index[rid] = ts.p.data.length-1;
+					rd = {};
+					ir++;
+				}
+			}
+		},
+		addJSONData = function(data,t, rcnt, more, adjust) {
+			var startReq = new Date();
+			if(data) {
+				if(ts.p.treeANode === -1 && !ts.p.scroll) {
+					emptyRows(t,false, true);
+					rcnt=1;
+				} else { rcnt = rcnt > 1 ? rcnt :1; }
+			} else { return; }
+
+			var dReader, locid = "_id_", frd,
+			locdata = (ts.p.datatype != "local" && ts.p.loadonce) || ts.p.datatype == "jsonstring";
+			if(locdata) { ts.p.data = []; ts.p._index = {}; ts.p.localReader.id = locid;}
+			ts.p.reccount = 0;
+			if(ts.p.datatype == "local") {
+				dReader =  ts.p.localReader;
+				frd= 'local';
+			} else {
+				dReader =  ts.p.jsonReader;
+				frd='json';
+			}
+			var ir=0,v,i,j,f=[],F,cur,gi=0,si=0,ni=0,len,drows,idn,rd={}, fpos, idr,rowData=[],cn=(ts.p.altRows === true) ? " "+ts.p.altclass:"",cn1,lp;
+			ts.p.page = $.jgrid.getAccessor(data,dReader.page) || 0;
+			lp = $.jgrid.getAccessor(data,dReader.total);
+			ts.p.lastpage = lp === undefined ? 1 : lp;
+			ts.p.records = $.jgrid.getAccessor(data,dReader.records) || 0;
+			ts.p.userData = $.jgrid.getAccessor(data,dReader.userdata) || {};
+			if(!dReader.repeatitems) {
+				F = f = reader(frd);
+			}
+			if( ts.p.keyIndex===false ) {
+				idn = dReader.id;
+			} else {
+				idn = ts.p.keyIndex;
+			}
+			if(f.length>0 && !isNaN(idn)) {
+				if (ts.p.remapColumns && ts.p.remapColumns.length) {
+					idn = $.inArray(idn, ts.p.remapColumns);
+				}
+				idn=f[idn];
+			}
+			drows = $.jgrid.getAccessor(data,dReader.root);
+			if (!drows) { drows = []; }
+			len = drows.length; i=0;
+			var rn = parseInt(ts.p.rowNum,10),br=ts.p.scroll?$.jgrid.randId():1, altr;
+			if (adjust) { rn *= adjust+1; }
+			var afterInsRow = $.isFunction(ts.p.afterInsertRow), grpdata={}, hiderow="";
+			if(ts.p.grouping && ts.p.groupingView.groupCollapse === true) {
+				hiderow = " style=\"display:none;\"";
+			}
+			while (i<len) {
+				cur = drows[i];
+				idr = $.jgrid.getAccessor(cur,idn);
+				if(idr === undefined) {
+					idr = br+i;
+					if(f.length===0){
+						if(dReader.cell){
+							var ccur = $.jgrid.getAccessor(cur,dReader.cell);
+							idr = ccur[idn] || idr;
+							ccur=null;
+						}
+					}
+				}
+				idr  = ts.p.idPrefix + idr;
+				altr = rcnt === 1 ? 0 : rcnt;
+				cn1 = (altr+i)%2 == 1 ? cn : '';
+				rowData.push("<tr"+hiderow+" id=\""+ idr +"\" tabindex=\"-1\" role=\"row\" class= \"ui-widget-content jqgrow ui-row-"+ts.p.direction+""+cn1+"\">");
+				if(ts.p.rownumbers===true) {
+					rowData.push( addRowNum(0,i,ts.p.page,ts.p.rowNum) );
+					ni=1;
+				}
+				if(ts.p.multiselect){
+					rowData.push( addMulti(idr,ni,i) );
+					gi = 1;
+				}
+				if (ts.p.subGrid) {
+					rowData.push( $(ts).jqGrid("addSubGridCell",gi+ni,i+rcnt) );
+					si= 1;
+				}
+				if (dReader.repeatitems) {
+					if(dReader.cell) {cur = $.jgrid.getAccessor(cur,dReader.cell);}
+					if (!F) { F=orderedCols(gi+si+ni); }
+				}
+				for (j=0;j<F.length;j++) {
+					v = $.jgrid.getAccessor(cur,F[j]);
+					rowData.push( addCell(idr,v,j+gi+si+ni,i+rcnt,cur) );
+					rd[ts.p.colModel[j+gi+si+ni].name] = v;
+				}
+				rowData.push( "</tr>" );
+				if(ts.p.grouping) {
+					var grlen = ts.p.groupingView.groupField.length, grpitem = [];
+					for(var z=0;z<grlen;z++) {
+						grpitem.push(rd[ts.p.groupingView.groupField[z]]);
+					}
+					grpdata = $(ts).jqGrid('groupingPrepare',rowData, grpitem, grpdata, rd);
+					rowData = [];
+				}
+				if(locdata || ts.p.treeGrid===true) {
+					rd[locid] = idr;
+					ts.p.data.push(rd);
+					ts.p._index[idr] = ts.p.data.length-1;
+				}
+				if(ts.p.gridview === false ) {
+					$("#"+$.jgrid.jqID(ts.p.id)+" tbody:first").append(rowData.join(''));
+					if(afterInsRow) {ts.p.afterInsertRow.call(ts,idr,rd,cur);}
+					rowData=[];//ari=0;
+				}
+				rd={};
+				ir++;
+				i++;
+				if(ir==rn) { break; }
+			}
+			if(ts.p.gridview === true ) {
+				fpos = ts.p.treeANode > -1 ? ts.p.treeANode: 0;
+				if(ts.p.grouping) {
+					$(ts).jqGrid('groupingRender',grpdata,ts.p.colModel.length);
+					grpdata = null;
+				} else if(ts.p.treeGrid === true && fpos > 0) {
+					$(ts.rows[fpos]).after(rowData.join(''));
+				} else {
+					$("#"+$.jgrid.jqID(ts.p.id)+" tbody:first").append(rowData.join(''));
+				}
+			}
+			if(ts.p.subGrid === true ) {
+				try { $(ts).jqGrid("addSubGrid",gi+ni);} catch (_){}
+			}
+			ts.p.totaltime = new Date() - startReq;
+			if(ir>0) {
+				if(ts.p.records===0) { ts.p.records=len; }
+			}
+			rowData = null;
+			if( ts.p.treeGrid === true) {
+				try {$(ts).jqGrid("setTreeNode", fpos+1, ir+fpos+1);} catch (e) {}
+			}
+			if(!ts.p.treeGrid && !ts.p.scroll) {ts.grid.bDiv.scrollTop = 0;}
+			ts.p.reccount=ir;
+			ts.p.treeANode = -1;
+			if(ts.p.userDataOnFooter) { $(ts).jqGrid("footerData","set",ts.p.userData,true); }
+			if(locdata) {
+				ts.p.records = len;
+				ts.p.lastpage = Math.ceil(len/ rn);
+			}
+			if (!more) { ts.updatepager(false,true); }
+			if(locdata) {
+				while (ir<len && drows[ir]) {
+					cur = drows[ir];
+					idr = $.jgrid.getAccessor(cur,idn);
+					if(idr === undefined) {
+						idr = br+ir;
+						if(f.length===0){
+							if(dReader.cell){
+								var ccur2 = $.jgrid.getAccessor(cur,dReader.cell);
+								idr = ccur2[idn] || idr;
+								ccur2=null;
+							}
+						}
+					}
+					if(cur) {
+						idr  = ts.p.idPrefix + idr;
+						if (dReader.repeatitems) {
+							if(dReader.cell) {cur = $.jgrid.getAccessor(cur,dReader.cell);}
+							if (!F) { F=orderedCols(gi+si+ni); }
+						}
+
+						for (j=0;j<F.length;j++) {
+							v = $.jgrid.getAccessor(cur,F[j]);
+							rd[ts.p.colModel[j+gi+si+ni].name] = v;
+						}
+						rd[locid] = idr;
+						ts.p.data.push(rd);
+						ts.p._index[idr] = ts.p.data.length-1;
+						rd = {};
+					}
+					ir++;
+				}
+			}
+		},
+		addLocalData = function() {
+			var st, fndsort=false, cmtypes={}, grtypes=[], grindexes=[], srcformat, sorttype, newformat;
+			if(!$.isArray(ts.p.data)) {
+				return;
+			}
+			var grpview = ts.p.grouping ? ts.p.groupingView : false;
+			$.each(ts.p.colModel,function(i,v){
+				sorttype = this.sorttype || "text";
+				if(sorttype == "date" || sorttype == "datetime") {
+					if(this.formatter && typeof(this.formatter) === 'string' && this.formatter == 'date') {
+						if(this.formatoptions && this.formatoptions.srcformat) {
+							srcformat = this.formatoptions.srcformat;
+						} else {
+							srcformat = $.jgrid.formatter.date.srcformat;
+						}
+						if(this.formatoptions && this.formatoptions.newformat) {
+							newformat = this.formatoptions.newformat;
+						} else {
+							newformat = $.jgrid.formatter.date.newformat;
+						}
+					} else {
+						srcformat = newformat = this.datefmt || "Y-m-d";
+					}
+					cmtypes[this.name] = {"stype": sorttype, "srcfmt": srcformat,"newfmt":newformat};
+				} else {
+					cmtypes[this.name] = {"stype": sorttype, "srcfmt":'',"newfmt":''};
+				}
+				if(ts.p.grouping && this.name == grpview.groupField[0]) {
+					var grindex = this.name;
+					if (typeof this.index != 'undefined') {
+						grindex = this.index;
+					}
+					grtypes[0] = cmtypes[grindex];
+					grindexes.push(grindex);
+				}
+				if(!fndsort && (this.index == ts.p.sortname || this.name == ts.p.sortname)){
+					st = this.name; // ???
+					fndsort = true;
+				}
+			});
+			if(ts.p.treeGrid) {
+				$(ts).jqGrid("SortTree", st, ts.p.sortorder, cmtypes[st].stype, cmtypes[st].srcfmt);
+				return;
+			}
+			var compareFnMap = {
+				'eq':function(queryObj, op) {return queryObj.equals;},
+				'ne':function(queryObj,op) {return queryObj.notEquals;},
+				'lt':function(queryObj,op) {return queryObj.less;},
+				'le':function(queryObj,op) {return queryObj.lessOrEquals;},
+				'gt':function(queryObj,op) {return queryObj.greater;},
+				'ge':function(queryObj,op) {return queryObj.greaterOrEquals;},
+				'cn':function(queryObj,op) {return queryObj.contains;},
+				'nc':function(queryObj,op) {return op === "OR" ? queryObj.orNot().contains : queryObj.andNot().contains;},
+				'bw':function(queryObj,op) {return queryObj.startsWith;},
+				'bn':function(queryObj,op) {return op === "OR" ? queryObj.orNot().startsWith : queryObj.andNot().startsWith;},
+				'en':function(queryObj,op) {return op === "OR" ? queryObj.orNot().endsWith : queryObj.andNot().endsWith;},
+				'ew':function(queryObj,op) {return queryObj.endsWith;},
+				'ni':function(queryObj,op) {return op === "OR" ? queryObj.orNot().equals : queryObj.andNot().equals;},
+				'in':function(queryObj,op) {return queryObj.equals;},
+				'nu':function(queryObj,op) {return queryObj.isNull;},
+				'nn':function(queryObj,op) {return op === "OR" ? queryObj.orNot().isNull : queryObj.andNot().isNull;}
+
+			},
+			query = $.jgrid.from(ts.p.data);
+			if (ts.p.ignoreCase) { query = query.ignoreCase(); }
+			function tojLinq ( group ) {
+				var s = 0, index, gor, ror, opr, rule;
+				if (group.groups !== undefined) {
+					gor = group.groups.length && group.groupOp.toString().toUpperCase() === "OR";
+					if (gor) {
+						query.orBegin();
+					}
+					for (index = 0; index < group.groups.length; index++) {
+						if (s > 0 && gor) {
+							query.or();
+						}
+						try {
+							tojLinq(group.groups[index]);
+						} catch (e) {alert(e);}
+						s++;
+					}
+					if (gor) {
+						query.orEnd();
+					}
+				}
+				if (group.rules !== undefined) {
+					if(s>0) {
+						var result = query.select();
+						query = $.jgrid.from( result);
+						if (ts.p.ignoreCase) { query = query.ignoreCase(); } 
+					}
+					try{
+						ror = group.rules.length && group.groupOp.toString().toUpperCase() === "OR";
+						if (ror) {
+							query.orBegin();
+						}
+						for (index = 0; index < group.rules.length; index++) {
+							rule = group.rules[index];
+							opr = group.groupOp.toString().toUpperCase();
+							if (compareFnMap[rule.op] && rule.field ) {
+								if(s > 0 && opr && opr === "OR") {
+									query = query.or();
+								}
+								query = compareFnMap[rule.op](query, opr)(rule.field, rule.data, cmtypes[rule.field]);
+							}
+							s++;
+						}
+						if (ror) {
+							query.orEnd();
+						}
+					} catch (g) {alert(g);}
+				}
+			}
+
+			if (ts.p.search === true) {
+				var srules = ts.p.postData.filters;
+				if(srules) {
+					if(typeof srules == "string") { srules = $.jgrid.parse(srules);}
+					tojLinq( srules );
+				} else {
+					try {
+						query = compareFnMap[ts.p.postData.searchOper](query)(ts.p.postData.searchField, ts.p.postData.searchString,cmtypes[ts.p.postData.searchField]);
+					} catch (se){}
+				}
+			}
+			if(ts.p.grouping) {
+				query.orderBy(grindexes,grpview.groupOrder[0],grtypes[0].stype, grtypes[0].srcfmt);
+				grpview.groupDataSorted = true;
+			}
+			if (st && ts.p.sortorder && fndsort) {
+				if(ts.p.sortorder.toUpperCase() == "DESC") {
+					query.orderBy(ts.p.sortname, "d", cmtypes[st].stype, cmtypes[st].srcfmt);
+				} else {
+					query.orderBy(ts.p.sortname, "a", cmtypes[st].stype, cmtypes[st].srcfmt);
+				}
+			}
+			var queryResults = query.select(),
+			recordsperpage = parseInt(ts.p.rowNum,10),
+			total = queryResults.length,
+			page = parseInt(ts.p.page,10),
+			totalpages = Math.ceil(total / recordsperpage),
+			retresult = {};
+			queryResults = queryResults.slice( (page-1)*recordsperpage , page*recordsperpage );
+			query = null;
+			cmtypes = null;
+			retresult[ts.p.localReader.total] = totalpages;
+			retresult[ts.p.localReader.page] = page;
+			retresult[ts.p.localReader.records] = total;
+			retresult[ts.p.localReader.root] = queryResults;
+			retresult[ts.p.localReader.userdata] = ts.p.userData;
+			queryResults = null;
+			return  retresult;
+		},
+		updatepager = function(rn, dnd) {
+			var cp, last, base, from,to,tot,fmt, pgboxes = "", sppg,
+			tspg = ts.p.pager ? "_"+$.jgrid.jqID(ts.p.pager.substr(1)) : "",
+			tspg_t = ts.p.toppager ? "_"+ts.p.toppager.substr(1) : "";
+			base = parseInt(ts.p.page,10)-1;
+			if(base < 0) { base = 0; }
+			base = base*parseInt(ts.p.rowNum,10);
+			to = base + ts.p.reccount;
+			if (ts.p.scroll) {
+				var rows = $("tbody:first > tr:gt(0)", ts.grid.bDiv);
+				base = to - rows.length;
+				ts.p.reccount = rows.length;
+				var rh = rows.outerHeight() || ts.grid.prevRowHeight;
+				if (rh) {
+					var top = base * rh;
+					var height = parseInt(ts.p.records,10) * rh;
+				    $(">div:first",ts.grid.bDiv).css({height : height}).children("div:first").css({height:top,display:top?"":"none"});
+				}
+				ts.grid.bDiv.scrollLeft = ts.grid.hDiv.scrollLeft;
+			}
+			pgboxes = ts.p.pager ? ts.p.pager : "";
+			pgboxes += ts.p.toppager ?  (pgboxes ? "," + ts.p.toppager : ts.p.toppager) : "";
+			if(pgboxes) {
+				fmt = $.jgrid.formatter.integer || {};
+				cp = intNum(ts.p.page);
+				last = intNum(ts.p.lastpage);
+				$(".selbox",pgboxes)[ this.p.useProp ? 'prop' : 'attr' ]("disabled",false);
+				if(ts.p.pginput===true) {
+					$('.ui-pg-input',pgboxes).val(ts.p.page);
+					sppg = ts.p.toppager ? '#sp_1'+tspg+",#sp_1"+tspg_t : '#sp_1'+tspg;
+					$(sppg).html($.fmatter ? $.fmatter.util.NumberFormat(ts.p.lastpage,fmt):ts.p.lastpage);
+
+				}
+				if (ts.p.viewrecords){
+					if(ts.p.reccount === 0) {
+						$(".ui-paging-info",pgboxes).html(ts.p.emptyrecords);
+					} else {
+						from = base+1;
+						tot=ts.p.records;
+						if($.fmatter) {
+							from = $.fmatter.util.NumberFormat(from,fmt);
+							to = $.fmatter.util.NumberFormat(to,fmt);
+							tot = $.fmatter.util.NumberFormat(tot,fmt);
+						}
+						$(".ui-paging-info",pgboxes).html($.jgrid.format(ts.p.recordtext,from,to,tot));
+					}
+				}
+				if(ts.p.pgbuttons===true) {
+					if(cp<=0) {cp = last = 0;}
+					if(cp==1 || cp === 0) {
+						$("#first"+tspg+", #prev"+tspg).addClass('ui-state-disabled').removeClass('ui-state-hover');
+						if(ts.p.toppager) { $("#first_t"+tspg_t+", #prev_t"+tspg_t).addClass('ui-state-disabled').removeClass('ui-state-hover'); }
+					} else {
+						$("#first"+tspg+", #prev"+tspg).removeClass('ui-state-disabled');
+						if(ts.p.toppager) { $("#first_t"+tspg_t+", #prev_t"+tspg_t).removeClass('ui-state-disabled'); }
+					}
+					if(cp==last || cp === 0) {
+						$("#next"+tspg+", #last"+tspg).addClass('ui-state-disabled').removeClass('ui-state-hover');
+						if(ts.p.toppager) { $("#next_t"+tspg_t+", #last_t"+tspg_t).addClass('ui-state-disabled').removeClass('ui-state-hover'); }
+					} else {
+						$("#next"+tspg+", #last"+tspg).removeClass('ui-state-disabled');
+						if(ts.p.toppager) { $("#next_t"+tspg_t+", #last_t"+tspg_t).removeClass('ui-state-disabled'); }
+					}
+				}
+			}
+			if(rn===true && ts.p.rownumbers === true) {
+				$("td.jqgrid-rownum",ts.rows).each(function(i){
+					$(this).html(base+1+i);
+				});
+			}
+			if(dnd && ts.p.jqgdnd) { $(ts).jqGrid('gridDnD','updateDnD');}
+			if($.isFunction(ts.p.gridComplete)) {ts.p.gridComplete.call(ts);}
+		},
+		beginReq = function() {
+			ts.grid.hDiv.loading = true;
+			if(ts.p.hiddengrid) { return;}
+			switch(ts.p.loadui) {
+				case "disable":
+					break;
+				case "enable":
+					$("#load_"+$.jgrid.jqID(ts.p.id)).show();
+					break;
+				case "block":
+					$("#lui_"+$.jgrid.jqID(ts.p.id)).show();
+					$("#load_"+$.jgrid.jqID(ts.p.id)).show();
+					break;
+			}
+		},
+		endReq = function() {
+			ts.grid.hDiv.loading = false;
+			switch(ts.p.loadui) {
+				case "disable":
+					break;
+				case "enable":
+					$("#load_"+$.jgrid.jqID(ts.p.id)).hide();
+					break;
+				case "block":
+					$("#lui_"+$.jgrid.jqID(ts.p.id)).hide();
+					$("#load_"+$.jgrid.jqID(ts.p.id)).hide();
+					break;
+			}
+		},
+		populate = function (npage) {
+			if(!ts.grid.hDiv.loading) {
+				var pvis = ts.p.scroll && npage === false;
+				var prm = {}, dt, dstr, pN=ts.p.prmNames;
+				if(ts.p.page <=0) { ts.p.page = 1; }
+				if(pN.search !== null) {prm[pN.search] = ts.p.search;} if(pN.nd !== null) {prm[pN.nd] = new Date().getTime();}
+				if(pN.rows !== null) {prm[pN.rows]= ts.p.rowNum;} if(pN.page !== null) {prm[pN.page]= ts.p.page;}
+				if(pN.sort !== null) {prm[pN.sort]= ts.p.sortname;} if(pN.order !== null) {prm[pN.order]= ts.p.sortorder;}
+				if(ts.p.rowTotal !== null && pN.totalrows !== null) { prm[pN.totalrows]= ts.p.rowTotal; }
+				var lc = ts.p.loadComplete;
+				var lcf = $.isFunction(lc);
+				if (!lcf) { lc = null; }
+				var adjust = 0;
+				npage = npage || 1;
+				if (npage > 1) {
+					if(pN.npage !== null) {
+						prm[pN.npage] = npage;
+						adjust = npage - 1;
+						npage = 1;
+					} else {
+						lc = function(req) {
+							ts.p.page++;
+							ts.grid.hDiv.loading = false;
+							if (lcf) {
+								ts.p.loadComplete.call(ts,req);
+							}
+							populate(npage-1);
+						};
+					}
+				} else if (pN.npage !== null) {
+					delete ts.p.postData[pN.npage];
+				}
+				if(ts.p.grouping) {
+					$(ts).jqGrid('groupingSetup');
+					if(ts.p.groupingView.groupDataSorted === true) {
+						prm[pN.sort] = ts.p.groupingView.groupField[0] +" "+ ts.p.groupingView.groupOrder[0]+", "+prm[pN.sort];
+					}
+				}
+				$.extend(ts.p.postData,prm);
+				var rcnt = !ts.p.scroll ? 1 : ts.rows.length-1;
+				if ($.isFunction(ts.p.datatype)) { ts.p.datatype.call(ts,ts.p.postData,"load_"+ts.p.id); return;}
+				else if($.isFunction(ts.p.beforeRequest)) {
+					var bfr = ts.p.beforeRequest.call(ts);
+					if(bfr === undefined) { bfr = true; }
+					if ( bfr === false ) { return; }
+				}
+				dt = ts.p.datatype.toLowerCase();
+				switch(dt)
+				{
+				case "json":
+				case "jsonp":
+				case "xml":
+				case "script":
+					$.ajax($.extend({
+						url:ts.p.url,
+						type:ts.p.mtype,
+						dataType: dt ,
+						data: $.isFunction(ts.p.serializeGridData)? ts.p.serializeGridData.call(ts,ts.p.postData) : ts.p.postData,
+						success:function(data,st, xhr) {
+							if ($.isFunction(ts.p.beforeProcessing)) {
+									ts.p.beforeProcessing.call(ts, data, st, xhr);
+							}
+							if(dt === "xml") { addXmlData(data,ts.grid.bDiv,rcnt,npage>1,adjust); }
+							else { addJSONData(data,ts.grid.bDiv,rcnt,npage>1,adjust); }
+							if(lc) { lc.call(ts,data); }
+							if (pvis) { ts.grid.populateVisible(); }
+							if( ts.p.loadonce || ts.p.treeGrid) {ts.p.datatype = "local";}
+							data=null;
+							if (npage === 1) { endReq(); }
+						},
+						error:function(xhr,st,err){
+							if($.isFunction(ts.p.loadError)) { ts.p.loadError.call(ts,xhr,st,err); }
+							if (npage === 1) { endReq(); }
+							xhr=null;
+						},
+						beforeSend: function(xhr, settings ){
+							var gotoreq = true;
+							if($.isFunction(ts.p.loadBeforeSend)) {
+								gotoreq = ts.p.loadBeforeSend.call(ts,xhr, settings); 
+							}
+							if(gotoreq === undefined) { gotoreq = true; }
+							if(gotoreq === false) {
+								return false;
+							} else {
+								beginReq();
+							}
+						}
+					},$.jgrid.ajaxOptions, ts.p.ajaxGridOptions));
+				break;
+				case "xmlstring":
+					beginReq();
+					dstr = $.jgrid.stringToDoc(ts.p.datastr);
+					addXmlData(dstr,ts.grid.bDiv);
+					if(lcf) {ts.p.loadComplete.call(ts,dstr);}
+					ts.p.datatype = "local";
+					ts.p.datastr = null;
+					endReq();
+				break;
+				case "jsonstring":
+					beginReq();
+					if(typeof ts.p.datastr == 'string') { dstr = $.jgrid.parse(ts.p.datastr); }
+					else { dstr = ts.p.datastr; }
+					addJSONData(dstr,ts.grid.bDiv);
+					if(lcf) {ts.p.loadComplete.call(ts,dstr);}
+					ts.p.datatype = "local";
+					ts.p.datastr = null;
+					endReq();
+				break;
+				case "local":
+				case "clientside":
+					beginReq();
+					ts.p.datatype = "local";
+					var req = addLocalData();
+					addJSONData(req,ts.grid.bDiv,rcnt,npage>1,adjust);
+					if(lc) { lc.call(ts,req); }
+					if (pvis) { ts.grid.populateVisible(); }
+					endReq();
+				break;
+				}
+			}
+		},
+        setPager = function (pgid, tp){
+            // TBD - consider escaping pgid with pgid = $.jgrid.jqID(pgid);
+			var sep = "<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='ui-separator'></span></td>",
+			pginp = "",
+			pgl="<table cellspacing='0' cellpadding='0' border='0' style='table-layout:auto;' class='ui-pg-table'><tbody><tr>",
+			str="", pgcnt, lft, cent, rgt, twd, tdw, i,
+			clearVals = function(onpaging){
+				var ret;
+				if ($.isFunction(ts.p.onPaging) ) { ret = ts.p.onPaging.call(ts,onpaging); }
+				ts.p.selrow = null;
+				if(ts.p.multiselect) {ts.p.selarrrow =[];$('#cb_'+$.jgrid.jqID(ts.p.id),ts.grid.hDiv)[ts.p.useProp ? 'prop': 'attr']("checked", false);}
+				ts.p.savedRow = [];
+				if(ret=='stop') {return false;}
+				return true;
+			};
+			pgid = pgid.substr(1);
+			tp += "_" + pgid;
+			pgcnt = "pg_"+pgid;
+			lft = pgid+"_left"; cent = pgid+"_center"; rgt = pgid+"_right";
+			$("#"+$.jgrid.jqID(pgid) )
+			.append("<div id='"+pgcnt+"' class='ui-pager-control' role='group'><table cellspacing='0' cellpadding='0' border='0' class='ui-pg-table' style='width:100%;table-layout:fixed;height:100%;' role='row'><tbody><tr><td id='"+lft+"' align='left'></td><td id='"+cent+"' align='center' style='white-space:pre;'></td><td id='"+rgt+"' align='right'></td></tr></tbody></table></div>")
+			.attr("dir","ltr"); //explicit setting
+			if(ts.p.rowList.length >0){
+				str = "<td dir='"+dir+"'>";
+				str +="<select class='ui-pg-selbox' role='listbox'>";
+				for(i=0;i<ts.p.rowList.length;i++){
+					str +="<option role=\"option\" value=\""+ts.p.rowList[i]+"\""+((ts.p.rowNum == ts.p.rowList[i])?" selected=\"selected\"":"")+">"+ts.p.rowList[i]+"</option>";
+				}
+				str +="</select></td>";
+			}
+			if(dir=="rtl") { pgl += str; }
+			if(ts.p.pginput===true) { pginp= "<td dir='"+dir+"'>"+$.jgrid.format(ts.p.pgtext || "","<input class='ui-pg-input' type='text' size='2' maxlength='7' value='0' role='textbox'/>","<span id='sp_1_"+$.jgrid.jqID(pgid)+"'></span>")+"</td>";}
+			if(ts.p.pgbuttons===true) {
+				var po=["first"+tp,"prev"+tp, "next"+tp,"last"+tp]; if(dir=="rtl") { po.reverse(); }
+				pgl += "<td id='"+po[0]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-first'></span></td>";
+				pgl += "<td id='"+po[1]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-prev'></span></td>";
+				pgl += pginp !== "" ? sep+pginp+sep:"";
+				pgl += "<td id='"+po[2]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-next'></span></td>";
+				pgl += "<td id='"+po[3]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-end'></span></td>";
+			} else if (pginp !== "") { pgl += pginp; }
+			if(dir=="ltr") { pgl += str; }
+			pgl += "</tr></tbody></table>";
+			if(ts.p.viewrecords===true) {$("td#"+pgid+"_"+ts.p.recordpos,"#"+pgcnt).append("<div dir='"+dir+"' style='text-align:"+ts.p.recordpos+"' class='ui-paging-info'></div>");}
+			$("td#"+pgid+"_"+ts.p.pagerpos,"#"+pgcnt).append(pgl);
+			tdw = $(".ui-jqgrid").css("font-size") || "11px";
+			$(document.body).append("<div id='testpg' class='ui-jqgrid ui-widget ui-widget-content' style='font-size:"+tdw+";visibility:hidden;' ></div>");
+			twd = $(pgl).clone().appendTo("#testpg").width();
+			$("#testpg").remove();
+			if(twd > 0) {
+				if(pginp !== "") { twd += 50; } //should be param
+				$("td#"+pgid+"_"+ts.p.pagerpos,"#"+pgcnt).width(twd);
+			}
+			ts.p._nvtd = [];
+			ts.p._nvtd[0] = twd ? Math.floor((ts.p.width - twd)/2) : Math.floor(ts.p.width/3);
+			ts.p._nvtd[1] = 0;
+			pgl=null;
+			$('.ui-pg-selbox',"#"+pgcnt).bind('change',function() {
+				ts.p.page = Math.round(ts.p.rowNum*(ts.p.page-1)/this.value-0.5)+1;
+				ts.p.rowNum = this.value;
+				if(tp) { $('.ui-pg-selbox',ts.p.pager).val(this.value); }
+				else if(ts.p.toppager) { $('.ui-pg-selbox',ts.p.toppager).val(this.value); }
+				if(!clearVals('records')) { return false; }
+				populate();
+				return false;
+			});
+			if(ts.p.pgbuttons===true) {
+			$(".ui-pg-button","#"+pgcnt).hover(function(e){
+				if($(this).hasClass('ui-state-disabled')) {
+					this.style.cursor='default';
+				} else {
+					$(this).addClass('ui-state-hover');
+					this.style.cursor='pointer';
+				}
+			},function(e) {
+				if($(this).hasClass('ui-state-disabled')) {
+				} else {
+					$(this).removeClass('ui-state-hover');
+					this.style.cursor= "default";
+				}
+			});
+			$("#first"+$.jgrid.jqID(tp)+", #prev"+$.jgrid.jqID(tp)+", #next"+$.jgrid.jqID(tp)+", #last"+$.jgrid.jqID(tp)).click( function(e) {
+				var cp = intNum(ts.p.page,1),
+				last = intNum(ts.p.lastpage,1), selclick = false,
+				fp=true, pp=true, np=true,lp=true;
+				if(last ===0 || last===1) {fp=false;pp=false;np=false;lp=false; }
+				else if( last>1 && cp >=1) {
+					if( cp === 1) { fp=false; pp=false; }
+					else if( cp>1 && cp <last){ }
+					else if( cp===last){ np=false;lp=false; }
+				} else if( last>1 && cp===0 ) { np=false;lp=false; cp=last-1;}
+				if( this.id === 'first'+tp && fp ) { ts.p.page=1; selclick=true;}
+				if( this.id === 'prev'+tp && pp) { ts.p.page=(cp-1); selclick=true;}
+				if( this.id === 'next'+tp && np) { ts.p.page=(cp+1); selclick=true;}
+				if( this.id === 'last'+tp && lp) { ts.p.page=last; selclick=true;}
+				if(selclick) {
+					if(!clearVals(this.id)) { return false; }
+					populate();
+				}
+				return false;
+			});
+			}
+			if(ts.p.pginput===true) {
+			$('input.ui-pg-input',"#"+pgcnt).keypress( function(e) {
+				var key = e.charCode ? e.charCode : e.keyCode ? e.keyCode : 0;
+				if(key == 13) {
+					ts.p.page = ($(this).val()>0) ? $(this).val():ts.p.page;
+					if(!clearVals('user')) { return false; }
+					populate();
+					return false;
+				}
+				return this;
+			});
+			}
+		},
+		sortData = function (index, idxcol,reload,sor){
+			if(!ts.p.colModel[idxcol].sortable) { return; }
+			var so;
+			if(ts.p.savedRow.length > 0) {return;}
+			if(!reload) {
+				if( ts.p.lastsort == idxcol ) {
+					if( ts.p.sortorder == 'asc') {
+						ts.p.sortorder = 'desc';
+					} else if(ts.p.sortorder == 'desc') { ts.p.sortorder = 'asc';}
+				} else { ts.p.sortorder = ts.p.colModel[idxcol].firstsortorder || 'asc'; }
+				ts.p.page = 1;
+			}
+			if(sor) {
+				if(ts.p.lastsort == idxcol && ts.p.sortorder == sor && !reload) { return; }
+				else { ts.p.sortorder = sor; }
+			}
+			var previousSelectedTh = ts.grid.headers[ts.p.lastsort].el, newSelectedTh = ts.grid.headers[idxcol].el;
+
+			$("span.ui-grid-ico-sort",previousSelectedTh).addClass('ui-state-disabled');
+			$(previousSelectedTh).attr("aria-selected","false");
+			$("span.ui-icon-"+ts.p.sortorder,newSelectedTh).removeClass('ui-state-disabled');
+			$(newSelectedTh).attr("aria-selected","true");
+			if(!ts.p.viewsortcols[0]) {
+				if(ts.p.lastsort != idxcol) {
+					$("span.s-ico",previousSelectedTh).hide();
+					$("span.s-ico",newSelectedTh).show();
+				}
+			}
+			index = index.substring(5 + ts.p.id.length + 1); // bad to be changed!?!
+			ts.p.sortname = ts.p.colModel[idxcol].index || index;
+			so = ts.p.sortorder;
+			if($.isFunction(ts.p.onSortCol)) {if (ts.p.onSortCol.call(ts,index,idxcol,so)=='stop') {ts.p.lastsort = idxcol; return;}}
+			if(ts.p.datatype == "local") {
+				if(ts.p.deselectAfterSort) {$(ts).jqGrid("resetSelection");}
+			} else {
+				ts.p.selrow = null;
+				if(ts.p.multiselect){$("#cb_"+$.jgrid.jqID(ts.p.id),ts.grid.hDiv)[ts.p.useProp ? 'prop': 'attr']("checked", false);}
+				ts.p.selarrrow =[];
+				ts.p.savedRow =[];
+			}
+			if(ts.p.scroll) {
+				var sscroll = ts.grid.bDiv.scrollLeft;
+				emptyRows(ts.grid.bDiv,true, false);
+				ts.grid.hDiv.scrollLeft = sscroll;
+			}
+			if(ts.p.subGrid && ts.p.datatype=='local') {
+				$("td.sgexpanded","#"+$.jgrid.jqID(ts.p.id)).each(function(){
+					$(this).trigger("click");
+				});
+			}
+			populate();
+			ts.p.lastsort = idxcol;
+			if(ts.p.sortname != index && idxcol) {ts.p.lastsort = idxcol;}
+		},
+		setColWidth = function () {
+			var initwidth = 0, brd=isSafari? 0: ts.p.cellLayout, vc=0, lvc, scw=ts.p.scrollOffset,cw,hs=false,aw,gw=0,
+			cl = 0, cr;
+			$.each(ts.p.colModel, function(i) {
+				if(typeof this.hidden === 'undefined') {this.hidden=false;}
+				this.widthOrg = cw = intNum(this.width,0);
+				if(this.hidden===false){
+					initwidth += cw+brd;
+					if(this.fixed) {
+						gw += cw+brd;
+					} else {
+						vc++;
+					}
+					cl++;
+				}
+			});
+			if(isNaN(ts.p.width)) {ts.p.width = grid.width = initwidth;}
+			else { grid.width = ts.p.width;}
+			ts.p.tblwidth = initwidth;
+			if(ts.p.shrinkToFit ===false && ts.p.forceFit === true) {ts.p.forceFit=false;}
+			if(ts.p.shrinkToFit===true && vc > 0) {
+				aw = grid.width-brd*vc-gw;
+				if(isNaN(ts.p.height)) {
+				} else {
+					aw -= scw;
+					hs = true;
+				}
+				initwidth =0;
+				$.each(ts.p.colModel, function(i) {
+					if(this.hidden === false && !this.fixed){
+						cw = Math.round(aw*this.width/(ts.p.tblwidth-brd*vc-gw));
+						this.width =cw;
+						initwidth += cw;
+						lvc = i;
+					}
+				});
+				cr =0;
+				if (hs) {
+					if(grid.width-gw-(initwidth+brd*vc) !== scw){
+						cr = grid.width-gw-(initwidth+brd*vc)-scw;
+					}
+				} else if(!hs && Math.abs(grid.width-gw-(initwidth+brd*vc)) !== 1) {
+					cr = grid.width-gw-(initwidth+brd*vc);
+				}
+				ts.p.colModel[lvc].width += cr;
+				ts.p.tblwidth = initwidth+cr+brd*vc+gw;
+				if(ts.p.tblwidth > ts.p.width) {
+					ts.p.colModel[lvc].width -= (ts.p.tblwidth - parseInt(ts.p.width,10));
+					ts.p.tblwidth = ts.p.width;
+				}
+			}
+		},
+		nextVisible= function(iCol) {
+			var ret = iCol, j=iCol, i;
+			for (i = iCol+1;i<ts.p.colModel.length;i++){
+				if(ts.p.colModel[i].hidden !== true ) {
+					j=i; break;
+				}
+			}
+			return j-ret;
+		},
+		getOffset = function (iCol) {
+			var i, ret = {}, brd1 = isSafari ? 0 : ts.p.cellLayout;
+			ret[0] =  ret[1] = ret[2] = 0;
+			for(i=0;i<=iCol;i++){
+				if(ts.p.colModel[i].hidden === false ) {
+					ret[0] += ts.p.colModel[i].width+brd1;
+				}
+			}
+			if(ts.p.direction=="rtl") { ret[0] = ts.p.width - ret[0]; }
+			ret[0] = ret[0] - ts.grid.bDiv.scrollLeft;
+			if($(ts.grid.cDiv).is(":visible")) {ret[1] += $(ts.grid.cDiv).height() +parseInt($(ts.grid.cDiv).css("padding-top"),10)+parseInt($(ts.grid.cDiv).css("padding-bottom"),10);}
+			if(ts.p.toolbar[0]===true && (ts.p.toolbar[1]=='top' || ts.p.toolbar[1]=='both')) {ret[1] += $(ts.grid.uDiv).height()+parseInt($(ts.grid.uDiv).css("border-top-width"),10)+parseInt($(ts.grid.uDiv).css("border-bottom-width"),10);}
+			if(ts.p.toppager) {ret[1] += $(ts.grid.topDiv).height()+parseInt($(ts.grid.topDiv).css("border-bottom-width"),10);}
+			ret[2] += $(ts.grid.bDiv).height() + $(ts.grid.hDiv).height();
+			return ret;
+		},
+		getColumnHeaderIndex = function (th) {
+			var i, headers = ts.grid.headers, ci = $.jgrid.getCellIndex(th);
+			for (i = 0; i < headers.length; i++) {
+				if (th === headers[i].el) {
+					ci = i;
+					break;
+				}
+			}
+			return ci;
+		};
+		this.p.id = this.id;
+		if ($.inArray(ts.p.multikey,sortkeys) == -1 ) {ts.p.multikey = false;}
+		ts.p.keyIndex=false;
+		for (i=0; i<ts.p.colModel.length;i++) {
+			ts.p.colModel[i] = $.extend(true, {}, ts.p.cmTemplate, ts.p.colModel[i].template || {}, ts.p.colModel[i]);
+			if (ts.p.keyIndex === false && ts.p.colModel[i].key===true) {
+				ts.p.keyIndex = i;
+			}
+		}
+		ts.p.sortorder = ts.p.sortorder.toLowerCase();
+		if(ts.p.grouping===true) {
+			ts.p.scroll = false;
+			ts.p.rownumbers = false;
+			ts.p.subGrid = false;
+			ts.p.treeGrid = false;
+			ts.p.gridview = true;
+		}
+		if(this.p.treeGrid === true) {
+			try { $(this).jqGrid("setTreeGrid");} catch (_) {}
+			if(ts.p.datatype != "local") { ts.p.localReader = {id: "_id_"};	}
+		}
+		if(this.p.subGrid) {
+			try { $(ts).jqGrid("setSubGrid");} catch (s){}
+		}
+		if(this.p.multiselect) {
+			this.p.colNames.unshift("<input role='checkbox' id='cb_"+this.p.id+"' class='cbox' type='checkbox'/>");
+			this.p.colModel.unshift({name:'cb',width:isSafari ? ts.p.multiselectWidth+ts.p.cellLayout : ts.p.multiselectWidth,sortable:false,resizable:false,hidedlg:true,search:false,align:'center',fixed:true});
+		}
+		if(this.p.rownumbers) {
+			this.p.colNames.unshift("");
+			this.p.colModel.unshift({name:'rn',width:ts.p.rownumWidth,sortable:false,resizable:false,hidedlg:true,search:false,align:'center',fixed:true});
+		}
+		ts.p.xmlReader = $.extend(true,{
+			root: "rows",
+			row: "row",
+			page: "rows>page",
+			total: "rows>total",
+			records : "rows>records",
+			repeatitems: true,
+			cell: "cell",
+			id: "[id]",
+			userdata: "userdata",
+			subgrid: {root:"rows", row: "row", repeatitems: true, cell:"cell"}
+		}, ts.p.xmlReader);
+		ts.p.jsonReader = $.extend(true,{
+			root: "rows",
+			page: "page",
+			total: "total",
+			records: "records",
+			repeatitems: true,
+			cell: "cell",
+			id: "id",
+			userdata: "userdata",
+			subgrid: {root:"rows", repeatitems: true, cell:"cell"}
+		},ts.p.jsonReader);
+		ts.p.localReader = $.extend(true,{
+			root: "rows",
+			page: "page",
+			total: "total",
+			records: "records",
+			repeatitems: false,
+			cell: "cell",
+			id: "id",
+			userdata: "userdata",
+			subgrid: {root:"rows", repeatitems: true, cell:"cell"}
+		},ts.p.localReader);
+		if(ts.p.scroll){
+			ts.p.pgbuttons = false; ts.p.pginput=false; ts.p.rowList=[];
+		}
+		if(ts.p.data.length) { refreshIndex(); }
+		var thead = "<thead><tr class='ui-jqgrid-labels' role='rowheader'>",
+		tdc, idn, w, res, sort,
+		td, ptr, tbody, imgs,iac="",idc="";
+		if(ts.p.shrinkToFit===true && ts.p.forceFit===true) {
+			for (i=ts.p.colModel.length-1;i>=0;i--){
+				if(!ts.p.colModel[i].hidden) {
+					ts.p.colModel[i].resizable=false;
+					break;
+				}
+			}
+		}
+		if(ts.p.viewsortcols[1] == 'horizontal') {iac=" ui-i-asc";idc=" ui-i-desc";}
+		tdc = isMSIE ?  "class='ui-th-div-ie'" :"";
+		imgs = "<span class='s-ico' style='display:none'><span sort='asc' class='ui-grid-ico-sort ui-icon-asc"+iac+" ui-state-disabled ui-icon ui-icon-triangle-1-n ui-sort-"+dir+"'></span>";
+		imgs += "<span sort='desc' class='ui-grid-ico-sort ui-icon-desc"+idc+" ui-state-disabled ui-icon ui-icon-triangle-1-s ui-sort-"+dir+"'></span></span>";
+		for(i=0;i<this.p.colNames.length;i++){
+			var tooltip = ts.p.headertitles ? (" title=\""+$.jgrid.stripHtml(ts.p.colNames[i])+"\"") :"";
+			thead += "<th id='"+ts.p.id+"_"+ts.p.colModel[i].name+"' role='columnheader' class='ui-state-default ui-th-column ui-th-"+dir+"'"+ tooltip+">";
+			idn = ts.p.colModel[i].index || ts.p.colModel[i].name;
+			thead += "<div id='jqgh_"+ts.p.id+"_"+ts.p.colModel[i].name+"' "+tdc+">"+ts.p.colNames[i];
+			if(!ts.p.colModel[i].width)  { ts.p.colModel[i].width = 150; }
+			else { ts.p.colModel[i].width = parseInt(ts.p.colModel[i].width,10); }
+			if(typeof(ts.p.colModel[i].title) !== "boolean") { ts.p.colModel[i].title = true; }
+			if (idn == ts.p.sortname) {
+				ts.p.lastsort = i;
+			}
+			thead += imgs+"</div></th>";
+		}
+		thead += "</tr></thead>";
+		imgs = null;
+		$(this).append(thead);
+		$("thead tr:first th",this).hover(function(){$(this).addClass('ui-state-hover');},function(){$(this).removeClass('ui-state-hover');});
+		if(this.p.multiselect) {
+			var emp=[], chk;
+			$('#cb_'+$.jgrid.jqID(ts.p.id),this).bind('click',function(){
+				ts.p.selarrrow = [];
+				if (this.checked) {
+					$(ts.rows).each(function(i) {
+						if (i>0) {
+							if(!$(this).hasClass("ui-subgrid") && !$(this).hasClass("jqgroup") && !$(this).hasClass('ui-state-disabled')){
+							    $("#jqg_"+$.jgrid.jqID(ts.p.id)+"_"+$.jgrid.jqID(this.id) )[ts.p.useProp ? 'prop': 'attr']("checked",true);
+							    $(this).addClass("ui-state-highlight").attr("aria-selected","true");  
+							    ts.p.selarrrow.push(this.id);
+ 								ts.p.selrow = this.id;
+                            }
+						}
+					});
+					chk=true;
+					emp=[];
+				}
+				else {
+					$(ts.rows).each(function(i) {
+						if(i>0) {
+							if(!$(this).hasClass("ui-subgrid") && !$(this).hasClass('ui-state-disabled')){
+								$("#jqg_"+$.jgrid.jqID(ts.p.id)+"_"+$.jgrid.jqID(this.id) )[ts.p.useProp ? 'prop': 'attr']("checked", false);
+								$(this).removeClass("ui-state-highlight").attr("aria-selected","false");
+								emp.push(this.id);
+							}
+						}
+					});
+					ts.p.selrow = null;
+					chk=false;
+				}
+				if($.isFunction(ts.p.onSelectAll)) {ts.p.onSelectAll.call(ts, chk ? ts.p.selarrrow : emp,chk);}
+			});
+		}
+
+		if(ts.p.autowidth===true) {
+			var pw = $(eg).innerWidth();
+			ts.p.width = pw > 0?  pw: 'nw';
+		}
+		setColWidth();
+		$(eg).css("width",grid.width+"px").append("<div class='ui-jqgrid-resize-mark' id='rs_m"+ts.p.id+"'>&#160;</div>");
+		$(gv).css("width",grid.width+"px");
+		thead = $("thead:first",ts).get(0);
+		var	tfoot = "";
+		if(ts.p.footerrow) { tfoot += "<table role='grid' style='width:"+ts.p.tblwidth+"px' class='ui-jqgrid-ftable' cellspacing='0' cellpadding='0' border='0'><tbody><tr role='row' class='ui-widget-content footrow footrow-"+dir+"'>"; }
+		var thr = $("tr:first",thead),
+		firstr = "<tr class='jqgfirstrow' role='row' style='height:auto'>";
+		ts.p.disableClick=false;
+		$("th",thr).each(function ( j ) {
+			w = ts.p.colModel[j].width;
+			if(typeof ts.p.colModel[j].resizable === 'undefined') {ts.p.colModel[j].resizable = true;}
+			if(ts.p.colModel[j].resizable){
+				res = document.createElement("span");
+				$(res).html("&#160;").addClass('ui-jqgrid-resize ui-jqgrid-resize-'+dir);
+				if(!$.browser.opera) { $(res).css("cursor","col-resize"); }
+				$(this).addClass(ts.p.resizeclass);
+			} else {
+				res = "";
+			}
+			$(this).css("width",w+"px").prepend(res);
+			var hdcol = "";
+			if( ts.p.colModel[j].hidden ) {
+				$(this).css("display","none");
+				hdcol = "display:none;";
+			}
+			firstr += "<td role='gridcell' style='height:0px;width:"+w+"px;"+hdcol+"'></td>";
+			grid.headers[j] = { width: w, el: this };
+			sort = ts.p.colModel[j].sortable;
+			if( typeof sort !== 'boolean') {ts.p.colModel[j].sortable =  true; sort=true;}
+			var nm = ts.p.colModel[j].name;
+			if( !(nm == 'cb' || nm=='subgrid' || nm=='rn') ) {
+				if(ts.p.viewsortcols[2]){
+					$("div",this).addClass('ui-jqgrid-sortable');
+				}
+			}
+			if(sort) {
+				if(ts.p.viewsortcols[0]) {$("div span.s-ico",this).show(); if(j==ts.p.lastsort){ $("div span.ui-icon-"+ts.p.sortorder,this).removeClass("ui-state-disabled");}}
+				else if( j == ts.p.lastsort) {$("div span.s-ico",this).show();$("div span.ui-icon-"+ts.p.sortorder,this).removeClass("ui-state-disabled");}
+			}
+			if(ts.p.footerrow) { tfoot += "<td role='gridcell' "+formatCol(j,0,'', null, '', false)+">&#160;</td>"; }
+		}).mousedown(function(e) {
+			if ($(e.target).closest("th>span.ui-jqgrid-resize").length != 1) { return; }
+			var ci = getColumnHeaderIndex(this);
+			if(ts.p.forceFit===true) {ts.p.nv= nextVisible(ci);}
+			grid.dragStart(ci, e, getOffset(ci));
+			return false;
+		}).click(function(e) {
+			if (ts.p.disableClick) {
+				ts.p.disableClick = false;
+				return false;
+			}
+			var s = "th>div.ui-jqgrid-sortable",r,d;
+			if (!ts.p.viewsortcols[2]) { s = "th>div>span>span.ui-grid-ico-sort"; }
+			var t = $(e.target).closest(s);
+			if (t.length != 1) { return; }
+			var ci = getColumnHeaderIndex(this);
+			if (!ts.p.viewsortcols[2]) { r=true;d=t.attr("sort"); }
+			sortData( $('div',this)[0].id, ci, r, d);
+			return false;
+		});
+		if (ts.p.sortable && $.fn.sortable) {
+			try {
+				$(ts).jqGrid("sortableColumns", thr);
+			} catch (e){}
+		}
+		if(ts.p.footerrow) { tfoot += "</tr></tbody></table>"; }
+		firstr += "</tr>";
+		tbody = document.createElement("tbody");
+		this.appendChild(tbody);
+		$(this).addClass('ui-jqgrid-btable').append(firstr);
+		firstr = null;
+		var hTable = $("<table class='ui-jqgrid-htable' style='width:"+ts.p.tblwidth+"px' role='grid' aria-labelledby='gbox_"+this.id+"' cellspacing='0' cellpadding='0' border='0'></table>").append(thead),
+		hg = (ts.p.caption && ts.p.hiddengrid===true) ? true : false,
+		hb = $("<div class='ui-jqgrid-hbox" + (dir=="rtl" ? "-rtl" : "" )+"'></div>");
+		thead = null;
+		grid.hDiv = document.createElement("div");
+		$(grid.hDiv)
+			.css({ width: grid.width+"px"})
+			.addClass("ui-state-default ui-jqgrid-hdiv")
+			.append(hb);
+		$(hb).append(hTable);
+		hTable = null;
+		if(hg) { $(grid.hDiv).hide(); }
+        if(ts.p.pager){
+            // TBD -- escape ts.p.pager here?
+			if(typeof ts.p.pager == "string") {if(ts.p.pager.substr(0,1) !="#") { ts.p.pager = "#"+ts.p.pager;} }
+			else { ts.p.pager = "#"+ $(ts.p.pager).attr("id");}
+			$(ts.p.pager).css({width: grid.width+"px"}).appendTo(eg).addClass('ui-state-default ui-jqgrid-pager ui-corner-bottom');
+			if(hg) {$(ts.p.pager).hide();}
+			setPager(ts.p.pager,'');
+		}
+		if( ts.p.cellEdit === false && ts.p.hoverrows === true) {
+		$(ts).bind('mouseover',function(e) {
+			ptr = $(e.target).closest("tr.jqgrow");
+			if($(ptr).attr("class") !== "ui-subgrid") {
+				$(ptr).addClass("ui-state-hover");
+			}
+		}).bind('mouseout',function(e) {
+			ptr = $(e.target).closest("tr.jqgrow");
+			$(ptr).removeClass("ui-state-hover");
+		});
+		}
+		var ri,ci;
+		$(ts).before(grid.hDiv).click(function(e) {
+			td = e.target;
+			ptr = $(td,ts.rows).closest("tr.jqgrow");
+			if($(ptr).length === 0 || ptr[0].className.indexOf( 'ui-state-disabled' ) > -1 ) {
+				return this;
+			}
+			var scb = $(td).hasClass("cbox"),
+			cSel = true;
+			if($.isFunction(ts.p.beforeSelectRow)) { cSel = ts.p.beforeSelectRow.call(ts,ptr[0].id, e); }
+			if (td.tagName == 'A' || ((td.tagName == 'INPUT' || td.tagName == 'TEXTAREA' || td.tagName == 'OPTION' || td.tagName == 'SELECT' ) && !scb) ) { return this; }
+			if(cSel === true) {
+				if(ts.p.cellEdit === true) {
+					if(ts.p.multiselect && scb){
+						$(ts).jqGrid("setSelection",ptr[0].id,true);
+					} else {
+						ri = ptr[0].rowIndex;
+						ci = $.jgrid.getCellIndex(td);
+						try {$(ts).jqGrid("editCell",ri,ci,true);} catch (_) {}
+					}
+				} else if ( !ts.p.multikey ) {
+					if(ts.p.multiselect && ts.p.multiboxonly) {
+						if(scb){$(ts).jqGrid("setSelection",ptr[0].id,true);}
+						else {
+							$(ts.p.selarrrow).each(function(i,n){
+								var ind = ts.rows.namedItem(n);
+								$(ind).removeClass("ui-state-highlight");
+								$("#jqg_"+$.jgrid.jqID(ts.p.id)+"_"+$.jgrid.jqID(n))[ts.p.useProp ? 'prop': 'attr']("checked", false);
+							});
+							ts.p.selarrrow = [];
+							$("#cb_"+$.jgrid.jqID(ts.p.id),ts.grid.hDiv)[ts.p.useProp ? 'prop': 'attr']("checked", false);
+							$(ts).jqGrid("setSelection",ptr[0].id,true);
+						}
+					} else {
+						$(ts).jqGrid("setSelection",ptr[0].id,true);
+					}
+				} else {
+					if(e[ts.p.multikey]) {
+						$(ts).jqGrid("setSelection",ptr[0].id,true);
+					} else if(ts.p.multiselect && scb) {
+						scb = $("#jqg_"+$.jgrid.jqID(ts.p.id)+"_"+ptr[0].id).is(":checked");
+						$("#jqg_"+$.jgrid.jqID(ts.p.id)+"_"+ptr[0].id)[ts.p.useProp ? 'prop' : 'attr']("checked", scb);
+					}
+				}
+				if($.isFunction(ts.p.onCellSelect)) {
+					ri = ptr[0].id;
+					ci = $.jgrid.getCellIndex(td);
+					ts.p.onCellSelect.call(ts,ri,ci,$(td).html(),e);
+				}
+				//e.stopPropagation();
+			}
+			//else {
+				return this;
+			//}
+		}).bind('reloadGrid', function(e,opts) {
+			if(ts.p.treeGrid ===true) {	ts.p.datatype = ts.p.treedatatype;}
+			if (opts && opts.current) {
+				ts.grid.selectionPreserver(ts);
+			}
+			if(ts.p.datatype=="local"){ $(ts).jqGrid("resetSelection");  if(ts.p.data.length) { refreshIndex();} }
+			else if(!ts.p.treeGrid) {
+				ts.p.selrow=null;
+				if(ts.p.multiselect) {ts.p.selarrrow =[];$('#cb_'+$.jgrid.jqID(ts.p.id),ts.grid.hDiv)[ts.p.useProp ? 'prop': 'attr']("checked", false);}
+				ts.p.savedRow = [];
+			}
+			if(ts.p.scroll) {emptyRows(ts.grid.bDiv,true, false);}
+			if (opts && opts.page) {
+				var page = opts.page;
+				if (page > ts.p.lastpage) { page = ts.p.lastpage; }
+				if (page < 1) { page = 1; }
+				ts.p.page = page;
+				if (ts.grid.prevRowHeight) {
+					ts.grid.bDiv.scrollTop = (page - 1) * ts.grid.prevRowHeight * ts.p.rowNum;
+				} else {
+					ts.grid.bDiv.scrollTop = 0;
+				}
+			}
+			if (ts.grid.prevRowHeight && ts.p.scroll) {
+                delete ts.p.lastpage;
+				ts.grid.populateVisible();
+			} else {
+				ts.grid.populate();
+			}
+			return false;
+		});
+		if( $.isFunction(this.p.ondblClickRow) ) {
+			$(this).dblclick(function(e) {
+				td = e.target;
+				ptr = $(td,ts.rows).closest("tr.jqgrow");
+				if($(ptr).length === 0 ){return false;}
+				ri = ptr[0].rowIndex;
+				ci = $.jgrid.getCellIndex(td);
+				ts.p.ondblClickRow.call(ts,$(ptr).attr("id"),ri,ci, e);
+				return false;
+			});
+		}
+		if ($.isFunction(this.p.onRightClickRow)) {
+			$(this).bind('contextmenu', function(e) {
+				td = e.target;
+				ptr = $(td,ts.rows).closest("tr.jqgrow");
+				if($(ptr).length === 0 ){return false;}
+				if(!ts.p.multiselect) {	$(ts).jqGrid("setSelection",ptr[0].id,true);	}
+				ri = ptr[0].rowIndex;
+				ci = $.jgrid.getCellIndex(td);
+				ts.p.onRightClickRow.call(ts,$(ptr).attr("id"),ri,ci, e);
+				return false;
+			});
+		}
+		grid.bDiv = document.createElement("div");
+		if(isMSIE) { if(String(ts.p.height).toLowerCase() === "auto") { ts.p.height = "100%"; } }
+		$(grid.bDiv)
+			.append($('<div style="position:relative;'+(isMSIE && $.browser.version < 8 ? "height:0.01%;" : "")+'"></div>').append('<div></div>').append(this))
+			.addClass("ui-jqgrid-bdiv")
+			.css({ height: ts.p.height+(isNaN(ts.p.height)?"":"px"), width: (grid.width)+"px"})
+			.scroll(grid.scrollGrid);
+		$("table:first",grid.bDiv).css({width:ts.p.tblwidth+"px"});
+		if( isMSIE ) {
+			if( $("tbody",this).size() == 2 ) { $("tbody:gt(0)",this).remove();}
+			if( ts.p.multikey) {$(grid.bDiv).bind("selectstart",function(){return false;});}
+		} else {
+			if( ts.p.multikey) {$(grid.bDiv).bind("mousedown",function(){return false;});}
+		}
+		if(hg) {$(grid.bDiv).hide();}
+		grid.cDiv = document.createElement("div");
+		var arf = ts.p.hidegrid===true ? $("<a role='link' href='javascript:void(0)'/>").addClass('ui-jqgrid-titlebar-close HeaderButton').hover(
+			function(){ arf.addClass('ui-state-hover');},
+			function() {arf.removeClass('ui-state-hover');})
+		.append("<span class='ui-icon ui-icon-circle-triangle-n'></span>").css((dir=="rtl"?"left":"right"),"0px") : "";
+		$(grid.cDiv).append(arf).append("<span class='ui-jqgrid-title"+(dir=="rtl" ? "-rtl" :"" )+"'>"+ts.p.caption+"</span>")
+		.addClass("ui-jqgrid-titlebar ui-widget-header ui-corner-top ui-helper-clearfix");
+		$(grid.cDiv).insertBefore(grid.hDiv);
+		if( ts.p.toolbar[0] ) {
+			grid.uDiv = document.createElement("div");
+			if(ts.p.toolbar[1] == "top") {$(grid.uDiv).insertBefore(grid.hDiv);}
+			else if (ts.p.toolbar[1]=="bottom" ) {$(grid.uDiv).insertAfter(grid.hDiv);}
+			if(ts.p.toolbar[1]=="both") {
+				grid.ubDiv = document.createElement("div");
+				$(grid.uDiv).insertBefore(grid.hDiv).addClass("ui-userdata ui-state-default").attr("id","t_"+this.id);
+				$(grid.ubDiv).insertAfter(grid.hDiv).addClass("ui-userdata ui-state-default").attr("id","tb_"+this.id);
+				if(hg)  {$(grid.ubDiv).hide();}
+			} else {
+				$(grid.uDiv).width(grid.width).addClass("ui-userdata ui-state-default").attr("id","t_"+this.id);
+			}
+			if(hg) {$(grid.uDiv).hide();}
+		}
+		if(ts.p.toppager) {
+			ts.p.toppager = $.jgrid.jqID(ts.p.id)+"_toppager";
+			grid.topDiv = $("<div id='"+ts.p.toppager+"'></div>")[0];
+			ts.p.toppager = "#"+ts.p.toppager;
+			$(grid.topDiv).insertBefore(grid.hDiv).addClass('ui-state-default ui-jqgrid-toppager').width(grid.width);
+			setPager(ts.p.toppager,'_t');
+		}
+		if(ts.p.footerrow) {
+			grid.sDiv = $("<div class='ui-jqgrid-sdiv'></div>")[0];
+			hb = $("<div class='ui-jqgrid-hbox"+(dir=="rtl"?"-rtl":"")+"'></div>");
+			$(grid.sDiv).append(hb).insertAfter(grid.hDiv).width(grid.width);
+			$(hb).append(tfoot);
+			grid.footers = $(".ui-jqgrid-ftable",grid.sDiv)[0].rows[0].cells;
+			if(ts.p.rownumbers) { grid.footers[0].className = 'ui-state-default jqgrid-rownum'; }
+			if(hg) {$(grid.sDiv).hide();}
+		}
+		hb = null;
+		if(ts.p.caption) {
+			var tdt = ts.p.datatype;
+			if(ts.p.hidegrid===true) {
+				$(".ui-jqgrid-titlebar-close",grid.cDiv).click( function(e){
+					var onHdCl = $.isFunction(ts.p.onHeaderClick),
+					elems = ".ui-jqgrid-bdiv, .ui-jqgrid-hdiv, .ui-jqgrid-pager, .ui-jqgrid-sdiv",
+					counter, self = this;
+					if(ts.p.toolbar[0]===true) {
+						if( ts.p.toolbar[1]=='both') {
+							elems += ', #' + $(grid.ubDiv).attr('id');
+						}
+						elems += ', #' + $(grid.uDiv).attr('id');
+					}
+					counter = $(elems,"#gview_"+$.jgrid.jqID(ts.p.id)).length;
+
+					if(ts.p.gridstate == 'visible') {
+						$(elems,"#gbox_"+$.jgrid.jqID(ts.p.id)).slideUp("fast", function() {
+							counter--;
+							if (counter === 0) {
+								$("span",self).removeClass("ui-icon-circle-triangle-n").addClass("ui-icon-circle-triangle-s");
+								ts.p.gridstate = 'hidden';
+								if($("#gbox_"+$.jgrid.jqID(ts.p.id)).hasClass("ui-resizable")) { $(".ui-resizable-handle","#gbox_"+$.jgrid.jqID(ts.p.id)).hide(); }
+								if(onHdCl) {if(!hg) {ts.p.onHeaderClick.call(ts,ts.p.gridstate,e);}}
+							}
+						});
+					} else if(ts.p.gridstate == 'hidden'){
+						$(elems,"#gbox_"+$.jgrid.jqID(ts.p.id)).slideDown("fast", function() {
+							counter--;
+							if (counter === 0) {
+								$("span",self).removeClass("ui-icon-circle-triangle-s").addClass("ui-icon-circle-triangle-n");
+								if(hg) {ts.p.datatype = tdt;populate();hg=false;}
+								ts.p.gridstate = 'visible';
+								if($("#gbox_"+$.jgrid.jqID(ts.p.id)).hasClass("ui-resizable")) { $(".ui-resizable-handle","#gbox_"+$.jgrid.jqID(ts.p.id)).show(); }
+								if(onHdCl) {if(!hg) {ts.p.onHeaderClick.call(ts,ts.p.gridstate,e);}}
+							}
+						});
+					}
+					return false;
+				});
+				if(hg) {ts.p.datatype="local"; $(".ui-jqgrid-titlebar-close",grid.cDiv).trigger("click");}
+			}
+		} else {$(grid.cDiv).hide();}
+		$(grid.hDiv).after(grid.bDiv)
+		.mousemove(function (e) {
+			if(grid.resizing){grid.dragMove(e);return false;}
+		});
+		$(".ui-jqgrid-labels",grid.hDiv).bind("selectstart", function () { return false; });
+		$(document).mouseup(function (e) {
+			if(grid.resizing) {	grid.dragEnd(); return false;}
+			return true;
+		});
+		ts.formatCol = formatCol;
+		ts.sortData = sortData;
+		ts.updatepager = updatepager;
+		ts.refreshIndex = refreshIndex;
+		ts.formatter = function ( rowId, cellval , colpos, rwdat, act){return formatter(rowId, cellval , colpos, rwdat, act);};
+		$.extend(grid,{populate : populate, emptyRows: emptyRows});
+		this.grid = grid;
+		ts.addXmlData = function(d) {addXmlData(d,ts.grid.bDiv);};
+		ts.addJSONData = function(d) {addJSONData(d,ts.grid.bDiv);};
+		this.grid.cols = this.rows[0].cells;
+
+		populate();ts.p.hiddengrid=false;
+		$(window).unload(function () {
+			ts = null;
+		});
+	});
+};
+$.jgrid.extend({
+	getGridParam : function(pName) {
+		var $t = this[0];
+		if (!$t || !$t.grid) {return;}
+		if (!pName) { return $t.p; }
+		else {return typeof($t.p[pName]) != "undefined" ? $t.p[pName] : null;}
+	},
+	setGridParam : function (newParams){
+		return this.each(function(){
+			if (this.grid && typeof(newParams) === 'object') {$.extend(true,this.p,newParams);}
+		});
+	},
+	getDataIDs : function () {
+		var ids=[], i=0, len, j=0;
+		this.each(function(){
+			len = this.rows.length;
+			if(len && len>0){
+				while(i<len) {
+					if($(this.rows[i]).hasClass('jqgrow')) {
+						ids[j] = this.rows[i].id;
+						j++;
+					}
+					i++;
+				}
+			}
+		});
+		return ids;
+	},
+	setSelection : function(selection,onsr) {
+		return this.each(function(){
+			var $t = this, stat,pt, ner, ia, tpsr;
+			if(selection === undefined) { return; }
+			onsr = onsr === false ? false : true;
+			pt=$t.rows.namedItem(selection+"");
+			if(!pt || pt.className.indexOf( 'ui-state-disabled' ) > -1 ) { return; }
+			function scrGrid(iR){
+				var ch = $($t.grid.bDiv)[0].clientHeight,
+				st = $($t.grid.bDiv)[0].scrollTop,
+				rpos = $t.rows[iR].offsetTop,
+				rh = $t.rows[iR].clientHeight;
+				if(rpos+rh >= ch+st) { $($t.grid.bDiv)[0].scrollTop = rpos-(ch+st)+rh+st; }
+				else if(rpos < ch+st) {
+					if(rpos < st) {
+						$($t.grid.bDiv)[0].scrollTop = rpos;
+					}
+				}
+			}
+			if($t.p.scrollrows===true) {
+				ner = $t.rows.namedItem(selection).rowIndex;
+				if(ner >=0 ){
+					scrGrid(ner);
+				}
+			}
+			if(!$t.p.multiselect) {	
+				if(pt.className !== "ui-subgrid") {
+					if( $t.p.selrow != pt.id) {
+						$($t.rows.namedItem($t.p.selrow)).removeClass("ui-state-highlight").attr({"aria-selected":"false", "tabindex" : "-1"});
+						$(pt).addClass("ui-state-highlight").attr({"aria-selected":"true", "tabindex" : "0"});//.focus();
+						stat = true;
+					} else {
+						stat = false;
+					}
+					$t.p.selrow = pt.id;
+					if( $t.p.onSelectRow && onsr) { $t.p.onSelectRow.call($t, pt.id, stat); }
+				}
+			} else {
+				//unselect selectall checkbox when deselecting a specific row
+				$("#cb_" + $.jgrid.jqID($t.p.id), $t.grid.hDiv)[$t.p.useProp ? 'prop' : 'attr']("checked", false);
+				$t.p.selrow = pt.id;
+				ia = $.inArray($t.p.selrow,$t.p.selarrrow);
+				if (  ia === -1 ){
+					if(pt.className !== "ui-subgrid") { $(pt).addClass("ui-state-highlight").attr("aria-selected","true");}
+					stat = true;
+					$("#jqg_"+$.jgrid.jqID($t.p.id)+"_"+$.jgrid.jqID($t.p.selrow))[$t.p.useProp ? 'prop': 'attr']("checked",stat);
+					$t.p.selarrrow.push($t.p.selrow);
+				} else {
+					if(pt.className !== "ui-subgrid") { $(pt).removeClass("ui-state-highlight").attr("aria-selected","false");}
+					stat = false;
+					$("#jqg_"+$.jgrid.jqID($t.p.id)+"_"+$.jgrid.jqID($t.p.selrow))[$t.p.useProp ? 'prop': 'attr']("checked",stat);
+					$t.p.selarrrow.splice(ia,1);
+					tpsr = $t.p.selarrrow[0];
+					$t.p.selrow = (tpsr === undefined) ? null : tpsr;
+				}
+				if( $t.p.onSelectRow && onsr) { $t.p.onSelectRow.call($t, pt.id , stat); }
+			}
+		});
+	},
+	resetSelection : function( rowid ){
+		return this.each(function(){
+			var t = this, ind, sr;
+			if(typeof(rowid) !== "undefined" ) {
+				sr = rowid === t.p.selrow ? t.p.selrow : rowid;
+				$("#"+$.jgrid.jqID(t.p.id)+" tbody:first tr#"+$.jgrid.jqID(sr)).removeClass("ui-state-highlight").attr("aria-selected","false");
+				if(t.p.multiselect) {
+					$("#jqg_"+$.jgrid.jqID(t.p.id)+"_"+$.jgrid.jqID(sr))[t.p.useProp ? 'prop': 'attr']("checked",false);
+					$("#cb_"+$.jgrid.jqID(t.p.id))[t.p.useProp ? 'prop': 'attr']("checked",false );
+				}
+				sr = null;
+			} else if(!t.p.multiselect) {
+				if(t.p.selrow) {
+					$("#"+$.jgrid.jqID(t.p.id)+" tbody:first tr#"+$.jgrid.jqID(t.p.selrow)).removeClass("ui-state-highlight").attr("aria-selected","false");
+					t.p.selrow = null;
+				}
+			} else {
+				$(t.p.selarrrow).each(function(i,n){
+					ind = t.rows.namedItem(n);
+					$(ind).removeClass("ui-state-highlight").attr("aria-selected","false");
+					$("#jqg_"+$.jgrid.jqID(t.p.id)+"_"+$.jgrid.jqID(n))[t.p.useProp ? 'prop': 'attr']("checked",false);
+				});
+				$("#cb_"+$.jgrid.jqID(t.p.id))[t.p.useProp ? 'prop': 'attr']("checked",false);
+				t.p.selarrrow = [];
+			}
+			if(t.p.cellEdit === true) {
+				if(parseInt(t.p.iCol,10)>=0  && parseInt(t.p.iRow,10)>=0) {
+					$("td:eq("+t.p.iCol+")",t.rows[t.p.iRow]).removeClass("edit-cell ui-state-highlight");
+					$(t.rows[t.p.iRow]).removeClass("selected-row ui-state-hover");
+				}
+			}
+			t.p.savedRow = [];
+		});
+	},
+	getRowData : function( rowid ) {
+		var res = {}, resall, getall=false, len, j=0;
+		this.each(function(){
+			var $t = this,nm,ind;
+			if(typeof(rowid) == 'undefined') {
+				getall = true;
+				resall = [];
+				len = $t.rows.length;
+			} else {
+				ind = $t.rows.namedItem(rowid);
+				if(!ind) { return res; }
+				len = 2;
+			}
+			while(j<len){
+				if(getall) { ind = $t.rows[j]; }
+				if( $(ind).hasClass('jqgrow') ) {
+					$('td',ind).each( function(i) {
+						nm = $t.p.colModel[i].name;
+						if ( nm !== 'cb' && nm !== 'subgrid' && nm !== 'rn') {
+							if($t.p.treeGrid===true && nm == $t.p.ExpandColumn) {
+								res[nm] = $.jgrid.htmlDecode($("span:first",this).html());
+							} else {
+								try {
+									res[nm] = $.unformat(this,{rowId:ind.id, colModel:$t.p.colModel[i]},i);
+								} catch (e){
+									res[nm] = $.jgrid.htmlDecode($(this).html());
+								}
+							}
+						}
+					});
+					if(getall) { resall.push(res); res={}; }
+				}
+				j++;
+			}
+		});
+		return resall ? resall: res;
+	},
+	delRowData : function(rowid) {
+		var success = false, rowInd, ia, ri;
+		this.each(function() {
+			var $t = this;
+			rowInd = $t.rows.namedItem(rowid);
+			if(!rowInd) {return false;}
+			else {
+				ri = rowInd.rowIndex;
+				$(rowInd).remove();
+				$t.p.records--;
+				$t.p.reccount--;
+				$t.updatepager(true,false);
+				success=true;
+				if($t.p.multiselect) {
+					ia = $.inArray(rowid,$t.p.selarrrow);
+					if(ia != -1) { $t.p.selarrrow.splice(ia,1);}
+				}
+				if(rowid == $t.p.selrow) {$t.p.selrow=null;}
+			}
+			if($t.p.datatype == 'local') {
+				var pos = $t.p._index[rowid];
+				if(typeof(pos) != 'undefined') {
+					$t.p.data.splice(pos,1);
+					$t.refreshIndex();
+				}
+			}
+			if( $t.p.altRows === true && success ) {
+				var cn = $t.p.altclass;
+				$($t.rows).each(function(i){
+					if(i % 2 ==1) { $(this).addClass(cn); }
+					else { $(this).removeClass(cn); }
+				});
+			}
+		});
+		return success;
+	},
+	setRowData : function(rowid, data, cssp) {
+		var nm, success=true, title;
+		this.each(function(){
+			if(!this.grid) {return false;}
+			var t = this, vl, ind, cp = typeof cssp, lcdata={};
+			ind = t.rows.namedItem(rowid);
+			if(!ind) { return false; }
+			if( data ) {
+				try {
+					$(this.p.colModel).each(function(i){
+						nm = this.name;
+						if( data[nm] !== undefined) {
+							lcdata[nm] = this.formatter && typeof(this.formatter) === 'string' && this.formatter == 'date' ? $.unformat.date(data[nm],this) : data[nm];
+							vl = t.formatter( rowid, data[nm], i, data, 'edit');
+							title = this.title ? {"title":$.jgrid.stripHtml(vl)} : {};
+							if(t.p.treeGrid===true && nm == t.p.ExpandColumn) {
+								$("td:eq("+i+") > span:first",ind).html(vl).attr(title);
+							} else {
+								$("td:eq("+i+")",ind).html(vl).attr(title);
+							}
+						}
+					});
+					if(t.p.datatype == 'local') {
+						var pos = t.p._index[rowid];
+						if(t.p.treeGrid) {
+							for(var key in t.p.treeReader ){
+								if(lcdata.hasOwnProperty(t.p.treeReader[key])) {
+									delete lcdata[t.p.treeReader[key]];
+								}
+						}
+						}
+						if(typeof(pos) != 'undefined') {
+							t.p.data[pos] = $.extend(true, t.p.data[pos], lcdata);
+						}
+						lcdata = null;
+					}
+				} catch (e) {
+					success = false;
+				}
+			}
+			if(success) {
+				if(cp === 'string') {$(ind).addClass(cssp);} else if(cp === 'object') {$(ind).css(cssp);}
+			}
+		});
+		return success;
+	},
+	addRowData : function(rowid,rdata,pos,src) {
+		if(!pos) {pos = "last";}
+		var success = false, nm, row, gi, si, ni,sind, i, v, prp="", aradd, cnm, cn, data, cm;
+		if(rdata) {
+			if($.isArray(rdata)) {
+				aradd=true;
+				pos = "last";
+				cnm = rowid;
+			} else {
+				rdata = [rdata];
+				aradd = false;
+			}
+			this.each(function() {
+				var t = this, datalen = rdata.length;
+				ni = t.p.rownumbers===true ? 1 :0;
+				gi = t.p.multiselect ===true ? 1 :0;
+				si = t.p.subGrid===true ? 1 :0;
+				if(!aradd) {
+					if(typeof(rowid) != 'undefined') { rowid = rowid+"";}
+					else {
+						rowid = $.jgrid.randId();
+						if(t.p.keyIndex !== false) {
+							cnm = t.p.colModel[t.p.keyIndex+gi+si+ni].name;
+							if(typeof rdata[0][cnm] != "undefined") { rowid = rdata[0][cnm]; }
+						}
+					}
+				}
+				cn = t.p.altclass;
+				var k = 0, cna ="", lcdata = {},
+				air = $.isFunction(t.p.afterInsertRow) ? true : false;
+				while(k < datalen) {
+					data = rdata[k];
+					row="";
+					if(aradd) {
+						try {rowid = data[cnm];}
+						catch (e) {rowid = $.jgrid.randId();}
+						cna = t.p.altRows === true ?  (t.rows.length-1)%2 === 0 ? cn : "" : "";
+					}
+					rowid  = t.p.idPrefix + rowid;
+					if(ni){
+						prp = t.formatCol(0,1,'',null,rowid, true);
+						row += "<td role=\"gridcell\" aria-describedby=\""+t.p.id+"_rn\" class=\"ui-state-default jqgrid-rownum\" "+prp+">0</td>";
+					}
+					if(gi) {
+						v = "<input role=\"checkbox\" type=\"checkbox\""+" id=\"jqg_"+t.p.id+"_"+rowid+"\" class=\"cbox\"/>";
+						prp = t.formatCol(ni,1,'', null, rowid, true);
+						row += "<td role=\"gridcell\" aria-describedby=\""+t.p.id+"_cb\" "+prp+">"+v+"</td>";
+					}
+					if(si) {
+						row += $(t).jqGrid("addSubGridCell",gi+ni,1);
+					}
+					for(i = gi+si+ni; i < t.p.colModel.length;i++){
+						cm = t.p.colModel[i];
+						nm = cm.name;
+						lcdata[nm] = cm.formatter && typeof(cm.formatter) === 'string' && cm.formatter == 'date' ? $.unformat.date(data[nm],cm) : data[nm];
+						v = t.formatter( rowid, $.jgrid.getAccessor(data,nm), i, data, 'edit');
+						prp = t.formatCol(i,1,v, data, rowid, true);
+						row += "<td role=\"gridcell\" aria-describedby=\""+t.p.id+"_"+nm+"\" "+prp+">"+v+"</td>";
+					}
+					row = "<tr id=\""+rowid+"\" role=\"row\" tabindex=\"-1\" class=\"ui-widget-content jqgrow ui-row-"+t.p.direction+" "+cna+"\">" + row+"</tr>";
+					if(t.rows.length === 0){
+						$("table:first",t.grid.bDiv).append(row);
+					} else {
+					switch (pos) {
+						case 'last':
+							$(t.rows[t.rows.length-1]).after(row);
+							sind = t.rows.length-1;
+							break;
+						case 'first':
+							$(t.rows[0]).after(row);
+							sind = 1;
+							break;
+						case 'after':
+							sind = t.rows.namedItem(src);
+							if (sind) {
+								if($(t.rows[sind.rowIndex+1]).hasClass("ui-subgrid")) { $(t.rows[sind.rowIndex+1]).after(row); }
+								else { $(sind).after(row); }
+							}
+							sind++;
+							break;
+						case 'before':
+							sind = t.rows.namedItem(src);
+							if(sind) {$(sind).before(row);sind=sind.rowIndex;}
+							sind--;
+							break;
+					}
+					}
+					if(t.p.subGrid===true) {
+						$(t).jqGrid("addSubGrid",gi+ni, sind);
+					}
+					t.p.records++;
+					t.p.reccount++;
+					if(air) { t.p.afterInsertRow.call(t,rowid,data,data); }
+					k++;
+					if(t.p.datatype == 'local') {
+						lcdata[t.p.localReader.id] = rowid;
+						t.p._index[rowid] = t.p.data.length;
+						t.p.data.push(lcdata);
+						lcdata = {};
+					}
+				}
+				if( t.p.altRows === true && !aradd) {
+					if (pos == "last") {
+						if ((t.rows.length-1)%2 == 1)  {$(t.rows[t.rows.length-1]).addClass(cn);}
+					} else {
+						$(t.rows).each(function(i){
+							if(i % 2 ==1) { $(this).addClass(cn); }
+							else { $(this).removeClass(cn); }
+						});
+					}
+				}
+				t.updatepager(true,true);
+				success = true;
+			});
+		}
+		return success;
+	},
+	footerData : function(action,data, format) {
+		var nm, success=false, res={}, title;
+		function isEmpty(obj) {
+			for(var i in obj) {
+				if (obj.hasOwnProperty(i)) { return false; }
+			}
+			return true;
+		}
+		if(typeof(action) == "undefined") { action = "get"; }
+		if(typeof(format) != "boolean") { format  = true; }
+		action = action.toLowerCase();
+		this.each(function(){
+			var t = this, vl;
+			if(!t.grid || !t.p.footerrow) {return false;}
+			if(action == "set") { if(isEmpty(data)) { return false; } }
+			success=true;
+			$(this.p.colModel).each(function(i){
+				nm = this.name;
+				if(action == "set") {
+					if( data[nm] !== undefined) {
+						vl = format ? t.formatter( "", data[nm], i, data, 'edit') : data[nm];
+						title = this.title ? {"title":$.jgrid.stripHtml(vl)} : {};
+						$("tr.footrow td:eq("+i+")",t.grid.sDiv).html(vl).attr(title);
+						success = true;
+					}
+				} else if(action == "get") {
+					res[nm] = $("tr.footrow td:eq("+i+")",t.grid.sDiv).html();
+				}
+			});
+		});
+		return action == "get" ? res : success;
+	},
+	showHideCol : function(colname,show) {
+		return this.each(function() {
+			var $t = this, fndh=false, brd=$.browser.webkit||$.browser.safari? 0: $t.p.cellLayout, cw;
+			if (!$t.grid ) {return;}
+			if( typeof colname === 'string') {colname=[colname];}
+			show = show != "none" ? "" : "none";
+			var sw = show === "" ? true :false,
+			gh = $t.p.groupHeader && (typeof $t.p.groupHeader === 'object' || $.isFunction($t.p.groupHeader) );
+			if(gh) { $($t).jqGrid('destroyGroupHeader', false); }
+			$(this.p.colModel).each(function(i) {
+				if ($.inArray(this.name,colname) !== -1 && this.hidden === sw) {
+					$("tr",$t.grid.hDiv).each(function(){
+						$(this.cells[i]).css("display", show);
+					});
+					$($t.rows).each(function(j){
+						$(this.cells[i]).css("display", show);
+					});
+					if($t.p.footerrow) { $("tr.footrow td:eq("+i+")", $t.grid.sDiv).css("display", show); }
+					cw = this.widthOrg? this.widthOrg: parseInt(this.width,10);
+					if(show === "none") {$t.p.tblwidth -= cw+brd;} else {$t.p.tblwidth += cw+brd;}
+					this.hidden = !sw;
+					fndh=true;
+				}
+			});
+			if(fndh===true) {
+				$($t).jqGrid("setGridWidth",$t.p.shrinkToFit === true ? $t.p.tblwidth : $t.p.width );
+			}
+			if( gh )  {
+				$($t).jqGrid('setGroupHeaders',$t.p.groupHeader);
+			}
+		});
+	},
+	hideCol : function (colname) {
+		return this.each(function(){$(this).jqGrid("showHideCol",colname,"none");});
+	},
+	showCol : function(colname) {
+		return this.each(function(){$(this).jqGrid("showHideCol",colname,"");});
+	},
+	remapColumns : function(permutation, updateCells, keepHeader)
+	{
+		function resortArray(a) {
+			var ac;
+			if (a.length) {
+				ac = $.makeArray(a);
+			} else {
+				ac = $.extend({}, a);
+			}
+			$.each(permutation, function(i) {
+				a[i] = ac[this];
+			});
+		}
+		var ts = this.get(0);
+		function resortRows(parent, clobj) {
+			$(">tr"+(clobj||""), parent).each(function() {
+				var row = this;
+				var elems = $.makeArray(row.cells);
+				$.each(permutation, function() {
+					var e = elems[this];
+					if (e) {
+						row.appendChild(e);
+					}
+				});
+			});
+		}
+		resortArray(ts.p.colModel);
+		resortArray(ts.p.colNames);
+		resortArray(ts.grid.headers);
+		resortRows($("thead:first", ts.grid.hDiv), keepHeader && ":not(.ui-jqgrid-labels)");
+		if (updateCells) {
+			resortRows($("#"+$.jgrid.jqID(ts.p.id)+" tbody:first"), ".jqgfirstrow, tr.jqgrow, tr.jqfoot");
+		}
+		if (ts.p.footerrow) {
+			resortRows($("tbody:first", ts.grid.sDiv));
+		}
+		if (ts.p.remapColumns) {
+			if (!ts.p.remapColumns.length){
+				ts.p.remapColumns = $.makeArray(permutation);
+			} else {
+				resortArray(ts.p.remapColumns);
+			}
+		}
+		ts.p.lastsort = $.inArray(ts.p.lastsort, permutation);
+		if(ts.p.treeGrid) { ts.p.expColInd = $.inArray(ts.p.expColInd, permutation); }
+	},
+	setGridWidth : function(nwidth, shrink) {
+		return this.each(function(){
+			if (!this.grid ) {return;}
+			var $t = this, cw,
+			initwidth = 0, brd=$.browser.webkit||$.browser.safari? 0: $t.p.cellLayout, lvc, vc=0, hs=false, scw=$t.p.scrollOffset, aw, gw=0,
+			cl = 0,cr;
+			if(typeof shrink != 'boolean') {
+				shrink=$t.p.shrinkToFit;
+			}
+			if(isNaN(nwidth)) {return;}
+			else { nwidth = parseInt(nwidth,10); $t.grid.width = $t.p.width = nwidth;}
+			$("#gbox_"+$.jgrid.jqID($t.p.id)).css("width",nwidth+"px");
+			$("#gview_"+$.jgrid.jqID($t.p.id)).css("width",nwidth+"px");
+			$($t.grid.bDiv).css("width",nwidth+"px");
+			$($t.grid.hDiv).css("width",nwidth+"px");
+			if($t.p.pager ) {$($t.p.pager).css("width",nwidth+"px");}
+			if($t.p.toppager ) {$($t.p.toppager).css("width",nwidth+"px");}
+			if($t.p.toolbar[0] === true){
+				$($t.grid.uDiv).css("width",nwidth+"px");
+				if($t.p.toolbar[1]=="both") {$($t.grid.ubDiv).css("width",nwidth+"px");}
+			}
+			if($t.p.footerrow) { $($t.grid.sDiv).css("width",nwidth+"px"); }
+			if(shrink ===false && $t.p.forceFit === true) {$t.p.forceFit=false;}
+			if(shrink===true) {
+				$.each($t.p.colModel, function(i) {
+					if(this.hidden===false){
+						cw = this.widthOrg? this.widthOrg: parseInt(this.width,10);
+						initwidth += cw+brd;
+						if(this.fixed) {
+							gw += cw+brd;
+						} else {
+							vc++;
+						}
+						cl++;
+					}
+				});
+				if(vc  === 0) { return; }
+				$t.p.tblwidth = initwidth;
+				aw = nwidth-brd*vc-gw;
+				if(!isNaN($t.p.height)) {
+					if($($t.grid.bDiv)[0].clientHeight < $($t.grid.bDiv)[0].scrollHeight || $t.rows.length === 1){
+						hs = true;
+						aw -= scw;
+					}
+				}
+				initwidth =0;
+				var cle = $t.grid.cols.length >0;
+				$.each($t.p.colModel, function(i) {
+					if(this.hidden === false && !this.fixed){
+						cw = this.widthOrg? this.widthOrg: parseInt(this.width,10);
+						cw = Math.round(aw*cw/($t.p.tblwidth-brd*vc-gw));
+						if (cw < 0) { return; }
+						this.width =cw;
+						initwidth += cw;
+						$t.grid.headers[i].width=cw;
+						$t.grid.headers[i].el.style.width=cw+"px";
+						if($t.p.footerrow) { $t.grid.footers[i].style.width = cw+"px"; }
+						if(cle) { $t.grid.cols[i].style.width = cw+"px"; }
+						lvc = i;
+					}
+				});
+
+				if (!lvc) { return; }
+			    
+				cr =0;
+				if (hs) {
+					if(nwidth-gw-(initwidth+brd*vc) !== scw){
+						cr = nwidth-gw-(initwidth+brd*vc)-scw;
+					}
+				} else if( Math.abs(nwidth-gw-(initwidth+brd*vc)) !== 1) {
+					cr = nwidth-gw-(initwidth+brd*vc);
+				}
+				$t.p.colModel[lvc].width += cr;
+				$t.p.tblwidth = initwidth+cr+brd*vc+gw;
+				if($t.p.tblwidth > nwidth) {
+					var delta = $t.p.tblwidth - parseInt(nwidth,10);
+					$t.p.tblwidth = nwidth;
+					cw = $t.p.colModel[lvc].width = $t.p.colModel[lvc].width-delta;
+				} else {
+					cw= $t.p.colModel[lvc].width;
+				}
+				$t.grid.headers[lvc].width = cw;
+				$t.grid.headers[lvc].el.style.width=cw+"px";
+				if(cle) { $t.grid.cols[lvc].style.width = cw+"px"; }
+				if($t.p.footerrow) {
+					$t.grid.footers[lvc].style.width = cw+"px";
+				}
+			}
+			if($t.p.tblwidth) {
+				$('table:first',$t.grid.bDiv).css("width",$t.p.tblwidth+"px");
+				$('table:first',$t.grid.hDiv).css("width",$t.p.tblwidth+"px");
+				$t.grid.hDiv.scrollLeft = $t.grid.bDiv.scrollLeft;
+				if($t.p.footerrow) {
+					$('table:first',$t.grid.sDiv).css("width",$t.p.tblwidth+"px");
+				}
+			}
+		});
+	},
+	setGridHeight : function (nh) {
+		return this.each(function (){
+			var $t = this;
+			if(!$t.grid) {return;}
+			$($t.grid.bDiv).css({height: nh+(isNaN(nh)?"":"px")});
+			$t.p.height = nh;
+			if ($t.p.scroll) { $t.grid.populateVisible(); }
+		});
+	},
+	setCaption : function (newcap){
+		return this.each(function(){
+			this.p.caption=newcap;
+			$("span.ui-jqgrid-title",this.grid.cDiv).html(newcap);
+			$(this.grid.cDiv).show();
+		});
+	},
+	setLabel : function(colname, nData, prop, attrp ){
+		return this.each(function(){
+			var $t = this, pos=-1;
+			if(!$t.grid) {return;}
+			if(typeof(colname) != "undefined") {
+				$($t.p.colModel).each(function(i){
+					if (this.name == colname) {
+						pos = i;return false;
+					}
+				});
+			} else { return; }
+			if(pos>=0) {
+				var thecol = $("tr.ui-jqgrid-labels th:eq("+pos+")",$t.grid.hDiv);
+				if (nData){
+					var ico = $(".s-ico",thecol);
+					$("[id^=jqgh_]",thecol).empty().html(nData).append(ico);
+					$t.p.colNames[pos] = nData;
+				}
+				if (prop) {
+					if(typeof prop === 'string') {$(thecol).addClass(prop);} else {$(thecol).css(prop);}
+				}
+				if(typeof attrp === 'object') {$(thecol).attr(attrp);}
+			}
+		});
+	},
+	setCell : function(rowid,colname,nData,cssp,attrp, forceupd) {
+		return this.each(function(){
+			var $t = this, pos =-1,v, title;
+			if(!$t.grid) {return;}
+			if(isNaN(colname)) {
+				$($t.p.colModel).each(function(i){
+					if (this.name == colname) {
+						pos = i;return false;
+					}
+				});
+			} else {pos = parseInt(colname,10);}
+			if(pos>=0) {
+				var ind = $t.rows.namedItem(rowid);
+				if (ind){
+					var tcell = $("td:eq("+pos+")",ind);
+					if(nData !== "" || forceupd === true) {
+						v = $t.formatter(rowid, nData, pos,ind,'edit');
+						title = $t.p.colModel[pos].title ? {"title":$.jgrid.stripHtml(v)} : {};
+						if($t.p.treeGrid && $(".tree-wrap",$(tcell)).length>0) {
+							$("span",$(tcell)).html(v).attr(title);
+						} else {
+							$(tcell).html(v).attr(title);
+						}
+						if($t.p.datatype == "local") {
+							var cm = $t.p.colModel[pos], index;
+							nData = cm.formatter && typeof(cm.formatter) === 'string' && cm.formatter == 'date' ? $.unformat.date(nData,cm) : nData;
+							index = $t.p._index[rowid];
+							if(typeof index  != "undefined") {
+								$t.p.data[index][cm.name] = nData;
+							}
+						}
+					}
+					if(typeof cssp === 'string'){
+						$(tcell).addClass(cssp);
+					} else if(cssp) {
+						$(tcell).css(cssp);
+					}
+					if(typeof attrp === 'object') {$(tcell).attr(attrp);}
+				}
+			}
+		});
+	},
+	getCell : function(rowid,col) {
+		var ret = false;
+		this.each(function(){
+			var $t=this, pos=-1;
+			if(!$t.grid) {return;}
+			if(isNaN(col)) {
+				$($t.p.colModel).each(function(i){
+					if (this.name === col) {
+						pos = i;return false;
+					}
+				});
+			} else {pos = parseInt(col,10);}
+			if(pos>=0) {
+				var ind = $t.rows.namedItem(rowid);
+				if(ind) {
+					try {
+						ret = $.unformat($("td:eq("+pos+")",ind),{rowId:ind.id, colModel:$t.p.colModel[pos]},pos);
+					} catch (e){
+						ret = $.jgrid.htmlDecode($("td:eq("+pos+")",ind).html());
+					}
+				}
+			}
+		});
+		return ret;
+	},
+	getCol : function (col, obj, mathopr) {
+		var ret = [], val, sum=0, min=0, max=0, v;
+		obj = typeof (obj) != 'boolean' ? false : obj;
+		if(typeof mathopr == 'undefined') { mathopr = false; }
+		this.each(function(){
+			var $t=this, pos=-1;
+			if(!$t.grid) {return;}
+			if(isNaN(col)) {
+				$($t.p.colModel).each(function(i){
+					if (this.name === col) {
+						pos = i;return false;
+					}
+				});
+			} else {pos = parseInt(col,10);}
+			if(pos>=0) {
+				var ln = $t.rows.length, i =0;
+				if (ln && ln>0){
+					while(i<ln){
+						if($($t.rows[i]).hasClass('jqgrow')) {
+							try {
+								val = $.unformat($($t.rows[i].cells[pos]),{rowId:$t.rows[i].id, colModel:$t.p.colModel[pos]},pos);
+							} catch (e) {
+								val = $.jgrid.htmlDecode($t.rows[i].cells[pos].innerHTML);
+							}
+							if(mathopr) {
+								v = parseFloat(val);
+								sum += v;
+								min = Math.min(min, v);
+								max = Math.max(max, v);
+							}
+							else if(obj) { ret.push( {id:$t.rows[i].id,value:val} ); }
+							else { ret.push( val ); }
+						}
+						i++;
+					}
+					if(mathopr) {
+						switch(mathopr.toLowerCase()){
+							case 'sum': ret =sum; break;
+							case 'avg': ret = sum/ln; break;
+							case 'count': ret = ln; break;
+							case 'min': ret = min; break;
+							case 'max': ret = max; break;
+						}
+					}
+				}
+			}
+		});
+		return ret;
+	},
+	clearGridData : function(clearfooter) {
+		return this.each(function(){
+			var $t = this;
+			if(!$t.grid) {return;}
+			if(typeof clearfooter != 'boolean') { clearfooter = false; }
+			if($t.p.deepempty) {$("#"+$.jgrid.jqID($t.p.id)+" tbody:first tr:gt(0)").remove();}
+			else {
+				var trf = $("#"+$.jgrid.jqID($t.p.id)+" tbody:first tr:first")[0];
+				$("#"+$.jgrid.jqID($t.p.id)+" tbody:first").empty().append(trf);
+			}
+			if($t.p.footerrow && clearfooter) { $(".ui-jqgrid-ftable td",$t.grid.sDiv).html("&#160;"); }
+			$t.p.selrow = null; $t.p.selarrrow= []; $t.p.savedRow = [];
+			$t.p.records = 0;$t.p.page=1;$t.p.lastpage=0;$t.p.reccount=0;
+			$t.p.data = []; $t.p._index = {};
+			$t.updatepager(true,false);
+		});
+	},
+	getInd : function(rowid,rc){
+		var ret =false,rw;
+		this.each(function(){
+			rw = this.rows.namedItem(rowid);
+			if(rw) {
+				ret = rc===true ? rw: rw.rowIndex;
+			}
+		});
+		return ret;
+	},
+	bindKeys : function( settings ){
+		var o = $.extend({
+			onEnter: null,
+			onSpace: null,
+			onLeftKey: null,
+			onRightKey: null,
+			scrollingRows : true
+		},settings || {});
+		return this.each(function(){
+			var $t = this;
+			if( !$('body').is('[role]') ){$('body').attr('role','application');}
+			$t.p.scrollrows = o.scrollingRows;
+			$($t).keydown(function(event){
+				var target = $($t).find('tr[tabindex=0]')[0], id, r, mind,
+				expanded = $t.p.treeReader.expanded_field;
+				//check for arrow keys
+				if(target) {
+					mind = $t.p._index[target.id];
+					if(event.keyCode === 37 || event.keyCode === 38 || event.keyCode === 39 || event.keyCode === 40){
+						// up key
+						if(event.keyCode === 38 ){
+							r = target.previousSibling;
+							id = "";
+							if(r) {
+								if($(r).is(":hidden")) {
+									while(r) {
+										r = r.previousSibling;
+										if(!$(r).is(":hidden") && $(r).hasClass('jqgrow')) {id = r.id;break;}
+									}
+								} else {
+									id = r.id;
+								}
+							}
+							$($t).jqGrid('setSelection', id);
+						}
+						//if key is down arrow
+						if(event.keyCode === 40){
+							r = target.nextSibling;
+							id ="";
+							if(r) {
+								if($(r).is(":hidden")) {
+									while(r) {
+										r = r.nextSibling;
+										if(!$(r).is(":hidden") && $(r).hasClass('jqgrow') ) {id = r.id;break;}
+									}
+								} else {
+									id = r.id;
+								}
+							}
+							$($t).jqGrid('setSelection', id);
+						}
+						// left
+						if(event.keyCode === 37 ){
+							if($t.p.treeGrid && $t.p.data[mind][expanded]) {
+								$(target).find("div.treeclick").trigger('click');
+							}
+							if($.isFunction(o.onLeftKey)) {
+								o.onLeftKey.call($t, $t.p.selrow);
+						}
+						}
+						// right
+						if(event.keyCode === 39 ){
+							if($t.p.treeGrid && !$t.p.data[mind][expanded]) {
+								$(target).find("div.treeclick").trigger('click');
+							}
+							if($.isFunction(o.onRightKey)) {
+								o.onRightKey.call($t, $t.p.selrow);
+						}
+						}
+						//return false;
+					}
+					//check if enter was pressed on a grid or treegrid node
+					else if( event.keyCode === 13 ){
+						if($.isFunction(o.onEnter)) {
+							o.onEnter.call($t, $t.p.selrow);
+						}
+						//return false;
+					} else if(event.keyCode === 32) {
+						if($.isFunction(o.onSpace)) {
+							o.onSpace.call($t, $t.p.selrow);
+					    }
+						//return false;
+				    }
+				}
+			});
+		});
+	},
+	unbindKeys : function(){
+		return this.each(function(){
+			var $t = this;
+			$($t).unbind('keydown');
+		});
+	},
+	getLocalRow : function (rowid) {
+		var ret = false, ind;
+		this.each(function(){
+			if(typeof(rowid) !== "undefined") {
+				ind = this.p._index[rowid];
+				if(ind >= 0 ) {
+					ret = this.p.data[ind];
+	}
+			}
+});
+		return ret;
+	}
+});
+})(jQuery);
Index: controlies/trunk/applications/controlies/static/js/jdgrid/src/grid.custom.js
===================================================================
--- controlies/trunk/applications/controlies/static/js/jdgrid/src/grid.custom.js	(revision 240)
+++ controlies/trunk/applications/controlies/static/js/jdgrid/src/grid.custom.js	(revision 241)
@@ -1,816 +1,622 @@
-;(function($){
-/**
- * jqGrid extension for custom methods
- * Tony Tomov tony@trirand.com
- * http://trirand.com/blog/ 
- * Dual licensed under the MIT and GPL licenses:
- * http://www.opensource.org/licenses/mit-license.php
- * http://www.gnu.org/licenses/gpl-2.0.html
-**/ 
-$.jgrid.extend({
-	getColProp : function(colname){
-		var ret ={}, $t = this[0];
-		if ( !$t.grid ) { return; }
-		var cM = $t.p.colModel;
-		for ( var i =0;i<cM.length;i++ ) {
-			if ( cM[i].name == colname ) {
-				ret = cM[i];
-				break;
-			}
-		}
-		return ret;
-	},
-	setColProp : function(colname, obj){
-		//do not set width will not work
-		return this.each(function(){
-			if ( this.grid ) {
-				if ( obj ) {
-					var cM = this.p.colModel;
-					for ( var i =0;i<cM.length;i++ ) {
-						if ( cM[i].name == colname ) {
-							$.extend(this.p.colModel[i],obj);
-							break;
-						}
-					}
-				}
-			}
-		});
-	},
-	sortGrid : function(colname,reload, sor){
-		return this.each(function(){
-			var $t=this,idx=-1;
-			if ( !$t.grid ) { return;}
-			if ( !colname ) { colname = $t.p.sortname; }
-			for ( var i=0;i<$t.p.colModel.length;i++ ) {
-				if ( $t.p.colModel[i].index == colname || $t.p.colModel[i].name==colname ) {
-					idx = i;
-					break;
-				}
-			}
-			if ( idx!=-1 ){
-				var sort = $t.p.colModel[idx].sortable;
-				if ( typeof sort !== 'boolean' ) { sort =  true; }
-				if ( typeof reload !=='boolean' ) { reload = false; }
-				if ( sort ) { $t.sortData("jqgh_"+colname, idx, reload, sor); }
-			}
-		});
-	},
-	GridDestroy : function () {
-		return this.each(function(){
-			if ( this.grid ) { 
-				if ( this.p.pager ) { // if not part of grid
-					$(this.p.pager).remove();
-				}
-				var gid = this.id;
-				try {
-					$("#gbox_"+gid).remove();
-				} catch (_) {}
-			}
-		});
-	},
-	GridUnload : function(){
-		return this.each(function(){
-			if ( !this.grid ) {return;}
-			var defgrid = {id: $(this).attr('id'),cl: $(this).attr('class')};
-			if (this.p.pager) {
-				$(this.p.pager).empty().removeClass("ui-state-default ui-jqgrid-pager corner-bottom");
-			}
-			var newtable = document.createElement('table');
-			$(newtable).attr({id:defgrid.id});
-			newtable.className = defgrid.cl;
-			var gid = this.id;
-			$(newtable).removeClass("ui-jqgrid-btable");
-			if( $(this.p.pager).parents("#gbox_"+gid).length === 1 ) {
-				$(newtable).insertBefore("#gbox_"+gid).show();
-				$(this.p.pager).insertBefore("#gbox_"+gid);
-			} else {
-				$(newtable).insertBefore("#gbox_"+gid).show();
-			}
-			$("#gbox_"+gid).remove();
-		});
-	},
-    setGridState : function(state) {
-		return this.each(function(){
-			if ( !this.grid ) {return;}
-            var $t = this;
-            if(state == 'hidden'){
-				$(".ui-jqgrid-bdiv, .ui-jqgrid-hdiv","#gview_"+$t.p.id).slideUp("fast");
-				if($t.p.pager) {$($t.p.pager).slideUp("fast");}
-				if($t.p.toppager) {$($t.p.toppager).slideUp("fast");}
-				if($t.p.toolbar[0]===true) {
-					if( $t.p.toolbar[1]=='both') {
-						$($t.grid.ubDiv).slideUp("fast");
-					}
-					$($t.grid.uDiv).slideUp("fast");
-				}
-				if($t.p.footerrow) { $(".ui-jqgrid-sdiv","#gbox_"+$t.p.id).slideUp("fast"); }
-				$(".ui-jqgrid-titlebar-close span",$t.grid.cDiv).removeClass("ui-icon-circle-triangle-n").addClass("ui-icon-circle-triangle-s");
-				$t.p.gridstate = 'hidden';
-            } else if(state=='visible') {
-				$(".ui-jqgrid-hdiv, .ui-jqgrid-bdiv","#gview_"+$t.p.id).slideDown("fast");
-				if($t.p.pager) {$($t.p.pager).slideDown("fast");}
-				if($t.p.toppager) {$($t.p.toppager).slideDown("fast");}
-				if($t.p.toolbar[0]===true) {
-					if( $t.p.toolbar[1]=='both') {
-						$($t.grid.ubDiv).slideDown("fast");
-					}
-					$($t.grid.uDiv).slideDown("fast");
-				}
-				if($t.p.footerrow) { $(".ui-jqgrid-sdiv","#gbox_"+$t.p.id).slideDown("fast"); }
-				$(".ui-jqgrid-titlebar-close span",$t.grid.cDiv).removeClass("ui-icon-circle-triangle-s").addClass("ui-icon-circle-triangle-n");
-				$t.p.gridstate = 'visible';
-            }
-            
-        });
-    },
-	updateGridRows : function (data, rowidname, jsonreader) {
-		var nm, success=false, title;
-		this.each(function(){
-			var t = this, vl, ind, srow, sid;
-			if(!t.grid) {return false;}
-			if(!rowidname) { rowidname = "id"; }
-			if( data  && data.length >0 ) {
-				$(data).each(function(j){
-					srow = this;
-					ind = t.rows.namedItem(srow[rowidname]);
-					if(ind) {
-						sid = srow[rowidname];
-						if(jsonreader === true){
-							if(t.p.jsonReader.repeatitems === true) {
-								if(t.p.jsonReader.cell) {srow = srow[t.p.jsonReader.cell];}
-								for (var k=0;k<srow.length;k++) {
-									vl = t.formatter( sid, srow[k], k, srow, 'edit');
-									title = t.p.colModel[k].title ? {"title":$.jgrid.stripHtml(vl)} : {};
-									if(t.p.treeGrid===true && nm == t.p.ExpandColumn) {
-										$("td:eq("+k+") > span:first",ind).html(vl).attr(title);
-									} else {
-										$("td:eq("+k+")",ind).html(vl).attr(title); 
-									}
-								}
-								success = true;
-								return true;
-							}
-						} 
-						$(t.p.colModel).each(function(i){
-							nm = jsonreader===true ? this.jsonmap || this.name :this.name;
-							if( srow[nm] !== undefined) {
-								vl = t.formatter( sid, srow[nm], i, srow, 'edit');
-								title = this.title ? {"title":$.jgrid.stripHtml(vl)} : {};
-								if(t.p.treeGrid===true && nm == t.p.ExpandColumn) {
-									$("td:eq("+i+") > span:first",ind).html(vl).attr(title);
-								} else {
-									$("td:eq("+i+")",ind).html(vl).attr(title); 
-								}
-								success = true;
-							}
-						});
-					}
-				});
-			}
-		});
-		return success;
-	},
-	filterGrid : function(gridid,p){
-		p = $.extend({
-			gridModel : false,
-			gridNames : false,
-			gridToolbar : false,
-			filterModel: [], // label/name/stype/defval/surl/sopt
-			formtype : "horizontal", // horizontal/vertical
-			autosearch: true, // if set to false a serch button should be enabled.
-			formclass: "filterform",
-			tableclass: "filtertable",
-			buttonclass: "filterbutton",
-			searchButton: "Search",
-			clearButton: "Clear",
-			enableSearch : false,
-			enableClear: false,
-			beforeSearch: null,
-			afterSearch: null,
-			beforeClear: null,
-			afterClear: null,
-			url : '',
-			marksearched: true
-		},p  || {});
-		return this.each(function(){
-			var self = this;
-			this.p = p;
-			if(this.p.filterModel.length === 0 && this.p.gridModel===false) { alert("No filter is set"); return;}
-			if( !gridid) {alert("No target grid is set!"); return;}
-			this.p.gridid = gridid.indexOf("#") != -1 ? gridid : "#"+gridid;
-			var gcolMod = $(this.p.gridid).jqGrid("getGridParam",'colModel');
-			if(gcolMod) {
-				if( this.p.gridModel === true) {
-					var thegrid = $(this.p.gridid)[0];
-					var sh;
-					// we should use the options search, edittype, editoptions
-					// additionally surl and defval can be added in grid colModel
-					$.each(gcolMod, function (i,n) {
-						var tmpFil = [];
-						this.search = this.search === false ? false : true;
-						if(this.editrules && this.editrules.searchhidden === true) {
-							sh = true;
-						} else {
-							if(this.hidden === true ) {
-								sh = false;
-							} else {
-								sh = true;
-							}
-						}
-						if( this.search === true && sh === true) {
-							if(self.p.gridNames===true) {
-								tmpFil.label = thegrid.p.colNames[i];
-							} else {
-								tmpFil.label = '';
-							}
-							tmpFil.name = this.name;
-							tmpFil.index = this.index || this.name;
-							// we support only text and selects, so all other to text
-							tmpFil.stype = this.edittype || 'text';
-							if(tmpFil.stype != 'select' ) {
-								tmpFil.stype = 'text';
-							}
-							tmpFil.defval = this.defval || '';
-							tmpFil.surl = this.surl || '';
-							tmpFil.sopt = this.editoptions || {};
-							tmpFil.width = this.width;
-							self.p.filterModel.push(tmpFil);
-						}
-					});
-				} else {
-					$.each(self.p.filterModel,function(i,n) {
-						for(var j=0;j<gcolMod.length;j++) {
-							if(this.name == gcolMod[j].name) {
-								this.index = gcolMod[j].index || this.name;
-								break;
-							}
-						}
-						if(!this.index) {
-							this.index = this.name;
-						}
-					});
-				}
-			} else {
-				alert("Could not get grid colModel"); return;
-			}
-			var triggerSearch = function() {
-				var sdata={}, j=0, v;
-				var gr = $(self.p.gridid)[0], nm;
-                gr.p.searchdata = {};
-				if($.isFunction(self.p.beforeSearch)){self.p.beforeSearch();}
-				$.each(self.p.filterModel,function(i,n){
-                    nm = this.index;
-					switch (this.stype) {
-						case 'select' :
-							v = $("select[name="+nm+"]",self).val();
-							if(v) {
-								sdata[nm] = v;
-								if(self.p.marksearched){
-									$("#jqgh_"+this.name,gr.grid.hDiv).addClass("dirty-cell");
-								}
-								j++;
-							} else {
-								if(self.p.marksearched){
-									$("#jqgh_"+this.name,gr.grid.hDiv).removeClass("dirty-cell");
-								}
-                                try {
-                                    delete gr.p.postData[this.index];
-                                } catch (e) {}
-							}
-							break;
-						default:
-							v = $("input[name="+nm+"]",self).val();
-							if(v) {
-								sdata[nm] = v;
-								if(self.p.marksearched){
-									$("#jqgh_"+this.name,gr.grid.hDiv).addClass("dirty-cell");
-								}
-								j++;
-							} else {
-								if(self.p.marksearched){
-									$("#jqgh_"+this.name,gr.grid.hDiv).removeClass("dirty-cell");
-								}
-                                try {
-                                    delete gr.p.postData[this.index];
-                                } catch(e) {}
-							}
-					}
-				});
-				var sd =  j>0 ? true : false;
-                $.extend(gr.p.postData,sdata);
-				var saveurl;
-				if(self.p.url) {
-					saveurl = $(gr).jqGrid("getGridParam",'url');
-					$(gr).jqGrid("setGridParam",{url:self.p.url});
-				}
-			    $(gr).jqGrid("setGridParam",{search:sd}).trigger("reloadGrid",[{page:1}]);
-				if(saveurl) {$(gr).jqGrid("setGridParam",{url:saveurl});}
-				if($.isFunction(self.p.afterSearch)){self.p.afterSearch();}
-			};
-			var clearSearch = function(){
-				var sdata={}, v, j=0;
-				var gr = $(self.p.gridid)[0], nm;
-				if($.isFunction(self.p.beforeClear)){self.p.beforeClear();}
-				$.each(self.p.filterModel,function(i,n){
-                    nm = this.index;
-					v = (this.defval) ? this.defval : "";
-					if(!this.stype){this.stype='text';}
-					switch (this.stype) {
-						case 'select' :
-							var v1;
-							$("select[name="+nm+"] option",self).each(function (i){
-                                if(i===0) { this.selected = true; }
-								if ($(this).text() == v) {
-									this.selected = true;
-									v1 = $(this).val();
-									return false;
-								}
-							});
-							if(v1) {
-								// post the key and not the text
-								sdata[nm] = v1;
-								if(self.p.marksearched){
-									$("#jqgh_"+this.name,gr.grid.hDiv).addClass("dirty-cell");
-								}
-								j++;
-							} else {
-								if(self.p.marksearched){
-									$("#jqgh_"+this.name,gr.grid.hDiv).removeClass("dirty-cell");
-								}
-                                try {
-                                    delete gr.p.postData[this.index];
-                                } catch (e) {}
-							}
-							break;
-						case 'text':
-							$("input[name="+nm+"]",self).val(v);
-							if(v) {
-								sdata[nm] = v;
-								if(self.p.marksearched){
-									$("#jqgh_"+this.name,gr.grid.hDiv).addClass("dirty-cell");
-								}
-								j++;
-							} else {
-								if(self.p.marksearched){
-									$("#jqgh_"+this.name,gr.grid.hDiv).removeClass("dirty-cell");
-								}
-                                try {
-                                    delete gr.p.postData[this.index];
-                                } catch (e) {}
-							}
-                            break;
-					}
-				});
-				var sd =  j>0 ? true : false;
-                $.extend(gr.p.postData,sdata);
-				var saveurl;
-				if(self.p.url) {
-					saveurl = $(gr).jqGrid("getGridParam",'url');
-					$(gr).jqGrid("setGridParam",{url:self.p.url});
-				}
-				$(gr).jqGrid("setGridParam",{search:sd}).trigger("reloadGrid",[{page:1}]);
-				if(saveurl) {$(gr).jqGrid("setGridParam",{url:saveurl});}
-				if($.isFunction(self.p.afterClear)){self.p.afterClear();}
-			};
-			var formFill = function(){
-				var tr = document.createElement("tr");
-				var tr1, sb, cb,tl,td;
-				if(self.p.formtype=='horizontal'){
-					$(tbl).append(tr);
-				}
-				$.each(self.p.filterModel,function(i,n){
-					tl = document.createElement("td");
-					$(tl).append("<label for='"+this.name+"'>"+this.label+"</label>");
-					td = document.createElement("td");
-					var $t=this;
-					if(!this.stype) { this.stype='text';}
-					switch (this.stype)
-					{
-					case "select":
-						if(this.surl) {
-							// data returned should have already constructed html select
-							$(td).load(this.surl,function(){
-								if($t.defval) { $("select",this).val($t.defval); }
-								$("select",this).attr({name:$t.index || $t.name, id: "sg_"+$t.name});
-								if($t.sopt) { $("select",this).attr($t.sopt); }
-								if(self.p.gridToolbar===true && $t.width) {
-									$("select",this).width($t.width);
-								}
-								if(self.p.autosearch===true){
-									$("select",this).change(function(e){
-										triggerSearch();
-										return false;
-									});
-								}
-							});
-						} else {
-							// sopt to construct the values
-							if($t.sopt.value) {
-								var oSv = $t.sopt.value;
-								var elem = document.createElement("select");
-								$(elem).attr({name:$t.index || $t.name, id: "sg_"+$t.name}).attr($t.sopt);
-								var so, sv, ov;
-								if(typeof oSv === "string") {
-									so = oSv.split(";");
-									for(var k=0; k<so.length;k++){
-										sv = so[k].split(":");
-										ov = document.createElement("option");
-										ov.value = sv[0]; ov.innerHTML = sv[1];
-										if (sv[1]==$t.defval) { ov.selected ="selected"; }
-										elem.appendChild(ov);
-									}
-								} else if(typeof oSv === "object" ) {
-									for ( var key in oSv) {
-										if(oSv.hasOwnProperty(key)) {
-											i++;
-											ov = document.createElement("option");
-											ov.value = key; ov.innerHTML = oSv[key];
-											if (oSv[key]==$t.defval) { ov.selected ="selected"; }
-											elem.appendChild(ov);
-										}
-									}
-								}
-								if(self.p.gridToolbar===true && $t.width) {
-									$(elem).width($t.width);
-								}
-								$(td).append(elem);
-								if(self.p.autosearch===true){
-									$(elem).change(function(e){
-										triggerSearch();
-										return false;
-									});
-								}
-							}
-						}
-						break;
-					case 'text':
-						var df = this.defval ? this.defval: "";
-						$(td).append("<input type='text' name='"+(this.index || this.name)+"' id='sg_"+this.name+"' value='"+df+"'/>");
-						if($t.sopt) { $("input",td).attr($t.sopt); }
-						if(self.p.gridToolbar===true && $t.width) {
-							if($.browser.msie) {
-								$("input",td).width($t.width-4);
-							} else {
-								$("input",td).width($t.width-2);
-							}
-						}
-						if(self.p.autosearch===true){
-							$("input",td).keypress(function(e){
-								var key = e.charCode ? e.charCode : e.keyCode ? e.keyCode : 0;
-								if(key == 13){
-									triggerSearch();
-									return false;
-								}
-								return this;
-							});
-						}
-						break;
-					}
-					if(self.p.formtype=='horizontal'){
-						if(self.p.gridToolbar===true && self.p.gridNames===false) {
-							$(tr).append(td);
-						} else {
-							$(tr).append(tl).append(td);
-						}
-						$(tr).append(td);
-					} else {
-						tr1 = document.createElement("tr");
-						$(tr1).append(tl).append(td);
-						$(tbl).append(tr1);
-					}
-				});
-				td = document.createElement("td");
-				if(self.p.enableSearch === true){
-					sb = "<input type='button' id='sButton' class='"+self.p.buttonclass+"' value='"+self.p.searchButton+"'/>";
-					$(td).append(sb);
-					$("input#sButton",td).click(function(){
-						triggerSearch();
-						return false;
-					});
-				}
-				if(self.p.enableClear === true) {
-					cb = "<input type='button' id='cButton' class='"+self.p.buttonclass+"' value='"+self.p.clearButton+"'/>";
-					$(td).append(cb);
-					$("input#cButton",td).click(function(){
-						clearSearch();
-						return false;
-					});
-				}
-				if(self.p.enableClear === true || self.p.enableSearch === true) {
-					if(self.p.formtype=='horizontal') {
-						$(tr).append(td);
-					} else {
-						tr1 = document.createElement("tr");
-						$(tr1).append("<td>&#160;</td>").append(td);
-						$(tbl).append(tr1);
-					}
-				}
-			};
-			var frm = $("<form name='SearchForm' style=display:inline;' class='"+this.p.formclass+"'></form>");
-			var tbl =$("<table class='"+this.p.tableclass+"' cellspacing='0' cellpading='0' border='0'><tbody></tbody></table>");
-			$(frm).append(tbl);
-			formFill();
-			$(this).append(frm);
-			this.triggerSearch = triggerSearch;
-			this.clearSearch = clearSearch;
-		});
-	},
-	filterToolbar : function(p){
-		p = $.extend({
-			autosearch: true,
-			searchOnEnter : true,
-			beforeSearch: null,
-			afterSearch: null,
-			beforeClear: null,
-			afterClear: null,
-			searchurl : '',
-			stringResult: false,
-			groupOp: 'AND'
-		},p  || {});
-		return this.each(function(){
-			var $t = this;
-			var triggerToolbar = function() {
-				var sdata={}, j=0, v, nm, sopt={};
-				$.each($t.p.colModel,function(i,n){
-                    nm = this.index || this.name;
-                    var so = (this.searchoptions && this.searchoptions.sopt) ? this.searchoptions.sopt[0] : "bw";
-					switch (this.stype) {
-						case 'select' :
-							v = $("select[name="+nm+"]",$t.grid.hDiv).val();
-							if(v) {
-								sdata[nm] = v;
-                                sopt[nm] = so;
-								j++;
-							} else {
-                                try {
-                                    delete $t.p.postData[nm];
-                                } catch (e) {}
-                            }
-							break;
-						case 'text':
-							v = $("input[name="+nm+"]",$t.grid.hDiv).val();
-							if(v) {
-								sdata[nm] = v;
-                                sopt[nm] = so;
-								j++;
-							} else {
-                                try {
-                                    delete $t.p.postData[nm];
-                                } catch (e) {}
-                            }
-                            break;
-					}
-				});
-				var sd =  j>0 ? true : false;
-                if(!p.stringResult) {
-                    $.extend($t.p.postData,sdata);
-                } else {
-                    var ruleGroup = "{\"groupOp\":\"" + p.groupOp + "\",\"rules\":[";
-                    var gi=0;
-                    $.each(sdata,function(i,n){
-                        if (gi > 0) {ruleGroup += ",";}
-                        ruleGroup += "{\"field\":\"" + i + "\",";
-                        ruleGroup += "\"op\":\"" + sopt[i] + "\",";
-                        ruleGroup += "\"data\":\"" + n + "\"}";
-                        gi++;
-                    });
-                    ruleGroup += "]}";
-                    $.extend($t.p.postData,{filters:ruleGroup});
-                }
-				var saveurl;
-				if($t.p.searchurl) {
-					saveurl = $t.p.url;
-					$($t).jqGrid("setGridParam",{url:$t.p.searchurl});
-				}
-				var bsr = false;
-				if($.isFunction(p.beforeSearch)){bsr = p.beforeSearch.call($t);}
-				if(!bsr) { $($t).jqGrid("setGridParam",{search:sd}).trigger("reloadGrid",[{page:1}]); }
-				if(saveurl) {$($t).jqGrid("setGridParam",{url:saveurl});}
-				if($.isFunction(p.afterSearch)){p.afterSearch();}
-			};
-			var clearToolbar = function(trigger){
-				var sdata={}, v, j=0, nm;
-                trigger = (typeof trigger != 'boolean') ? true : trigger;
-				$.each($t.p.colModel,function(i,n){
-					v = (this.searchoptions && this.searchoptions.defaultValue) ? this.searchoptions.defaultValue : "";
-                    nm = this.index || this.name;
-					switch (this.stype) {
-						case 'select' :
-							var v1;
-							$("select[name="+nm+"] option",$t.grid.hDiv).each(function (i){
-                                if(i===0) { this.selected = true; }
-								if ($(this).text() == v) {
-									this.selected = true;
-									v1 = $(this).val();
-									return false;
-								}
-							});
-                            if (v1) {
-                                // post the key and not the text
-                                sdata[nm] = v1;
-                                j++;
-                            } else {
-                                try {
-                                    delete $t.p.postData[nm];
-                                } catch(e) {}
-                            }
-							break;
-						case 'text':
-							$("input[name="+nm+"]",$t.grid.hDiv).val(v);
-							if(v) {
-								sdata[nm] = v;
-								j++;
-							} else {
-                                try {
-                                    delete $t.p.postData[nm];
-                                } catch (e){}
-                            }
-                            break;
-					}
-				});
-				var sd =  j>0 ? true : false;
-                if(!p.stringResult) {
-                    $.extend($t.p.postData,sdata);
-                } else {
-                    var ruleGroup = "{\"groupOp\":\"" + p.groupOp + "\",\"rules\":[";
-                    var gi=0;
-                    $.each(sdata,function(i,n){
-                        if (gi > 0) {ruleGroup += ",";}
-                        ruleGroup += "{\"field\":\"" + i + "\",";
-                        ruleGroup += "\"op\":\"" + "eq" + "\",";
-                        ruleGroup += "\"data\":\"" + n + "\"}";
-                        gi++;
-                    });
-                    ruleGroup += "]}";
-                    $.extend($t.p.postData,{filters:ruleGroup});
-                }
-				var saveurl;
-				if($t.p.searchurl) {
-					saveurl = $t.p.url;
-					$($t).jqGrid("setGridParam",{url:$t.p.searchurl});
-				}
-				var bcv = false;
-				if($.isFunction(p.beforeClear)){bcv = p.beforeClear.call($t);}
-				if(!bcv) {
-                    if(trigger) {
-                        $($t).jqGrid("setGridParam",{search:sd}).trigger("reloadGrid",[{page:1}]);
-                    }
-                }
-				if(saveurl) {$($t).jqGrid("setGridParam",{url:saveurl});}
-				if($.isFunction(p.afterClear)){p.afterClear();}
-			};
-			var toggleToolbar = function(){
-                var trow = $("tr.ui-search-toolbar",$t.grid.hDiv);
-                if(trow.css("display")=='none') { trow.show(); }
-                else { trow.hide(); }
-			};
-			// create the row
-			function bindEvents(selector, events) {
-				var jElem = $(selector);
-				if (jElem[0]) {
-				    jQuery.each(events, function() {
-				        if (this.data !== undefined) {
-				            jElem.bind(this.type, this.data, this.fn);
-				        } else {
-				            jElem.bind(this.type, this.fn);
-				        }
-				    });
-				}
-			}
-			var tr = $("<tr class='ui-search-toolbar' role='rowheader'></tr>");
-            var timeoutHnd;
-			$.each($t.p.colModel,function(i,n){
-				var cm=this, thd , th, soptions,surl,self;
-				th = $("<th role='columnheader' class='ui-state-default ui-th-column ui-th-"+$t.p.direction+"'></th>");
-				thd = $("<div style='width:100%;position:relative;height:100%;padding-right:0.3em;'></div>");
-				if(this.hidden===true) { $(th).css("display","none");}
-				this.search = this.search === false ? false : true;
-				if(typeof this.stype == 'undefined' ) {this.stype='text';}
-				soptions = $.extend({},this.searchoptions || {});
-				if(this.search){
-					switch (this.stype)
-					{
-					case "select":
-						surl = this.surl || soptions.dataUrl;
-						if(surl) {
-							// data returned should have already constructed html select
-							// primitive jQuery load
-							self = thd;
-							$.ajax($.extend({
-								url: surl,
-								dataType: "html",
-								complete: function(res,status) {
-									if(soptions.buildSelect !== undefined) {
-										var d = soptions.buildSelect(res);
-										if (d) { $(self).append(d); }
-									} else {
-										$(self).append(res.responseText);
-									}
-									if(soptions.defaultValue) { $("select",self).val(soptions.defaultValue); }
-									$("select",self).attr({name:cm.index || cm.name, id: "gs_"+cm.name});
-									if(soptions.attr) {$("select",self).attr(soptions.attr);}
-									$("select",self).css({width: "100%"});
-									// preserve autoserch
-									if(soptions.dataInit !== undefined) { soptions.dataInit($("select",self)[0]); }
-									if(soptions.dataEvents !== undefined) { bindEvents($("select",self)[0],soptions.dataEvents); }
-									if(p.autosearch===true){
-										$("select",self).change(function(e){
-											triggerToolbar();
-											return false;
-										});
-									}
-									res=null;
-								}
-							}, $.jgrid.ajaxOptions, $t.p.ajaxSelectOptions || {} ));
-						} else {
-							var oSv;
-							if(cm.searchoptions && cm.searchoptions.value) {
-								oSv = cm.searchoptions.value;
-							} else if(cm.editoptions && cm.editoptions.value) {
-								oSv = cm.editoptions.value;
-							}
-							if (oSv) {	
-								var elem = document.createElement("select");
-								elem.style.width = "100%";
-								$(elem).attr({name:cm.index || cm.name, id: "gs_"+cm.name});
-								var so, sv, ov;
-								if(typeof oSv === "string") {
-									so = oSv.split(";");
-									for(var k=0; k<so.length;k++){
-										sv = so[k].split(":");
-										ov = document.createElement("option");
-										ov.value = sv[0]; ov.innerHTML = sv[1];
-										elem.appendChild(ov);
-									}
-								} else if(typeof oSv === "object" ) {
-									for ( var key in oSv) {
-										if(oSv.hasOwnProperty(key)) {
-											ov = document.createElement("option");
-											ov.value = key; ov.innerHTML = oSv[key];
-											elem.appendChild(ov);
-										}
-									}
-								}
-								if(soptions.defaultValue) { $(elem).val(soptions.defaultValue); }
-								if(soptions.attr) {$(elem).attr(soptions.attr);}
-								if(soptions.dataInit !== undefined) { soptions.dataInit(elem); }
-								if(soptions.dataEvents !== undefined) { bindEvents(elem, soptions.dataEvents); }
-								$(thd).append(elem);
-								if(p.autosearch===true){
-									$(elem).change(function(e){
-										triggerToolbar();
-										return false;
-									});
-								}
-							}
-						}
-						break;
-					case 'text':
-						var df = soptions.defaultValue ? soptions.defaultValue: "";
-						$(thd).append("<input type='text' style='width:95%;padding:0px;' name='"+(cm.index || cm.name)+"' id='gs_"+cm.name+"' value='"+df+"'/>");
-						if(soptions.attr) {$("input",thd).attr(soptions.attr);}
-						if(soptions.dataInit !== undefined) { soptions.dataInit($("input",thd)[0]); }
-						if(soptions.dataEvents !== undefined) { bindEvents($("input",thd)[0], soptions.dataEvents); }
-						if(p.autosearch===true){
-                            if(p.searchOnEnter) {
-                                $("input",thd).keypress(function(e){
-                                    var key = e.charCode ? e.charCode : e.keyCode ? e.keyCode : 0;
-                                    if(key == 13){
-                                        triggerToolbar();
-                                        return false;
-                                    }
-                                    return this;
-                                });
-                            } else {
-                                $("input",thd).keydown(function(e){
-                                    var key = e.which;
-									switch (key) {
-										case 9 :
-										case 16:
-										case 37:
-										case 38:
-										case 39:
-										case 40:
-										case 27:
-											break;
-										default :
-	                                        if(timeoutHnd) { clearTimeout(timeoutHnd); }
-	                                        timeoutHnd = setTimeout(function(){triggerToolbar();},500);
-									}
-                                });
-                            }
-						}
-						break;
-					}
-				}
-				$(th).append(thd);
-				$(tr).append(th);
-			});
-			$("table thead",$t.grid.hDiv).append(tr);
-			this.triggerToolbar = triggerToolbar;
-			this.clearToolbar = clearToolbar;
-			this.toggleToolbar = toggleToolbar;
-		});
-	}
-});
+(function($){
+/**
+ * jqGrid extension for custom methods
+ * Tony Tomov tony@trirand.com
+ * http://trirand.com/blog/ 
+ * 
+ * Wildraid wildraid@mail.ru
+ * Oleg Kiriljuk oleg.kiriljuk@ok-soft-gmbh.com
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl-2.0.html
+**/
+/*global jQuery, $ */
+
+$.jgrid.extend({
+	getColProp : function(colname){
+		var ret ={}, $t = this[0];
+		if ( !$t.grid ) { return false; }
+		var cM = $t.p.colModel;
+		for ( var i =0;i<cM.length;i++ ) {
+			if ( cM[i].name == colname ) {
+				ret = cM[i];
+				break;
+			}
+		}
+		return ret;
+	},
+	setColProp : function(colname, obj){
+		//do not set width will not work
+		return this.each(function(){
+			if ( this.grid ) {
+				if ( obj ) {
+					var cM = this.p.colModel;
+					for ( var i =0;i<cM.length;i++ ) {
+						if ( cM[i].name == colname ) {
+							$.extend(this.p.colModel[i],obj);
+							break;
+						}
+					}
+				}
+			}
+		});
+	},
+	sortGrid : function(colname,reload, sor){
+		return this.each(function(){
+			var $t=this,idx=-1;
+			if ( !$t.grid ) { return;}
+			if ( !colname ) { colname = $t.p.sortname; }
+			for ( var i=0;i<$t.p.colModel.length;i++ ) {
+				if ( $t.p.colModel[i].index == colname || $t.p.colModel[i].name==colname ) {
+					idx = i;
+					break;
+				}
+			}
+			if ( idx!=-1 ){
+				var sort = $t.p.colModel[idx].sortable;
+				if ( typeof sort !== 'boolean' ) { sort =  true; }
+				if ( typeof reload !=='boolean' ) { reload = false; }
+				if ( sort ) { $t.sortData("jqgh_"+$t.p.id+"_" + colname, idx, reload, sor); }
+			}
+		});
+	},
+	GridDestroy : function () {
+		return this.each(function(){
+			if ( this.grid ) { 
+				if ( this.p.pager ) { // if not part of grid
+					$(this.p.pager).remove();
+				}
+				var gid = this.id;
+				try {
+					$("#gbox_"+gid).remove();
+				} catch (_) {}
+			}
+		});
+	},
+	GridUnload : function(){
+		return this.each(function(){
+			if ( !this.grid ) {return;}
+			var defgrid = {id: $(this).attr('id'),cl: $(this).attr('class')};
+			if (this.p.pager) {
+				$(this.p.pager).empty().removeClass("ui-state-default ui-jqgrid-pager corner-bottom");
+			}
+			var newtable = document.createElement('table');
+			$(newtable).attr({id:defgrid.id});
+			newtable.className = defgrid.cl;
+			var gid = this.id;
+			$(newtable).removeClass("ui-jqgrid-btable");
+			if( $(this.p.pager).parents("#gbox_"+gid).length === 1 ) {
+				$(newtable).insertBefore("#gbox_"+gid).show();
+				$(this.p.pager).insertBefore("#gbox_"+gid);
+			} else {
+				$(newtable).insertBefore("#gbox_"+gid).show();
+			}
+			$("#gbox_"+gid).remove();
+		});
+	},
+    setGridState : function(state) {
+		return this.each(function(){
+			if ( !this.grid ) {return;}
+            var $t = this;
+            if(state == 'hidden'){
+				$(".ui-jqgrid-bdiv, .ui-jqgrid-hdiv","#gview_"+$t.p.id).slideUp("fast");
+				if($t.p.pager) {$($t.p.pager).slideUp("fast");}
+				if($t.p.toppager) {$($t.p.toppager).slideUp("fast");}
+				if($t.p.toolbar[0]===true) {
+					if( $t.p.toolbar[1]=='both') {
+						$($t.grid.ubDiv).slideUp("fast");
+					}
+					$($t.grid.uDiv).slideUp("fast");
+				}
+				if($t.p.footerrow) { $(".ui-jqgrid-sdiv","#gbox_"+$t.p.id).slideUp("fast"); }
+				$(".ui-jqgrid-titlebar-close span",$t.grid.cDiv).removeClass("ui-icon-circle-triangle-n").addClass("ui-icon-circle-triangle-s");
+				$t.p.gridstate = 'hidden';
+            } else if(state=='visible') {
+				$(".ui-jqgrid-hdiv, .ui-jqgrid-bdiv","#gview_"+$t.p.id).slideDown("fast");
+				if($t.p.pager) {$($t.p.pager).slideDown("fast");}
+				if($t.p.toppager) {$($t.p.toppager).slideDown("fast");}
+				if($t.p.toolbar[0]===true) {
+					if( $t.p.toolbar[1]=='both') {
+						$($t.grid.ubDiv).slideDown("fast");
+					}
+					$($t.grid.uDiv).slideDown("fast");
+				}
+				if($t.p.footerrow) { $(".ui-jqgrid-sdiv","#gbox_"+$t.p.id).slideDown("fast"); }
+				$(".ui-jqgrid-titlebar-close span",$t.grid.cDiv).removeClass("ui-icon-circle-triangle-s").addClass("ui-icon-circle-triangle-n");
+				$t.p.gridstate = 'visible';
+			}
+
+		});
+	},
+	filterToolbar : function(p){
+		p = $.extend({
+			autosearch: true,
+			searchOnEnter : true,
+			beforeSearch: null,
+			afterSearch: null,
+			beforeClear: null,
+			afterClear: null,
+			searchurl : '',
+			stringResult: false,
+			groupOp: 'AND',
+			defaultSearch : "bw"
+		},p  || {});
+		return this.each(function(){
+			var $t = this;
+			if(this.ftoolbar) { return; }
+			var triggerToolbar = function() {
+				var sdata={}, j=0, v, nm, sopt={},so;
+				$.each($t.p.colModel,function(i,n){
+					nm = this.index || this.name;
+					switch (this.stype) {
+						case 'select' :
+							so  = (this.searchoptions && this.searchoptions.sopt) ? this.searchoptions.sopt[0] : 'eq';
+							v = $("#gs_"+$.jgrid.jqID(this.name),$t.grid.hDiv).val();
+							if(v) {
+								sdata[nm] = v;
+								sopt[nm] = so;
+								j++;
+							} else {
+								try {
+									delete $t.p.postData[nm];
+								} catch (e) {}
+							}
+							break;
+						case 'text':
+							so  = (this.searchoptions && this.searchoptions.sopt) ? this.searchoptions.sopt[0] : p.defaultSearch;
+							v = $("#gs_"+$.jgrid.jqID(this.name), $t.grid.hDiv).val();
+							if(v) {
+								sdata[nm] = v;
+								sopt[nm] = so;
+								j++;
+							} else {
+								try {
+									delete $t.p.postData[nm];
+								} catch (z) {}
+							}
+							break;
+					}
+				});
+				var sd =  j>0 ? true : false;
+				if(p.stringResult === true || $t.p.datatype == "local") {
+					var ruleGroup = "{\"groupOp\":\"" + p.groupOp + "\",\"rules\":[";
+					var gi=0;
+					$.each(sdata,function(i,n){
+						if (gi > 0) {ruleGroup += ",";}
+						ruleGroup += "{\"field\":\"" + i + "\",";
+						ruleGroup += "\"op\":\"" + sopt[i] + "\",";
+						n+="";
+						ruleGroup += "\"data\":\"" + n.replace(/\\/g,'\\\\').replace(/\"/g,'\\"') + "\"}";
+						gi++;
+					});
+					ruleGroup += "]}";
+					$.extend($t.p.postData,{filters:ruleGroup});
+					$.each(['searchField', 'searchString', 'searchOper'], function(i, n){
+						if($t.p.postData.hasOwnProperty(n)) { delete $t.p.postData[n];}
+					});
+				} else {
+					$.extend($t.p.postData,sdata);
+				}
+				var saveurl;
+				if($t.p.searchurl) {
+					saveurl = $t.p.url;
+					$($t).jqGrid("setGridParam",{url:$t.p.searchurl});
+				}
+				var bsr = false;
+				if($.isFunction(p.beforeSearch)){bsr = p.beforeSearch.call($t);}
+				if(!bsr) { $($t).jqGrid("setGridParam",{search:sd}).trigger("reloadGrid",[{page:1}]); }
+				if(saveurl) {$($t).jqGrid("setGridParam",{url:saveurl});}
+				if($.isFunction(p.afterSearch)){p.afterSearch();}
+			};
+			var clearToolbar = function(trigger){
+				var sdata={}, v, j=0, nm;
+				trigger = (typeof trigger != 'boolean') ? true : trigger;
+				$.each($t.p.colModel,function(i,n){
+					v = (this.searchoptions && this.searchoptions.defaultValue) ? this.searchoptions.defaultValue : "";
+					nm = this.index || this.name;
+					switch (this.stype) {
+						case 'select' :
+							var v1;
+							$("#gs_"+$.jgrid.jqID(nm)+" option",$t.grid.hDiv).each(function (i){
+								if(i===0) { this.selected = true; }
+								if ($(this).text() == v) {
+									this.selected = true;
+									v1 = $(this).val();
+									return false;
+								}
+							});
+							if (v1) {
+								// post the key and not the text
+								sdata[nm] = v1;
+								j++;
+							} else {
+								try {
+									delete $t.p.postData[nm];
+								} catch(e) {}
+							}
+							break;
+						case 'text':
+							$("#gs_"+$.jgrid.jqID(nm),$t.grid.hDiv).val(v);
+							if(v) {
+								sdata[nm] = v;
+								j++;
+							} else {
+								try {
+									delete $t.p.postData[nm];
+								} catch (y){}
+							}
+							break;
+					}
+				});
+				var sd =  j>0 ? true : false;
+				if(p.stringResult === true || $t.p.datatype == "local") {
+					var ruleGroup = "{\"groupOp\":\"" + p.groupOp + "\",\"rules\":[";
+					var gi=0;
+					$.each(sdata,function(i,n){
+						if (gi > 0) {ruleGroup += ",";}
+						ruleGroup += "{\"field\":\"" + i + "\",";
+						ruleGroup += "\"op\":\"" + "eq" + "\",";
+						n+="";
+						ruleGroup += "\"data\":\"" + n.replace(/\\/g,'\\\\').replace(/\"/g,'\\"') + "\"}";
+						gi++;
+					});
+					ruleGroup += "]}";
+					$.extend($t.p.postData,{filters:ruleGroup});
+					$.each(['searchField', 'searchString', 'searchOper'], function(i, n){
+						if($t.p.postData.hasOwnProperty(n)) { delete $t.p.postData[n];}
+					});
+				} else {
+					$.extend($t.p.postData,sdata);
+				}
+				var saveurl;
+				if($t.p.searchurl) {
+					saveurl = $t.p.url;
+					$($t).jqGrid("setGridParam",{url:$t.p.searchurl});
+				}
+				var bcv = false;
+				if($.isFunction(p.beforeClear)){bcv = p.beforeClear.call($t);}
+				if(!bcv) {
+					if(trigger) {
+						$($t).jqGrid("setGridParam",{search:sd}).trigger("reloadGrid",[{page:1}]);
+					}
+				}
+				if(saveurl) {$($t).jqGrid("setGridParam",{url:saveurl});}
+				if($.isFunction(p.afterClear)){p.afterClear();}
+			};
+			var toggleToolbar = function(){
+				var trow = $("tr.ui-search-toolbar",$t.grid.hDiv);
+				if(trow.css("display")=='none') { trow.show(); }
+				else { trow.hide(); }
+			};
+			// create the row
+			function bindEvents(selector, events) {
+				var jElem = $(selector);
+				if (jElem[0]) {
+				    jQuery.each(events, function() {
+				        if (this.data !== undefined) {
+				            jElem.bind(this.type, this.data, this.fn);
+				        } else {
+				            jElem.bind(this.type, this.fn);
+				        }
+				    });
+				}
+			}
+			var tr = $("<tr class='ui-search-toolbar' role='rowheader'></tr>");
+			var timeoutHnd;
+			$.each($t.p.colModel,function(i,n){
+				var cm=this, thd , th, soptions,surl,self;
+				th = $("<th role='columnheader' class='ui-state-default ui-th-column ui-th-"+$t.p.direction+"'></th>");
+				thd = $("<div style='width:100%;position:relative;height:100%;padding-right:0.3em;'></div>");
+				if(this.hidden===true) { $(th).css("display","none");}
+				this.search = this.search === false ? false : true;
+				if(typeof this.stype == 'undefined' ) {this.stype='text';}
+				soptions = $.extend({},this.searchoptions || {});
+				if(this.search){
+					switch (this.stype)
+					{
+					case "select":
+						surl = this.surl || soptions.dataUrl;
+						if(surl) {
+							// data returned should have already constructed html select
+							// primitive jQuery load
+							self = thd;
+							$.ajax($.extend({
+								url: surl,
+								dataType: "html",
+								success: function(res,status) {
+									if(soptions.buildSelect !== undefined) {
+										var d = soptions.buildSelect(res);
+										if (d) { $(self).append(d); }
+									} else {
+										$(self).append(res);
+									}
+									if(soptions.defaultValue) { $("select",self).val(soptions.defaultValue); }
+									$("select",self).attr({name:cm.index || cm.name, id: "gs_"+cm.name});
+									if(soptions.attr) {$("select",self).attr(soptions.attr);}
+									$("select",self).css({width: "100%"});
+									// preserve autoserch
+									if(soptions.dataInit !== undefined) { soptions.dataInit($("select",self)[0]); }
+									if(soptions.dataEvents !== undefined) { bindEvents($("select",self)[0],soptions.dataEvents); }
+									if(p.autosearch===true){
+										$("select",self).change(function(e){
+											triggerToolbar();
+											return false;
+										});
+									}
+									res=null;
+								}
+							}, $.jgrid.ajaxOptions, $t.p.ajaxSelectOptions || {} ));
+						} else {
+							var oSv;
+							if(cm.searchoptions && cm.searchoptions.value) {
+								oSv = cm.searchoptions.value;
+							} else if(cm.editoptions && cm.editoptions.value) {
+								oSv = cm.editoptions.value;
+							}
+							if (oSv) {	
+								var elem = document.createElement("select");
+								elem.style.width = "100%";
+								$(elem).attr({name:cm.index || cm.name, id: "gs_"+cm.name});
+								var so, sv, ov;
+								if(typeof oSv === "string") {
+									so = oSv.split(";");
+									for(var k=0; k<so.length;k++){
+										sv = so[k].split(":");
+										ov = document.createElement("option");
+										ov.value = sv[0]; ov.innerHTML = sv[1];
+										elem.appendChild(ov);
+									}
+								} else if(typeof oSv === "object" ) {
+									for ( var key in oSv) {
+										if(oSv.hasOwnProperty(key)) {
+											ov = document.createElement("option");
+											ov.value = key; ov.innerHTML = oSv[key];
+											elem.appendChild(ov);
+										}
+									}
+								}
+								if(soptions.defaultValue) { $(elem).val(soptions.defaultValue); }
+								if(soptions.attr) {$(elem).attr(soptions.attr);}
+								if(soptions.dataInit !== undefined) { soptions.dataInit(elem); }
+								if(soptions.dataEvents !== undefined) { bindEvents(elem, soptions.dataEvents); }
+								$(thd).append(elem);
+								if(p.autosearch===true){
+									$(elem).change(function(e){
+										triggerToolbar();
+										return false;
+									});
+								}
+							}
+						}
+						break;
+					case 'text':
+						var df = soptions.defaultValue ? soptions.defaultValue: "";
+						$(thd).append("<input type='text' style='width:95%;padding:0px;' name='"+(cm.index || cm.name)+"' id='gs_"+cm.name+"' value='"+df+"'/>");
+						if(soptions.attr) {$("input",thd).attr(soptions.attr);}
+						if(soptions.dataInit !== undefined) { soptions.dataInit($("input",thd)[0]); }
+						if(soptions.dataEvents !== undefined) { bindEvents($("input",thd)[0], soptions.dataEvents); }
+						if(p.autosearch===true){
+							if(p.searchOnEnter) {
+								$("input",thd).keypress(function(e){
+									var key = e.charCode ? e.charCode : e.keyCode ? e.keyCode : 0;
+									if(key == 13){
+										triggerToolbar();
+										return false;
+									}
+									return this;
+								});
+							} else {
+								$("input",thd).keydown(function(e){
+									var key = e.which;
+									switch (key) {
+										case 13:
+											return false;
+										case 9 :
+										case 16:
+										case 37:
+										case 38:
+										case 39:
+										case 40:
+										case 27:
+											break;
+										default :
+											if(timeoutHnd) { clearTimeout(timeoutHnd); }
+											timeoutHnd = setTimeout(function(){triggerToolbar();},500);
+									}
+								});
+							}
+						}
+						break;
+					}
+				}
+				$(th).append(thd);
+				$(tr).append(th);
+			});
+			$("table thead",$t.grid.hDiv).append(tr);
+			this.ftoolbar = true;
+			this.triggerToolbar = triggerToolbar;
+			this.clearToolbar = clearToolbar;
+			this.toggleToolbar = toggleToolbar;
+		});
+	},
+
+	destroyGroupHeader : function(nullHeader)
+	{
+		if(typeof(nullHeader) == 'undefined') {
+			nullHeader = true;
+		}
+		return this.each(function()
+		{
+			var $t = this, $tr, i, l, headers, $th, $resizing, grid = $t.grid,
+			thead = $("table.ui-jqgrid-htable thead", grid.hDiv), cm = $t.p.colModel, hc;
+			if(!grid) return;
+
+			$tr = $("<tr>", {role: "rowheader"}).addClass("ui-jqgrid-labels");
+			headers = grid.headers;
+			for (i = 0, l = headers.length; i < l; i++) {
+				hc = cm[i].hidden ? "none" : "";
+				$th = $(headers[i].el)
+					.width(headers[i].width)
+					.removeAttr("rowSpan")
+					.css('display',hc);
+				$tr.append($th);
+				$resizing = $th.children("span.ui-jqgrid-resize");
+				if ($resizing.length>0) {// resizable column
+					$resizing[0].style.height = "";
+				}
+				$th.children("div")[0].style.top = "";
+			}
+			$(thead).children('tr.ui-jqgrid-labels').remove();
+			$(thead).prepend($tr);
+
+			if(nullHeader === true) {
+				$($t).jqGrid('setGridParam',{ 'groupHeader': null});
+			}
+		});
+	},
+	
+	setGroupHeaders : function ( o ) {
+		o = $.extend({
+			useColSpanStyle :  false,
+			groupHeaders: []
+		},o  || {});
+		return this.each(function(){
+			this.p.groupHeader = o;
+			var ts = this,
+			i, cmi, skip = 0, $tr, $colHeader, th, $th, thStyle,
+			iCol,
+			cghi,
+			//startColumnName,
+			numberOfColumns,
+			titleText,
+			cVisibleColumns,
+			colModel = ts.p.colModel,
+			cml = colModel.length,
+			ths = ts.grid.headers,
+			$htable = $("table.ui-jqgrid-htable", ts.grid.hDiv),
+			$trLabels = $htable.children("thead").children("tr.ui-jqgrid-labels:last").addClass("jqg-second-row-header"),
+			$thead = $htable.children("thead"),
+			$theadInTable,
+			originalResizeStop,
+			$firstHeaderRow = $htable.find(".jqg-first-row-header");
+			if($firstHeaderRow.html() === null) {
+				$firstHeaderRow = $('<tr>', {role: "row", "aria-hidden": "true"}).addClass("jqg-first-row-header").css("height", "auto");
+			} else {
+				$firstHeaderRow.empty();
+			}
+			var $firstRow,
+			inColumnHeader = function (text, columnHeaders) {
+                    var i = 0, length = columnHeaders.length;
+                    for (; i < length; i++) {
+                        if (columnHeaders[i].startColumnName === text) {
+                            return i;
+                        }
+                    }
+        
+                    return -1;
+			};
+
+			$(ts).prepend($thead);
+			$tr = $('<tr>', {role: "rowheader"}).addClass("ui-jqgrid-labels jqg-third-row-header");
+			for (i = 0; i < cml; i++) {
+				th = ths[i].el;
+				$th = $(th);
+				cmi = colModel[i];
+				// build the next cell for the first header row
+				thStyle = { height: '0px', width: ths[i].width + 'px', display: (cmi.hidden ? 'none' : '')};
+				$("<th>", {role: 'gridcell'}).css(thStyle).addClass("ui-first-th-"+ts.p.direction).appendTo($firstHeaderRow);
+
+				th.style.width = ""; // remove unneeded style
+				iCol = inColumnHeader(cmi.name, o.groupHeaders);
+				if (iCol >= 0) {
+					cghi = o.groupHeaders[iCol];
+					numberOfColumns = cghi.numberOfColumns;
+					titleText = cghi.titleText;
+
+					// caclulate the number of visible columns from the next numberOfColumns columns
+					for (cVisibleColumns = 0, iCol = 0; iCol < numberOfColumns && (i + iCol < cml); iCol++) {
+						if (!colModel[i + iCol].hidden) {
+							cVisibleColumns++;
+						}
+					}
+
+					// The next numberOfColumns headers will be moved in the next row
+					// in the current row will be placed the new column header with the titleText.
+					// The text will be over the cVisibleColumns columns
+					$colHeader = $('<th>', {colspan: String(cVisibleColumns), role: "columnheader"})
+						.addClass("ui-state-default ui-th-column-header ui-th-"+ts.p.direction)
+						.css({'height':'22px', 'border-top': '0px none'})
+						.html(titleText);
+					if (ts.p.headertitles) {
+						$colHeader.attr("title", $colHeader.text());
+					}
+					// hide if not a visible cols
+					if( cVisibleColumns === 0) {
+						$colHeader.hide();
+					}
+
+					$th.before($colHeader); // insert new column header before the current
+					$tr.append(th);         // move the current header in the next row
+
+					// set the coumter of headers which will be moved in the next row
+					skip = numberOfColumns - 1;
+				} else {
+					if (skip === 0) {
+						if (o.useColSpanStyle) {
+							// expand the header height to two rows
+							$th.attr("rowspan", "2");
+						} else {
+							$('<th>', {role: "columnheader"})
+								.addClass("ui-state-default ui-th-column-header ui-th-"+ts.p.direction)
+								.css({"display": cmi.hidden ? 'none' : '', 'border-top': '0px none'})
+								.insertBefore($th);
+							$tr.append(th);
+						}
+					} else {
+						// move the header to the next row
+						//$th.css({"padding-top": "2px", height: "19px"});
+						$tr.append(th);
+						skip--;
+					}
+				}
+			}
+			$theadInTable = $(ts).children("thead");
+			$theadInTable.prepend($firstHeaderRow);
+			$tr.insertAfter($trLabels);
+			$htable.append($theadInTable);
+
+			if (o.useColSpanStyle) {
+				// Increase the height of resizing span of visible headers
+				$htable.find("span.ui-jqgrid-resize").each(function () {
+					var $parent = $(this).parent();
+					if ($parent.is(":visible")) {
+						this.style.cssText = 'height: ' + $parent.height() + 'px !important; cursor: col-resize;';
+					}
+				});
+
+				// Set position of the sortable div (the main lable)
+				// with the column header text to the middle of the cell.
+				// One should not do this for hidden headers.
+				$htable.find("div.ui-jqgrid-sortable").each(function () {
+					var $ts = $(this), $parent = $ts.parent();
+					if ($parent.is(":visible")) {
+						$ts.css('top', ($parent.height() - $ts.outerHeight()) / 2 + 'px');
+					}
+				});
+			}
+
+			// Preserve original resizeStop event if any defined
+			if ($.isFunction(ts.p.resizeStop)) {
+				originalResizeStop = ts.p.resizeStop;
+			}
+			$firstRow = $theadInTable.find("tr.jqg-first-row-header");
+			ts.p.resizeStop = function (nw, idx) {
+				$firstRow.find('th').eq(idx).width(nw);
+				if ($.isFunction(originalResizeStop)) {
+					originalResizeStop.call(ts, nw, idx);
+				}
+			};
+		});				
+	}
+});
 })(jQuery);
\ No newline at end of file
Index: controlies/trunk/applications/controlies/static/js/jdgrid/src/grid.import.js
===================================================================
--- controlies/trunk/applications/controlies/static/js/jdgrid/src/grid.import.js	(revision 240)
+++ controlies/trunk/applications/controlies/static/js/jdgrid/src/grid.import.js	(revision 241)
@@ -1,199 +1,201 @@
-;(function($){
-/*
- * jqGrid extension for constructing Grid Data from external file
- * Tony Tomov tony@trirand.com
- * http://trirand.com/blog/ 
- * Dual licensed under the MIT and GPL licenses:
- * http://www.opensource.org/licenses/mit-license.php
- * http://www.gnu.org/licenses/gpl-2.0.html
-**/ 
-    $.jgrid.extend({
-        jqGridImport : function(o) {
-            o = $.extend({
-                imptype : "xml", // xml, json, xmlstring, jsonstring
-                impstring: "",
-                impurl: "",
-                mtype: "GET",
-                impData : {},
-                xmlGrid :{
-                    config : "roots>grid",
-                    data: "roots>rows"
-                },
-                jsonGrid :{
-                    config : "grid",
-                    data: "data"
-                },
-                ajaxOptions :{}
-            }, o || {});
-            return this.each(function(){
-                var $t = this;
-                var XmlConvert = function (xml,o) {
-                    var cnfg = $(o.xmlGrid.config,xml)[0];
-                    var xmldata = $(o.xmlGrid.data,xml)[0], jstr, jstr1;
-                    if(xmlJsonClass.xml2json && $.jgrid.parse) {
-                        jstr = xmlJsonClass.xml2json(cnfg," ");
-                        jstr = $.jgrid.parse(jstr);
-                        for(var key in jstr) {
-                            if(jstr.hasOwnProperty(key)) {
-                                jstr1=jstr[key];
-                            }
-                        }
-                        if(xmldata) {
-                        // save the datatype
-                            var svdatatype = jstr.grid.datatype;
-                            jstr.grid.datatype = 'xmlstring';
-                            jstr.grid.datastr = xml;
-                            $($t).jqGrid( jstr1 ).jqGrid("setGridParam",{datatype:svdatatype});
-                        } else {
-                            $($t).jqGrid( jstr1 );
-                        }
-                        jstr = null;jstr1=null;
-                    } else {
-                        alert("xml2json or parse are not present");
-                    }
-                };
-                var JsonConvert = function (jsonstr,o){
-                    if (jsonstr && typeof jsonstr == 'string') {
-                        var json = $.jgrid.parse(jsonstr);
-                        var gprm = json[o.jsonGrid.config];
-                        var jdata = json[o.jsonGrid.data];
-                        if(jdata) {
-                            var svdatatype = gprm.datatype;
-                            gprm.datatype = 'jsonstring';
-                            gprm.datastr = jdata;
-                            $($t).jqGrid( gprm ).jqGrid("setGridParam",{datatype:svdatatype});
-                        } else {
-                            $($t).jqGrid( gprm );
-                        }
-                    }
-                };
-                switch (o.imptype){
-                    case 'xml':
-                        $.ajax($.extend({
-                            url:o.impurl,
-                            type:o.mtype,
-                            data: o.impData,
-                            dataType:"xml",
-                            complete: function(xml,stat) {
-                                if(stat == 'success') {
-                                    XmlConvert(xml.responseXML,o);
-                                    if($.isFunction(o.importComplete)) {
-                                        o.importComplete(xml);
-                                    }
-                                }
-                                xml=null;
-                            }
-                        }, o.ajaxOptions));
-                        break;
-                    case 'xmlstring' :
-                        // we need to make just the conversion and use the same code as xml
-                        if(o.impstring && typeof o.impstring == 'string') {
-                            var xmld = $.jgrid.stringToDoc(o.impstring);
-                            if(xmld) {
-                                XmlConvert(xmld,o);
-                                if($.isFunction(o.importComplete)) {
-                                    o.importComplete(xmld);
-                                }
-                                o.impstring = null;
-                            }
-                            xmld = null;
-                        }
-                        break;
-                    case 'json':
-                        $.ajax($.extend({
-                            url:o.impurl,
-                            type:o.mtype,
-                            data: o.impData,
-                            dataType:"json",
-                            complete: function(json,stat) {
-                                if(stat == 'success') {
-                                    JsonConvert(json.responseText,o );
-                                    if($.isFunction(o.importComplete)) {
-                                        o.importComplete(json);
-                                    }
-                                }
-                                json=null;
-                            }
-                        }, o.ajaxOptions ));
-                        break;
-                    case 'jsonstring' :
-                        if(o.impstring && typeof o.impstring == 'string') {
-                            JsonConvert(o.impstring,o );
-                            if($.isFunction(o.importComplete)) {
-                                o.importComplete(o.impstring);
-                            }
-                            o.impstring = null;
-                        }
-                        break;
-                }
-            });
-        },
-        jqGridExport : function(o) {
-            o = $.extend({
-                exptype : "xmlstring",
-                root: "grid",
-                ident: "\t"
-            }, o || {});
-            var ret = null;
-            this.each(function () {
-                if(!this.grid) { return;}
-                var gprm = $.extend({},$(this).jqGrid("getGridParam"));
-                // we need to check for:
-                // 1.multiselect, 2.subgrid  3. treegrid and remove the unneded columns from colNames
-                if(gprm.rownumbers) {
-                    gprm.colNames.splice(0,1);
-                    gprm.colModel.splice(0,1);
-                }
-                if(gprm.multiselect) {
-                    gprm.colNames.splice(0,1);
-                    gprm.colModel.splice(0,1);
-                }
-                if(gprm.subGrid) {
-                    gprm.colNames.splice(0,1);
-                    gprm.colModel.splice(0,1);
-                }
-                gprm.knv = null;
-                if(gprm.treeGrid) {
-                    for (var key in gprm.treeReader) {
-                        if(gprm.treeReader.hasOwnProperty(key)) {
-                            gprm.colNames.splice(gprm.colNames.length-1);
-                            gprm.colModel.splice(gprm.colModel.length-1);
-                        }
-                    }
-                }
-                switch (o.exptype) {
-                    case 'xmlstring' :
-                        ret = "<"+o.root+">"+xmlJsonClass.json2xml(gprm,o.ident)+"</"+o.root+">";
-                        break;
-                    case 'jsonstring' :
-                        ret = "{"+ xmlJsonClass.toJson(gprm,o.root,o.ident)+"}";
-                        if(gprm.postData.filters !== undefined) {
-                            ret=ret.replace(/filters":"/,'filters":');
-                            ret=ret.replace(/}]}"/,'}]}');
-                        }
-                        break;
-                }
-            });
-            return ret;
-        },
-        excelExport : function(o) {
-            o = $.extend({
-                exptype : "remote",
-                url : null,
-                oper: "oper",
-                tag: "excel",
-                exportOptions : {}
-            }, o || {});
-            return this.each(function(){
-                $t = this;
-                if(!this.grid) { return;}
-                if(o.exptype == "remote") {
-                    var pdata = $.extend({},this.p.postData);
-                    pdata[o.oper] = o.tag;
-                    var params = jQuery.param(pdata);
-                    window.location = o.url+"?"+params;
-                }
-            });
-        }
-    });
+;(function($){
+/*
+ * jqGrid extension for constructing Grid Data from external file
+ * Tony Tomov tony@trirand.com
+ * http://trirand.com/blog/ 
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl-2.0.html
+**/ 
+    $.jgrid.extend({
+        jqGridImport : function(o) {
+            o = $.extend({
+                imptype : "xml", // xml, json, xmlstring, jsonstring
+                impstring: "",
+                impurl: "",
+                mtype: "GET",
+                impData : {},
+                xmlGrid :{
+                    config : "roots>grid",
+                    data: "roots>rows"
+                },
+                jsonGrid :{
+                    config : "grid",
+                    data: "data"
+                },
+                ajaxOptions :{}
+            }, o || {});
+            return this.each(function(){
+                var $t = this;
+                var XmlConvert = function (xml,o) {
+                    var cnfg = $(o.xmlGrid.config,xml)[0];
+                    var xmldata = $(o.xmlGrid.data,xml)[0], jstr, jstr1;
+                    if(xmlJsonClass.xml2json && $.jgrid.parse) {
+                        jstr = xmlJsonClass.xml2json(cnfg," ");
+                        jstr = $.jgrid.parse(jstr);
+                        for(var key in jstr) {
+                            if(jstr.hasOwnProperty(key)) {
+                                jstr1=jstr[key];
+                            }
+                        }
+                        if(xmldata) {
+                        // save the datatype
+                            var svdatatype = jstr.grid.datatype;
+                            jstr.grid.datatype = 'xmlstring';
+                            jstr.grid.datastr = xml;
+                            $($t).jqGrid( jstr1 ).jqGrid("setGridParam",{datatype:svdatatype});
+                        } else {
+                            $($t).jqGrid( jstr1 );
+                        }
+                        jstr = null;jstr1=null;
+                    } else {
+                        alert("xml2json or parse are not present");
+                    }
+                };
+                var JsonConvert = function (jsonstr,o){
+                    if (jsonstr && typeof jsonstr == 'string') {
+                        var json = $.jgrid.parse(jsonstr);
+                        var gprm = json[o.jsonGrid.config];
+                        var jdata = json[o.jsonGrid.data];
+                        if(jdata) {
+                            var svdatatype = gprm.datatype;
+                            gprm.datatype = 'jsonstring';
+                            gprm.datastr = jdata;
+                            $($t).jqGrid( gprm ).jqGrid("setGridParam",{datatype:svdatatype});
+                        } else {
+                            $($t).jqGrid( gprm );
+                        }
+                    }
+                };
+                switch (o.imptype){
+                    case 'xml':
+                        $.ajax($.extend({
+                            url:o.impurl,
+                            type:o.mtype,
+                            data: o.impData,
+                            dataType:"xml",
+                            complete: function(xml,stat) {
+                                if(stat == 'success') {
+                                    XmlConvert(xml.responseXML,o);
+                                    if($.isFunction(o.importComplete)) {
+                                        o.importComplete(xml);
+                                    }
+                                }
+                                xml=null;
+                            }
+                        }, o.ajaxOptions));
+                        break;
+                    case 'xmlstring' :
+                        // we need to make just the conversion and use the same code as xml
+                        if(o.impstring && typeof o.impstring == 'string') {
+                            var xmld = $.jgrid.stringToDoc(o.impstring);
+                            if(xmld) {
+                                XmlConvert(xmld,o);
+                                if($.isFunction(o.importComplete)) {
+                                    o.importComplete(xmld);
+                                }
+                                o.impstring = null;
+                            }
+                            xmld = null;
+                        }
+                        break;
+                    case 'json':
+                        $.ajax($.extend({
+                            url:o.impurl,
+                            type:o.mtype,
+                            data: o.impData,
+                            dataType:"json",
+                            complete: function(json,stat) {
+                                if(stat == 'success') {
+                                    JsonConvert(json.responseText,o );
+                                    if($.isFunction(o.importComplete)) {
+                                        o.importComplete(json);
+                                    }
+                                }
+                                json=null;
+                            }
+                        }, o.ajaxOptions ));
+                        break;
+                    case 'jsonstring' :
+                        if(o.impstring && typeof o.impstring == 'string') {
+                            JsonConvert(o.impstring,o );
+                            if($.isFunction(o.importComplete)) {
+                                o.importComplete(o.impstring);
+                            }
+                            o.impstring = null;
+                        }
+                        break;
+                }
+            });
+        },
+        jqGridExport : function(o) {
+            o = $.extend({
+                exptype : "xmlstring",
+                root: "grid",
+                ident: "\t"
+            }, o || {});
+            var ret = null;
+            this.each(function () {
+                if(!this.grid) { return;}
+                var gprm = $.extend({},$(this).jqGrid("getGridParam"));
+                // we need to check for:
+                // 1.multiselect, 2.subgrid  3. treegrid and remove the unneded columns from colNames
+                if(gprm.rownumbers) {
+                    gprm.colNames.splice(0,1);
+                    gprm.colModel.splice(0,1);
+                }
+                if(gprm.multiselect) {
+                    gprm.colNames.splice(0,1);
+                    gprm.colModel.splice(0,1);
+                }
+                if(gprm.subGrid) {
+                    gprm.colNames.splice(0,1);
+                    gprm.colModel.splice(0,1);
+                }
+                gprm.knv = null;
+                if(gprm.treeGrid) {
+                    for (var key in gprm.treeReader) {
+                        if(gprm.treeReader.hasOwnProperty(key)) {
+                            gprm.colNames.splice(gprm.colNames.length-1);
+                            gprm.colModel.splice(gprm.colModel.length-1);
+                        }
+                    }
+                }
+                switch (o.exptype) {
+                    case 'xmlstring' :
+                        ret = "<"+o.root+">"+xmlJsonClass.json2xml(gprm,o.ident)+"</"+o.root+">";
+                        break;
+                    case 'jsonstring' :
+                        ret = "{"+ xmlJsonClass.toJson(gprm,o.root,o.ident,false)+"}";
+                        if(gprm.postData.filters !== undefined) {
+                            ret=ret.replace(/filters":"/,'filters":');
+                            ret=ret.replace(/}]}"/,'}]}');
+                        }
+                        break;
+                }
+            });
+            return ret;
+        },
+        excelExport : function(o) {
+            o = $.extend({
+                exptype : "remote",
+                url : null,
+                oper: "oper",
+                tag: "excel",
+                exportOptions : {}
+            }, o || {});
+            return this.each(function(){
+                if(!this.grid) { return;}
+                var url;
+                if(o.exptype == "remote") {
+                    var pdata = $.extend({},this.p.postData);
+                    pdata[o.oper] = o.tag;
+                    var params = jQuery.param(pdata);
+                    if(o.url.indexOf("?") != -1) { url = o.url+"&"+params; }
+                    else { url = o.url+"?"+params; }
+                    window.location = url;
+                }
+            });
+        }
+    });
 })(jQuery);
\ No newline at end of file
Index: controlies/trunk/applications/controlies/static/js/jdgrid/src/grid.jqueryui.js
===================================================================
--- controlies/trunk/applications/controlies/static/js/jdgrid/src/grid.jqueryui.js	(revision 240)
+++ controlies/trunk/applications/controlies/static/js/jdgrid/src/grid.jqueryui.js	(revision 241)
@@ -1,503 +1,505 @@
-;(function($){
-/*
-**
- * jqGrid addons using jQuery UI 
- * Author: Mark Williams
- * Dual licensed under the MIT and GPL licenses:
- * http://www.opensource.org/licenses/mit-license.php
- * http://www.gnu.org/licenses/gpl-2.0.html
- * depends on jQuery UI 
-**/
-if ($.browser.msie && $.browser.version==8) {
-	$.expr[":"].hidden = function(elem) {
-		return elem.offsetWidth === 0 || elem.offsetHeight === 0 ||
-			elem.style.display == "none";
-	};
-}
-// requiere load multiselect before grid
-$.jgrid._multiselect = false;
-if($.ui) {
-	if ($.ui.multiselect ) {
-		if($.ui.multiselect.prototype._setSelected) {
-			var setSelected = $.ui.multiselect.prototype._setSelected;
-		    $.ui.multiselect.prototype._setSelected = function(item,selected) {
-		        var ret = setSelected.call(this,item,selected);
-		        if (selected && this.selectedList) {
-		            var elt = this.element;
-				    this.selectedList.find('li').each(function() {
-					    if ($(this).data('optionLink')) {
-						    $(this).data('optionLink').remove().appendTo(elt);
-					    }
-				    });
-		        }
-		        return ret;
-			};
-		}
-		if($.ui.multiselect.prototype.destroy) {
-			$.ui.multiselect.prototype.destroy = function() {
-				this.element.show();
-				this.container.remove();
-				if ($.Widget === undefined) {
-					$.widget.prototype.destroy.apply(this, arguments);
-				} else {
-					$.Widget.prototype.destroy.apply(this, arguments);
-	            }
-			};
-		}
-		$.jgrid._multiselect = true;
-	}
-}
-        
-$.jgrid.extend({
-	sortableColumns : function (tblrow)
-	{
-		return this.each(function (){
-			var ts = this;
-			function start() {ts.p.disableClick = true;}
-			var sortable_opts = {
-				"tolerance" : "pointer",
-				"axis" : "x",
-				"scrollSensitivity": "1",
-				"items": '>th:not(:has(#jqgh_cb,#jqgh_rn,#jqgh_subgrid),:hidden)',
-				"placeholder": {
-					element: function(item) {
-						var el = $(document.createElement(item[0].nodeName))
-						.addClass(item[0].className+" ui-sortable-placeholder ui-state-highlight")
-						.removeClass("ui-sortable-helper")[0];
-						return el;
-					},
-					update: function(self, p) {
-						p.height(self.currentItem.innerHeight() - parseInt(self.currentItem.css('paddingTop')||0, 10) - parseInt(self.currentItem.css('paddingBottom')||0, 10));
-						p.width(self.currentItem.innerWidth() - parseInt(self.currentItem.css('paddingLeft')||0, 10) - parseInt(self.currentItem.css('paddingRight')||0, 10));
-					}
-				},
-				"update": function(event, ui) {
-					var p = $(ui.item).parent();
-					var th = $(">th", p);
-					var colModel = ts.p.colModel;
-					var cmMap = {};
-					$.each(colModel, function(i) { cmMap[this.name]=i; });
-					var permutation = [];
-					th.each(function(i) {
-						var id = $(">div", this).get(0).id.replace(/^jqgh_/, "");
-							if (id in cmMap) {
-								permutation.push(cmMap[id]);
-							}
-					});
-	
-					$(ts).jqGrid("remapColumns",permutation, true, true);
-					if ($.isFunction(ts.p.sortable.update)) {
-						ts.p.sortable.update(permutation);
-					}
-					setTimeout(function(){ts.p.disableClick=false;}, 50);
-				}
-			};
-			if (ts.p.sortable.options) {
-				$.extend(sortable_opts, ts.p.sortable.options);
-			} else if ($.isFunction(ts.p.sortable)) {
-				ts.p.sortable = { "update" : ts.p.sortable };
-			}
-			if (sortable_opts.start) {
-				var s = sortable_opts.start;
-				sortable_opts.start = function(e,ui) {
-					start();
-					s.call(this,e,ui);
-				};
-			} else {
-				sortable_opts.start = start;
-			}
-			if (ts.p.sortable.exclude) {
-				sortable_opts.items += ":not("+ts.p.sortable.exclude+")";
-			}
-			tblrow.sortable(sortable_opts).data("sortable").floating = true;
-		});
-	},
-    columnChooser : function(opts) {
-        var self = this;
-		if($("#colchooser_"+self[0].p.id).length ) { return; }
-        var selector = $('<div id="colchooser_'+self[0].p.id+'" style="position:relative;overflow:hidden"><div><select multiple="multiple"></select></div></div>');
-        var select = $('select', selector);
-
-        opts = $.extend({
-            "width" : 420,
-            "height" : 240,
-            "classname" : null,
-            "done" : function(perm) { if (perm) { self.jqGrid("remapColumns", perm, true); } },
-            /* msel is either the name of a ui widget class that
-               extends a multiselect, or a function that supports
-               creating a multiselect object (with no argument,
-               or when passed an object), and destroying it (when
-               passed the string "destroy"). */
-            "msel" : "multiselect",
-            /* "msel_opts" : {}, */
-
-            /* dlog is either the name of a ui widget class that 
-               behaves in a dialog-like way, or a function, that
-               supports creating a dialog (when passed dlog_opts)
-               or destroying a dialog (when passed the string
-               "destroy")
-               */
-            "dlog" : "dialog",
-
-            /* dlog_opts is either an option object to be passed 
-               to "dlog", or (more likely) a function that creates
-               the options object.
-               The default produces a suitable options object for
-               ui.dialog */
-            "dlog_opts" : function(opts) {
-                var buttons = {};
-                buttons[opts.bSubmit] = function() {
-                    opts.apply_perm();
-                    opts.cleanup(false);
-                };
-                buttons[opts.bCancel] = function() {
-                    opts.cleanup(true);
-                };
-                return {
-                    "buttons": buttons,
-                    "close": function() {
-                        opts.cleanup(true);
-                    },
-					"modal" : false,
-                    "resizable": false,
-                    "width": opts.width+20
-                };
-            },
-            /* Function to get the permutation array, and pass it to the
-               "done" function */
-            "apply_perm" : function() {
-                $('option',select).each(function(i) {
-                    if (this.selected) {
-                        self.jqGrid("showCol", colModel[this.value].name);
-                    } else {
-                        self.jqGrid("hideCol", colModel[this.value].name);
-                    }
-                });
-                
-                var perm = [];
-				//fixedCols.slice(0);
-                $('option[selected]',select).each(function() { perm.push(parseInt(this.value,10)); });
-                $.each(perm, function() { delete colMap[colModel[parseInt(this,10)].name]; });
-                $.each(colMap, function() {
-					var ti = parseInt(this,10);
-					perm = insert(perm,ti,ti);
-				});
-                if (opts.done) {
-                    opts.done.call(self, perm);
-                }
-            },
-            /* Function to cleanup the dialog, and select. Also calls the
-               done function with no permutation (to indicate that the
-               columnChooser was aborted */
-            "cleanup" : function(calldone) {
-                call(opts.dlog, selector, 'destroy');
-                call(opts.msel, select, 'destroy');
-                selector.remove();
-                if (calldone && opts.done) {
-                    opts.done.call(self);
-                }
-            },
-			"msel_opts" : {}
-        }, $.jgrid.col, opts || {});
-		if($.ui) {
-			if ($.ui.multiselect ) {
-				if(opts.msel == "multiselect") {
-					if(!$.jgrid._multiselect) {
-						// should be in language file
-						alert("Multiselect plugin loaded after jqGrid. Please load the plugin before the jqGrid!");
-						return;
-					}
-					opts.msel_opts = $.extend($.ui.multiselect.defaults,opts.msel_opts);
-				}
-			}
-		}
-        if (opts.caption) {
-            selector.attr("title", opts.caption);
-        }
-        if (opts.classname) {
-            selector.addClass(opts.classname);
-            select.addClass(opts.classname);
-        }
-        if (opts.width) {
-            $(">div",selector).css({"width": opts.width,"margin":"0 auto"});
-            select.css("width", opts.width);
-        }
-        if (opts.height) {
-            $(">div",selector).css("height", opts.height);
-            select.css("height", opts.height - 10);
-        }
-        var colModel = self.jqGrid("getGridParam", "colModel");
-        var colNames = self.jqGrid("getGridParam", "colNames");
-        var colMap = {}, fixedCols = [];
-
-        select.empty();
-        $.each(colModel, function(i) {
-            colMap[this.name] = i;
-            if (this.hidedlg) {
-                if (!this.hidden) {
-                    fixedCols.push(i);
-                }
-                return;
-            }
-
-            select.append("<option value='"+i+"' "+
-                          (this.hidden?"":"selected='selected'")+">"+colNames[i]+"</option>");
-        });
-		function insert(perm,i,v) {
-			if(i>=0){
-				var a = perm.slice();
-				var b = a.splice(i,Math.max(perm.length-i,i));
-				if(i>perm.length) { i = perm.length; }
-				a[i] = v;
-				return a.concat(b);
-			}
-		}
-        function call(fn, obj) {
-            if (!fn) { return; }
-            if (typeof fn == 'string') {
-                if ($.fn[fn]) {
-                    $.fn[fn].apply(obj, $.makeArray(arguments).slice(2));
-                }
-            } else if ($.isFunction(fn)) {
-                fn.apply(obj, $.makeArray(arguments).slice(2));
-            }
-        }
-
-        var dopts = $.isFunction(opts.dlog_opts) ? opts.dlog_opts.call(self, opts) : opts.dlog_opts;
-        call(opts.dlog, selector, dopts);
-        var mopts = $.isFunction(opts.msel_opts) ? opts.msel_opts.call(self, opts) : opts.msel_opts;
-        call(opts.msel, select, mopts);
-    },
-	sortableRows : function (opts) {
-		// Can accept all sortable options and events
-		return this.each(function(){
-			var $t = this;
-			if(!$t.grid) { return; }
-			// Currently we disable a treeGrid sortable
-			if($t.p.treeGrid) { return; }
-			if($.fn.sortable) {
-				opts = $.extend({
-					"cursor":"move",
-					"axis" : "y",
-					"items": ".jqgrow"
-					},
-				opts || {});
-				if(opts.start && $.isFunction(opts.start)) {
-					opts._start_ = opts.start;
-					delete opts.start;
-				} else {opts._start_=false;}
-				if(opts.update && $.isFunction(opts.update)) {
-					opts._update_ = opts.update;
-					delete opts.update;
-				} else {opts._update_ = false;}
-				opts.start = function(ev,ui) {
-					$(ui.item).css("border-width","0px");
-					$("td",ui.item).each(function(i){
-						this.style.width = $t.grid.cols[i].style.width;
-					});
-					if($t.p.subGrid) {
-						var subgid = $(ui.item).attr("id");
-						try {
-							$($t).jqGrid('collapseSubGridRow',subgid);
-						} catch (e) {}
-					}
-					if(opts._start_) {
-						opts._start_.apply(this,[ev,ui]);
-					}
-				};
-				opts.update = function (ev,ui) {
-					$(ui.item).css("border-width","");
-					$t.updateColumns();
-					if($t.p.rownumbers === true) {
-						$("td.jqgrid-rownum",$t.rows).each(function(i){
-							$(this).html(i+1);
-						});
-					}
-					if(opts._update_) {
-						opts._update_.apply(this,[ev,ui]);
-					}
-				};
-				$("tbody:first",$t).sortable(opts);
-				$("tbody:first",$t).disableSelection();
-			}
-		});
-	},
-	gridDnD : function(opts) {
-		return this.each(function(){
-		var $t = this;
-		if(!$t.grid) { return; }
-		// Currently we disable a treeGrid drag and drop
-		if($t.p.treeGrid) { return; }
-		if(!$.fn.draggable || !$.fn.droppable) { return; }
-		function updateDnD ()
-		{
-			var datadnd = $.data($t,"dnd");
-		    $("tr.jqgrow:not(.ui-draggable)",$t).draggable($.isFunction(datadnd.drag) ? datadnd.drag.call($($t),datadnd) : datadnd.drag);
-		}
-		var appender = "<table id='jqgrid_dnd' class='ui-jqgrid-dnd'></table>";
-		if($("#jqgrid_dnd").html() === null) {
-			$('body').append(appender);
-		}
-
-		if(typeof opts == 'string' && opts == 'updateDnD' && $t.p.jqgdnd===true) {
-			updateDnD();
-			return;
-		}
-		opts = $.extend({
-			"drag" : function (opts) {
-				return $.extend({
-					start : function (ev, ui) {
-						// if we are in subgrid mode try to collapse the node
-						if($t.p.subGrid) {
-							var subgid = $(ui.helper).attr("id");
-							try {
-								$($t).jqGrid('collapseSubGridRow',subgid);
-							} catch (e) {}
-						}
-						// hack
-						// drag and drop does not insert tr in table, when the table has no rows
-						// we try to insert new empty row on the target(s)
-						for (var i=0;i<$.data($t,"dnd").connectWith.length;i++){
-							if($($.data($t,"dnd").connectWith[i]).jqGrid('getGridParam','reccount') == "0" ){
-								$($.data($t,"dnd").connectWith[i]).jqGrid('addRowData','jqg_empty_row',{});
-							}
-						}
-						ui.helper.addClass("ui-state-highlight");
-						$("td",ui.helper).each(function(i) {
-							this.style.width = $t.grid.headers[i].width+"px";
-						});
-						if(opts.onstart && $.isFunction(opts.onstart) ) { opts.onstart.call($($t),ev,ui); }
-					},
-					stop :function(ev,ui) {
-						if(ui.helper.dropped) {
-							var ids = $(ui.helper).attr("id");
-							$($t).jqGrid('delRowData',ids );
-						}
-						// if we have a empty row inserted from start event try to delete it
-						for (var i=0;i<$.data($t,"dnd").connectWith.length;i++){
-							$($.data($t,"dnd").connectWith[i]).jqGrid('delRowData','jqg_empty_row');
-						}
-						if(opts.onstop && $.isFunction(opts.onstop) ) { opts.onstop.call($($t),ev,ui); }
-					}
-				},opts.drag_opts || {});
-			},
-			"drop" : function (opts) {
-				return $.extend({
-					accept: function(d) {
-						var tid = $(d).closest("table.ui-jqgrid-btable");
-						if($.data(tid[0],"dnd") !== undefined) {
-						    var cn = $.data(tid[0],"dnd").connectWith;
-						    return $.inArray('#'+this.id,cn) != -1 ? true : false;
-						}
-						return d;
-					},
-					drop: function(ev, ui) {
-						var accept = $(ui.draggable).attr("id");
-						var getdata = $('#'+$t.id).jqGrid('getRowData',accept);
-						if(!opts.dropbyname) {
-							var j =0, tmpdata = {}, dropname;
-							var dropmodel = $("#"+this.id).jqGrid('getGridParam','colModel');
-							try {
-								for (var key in getdata) {
-									if(getdata.hasOwnProperty(key) && dropmodel[j]) {
-										dropname = dropmodel[j].name;
-										tmpdata[dropname] = getdata[key];
-									}
-									j++;
-								}
-								getdata = tmpdata;
-							} catch (e) {}
-						}
-						ui.helper.dropped = true;
-						if(opts.beforedrop && $.isFunction(opts.beforedrop) ) {
-							//parameters to this callback - event, element, data to be inserted, sender, reciever
-							// should return object which will be inserted into the reciever
-							var datatoinsert = opts.beforedrop.call(this,ev,ui,getdata,$('#'+$t.id),$(this));
-							if (typeof datatoinsert != "undefined" && datatoinsert !== null && typeof datatoinsert == "object") { getdata = datatoinsert; }
-						}
-						if(ui.helper.dropped) {
-							var grid;
-							if(opts.autoid) {
-								if($.isFunction(opts.autoid)) {
-									grid = opts.autoid.call(this,getdata);
-								} else {
-									grid = Math.ceil(Math.random()*1000);
-									grid = opts.autoidprefix+grid;
-								}
-							}
-							// NULL is interpreted as undefined while null as object
-							$("#"+this.id).jqGrid('addRowData',grid,getdata,opts.droppos);
-						}
-						if(opts.ondrop && $.isFunction(opts.ondrop) ) { opts.ondrop.call(this,ev,ui, getdata); }
-					}}, opts.drop_opts || {});
-			},
-			"onstart" : null,
-			"onstop" : null,
-			"beforedrop": null,
-			"ondrop" : null,
-			"drop_opts" : {
-				"activeClass": "ui-state-active",
-				"hoverClass": "ui-state-hover"
-			},
-			"drag_opts" : {
-				"revert": "invalid",
-				"helper": "clone",
-				"cursor": "move",
-				"appendTo" : "#jqgrid_dnd",
-				"zIndex": 5000
-			},
-			"dropbyname" : false,
-			"droppos" : "first",
-			"autoid" : true,
-			"autoidprefix" : "dnd_"
-		}, opts || {});
-		
-		if(!opts.connectWith) { return; }
-		opts.connectWith = opts.connectWith.split(",");
-		opts.connectWith = $.map(opts.connectWith,function(n){return $.trim(n);});
-		$.data($t,"dnd",opts);
-		
-		if($t.p.reccount != "0" && !$t.p.jqgdnd) {
-			updateDnD();
-		}
-		$t.p.jqgdnd = true;
-		for (var i=0;i<opts.connectWith.length;i++){
-			var cn =opts.connectWith[i];
-			$(cn).droppable($.isFunction(opts.drop) ? opts.drop.call($($t),opts) : opts.drop);
-		}
-		});
-	},
-	gridResize : function(opts) {
-		return this.each(function(){
-			var $t = this;
-			if(!$t.grid || !$.fn.resizable) { return; }
-			opts = $.extend({}, opts || {});
-			if(opts.alsoResize ) {
-				opts._alsoResize_ = opts.alsoResize;
-				delete opts.alsoResize;
-			} else {
-				opts._alsoResize_ = false;
-			}
-			if(opts.stop && $.isFunction(opts.stop)) {
-				opts._stop_ = opts.stop;
-				delete opts.stop;
-			} else {
-				opts._stop_ = false;
-			}
-			opts.stop = function (ev, ui) {
-				$($t).jqGrid('setGridParam',{height:$("#gview_"+$t.p.id+" .ui-jqgrid-bdiv").height()});
-				$($t).jqGrid('setGridWidth',ui.size.width,opts.shrinkToFit);
-				if(opts._stop_) { opts._stop_.call($t,ev,ui); }
-			};
-			if(opts._alsoResize_) {
-				var optstest = "{\'#gview_"+$t.p.id+" .ui-jqgrid-bdiv\':true,'" +opts._alsoResize_+"':true}";
-				opts.alsoResize = eval('('+optstest+')'); // the only way that I found to do this
-			} else {
-				opts.alsoResize = $(".ui-jqgrid-bdiv","#gview_"+$t.p.id);
-			}
-			delete opts._alsoResize_;
-			$("#gbox_"+$t.p.id).resizable(opts);
-		});
-	}
-});
-})(jQuery);
+;(function($){
+/*
+**
+ * jqGrid addons using jQuery UI 
+ * Author: Mark Williams
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl-2.0.html
+ * depends on jQuery UI 
+**/
+if ($.browser.msie && $.browser.version==8) {
+	$.expr[":"].hidden = function(elem) {
+		return elem.offsetWidth === 0 || elem.offsetHeight === 0 ||
+			elem.style.display == "none";
+	};
+}
+// requiere load multiselect before grid
+$.jgrid._multiselect = false;
+if($.ui) {
+	if ($.ui.multiselect ) {
+		if($.ui.multiselect.prototype._setSelected) {
+			var setSelected = $.ui.multiselect.prototype._setSelected;
+		    $.ui.multiselect.prototype._setSelected = function(item,selected) {
+		        var ret = setSelected.call(this,item,selected);
+		        if (selected && this.selectedList) {
+		            var elt = this.element;
+				    this.selectedList.find('li').each(function() {
+					    if ($(this).data('optionLink')) {
+						    $(this).data('optionLink').remove().appendTo(elt);
+					    }
+				    });
+		        }
+		        return ret;
+			};
+		}
+		if($.ui.multiselect.prototype.destroy) {
+			$.ui.multiselect.prototype.destroy = function() {
+				this.element.show();
+				this.container.remove();
+				if ($.Widget === undefined) {
+					$.widget.prototype.destroy.apply(this, arguments);
+				} else {
+					$.Widget.prototype.destroy.apply(this, arguments);
+	            }
+			};
+		}
+		$.jgrid._multiselect = true;
+	}
+}
+        
+$.jgrid.extend({
+	sortableColumns : function (tblrow)
+	{
+		return this.each(function (){
+			var ts = this, tid= ts.p.id;
+			function start() {ts.p.disableClick = true;}
+			var sortable_opts = {
+				"tolerance" : "pointer",
+				"axis" : "x",
+				"scrollSensitivity": "1",
+				"items": '>th:not(:has(#jqgh_'+tid+'_cb'+',#jqgh_'+tid+'_rn'+',#jqgh_'+tid+'_subgrid),:hidden)',
+				"placeholder": {
+					element: function(item) {
+						var el = $(document.createElement(item[0].nodeName))
+						.addClass(item[0].className+" ui-sortable-placeholder ui-state-highlight")
+						.removeClass("ui-sortable-helper")[0];
+						return el;
+					},
+					update: function(self, p) {
+						p.height(self.currentItem.innerHeight() - parseInt(self.currentItem.css('paddingTop')||0, 10) - parseInt(self.currentItem.css('paddingBottom')||0, 10));
+						p.width(self.currentItem.innerWidth() - parseInt(self.currentItem.css('paddingLeft')||0, 10) - parseInt(self.currentItem.css('paddingRight')||0, 10));
+					}
+				},
+				"update": function(event, ui) {
+					var p = $(ui.item).parent(),
+					th = $(">th", p),
+					colModel = ts.p.colModel,
+					cmMap = {}, tid= ts.p.id+"_";
+					$.each(colModel, function(i) { cmMap[this.name]=i; });
+					var permutation = [];
+					th.each(function(i) {
+						var id = $(">div", this).get(0).id.replace(/^jqgh_/, "").replace(tid,"");
+							if (id in cmMap) {
+								permutation.push(cmMap[id]);
+							}
+					});
+	
+					$(ts).jqGrid("remapColumns",permutation, true, true);
+					if ($.isFunction(ts.p.sortable.update)) {
+						ts.p.sortable.update(permutation);
+					}
+					setTimeout(function(){ts.p.disableClick=false;}, 50);
+				}
+			};
+			if (ts.p.sortable.options) {
+				$.extend(sortable_opts, ts.p.sortable.options);
+			} else if ($.isFunction(ts.p.sortable)) {
+				ts.p.sortable = { "update" : ts.p.sortable };
+			}
+			if (sortable_opts.start) {
+				var s = sortable_opts.start;
+				sortable_opts.start = function(e,ui) {
+					start();
+					s.call(this,e,ui);
+				};
+			} else {
+				sortable_opts.start = start;
+			}
+			if (ts.p.sortable.exclude) {
+				sortable_opts.items += ":not("+ts.p.sortable.exclude+")";
+			}
+			tblrow.sortable(sortable_opts).data("sortable").floating = true;
+		});
+	},
+    columnChooser : function(opts) {
+        var self = this;
+		if($("#colchooser_"+self[0].p.id).length ) { return; }
+        var selector = $('<div id="colchooser_'+self[0].p.id+'" style="position:relative;overflow:hidden"><div><select multiple="multiple"></select></div></div>');
+        var select = $('select', selector);
+		
+		function insert(perm,i,v) {
+			if(i>=0){
+				var a = perm.slice();
+				var b = a.splice(i,Math.max(perm.length-i,i));
+				if(i>perm.length) { i = perm.length; }
+				a[i] = v;
+				return a.concat(b);
+			}
+		}
+        opts = $.extend({
+            "width" : 420,
+            "height" : 240,
+            "classname" : null,
+            "done" : function(perm) { if (perm) { self.jqGrid("remapColumns", perm, true); } },
+            /* msel is either the name of a ui widget class that
+               extends a multiselect, or a function that supports
+               creating a multiselect object (with no argument,
+               or when passed an object), and destroying it (when
+               passed the string "destroy"). */
+            "msel" : "multiselect",
+            /* "msel_opts" : {}, */
+
+            /* dlog is either the name of a ui widget class that 
+               behaves in a dialog-like way, or a function, that
+               supports creating a dialog (when passed dlog_opts)
+               or destroying a dialog (when passed the string
+               "destroy")
+               */
+            "dlog" : "dialog",
+
+            /* dlog_opts is either an option object to be passed 
+               to "dlog", or (more likely) a function that creates
+               the options object.
+               The default produces a suitable options object for
+               ui.dialog */
+            "dlog_opts" : function(opts) {
+                var buttons = {};
+                buttons[opts.bSubmit] = function() {
+                    opts.apply_perm();
+                    opts.cleanup(false);
+                };
+                buttons[opts.bCancel] = function() {
+                    opts.cleanup(true);
+                };
+                return {
+                    "buttons": buttons,
+                    "close": function() {
+                        opts.cleanup(true);
+                    },
+					"modal" : opts.modal ? opts.modal : false,
+					"resizable": opts.resizable ? opts.resizable : true,
+                    "width": opts.width+20
+                };
+            },
+            /* Function to get the permutation array, and pass it to the
+               "done" function */
+            "apply_perm" : function() {
+                $('option',select).each(function(i) {
+                    if (this.selected) {
+                        self.jqGrid("showCol", colModel[this.value].name);
+                    } else {
+                        self.jqGrid("hideCol", colModel[this.value].name);
+                    }
+                });
+                
+                var perm = [];
+				//fixedCols.slice(0);
+                $('option:selected',select).each(function() { perm.push(parseInt(this.value,10)); });
+                $.each(perm, function() { delete colMap[colModel[parseInt(this,10)].name]; });
+                $.each(colMap, function() {
+					var ti = parseInt(this,10);
+					perm = insert(perm,ti,ti);
+				});
+                if (opts.done) {
+                    opts.done.call(self, perm);
+                }
+            },
+            /* Function to cleanup the dialog, and select. Also calls the
+               done function with no permutation (to indicate that the
+               columnChooser was aborted */
+            "cleanup" : function(calldone) {
+                call(opts.dlog, selector, 'destroy');
+                call(opts.msel, select, 'destroy');
+                selector.remove();
+                if (calldone && opts.done) {
+                    opts.done.call(self);
+                }
+            },
+			"msel_opts" : {}
+        }, $.jgrid.col, opts || {});
+		if($.ui) {
+			if ($.ui.multiselect ) {
+				if(opts.msel == "multiselect") {
+					if(!$.jgrid._multiselect) {
+						// should be in language file
+						alert("Multiselect plugin loaded after jqGrid. Please load the plugin before the jqGrid!");
+						return;
+					}
+					opts.msel_opts = $.extend($.ui.multiselect.defaults,opts.msel_opts);
+				}
+			}
+		}
+        if (opts.caption) {
+            selector.attr("title", opts.caption);
+        }
+        if (opts.classname) {
+            selector.addClass(opts.classname);
+            select.addClass(opts.classname);
+        }
+        if (opts.width) {
+            $(">div",selector).css({"width": opts.width,"margin":"0 auto"});
+            select.css("width", opts.width);
+        }
+        if (opts.height) {
+            $(">div",selector).css("height", opts.height);
+            select.css("height", opts.height - 10);
+        }
+        var colModel = self.jqGrid("getGridParam", "colModel");
+        var colNames = self.jqGrid("getGridParam", "colNames");
+        var colMap = {}, fixedCols = [];
+
+        select.empty();
+        $.each(colModel, function(i) {
+            colMap[this.name] = i;
+            if (this.hidedlg) {
+                if (!this.hidden) {
+                    fixedCols.push(i);
+                }
+                return;
+            }
+
+            select.append("<option value='"+i+"' "+
+                          (this.hidden?"":"selected='selected'")+">"+colNames[i]+"</option>");
+        });
+        function call(fn, obj) {
+            if (!fn) { return; }
+            if (typeof fn == 'string') {
+                if ($.fn[fn]) {
+                    $.fn[fn].apply(obj, $.makeArray(arguments).slice(2));
+                }
+            } else if ($.isFunction(fn)) {
+                fn.apply(obj, $.makeArray(arguments).slice(2));
+            }
+        }
+
+        var dopts = $.isFunction(opts.dlog_opts) ? opts.dlog_opts.call(self, opts) : opts.dlog_opts;
+        call(opts.dlog, selector, dopts);
+        var mopts = $.isFunction(opts.msel_opts) ? opts.msel_opts.call(self, opts) : opts.msel_opts;
+        call(opts.msel, select, mopts);
+    },
+	sortableRows : function (opts) {
+		// Can accept all sortable options and events
+		return this.each(function(){
+			var $t = this;
+			if(!$t.grid) { return; }
+			// Currently we disable a treeGrid sortable
+			if($t.p.treeGrid) { return; }
+			if($.fn.sortable) {
+				opts = $.extend({
+					"cursor":"move",
+					"axis" : "y",
+					"items": ".jqgrow"
+					},
+				opts || {});
+				if(opts.start && $.isFunction(opts.start)) {
+					opts._start_ = opts.start;
+					delete opts.start;
+				} else {opts._start_=false;}
+				if(opts.update && $.isFunction(opts.update)) {
+					opts._update_ = opts.update;
+					delete opts.update;
+				} else {opts._update_ = false;}
+				opts.start = function(ev,ui) {
+					$(ui.item).css("border-width","0px");
+					$("td",ui.item).each(function(i){
+						this.style.width = $t.grid.cols[i].style.width;
+					});
+					if($t.p.subGrid) {
+						var subgid = $(ui.item).attr("id");
+						try {
+							$($t).jqGrid('collapseSubGridRow',subgid);
+						} catch (e) {}
+					}
+					if(opts._start_) {
+						opts._start_.apply(this,[ev,ui]);
+					}
+				};
+				opts.update = function (ev,ui) {
+					$(ui.item).css("border-width","");
+					if($t.p.rownumbers === true) {
+						$("td.jqgrid-rownum",$t.rows).each(function( i ){
+							$(this).html( i+1+(parseInt($t.p.page,10)-1)*parseInt($t.p.rowNum,10) );
+						});
+					}
+					if(opts._update_) {
+						opts._update_.apply(this,[ev,ui]);
+					}
+				};
+				$("tbody:first",$t).sortable(opts);
+				$("tbody:first",$t).disableSelection();
+			}
+		});
+	},
+	gridDnD : function(opts) {
+		return this.each(function(){
+		var $t = this;
+		if(!$t.grid) { return; }
+		// Currently we disable a treeGrid drag and drop
+		if($t.p.treeGrid) { return; }
+		if(!$.fn.draggable || !$.fn.droppable) { return; }
+		function updateDnD ()
+		{
+			var datadnd = $.data($t,"dnd");
+		    $("tr.jqgrow:not(.ui-draggable)",$t).draggable($.isFunction(datadnd.drag) ? datadnd.drag.call($($t),datadnd) : datadnd.drag);
+		}
+		var appender = "<table id='jqgrid_dnd' class='ui-jqgrid-dnd'></table>";
+		if($("#jqgrid_dnd").html() === null) {
+			$('body').append(appender);
+		}
+
+		if(typeof opts == 'string' && opts == 'updateDnD' && $t.p.jqgdnd===true) {
+			updateDnD();
+			return;
+		}
+		opts = $.extend({
+			"drag" : function (opts) {
+				return $.extend({
+					start : function (ev, ui) {
+						// if we are in subgrid mode try to collapse the node
+						if($t.p.subGrid) {
+							var subgid = $(ui.helper).attr("id");
+							try {
+								$($t).jqGrid('collapseSubGridRow',subgid);
+							} catch (e) {}
+						}
+						// hack
+						// drag and drop does not insert tr in table, when the table has no rows
+						// we try to insert new empty row on the target(s)
+						for (var i=0;i<$.data($t,"dnd").connectWith.length;i++){
+							if($($.data($t,"dnd").connectWith[i]).jqGrid('getGridParam','reccount') == "0" ){
+								$($.data($t,"dnd").connectWith[i]).jqGrid('addRowData','jqg_empty_row',{});
+							}
+						}
+						ui.helper.addClass("ui-state-highlight");
+						$("td",ui.helper).each(function(i) {
+							this.style.width = $t.grid.headers[i].width+"px";
+						});
+						if(opts.onstart && $.isFunction(opts.onstart) ) { opts.onstart.call($($t),ev,ui); }
+					},
+					stop :function(ev,ui) {
+						if(ui.helper.dropped && !opts.dragcopy) {
+							var ids = $(ui.helper).attr("id");
+							$($t).jqGrid('delRowData',ids );
+						}
+						// if we have a empty row inserted from start event try to delete it
+						for (var i=0;i<$.data($t,"dnd").connectWith.length;i++){
+							$($.data($t,"dnd").connectWith[i]).jqGrid('delRowData','jqg_empty_row');
+						}
+						if(opts.onstop && $.isFunction(opts.onstop) ) { opts.onstop.call($($t),ev,ui); }
+					}
+				},opts.drag_opts || {});
+			},
+			"drop" : function (opts) {
+				return $.extend({
+					accept: function(d) {
+						if (!$(d).hasClass('jqgrow')) { return d;}
+						var tid = $(d).closest("table.ui-jqgrid-btable");
+						if(tid.length > 0 && $.data(tid[0],"dnd") !== undefined) {
+						    var cn = $.data(tid[0],"dnd").connectWith;
+						    return $.inArray('#'+this.id,cn) != -1 ? true : false;
+						}
+						return d;
+					},
+					drop: function(ev, ui) {
+						if (!$(ui.draggable).hasClass('jqgrow')) { return; }
+						var accept = $(ui.draggable).attr("id");
+						var getdata = ui.draggable.parent().parent().jqGrid('getRowData',accept);
+						if(!opts.dropbyname) {
+							var j =0, tmpdata = {}, dropname;
+							var dropmodel = $("#"+this.id).jqGrid('getGridParam','colModel');
+							try {
+								for (var key in getdata) {
+									if(getdata.hasOwnProperty(key) && dropmodel[j]) {
+										dropname = dropmodel[j].name;
+										tmpdata[dropname] = getdata[key];
+									}
+									j++;
+								}
+								getdata = tmpdata;
+							} catch (e) {}
+						}
+						ui.helper.dropped = true;
+						if(opts.beforedrop && $.isFunction(opts.beforedrop) ) {
+							//parameters to this callback - event, element, data to be inserted, sender, reciever
+							// should return object which will be inserted into the reciever
+							var datatoinsert = opts.beforedrop.call(this,ev,ui,getdata,$('#'+$t.id),$(this));
+							if (typeof datatoinsert != "undefined" && datatoinsert !== null && typeof datatoinsert == "object") { getdata = datatoinsert; }
+						}
+						if(ui.helper.dropped) {
+							var grid;
+							if(opts.autoid) {
+								if($.isFunction(opts.autoid)) {
+									grid = opts.autoid.call(this,getdata);
+								} else {
+									grid = Math.ceil(Math.random()*1000);
+									grid = opts.autoidprefix+grid;
+								}
+							}
+							// NULL is interpreted as undefined while null as object
+							$("#"+this.id).jqGrid('addRowData',grid,getdata,opts.droppos);
+						}
+						if(opts.ondrop && $.isFunction(opts.ondrop) ) { opts.ondrop.call(this,ev,ui, getdata); }
+					}}, opts.drop_opts || {});
+			},
+			"onstart" : null,
+			"onstop" : null,
+			"beforedrop": null,
+			"ondrop" : null,
+			"drop_opts" : {
+				"activeClass": "ui-state-active",
+				"hoverClass": "ui-state-hover"
+			},
+			"drag_opts" : {
+				"revert": "invalid",
+				"helper": "clone",
+				"cursor": "move",
+				"appendTo" : "#jqgrid_dnd",
+				"zIndex": 5000
+			},
+			"dragcopy": false,
+			"dropbyname" : false,
+			"droppos" : "first",
+			"autoid" : true,
+			"autoidprefix" : "dnd_"
+		}, opts || {});
+		
+		if(!opts.connectWith) { return; }
+		opts.connectWith = opts.connectWith.split(",");
+		opts.connectWith = $.map(opts.connectWith,function(n){return $.trim(n);});
+		$.data($t,"dnd",opts);
+		
+		if($t.p.reccount != "0" && !$t.p.jqgdnd) {
+			updateDnD();
+		}
+		$t.p.jqgdnd = true;
+		for (var i=0;i<opts.connectWith.length;i++){
+			var cn =opts.connectWith[i];
+			$(cn).droppable($.isFunction(opts.drop) ? opts.drop.call($($t),opts) : opts.drop);
+		}
+		});
+	},
+	gridResize : function(opts) {
+		return this.each(function(){
+			var $t = this;
+			if(!$t.grid || !$.fn.resizable) { return; }
+			opts = $.extend({}, opts || {});
+			if(opts.alsoResize ) {
+				opts._alsoResize_ = opts.alsoResize;
+				delete opts.alsoResize;
+			} else {
+				opts._alsoResize_ = false;
+			}
+			if(opts.stop && $.isFunction(opts.stop)) {
+				opts._stop_ = opts.stop;
+				delete opts.stop;
+			} else {
+				opts._stop_ = false;
+			}
+			opts.stop = function (ev, ui) {
+				$($t).jqGrid('setGridParam',{height:$("#gview_"+$t.p.id+" .ui-jqgrid-bdiv").height()});
+				$($t).jqGrid('setGridWidth',ui.size.width,opts.shrinkToFit);
+				if(opts._stop_) { opts._stop_.call($t,ev,ui); }
+			};
+			if(opts._alsoResize_) {
+				var optstest = "{\'#gview_"+$t.p.id+" .ui-jqgrid-bdiv\':true,'" +opts._alsoResize_+"':true}";
+				opts.alsoResize = eval('('+optstest+')'); // the only way that I found to do this
+			} else {
+				opts.alsoResize = $(".ui-jqgrid-bdiv","#gview_"+$t.p.id);
+			}
+			delete opts._alsoResize_;
+			$("#gbox_"+$t.p.id).resizable(opts);
+		});
+	}
+});
+})(jQuery);
Index: controlies/trunk/applications/controlies/static/js/jdgrid/src/grid.inlinedit.js
===================================================================
--- controlies/trunk/applications/controlies/static/js/jdgrid/src/grid.inlinedit.js	(revision 240)
+++ controlies/trunk/applications/controlies/static/js/jdgrid/src/grid.inlinedit.js	(revision 241)
@@ -1,249 +1,315 @@
-;(function($){
-/**
- * jqGrid extension for manipulating Grid Data
- * Tony Tomov tony@trirand.com
- * http://trirand.com/blog/ 
- * Dual licensed under the MIT and GPL licenses:
- * http://www.opensource.org/licenses/mit-license.php
- * http://www.gnu.org/licenses/gpl-2.0.html
-**/ 
-$.jgrid.extend({
-//Editing
-	editRow : function(rowid,keys,oneditfunc,succesfunc, url, extraparam, aftersavefunc,errorfunc, afterrestorefunc) {
-		return this.each(function(){
-			var $t = this, nm, tmp, editable, cnt=0, focus=null, svr={}, ind,cm;
-			if (!$t.grid ) { return; }
-			ind = $($t).jqGrid("getInd",rowid,true);
-			if( ind === false ) {return;}
-			editable = $(ind).attr("editable") || "0";
-			if (editable == "0" && !$(ind).hasClass("not-editable-row")) {
-				cm = $t.p.colModel;
-				$('td',ind).each( function(i) {
-					nm = cm[i].name;
-					var treeg = $t.p.treeGrid===true && nm == $t.p.ExpandColumn;
-					if(treeg) { tmp = $("span:first",this).html();}
-					else {
-						try {
-							tmp =  $.unformat(this,{rowId:rowid, colModel:cm[i]},i);
-						} catch (_) {
-							tmp = $(this).html();
-						}
-					}
-					if ( nm != 'cb' && nm != 'subgrid' && nm != 'rn') {
-						if($t.p.autoencode) { tmp = $.jgrid.htmlDecode(tmp); }
-						svr[nm]=tmp;
-						if(cm[i].editable===true) {
-							if(focus===null) { focus = i; }
-							if (treeg) { $("span:first",this).html(""); }
-							else { $(this).html(""); }
-							var opt = $.extend({},cm[i].editoptions || {},{id:rowid+"_"+nm,name:nm});
-							if(!cm[i].edittype) { cm[i].edittype = "text"; }
-							var elc = createEl(cm[i].edittype,opt,tmp,true,$.extend({},$.jgrid.ajaxOptions,$t.p.ajaxSelectOptions || {}));
-							$(elc).addClass("editable");
-							if(treeg) { $("span:first",this).append(elc); }
-							else { $(this).append(elc); }
-							//Again IE
-							if(cm[i].edittype == "select" && cm[i].editoptions.multiple===true && $.browser.msie) {
-								$(elc).width($(elc).width());
-							}
-							cnt++;
-						}
-					}
-				});
-				if(cnt > 0) {
-					svr.id = rowid; $t.p.savedRow.push(svr);
-					$(ind).attr("editable","1");
-					$("td:eq("+focus+") input",ind).focus();
-					if(keys===true) {
-						$(ind).bind("keydown",function(e) {
-							if (e.keyCode === 27) {$($t).jqGrid("restoreRow",rowid, afterrestorefunc);}
-							if (e.keyCode === 13) {
-								var ta = e.target;
-								if(ta.tagName == 'TEXTAREA') { return true; }
-								$($t).jqGrid("saveRow",rowid,succesfunc, url, extraparam, aftersavefunc,errorfunc, afterrestorefunc );
-								return false;
-							}
-							e.stopPropagation();
-						});
-					}
-					if( $.isFunction(oneditfunc)) { oneditfunc(rowid); }
-				}
-			}
-		});
-	},
-	saveRow : function(rowid, succesfunc, url, extraparam, aftersavefunc,errorfunc, afterrestorefunc) {
-		return this.each(function(){
-		var $t = this, nm, tmp={}, tmp2={}, editable, fr, cv, ind;
-		if (!$t.grid ) { return; }
-		ind = $($t).jqGrid("getInd",rowid,true);
-		if(ind === false) {return;}
-		editable = $(ind).attr("editable");
-		url = url ? url : $t.p.editurl;
-		if (editable==="1") {
-			var cm;
-			$("td",ind).each(function(i) {
-				cm = $t.p.colModel[i];
-				nm = cm.name;
-				if ( nm != 'cb' && nm != 'subgrid' && cm.editable===true && nm != 'rn') {
-					switch (cm.edittype) {
-						case "checkbox":
-							var cbv = ["Yes","No"];
-							if(cm.editoptions ) {
-								cbv = cm.editoptions.value.split(":");
-							}
-							tmp[nm]=  $("input",this).attr("checked") ? cbv[0] : cbv[1]; 
-							break;
-						case 'text':
-						case 'password':
-						case 'textarea':
-						case "button" :
-							tmp[nm]=$("input, textarea",this).val();
-							break;
-						case 'select':
-							if(!cm.editoptions.multiple) {
-								tmp[nm] = $("select>option:selected",this).val();
-								tmp2[nm] = $("select>option:selected", this).text();
-							} else {
-								var sel = $("select",this), selectedText = [];
-								tmp[nm] = $(sel).val();
-								if(tmp[nm]) { tmp[nm]= tmp[nm].join(","); } else { tmp[nm] =""; }
-								$("select > option:selected",this).each(
-									function(i,selected){
-										selectedText[i] = $(selected).text();
-									}
-								);
-								tmp2[nm] = selectedText.join(",");
-							}
-							if(cm.formatter && cm.formatter == 'select') { tmp2={}; }
-							break;
-						case 'custom' :
-							try {
-								if(cm.editoptions && $.isFunction(cm.editoptions.custom_value)) {
-									tmp[nm] = cm.editoptions.custom_value($(".customelement",this),'get');
-									if (tmp[nm] === undefined) { throw "e2"; }
-								} else { throw "e1"; }
-							} catch (e) {
-								if (e=="e1") { info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+$.jgrid.edit.msg.nodefined,jQuery.jgrid.edit.bClose); }
-								if (e=="e2") { info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+$.jgrid.edit.msg.novalue,jQuery.jgrid.edit.bClose); }
-								else { info_dialog(jQuery.jgrid.errors.errcap,e.message,jQuery.jgrid.edit.bClose); }
-							}
-							break;
-					}
-					cv = checkValues(tmp[nm],i,$t);
-					if(cv[0] === false) {
-						cv[1] = tmp[nm] + " " + cv[1];
-						return false;
-					}
-					if($t.p.autoencode) { tmp[nm] = $.jgrid.htmlEncode(tmp[nm]); }
-				}
-			});
-			if (cv[0] === false){
-				try {
-					var positions = findPos($("#"+rowid)[0]);
-					info_dialog($.jgrid.errors.errcap,cv[1],$.jgrid.edit.bClose,{left:positions[0],top:positions[1]});
-				} catch (e) {
-					alert(cv[1]);
-				}
-				return;
-			}
-			if(tmp) {
-				var idname, opers, oper;
-				opers = $t.p.prmNames;
-				oper = opers.oper;
-				idname = opers.id;
-				tmp[oper] = opers.editoper;
-				tmp[idname] = rowid;
-				if(typeof($t.p.inlineData) == 'undefined') { $t.p.inlineData ={}; }
-				if(typeof(extraparam) == 'undefined') { extraparam ={}; }
-				tmp = $.extend({},tmp,$t.p.inlineData,extraparam);
-			}
-			if (url == 'clientArray') {
-				tmp = $.extend({},tmp, tmp2);
-				if($t.p.autoencode) {
-					$.each(tmp,function(n,v){
-						tmp[n] = $.jgrid.htmlDecode(v);
-					});
-				}
-				var resp = $($t).jqGrid("setRowData",rowid,tmp);
-				$(ind).attr("editable","0");
-				for( var k=0;k<$t.p.savedRow.length;k++) {
-					if( $t.p.savedRow[k].id == rowid) {fr = k; break;}
-				}
-				if(fr >= 0) { $t.p.savedRow.splice(fr,1); }
-				if( $.isFunction(aftersavefunc) ) { aftersavefunc(rowid,resp); }
-			} else {
-				$("#lui_"+$t.p.id).show();
-				$.ajax($.extend({
-					url:url,
-					data: $.isFunction($t.p.serializeRowData) ? $t.p.serializeRowData(tmp) : tmp,
-					type: "POST",
-					complete: function(res,stat){
-						$("#lui_"+$t.p.id).hide();
-						if (stat === "success"){
-							var ret;
-							if( $.isFunction(succesfunc)) { ret = succesfunc(res);}
-							else { ret = true; }
-							if (ret===true) {
-								if($t.p.autoencode) {
-									$.each(tmp,function(n,v){
-										tmp[n] = $.jgrid.htmlDecode(v);
-									});
-								}
-								tmp = $.extend({},tmp, tmp2);
-								$($t).jqGrid("setRowData",rowid,tmp);
-								$(ind).attr("editable","0");
-								for( var k=0;k<$t.p.savedRow.length;k++) {
-									if( $t.p.savedRow[k].id == rowid) {fr = k; break;}
-								}
-								if(fr >= 0) { $t.p.savedRow.splice(fr,1); }
-								if( $.isFunction(aftersavefunc) ) { aftersavefunc(rowid,res); }
-							} else { $($t).jqGrid("restoreRow",rowid, afterrestorefunc); }
-						}
-					},
-					error:function(res,stat){
-						$("#lui_"+$t.p.id).hide();
-						if($.isFunction(errorfunc) ) {
-							errorfunc(rowid, res, stat);
-						} else {
-							alert("Error Row: "+rowid+" Result: " +res.status+":"+res.statusText+" Status: "+stat);
-						}
-					}
-				}, $.jgrid.ajaxOptions, $t.p.ajaxRowOptions || {}));
-			}
-			$(ind).unbind("keydown");
-		}
-		});
-	},
-	restoreRow : function(rowid, afterrestorefunc) {
-		return this.each(function(){
-			var $t= this, fr, ind, ares={};
-			if (!$t.grid ) { return; }
-			ind = $($t).jqGrid("getInd",rowid,true);
-			if(ind === false) {return;}
-			for( var k=0;k<$t.p.savedRow.length;k++) {
-				if( $t.p.savedRow[k].id == rowid) {fr = k; break;}
-			}
-			if(fr >= 0) {
-				if($.isFunction($.fn.datepicker)) {
-					try {
-						$("input.hasDatepicker","#"+ind.id).datepicker('hide');
-					} catch (e) {}
-				}
-				$.each($t.p.colModel, function(i,n){
-					if(this.editable === true && this.name in $t.p.savedRow[fr]) {
-						ares[this.name] = $t.p.savedRow[fr][this.name];
-					}
-				});
-				$($t).jqGrid("setRowData",rowid,ares);
-				$(ind).attr("editable","0").unbind("keydown");
-				$t.p.savedRow.splice(fr,1);
-			}
-			if ($.isFunction(afterrestorefunc))
-			{
-				afterrestorefunc(rowid);
-			}
-		});
-	}
-//end inline edit
-});
-})(jQuery);
+;(function($){
+/**
+ * jqGrid extension for manipulating Grid Data
+ * Tony Tomov tony@trirand.com
+ * http://trirand.com/blog/ 
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl-2.0.html
+**/ 
+$.jgrid.extend({
+//Editing
+	editRow : function(rowid,keys,oneditfunc,successfunc, url, extraparam, aftersavefunc,errorfunc, afterrestorefunc) {
+		// Compatible mode old versions
+		var settings = {
+			"keys" : keys || false,
+			"oneditfunc" : oneditfunc || null,
+			"successfunc" : successfunc || null,
+			"url" : url || null,
+			"extraparam" : extraparam || {},
+			"aftersavefunc" : aftersavefunc || null,
+			"errorfunc": errorfunc || null,
+			"afterrestorefunc" : afterrestorefunc|| null,
+			"restoreAfterError" : true,
+			"mtype" : "POST"
+		},
+		args = $.makeArray(arguments).slice(1), o;
+
+		if(args[0] && typeof(args[0]) == "object" && !$.isFunction(args[0])) {
+			o = $.extend(settings,args[0]);
+		} else {
+			o = settings;
+		}
+		// End compatible
+		return this.each(function(){
+			var $t = this, nm, tmp, editable, cnt=0, focus=null, svr={}, ind,cm;
+			if (!$t.grid ) { return; }
+			ind = $($t).jqGrid("getInd",rowid,true);
+			if( ind === false ) {return;}
+			editable = $(ind).attr("editable") || "0";
+			if (editable == "0" && !$(ind).hasClass("not-editable-row")) {
+				cm = $t.p.colModel;
+				$('td',ind).each( function(i) {
+					nm = cm[i].name;
+					var treeg = $t.p.treeGrid===true && nm == $t.p.ExpandColumn;
+					if(treeg) { tmp = $("span:first",this).html();}
+					else {
+						try {
+							tmp =  $.unformat(this,{rowId:rowid, colModel:cm[i]},i);
+						} catch (_) {
+							tmp =  ( cm[i].edittype && cm[i].edittype == 'textarea' ) ? $(this).text() : $(this).html();
+						}
+					}
+					if ( nm != 'cb' && nm != 'subgrid' && nm != 'rn') {
+						if($t.p.autoencode) { tmp = $.jgrid.htmlDecode(tmp); }
+						svr[nm]=tmp;
+						if(cm[i].editable===true) {
+							if(focus===null) { focus = i; }
+							if (treeg) { $("span:first",this).html(""); }
+							else { $(this).html(""); }
+							var opt = $.extend({},cm[i].editoptions || {},{id:rowid+"_"+nm,name:nm});
+							if(!cm[i].edittype) { cm[i].edittype = "text"; }
+							if(tmp == "&nbsp;" || tmp == "&#160;" || (tmp.length==1 && tmp.charCodeAt(0)==160) ) {tmp='';}
+							var elc = $.jgrid.createEl(cm[i].edittype,opt,tmp,true,$.extend({},$.jgrid.ajaxOptions,$t.p.ajaxSelectOptions || {}));
+							$(elc).addClass("editable");
+							if(treeg) { $("span:first",this).append(elc); }
+							else { $(this).append(elc); }
+							//Again IE
+							if(cm[i].edittype == "select" && typeof(cm[i].editoptions)!=="undefined" && cm[i].editoptions.multiple===true  && typeof(cm[i].editoptions.dataUrl)==="undefined" && $.browser.msie) {
+								$(elc).width($(elc).width());
+							}
+							cnt++;
+						}
+					}
+				});
+				if(cnt > 0) {
+					svr.id = rowid; $t.p.savedRow.push(svr);
+					$(ind).attr("editable","1");
+					$("td:eq("+focus+") input",ind).focus();
+					if(o.keys===true) {
+						$(ind).bind("keydown",function(e) {
+							if (e.keyCode === 27) {$($t).jqGrid("restoreRow",rowid, afterrestorefunc);}
+							if (e.keyCode === 13) {
+								var ta = e.target;
+								if(ta.tagName == 'TEXTAREA') { return true; }
+								$($t).jqGrid("saveRow", rowid, o );
+								return false;
+							}
+							e.stopPropagation();
+						});
+					}
+					if( $.isFunction(o.oneditfunc)) { o.oneditfunc.call($t, rowid); }
+				}
+			}
+		});
+	},
+	saveRow : function(rowid, successfunc, url, extraparam, aftersavefunc,errorfunc, afterrestorefunc) {
+		// Compatible mode old versions
+		var settings = {
+			"successfunc" : successfunc || null,
+			"url" : url || null,
+			"extraparam" : extraparam || {},
+			"aftersavefunc" : aftersavefunc || null,
+			"errorfunc": errorfunc || null,
+			"afterrestorefunc" : afterrestorefunc|| null,
+			"restoreAfterError" : true,
+			"mtype" : "POST"
+		},
+		args = $.makeArray(arguments).slice(1), o;
+
+		if(args[0] && typeof(args[0]) == "object" && !$.isFunction(args[0])) {
+			o = $.extend(settings,args[0]);
+		} else {
+			o = settings;
+		}
+		// End compatible
+		var success = false;
+		var $t = this[0], nm, tmp={}, tmp2={}, tmp3= {}, editable, fr, cv, ind;
+		if (!$t.grid ) { return success; }
+		ind = $($t).jqGrid("getInd",rowid,true);
+		if(ind === false) {return success;}
+		editable = $(ind).attr("editable");
+		o.url = o.url ? o.url : $t.p.editurl;
+		if (editable==="1") {
+			var cm;
+			$("td",ind).each(function(i) {
+				cm = $t.p.colModel[i];
+				nm = cm.name;
+				if ( nm != 'cb' && nm != 'subgrid' && cm.editable===true && nm != 'rn' && !$(this).hasClass('not-editable-cell')) {
+					switch (cm.edittype) {
+						case "checkbox":
+							var cbv = ["Yes","No"];
+							if(cm.editoptions ) {
+								cbv = cm.editoptions.value.split(":");
+							}
+							tmp[nm]=  $("input",this).is(":checked") ? cbv[0] : cbv[1]; 
+							break;
+						case 'text':
+						case 'password':
+						case 'textarea':
+						case "button" :
+							tmp[nm]=$("input, textarea",this).val();
+							break;
+						case 'select':
+							if(!cm.editoptions.multiple) {
+								tmp[nm] = $("select option:selected",this).val();
+								tmp2[nm] = $("select option:selected", this).text();
+							} else {
+								var sel = $("select",this), selectedText = [];
+								tmp[nm] = $(sel).val();
+								if(tmp[nm]) { tmp[nm]= tmp[nm].join(","); } else { tmp[nm] =""; }
+								$("select option:selected",this).each(
+									function(i,selected){
+										selectedText[i] = $(selected).text();
+									}
+								);
+								tmp2[nm] = selectedText.join(",");
+							}
+							if(cm.formatter && cm.formatter == 'select') { tmp2={}; }
+							break;
+						case 'custom' :
+							try {
+								if(cm.editoptions && $.isFunction(cm.editoptions.custom_value)) {
+									tmp[nm] = cm.editoptions.custom_value.call($t, $(".customelement",this),'get');
+									if (tmp[nm] === undefined) { throw "e2"; }
+								} else { throw "e1"; }
+							} catch (e) {
+								if (e=="e1") { $.jgrid.info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+$.jgrid.edit.msg.nodefined,jQuery.jgrid.edit.bClose); }
+								if (e=="e2") { $.jgrid.info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+$.jgrid.edit.msg.novalue,jQuery.jgrid.edit.bClose); }
+								else { $.jgrid.info_dialog(jQuery.jgrid.errors.errcap,e.message,jQuery.jgrid.edit.bClose); }
+							}
+							break;
+					}
+					cv = $.jgrid.checkValues(tmp[nm],i,$t);
+					if(cv[0] === false) {
+						cv[1] = tmp[nm] + " " + cv[1];
+						return false;
+					}
+					if($t.p.autoencode) { tmp[nm] = $.jgrid.htmlEncode(tmp[nm]); }
+					if(o.url !== 'clientArray' && cm.editoptions && cm.editoptions.NullIfEmpty === true) {
+						if(tmp[nm] == "") {
+							tmp3[nm] = 'null';
+				}
+					}
+				}
+			});
+			if (cv[0] === false){
+				try {
+					var positions = $.jgrid.findPos($("#"+$.jgrid.jqID(rowid), $t.grid.bDiv)[0]);
+					$.jgrid.info_dialog($.jgrid.errors.errcap,cv[1],$.jgrid.edit.bClose,{left:positions[0],top:positions[1]});
+				} catch (e) {
+					alert(cv[1]);
+				}
+				return success;
+			}
+			var idname, opers, oper;
+			opers = $t.p.prmNames;
+			oper = opers.oper;
+			idname = opers.id;
+			if(tmp) {
+				tmp[oper] = opers.editoper;
+				tmp[idname] = rowid;
+				if(typeof($t.p.inlineData) == 'undefined') { $t.p.inlineData ={}; }
+				tmp = $.extend({},tmp,$t.p.inlineData,o.extraparam);
+			}
+			if (o.url == 'clientArray') {
+				tmp = $.extend({},tmp, tmp2);
+				if($t.p.autoencode) {
+					$.each(tmp,function(n,v){
+						tmp[n] = $.jgrid.htmlDecode(v);
+					});
+				}
+				var resp = $($t).jqGrid("setRowData",rowid,tmp);
+				$(ind).attr("editable","0");
+				for( var k=0;k<$t.p.savedRow.length;k++) {
+					if( $t.p.savedRow[k].id == rowid) {fr = k; break;}
+				}
+				if(fr >= 0) { $t.p.savedRow.splice(fr,1); }
+				if( $.isFunction(o.aftersavefunc) ) { o.aftersavefunc.call($t, rowid,resp); }
+				success = true;
+				$(ind).unbind("keydown");
+			} else {
+				$("#lui_"+$t.p.id).show();
+				tmp3 = $.extend({},tmp,tmp3);
+				tmp3[idname] = $.jgrid.stripPref($t.p.idPrefix, tmp3[idname]);
+				$.ajax($.extend({
+					url:o.url,
+					data: $.isFunction($t.p.serializeRowData) ? $t.p.serializeRowData.call($t, tmp3) : tmp3,
+					type: o.mtype,
+					async : false, //?!?
+					complete: function(res,stat){
+						$("#lui_"+$t.p.id).hide();
+						if (stat === "success"){
+							var ret;
+							if( $.isFunction(o.successfunc)) { ret = o.successfunc.call($t, res);}
+							else { ret = true; }
+							if (ret===true) {
+								if($t.p.autoencode) {
+									$.each(tmp,function(n,v){
+										tmp[n] = $.jgrid.htmlDecode(v);
+									});
+								}
+								tmp = $.extend({},tmp, tmp2);
+								$($t).jqGrid("setRowData",rowid,tmp);
+								$(ind).attr("editable","0");
+								for( var k=0;k<$t.p.savedRow.length;k++) {
+									if( $t.p.savedRow[k].id == rowid) {fr = k; break;}
+								}
+								if(fr >= 0) { $t.p.savedRow.splice(fr,1); }
+								if( $.isFunction(o.aftersavefunc) ) { o.aftersavefunc.call($t, rowid,res); }
+								success = true;
+								$(ind).unbind("keydown");
+							} else {
+								if($.isFunction(o.errorfunc) ) {
+									o.errorfunc.call($t, rowid, res, stat);
+								}
+								if(o.restoreAfterError === true) {
+									$($t).jqGrid("restoreRow",rowid, o.afterrestorefunc);
+							}
+						}
+						}
+					},
+					error:function(res,stat){
+						$("#lui_"+$t.p.id).hide();
+						if($.isFunction(o.errorfunc) ) {
+							o.errorfunc.call($t, rowid, res, stat);
+						} else {
+							try {
+								jQuery.jgrid.info_dialog(jQuery.jgrid.errors.errcap,'<div class="ui-state-error">'+ res.responseText +'</div>', jQuery.jgrid.edit.bClose,{buttonalign:'right'});
+						}
+							catch(e) {
+								alert(res.responseText);
+					}
+						}
+						if(o.restoreAfterError === true) {
+							$($t).jqGrid("restoreRow",rowid, o.afterrestorefunc);
+						}
+					}
+				}, $.jgrid.ajaxOptions, $t.p.ajaxRowOptions || {}));
+			}
+		}
+		return success;
+	},
+	restoreRow : function(rowid, afterrestorefunc) {
+		return this.each(function(){
+			var $t= this, fr, ind, ares={};
+			if (!$t.grid ) { return; }
+			ind = $($t).jqGrid("getInd",rowid,true);
+			if(ind === false) {return;}
+			for( var k=0;k<$t.p.savedRow.length;k++) {
+				if( $t.p.savedRow[k].id == rowid) {fr = k; break;}
+			}
+			if(fr >= 0) {
+				if($.isFunction($.fn.datepicker)) {
+					try {
+						$("input.hasDatepicker","#"+$.jgrid.jqID(ind.id)).datepicker('hide');
+					} catch (e) {}
+				}
+				$.each($t.p.colModel, function(i,n){
+					if(this.editable === true && this.name in $t.p.savedRow[fr] && !$(this).hasClass('not-editable-cell')) {
+						ares[this.name] = $t.p.savedRow[fr][this.name];
+					}
+				});
+				$($t).jqGrid("setRowData",rowid,ares);
+				$(ind).attr("editable","0").unbind("keydown");
+				$t.p.savedRow.splice(fr,1);
+			}
+			if ($.isFunction(afterrestorefunc))
+			{
+				afterrestorefunc.call($t, rowid);
+			}
+		});
+	}
+//end inline edit
+});
+})(jQuery);
Index: controlies/trunk/applications/controlies/static/js/jdgrid/src/i18n/grid.locale-sv.js
===================================================================
--- controlies/trunk/applications/controlies/static/js/jdgrid/src/i18n/grid.locale-sv.js	(revision 240)
+++ controlies/trunk/applications/controlies/static/js/jdgrid/src/i18n/grid.locale-sv.js	(revision 241)
@@ -1,127 +1,127 @@
-;(function($){
-/**
- * jqGrid Swedish Translation
- * Harald Normann harald.normann@wts.se, harald.normann@gmail.com
- * http://www.worldteamsoftware.com 
- * Dual licensed under the MIT and GPL licenses:
- * http://www.opensource.org/licenses/mit-license.php
- * http://www.gnu.org/licenses/gpl.html
-**/
-$.jgrid = {
-	defaults : {
-		recordtext: "Visar {0} - {1} av {2}",
-		emptyrecords: "Det finns inga poster att visa",
-		loadtext: "Laddar...",
-		pgtext : "Sida {0} av {1}"
-	},
-	search : {
-		caption: "Sök Poster - Ange sökvillkor",
-		Find: "Sök",
-		Reset: "Nollställ Villkor",
-		odata : ['lika', 'ej lika', 'mindre', 'mindre eller lika','större','större eller lika', 'börjar med','börjar inte med','tillhör','tillhör inte','slutar med','slutar inte med','innehåller','innehåller inte'],
-		groupOps: [	{ op: "AND", text: "alla" },	{ op: "OR",  text: "eller" }	],
-		matchText: " träff",
-		rulesText: " regler"
-	},
-	edit : {
-		addCaption: "Ny Post",
-		editCaption: "Redigera Post",
-		bSubmit: "Spara",
-		bCancel: "Avbryt",
-		bClose: "Stäng",
-		saveData: "Data har ändrats! Spara förändringar?",
-		bYes : "Ja",
-		bNo : "Nej",
-		bExit : "Avbryt",
-		msg: {
-	        required:"Fältet är obligatoriskt",
-	        number:"Välj korrekt nummer",
-	        minValue:"värdet måste vara större än eller lika med",
-	        maxValue:"värdet måste vara mindre än eller lika med",
-	        email: "är inte korrekt e-post adress",
-	        integer: "Var god ange korrekt heltal",
-	        date: "Var god ange korrekt datum",
-	        url: "är inte en korrekt URL. Prefix måste anges ('http://' or 'https://')",
-	        nodefined : " är inte definierad!",
-	        novalue : " returvärde måste anges!",
-	        customarray : "Custom funktion måste returnera en vektor!",
-			customfcheck : "Custom funktion måste finnas om Custom kontroll sker!"
-		}
-	},
-	view : {
-		caption: "Visa Post",
-		bClose: "Stäng"
-	},
-	del : {
-		caption: "Radera",
-		msg: "Radera markerad(e) post(er)?",
-		bSubmit: "Radera",
-		bCancel: "Avbryt"
-	},
-	nav : {
-		edittext: "",
-		edittitle: "Redigera markerad rad",
-		addtext:"",
-		addtitle: "Skapa ny post",
-		deltext: "",
-		deltitle: "Radera markerad rad",
-		searchtext: "",
-		searchtitle: "Sök poster",
-		refreshtext: "",
-		refreshtitle: "Uppdatera data",
-		alertcap: "Varning",
-		alerttext: "Ingen rad är markerad",
-		viewtext: "",
-		viewtitle: "Visa markerad rad"
-	},
-	col : {
-		caption: "Välj Kolumner",
-		bSubmit: "OK",
-		bCancel: "Avbryt"
-	},
-	errors : {
-		errcap : "Fel",
-		nourl : "URL saknas",
-		norecords: "Det finns inga poster att bearbeta",
-		model : "Antal colNames <> colModel!"
-	},
-	formatter : {
-		integer : {thousandsSeparator: " ", defaultValue: '0'},
-		number : {decimalSeparator:",", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0,00'},
-		currency : {decimalSeparator:",", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"Kr", defaultValue: '0,00'},
-		date : {
-			dayNames:   [
-				"Sön", "Mån", "Tis", "Ons", "Tor", "Fre", "Lör",
-				"Söndag", "Måndag", "Tisdag", "Onsdag", "Torsdag", "Fredag", "Lördag"
-			],
-			monthNames: [
-				"Jan", "Feb", "Mar", "Apr", "Maj", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dec",
-				"Januari", "Februari", "Mars", "April", "Maj", "Juni", "Juli", "Augusti", "September", "Oktober", "November", "December"
-			],
-			AmPm : ["fm","em","FM","EM"],
-			S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'},
-			srcformat: 'Y-m-d',
-			newformat: 'Y-m-d',
-			masks : {
-	            ISO8601Long:"Y-m-d H:i:s",
-	            ISO8601Short:"Y-m-d",
-	            ShortDate:  "n/j/Y",
-	            LongDate: "l, F d, Y",
-	            FullDateTime: "l, F d, Y g:i:s A",
-	            MonthDay: "F d",
-	            ShortTime: "g:i A",
-	            LongTime: "g:i:s A",
-	            SortableDateTime: "Y-m-d\\TH:i:s",
-	            UniversalSortableDateTime: "Y-m-d H:i:sO",
-	            YearMonth: "F, Y"
-			},
-			reformatAfterEdit : false
-		},
-		baseLinkUrl: '',
-		showAction: '',
-		target: '',
-		checkbox : {disabled:true},
-		idName : 'id'
-	}
-};
-})(jQuery);
+;(function($){
+/**
+ * jqGrid Swedish Translation
+ * Harald Normann harald.normann@wts.se, harald.normann@gmail.com
+ * http://www.worldteamsoftware.com 
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl.html
+**/
+$.jgrid = {
+	defaults : {
+		recordtext: "Visar {0} - {1} av {2}",
+		emptyrecords: "Det finns inga poster att visa",
+		loadtext: "Laddar...",
+		pgtext : "Sida {0} av {1}"
+	},
+	search : {
+		caption: "Sök Poster - Ange sökvillkor",
+		Find: "Sök",
+		Reset: "Nollställ Villkor",
+		odata : ['lika', 'ej lika', 'mindre', 'mindre eller lika','större','större eller lika', 'börjar med','börjar inte med','tillhör','tillhör inte','slutar med','slutar inte med','innehåller','innehåller inte'],
+		groupOps: [	{ op: "AND", text: "alla" },	{ op: "OR",  text: "eller" }	],
+		matchText: " träff",
+		rulesText: " regler"
+	},
+	edit : {
+		addCaption: "Ny Post",
+		editCaption: "Redigera Post",
+		bSubmit: "Spara",
+		bCancel: "Avbryt",
+		bClose: "Stäng",
+		saveData: "Data har ändrats! Spara förändringar?",
+		bYes : "Ja",
+		bNo : "Nej",
+		bExit : "Avbryt",
+		msg: {
+	        required:"Fältet är obligatoriskt",
+	        number:"Välj korrekt nummer",
+	        minValue:"värdet måste vara större än eller lika med",
+	        maxValue:"värdet måste vara mindre än eller lika med",
+	        email: "är inte korrekt e-post adress",
+	        integer: "Var god ange korrekt heltal",
+	        date: "Var god ange korrekt datum",
+	        url: "är inte en korrekt URL. Prefix måste anges ('http://' or 'https://')",
+	        nodefined : " är inte definierad!",
+	        novalue : " returvärde måste anges!",
+	        customarray : "Custom funktion måste returnera en vektor!",
+			customfcheck : "Custom funktion måste finnas om Custom kontroll sker!"
+		}
+	},
+	view : {
+		caption: "Visa Post",
+		bClose: "Stäng"
+	},
+	del : {
+		caption: "Radera",
+		msg: "Radera markerad(e) post(er)?",
+		bSubmit: "Radera",
+		bCancel: "Avbryt"
+	},
+	nav : {
+		edittext: "",
+		edittitle: "Redigera markerad rad",
+		addtext:"",
+		addtitle: "Skapa ny post",
+		deltext: "",
+		deltitle: "Radera markerad rad",
+		searchtext: "",
+		searchtitle: "Sök poster",
+		refreshtext: "",
+		refreshtitle: "Uppdatera data",
+		alertcap: "Varning",
+		alerttext: "Ingen rad är markerad",
+		viewtext: "",
+		viewtitle: "Visa markerad rad"
+	},
+	col : {
+		caption: "Välj Kolumner",
+		bSubmit: "OK",
+		bCancel: "Avbryt"
+	},
+	errors : {
+		errcap : "Fel",
+		nourl : "URL saknas",
+		norecords: "Det finns inga poster att bearbeta",
+		model : "Antal colNames <> colModel!"
+	},
+	formatter : {
+		integer : {thousandsSeparator: " ", defaultValue: '0'},
+		number : {decimalSeparator:",", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0,00'},
+		currency : {decimalSeparator:",", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"Kr", defaultValue: '0,00'},
+		date : {
+			dayNames:   [
+				"Sön", "Mån", "Tis", "Ons", "Tor", "Fre", "Lör",
+				"Söndag", "Måndag", "Tisdag", "Onsdag", "Torsdag", "Fredag", "Lördag"
+			],
+			monthNames: [
+				"Jan", "Feb", "Mar", "Apr", "Maj", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dec",
+				"Januari", "Februari", "Mars", "April", "Maj", "Juni", "Juli", "Augusti", "September", "Oktober", "November", "December"
+			],
+			AmPm : ["fm","em","FM","EM"],
+			S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'},
+			srcformat: 'Y-m-d',
+			newformat: 'Y-m-d',
+			masks : {
+	            ISO8601Long:"Y-m-d H:i:s",
+	            ISO8601Short:"Y-m-d",
+	            ShortDate:  "n/j/Y",
+	            LongDate: "l, F d, Y",
+	            FullDateTime: "l, F d, Y g:i:s A",
+	            MonthDay: "F d",
+	            ShortTime: "g:i A",
+	            LongTime: "g:i:s A",
+	            SortableDateTime: "Y-m-d\\TH:i:s",
+	            UniversalSortableDateTime: "Y-m-d H:i:sO",
+	            YearMonth: "F, Y"
+			},
+			reformatAfterEdit : false
+		},
+		baseLinkUrl: '',
+		showAction: '',
+		target: '',
+		checkbox : {disabled:true},
+		idName : 'id'
+	}
+};
+})(jQuery);
Index: controlies/trunk/applications/controlies/static/js/jdgrid/src/i18n/grid.locale-bg.js
===================================================================
--- controlies/trunk/applications/controlies/static/js/jdgrid/src/i18n/grid.locale-bg.js	(revision 240)
+++ controlies/trunk/applications/controlies/static/js/jdgrid/src/i18n/grid.locale-bg.js	(revision 241)
@@ -1,132 +1,132 @@
-;(function($){
-/**
- * jqGrid Bulgarian Translation 
- * Tony Tomov tony@trirand.com
- * http://trirand.com/blog/ 
- * Dual licensed under the MIT and GPL licenses:
- * http://www.opensource.org/licenses/mit-license.php
- * http://www.gnu.org/licenses/gpl.html
-**/
-$.jgrid = {
-	defaults : {
-		recordtext: "{0} - {1} от {2}",
-		emptyrecords: "Няма запис(и)",
-		loadtext: "Зареждам...",
-		pgtext : "Стр. {0} от {1}"
-	},
-	search : {
-		caption: "Търсене...",
-		Find: "Намери",
-		Reset: "Изчисти",
-		odata : ['равно', 'различно', 'по-малко', 'по-малко или=','по-голямо','по-голямо или =', 'започва с','не започва с','се намира в','не се намира в','завършва с','не завършава с','съдържа', 'не съдържа' ],
-	    groupOps: [	{ op: "AND", text: "&nbsp;И " },	{ op: "OR",  text: "ИЛИ" }	],
-		matchText: " включи",
-		rulesText: " клауза"
-	},
-	edit : {
-		addCaption: "Нов Запис",
-		editCaption: "Редакция Запис",
-		bSubmit: "Запиши",
-		bCancel: "Изход",
-		bClose: "Затвори",
-		saveData: "Данните са променени! Да съхраня ли промените?",
-		bYes : "Да",
-		bNo : "Не",
-		bExit : "Отказ",
-		msg: {
-			required:"Полето е задължително",
-			number:"Въведете валидно число!",
-			minValue:"стойността трябва да е по-голяма или равна от",
-			maxValue:"стойността трябва да е по-малка или равна от",
-			email: "не е валиден ел. адрес",
-			integer: "Въведете валидно цяло число",
-			date: "Въведете валидна дата",
-			url: "e невалиден URL. Изискава се префикс('http://' или 'https://')",
-			nodefined : " е недефинирана!",
-			novalue : " изисква връщане на стойност!",
-			customarray : "Потреб. Функция трябва да върне масив!",
-			customfcheck : "Потребителска функция е задължителна при този тип елемент!"
-		}
-	},
-	view : {
-		caption: "Преглед запис",
-		bClose: "Затвори"
-	},
-	del : {
-		caption: "Изтриване",
-		msg: "Да изтрия ли избраният запис?",
-		bSubmit: "Изтрий",
-		bCancel: "Отказ"
-	},
-	nav : {
-		edittext: " ",
-		edittitle: "Редакция избран запис",
-		addtext:" ",
-		addtitle: "Добавяне нов запис",
-		deltext: " ",
-		deltitle: "Изтриване избран запис",
-		searchtext: " ",
-		searchtitle: "Търсене запис(и)",
-		refreshtext: "",
-		refreshtitle: "Обнови таблица",
-		alertcap: "Предупреждение",
-		alerttext: "Моля, изберете запис",
-		viewtext: "",
-		viewtitle: "Преглед избран запис"
-	},
-	col : {
-		caption: "Избери колони",
-		bSubmit: "Ок",
-		bCancel: "Изход"	
-	},
-	errors : {
-		errcap : "Грешка",
-		nourl : "Няма посочен url адрес",
-		norecords: "Няма запис за обработка",
-		model : "Модела не съответства на имената!"	
-	},
-	formatter : {
-		integer : {thousandsSeparator: " ", defaultValue: '0'},
-		number : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0.00'},
-		currency : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:" лв.", defaultValue: '0.00'},
-		date : {
-			dayNames:   [
-				"Нед", "Пон", "Вт", "Ср", "Чет", "Пет", "Съб",
-				"Неделя", "Понеделник", "Вторник", "Сряда", "Четвъртък", "Петък", "Събота"
-			],
-			monthNames: [
-				"Яну", "Фев", "Мар", "Апр", "Май", "Юни", "Юли", "Авг", "Сеп", "Окт", "Нов", "Дек",
-				"Януари", "Февруари", "Март", "Април", "Май", "Юни", "Юли", "Август", "Септември", "Октомври", "Ноември", "Декември"
-			],
-			AmPm : ["","","",""],
-			S: function (j) {
-				if(j==7 || j==8 || j== 27 || j== 28) {
-					return 'ми';
-				}
-				return ['ви', 'ри', 'ти'][Math.min((j - 1) % 10, 2)];
-			},
-			srcformat: 'Y-m-d',
-			newformat: 'd/m/Y',
-			masks : {
-				ISO8601Long:"Y-m-d H:i:s",
-				ISO8601Short:"Y-m-d",
-				ShortDate: "n/j/Y",
-				LongDate: "l, F d, Y",
-				FullDateTime: "l, F d, Y g:i:s A",
-				MonthDay: "F d",
-				ShortTime: "g:i A",
-				LongTime: "g:i:s A",
-				SortableDateTime: "Y-m-d\\TH:i:s",
-				UniversalSortableDateTime: "Y-m-d H:i:sO",
-				YearMonth: "F, Y"
-			},
-			reformatAfterEdit : false
-		},
-		baseLinkUrl: '',
-		showAction: '',
-		target: '',
-		checkbox : {disabled:true},
-		idName : 'id'
-	}
-};
-})(jQuery);
+;(function($){
+/**
+ * jqGrid Bulgarian Translation 
+ * Tony Tomov tony@trirand.com
+ * http://trirand.com/blog/ 
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl.html
+**/
+$.jgrid = {
+	defaults : {
+		recordtext: "{0} - {1} от {2}",
+		emptyrecords: "Няма запис(и)",
+		loadtext: "Зареждам...",
+		pgtext : "Стр. {0} от {1}"
+	},
+	search : {
+		caption: "Търсене...",
+		Find: "Намери",
+		Reset: "Изчисти",
+		odata : ['равно', 'различно', 'по-малко', 'по-малко или=','по-голямо','по-голямо или =', 'започва с','не започва с','се намира в','не се намира в','завършва с','не завършава с','съдържа', 'не съдържа' ],
+	    groupOps: [	{ op: "AND", text: "&nbsp;И " },	{ op: "OR",  text: "ИЛИ" }	],
+		matchText: " включи",
+		rulesText: " клауза"
+	},
+	edit : {
+		addCaption: "Нов Запис",
+		editCaption: "Редакция Запис",
+		bSubmit: "Запиши",
+		bCancel: "Изход",
+		bClose: "Затвори",
+		saveData: "Данните са променени! Да съхраня ли промените?",
+		bYes : "Да",
+		bNo : "Не",
+		bExit : "Отказ",
+		msg: {
+			required:"Полето е задължително",
+			number:"Въведете валидно число!",
+			minValue:"стойността трябва да е по-голяма или равна от",
+			maxValue:"стойността трябва да е по-малка или равна от",
+			email: "не е валиден ел. адрес",
+			integer: "Въведете валидно цяло число",
+			date: "Въведете валидна дата",
+			url: "e невалиден URL. Изискава се префикс('http://' или 'https://')",
+			nodefined : " е недефинирана!",
+			novalue : " изисква връщане на стойност!",
+			customarray : "Потреб. Функция трябва да върне масив!",
+			customfcheck : "Потребителска функция е задължителна при този тип елемент!"
+		}
+	},
+	view : {
+		caption: "Преглед запис",
+		bClose: "Затвори"
+	},
+	del : {
+		caption: "Изтриване",
+		msg: "Да изтрия ли избраният запис?",
+		bSubmit: "Изтрий",
+		bCancel: "Отказ"
+	},
+	nav : {
+		edittext: " ",
+		edittitle: "Редакция избран запис",
+		addtext:" ",
+		addtitle: "Добавяне нов запис",
+		deltext: " ",
+		deltitle: "Изтриване избран запис",
+		searchtext: " ",
+		searchtitle: "Търсене запис(и)",
+		refreshtext: "",
+		refreshtitle: "Обнови таблица",
+		alertcap: "Предупреждение",
+		alerttext: "Моля, изберете запис",
+		viewtext: "",
+		viewtitle: "Преглед избран запис"
+	},
+	col : {
+		caption: "Избери колони",
+		bSubmit: "Ок",
+		bCancel: "Изход"	
+	},
+	errors : {
+		errcap : "Грешка",
+		nourl : "Няма посочен url адрес",
+		norecords: "Няма запис за обработка",
+		model : "Модела не съответства на имената!"	
+	},
+	formatter : {
+		integer : {thousandsSeparator: " ", defaultValue: '0'},
+		number : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0.00'},
+		currency : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:" лв.", defaultValue: '0.00'},
+		date : {
+			dayNames:   [
+				"Нед", "Пон", "Вт", "Ср", "Чет", "Пет", "Съб",
+				"Неделя", "Понеделник", "Вторник", "Сряда", "Четвъртък", "Петък", "Събота"
+			],
+			monthNames: [
+				"Яну", "Фев", "Мар", "Апр", "Май", "Юни", "Юли", "Авг", "Сеп", "Окт", "Нов", "Дек",
+				"Януари", "Февруари", "Март", "Април", "Май", "Юни", "Юли", "Август", "Септември", "Октомври", "Ноември", "Декември"
+			],
+			AmPm : ["","","",""],
+			S: function (j) {
+				if(j==7 || j==8 || j== 27 || j== 28) {
+					return 'ми';
+				}
+				return ['ви', 'ри', 'ти'][Math.min((j - 1) % 10, 2)];
+			},
+			srcformat: 'Y-m-d',
+			newformat: 'd/m/Y',
+			masks : {
+				ISO8601Long:"Y-m-d H:i:s",
+				ISO8601Short:"Y-m-d",
+				ShortDate: "n/j/Y",
+				LongDate: "l, F d, Y",
+				FullDateTime: "l, F d, Y g:i:s A",
+				MonthDay: "F d",
+				ShortTime: "g:i A",
+				LongTime: "g:i:s A",
+				SortableDateTime: "Y-m-d\\TH:i:s",
+				UniversalSortableDateTime: "Y-m-d H:i:sO",
+				YearMonth: "F, Y"
+			},
+			reformatAfterEdit : false
+		},
+		baseLinkUrl: '',
+		showAction: '',
+		target: '',
+		checkbox : {disabled:true},
+		idName : 'id'
+	}
+};
+})(jQuery);
Index: controlies/trunk/applications/controlies/static/js/jdgrid/src/i18n/grid.locale-de.js
===================================================================
--- controlies/trunk/applications/controlies/static/js/jdgrid/src/i18n/grid.locale-de.js	(revision 240)
+++ controlies/trunk/applications/controlies/static/js/jdgrid/src/i18n/grid.locale-de.js	(revision 241)
@@ -1,128 +1,133 @@
-;(function($){
-/**
- * jqGrid German Translation
- * Version 1.0.0 (developed for jQuery Grid 3.3.1)
- * Olaf Klöppel opensource@blue-hit.de
- * http://blue-hit.de/ 
- * Dual licensed under the MIT and GPL licenses:
- * http://www.opensource.org/licenses/mit-license.php
- * http://www.gnu.org/licenses/gpl.html
-**/
-$.jgrid = {
-	defaults : {
-		recordtext: "Zeige {0} - {1} von {2}",
-	    emptyrecords: "Keine Datensätze vorhanden",
-		loadtext: "Lädt...",
-		pgtext : "Seite {0} von {1}"
-	},
-	search : {
-		caption: "Suche...",
-		Find: "Finden",
-		Reset: "Zurücksetzen",
-	    odata : ['gleich', 'ungleich', 'kleiner', 'kleiner gleich','größer','größer gleich', 'beginnt mit','beginnt nicht mit','ist in','ist nicht in','endet mit','endet nicht mit','enthält','enthält nicht'],
-	    groupOps: [	{ op: "AND", text: "alle" },	{ op: "OR",  text: "mindestens eins" }	],
-		matchText: " match",
-		rulesText: " rules"
-	},
-	edit : {
-		addCaption: "Datensatz hinzufügen",
-		editCaption: "Datensatz bearbeiten",
-		bSubmit: "Speichern",
-		bCancel: "Abbrechen",
-		bClose: "Schließen",
-		saveData: "Daten wurden geändert! Änderungen speichern?",
-		bYes : "ja",
-		bNo : "nein",
-		bExit : "abbrechen",
-		msg: {
-		    required:"Feld ist erforderlich",
-		    number: "Bitte geben Sie eine Zahl ein",
-		    minValue:"Wert muss größer oder gleich sein, als ",
-		    maxValue:"Wert muss kleiner oder gleich sein, als ",
-		    email: "ist keine valide E-Mail Adresse",
-		    integer: "Bitte geben Sie eine Ganzzahl ein",
-			date: "Bitte geben Sie ein gültiges Datum ein",
-			url: "ist keine gültige URL. Prefix muss eingegeben werden ('http://' oder 'https://')",
-			nodefined : " ist nicht definiert!",
-			novalue : " Rückgabewert ist erforderlich!",
-			customarray : "Benutzerdefinierte Funktion sollte ein Array zurückgeben!",
-			customfcheck : "Benutzerdefinierte Funktion sollte im Falle der benutzerdefinierten Überprüfung vorhanden sein!"
-		}
-	},
-	view : {
-	    caption: "Datensatz anschauen",
-	    bClose: "Schließen"
-	},
-	del : {
-		caption: "Löschen",
-		msg: "Ausgewählte Datensätze löschen?",
-		bSubmit: "Löschen",
-		bCancel: "Abbrechen"
-	},
-	nav : {
-		edittext: " ",
-	    edittitle: "Ausgewählten Zeile editieren",
-		addtext:" ",
-	    addtitle: "Neuen Zeile einfügen",
-	    deltext: " ",
-	    deltitle: "Ausgewählte Zeile löschen",
-	    searchtext: " ",
-	    searchtitle: "Datensatz finden",
-	    refreshtext: "",
-	    refreshtitle: "Tabelle neu laden",
-	    alertcap: "Warnung",
-	    alerttext: "Bitte Zeile auswählen",
-		viewtext: "",
-		viewtitle: "Ausgewählte Zeile anzeigen"
-	},
-	col : {
-		caption: "Spalten anzeigen/verbergen",
-		bSubmit: "Speichern",
-		bCancel: "Abbrechen"	
-	},
-	errors : {
-		errcap : "Fehler",
-		nourl : "Keine URL angegeben",
-		norecords: "Keine Datensätze zum verarbeiten",
-		model : "colNames und colModel sind unterschiedlich lang!"
-	},
-	formatter : {
-		integer : {thousandsSeparator: " ", defaultValue: '0'},
-		number : {decimalSeparator:",", thousandsSeparator: ".", decimalPlaces: 2, defaultValue: '0,00'},
-		currency : {decimalSeparator:",", thousandsSeparator: ".", decimalPlaces: 2, prefix: "", suffix:" €", defaultValue: '0,00'},
-		date : {
-			dayNames:   [
-				"So", "Mo", "Di", "Mi", "Do", "Fr", "Sa",
-				"Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"
-			],
-			monthNames: [
-				"Jan", "Feb", "Mar", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dez",
-				"Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"
-			],
-			AmPm : ["am","pm","AM","PM"],
-			S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'},
-			srcformat: 'Y-m-d',
-			newformat: 'd/m/Y',
-			masks : {
-		        ISO8601Long:"d.m.Y H:i:s",
-		        ISO8601Short:"d.m.Y",
-		        ShortDate: "j.n.Y",
-		        LongDate: "l, d. F Y",
-		        FullDateTime: "l, d. F Y G:i:s",
-		        MonthDay: "d. F",
-		        ShortTime: "G:i",
-		        LongTime: "G:i:s",
-		        SortableDateTime: "Y-m-d\\TH:i:s",
-		        UniversalSortableDateTime: "Y-m-d H:i:sO",
-		        YearMonth: "F Y"
-		    },
-		    reformatAfterEdit : false
-		},
-		baseLinkUrl: '',
-		showAction: '',
-	    target: '',
-	    checkbox : {disabled:true},
-		idName : 'id'
-	}
-};
+;(function($){
+/**
+ * jqGrid German Translation
+ * Version 1.0.0 (developed for jQuery Grid 3.3.1)
+ * Olaf Klöppel opensource@blue-hit.de
+ * http://blue-hit.de/ 
+ *
+ * Updated for jqGrid 3.8
+ * Andreas Flack
+ * http://www.contentcontrol-berlin.de
+ *
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl.html
+**/
+$.jgrid = {
+	defaults : {
+		recordtext: "Zeige {0} - {1} von {2}",
+	    emptyrecords: "Keine Datensätze vorhanden",
+		loadtext: "Lädt...",
+		pgtext : "Seite {0} von {1}"
+	},
+	search : {
+		caption: "Suche...",
+		Find: "Suchen",
+		Reset: "Zurücksetzen",
+	    odata : ['gleich', 'ungleich', 'kleiner', 'kleiner gleich','größer','größer gleich', 'beginnt mit','beginnt nicht mit','ist in','ist nicht in','endet mit','endet nicht mit','enthält','enthält nicht'],
+	    groupOps: [	{ op: "AND", text: "alle" },	{ op: "OR",  text: "mindestens eine" }	],
+		matchText: " erfülle",
+		rulesText: " Bedingung(en)"
+	},
+	edit : {
+		addCaption: "Datensatz hinzufügen",
+		editCaption: "Datensatz bearbeiten",
+		bSubmit: "Speichern",
+		bCancel: "Abbrechen",
+		bClose: "Schließen",
+		saveData: "Daten wurden geändert! Änderungen speichern?",
+		bYes : "ja",
+		bNo : "nein",
+		bExit : "abbrechen",
+		msg: {
+		    required:"Feld ist erforderlich",
+		    number: "Bitte geben Sie eine Zahl ein",
+		    minValue:"Wert muss größer oder gleich sein, als ",
+		    maxValue:"Wert muss kleiner oder gleich sein, als ",
+		    email: "ist keine gültige E-Mail-Adresse",
+		    integer: "Bitte geben Sie eine Ganzzahl ein",
+			date: "Bitte geben Sie ein gültiges Datum ein",
+			url: "ist keine gültige URL. Präfix muss eingegeben werden ('http://' oder 'https://')",
+			nodefined : " ist nicht definiert!",
+			novalue : " Rückgabewert ist erforderlich!",
+			customarray : "Benutzerdefinierte Funktion sollte ein Array zurückgeben!",
+			customfcheck : "Benutzerdefinierte Funktion sollte im Falle der benutzerdefinierten Überprüfung vorhanden sein!"
+		}
+	},
+	view : {
+	    caption: "Datensatz anzeigen",
+	    bClose: "Schließen"
+	},
+	del : {
+		caption: "Löschen",
+		msg: "Ausgewählte Datensätze löschen?",
+		bSubmit: "Löschen",
+		bCancel: "Abbrechen"
+	},
+	nav : {
+		edittext: " ",
+	    edittitle: "Ausgewählte Zeile editieren",
+		addtext:" ",
+	    addtitle: "Neue Zeile einfügen",
+	    deltext: " ",
+	    deltitle: "Ausgewählte Zeile löschen",
+	    searchtext: " ",
+	    searchtitle: "Datensatz suchen",
+	    refreshtext: "",
+	    refreshtitle: "Tabelle neu laden",
+	    alertcap: "Warnung",
+	    alerttext: "Bitte Zeile auswählen",
+		viewtext: "",
+		viewtitle: "Ausgewählte Zeile anzeigen"
+	},
+	col : {
+		caption: "Spalten auswählen",
+		bSubmit: "Speichern",
+		bCancel: "Abbrechen"	
+	},
+	errors : {
+		errcap : "Fehler",
+		nourl : "Keine URL angegeben",
+		norecords: "Keine Datensätze zu bearbeiten",
+		model : "colNames und colModel sind unterschiedlich lang!"
+	},
+	formatter : {
+		integer : {thousandsSeparator: ".", defaultValue: '0'},
+		number : {decimalSeparator:",", thousandsSeparator: ".", decimalPlaces: 2, defaultValue: '0,00'},
+		currency : {decimalSeparator:",", thousandsSeparator: ".", decimalPlaces: 2, prefix: "", suffix:" €", defaultValue: '0,00'},
+		date : {
+			dayNames:   [
+				"So", "Mo", "Di", "Mi", "Do", "Fr", "Sa",
+				"Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"
+			],
+			monthNames: [
+				"Jan", "Feb", "Mar", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dez",
+				"Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"
+			],
+			AmPm : ["am","pm","AM","PM"],
+			S: function (j) {return 'ter'},
+			srcformat: 'Y-m-d',
+			newformat: 'd.m.Y',
+			masks : {
+		        ISO8601Long: "Y-m-d H:i:s",
+		        ISO8601Short: "Y-m-d",
+		        ShortDate: "j.n.Y",
+		        LongDate: "l, j. F Y",
+		        FullDateTime: "l, d. F Y G:i:s",
+		        MonthDay: "d. F",
+		        ShortTime: "G:i",
+		        LongTime: "G:i:s",
+		        SortableDateTime: "Y-m-d\\TH:i:s",
+		        UniversalSortableDateTime: "Y-m-d H:i:sO",
+		        YearMonth: "F Y"
+		    },
+		    reformatAfterEdit : false
+		},
+		baseLinkUrl: '',
+		showAction: '',
+	    target: '',
+	    checkbox : {disabled:true},
+		idName : 'id'
+	}
+};
 })(jQuery);
\ No newline at end of file
Index: controlies/trunk/applications/controlies/static/js/jdgrid/src/i18n/grid.locale-ja.js
===================================================================
--- controlies/trunk/applications/controlies/static/js/jdgrid/src/i18n/grid.locale-ja.js	(revision 240)
+++ controlies/trunk/applications/controlies/static/js/jdgrid/src/i18n/grid.locale-ja.js	(revision 241)
@@ -1,155 +1,155 @@
-;(function($){
-/**
- * jqGrid Japanese Translation
- * OKADA Yoshitada okada.dev@sth.jp
- * http://trirand.com/blog/ 
- * Dual licensed under the MIT and GPL licenses:
- * http://www.opensource.org/licenses/mit-license.php
- * http://www.gnu.org/licenses/gpl.html
-**/
-$.jgrid = {
-	defaults : {
-		recordtext: "{2} \u4EF6\u4E2D {0} - {1} \u3092\u8868\u793A ",
-	    emptyrecords: "\u8868\u793A\u3059\u308B\u30EC\u30B3\u30FC\u30C9\u304C\u3042\u308A\u307E\u305B\u3093",
-		loadtext: "\u8aad\u307f\u8fbc\u307f\u4e2d...",
-		pgtext : "{1} \u30DA\u30FC\u30B8\u4E2D {0} \u30DA\u30FC\u30B8\u76EE "
-	},
-	search : {
-	    caption: "\u691c\u7d22...",
-	    Find: "\u691c\u7d22",
-	    Reset: "\u30ea\u30bb\u30c3\u30c8",
-	    odata: ["\u6B21\u306B\u7B49\u3057\u3044", "\u6B21\u306B\u7B49\u3057\u304F\u306A\u3044",
-            "\u6B21\u3088\u308A\u5C0F\u3055\u3044", "\u6B21\u306B\u7B49\u3057\u3044\u304B\u5C0F\u3055\u3044",
-            "\u6B21\u3088\u308A\u5927\u304D\u3044", "\u6B21\u306B\u7B49\u3057\u3044\u304B\u5927\u304D\u3044",
-            "\u6B21\u3067\u59CB\u307E\u308B", "\u6B21\u3067\u59CB\u307E\u3089\u306A\u3044",
-            "\u6B21\u306B\u542B\u307E\u308C\u308B", "\u6B21\u306B\u542B\u307E\u308C\u306A\u3044",
-            "\u6B21\u3067\u7D42\u308F\u308B", "\u6B21\u3067\u7D42\u308F\u3089\u306A\u3044",
-            "\u6B21\u3092\u542B\u3080", "\u6B21\u3092\u542B\u307E\u306A\u3044"],
-	    groupOps: [{
-                op: "AND",
-                text: "\u3059\u3079\u3066\u306E"
-            },
-            {
-                op: "OR",
-                text: "\u3044\u305A\u308C\u304B\u306E"
-            }],
-      matchText: " \u6B21\u306E",
-      rulesText: " \u6761\u4EF6\u3092\u6E80\u305F\u3059"
-	},
-	edit : {
-	    addCaption: "\u30ec\u30b3\u30fc\u30c9\u8ffd\u52a0",
-	    editCaption: "\u30ec\u30b3\u30fc\u30c9\u7de8\u96c6",
-	    bSubmit: "\u9001\u4fe1",
-	    bCancel: "\u30ad\u30e3\u30f3\u30bb\u30eb",
-  		bClose: "\u9589\u3058\u308b",
-      saveData: "\u30C7\u30FC\u30BF\u304C\u5909\u66F4\u3055\u308C\u3066\u3044\u307E\u3059\u3002\u4FDD\u5B58\u3057\u307E\u3059\u304B\uFF1F",
-      bYes: "\u306F\u3044",
-      bNo: "\u3044\u3044\u3048",
-      bExit: "\u30AD\u30E3\u30F3\u30BB\u30EB",
-	    msg: {
-	        required:"\u3053\u306e\u9805\u76ee\u306f\u5fc5\u9808\u3067\u3059\u3002",
-	        number:"\u6b63\u3057\u3044\u6570\u5024\u3092\u5165\u529b\u3057\u3066\u4e0b\u3055\u3044\u3002",
-	        minValue:"\u6b21\u306e\u5024\u4ee5\u4e0a\u3067\u5165\u529b\u3057\u3066\u4e0b\u3055\u3044\u3002",
-	        maxValue:"\u6b21\u306e\u5024\u4ee5\u4e0b\u3067\u5165\u529b\u3057\u3066\u4e0b\u3055\u3044\u3002",
-	        email: "e-mail\u304c\u6b63\u3057\u304f\u3042\u308a\u307e\u305b\u3093\u3002",
-	        integer: "\u6b63\u3057\u3044\u6574\u6570\u5024\u3092\u5165\u529b\u3057\u3066\u4e0b\u3055\u3044\u3002",
-    			date: "\u6b63\u3057\u3044\u5024\u3092\u5165\u529b\u3057\u3066\u4e0b\u3055\u3044\u3002",
-          url: "\u306F\u6709\u52B9\u306AURL\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002\20\u30D7\u30EC\u30D5\u30A3\u30C3\u30AF\u30B9\u304C\u5FC5\u8981\u3067\u3059\u3002 ('http://' \u307E\u305F\u306F 'https://')",
-          nodefined: " \u304C\u5B9A\u7FA9\u3055\u308C\u3066\u3044\u307E\u305B\u3093",
-          novalue: " \u623B\u308A\u5024\u304C\u5FC5\u8981\u3067\u3059",
-          customarray: "\u30AB\u30B9\u30BF\u30E0\u95A2\u6570\u306F\u914D\u5217\u3092\u8FD4\u3059\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059",
-          customfcheck: "\u30AB\u30B9\u30BF\u30E0\u691C\u8A3C\u306B\u306F\u30AB\u30B9\u30BF\u30E0\u95A2\u6570\u304C\u5FC5\u8981\u3067\u3059"
-		}
-	},
-	view : {
-      caption: "\u30EC\u30B3\u30FC\u30C9\u3092\u8868\u793A",
-      bClose: "\u9589\u3058\u308B"
-	},
-	del : {
-	    caption: "\u524a\u9664",
-	    msg: "\u9078\u629e\u3057\u305f\u30ec\u30b3\u30fc\u30c9\u3092\u524a\u9664\u3057\u307e\u3059\u304b\uff1f",
-	    bSubmit: "\u524a\u9664",
-	    bCancel: "\u30ad\u30e3\u30f3\u30bb\u30eb"
-	},
-	nav : {
-    	edittext: " ",
-	    edittitle: "\u9078\u629e\u3057\u305f\u884c\u3092\u7de8\u96c6",
-      addtext:" ",
-	    addtitle: "\u884c\u3092\u65b0\u898f\u8ffd\u52a0",
-	    deltext: " ",
-	    deltitle: "\u9078\u629e\u3057\u305f\u884c\u3092\u524a\u9664",
-	    searchtext: " ",
-	    searchtitle: "\u30ec\u30b3\u30fc\u30c9\u691c\u7d22",
-	    refreshtext: "",
-	    refreshtitle: "\u30b0\u30ea\u30c3\u30c9\u3092\u30ea\u30ed\u30fc\u30c9",
-	    alertcap: "\u8b66\u544a",
-	    alerttext: "\u884c\u3092\u9078\u629e\u3057\u3066\u4e0b\u3055\u3044\u3002",
-      viewtext: "",
-      viewtitle: "\u9078\u629E\u3057\u305F\u884C\u3092\u8868\u793A"
-	},
-	col : {
-	    caption: "\u5217\u3092\u8868\u793a\uff0f\u96a0\u3059",
-	    bSubmit: "\u9001\u4fe1",
-	    bCancel: "\u30ad\u30e3\u30f3\u30bb\u30eb"	
-	},
-	errors : {
-		errcap : "\u30a8\u30e9\u30fc",
-		nourl : "URL\u304c\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002",
-		norecords: "\u51e6\u7406\u5bfe\u8c61\u306e\u30ec\u30b3\u30fc\u30c9\u304c\u3042\u308a\u307e\u305b\u3093\u3002",
-	    model : "colNames\u306e\u9577\u3055\u304ccolModel\u3068\u4e00\u81f4\u3057\u307e\u305b\u3093\u3002"
-	},
-	formatter : {
-            integer: {
-                thousandsSeparator: ",",
-                defaultValue: '0'
-            },
-            number: {
-                decimalSeparator: ".",
-                thousandsSeparator: ",",
-                decimalPlaces: 2,
-                defaultValue: '0.00'
-            },
-            currency: {
-                decimalSeparator: ".",
-                thousandsSeparator: ",",
-                decimalPlaces: 0,
-                prefix: "",
-                suffix: "",
-                defaultValue: '0'
-            },
-		date : {
-			dayNames:   [
-				"\u65e5", "\u6708", "\u706b", "\u6c34", "\u6728", "\u91d1", "\u571f",
-				"\u65e5", "\u6708", "\u706b", "\u6c34", "\u6728", "\u91d1", "\u571f"
-			],
-			monthNames: [
-				"1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12",
-				"1\u6708", "2\u6708", "3\u6708", "4\u6708", "5\u6708", "6\u6708", "7\u6708", "8\u6708", "9\u6708", "10\u6708", "11\u6708", "12\u6708"
-			],
-			AmPm : ["am","pm","AM","PM"],
-			S: "\u756a\u76ee",
-			srcformat: 'Y-m-d',
-			newformat: 'd/m/Y',
-			masks : {
-	            ISO8601Long:"Y-m-d H:i:s",
-	            ISO8601Short:"Y-m-d",
-	            ShortDate: "n/j/Y",
-	            LongDate: "l, F d, Y",
-	            FullDateTime: "l, F d, Y g:i:s A",
-	            MonthDay: "F d",
-	            ShortTime: "g:i A",
-	            LongTime: "g:i:s A",
-	            SortableDateTime: "Y-m-d\\TH:i:s",
-	            UniversalSortableDateTime: "Y-m-d H:i:sO",
-	            YearMonth: "F, Y"
-	        },
-	        reformatAfterEdit : false
-		},
-		baseLinkUrl: '',
-		showAction: '',
-	    target: '',
-	    checkbox : {disabled:true},
-		idName : 'id'
-	}
-};
-})(jQuery);
+;(function($){
+/**
+ * jqGrid Japanese Translation
+ * OKADA Yoshitada okada.dev@sth.jp
+ * http://trirand.com/blog/ 
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl.html
+**/
+$.jgrid = {
+	defaults : {
+		recordtext: "{2} \u4EF6\u4E2D {0} - {1} \u3092\u8868\u793A ",
+	    emptyrecords: "\u8868\u793A\u3059\u308B\u30EC\u30B3\u30FC\u30C9\u304C\u3042\u308A\u307E\u305B\u3093",
+		loadtext: "\u8aad\u307f\u8fbc\u307f\u4e2d...",
+		pgtext : "{1} \u30DA\u30FC\u30B8\u4E2D {0} \u30DA\u30FC\u30B8\u76EE "
+	},
+	search : {
+	    caption: "\u691c\u7d22...",
+	    Find: "\u691c\u7d22",
+	    Reset: "\u30ea\u30bb\u30c3\u30c8",
+	    odata: ["\u6B21\u306B\u7B49\u3057\u3044", "\u6B21\u306B\u7B49\u3057\u304F\u306A\u3044",
+            "\u6B21\u3088\u308A\u5C0F\u3055\u3044", "\u6B21\u306B\u7B49\u3057\u3044\u304B\u5C0F\u3055\u3044",
+            "\u6B21\u3088\u308A\u5927\u304D\u3044", "\u6B21\u306B\u7B49\u3057\u3044\u304B\u5927\u304D\u3044",
+            "\u6B21\u3067\u59CB\u307E\u308B", "\u6B21\u3067\u59CB\u307E\u3089\u306A\u3044",
+            "\u6B21\u306B\u542B\u307E\u308C\u308B", "\u6B21\u306B\u542B\u307E\u308C\u306A\u3044",
+            "\u6B21\u3067\u7D42\u308F\u308B", "\u6B21\u3067\u7D42\u308F\u3089\u306A\u3044",
+            "\u6B21\u3092\u542B\u3080", "\u6B21\u3092\u542B\u307E\u306A\u3044"],
+	    groupOps: [{
+                op: "AND",
+                text: "\u3059\u3079\u3066\u306E"
+            },
+            {
+                op: "OR",
+                text: "\u3044\u305A\u308C\u304B\u306E"
+            }],
+      matchText: " \u6B21\u306E",
+      rulesText: " \u6761\u4EF6\u3092\u6E80\u305F\u3059"
+	},
+	edit : {
+	    addCaption: "\u30ec\u30b3\u30fc\u30c9\u8ffd\u52a0",
+	    editCaption: "\u30ec\u30b3\u30fc\u30c9\u7de8\u96c6",
+	    bSubmit: "\u9001\u4fe1",
+	    bCancel: "\u30ad\u30e3\u30f3\u30bb\u30eb",
+  		bClose: "\u9589\u3058\u308b",
+      saveData: "\u30C7\u30FC\u30BF\u304C\u5909\u66F4\u3055\u308C\u3066\u3044\u307E\u3059\u3002\u4FDD\u5B58\u3057\u307E\u3059\u304B\uFF1F",
+      bYes: "\u306F\u3044",
+      bNo: "\u3044\u3044\u3048",
+      bExit: "\u30AD\u30E3\u30F3\u30BB\u30EB",
+	    msg: {
+	        required:"\u3053\u306e\u9805\u76ee\u306f\u5fc5\u9808\u3067\u3059\u3002",
+	        number:"\u6b63\u3057\u3044\u6570\u5024\u3092\u5165\u529b\u3057\u3066\u4e0b\u3055\u3044\u3002",
+	        minValue:"\u6b21\u306e\u5024\u4ee5\u4e0a\u3067\u5165\u529b\u3057\u3066\u4e0b\u3055\u3044\u3002",
+	        maxValue:"\u6b21\u306e\u5024\u4ee5\u4e0b\u3067\u5165\u529b\u3057\u3066\u4e0b\u3055\u3044\u3002",
+	        email: "e-mail\u304c\u6b63\u3057\u304f\u3042\u308a\u307e\u305b\u3093\u3002",
+	        integer: "\u6b63\u3057\u3044\u6574\u6570\u5024\u3092\u5165\u529b\u3057\u3066\u4e0b\u3055\u3044\u3002",
+    			date: "\u6b63\u3057\u3044\u5024\u3092\u5165\u529b\u3057\u3066\u4e0b\u3055\u3044\u3002",
+          url: "\u306F\u6709\u52B9\u306AURL\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002\20\u30D7\u30EC\u30D5\u30A3\u30C3\u30AF\u30B9\u304C\u5FC5\u8981\u3067\u3059\u3002 ('http://' \u307E\u305F\u306F 'https://')",
+          nodefined: " \u304C\u5B9A\u7FA9\u3055\u308C\u3066\u3044\u307E\u305B\u3093",
+          novalue: " \u623B\u308A\u5024\u304C\u5FC5\u8981\u3067\u3059",
+          customarray: "\u30AB\u30B9\u30BF\u30E0\u95A2\u6570\u306F\u914D\u5217\u3092\u8FD4\u3059\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059",
+          customfcheck: "\u30AB\u30B9\u30BF\u30E0\u691C\u8A3C\u306B\u306F\u30AB\u30B9\u30BF\u30E0\u95A2\u6570\u304C\u5FC5\u8981\u3067\u3059"
+		}
+	},
+	view : {
+      caption: "\u30EC\u30B3\u30FC\u30C9\u3092\u8868\u793A",
+      bClose: "\u9589\u3058\u308B"
+	},
+	del : {
+	    caption: "\u524a\u9664",
+	    msg: "\u9078\u629e\u3057\u305f\u30ec\u30b3\u30fc\u30c9\u3092\u524a\u9664\u3057\u307e\u3059\u304b\uff1f",
+	    bSubmit: "\u524a\u9664",
+	    bCancel: "\u30ad\u30e3\u30f3\u30bb\u30eb"
+	},
+	nav : {
+    	edittext: " ",
+	    edittitle: "\u9078\u629e\u3057\u305f\u884c\u3092\u7de8\u96c6",
+      addtext:" ",
+	    addtitle: "\u884c\u3092\u65b0\u898f\u8ffd\u52a0",
+	    deltext: " ",
+	    deltitle: "\u9078\u629e\u3057\u305f\u884c\u3092\u524a\u9664",
+	    searchtext: " ",
+	    searchtitle: "\u30ec\u30b3\u30fc\u30c9\u691c\u7d22",
+	    refreshtext: "",
+	    refreshtitle: "\u30b0\u30ea\u30c3\u30c9\u3092\u30ea\u30ed\u30fc\u30c9",
+	    alertcap: "\u8b66\u544a",
+	    alerttext: "\u884c\u3092\u9078\u629e\u3057\u3066\u4e0b\u3055\u3044\u3002",
+      viewtext: "",
+      viewtitle: "\u9078\u629E\u3057\u305F\u884C\u3092\u8868\u793A"
+	},
+	col : {
+	    caption: "\u5217\u3092\u8868\u793a\uff0f\u96a0\u3059",
+	    bSubmit: "\u9001\u4fe1",
+	    bCancel: "\u30ad\u30e3\u30f3\u30bb\u30eb"	
+	},
+	errors : {
+		errcap : "\u30a8\u30e9\u30fc",
+		nourl : "URL\u304c\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002",
+		norecords: "\u51e6\u7406\u5bfe\u8c61\u306e\u30ec\u30b3\u30fc\u30c9\u304c\u3042\u308a\u307e\u305b\u3093\u3002",
+	    model : "colNames\u306e\u9577\u3055\u304ccolModel\u3068\u4e00\u81f4\u3057\u307e\u305b\u3093\u3002"
+	},
+	formatter : {
+            integer: {
+                thousandsSeparator: ",",
+                defaultValue: '0'
+            },
+            number: {
+                decimalSeparator: ".",
+                thousandsSeparator: ",",
+                decimalPlaces: 2,
+                defaultValue: '0.00'
+            },
+            currency: {
+                decimalSeparator: ".",
+                thousandsSeparator: ",",
+                decimalPlaces: 0,
+                prefix: "",
+                suffix: "",
+                defaultValue: '0'
+            },
+		date : {
+			dayNames:   [
+				"\u65e5", "\u6708", "\u706b", "\u6c34", "\u6728", "\u91d1", "\u571f",
+				"\u65e5", "\u6708", "\u706b", "\u6c34", "\u6728", "\u91d1", "\u571f"
+			],
+			monthNames: [
+				"1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12",
+				"1\u6708", "2\u6708", "3\u6708", "4\u6708", "5\u6708", "6\u6708", "7\u6708", "8\u6708", "9\u6708", "10\u6708", "11\u6708", "12\u6708"
+			],
+			AmPm : ["am","pm","AM","PM"],
+			S: "\u756a\u76ee",
+			srcformat: 'Y-m-d',
+			newformat: 'd/m/Y',
+			masks : {
+	            ISO8601Long:"Y-m-d H:i:s",
+	            ISO8601Short:"Y-m-d",
+	            ShortDate: "n/j/Y",
+	            LongDate: "l, F d, Y",
+	            FullDateTime: "l, F d, Y g:i:s A",
+	            MonthDay: "F d",
+	            ShortTime: "g:i A",
+	            LongTime: "g:i:s A",
+	            SortableDateTime: "Y-m-d\\TH:i:s",
+	            UniversalSortableDateTime: "Y-m-d H:i:sO",
+	            YearMonth: "F, Y"
+	        },
+	        reformatAfterEdit : false
+		},
+		baseLinkUrl: '',
+		showAction: '',
+	    target: '',
+	    checkbox : {disabled:true},
+		idName : 'id'
+	}
+};
+})(jQuery);
Index: controlies/trunk/applications/controlies/static/js/jdgrid/src/i18n/grid.locale-he.js
===================================================================
--- controlies/trunk/applications/controlies/static/js/jdgrid/src/i18n/grid.locale-he.js	(revision 240)
+++ controlies/trunk/applications/controlies/static/js/jdgrid/src/i18n/grid.locale-he.js	(revision 241)
@@ -1,127 +1,127 @@
-;(function($){
-/**
- * jqGrid Hebrew Translation
- * Shuki Shukrun shukrun.shuki@gmail.com
- * http://trirand.com/blog/ 
- * Dual licensed under the MIT and GPL licenses:
- * http://www.opensource.org/licenses/mit-license.php
- * http://www.gnu.org/licenses/gpl.html
-**/
-$.jgrid = {
-	defaults : {
-		recordtext: "מציג {0} - {1} מתוך {2}",
-		emptyrecords: "אין רשומות להציג",
-		loadtext: "טוען...",
-		pgtext : "דף {0} מתוך {1}"
-	},
-	search : {
-		caption: "מחפש...",
-		Find: "חפש",
-		Reset: "התחל",
-		odata : ['שווה', 'לא שווה', 'קטן', 'קטן או שווה','גדול','גדול או שווה', 'מתחיל ב','לא מתחיל ב','נמצא ב','לא נמצא ב','מסתיים ב','לא מסתיים ב','מכיל','לא מכיל'],
-		groupOps: [	{ op: "AND", text: "הכל" },	{ op: "OR",  text: "אחד מ" }	],
-		matchText: " תואם",
-		rulesText: " חוקים"
-	},
-	edit : {
-		addCaption: "הוסף רשומה",
-		editCaption: "ערוך רשומה",
-		bSubmit: "שלח",
-		bCancel: "בטל",
-		bClose: "סגור",
-		saveData: "נתונים השתנו! לשמור?",
-		bYes : "כן",
-		bNo : "לא",
-		bExit : "בטל",
-		msg: {
-			required:"שדה חובה",
-			number:"אנא, הכנס מספר תקין",
-			minValue:"ערך צריך להיות גדול או שווה ל ",
-			maxValue:"ערך צריך להיות קטן או שווה ל ",
-			email: "היא לא כתובת איימל תקינה",
-			integer: "אנא, הכנס מספר שלם",
-			date: "אנא, הכנס תאריך תקין",
-			url: "הכתובת אינה תקינה. דרושה תחילית ('http://' או 'https://')",
-			nodefined : " is not defined!",
-			novalue : " return value is required!",
-			customarray : "Custom function should return array!",
-			customfcheck : "Custom function should be present in case of custom checking!"
-		}
-	},
-	view : {
-		caption: "הצג רשומה",
-		bClose: "סגור"
-	},
-	del : {
-		caption: "מחק",
-		msg: "האם למחוק את הרשומה/ות המסומנות?",
-		bSubmit: "מחק",
-		bCancel: "בטל"
-	},
-	nav : {
-		edittext: "",
-		edittitle: "ערוך שורה מסומנת",
-		addtext:"",
-		addtitle: "הוסף שורה חדשה",
-		deltext: "",
-		deltitle: "מחק שורה מסומנת",
-		searchtext: "",
-		searchtitle: "חפש רשומות",
-		refreshtext: "",
-		refreshtitle: "טען גריד מחדש",
-		alertcap: "אזהרה",
-		alerttext: "אנא, בחר שורה",
-		viewtext: "",
-		viewtitle: "הצג שורה מסומנת"
-	},
-	col : {
-		caption: "הצג/הסתר עמודות",
-		bSubmit: "שלח",
-		bCancel: "בטל"
-	},
-	errors : {
-		errcap : "שגיאה",
-		nourl : "לא הוגדרה כתובת url",
-		norecords: "אין רשומות לעבד",
-		model : "אורך של colNames <> colModel!"
-	},
-	formatter : {
-		integer : {thousandsSeparator: " ", defaultValue: '0'},
-		number : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0.00'},
-		currency : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0.00'},
-		date : {
-			dayNames:   [
-				"א", "ב", "ג", "ד", "ה", "ו", "ש",
-				"ראשון", "שני", "שלישי", "רביעי", "חמישי", "שישי", "שבת"
-			],
-			monthNames: [
-				"ינו", "פבר", "מרץ", "אפר", "מאי", "יונ", "יול", "אוג", "ספט", "אוק", "נוב", "דצמ",
-				"ינואר", "פברואר", "מרץ", "אפריל", "מאי", "יוני", "יולי", "אוגוסט", "ספטמבר", "אוקטובר", "נובמבר", "דצמבר"
-			],
-			AmPm : ["לפני הצהרים","אחר הצהרים","לפני הצהרים","אחר הצהרים"],
-			S: function (j) {return j < 11 || j > 13 ? ['', '', '', ''][Math.min((j - 1) % 10, 3)] : ''},
-			srcformat: 'Y-m-d',
-			newformat: 'd/m/Y',
-			masks : {
-				ISO8601Long:"Y-m-d H:i:s",
-				ISO8601Short:"Y-m-d",
-				ShortDate: "n/j/Y",
-				LongDate: "l, F d, Y",
-				FullDateTime: "l, F d, Y g:i:s A",
-				MonthDay: "F d",
-				ShortTime: "g:i A",
-				LongTime: "g:i:s A",
-				SortableDateTime: "Y-m-d\\TH:i:s",
-				UniversalSortableDateTime: "Y-m-d H:i:sO",
-				YearMonth: "F, Y"
-			},
-			reformatAfterEdit : false
-		},
-		baseLinkUrl: '',
-		showAction: '',
-		target: '',
-		checkbox : {disabled:true},
-		idName : 'id'
-	}
-};
-})(jQuery);
+;(function($){
+/**
+ * jqGrid Hebrew Translation
+ * Shuki Shukrun shukrun.shuki@gmail.com
+ * http://trirand.com/blog/ 
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl.html
+**/
+$.jgrid = {
+	defaults : {
+		recordtext: "מציג {0} - {1} מתוך {2}",
+		emptyrecords: "אין רשומות להציג",
+		loadtext: "טוען...",
+		pgtext : "דף {0} מתוך {1}"
+	},
+	search : {
+		caption: "מחפש...",
+		Find: "חפש",
+		Reset: "התחל",
+		odata : ['שווה', 'לא שווה', 'קטן', 'קטן או שווה','גדול','גדול או שווה', 'מתחיל ב','לא מתחיל ב','נמצא ב','לא נמצא ב','מסתיים ב','לא מסתיים ב','מכיל','לא מכיל'],
+		groupOps: [	{ op: "AND", text: "הכל" },	{ op: "OR",  text: "אחד מ" }	],
+		matchText: " תואם",
+		rulesText: " חוקים"
+	},
+	edit : {
+		addCaption: "הוסף רשומה",
+		editCaption: "ערוך רשומה",
+		bSubmit: "שלח",
+		bCancel: "בטל",
+		bClose: "סגור",
+		saveData: "נתונים השתנו! לשמור?",
+		bYes : "כן",
+		bNo : "לא",
+		bExit : "בטל",
+		msg: {
+			required:"שדה חובה",
+			number:"אנא, הכנס מספר תקין",
+			minValue:"ערך צריך להיות גדול או שווה ל ",
+			maxValue:"ערך צריך להיות קטן או שווה ל ",
+			email: "היא לא כתובת איימל תקינה",
+			integer: "אנא, הכנס מספר שלם",
+			date: "אנא, הכנס תאריך תקין",
+			url: "הכתובת אינה תקינה. דרושה תחילית ('http://' או 'https://')",
+			nodefined : " is not defined!",
+			novalue : " return value is required!",
+			customarray : "Custom function should return array!",
+			customfcheck : "Custom function should be present in case of custom checking!"
+		}
+	},
+	view : {
+		caption: "הצג רשומה",
+		bClose: "סגור"
+	},
+	del : {
+		caption: "מחק",
+		msg: "האם למחוק את הרשומה/ות המסומנות?",
+		bSubmit: "מחק",
+		bCancel: "בטל"
+	},
+	nav : {
+		edittext: "",
+		edittitle: "ערוך שורה מסומנת",
+		addtext:"",
+		addtitle: "הוסף שורה חדשה",
+		deltext: "",
+		deltitle: "מחק שורה מסומנת",
+		searchtext: "",
+		searchtitle: "חפש רשומות",
+		refreshtext: "",
+		refreshtitle: "טען גריד מחדש",
+		alertcap: "אזהרה",
+		alerttext: "אנא, בחר שורה",
+		viewtext: "",
+		viewtitle: "הצג שורה מסומנת"
+	},
+	col : {
+		caption: "הצג/הסתר עמודות",
+		bSubmit: "שלח",
+		bCancel: "בטל"
+	},
+	errors : {
+		errcap : "שגיאה",
+		nourl : "לא הוגדרה כתובת url",
+		norecords: "אין רשומות לעבד",
+		model : "אורך של colNames <> colModel!"
+	},
+	formatter : {
+		integer : {thousandsSeparator: " ", defaultValue: '0'},
+		number : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0.00'},
+		currency : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0.00'},
+		date : {
+			dayNames:   [
+				"א", "ב", "ג", "ד", "ה", "ו", "ש",
+				"ראשון", "שני", "שלישי", "רביעי", "חמישי", "שישי", "שבת"
+			],
+			monthNames: [
+				"ינו", "פבר", "מרץ", "אפר", "מאי", "יונ", "יול", "אוג", "ספט", "אוק", "נוב", "דצמ",
+				"ינואר", "פברואר", "מרץ", "אפריל", "מאי", "יוני", "יולי", "אוגוסט", "ספטמבר", "אוקטובר", "נובמבר", "דצמבר"
+			],
+			AmPm : ["לפני הצהרים","אחר הצהרים","לפני הצהרים","אחר הצהרים"],
+			S: function (j) {return j < 11 || j > 13 ? ['', '', '', ''][Math.min((j - 1) % 10, 3)] : ''},
+			srcformat: 'Y-m-d',
+			newformat: 'd/m/Y',
+			masks : {
+				ISO8601Long:"Y-m-d H:i:s",
+				ISO8601Short:"Y-m-d",
+				ShortDate: "n/j/Y",
+				LongDate: "l, F d, Y",
+				FullDateTime: "l, F d, Y g:i:s A",
+				MonthDay: "F d",
+				ShortTime: "g:i A",
+				LongTime: "g:i:s A",
+				SortableDateTime: "Y-m-d\\TH:i:s",
+				UniversalSortableDateTime: "Y-m-d H:i:sO",
+				YearMonth: "F, Y"
+			},
+			reformatAfterEdit : false
+		},
+		baseLinkUrl: '',
+		showAction: '',
+		target: '',
+		checkbox : {disabled:true},
+		idName : 'id'
+	}
+};
+})(jQuery);
Index: controlies/trunk/applications/controlies/static/js/jdgrid/src/i18n/grid.locale-fi.js
===================================================================
--- controlies/trunk/applications/controlies/static/js/jdgrid/src/i18n/grid.locale-fi.js	(revision 240)
+++ controlies/trunk/applications/controlies/static/js/jdgrid/src/i18n/grid.locale-fi.js	(revision 241)
@@ -1,128 +1,129 @@
-;(function($){
-/**
- * jqGrid (fi) Finnish Translation
- * Jukka Inkeri  awot.fi
- * http://awot.fi
- * Dual licensed under the MIT and GPL licenses:
- * http://www.opensource.org/licenses/mit-license.php
- * http://www.gnu.org/licenses/gpl.html
-**/
-$.jgrid = {
-	defaults : {
-		recordtext: "View {0} - {1} of {2}",
-	    emptyrecords: "No records to view",
-		loadtext: "Haetaan...",
-		pgtext : "Page {0} of {1}"
-	},
-	search : {
-	    caption: "Etsi...",
-	    Find: "Etsi",
-	    Reset: "Tyhj&auml;&auml;",
-	    odata : ['equal', 'not equal', 'less', 'less or equal','greater','greater or equal', 'begins with','does not begin with','is in','is not in','ends with','does not end with','contains','does not contain'],
-	    groupOps: [	{ op: "AND", text: "all" },	{ op: "OR",  text: "any" }	],
-		matchText: " match",
-		rulesText: " rules"
-	},
-	edit : {
-	    addCaption: "Uusi rivi",
-	    editCaption: "Muokkaa rivi",
-	    bSubmit: "OK",
-	    bCancel: "Peru",
-		bClose: "Sulje",
-		saveData: "Data has been changed! Save changes?",
-		bYes : "Yes",
-		bNo : "No",
-		bExit : "Cancel",
-	    msg: {
-	        required:"pakollinen",
-	        number:"Anna kelvollinen nro",
-	        minValue:"arvo oltava >= ",
-	        maxValue:"arvo oltava  <= ",
-	        email: "virheellinen sposti ",
-	        integer: "Anna kelvollinen kokonaisluku",
-			date: "Anna kelvollinen pvm",
-			url: "is not a valid URL. Prefix required ('http://' or 'https://')",
-			nodefined : " is not defined!",
-			novalue : " return value is required!",
-			customarray : "Custom function should return array!",
-			customfcheck : "Custom function should be present in case of custom checking!"
-		}
-	},
-	view : {
-	    caption: "View Record",
-	    bClose: "Close"
-	},
-	del : {
-	    caption: "Poista",
-	    msg: "Poista valitut  rivi(t)?",
-	    bSubmit: "Poista",
-	    bCancel: "Peru"
-	},
-	nav : {
-		edittext: " ",
-	    edittitle: "Muokkaa valittu rivi",
-		addtext:" ",
-	    addtitle: "Uusi rivi",
-	    deltext: " ",
-	    deltitle: "Poista valittu rivi",
-	    searchtext: " ",
-	    searchtitle: "Etsi tietoja",
-	    refreshtext: "",
-	    refreshtitle: "Lataa uudelleen",
-	    alertcap: "Varoitus",
-	    alerttext: "Valitse rivi",
-		viewtext: "",
-		viewtitle: "View selected row"
-	},
-	col : {
-	    caption: "Nayta/Piilota sarakkeet",
-	    bSubmit: "OK",
-	    bCancel: "Peru"	
-	},
-	errors : {
-		errcap : "Virhe",
-		nourl : "url asettamatta",
-		norecords: "Ei muokattavia tietoja",
-	    model : "Pituus colNames <> colModel!"
-	},
-	formatter : {
-		integer : {thousandsSeparator: "", defaultValue: '0'},
-		number : {decimalSeparator:",", thousandsSeparator: "", decimalPlaces: 2, defaultValue: '0,00'},
-		currency : {decimalSeparator:",", thousandsSeparator: "", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0,00'},
-		date : {
-			dayNames:   [
-				"Su", "Ma", "Ti", "Ke", "To", "Pe", "La",
-				"Sunnuntai", "Maanantai", "Tiista", "Keskiviikko", "Torstai", "Perjantai", "Lauantai"
-			],
-			monthNames: [
-				"Tam", "Hel", "Maa", "Huh", "Tou", "Kes", "Hei", "Elo", "Syy", "Lok", "Mar", "Jou",
-				"Tammikuu", "Helmikuu", "Maaliskuu", "Huhtikuu", "Toukokuu", "Kes&auml;kuu", "Hein&auml;kuu", "Elokuu", "Syyskuu", "Lokakuu", "Marraskuu", "Joulukuu"
-			],
-			AmPm : ["am","pm","AM","PM"],
-			S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'},
-			srcformat: 'Y-m-d',
-			newformat: 'd/m/Y',
-			masks : {
-	            ISO8601Long:"Y-m-d H:i:s",
-	            ISO8601Short:"Y-m-d",
-	            ShortDate: "d.m.Y",
-	            LongDate: "l, F d, Y",
-	            FullDateTime: "l, F d, Y g:i:s A",
-	            MonthDay: "F d",
-	            ShortTime: "g:i A",
-	            LongTime: "g:i:s A",
-	            SortableDateTime: "Y-m-d\\TH:i:s",
-	            UniversalSortableDateTime: "Y-m-d H:i:sO",
-	            YearMonth: "F, Y"
-	        },
-	        reformatAfterEdit : false
-		},
-		baseLinkUrl: '',
-		showAction: '',
-	    target: '',
-	    checkbox : {disabled:true},
-		idName : 'id'
-	}
-};
-// FI
-})(jQuery);
+;(function($){
+/**
+ * jqGrid (fi) Finnish Translation
+ * Jukka Inkeri  awot.fi  2010-05-19
+ * Alex Grönholm  alex.gronholm@nextday.fi  2011-05-18
+ * http://awot.fi
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl.html
+**/
+$.jgrid = {
+	defaults: {
+		recordtext: "Rivit {0} - {1} / {2}",
+	    emptyrecords: "Ei n&auml;ytett&auml;vi&auml;",
+		loadtext: "Haetaan...",
+		pgtext: "Sivu {0} / {1}"
+	},
+	search: {
+	    caption: "Etsi...",
+	    Find: "Etsi",
+	    Reset: "Tyhjenn&auml;",
+	    odata: ['on', 'ei ole', 'pienempi', 'pienempi tai yht&auml;suuri','suurempi','suurempi tai yht&auml;suuri', 'alkaa','ei ala','joukossa','ei joukossa','loppuu','ei lopu','sis&auml;lt&auml;&auml;','ei sis&auml;ll&auml;','on tyhj&auml;','ei ole tyhj&auml;'],
+	    groupOps: [	{ op: "AND", text: "kaikki" }, { op: "OR", text: "mik&auml; tahansa" }	],
+		matchText: "&nbsp;&nbsp;t&auml;yt&auml; ehdot:",
+		rulesText: ""
+	},
+	edit: {
+	    addCaption: "Uusi rivi",
+	    editCaption: "Muokkaa rivi&auml;",
+	    bSubmit: "OK",
+	    bCancel: "Peru",
+		bClose: "Sulje",
+		saveData: "Tietoja muutettu! Tallennetaanko?",
+		bYes: "Kyll&auml;",
+		bNo: "Ei",
+		bExit: "Peru",
+	    msg: {
+	        required: "pakollinen",
+	        number: "Anna kelvollinen nro",
+	        minValue: "arvon oltava suurempi tai yht&auml;suuri kuin ",
+	        maxValue: "arvon oltava pienempi tai yht&auml;suuri kuin ",
+	        email: "ei ole kelvollinen s&auml;postiosoite",
+	        integer: "Anna kelvollinen kokonaisluku",
+			date: "Anna kelvollinen pvm",
+			url: "Ei ole kelvollinen linkki(URL). Alku oltava ('http://' tai 'https://')",
+			nodefined: " ei ole m&auml;&auml;ritelty!",
+			novalue: " paluuarvo vaaditaan!",
+			customarray: "Oman funktion tulee palauttaa jono!",
+			customfcheck: "Oma funktio on m&auml;&auml;ritelt&auml;v&auml; r&auml;&auml;t&auml;l&ouml;ity&auml; tarkastusta varten!"
+		}
+	},
+	view: {
+	    caption: "N&auml;yt&auml; rivi",
+	    bClose: "Sulje"
+	},
+	del: {
+	    caption: "Poista",
+	    msg: "Poista valitut rivit?",
+	    bSubmit: "Poista",
+	    bCancel: "Peru"
+	},
+	nav: {
+		edittext: "",
+	    edittitle: "Muokkaa valittua rivi&auml;",
+		addtext: "",
+	    addtitle: "Uusi rivi",
+	    deltext: "",
+	    deltitle: "Poista valittu rivi",
+	    searchtext: "",
+	    searchtitle: "Etsi tietoja",
+	    refreshtext: "",
+	    refreshtitle: "Lataa uudelleen",
+	    alertcap: "Varoitus",
+	    alerttext: "Valitse rivi",
+		viewtext: "",
+		viewtitle: "N&auml;yta valitut rivit"
+	},
+	col: {
+	    caption: "Valitse sarakkeet",
+	    bSubmit: "OK",
+	    bCancel: "Peru"	
+	},
+	errors : {
+		errcap: "Virhe",
+		nourl: "URL on asettamatta",
+		norecords: "Ei muokattavia tietoja",
+	    model: "Pituus colNames <> colModel!"
+	},
+	formatter: {
+		integer: {thousandsSeparator: "", defaultValue: '0'},
+		number: {decimalSeparator:",", thousandsSeparator: "", decimalPlaces: 2, defaultValue: '0,00'},
+		currency: {decimalSeparator:",", thousandsSeparator: "", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0,00'},
+		date: {
+			dayNames:   [
+				"Su", "Ma", "Ti", "Ke", "To", "Pe", "La",
+				"Sunnuntai", "Maanantai", "Tiistai", "Keskiviikko", "Torstai", "Perjantai", "Lauantai"
+			],
+			monthNames: [
+				"Tam", "Hel", "Maa", "Huh", "Tou", "Kes", "Hei", "Elo", "Syy", "Lok", "Mar", "Jou",
+				"Tammikuu", "Helmikuu", "Maaliskuu", "Huhtikuu", "Toukokuu", "Kes&auml;kuu", "Hein&auml;kuu", "Elokuu", "Syyskuu", "Lokakuu", "Marraskuu", "Joulukuu"
+			],
+			AmPm: ["am","pm","AM","PM"],
+			S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'},
+			srcformat: 'Y-m-d',
+			newformat: 'd.m.Y',
+			masks: {
+	            ISO8601Long:"Y-m-d H:i:s",
+	            ISO8601Short:"Y-m-d",
+	            ShortDate: "d.m.Y",
+	            LongDate: "l, F d, Y",
+	            FullDateTime: "l, F d, Y g:i:s A",
+	            MonthDay: "F d",
+	            ShortTime: "g:i A",
+	            LongTime: "g:i:s A",
+	            SortableDateTime: "Y-m-d\\TH:i:s",
+	            UniversalSortableDateTime: "Y-m-d H:i:sO",
+	            YearMonth: "F, Y"
+	        },
+	        reformatAfterEdit : false
+		},
+		baseLinkUrl: '',
+		showAction: '',
+	    target: '',
+	    checkbox: {disabled:true},
+		idName: 'id'
+	}
+};
+// FI
+})(jQuery);
Index: controlies/trunk/applications/controlies/static/js/jdgrid/src/i18n/grid.locale-cn.js
===================================================================
--- controlies/trunk/applications/controlies/static/js/jdgrid/src/i18n/grid.locale-cn.js	(revision 240)
+++ controlies/trunk/applications/controlies/static/js/jdgrid/src/i18n/grid.locale-cn.js	(revision 241)
@@ -1,132 +1,132 @@
-;(function($){
-/**
- * jqGrid Chinese Translation for v3.6
- * waiting 2010.01.18
- * http://waiting.javaeye.com/
- * Dual licensed under the MIT and GPL licenses:
- * http://www.opensource.org/licenses/mit-license.php
- * http://www.gnu.org/licenses/gpl.html
- * 
- * update 2010.05.04
- *		add double u3000 SPACE for search:odata to fix SEARCH box display err when narrow width from only use of eq/ne/cn/in/lt/gt operator under IE6/7
-**/
-$.jgrid = {
-	defaults : {
-		recordtext: "{0} - {1}\u3000共 {2} 条",	// 共字前是全角空格
-		emptyrecords: "无数据显示",
-		loadtext: "读取中...",
-		pgtext : " {0} 共 {1} 页"
-	},
-	search : {
-		caption: "搜索...",
-		Find: "查找",
-		Reset: "重置",
-		odata : ['等于\u3000\u3000', '不等\u3000\u3000', '小于\u3000\u3000', '小于等于','大于\u3000\u3000','大于等于', 
-			'开始于','不开始于','属于\u3000\u3000','不属于','结束于','不结束于','包含\u3000\u3000','不包含'],
-		groupOps: [	{ op: "AND", text: "所有" },	{ op: "OR",  text: "任一" }	],
-		matchText: " 匹配",
-		rulesText: " 规则"
-	},
-	edit : {
-		addCaption: "添加记录",
-		editCaption: "编辑记录",
-		bSubmit: "提交",
-		bCancel: "取消",
-		bClose: "关闭",
-		saveData: "数据已改变，是否保存？",
-		bYes : "是",
-		bNo : "否",
-		bExit : "取消",
-		msg: {
-			required:"此字段必需",
-			number:"请输入有效数字",
-			minValue:"输值必须大于等于 ",
-			maxValue:"输值必须小于等于 ",
-			email: "这不是有效的e-mail地址",
-			integer: "请输入有效整数",
-			date: "请输入有效时间",
-			url: "无效网址。前缀必须为 ('http://' 或 'https://')",
-			nodefined : " 未定义！",
-			novalue : " 需要返回值！",
-			customarray : "自定义函数需要返回数组！",
-			customfcheck : "Custom function should be present in case of custom checking!"
-			
-		}
-	},
-	view : {
-		caption: "查看记录",
-		bClose: "关闭"
-	},
-	del : {
-		caption: "删除",
-		msg: "删除所选记录？",
-		bSubmit: "删除",
-		bCancel: "取消"
-	},
-	nav : {
-		edittext: "",
-		edittitle: "编辑所选记录",
-		addtext:"",
-		addtitle: "添加新记录",
-		deltext: "",
-		deltitle: "删除所选记录",
-		searchtext: "",
-		searchtitle: "查找",
-		refreshtext: "",
-		refreshtitle: "刷新表格",
-		alertcap: "注意",
-		alerttext: "请选择记录",
-		viewtext: "",
-		viewtitle: "查看所选记录"
-	},
-	col : {
-		caption: "选择列",
-		bSubmit: "确定",
-		bCancel: "取消"
-	},
-	errors : {
-		errcap : "错误",
-		nourl : "没有设置url",
-		norecords: "没有要处理的记录",
-		model : "colNames 和 colModel 长度不等！"
-	},
-	formatter : {
-		integer : {thousandsSeparator: " ", defaultValue: '0'},
-		number : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0.00'},
-		currency : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0.00'},
-		date : {
-			dayNames:   [
-				"Sun", "Mon", "Tue", "Wed", "Thr", "Fri", "Sat",
-		         "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
-			],
-			monthNames: [
-				"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
-				"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
-			],
-			AmPm : ["am","pm","AM","PM"],
-			S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'},
-			srcformat: 'Y-m-d',
-			newformat: 'm-d-Y',
-			masks : {
-				ISO8601Long:"Y-m-d H:i:s",
-				ISO8601Short:"Y-m-d",
-				ShortDate: "Y/j/n",
-				LongDate: "l, F d, Y",
-				FullDateTime: "l, F d, Y g:i:s A",
-				MonthDay: "F d",
-				ShortTime: "g:i A",
-				LongTime: "g:i:s A",
-				SortableDateTime: "Y-m-d\\TH:i:s",
-				UniversalSortableDateTime: "Y-m-d H:i:sO",
-				YearMonth: "F, Y"
-			},
-			reformatAfterEdit : false
-		},
-		baseLinkUrl: '',
-		showAction: '',
-		target: '',
-		checkbox : {disabled:true},
-		idName : 'id'
-	}
-};
-})(jQuery);
+;(function($){
+/**
+ * jqGrid Chinese Translation for v3.6
+ * waiting 2010.01.18
+ * http://waiting.javaeye.com/
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl.html
+ * 
+ * update 2010.05.04
+ *		add double u3000 SPACE for search:odata to fix SEARCH box display err when narrow width from only use of eq/ne/cn/in/lt/gt operator under IE6/7
+**/
+$.jgrid = {
+	defaults : {
+		recordtext: "{0} - {1}\u3000共 {2} 条",	// 共字前是全角空格
+		emptyrecords: "无数据显示",
+		loadtext: "读取中...",
+		pgtext : " {0} 共 {1} 页"
+	},
+	search : {
+		caption: "搜索...",
+		Find: "查找",
+		Reset: "重置",
+		odata : ['等于\u3000\u3000', '不等\u3000\u3000', '小于\u3000\u3000', '小于等于','大于\u3000\u3000','大于等于', 
+			'开始于','不开始于','属于\u3000\u3000','不属于','结束于','不结束于','包含\u3000\u3000','不包含'],
+		groupOps: [	{ op: "AND", text: "所有" },	{ op: "OR",  text: "任一" }	],
+		matchText: " 匹配",
+		rulesText: " 规则"
+	},
+	edit : {
+		addCaption: "添加记录",
+		editCaption: "编辑记录",
+		bSubmit: "提交",
+		bCancel: "取消",
+		bClose: "关闭",
+		saveData: "数据已改变，是否保存？",
+		bYes : "是",
+		bNo : "否",
+		bExit : "取消",
+		msg: {
+			required:"此字段必需",
+			number:"请输入有效数字",
+			minValue:"输值必须大于等于 ",
+			maxValue:"输值必须小于等于 ",
+			email: "这不是有效的e-mail地址",
+			integer: "请输入有效整数",
+			date: "请输入有效时间",
+			url: "无效网址。前缀必须为 ('http://' 或 'https://')",
+			nodefined : " 未定义！",
+			novalue : " 需要返回值！",
+			customarray : "自定义函数需要返回数组！",
+			customfcheck : "Custom function should be present in case of custom checking!"
+			
+		}
+	},
+	view : {
+		caption: "查看记录",
+		bClose: "关闭"
+	},
+	del : {
+		caption: "删除",
+		msg: "删除所选记录？",
+		bSubmit: "删除",
+		bCancel: "取消"
+	},
+	nav : {
+		edittext: "",
+		edittitle: "编辑所选记录",
+		addtext:"",
+		addtitle: "添加新记录",
+		deltext: "",
+		deltitle: "删除所选记录",
+		searchtext: "",
+		searchtitle: "查找",
+		refreshtext: "",
+		refreshtitle: "刷新表格",
+		alertcap: "注意",
+		alerttext: "请选择记录",
+		viewtext: "",
+		viewtitle: "查看所选记录"
+	},
+	col : {
+		caption: "选择列",
+		bSubmit: "确定",
+		bCancel: "取消"
+	},
+	errors : {
+		errcap : "错误",
+		nourl : "没有设置url",
+		norecords: "没有要处理的记录",
+		model : "colNames 和 colModel 长度不等！"
+	},
+	formatter : {
+		integer : {thousandsSeparator: " ", defaultValue: '0'},
+		number : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0.00'},
+		currency : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0.00'},
+		date : {
+			dayNames:   [
+				"Sun", "Mon", "Tue", "Wed", "Thr", "Fri", "Sat",
+		         "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
+			],
+			monthNames: [
+				"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
+				"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
+			],
+			AmPm : ["am","pm","AM","PM"],
+			S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'},
+			srcformat: 'Y-m-d',
+			newformat: 'm-d-Y',
+			masks : {
+				ISO8601Long:"Y-m-d H:i:s",
+				ISO8601Short:"Y-m-d",
+				ShortDate: "Y/j/n",
+				LongDate: "l, F d, Y",
+				FullDateTime: "l, F d, Y g:i:s A",
+				MonthDay: "F d",
+				ShortTime: "g:i A",
+				LongTime: "g:i:s A",
+				SortableDateTime: "Y-m-d\\TH:i:s",
+				UniversalSortableDateTime: "Y-m-d H:i:sO",
+				YearMonth: "F, Y"
+			},
+			reformatAfterEdit : false
+		},
+		baseLinkUrl: '',
+		showAction: '',
+		target: '',
+		checkbox : {disabled:true},
+		idName : 'id'
+	}
+};
+})(jQuery);
Index: controlies/trunk/applications/controlies/static/js/jdgrid/src/i18n/grid.locale-el.js
===================================================================
--- controlies/trunk/applications/controlies/static/js/jdgrid/src/i18n/grid.locale-el.js	(revision 240)
+++ controlies/trunk/applications/controlies/static/js/jdgrid/src/i18n/grid.locale-el.js	(revision 241)
@@ -1,126 +1,126 @@
-;(function($){
-/**
- * jqGrid Greek (el) Translation
- * Alex Cicovic
- * http://www.alexcicovic.com
- * Dual licensed under the MIT and GPL licenses:
- * http://www.opensource.org/licenses/mit-license.php
- * http://www.gnu.org/licenses/gpl.html
-**/
-$.jgrid = {
-	defaults : {
-		recordtext: "View {0} - {1} of {2}",
-	    emptyrecords: "No records to view",
-		loadtext: "Φόρτωση...",
-		pgtext : "Page {0} of {1}"
-	},
-	search : {
-	    caption: "Αναζήτηση...",
-	    Find: "Εύρεση",
-	    Reset: "Επαναφορά",
-	    odata : ['equal', 'not equal', 'less', 'less or equal','greater','greater or equal', 'begins with','does not begin with','is in','is not in','ends with','does not end with','contains','does not contain'],
-	    groupOps: [	{ op: "AND", text: "all" },	{ op: "OR",  text: "any" }	],
-		matchText: " match",
-		rulesText: " rules"
-	},
-	edit : {
-	    addCaption: "Εισαγωγή Εγγραφής",
-	    editCaption: "Επεξεργασία Εγγραφής",
-	    bSubmit: "Καταχώρηση",
-	    bCancel: "Άκυρο",
-		bClose: "Κλείσιμο",
-		saveData: "Data has been changed! Save changes?",
-		bYes : "Yes",
-		bNo : "No",
-		bExit : "Cancel",
-	    msg: {
-	        required:"Το πεδίο είναι απαραίτητο",
-	        number:"Το πεδίο δέχεται μόνο αριθμούς",
-	        minValue:"Η τιμή πρέπει να είναι μεγαλύτερη ή ίση του ",
-	        maxValue:"Η τιμή πρέπει να είναι μικρότερη ή ίση του ",
-	        email: "Η διεύθυνση e-mail δεν είναι έγκυρη",
-	        integer: "Το πεδίο δέχεται μόνο ακέραιους αριθμούς",
-			url: "is not a valid URL. Prefix required ('http://' or 'https://')",
-			nodefined : " is not defined!",
-			novalue : " return value is required!",
-			customarray : "Custom function should return array!",
-			customfcheck : "Custom function should be present in case of custom checking!"
-		}
-	},
-	view : {
-	    caption: "View Record",
-	    bClose: "Close"
-	},
-	del : {
-	    caption: "Διαγραφή",
-	    msg: "Διαγραφή των επιλεγμένων εγγραφών;",
-	    bSubmit: "Ναι",
-	    bCancel: "Άκυρο"
-	},
-	nav : {
-		edittext: " ",
-	    edittitle: "Επεξεργασία επιλεγμένης εγγραφής",
-		addtext:" ",
-	    addtitle: "Εισαγωγή νέας εγγραφής",
-	    deltext: " ",
-	    deltitle: "Διαγραφή επιλεγμένης εγγραφής",
-	    searchtext: " ",
-	    searchtitle: "Εύρεση Εγγραφών",
-	    refreshtext: "",
-	    refreshtitle: "Ανανέωση Πίνακα",
-	    alertcap: "Προσοχή",
-	    alerttext: "Δεν έχετε επιλέξει εγγραφή",
-		viewtext: "",
-		viewtitle: "View selected row"
-	},
-	col : {
-	    caption: "Εμφάνιση / Απόκρυψη Στηλών",
-	    bSubmit: "ΟΚ",
-	    bCancel: "Άκυρο"
-	},
-	errors : {
-		errcap : "Σφάλμα",
-		nourl : "Δεν έχει δοθεί διεύθυνση χειρισμού για τη συγκεκριμένη ενέργεια",
-		norecords: "Δεν υπάρχουν εγγραφές προς επεξεργασία",
-		model : "Άνισος αριθμός πεδίων colNames/colModel!"
-	},
-	formatter : {
-		integer : {thousandsSeparator: " ", defaultValue: '0'},
-		number : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0.00'},
-		currency : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0.00'},
-		date : {
-			dayNames:   [
-				"Κυρ", "Δευ", "Τρι", "Τετ", "Πεμ", "Παρ", "Σαβ",
-				"Κυριακή", "Δευτέρα", "Τρίτη", "Τετάρτη", "Πέμπτη", "Παρασκευή", "Σάββατο"
-			],
-			monthNames: [
-				"Ιαν", "Φεβ", "Μαρ", "Απρ", "Μαι", "Ιουν", "Ιουλ", "Αυγ", "Σεπ", "Οκτ", "Νοε", "Δεκ",
-				"Ιανουάριος", "Φεβρουάριος", "Μάρτιος", "Απρίλιος", "Μάιος", "Ιούνιος", "Ιούλιος", "Αύγουστος", "Σεπτέμβριος", "Οκτώβριος", "Νοέμβριος", "Δεκέμβριος"
-			],
-			AmPm : ["πμ","μμ","ΠΜ","ΜΜ"],
-			S: function (j) {return j == 1 || j > 1 ? ['η'][Math.min((j - 1) % 10, 3)] : ''},
-			srcformat: 'Y-m-d',
-			newformat: 'd/m/Y',
-			masks : {
-	            ISO8601Long:"Y-m-d H:i:s",
-	            ISO8601Short:"Y-m-d",
-	            ShortDate: "n/j/Y",
-	            LongDate: "l, F d, Y",
-	            FullDateTime: "l, F d, Y g:i:s A",
-	            MonthDay: "F d",
-	            ShortTime: "g:i A",
-	            LongTime: "g:i:s A",
-	            SortableDateTime: "Y-m-d\\TH:i:s",
-	            UniversalSortableDateTime: "Y-m-d H:i:sO",
-	            YearMonth: "F, Y"
-	        },
-	        reformatAfterEdit : false
-		},
-		baseLinkUrl: '',
-		showAction: '',
-	    target: '',
-	    checkbox : {disabled:true},
-		idName : 'id'
-	}
-};
-})(jQuery);
+;(function($){
+/**
+ * jqGrid Greek (el) Translation
+ * Alex Cicovic
+ * http://www.alexcicovic.com
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl.html
+**/
+$.jgrid = {
+	defaults : {
+		recordtext: "View {0} - {1} of {2}",
+	    emptyrecords: "No records to view",
+		loadtext: "Φόρτωση...",
+		pgtext : "Page {0} of {1}"
+	},
+	search : {
+	    caption: "Αναζήτηση...",
+	    Find: "Εύρεση",
+	    Reset: "Επαναφορά",
+	    odata : ['equal', 'not equal', 'less', 'less or equal','greater','greater or equal', 'begins with','does not begin with','is in','is not in','ends with','does not end with','contains','does not contain'],
+	    groupOps: [	{ op: "AND", text: "all" },	{ op: "OR",  text: "any" }	],
+		matchText: " match",
+		rulesText: " rules"
+	},
+	edit : {
+	    addCaption: "Εισαγωγή Εγγραφής",
+	    editCaption: "Επεξεργασία Εγγραφής",
+	    bSubmit: "Καταχώρηση",
+	    bCancel: "Άκυρο",
+		bClose: "Κλείσιμο",
+		saveData: "Data has been changed! Save changes?",
+		bYes : "Yes",
+		bNo : "No",
+		bExit : "Cancel",
+	    msg: {
+	        required:"Το πεδίο είναι απαραίτητο",
+	        number:"Το πεδίο δέχεται μόνο αριθμούς",
+	        minValue:"Η τιμή πρέπει να είναι μεγαλύτερη ή ίση του ",
+	        maxValue:"Η τιμή πρέπει να είναι μικρότερη ή ίση του ",
+	        email: "Η διεύθυνση e-mail δεν είναι έγκυρη",
+	        integer: "Το πεδίο δέχεται μόνο ακέραιους αριθμούς",
+			url: "is not a valid URL. Prefix required ('http://' or 'https://')",
+			nodefined : " is not defined!",
+			novalue : " return value is required!",
+			customarray : "Custom function should return array!",
+			customfcheck : "Custom function should be present in case of custom checking!"
+		}
+	},
+	view : {
+	    caption: "View Record",
+	    bClose: "Close"
+	},
+	del : {
+	    caption: "Διαγραφή",
+	    msg: "Διαγραφή των επιλεγμένων εγγραφών;",
+	    bSubmit: "Ναι",
+	    bCancel: "Άκυρο"
+	},
+	nav : {
+		edittext: " ",
+	    edittitle: "Επεξεργασία επιλεγμένης εγγραφής",
+		addtext:" ",
+	    addtitle: "Εισαγωγή νέας εγγραφής",
+	    deltext: " ",
+	    deltitle: "Διαγραφή επιλεγμένης εγγραφής",
+	    searchtext: " ",
+	    searchtitle: "Εύρεση Εγγραφών",
+	    refreshtext: "",
+	    refreshtitle: "Ανανέωση Πίνακα",
+	    alertcap: "Προσοχή",
+	    alerttext: "Δεν έχετε επιλέξει εγγραφή",
+		viewtext: "",
+		viewtitle: "View selected row"
+	},
+	col : {
+	    caption: "Εμφάνιση / Απόκρυψη Στηλών",
+	    bSubmit: "ΟΚ",
+	    bCancel: "Άκυρο"
+	},
+	errors : {
+		errcap : "Σφάλμα",
+		nourl : "Δεν έχει δοθεί διεύθυνση χειρισμού για τη συγκεκριμένη ενέργεια",
+		norecords: "Δεν υπάρχουν εγγραφές προς επεξεργασία",
+		model : "Άνισος αριθμός πεδίων colNames/colModel!"
+	},
+	formatter : {
+		integer : {thousandsSeparator: " ", defaultValue: '0'},
+		number : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0.00'},
+		currency : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0.00'},
+		date : {
+			dayNames:   [
+				"Κυρ", "Δευ", "Τρι", "Τετ", "Πεμ", "Παρ", "Σαβ",
+				"Κυριακή", "Δευτέρα", "Τρίτη", "Τετάρτη", "Πέμπτη", "Παρασκευή", "Σάββατο"
+			],
+			monthNames: [
+				"Ιαν", "Φεβ", "Μαρ", "Απρ", "Μαι", "Ιουν", "Ιουλ", "Αυγ", "Σεπ", "Οκτ", "Νοε", "Δεκ",
+				"Ιανουάριος", "Φεβρουάριος", "Μάρτιος", "Απρίλιος", "Μάιος", "Ιούνιος", "Ιούλιος", "Αύγουστος", "Σεπτέμβριος", "Οκτώβριος", "Νοέμβριος", "Δεκέμβριος"
+			],
+			AmPm : ["πμ","μμ","ΠΜ","ΜΜ"],
+			S: function (j) {return j == 1 || j > 1 ? ['η'][Math.min((j - 1) % 10, 3)] : ''},
+			srcformat: 'Y-m-d',
+			newformat: 'd/m/Y',
+			masks : {
+	            ISO8601Long:"Y-m-d H:i:s",
+	            ISO8601Short:"Y-m-d",
+	            ShortDate: "n/j/Y",
+	            LongDate: "l, F d, Y",
+	            FullDateTime: "l, F d, Y g:i:s A",
+	            MonthDay: "F d",
+	            ShortTime: "g:i A",
+	            LongTime: "g:i:s A",
+	            SortableDateTime: "Y-m-d\\TH:i:s",
+	            UniversalSortableDateTime: "Y-m-d H:i:sO",
+	            YearMonth: "F, Y"
+	        },
+	        reformatAfterEdit : false
+		},
+		baseLinkUrl: '',
+		showAction: '',
+	    target: '',
+	    checkbox : {disabled:true},
+		idName : 'id'
+	}
+};
+})(jQuery);
Index: controlies/trunk/applications/controlies/static/js/jdgrid/src/i18n/grid.locale-bg1251.js
===================================================================
--- controlies/trunk/applications/controlies/static/js/jdgrid/src/i18n/grid.locale-bg1251.js	(revision 240)
+++ controlies/trunk/applications/controlies/static/js/jdgrid/src/i18n/grid.locale-bg1251.js	(revision 241)
@@ -1,132 +1,132 @@
-;(function($){
-/**
- * jqGrid Bulgarian Translation 
- * Tony Tomov tony@trirand.com
- * http://trirand.com/blog/ 
- * Dual licensed under the MIT and GPL licenses:
- * http://www.opensource.org/licenses/mit-license.php
- * http://www.gnu.org/licenses/gpl.html
-**/
-$.jgrid = {
-	defaults : {
-		recordtext: "{0} - {1} �� {2}",
-		emptyrecords: "���� �����(�)",
-		loadtext: "��������...",
-		pgtext : "���. {0} �� {1}"
-	},
-	search : {
-		caption: "�������...",
-		Find: "������",
-		Reset: "�������",
-		odata : ['�����', '��������', '��-�����', '��-����� ���=','��-������','��-������ ��� =', '������� �','�� ������� �','�� ������ �','�� �� ������ �','�������� �','�� ��������� �','�������', '�� �������' ],
-	    groupOps: [	{ op: "AND", text: " � " },	{ op: "OR",  text: "���" }	],
-		matchText: " ������",
-		rulesText: " ������"
-	},
-	edit : {
-		addCaption: "��� �����",
-		editCaption: "�������� �����",
-		bSubmit: "������",
-		bCancel: "�����",
-		bClose: "�������",
-		saveData: "������� �� ���������! �� ������� �� ���������?",
-		bYes : "��",
-		bNo : "��",
-		bExit : "�����",
-		msg: {
-		    required:"������ � ������������",
-		    number:"�������� ������� �����!",
-		    minValue:"���������� ������ �� � ��-������ ��� ����� ��",
-		    maxValue:"���������� ������ �� � ��-����� ��� ����� ��",
-		    email: "�� � ������� ��. �����",
-		    integer: "�������� ������� ���� �����",
-			date: "�������� ������� ����",
-			url: "e ��������� URL. �������� �� �������('http://' ��� 'https://')",
-			nodefined : " � ������������!",
-			novalue : " ������� ������� �� ��������!",
-			customarray : "������. ������� ������ �� ����� �����!",
-			customfcheck : "������������� ������� � ������������ ��� ���� ��� �������!"
-		}
-	},
-	view : {
-	    caption: "������� �����",
-	    bClose: "�������"
-	},
-	del : {
-		caption: "���������",
-		msg: "�� ������ �� ��������� �����?",
-		bSubmit: "������",
-		bCancel: "�����"
-	},
-	nav : {
-		edittext: " ",
-		edittitle: "�������� ������ �����",
-		addtext:" ",
-		addtitle: "�������� ��� �����",
-		deltext: " ",
-		deltitle: "��������� ������ �����",
-		searchtext: " ",
-		searchtitle: "������� �����(�)",
-		refreshtext: "",
-		refreshtitle: "������ �������",
-		alertcap: "��������������",
-		alerttext: "����, �������� �����",
-		viewtext: "",
-		viewtitle: "������� ������ �����"
-	},
-	col : {
-		caption: "����� ������",
-		bSubmit: "��",
-		bCancel: "�����"	
-	},
-	errors : {
-		errcap : "������",
-		nourl : "���� ������� url �����",
-		norecords: "���� ����� �� ���������",
-		model : "������ �� ����������� �� �������!"	
-	},
-	formatter : {
-		integer : {thousandsSeparator: " ", defaultValue: '0'},
-		number : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0.00'},
-		currency : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:" ��.", defaultValue: '0.00'},
-		date : {
-			dayNames:   [
-				"���", "���", "��", "��", "���", "���", "���",
-				"������", "����������", "�������", "�����", "���������", "�����", "������"
-			],
-			monthNames: [
-				"���", "���", "���", "���", "���", "���", "���", "���", "���", "���", "���", "���",
-				"������", "��������", "����", "�����", "���", "���", "���", "������", "���������", "��������", "�������", "��������"
-			],
-			AmPm : ["","","",""],
-			S: function (j) {
-				if(j==7 || j==8 || j== 27 || j== 28) {
-					return '��';
-				}
-				return ['��', '��', '��'][Math.min((j - 1) % 10, 2)];
-			},
-			srcformat: 'Y-m-d',
-			newformat: 'd/m/Y',
-			masks : {
-		        ISO8601Long:"Y-m-d H:i:s",
-		        ISO8601Short:"Y-m-d",
-		        ShortDate: "n/j/Y",
-		        LongDate: "l, F d, Y",
-		        FullDateTime: "l, F d, Y g:i:s A",
-		        MonthDay: "F d",
-		        ShortTime: "g:i A",
-		        LongTime: "g:i:s A",
-		        SortableDateTime: "Y-m-d\\TH:i:s",
-		        UniversalSortableDateTime: "Y-m-d H:i:sO",
-		        YearMonth: "F, Y"
-		    },
-		    reformatAfterEdit : false
-		},
-		baseLinkUrl: '',
-		showAction: '',
-		target: '',
-		checkbox : {disabled:true},
-		idName : 'id'
-	}
-};
-})(jQuery);
+;(function($){
+/**
+ * jqGrid Bulgarian Translation 
+ * Tony Tomov tony@trirand.com
+ * http://trirand.com/blog/ 
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl.html
+**/
+$.jgrid = {
+	defaults : {
+		recordtext: "{0} - {1} �� {2}",
+		emptyrecords: "���� �����(�)",
+		loadtext: "��������...",
+		pgtext : "���. {0} �� {1}"
+	},
+	search : {
+		caption: "�������...",
+		Find: "������",
+		Reset: "�������",
+		odata : ['�����', '��������', '��-�����', '��-����� ���=','��-������','��-������ ��� =', '������� �','�� ������� �','�� ������ �','�� �� ������ �','�������� �','�� ��������� �','�������', '�� �������' ],
+	    groupOps: [	{ op: "AND", text: " � " },	{ op: "OR",  text: "���" }	],
+		matchText: " ������",
+		rulesText: " ������"
+	},
+	edit : {
+		addCaption: "��� �����",
+		editCaption: "�������� �����",
+		bSubmit: "������",
+		bCancel: "�����",
+		bClose: "�������",
+		saveData: "������� �� ���������! �� ������� �� ���������?",
+		bYes : "��",
+		bNo : "��",
+		bExit : "�����",
+		msg: {
+		    required:"������ � ������������",
+		    number:"�������� ������� �����!",
+		    minValue:"���������� ������ �� � ��-������ ��� ����� ��",
+		    maxValue:"���������� ������ �� � ��-����� ��� ����� ��",
+		    email: "�� � ������� ��. �����",
+		    integer: "�������� ������� ���� �����",
+			date: "�������� ������� ����",
+			url: "e ��������� URL. �������� �� �������('http://' ��� 'https://')",
+			nodefined : " � ������������!",
+			novalue : " ������� ������� �� ��������!",
+			customarray : "������. ������� ������ �� ����� �����!",
+			customfcheck : "������������� ������� � ������������ ��� ���� ��� �������!"
+		}
+	},
+	view : {
+	    caption: "������� �����",
+	    bClose: "�������"
+	},
+	del : {
+		caption: "���������",
+		msg: "�� ������ �� ��������� �����?",
+		bSubmit: "������",
+		bCancel: "�����"
+	},
+	nav : {
+		edittext: " ",
+		edittitle: "�������� ������ �����",
+		addtext:" ",
+		addtitle: "�������� ��� �����",
+		deltext: " ",
+		deltitle: "��������� ������ �����",
+		searchtext: " ",
+		searchtitle: "������� �����(�)",
+		refreshtext: "",
+		refreshtitle: "������ �������",
+		alertcap: "��������������",
+		alerttext: "����, �������� �����",
+		viewtext: "",
+		viewtitle: "������� ������ �����"
+	},
+	col : {
+		caption: "����� ������",
+		bSubmit: "��",
+		bCancel: "�����"	
+	},
+	errors : {
+		errcap : "������",
+		nourl : "���� ������� url �����",
+		norecords: "���� ����� �� ���������",
+		model : "������ �� ����������� �� �������!"	
+	},
+	formatter : {
+		integer : {thousandsSeparator: " ", defaultValue: '0'},
+		number : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0.00'},
+		currency : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:" ��.", defaultValue: '0.00'},
+		date : {
+			dayNames:   [
+				"���", "���", "��", "��", "���", "���", "���",
+				"������", "����������", "�������", "�����", "���������", "�����", "������"
+			],
+			monthNames: [
+				"���", "���", "���", "���", "���", "���", "���", "���", "���", "���", "���", "���",
+				"������", "��������", "����", "�����", "���", "���", "���", "������", "���������", "��������", "�������", "��������"
+			],
+			AmPm : ["","","",""],
+			S: function (j) {
+				if(j==7 || j==8 || j== 27 || j== 28) {
+					return '��';
+				}
+				return ['��', '��', '��'][Math.min((j - 1) % 10, 2)];
+			},
+			srcformat: 'Y-m-d',
+			newformat: 'd/m/Y',
+			masks : {
+		        ISO8601Long:"Y-m-d H:i:s",
+		        ISO8601Short:"Y-m-d",
+		        ShortDate: "n/j/Y",
+		        LongDate: "l, F d, Y",
+		        FullDateTime: "l, F d, Y g:i:s A",
+		        MonthDay: "F d",
+		        ShortTime: "g:i A",
+		        LongTime: "g:i:s A",
+		        SortableDateTime: "Y-m-d\\TH:i:s",
+		        UniversalSortableDateTime: "Y-m-d H:i:sO",
+		        YearMonth: "F, Y"
+		    },
+		    reformatAfterEdit : false
+		},
+		baseLinkUrl: '',
+		showAction: '',
+		target: '',
+		checkbox : {disabled:true},
+		idName : 'id'
+	}
+};
+})(jQuery);
Index: controlies/trunk/applications/controlies/static/js/jdgrid/src/i18n/grid.locale-en.js
===================================================================
--- controlies/trunk/applications/controlies/static/js/jdgrid/src/i18n/grid.locale-en.js	(revision 240)
+++ controlies/trunk/applications/controlies/static/js/jdgrid/src/i18n/grid.locale-en.js	(revision 241)
@@ -1,128 +1,128 @@
-;(function($){
-/**
- * jqGrid English Translation
- * Tony Tomov tony@trirand.com
- * http://trirand.com/blog/ 
- * Dual licensed under the MIT and GPL licenses:
- * http://www.opensource.org/licenses/mit-license.php
- * http://www.gnu.org/licenses/gpl.html
-**/
-$.jgrid = {
-	defaults : {
-		recordtext: "View {0} - {1} of {2}",
-		emptyrecords: "No records to view",
-		loadtext: "Loading...",
-		pgtext : "Page {0} of {1}"
-	},
-	search : {
-		caption: "Search...",
-		Find: "Find",
-		Reset: "Reset",
-		odata : ['equal', 'not equal', 'less', 'less or equal','greater','greater or equal', 'begins with','does not begin with','is in','is not in','ends with','does not end with','contains','does not contain'],
-		groupOps: [	{ op: "AND", text: "all" },	{ op: "OR",  text: "any" }	],
-		matchText: " match",
-		rulesText: " rules"
-	},
-	edit : {
-		addCaption: "Add Record",
-		editCaption: "Edit Record",
-		bSubmit: "Submit",
-		bCancel: "Cancel",
-		bClose: "Close",
-		saveData: "Data has been changed! Save changes?",
-		bYes : "Yes",
-		bNo : "No",
-		bExit : "Cancel",
-		msg: {
-			required:"Field is required",
-			number:"Please, enter valid number",
-			minValue:"value must be greater than or equal to ",
-			maxValue:"value must be less than or equal to",
-			email: "is not a valid e-mail",
-			integer: "Please, enter valid integer value",
-			date: "Please, enter valid date value",
-			url: "is not a valid URL. Prefix required ('http://' or 'https://')",
-			nodefined : " is not defined!",
-			novalue : " return value is required!",
-			customarray : "Custom function should return array!",
-			customfcheck : "Custom function should be present in case of custom checking!"
-			
-		}
-	},
-	view : {
-		caption: "View Record",
-		bClose: "Close"
-	},
-	del : {
-		caption: "Delete",
-		msg: "Delete selected record(s)?",
-		bSubmit: "Delete",
-		bCancel: "Cancel"
-	},
-	nav : {
-		edittext: "",
-		edittitle: "Edit selected row",
-		addtext:"",
-		addtitle: "Add new row",
-		deltext: "",
-		deltitle: "Delete selected row",
-		searchtext: "",
-		searchtitle: "Find records",
-		refreshtext: "",
-		refreshtitle: "Reload Grid",
-		alertcap: "Warning",
-		alerttext: "Please, select row",
-		viewtext: "",
-		viewtitle: "View selected row"
-	},
-	col : {
-		caption: "Select columns",
-		bSubmit: "Ok",
-		bCancel: "Cancel"
-	},
-	errors : {
-		errcap : "Error",
-		nourl : "No url is set",
-		norecords: "No records to process",
-		model : "Length of colNames <> colModel!"
-	},
-	formatter : {
-		integer : {thousandsSeparator: " ", defaultValue: '0'},
-		number : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0.00'},
-		currency : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0.00'},
-		date : {
-			dayNames:   [
-				"Sun", "Mon", "Tue", "Wed", "Thr", "Fri", "Sat",
-				"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
-			],
-			monthNames: [
-				"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
-				"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
-			],
-			AmPm : ["am","pm","AM","PM"],
-			S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'},
-			srcformat: 'Y-m-d',
-			newformat: 'd/m/Y',
-			masks : {
-				ISO8601Long:"Y-m-d H:i:s",
-				ISO8601Short:"Y-m-d",
-				ShortDate: "n/j/Y",
-				LongDate: "l, F d, Y",
-				FullDateTime: "l, F d, Y g:i:s A",
-				MonthDay: "F d",
-				ShortTime: "g:i A",
-				LongTime: "g:i:s A",
-				SortableDateTime: "Y-m-d\\TH:i:s",
-				UniversalSortableDateTime: "Y-m-d H:i:sO",
-				YearMonth: "F, Y"
-			},
-			reformatAfterEdit : false
-		},
-		baseLinkUrl: '',
-		showAction: '',
-		target: '',
-		checkbox : {disabled:true},
-		idName : 'id'
-	}
-};
-})(jQuery);
+;(function($){
+/**
+ * jqGrid English Translation
+ * Tony Tomov tony@trirand.com
+ * http://trirand.com/blog/ 
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl.html
+**/
+$.jgrid = {
+	defaults : {
+		recordtext: "View {0} - {1} of {2}",
+		emptyrecords: "No records to view",
+		loadtext: "Loading...",
+		pgtext : "Page {0} of {1}"
+	},
+	search : {
+		caption: "Search...",
+		Find: "Find",
+		Reset: "Reset",
+		odata : ['equal', 'not equal', 'less', 'less or equal','greater','greater or equal', 'begins with','does not begin with','is in','is not in','ends with','does not end with','contains','does not contain'],
+		groupOps: [	{ op: "AND", text: "all" },	{ op: "OR",  text: "any" }	],
+		matchText: " match",
+		rulesText: " rules"
+	},
+	edit : {
+		addCaption: "Add Record",
+		editCaption: "Edit Record",
+		bSubmit: "Submit",
+		bCancel: "Cancel",
+		bClose: "Close",
+		saveData: "Data has been changed! Save changes?",
+		bYes : "Yes",
+		bNo : "No",
+		bExit : "Cancel",
+		msg: {
+			required:"Field is required",
+			number:"Please, enter valid number",
+			minValue:"value must be greater than or equal to ",
+			maxValue:"value must be less than or equal to",
+			email: "is not a valid e-mail",
+			integer: "Please, enter valid integer value",
+			date: "Please, enter valid date value",
+			url: "is not a valid URL. Prefix required ('http://' or 'https://')",
+			nodefined : " is not defined!",
+			novalue : " return value is required!",
+			customarray : "Custom function should return array!",
+			customfcheck : "Custom function should be present in case of custom checking!"
+			
+		}
+	},
+	view : {
+		caption: "View Record",
+		bClose: "Close"
+	},
+	del : {
+		caption: "Delete",
+		msg: "Delete selected record(s)?",
+		bSubmit: "Delete",
+		bCancel: "Cancel"
+	},
+	nav : {
+		edittext: "",
+		edittitle: "Edit selected row",
+		addtext:"",
+		addtitle: "Add new row",
+		deltext: "",
+		deltitle: "Delete selected row",
+		searchtext: "",
+		searchtitle: "Find records",
+		refreshtext: "",
+		refreshtitle: "Reload Grid",
+		alertcap: "Warning",
+		alerttext: "Please, select row",
+		viewtext: "",
+		viewtitle: "View selected row"
+	},
+	col : {
+		caption: "Select columns",
+		bSubmit: "Ok",
+		bCancel: "Cancel"
+	},
+	errors : {
+		errcap : "Error",
+		nourl : "No url is set",
+		norecords: "No records to process",
+		model : "Length of colNames <> colModel!"
+	},
+	formatter : {
+		integer : {thousandsSeparator: " ", defaultValue: '0'},
+		number : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0.00'},
+		currency : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0.00'},
+		date : {
+			dayNames:   [
+				"Sun", "Mon", "Tue", "Wed", "Thr", "Fri", "Sat",
+				"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
+			],
+			monthNames: [
+				"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
+				"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
+			],
+			AmPm : ["am","pm","AM","PM"],
+			S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'},
+			srcformat: 'Y-m-d',
+			newformat: 'd/m/Y',
+			masks : {
+				ISO8601Long:"Y-m-d H:i:s",
+				ISO8601Short:"Y-m-d",
+				ShortDate: "n/j/Y",
+				LongDate: "l, F d, Y",
+				FullDateTime: "l, F d, Y g:i:s A",
+				MonthDay: "F d",
+				ShortTime: "g:i A",
+				LongTime: "g:i:s A",
+				SortableDateTime: "Y-m-d\\TH:i:s",
+				UniversalSortableDateTime: "Y-m-d H:i:sO",
+				YearMonth: "F, Y"
+			},
+			reformatAfterEdit : false
+		},
+		baseLinkUrl: '',
+		showAction: '',
+		target: '',
+		checkbox : {disabled:true},
+		idName : 'id'
+	}
+};
+})(jQuery);
Index: controlies/trunk/applications/controlies/static/js/jdgrid/src/i18n/grid.locale-ua.js
===================================================================
--- controlies/trunk/applications/controlies/static/js/jdgrid/src/i18n/grid.locale-ua.js	(revision 240)
+++ controlies/trunk/applications/controlies/static/js/jdgrid/src/i18n/grid.locale-ua.js	(revision 241)
@@ -1,127 +1,127 @@
-;(function($){
-/**
- * jqGrid Ukrainian Translation v1.0 02.07.2009
- * Sergey Dyagovchenko
- * http://d.sumy.ua
- * Dual licensed under the MIT and GPL licenses:
- * http://www.opensource.org/licenses/mit-license.php
- * http://www.gnu.org/licenses/gpl.html
-**/
-$.jgrid = {
-	defaults : {
-		recordtext: "Перегляд {0} - {1} з {2}",
-	  emptyrecords: "Немає записів для перегляду",
-		loadtext: "Завантаження...",
-		pgtext : "Стор. {0} з {1}"
-	},
-	search : {
-    caption: "Пошук...",
-    Find: "Знайти",
-    Reset: "Скидання",
-    odata : ['рівно', 'не рівно', 'менше', 'менше або рівне','більше','більше або рівне', 'починається з','не починається з','знаходиться в','не знаходиться в','закінчується на','не закінчується на','містить','не містить'],
-    groupOps: [	{ op: "AND", text: "все" },	{ op: "OR",  text: "будь-який" }	],
-    matchText: " збігається",
-    rulesText: " правила"
-	},
-	edit : {
-    addCaption: "Додати запис",
-    editCaption: "Змінити запис",
-    bSubmit: "Зберегти",
-    bCancel: "Відміна",
-		bClose: "Закрити",
-		saveData: "До данних були внесені зміни! Зберегти зміни?",
-		bYes : "Так",
-		bNo : "Ні",
-		bExit : "Відміна",
-	    msg: {
-        required:"Поле є обов'язковим",
-        number:"Будь ласка, введіть правильне число",
-        minValue:"значення повинне бути більше або дорівнює",
-        maxValue:"значення повинно бути менше або дорівнює",
-        email: "некоректна адреса електронної пошти",
-        integer: "Будь ласка, введення дійсне ціле значення",
-        date: "Будь ласка, введення дійсне значення дати",
-        url: "не дійсний URL. Необхідна приставка ('http://' or 'https://')",
-		nodefined : " is not defined!",
-		novalue : " return value is required!",
-		customarray : "Custom function should return array!",
-		customfcheck : "Custom function should be present in case of custom checking!"
-		}
-	},
-	view : {
-	    caption: "Переглянути запис",
-	    bClose: "Закрити"
-	},
-	del : {
-	    caption: "Видалити",
-	    msg: "Видалити обраний запис(и)?",
-	    bSubmit: "Видалити",
-	    bCancel: "Відміна"
-	},
-	nav : {
-  		edittext: " ",
-	    edittitle: "Змінити вибраний запис",
-  		addtext:" ",
-	    addtitle: "Додати новий запис",
-	    deltext: " ",
-	    deltitle: "Видалити вибраний запис",
-	    searchtext: " ",
-	    searchtitle: "Знайти записи",
-	    refreshtext: "",
-	    refreshtitle: "Оновити таблицю",
-	    alertcap: "Попередження",
-	    alerttext: "Будь ласка, виберіть запис",
-  		viewtext: "",
-  		viewtitle: "Переглянути обраний запис"
-	},
-	col : {
-	    caption: "Показати/Приховати стовпці",
-	    bSubmit: "Зберегти",
-	    bCancel: "Відміна"
-	},
-	errors : {
-		errcap : "Помилка",
-		nourl : "URL не задан",
-		norecords: "Немає записів для обробки",
-    model : "Число полів не відповідає числу стовпців таблиці!"
-	},
-	formatter : {
-		integer : {thousandsSeparator: " ", defaultValue: '0'},
-		number : {decimalSeparator:",", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0,00'},
-		currency : {decimalSeparator:",", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0,00'},
-		date : {
-			dayNames:   [
-				"Нд", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб",
-				"Неділя", "Понеділок", "Вівторок", "Середа", "Четвер", "П'ятниця", "Субота"
-			],
-			monthNames: [
-				"Січ", "Лют", "Бер", "Кві", "Тра", "Чер", "Лип", "Сер", "Вер", "Жов", "Лис", "Гру",
-				"Січень", "Лютий", "Березень", "Квітень", "Травень", "Червень", "Липень", "Серпень", "Вересень", "Жовтень", "Листопад", "Грудень"
-			],
-			AmPm : ["am","pm","AM","PM"],
-			S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'},
-			srcformat: 'Y-m-d',
-			newformat: 'd.m.Y',
-			masks : {
-	            ISO8601Long:"Y-m-d H:i:s",
-	            ISO8601Short:"Y-m-d",
-	            ShortDate: "n.j.Y",
-	            LongDate: "l, F d, Y",
-	            FullDateTime: "l, F d, Y G:i:s",
-	            MonthDay: "F d",
-	            ShortTime: "G:i",
-	            LongTime: "G:i:s",
-	            SortableDateTime: "Y-m-d\\TH:i:s",
-	            UniversalSortableDateTime: "Y-m-d H:i:sO",
-	            YearMonth: "F, Y"
-	        },
-	        reformatAfterEdit : false
-		},
-		baseLinkUrl: '',
-		showAction: '',
-	  target: '',
-	  checkbox : {disabled:true},
-		idName : 'id'
-	}
-};
-})(jQuery);
+;(function($){
+/**
+ * jqGrid Ukrainian Translation v1.0 02.07.2009
+ * Sergey Dyagovchenko
+ * http://d.sumy.ua
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl.html
+**/
+$.jgrid = {
+	defaults : {
+		recordtext: "Перегляд {0} - {1} з {2}",
+	  emptyrecords: "Немає записів для перегляду",
+		loadtext: "Завантаження...",
+		pgtext : "Стор. {0} з {1}"
+	},
+	search : {
+    caption: "Пошук...",
+    Find: "Знайти",
+    Reset: "Скидання",
+    odata : ['рівно', 'не рівно', 'менше', 'менше або рівне','більше','більше або рівне', 'починається з','не починається з','знаходиться в','не знаходиться в','закінчується на','не закінчується на','містить','не містить'],
+    groupOps: [	{ op: "AND", text: "все" },	{ op: "OR",  text: "будь-який" }	],
+    matchText: " збігається",
+    rulesText: " правила"
+	},
+	edit : {
+    addCaption: "Додати запис",
+    editCaption: "Змінити запис",
+    bSubmit: "Зберегти",
+    bCancel: "Відміна",
+		bClose: "Закрити",
+		saveData: "До данних були внесені зміни! Зберегти зміни?",
+		bYes : "Так",
+		bNo : "Ні",
+		bExit : "Відміна",
+	    msg: {
+        required:"Поле є обов'язковим",
+        number:"Будь ласка, введіть правильне число",
+        minValue:"значення повинне бути більше або дорівнює",
+        maxValue:"значення повинно бути менше або дорівнює",
+        email: "некоректна адреса електронної пошти",
+        integer: "Будь ласка, введення дійсне ціле значення",
+        date: "Будь ласка, введення дійсне значення дати",
+        url: "не дійсний URL. Необхідна приставка ('http://' or 'https://')",
+		nodefined : " is not defined!",
+		novalue : " return value is required!",
+		customarray : "Custom function should return array!",
+		customfcheck : "Custom function should be present in case of custom checking!"
+		}
+	},
+	view : {
+	    caption: "Переглянути запис",
+	    bClose: "Закрити"
+	},
+	del : {
+	    caption: "Видалити",
+	    msg: "Видалити обраний запис(и)?",
+	    bSubmit: "Видалити",
+	    bCancel: "Відміна"
+	},
+	nav : {
+  		edittext: " ",
+	    edittitle: "Змінити вибраний запис",
+  		addtext:" ",
+	    addtitle: "Додати новий запис",
+	    deltext: " ",
+	    deltitle: "Видалити вибраний запис",
+	    searchtext: " ",
+	    searchtitle: "Знайти записи",
+	    refreshtext: "",
+	    refreshtitle: "Оновити таблицю",
+	    alertcap: "Попередження",
+	    alerttext: "Будь ласка, виберіть запис",
+  		viewtext: "",
+  		viewtitle: "Переглянути обраний запис"
+	},
+	col : {
+	    caption: "Показати/Приховати стовпці",
+	    bSubmit: "Зберегти",
+	    bCancel: "Відміна"
+	},
+	errors : {
+		errcap : "Помилка",
+		nourl : "URL не задан",
+		norecords: "Немає записів для обробки",
+    model : "Число полів не відповідає числу стовпців таблиці!"
+	},
+	formatter : {
+		integer : {thousandsSeparator: " ", defaultValue: '0'},
+		number : {decimalSeparator:",", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0,00'},
+		currency : {decimalSeparator:",", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0,00'},
+		date : {
+			dayNames:   [
+				"Нд", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб",
+				"Неділя", "Понеділок", "Вівторок", "Середа", "Четвер", "П'ятниця", "Субота"
+			],
+			monthNames: [
+				"Січ", "Лют", "Бер", "Кві", "Тра", "Чер", "Лип", "Сер", "Вер", "Жов", "Лис", "Гру",
+				"Січень", "Лютий", "Березень", "Квітень", "Травень", "Червень", "Липень", "Серпень", "Вересень", "Жовтень", "Листопад", "Грудень"
+			],
+			AmPm : ["am","pm","AM","PM"],
+			S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'},
+			srcformat: 'Y-m-d',
+			newformat: 'd.m.Y',
+			masks : {
+	            ISO8601Long:"Y-m-d H:i:s",
+	            ISO8601Short:"Y-m-d",
+	            ShortDate: "n.j.Y",
+	            LongDate: "l, F d, Y",
+	            FullDateTime: "l, F d, Y G:i:s",
+	            MonthDay: "F d",
+	            ShortTime: "G:i",
+	            LongTime: "G:i:s",
+	            SortableDateTime: "Y-m-d\\TH:i:s",
+	            UniversalSortableDateTime: "Y-m-d H:i:sO",
+	            YearMonth: "F, Y"
+	        },
+	        reformatAfterEdit : false
+		},
+		baseLinkUrl: '',
+		showAction: '',
+	  target: '',
+	  checkbox : {disabled:true},
+		idName : 'id'
+	}
+};
+})(jQuery);
Index: controlies/trunk/applications/controlies/static/js/jdgrid/src/i18n/grid.locale-cs.js
===================================================================
--- controlies/trunk/applications/controlies/static/js/jdgrid/src/i18n/grid.locale-cs.js	(revision 240)
+++ controlies/trunk/applications/controlies/static/js/jdgrid/src/i18n/grid.locale-cs.js	(revision 241)
@@ -1,128 +1,128 @@
-;(function($){
-/**
- * jqGrid Czech Translation
- * Pavel Jirak pavel.jirak@jipas.cz
- * doplnil Thomas Wagner xwagne01@stud.fit.vutbr.cz
- * http://trirand.com/blog/ 
- * Dual licensed under the MIT and GPL licenses:
- * http://www.opensource.org/licenses/mit-license.php
- * http://www.gnu.org/licenses/gpl.html
-**/
-$.jgrid = {
-	defaults : {
-		recordtext: "Zobrazeno {0} - {1} z {2} záznamů",
-	    emptyrecords: "Nenalezeny žádné záznamy",
-		loadtext: "Načítám...",
-		pgtext : "Strana {0} z {1}"
-	},
-	search : {
-		caption: "Vyhledávám...",
-		Find: "Hledat",
-		Reset: "Reset",
-	    odata : ['rovno', 'nerovono', 'menší', 'menší nebo rovno','větší', 'větší nebo rovno', 'začíná s', 'nezačíná s', 'je v', 'není v', 'končí s', 'nekončí s', 'obahuje', 'neobsahuje'],
-	    groupOps: [	{ op: "AND", text: "všech" },	{ op: "OR",  text: "některého z" }	],
-		matchText: " hledat podle",
-		rulesText: " pravidel"
-	},
-	edit : {
-		addCaption: "Přidat záznam",
-		editCaption: "Editace záznamu",
-		bSubmit: "Uložit",
-		bCancel: "Storno",
-		bClose: "Zavřít",
-		saveData: "Data byla změněna! Uložit změny?",
-		bYes : "Ano",
-		bNo : "Ne",
-		bExit : "Zrušit",
-		msg: {
-		    required:"Pole je vyžadováno",
-		    number:"Prosím, vložte validní číslo",
-		    minValue:"hodnota musí být větší než nebo rovná ",
-		    maxValue:"hodnota musí být menší než nebo rovná ",
-		    email: "není validní e-mail",
-		    integer: "Prosím, vložte celé číslo",
-			date: "Prosím, vložte validní datum",
-			url: "není platnou URL. Vyžadován prefix ('http://' or 'https://')",
-			nodefined : " není definován!",
-			novalue : " je vyžadována návratová hodnota!",
-			customarray : "Custom function mělá vrátit pole!",
-			customfcheck : "Custom function by měla být přítomna v případě custom checking!"
-		}
-	},
-	view : {
-	    caption: "Zobrazit záznam",
-	    bClose: "Zavřít"
-	},
-	del : {
-		caption: "Smazat",
-		msg: "Smazat vybraný(é) záznam(y)?",
-		bSubmit: "Smazat",
-		bCancel: "Storno"
-	},
-	nav : {
-		edittext: " ",
-		edittitle: "Editovat vybraný řádek",
-		addtext:" ",
-		addtitle: "Přidat nový řádek",
-		deltext: " ",
-		deltitle: "Smazat vybraný záznam ",
-		searchtext: " ",
-		searchtitle: "Najít záznamy",
-		refreshtext: "",
-		refreshtitle: "Obnovit tabulku",
-		alertcap: "Varování",
-		alerttext: "Prosím, vyberte řádek",
-		viewtext: "",
-		viewtitle: "Zobrazit vybraný řádek"
-	},
-	col : {
-		caption: "Zobrazit/Skrýt sloupce",
-		bSubmit: "Uložit",
-		bCancel: "Storno"	
-	},
-	errors : {
-		errcap : "Chyba",
-		nourl : "Není nastavena url",
-		norecords: "Žádné záznamy ke zpracování",
-		model : "Délka colNames <> colModel!"
-	},
-	formatter : {
-		integer : {thousandsSeparator: " ", defaultValue: '0'},
-		number : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0.00'},
-		currency : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0.00'},
-		date : {
-			dayNames:   [
-				"Ne", "Po", "Út", "St", "Čt", "Pá", "So",
-				"Neděle", "Pondělí", "Úterý", "Středa", "Čtvrtek", "Pátek", "Sobota"
-			],
-			monthNames: [
-				"Led", "Úno", "Bře", "Dub", "Kvě", "Čer", "Čvc", "Srp", "Zář", "Říj", "Lis", "Pro",
-				"Leden", "Únor", "Březen", "Duben", "Květen", "Červen", "Červenec", "Srpen", "Září", "Říjen", "Listopad", "Prosinec"
-			],
-			AmPm : ["do","od","DO","OD"],
-			S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'},
-			srcformat: 'Y-m-d',
-			newformat: 'd/m/Y',
-			masks : {
-		        ISO8601Long:"Y-m-d H:i:s",
-		        ISO8601Short:"Y-m-d",
-		        ShortDate: "n/j/Y",
-		        LongDate: "l, F d, Y",
-		        FullDateTime: "l, F d, Y g:i:s A",
-		        MonthDay: "F d",
-		        ShortTime: "g:i A",
-		        LongTime: "g:i:s A",
-		        SortableDateTime: "Y-m-d\\TH:i:s",
-		        UniversalSortableDateTime: "Y-m-d H:i:sO",
-		        YearMonth: "F, Y"
-		    },
-		    reformatAfterEdit : false
-		},
-		baseLinkUrl: '',
-		showAction: '',
-	    target: '',
-	    checkbox : {disabled:true},
-		idName : 'id'
-	}
-};
-})(jQuery);
+;(function($){
+/**
+ * jqGrid Czech Translation
+ * Pavel Jirak pavel.jirak@jipas.cz
+ * doplnil Thomas Wagner xwagne01@stud.fit.vutbr.cz
+ * http://trirand.com/blog/ 
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl.html
+**/
+$.jgrid = {
+	defaults : {
+		recordtext: "Zobrazeno {0} - {1} z {2} záznamů",
+	    emptyrecords: "Nenalezeny žádné záznamy",
+		loadtext: "Načítám...",
+		pgtext : "Strana {0} z {1}"
+	},
+	search : {
+		caption: "Vyhledávám...",
+		Find: "Hledat",
+		Reset: "Reset",
+	    odata : ['rovno', 'nerovono', 'menší', 'menší nebo rovno','větší', 'větší nebo rovno', 'začíná s', 'nezačíná s', 'je v', 'není v', 'končí s', 'nekončí s', 'obahuje', 'neobsahuje'],
+	    groupOps: [	{ op: "AND", text: "všech" },	{ op: "OR",  text: "některého z" }	],
+		matchText: " hledat podle",
+		rulesText: " pravidel"
+	},
+	edit : {
+		addCaption: "Přidat záznam",
+		editCaption: "Editace záznamu",
+		bSubmit: "Uložit",
+		bCancel: "Storno",
+		bClose: "Zavřít",
+		saveData: "Data byla změněna! Uložit změny?",
+		bYes : "Ano",
+		bNo : "Ne",
+		bExit : "Zrušit",
+		msg: {
+		    required:"Pole je vyžadováno",
+		    number:"Prosím, vložte validní číslo",
+		    minValue:"hodnota musí být větší než nebo rovná ",
+		    maxValue:"hodnota musí být menší než nebo rovná ",
+		    email: "není validní e-mail",
+		    integer: "Prosím, vložte celé číslo",
+			date: "Prosím, vložte validní datum",
+			url: "není platnou URL. Vyžadován prefix ('http://' or 'https://')",
+			nodefined : " není definován!",
+			novalue : " je vyžadována návratová hodnota!",
+			customarray : "Custom function mělá vrátit pole!",
+			customfcheck : "Custom function by měla být přítomna v případě custom checking!"
+		}
+	},
+	view : {
+	    caption: "Zobrazit záznam",
+	    bClose: "Zavřít"
+	},
+	del : {
+		caption: "Smazat",
+		msg: "Smazat vybraný(é) záznam(y)?",
+		bSubmit: "Smazat",
+		bCancel: "Storno"
+	},
+	nav : {
+		edittext: " ",
+		edittitle: "Editovat vybraný řádek",
+		addtext:" ",
+		addtitle: "Přidat nový řádek",
+		deltext: " ",
+		deltitle: "Smazat vybraný záznam ",
+		searchtext: " ",
+		searchtitle: "Najít záznamy",
+		refreshtext: "",
+		refreshtitle: "Obnovit tabulku",
+		alertcap: "Varování",
+		alerttext: "Prosím, vyberte řádek",
+		viewtext: "",
+		viewtitle: "Zobrazit vybraný řádek"
+	},
+	col : {
+		caption: "Zobrazit/Skrýt sloupce",
+		bSubmit: "Uložit",
+		bCancel: "Storno"	
+	},
+	errors : {
+		errcap : "Chyba",
+		nourl : "Není nastavena url",
+		norecords: "Žádné záznamy ke zpracování",
+		model : "Délka colNames <> colModel!"
+	},
+	formatter : {
+		integer : {thousandsSeparator: " ", defaultValue: '0'},
+		number : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0.00'},
+		currency : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0.00'},
+		date : {
+			dayNames:   [
+				"Ne", "Po", "Út", "St", "Čt", "Pá", "So",
+				"Neděle", "Pondělí", "Úterý", "Středa", "Čtvrtek", "Pátek", "Sobota"
+			],
+			monthNames: [
+				"Led", "Úno", "Bře", "Dub", "Kvě", "Čer", "Čvc", "Srp", "Zář", "Říj", "Lis", "Pro",
+				"Leden", "Únor", "Březen", "Duben", "Květen", "Červen", "Červenec", "Srpen", "Září", "Říjen", "Listopad", "Prosinec"
+			],
+			AmPm : ["do","od","DO","OD"],
+			S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'},
+			srcformat: 'Y-m-d',
+			newformat: 'd/m/Y',
+			masks : {
+		        ISO8601Long:"Y-m-d H:i:s",
+		        ISO8601Short:"Y-m-d",
+		        ShortDate: "n/j/Y",
+		        LongDate: "l, F d, Y",
+		        FullDateTime: "l, F d, Y g:i:s A",
+		        MonthDay: "F d",
+		        ShortTime: "g:i A",
+		        LongTime: "g:i:s A",
+		        SortableDateTime: "Y-m-d\\TH:i:s",
+		        UniversalSortableDateTime: "Y-m-d H:i:sO",
+		        YearMonth: "F, Y"
+		    },
+		    reformatAfterEdit : false
+		},
+		baseLinkUrl: '',
+		showAction: '',
+	    target: '',
+	    checkbox : {disabled:true},
+		idName : 'id'
+	}
+};
+})(jQuery);
Index: controlies/trunk/applications/controlies/static/js/jdgrid/src/i18n/grid.locale-cat.js
===================================================================
--- controlies/trunk/applications/controlies/static/js/jdgrid/src/i18n/grid.locale-cat.js	(revision 240)
+++ controlies/trunk/applications/controlies/static/js/jdgrid/src/i18n/grid.locale-cat.js	(revision 241)
@@ -1,128 +1,128 @@
-;(function($){
-/**
- * jqGrid Catalan Translation
- * Traducció jqGrid en Catatà per Faserline, S.L.
- * http://www.faserline.com
- * Dual licensed under the MIT and GPL licenses:
- * http://www.opensource.org/licenses/mit-license.php
- * http://www.gnu.org/licenses/gpl.html
-**/
-$.jgrid = {
-	defaults : {
-		recordtext: "Mostrant {0} - {1} de {2}",
-	    emptyrecords: "Sense registres que mostrar",
-		loadtext: "Carregant...",
-		pgtext : "Page {0} of {1}"
-	},
-	search : {
-		caption: "Cerca...",
-		Find: "Cercar",
-		Reset: "Buidar",
-	    odata : ['equal', 'not equal', 'less', 'less or equal','greater','greater or equal', 'begins with','does not begin with','is in','is not in','ends with','does not end with','contains','does not contain'],
-	    groupOps: [	{ op: "AND", text: "tot" },	{ op: "OR",  text: "qualsevol" }	],
-		matchText: " match",
-		rulesText: " rules"
-	},
-	edit : {
-		addCaption: "Afegir registre",
-		editCaption: "Modificar registre",
-		bSubmit: "Guardar",
-		bCancel: "Cancelar",
-		bClose: "Tancar",
-		saveData: "Les dades han canviat. Guardar canvis?",
-		bYes : "Yes",
-		bNo : "No",
-		bExit : "Cancel",
-		msg: {
-		    required:"Camp obligatori",
-		    number:"Introdueixi un nombre",
-		    minValue:"El valor ha de ser major o igual que ",
-		    maxValue:"El valor ha de ser menor o igual a ",
-		    email: "no és una direcció de correu vàlida",
-		    integer: "Introdueixi un valor enter",
-			date: "Introdueixi una data correcta ",
-			url: "no és una URL vàlida. Prefix requerit ('http://' or 'https://')",
-			nodefined : " is not defined!",
-			novalue : " return value is required!",
-			customarray : "Custom function should return array!",
-			customfcheck : "Custom function should be present in case of custom checking!"
-		}
-	},
-	view : {
-		caption: "Veure registre",
-		bClose: "Tancar"
-	},
-	del : {
-		caption: "Eliminar",
-		msg: "¿Desitja eliminar els registres seleccionats?",
-		bSubmit: "Eliminar",
-		bCancel: "Cancelar"
-	},
-	nav : {
-		edittext: " ",
-		edittitle: "Modificar fila seleccionada",
-		addtext:" ",
-		addtitle: "Agregar nova fila",
-		deltext: " ",
-		deltitle: "Eliminar fila seleccionada",
-		searchtext: " ",
-		searchtitle: "Cercar informació",
-		refreshtext: "",
-		refreshtitle: "Refrescar taula",
-		alertcap: "Avís",
-		alerttext: "Seleccioni una fila",
-		viewtext: " ",
-		viewtitle: "Veure fila seleccionada"
-	},
-// setcolumns module
-	col : {
-		caption: "Mostrar/ocultar columnes",
-		bSubmit: "Enviar",
-		bCancel: "Cancelar"	
-	},
-	errors : {
-		errcap : "Error",
-		nourl : "No s'ha especificat una URL",
-		norecords: "No hi ha dades per processar",
-		model : "Les columnes de noms són diferents de les columnes del model"
-	},
-	formatter : {
-		integer : {thousandsSeparator: ".", defaultValue: '0'},
-		number : {decimalSeparator:",", thousandsSeparator: ".", decimalPlaces: 2, defaultValue: '0,00'},
-		currency : {decimalSeparator:",", thousandsSeparator: ".", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0,00'},
-		date : {
-			dayNames:   [
-				"Dg", "Dl", "Dt", "Dc", "Dj", "Dv", "Ds",
-				"Diumenge", "Dilluns", "Dimarts", "Dimecres", "Dijous", "Divendres", "Dissabte"
-			],
-			monthNames: [
-				"Gen", "Febr", "Març", "Abr", "Maig", "Juny", "Jul", "Ag", "Set", "Oct", "Nov", "Des",
-				"Gener", "Febrer", "Març", "Abril", "Maig", "Juny", "Juliol", "Agost", "Setembre", "Octubre", "Novembre", "Desembre"
-			],
-			AmPm : ["am","pm","AM","PM"],
-			S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'},
-			srcformat: 'Y-m-d',
-			newformat: 'd-m-Y',
-			masks : {
-		        ISO8601Long:"Y-m-d H:i:s",
-		        ISO8601Short:"Y-m-d",
-		        ShortDate: "n/j/Y",
-		        LongDate: "l, F d, Y",
-		        FullDateTime: "l, F d, Y g:i:s A",
-		        MonthDay: "F d",
-		        ShortTime: "g:i A",
-		        LongTime: "g:i:s A",
-		        SortableDateTime: "Y-m-d\\TH:i:s",
-		        UniversalSortableDateTime: "Y-m-d H:i:sO",
-		        YearMonth: "F, Y"
-		    },
-		    reformatAfterEdit : false
-		},
-		baseLinkUrl: '',
-		showAction: 'show',
-	    target: '',
-	    checkbox : {disabled:true},
-		idName : 'id'
-	}
-};
-})(jQuery);
+;(function($){
+/**
+ * jqGrid Catalan Translation
+ * Traducció jqGrid en Catatà per Faserline, S.L.
+ * http://www.faserline.com
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl.html
+**/
+$.jgrid = {
+	defaults : {
+		recordtext: "Mostrant {0} - {1} de {2}",
+	    emptyrecords: "Sense registres que mostrar",
+		loadtext: "Carregant...",
+		pgtext : "Pàgina {0} de {1}"
+	},
+	search : {
+		caption: "Cerca...",
+		Find: "Cercar",
+		Reset: "Buidar",
+	    odata : ['equal', 'not equal', 'less', 'less or equal','greater','greater or equal', 'begins with','does not begin with','is in','is not in','ends with','does not end with','contains','does not contain'],
+	    groupOps: [	{ op: "AND", text: "tot" },	{ op: "OR",  text: "qualsevol" }	],
+		matchText: " match",
+		rulesText: " rules"
+	},
+	edit : {
+		addCaption: "Afegir registre",
+		editCaption: "Modificar registre",
+		bSubmit: "Guardar",
+		bCancel: "Cancelar",
+		bClose: "Tancar",
+		saveData: "Les dades han canviat. Guardar canvis?",
+		bYes : "Yes",
+		bNo : "No",
+		bExit : "Cancel",
+		msg: {
+		    required:"Camp obligatori",
+		    number:"Introdueixi un nombre",
+		    minValue:"El valor ha de ser major o igual que ",
+		    maxValue:"El valor ha de ser menor o igual a ",
+		    email: "no és una direcció de correu vàlida",
+		    integer: "Introdueixi un valor enter",
+			date: "Introdueixi una data correcta ",
+			url: "no és una URL vàlida. Prefix requerit ('http://' or 'https://')",
+			nodefined : " is not defined!",
+			novalue : " return value is required!",
+			customarray : "Custom function should return array!",
+			customfcheck : "Custom function should be present in case of custom checking!"
+		}
+	},
+	view : {
+		caption: "Veure registre",
+		bClose: "Tancar"
+	},
+	del : {
+		caption: "Eliminar",
+		msg: "¿Desitja eliminar els registres seleccionats?",
+		bSubmit: "Eliminar",
+		bCancel: "Cancelar"
+	},
+	nav : {
+		edittext: " ",
+		edittitle: "Modificar fila seleccionada",
+		addtext:" ",
+		addtitle: "Agregar nova fila",
+		deltext: " ",
+		deltitle: "Eliminar fila seleccionada",
+		searchtext: " ",
+		searchtitle: "Cercar informació",
+		refreshtext: "",
+		refreshtitle: "Refrescar taula",
+		alertcap: "Avís",
+		alerttext: "Seleccioni una fila",
+		viewtext: " ",
+		viewtitle: "Veure fila seleccionada"
+	},
+// setcolumns module
+	col : {
+		caption: "Mostrar/ocultar columnes",
+		bSubmit: "Enviar",
+		bCancel: "Cancelar"	
+	},
+	errors : {
+		errcap : "Error",
+		nourl : "No s'ha especificat una URL",
+		norecords: "No hi ha dades per processar",
+		model : "Les columnes de noms són diferents de les columnes del model"
+	},
+	formatter : {
+		integer : {thousandsSeparator: ".", defaultValue: '0'},
+		number : {decimalSeparator:",", thousandsSeparator: ".", decimalPlaces: 2, defaultValue: '0,00'},
+		currency : {decimalSeparator:",", thousandsSeparator: ".", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0,00'},
+		date : {
+			dayNames:   [
+				"Dg", "Dl", "Dt", "Dc", "Dj", "Dv", "Ds",
+				"Diumenge", "Dilluns", "Dimarts", "Dimecres", "Dijous", "Divendres", "Dissabte"
+			],
+			monthNames: [
+				"Gen", "Febr", "Març", "Abr", "Maig", "Juny", "Jul", "Ag", "Set", "Oct", "Nov", "Des",
+				"Gener", "Febrer", "Març", "Abril", "Maig", "Juny", "Juliol", "Agost", "Setembre", "Octubre", "Novembre", "Desembre"
+			],
+			AmPm : ["am","pm","AM","PM"],
+			S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'},
+			srcformat: 'Y-m-d',
+			newformat: 'd-m-Y',
+			masks : {
+		        ISO8601Long:"Y-m-d H:i:s",
+		        ISO8601Short:"Y-m-d",
+		        ShortDate: "n/j/Y",
+		        LongDate: "l, F d, Y",
+		        FullDateTime: "l, F d, Y g:i:s A",
+		        MonthDay: "F d",
+		        ShortTime: "g:i A",
+		        LongTime: "g:i:s A",
+		        SortableDateTime: "Y-m-d\\TH:i:s",
+		        UniversalSortableDateTime: "Y-m-d H:i:sO",
+		        YearMonth: "F, Y"
+		    },
+		    reformatAfterEdit : false
+		},
+		baseLinkUrl: '',
+		showAction: 'show',
+	    target: '',
+	    checkbox : {disabled:true},
+		idName : 'id'
+	}
+};
+})(jQuery);
Index: controlies/trunk/applications/controlies/static/js/jdgrid/src/i18n/grid.locale-fr.js
===================================================================
--- controlies/trunk/applications/controlies/static/js/jdgrid/src/i18n/grid.locale-fr.js	(revision 240)
+++ controlies/trunk/applications/controlies/static/js/jdgrid/src/i18n/grid.locale-fr.js	(revision 241)
@@ -36,8 +36,8 @@
 		msg: {
 			required: "Champ obligatoire",
 			number: "Saisissez un nombre correct",
-			minValue: "La valeur doit être supérieure ou égale à 0",
-			maxValue: "La valeur doit être inférieure ou égale à 0",
+			minValue: "La valeur doit être supérieure ou égale à",
+			maxValue: "La valeur doit être inférieure ou égale à",
 			email: "n'est pas un email correct",
 			integer: "Saisissez un entier correct",
 			url: "n'est pas une adresse correcte. Préfixe requis ('http://' or 'https://')",
Index: controlies/trunk/applications/controlies/static/js/jdgrid/src/i18n/grid.locale-nl.js
===================================================================
--- controlies/trunk/applications/controlies/static/js/jdgrid/src/i18n/grid.locale-nl.js	(revision 240)
+++ controlies/trunk/applications/controlies/static/js/jdgrid/src/i18n/grid.locale-nl.js	(revision 241)
@@ -1,149 +1,149 @@
-(function(a) {
-    a.jgrid =
-    {
-        defaults:
-        {
-            recordtext: "regels {0} - {1} van {2}",
-            emptyrecords: "Geen data gevonden.",
-            loadtext: "laden...",
-            pgtext: "pagina  {0}  van {1}"
-        },
-        search:
-        {
-            caption: "Zoeken...",
-            Find: "Zoek",
-            Reset: "Herstellen",
-            odata: ["gelijk aan", "niet gelijk aan", "kleiner dan", "kleiner dan of gelijk aan", "groter dan", "groter dan of gelijk aan", "begint met", "begint niet met", "is in", "is niet in", "eindigd met", "eindigd niet met", "bevat", "bevat niet"],
-            groupOps: [{ op: "AND", text: "alle" }, { op: "OR", text: "een van de"}],
-            matchText: " match",
-            rulesText: " regels"
-        },
-        edit:
-        {
-            addCaption: "Nieuw",
-            editCaption: "Bewerken",
-            bSubmit: "Opslaan",
-            bCancel: "Annuleren",
-            bClose: "Sluiten",
-            saveData: "Er is data aangepast! Wijzigingen opslaan?",
-            bYes: "Ja",
-            bNo: "Nee",
-            bExit: "Sluiten",
-            msg:
-            {
-                required: "Veld is verplicht",
-                number: "Voer a.u.b. geldig nummer in",
-                minValue: "Waarde moet groter of gelijk zijn aan ",
-                maxValue: "Waarde moet kleiner of gelijks zijn aan",
-                email: "is geen geldig e-mailadres",
-                integer: "Voer a.u.b. een geldig getal in",
-                date: "Voer a.u.b. een geldige waarde in",
-                url: "is geen geldige URL. Prefix is verplicht ('http://' or 'https://')",
-                nodefined : " is not defined!",
-                novalue : " return value is required!",
-                customarray : "Custom function should return array!",
-                customfcheck : "Custom function should be present in case of custom checking!"
-            }
-        },
-        view:
-        {
-            caption: "Tonen",
-            bClose: "Sluiten"
-        },
-        del:
-        {
-            caption: "Verwijderen",
-            msg: "Verwijder geselecteerde regel(s)?",
-            bSubmit: "Verwijderen",
-            bCancel: "Annuleren"
-        },
-        nav:
-        {
-            edittext: "",
-            edittitle: "Bewerken",
-            addtext: "",
-            addtitle: "Nieuw",
-            deltext: "",
-            deltitle: "Verwijderen",
-            searchtext: "",
-            searchtitle: "Zoeken",
-            refreshtext: "",
-            refreshtitle: "Vernieuwen",
-            alertcap: "Waarschuwing",
-            alerttext: "Selecteer a.u.b. een regel",
-            viewtext: "",
-            viewtitle: "Openen"
-        },
-        col:
-        {
-            caption: "Tonen/verbergen kolommen",
-            bSubmit: "OK",
-            bCancel: "Annuleren"
-        },
-        errors:
-        {
-            errcap: "Fout",
-            nourl: "Er is geen URL gedefinieerd",
-            norecords: "Geen data om te verwerken",
-            model: "Lengte van 'colNames' is niet gelijk aan 'colModel'!"
-        },
-        formatter:
-        {
-            integer:
-            {
-                thousandsSeparator: ".",
-                defaultValue: "0"
-            },
-            number:
-            {
-                decimalSeparator: ",",
-                thousandsSeparator: ".",
-                decimalPlaces: 2,
-                defaultValue: "0.00"
-            },
-            currency:
-            {
-                decimalSeparator: ",",
-                thousandsSeparator: ".",
-                decimalPlaces: 2,
-                prefix: "EUR ",
-                suffix: "",
-                defaultValue: "0.00"
-            },
-            date:
-            {
-                dayNames: ["Zo", "Ma", "Di", "Wo", "Do", "Vr", "Za", "Zondag", "Maandag", "Dinsdag", "Woensdag", "Donderdag", "Vrijdag", "Zaterdag"],
-                monthNames: ["Jan", "Feb", "Maa", "Apr", "Mei", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", "Januari", "Februari", "Maart", "April", "Mei", "Juni", "Juli", "Augustus", "September", "October", "November", "December"],
-                AmPm: ["am", "pm", "AM", "PM"],
-                S: function(b) {
-                    return b < 11 || b > 13 ? ["st", "nd", "rd", "th"][Math.min((b - 1) % 10, 3)] : "th"
-                },
-                srcformat: "Y-m-d",
-                newformat: "d/m/Y",
-                masks:
-                {
-                    ISO8601Long: "Y-m-d H:i:s",
-                    ISO8601Short: "Y-m-d",
-                    ShortDate: "n/j/Y",
-                    LongDate: "l, F d, Y",
-                    FullDateTime: "l d F Y G:i:s",
-                    MonthDay: "d F",
-                    ShortTime: "G:i",
-                    LongTime: "G:i:s",
-                    SortableDateTime: "Y-m-d\\TH:i:s",
-                    UniversalSortableDateTime: "Y-m-d H:i:sO",
-                    YearMonth: "F, Y"
-                },
-                reformatAfterEdit: false
-            },
-            baseLinkUrl: "",
-            showAction: "",
-            target: "",
-            checkbox:
-            {
-                disabled: true
-            },
-            idName: "id"
-        }
-    }
+(function(a) {
+    a.jgrid =
+    {
+        defaults:
+        {
+            recordtext: "regels {0} - {1} van {2}",
+            emptyrecords: "Geen data gevonden.",
+            loadtext: "laden...",
+            pgtext: "pagina  {0}  van {1}"
+        },
+        search:
+        {
+            caption: "Zoeken...",
+            Find: "Zoek",
+            Reset: "Herstellen",
+            odata: ["gelijk aan", "niet gelijk aan", "kleiner dan", "kleiner dan of gelijk aan", "groter dan", "groter dan of gelijk aan", "begint met", "begint niet met", "is in", "is niet in", "eindigd met", "eindigd niet met", "bevat", "bevat niet"],
+            groupOps: [{ op: "AND", text: "alle" }, { op: "OR", text: "een van de"}],
+            matchText: " match",
+            rulesText: " regels"
+        },
+        edit:
+        {
+            addCaption: "Nieuw",
+            editCaption: "Bewerken",
+            bSubmit: "Opslaan",
+            bCancel: "Annuleren",
+            bClose: "Sluiten",
+            saveData: "Er is data aangepast! Wijzigingen opslaan?",
+            bYes: "Ja",
+            bNo: "Nee",
+            bExit: "Sluiten",
+            msg:
+            {
+                required: "Veld is verplicht",
+                number: "Voer a.u.b. geldig nummer in",
+                minValue: "Waarde moet groter of gelijk zijn aan ",
+                maxValue: "Waarde moet kleiner of gelijks zijn aan",
+                email: "is geen geldig e-mailadres",
+                integer: "Voer a.u.b. een geldig getal in",
+                date: "Voer a.u.b. een geldige waarde in",
+                url: "is geen geldige URL. Prefix is verplicht ('http://' or 'https://')",
+                nodefined : " is not defined!",
+                novalue : " return value is required!",
+                customarray : "Custom function should return array!",
+                customfcheck : "Custom function should be present in case of custom checking!"
+            }
+        },
+        view:
+        {
+            caption: "Tonen",
+            bClose: "Sluiten"
+        },
+        del:
+        {
+            caption: "Verwijderen",
+            msg: "Verwijder geselecteerde regel(s)?",
+            bSubmit: "Verwijderen",
+            bCancel: "Annuleren"
+        },
+        nav:
+        {
+            edittext: "",
+            edittitle: "Bewerken",
+            addtext: "",
+            addtitle: "Nieuw",
+            deltext: "",
+            deltitle: "Verwijderen",
+            searchtext: "",
+            searchtitle: "Zoeken",
+            refreshtext: "",
+            refreshtitle: "Vernieuwen",
+            alertcap: "Waarschuwing",
+            alerttext: "Selecteer a.u.b. een regel",
+            viewtext: "",
+            viewtitle: "Openen"
+        },
+        col:
+        {
+            caption: "Tonen/verbergen kolommen",
+            bSubmit: "OK",
+            bCancel: "Annuleren"
+        },
+        errors:
+        {
+            errcap: "Fout",
+            nourl: "Er is geen URL gedefinieerd",
+            norecords: "Geen data om te verwerken",
+            model: "Lengte van 'colNames' is niet gelijk aan 'colModel'!"
+        },
+        formatter:
+        {
+            integer:
+            {
+                thousandsSeparator: ".",
+                defaultValue: "0"
+            },
+            number:
+            {
+                decimalSeparator: ",",
+                thousandsSeparator: ".",
+                decimalPlaces: 2,
+                defaultValue: "0.00"
+            },
+            currency:
+            {
+                decimalSeparator: ",",
+                thousandsSeparator: ".",
+                decimalPlaces: 2,
+                prefix: "EUR ",
+                suffix: "",
+                defaultValue: "0.00"
+            },
+            date:
+            {
+                dayNames: ["Zo", "Ma", "Di", "Wo", "Do", "Vr", "Za", "Zondag", "Maandag", "Dinsdag", "Woensdag", "Donderdag", "Vrijdag", "Zaterdag"],
+                monthNames: ["Jan", "Feb", "Maa", "Apr", "Mei", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", "Januari", "Februari", "Maart", "April", "Mei", "Juni", "Juli", "Augustus", "September", "October", "November", "December"],
+                AmPm: ["am", "pm", "AM", "PM"],
+                S: function(b) {
+                    return b < 11 || b > 13 ? ["st", "nd", "rd", "th"][Math.min((b - 1) % 10, 3)] : "th"
+                },
+                srcformat: "Y-m-d",
+                newformat: "d/m/Y",
+                masks:
+                {
+                    ISO8601Long: "Y-m-d H:i:s",
+                    ISO8601Short: "Y-m-d",
+                    ShortDate: "n/j/Y",
+                    LongDate: "l, F d, Y",
+                    FullDateTime: "l d F Y G:i:s",
+                    MonthDay: "d F",
+                    ShortTime: "G:i",
+                    LongTime: "G:i:s",
+                    SortableDateTime: "Y-m-d\\TH:i:s",
+                    UniversalSortableDateTime: "Y-m-d H:i:sO",
+                    YearMonth: "F, Y"
+                },
+                reformatAfterEdit: false
+            },
+            baseLinkUrl: "",
+            showAction: "",
+            target: "",
+            checkbox:
+            {
+                disabled: true
+            },
+            idName: "id"
+        }
+    }
 })(jQuery);
\ No newline at end of file
Index: controlies/trunk/applications/controlies/static/js/jdgrid/src/i18n/grid.locale-is.js
===================================================================
--- controlies/trunk/applications/controlies/static/js/jdgrid/src/i18n/grid.locale-is.js	(revision 240)
+++ controlies/trunk/applications/controlies/static/js/jdgrid/src/i18n/grid.locale-is.js	(revision 241)
@@ -1,126 +1,126 @@
-;(function($){
-/**
- * jqGrid Icelandic Translation
- * jtm@hi.is Univercity of Iceland
- * Dual licensed under the MIT and GPL licenses:
- * http://www.opensource.org/licenses/mit-license.php
- * http://www.gnu.org/licenses/gpl.html
-**/
-$.jgrid = {
-	defaults : {
-		recordtext: "View {0} - {1} of {2}",
-	    emptyrecords: "No records to view",
-		loadtext: "Hleður...",
-		pgtext : "Page {0} of {1}"
-	},
-	search : {
-	    caption: "Leita...",
-	    Find: "Leita",
-	    Reset: "Endursetja",
-	    odata : ['equal', 'not equal', 'less', 'less or equal','greater','greater or equal', 'begins with','does not begin with','is in','is not in','ends with','does not end with','contains','does not contain'],
-	    groupOps: [	{ op: "AND", text: "all" },	{ op: "OR",  text: "any" }	],
-		matchText: " match",
-		rulesText: " rules"
-	},
-	edit : {
-	    addCaption: "Add Record",
-	    editCaption: "Edit Record",
-	    bSubmit: "Vista",
-	    bCancel: "Hætta við",
-		bClose: "Loka",
-		saveData: "Data has been changed! Save changes?",
-		bYes : "Yes",
-		bNo : "No",
-		bExit : "Cancel",
-	    msg: {
-	        required:"Reitur er nauðsynlegur",
-	        number:"Vinsamlega settu inn tölu",
-	        minValue:"gildi verður að vera meira en eða jafnt og ",
-	        maxValue:"gildi verður að vera minna en eða jafnt og ",
-	        email: "er ekki löglegt email",
-	        integer: "Vinsamlega settu inn tölu",
-			date: "Please, enter valid date value",
-			url: "is not a valid URL. Prefix required ('http://' or 'https://')",
-			nodefined : " is not defined!",
-			novalue : " return value is required!",
-			customarray : "Custom function should return array!",
-			customfcheck : "Custom function should be present in case of custom checking!"
-		}
-	},
-	view : {
-	    caption: "View Record",
-	    bClose: "Close"
-	},
-	del : {
-	    caption: "Eyða",
-	    msg: "Eyða völdum færslum ?",
-	    bSubmit: "Eyða",
-	    bCancel: "Hætta við"
-	},
-	nav : {
-		edittext: " ",
-	    edittitle: "Breyta færslu",
-		addtext:" ",
-	    addtitle: "Ný færsla",
-	    deltext: " ",
-	    deltitle: "Eyða færslu",
-	    searchtext: " ",
-	    searchtitle: "Leita",
-	    refreshtext: "",
-	    refreshtitle: "Endurhlaða",
-	    alertcap: "Viðvörun",
-	    alerttext: "Vinsamlega veldu færslu",
-		viewtext: "",
-		viewtitle: "View selected row"
-	},
-	col : {
-	    caption: "Sýna / fela dálka",
-	    bSubmit: "Vista",
-	    bCancel: "Hætta við"	
-	},
-	errors : {
-		errcap : "Villa",
-		nourl : "Vantar slóð",
-		norecords: "Engar færslur valdar",
-	    model : "Length of colNames <> colModel!"
-	},
-	formatter : {
-		integer : {thousandsSeparator: " ", defaultValue: '0'},
-		number : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0.00'},
-		currency : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0.00'},
-		date : {
-			dayNames:   [
-				"Sun", "Mon", "Tue", "Wed", "Thr", "Fri", "Sat",
-				"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
-			],
-			monthNames: [
-				"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
-				"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
-			],
-			AmPm : ["am","pm","AM","PM"],
-			S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'},
-			srcformat: 'Y-m-d',
-			newformat: 'd/m/Y',
-			masks : {
-	            ISO8601Long:"Y-m-d H:i:s",
-	            ISO8601Short:"Y-m-d",
-	            ShortDate: "n/j/Y",
-	            LongDate: "l, F d, Y",
-	            FullDateTime: "l, F d, Y g:i:s A",
-	            MonthDay: "F d",
-	            ShortTime: "g:i A",
-	            LongTime: "g:i:s A",
-	            SortableDateTime: "Y-m-d\\TH:i:s",
-	            UniversalSortableDateTime: "Y-m-d H:i:sO",
-	            YearMonth: "F, Y"
-	        },
-	        reformatAfterEdit : false
-		},
-		baseLinkUrl: '',
-		showAction: '',
-	    target: '',
-	    checkbox : {disabled:true},
-		idName : 'id'
-	}
-};
-})(jQuery);
+;(function($){
+/**
+ * jqGrid Icelandic Translation
+ * jtm@hi.is Univercity of Iceland
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl.html
+**/
+$.jgrid = {
+	defaults : {
+		recordtext: "Skoða {0} - {1} af {2}",
+	    emptyrecords: "Engar færslur",
+		loadtext: "Hleður...",
+		pgtext : "Síða {0} af {1}"
+	},
+	search : {
+	    caption: "Leita...",
+	    Find: "Leita",
+	    Reset: "Endursetja",
+	    odata : ['sama og', 'ekki sama og', 'minna en', 'minna eða jafnt og','stærra en','stærra eða jafnt og', 'byrjar á','byrjar ekki á','er í','er ekki í','endar á','endar ekki á','inniheldur','inniheldur ekki'],
+	    groupOps: [	{ op: "AND", text: "allt" },	{ op: "OR",  text: "eða" }	],
+		matchText: " passar",
+		rulesText: " reglur"
+	},
+	edit : {
+	    addCaption: "Bæta við færslu",
+	    editCaption: "Breyta færslu",
+	    bSubmit: "Vista",
+	    bCancel: "Hætta við",
+		bClose: "Loka",
+		saveData: "Gögn hafa breyst! Vista breytingar?",
+		bYes : "Já",
+		bNo : "Nei",
+		bExit : "Hætta við",
+	    msg: {
+	        required:"Reitur er nauðsynlegur",
+	        number:"Vinsamlega settu inn tölu",
+	        minValue:"gildi verður að vera meira en eða jafnt og ",
+	        maxValue:"gildi verður að vera minna en eða jafnt og ",
+	        email: "er ekki löglegt email",
+	        integer: "Vinsamlega settu inn tölu",
+			date: "Vinsamlega setti inn dagsetningu",
+			url: "er ekki löglegt URL. Vantar ('http://' eða 'https://')",
+			nodefined : " er ekki skilgreint!",
+			novalue : " skilagildi nauðsynlegt!",
+			customarray : "Fall skal skila fylki!",
+			customfcheck : "Fall skal vera skilgreint!"
+		}
+	},
+	view : {
+	    caption: "Skoða færslu",
+	    bClose: "Loka"
+	},
+	del : {
+	    caption: "Eyða",
+	    msg: "Eyða völdum færslum ?",
+	    bSubmit: "Eyða",
+	    bCancel: "Hætta við"
+	},
+	nav : {
+		edittext: " ",
+	    edittitle: "Breyta færslu",
+		addtext:" ",
+	    addtitle: "Ný færsla",
+	    deltext: " ",
+	    deltitle: "Eyða færslu",
+	    searchtext: " ",
+	    searchtitle: "Leita",
+	    refreshtext: "",
+	    refreshtitle: "Endurhlaða",
+	    alertcap: "Viðvörun",
+	    alerttext: "Vinsamlega veldu færslu",
+		viewtext: "",
+		viewtitle: "Skoða valda færslu"
+	},
+	col : {
+	    caption: "Sýna / fela dálka",
+	    bSubmit: "Vista",
+	    bCancel: "Hætta við"	
+	},
+	errors : {
+		errcap : "Villa",
+		nourl : "Vantar slóð",
+		norecords: "Engar færslur valdar",
+	    model : "Lengd colNames <> colModel!"
+	},
+	formatter : {
+		integer : {thousandsSeparator: " ", defaultValue: '0'},
+		number : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0.00'},
+		currency : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0.00'},
+		date : {
+			dayNames:   [
+				"Sun", "Mán", "Þri", "Mið", "Fim", "Fös", "Lau",
+				"Sunnudagur", "Mánudagur", "Þriðjudagur", "Miðvikudagur", "Fimmtudagur", "Föstudagur", "Laugardagur"
+			],
+			monthNames: [
+				"Jan", "Feb", "Mar", "Apr", "Maí", "Jún", "Júl", "Ágú", "Sep", "Oct", "Nóv", "Des",
+				"Janúar", "Febrúar", "Mars", "Apríl", "Maí", "Júný", "Júlý", "Ágúst", "September", "Október", "Nóvember", "Desember"
+			],
+			AmPm : ["am","pm","AM","PM"],
+			S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'},
+			srcformat: 'Y-m-d',
+			newformat: 'd/m/Y',
+			masks : {
+	            ISO8601Long:"Y-m-d H:i:s",
+	            ISO8601Short:"Y-m-d",
+	            ShortDate: "n/j/Y",
+	            LongDate: "l, F d, Y",
+	            FullDateTime: "l, F d, Y g:i:s A",
+	            MonthDay: "F d",
+	            ShortTime: "g:i A",
+	            LongTime: "g:i:s A",
+	            SortableDateTime: "Y-m-d\\TH:i:s",
+	            UniversalSortableDateTime: "Y-m-d H:i:sO",
+	            YearMonth: "F, Y"
+	        },
+	        reformatAfterEdit : false
+		},
+		baseLinkUrl: '',
+		showAction: '',
+	    target: '',
+	    checkbox : {disabled:true},
+		idName : 'id'
+	}
+};
+})(jQuery);
Index: controlies/trunk/applications/controlies/static/js/jdgrid/src/i18n/grid.locale-pl.js
===================================================================
--- controlies/trunk/applications/controlies/static/js/jdgrid/src/i18n/grid.locale-pl.js	(revision 240)
+++ controlies/trunk/applications/controlies/static/js/jdgrid/src/i18n/grid.locale-pl.js	(revision 241)
@@ -1,127 +1,127 @@
-;(function($){
-/**
- * jqGrid Polish Translation
- * Łukasz Schab
- * http://FreeTree.pl
- * Dual licensed under the MIT and GPL licenses:
- * http://www.opensource.org/licenses/mit-license.php
- * http://www.gnu.org/licenses/gpl.html
-**/
-$.jgrid = {
-	defaults : {
-		recordtext: "Pokaż {0} - {1} z {2}",
-	    emptyrecords: "Brak rekordów do pokazania",
-		loadtext: "\u0142adowanie...",
-		pgtext : "Strona {0} z {1}"
-	},
-	search : {
-	    caption: "Wyszukiwanie...",
-	    Find: "Szukaj",
-	    Reset: "Czyść",
-	    odata : ['dok\u0142adnie', 'różne od', 'mniejsze od', 'mniejsze lub równe','większe od','większe lub równe', 'zaczyna się od','nie zaczyna się od','zawiera','nie zawiera','kończy się na','nie kończy się na','zawiera','nie zawiera'],
-	    groupOps: [	{ op: "ORAZ", text: "wszystkie" },	{ op: "LUB",  text: "każdy" }	],
-		matchText: " pasuje",
-		rulesText: " regu\u0142y"
-	},
-	edit : {
-	    addCaption: "Dodaj rekord",
-	    editCaption: "Edytuj rekord",
-	    bSubmit: "Zapisz",
-	    bCancel: "Anuluj",
-		bClose: "Zamknij",
-		saveData: "Dane zosta\u0142y zmienione! Zapisać zmiany?",
-		bYes : "Tak",
-		bNo : "Nie",
-		bExit : "Anuluj",
-	    msg: {
-	        required:"Pole jest wymagane",
-	        number:"Proszę wpisać poprawną liczbę",
-	        minValue:"wartość musi być większa lub równa",
-	        maxValue:"wartość musi być mniejsza od",
-	        email: "nie jest adresem e-mail",
-	        integer: "Proszę wpisać poprawną liczbę",
-			date: "Proszę podaj poprawną datę",
-			url: "jest niew\u0142aściwym adresem URL. Pamiętaj o prefiksie ('http://' lub 'https://')",
-			nodefined : " is not defined!",
-			novalue : " return value is required!",
-			customarray : "Custom function should return array!",
-			customfcheck : "Custom function should be present in case of custom checking!"
-		}
-	},
-	view : {
-	    caption: "Pokaż rekord",
-	    bClose: "Zamknij"
-	},
-	del : {
-	    caption: "Usuwanie",
-	    msg: "Czy usunąć wybrany rekord(y)?",
-	    bSubmit: "Usuń",
-	    bCancel: "Anuluj"
-	},
-	nav : {
-		edittext: " ",
-	    edittitle: "Edytuj wybrany wiersz",
-		addtext:" ",
-	    addtitle: "Dodaj nowy wiersz",
-	    deltext: " ",
-	    deltitle: "Usuń wybrany wiersz",
-	    searchtext: " ",
-	    searchtitle: "Wyszukaj rekord",
-	    refreshtext: "",
-	    refreshtitle: "Prze\u0142aduj",
-	    alertcap: "Uwaga",
-	    alerttext: "Proszę wybrać wiersz",
-		viewtext: "",
-		viewtitle: "View selected row"
-	},
-	col : {
-	    caption: "Pokaż/Ukryj kolumny",
-	    bSubmit: "Zatwierdź",
-	    bCancel: "Anuluj"	
-	},
-	errors : {
-		errcap : "B\u0142ąd",
-		nourl : "Brak adresu url",
-		norecords: "Brak danych",
-	    model : "D\u0142ugość colNames <> colModel!"
-	},
-	formatter : {
-		integer : {thousandsSeparator: " ", defaultValue: '0'},
-		number : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0.00'},
-		currency : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0.00'},
-		date : {
-			dayNames:   [
-				"Nie", "Pon", "Wt", "Śr", "Cz", "Pi", "So",
-				"Niedziela", "Poniedzia\u0142ek", "Wtorek", "Środa", "Czwartek", "Piątek", "Sobota"
-			],
-			monthNames: [
-				"Sty", "Lu", "Mar", "Kwie", "Maj", "Cze", "Lip", "Sie", "Wrz", "Paź", "Lis", "Gru",
-				"Styczeń", "Luty", "Marzec", "Kwiecień", "Maj", "Czerwiec", "Lipiec", "Sierpień", "Wrzesień", "Październik", "Listopad", "Grudzień"
-				],
-			AmPm : ["am","pm","AM","PM"],
-			S: function (j) {return j < 11 || j > 13 ? ['', '', '', ''][Math.min((j - 1) % 10, 3)] : ''},
-			srcformat: 'Y-m-d',
-			newformat: 'd/m/Y',
-			masks : {
-			    ISO8601Long:"Y-m-d H:i:s",
-			    ISO8601Short:"Y-m-d",
-			    ShortDate: "n/j/Y",
-			    LongDate: "l, F d, Y",
-			    FullDateTime: "l, F d, Y g:i:s A",
-			    MonthDay: "F d",
-			    ShortTime: "g:i A",
-			    LongTime: "g:i:s A",
-			    SortableDateTime: "Y-m-d\\TH:i:s",
-			    UniversalSortableDateTime: "Y-m-d H:i:sO",
-			    YearMonth: "F, Y"
-			},
-			reformatAfterEdit : false
-		},	
-		baseLinkUrl: '',
-		showAction: '',
-	    target: '',
-	    checkbox : {disabled:true},
-		idName : 'id'
-	}
-};
+;(function($){
+/**
+ * jqGrid Polish Translation
+ * Łukasz Schab
+ * http://FreeTree.pl
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl.html
+**/
+$.jgrid = {
+	defaults : {
+		recordtext: "Pokaż {0} - {1} z {2}",
+	    emptyrecords: "Brak rekordów do pokazania",
+		loadtext: "\u0142adowanie...",
+		pgtext : "Strona {0} z {1}"
+	},
+	search : {
+	    caption: "Wyszukiwanie...",
+	    Find: "Szukaj",
+	    Reset: "Czyść",
+	    odata : ['dok\u0142adnie', 'różne od', 'mniejsze od', 'mniejsze lub równe','większe od','większe lub równe', 'zaczyna się od','nie zaczyna się od','zawiera','nie zawiera','kończy się na','nie kończy się na','zawiera','nie zawiera'],
+	    groupOps: [	{ op: "ORAZ", text: "wszystkie" },	{ op: "LUB",  text: "każdy" }	],
+		matchText: " pasuje",
+		rulesText: " regu\u0142y"
+	},
+	edit : {
+	    addCaption: "Dodaj rekord",
+	    editCaption: "Edytuj rekord",
+	    bSubmit: "Zapisz",
+	    bCancel: "Anuluj",
+		bClose: "Zamknij",
+		saveData: "Dane zosta\u0142y zmienione! Zapisać zmiany?",
+		bYes : "Tak",
+		bNo : "Nie",
+		bExit : "Anuluj",
+	    msg: {
+	        required:"Pole jest wymagane",
+	        number:"Proszę wpisać poprawną liczbę",
+	        minValue:"wartość musi być większa lub równa",
+	        maxValue:"wartość musi być mniejsza od",
+	        email: "nie jest adresem e-mail",
+	        integer: "Proszę wpisać poprawną liczbę",
+			date: "Proszę podaj poprawną datę",
+			url: "jest niew\u0142aściwym adresem URL. Pamiętaj o prefiksie ('http://' lub 'https://')",
+			nodefined : " is not defined!",
+			novalue : " return value is required!",
+			customarray : "Custom function should return array!",
+			customfcheck : "Custom function should be present in case of custom checking!"
+		}
+	},
+	view : {
+	    caption: "Pokaż rekord",
+	    bClose: "Zamknij"
+	},
+	del : {
+	    caption: "Usuwanie",
+	    msg: "Czy usunąć wybrany rekord(y)?",
+	    bSubmit: "Usuń",
+	    bCancel: "Anuluj"
+	},
+	nav : {
+		edittext: " ",
+	    edittitle: "Edytuj wybrany wiersz",
+		addtext:" ",
+	    addtitle: "Dodaj nowy wiersz",
+	    deltext: " ",
+	    deltitle: "Usuń wybrany wiersz",
+	    searchtext: " ",
+	    searchtitle: "Wyszukaj rekord",
+	    refreshtext: "",
+	    refreshtitle: "Prze\u0142aduj",
+	    alertcap: "Uwaga",
+	    alerttext: "Proszę wybrać wiersz",
+		viewtext: "",
+		viewtitle: "View selected row"
+	},
+	col : {
+	    caption: "Pokaż/Ukryj kolumny",
+	    bSubmit: "Zatwierdź",
+	    bCancel: "Anuluj"	
+	},
+	errors : {
+		errcap : "B\u0142ąd",
+		nourl : "Brak adresu url",
+		norecords: "Brak danych",
+	    model : "D\u0142ugość colNames <> colModel!"
+	},
+	formatter : {
+		integer : {thousandsSeparator: " ", defaultValue: '0'},
+		number : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0.00'},
+		currency : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0.00'},
+		date : {
+			dayNames:   [
+				"Nie", "Pon", "Wt", "Śr", "Cz", "Pi", "So",
+				"Niedziela", "Poniedzia\u0142ek", "Wtorek", "Środa", "Czwartek", "Piątek", "Sobota"
+			],
+			monthNames: [
+				"Sty", "Lu", "Mar", "Kwie", "Maj", "Cze", "Lip", "Sie", "Wrz", "Paź", "Lis", "Gru",
+				"Styczeń", "Luty", "Marzec", "Kwiecień", "Maj", "Czerwiec", "Lipiec", "Sierpień", "Wrzesień", "Październik", "Listopad", "Grudzień"
+				],
+			AmPm : ["am","pm","AM","PM"],
+			S: function (j) {return j < 11 || j > 13 ? ['', '', '', ''][Math.min((j - 1) % 10, 3)] : ''},
+			srcformat: 'Y-m-d',
+			newformat: 'd/m/Y',
+			masks : {
+			    ISO8601Long:"Y-m-d H:i:s",
+			    ISO8601Short:"Y-m-d",
+			    ShortDate: "n/j/Y",
+			    LongDate: "l, F d, Y",
+			    FullDateTime: "l, F d, Y g:i:s A",
+			    MonthDay: "F d",
+			    ShortTime: "g:i A",
+			    LongTime: "g:i:s A",
+			    SortableDateTime: "Y-m-d\\TH:i:s",
+			    UniversalSortableDateTime: "Y-m-d H:i:sO",
+			    YearMonth: "F, Y"
+			},
+			reformatAfterEdit : false
+		},	
+		baseLinkUrl: '',
+		showAction: '',
+	    target: '',
+	    checkbox : {disabled:true},
+		idName : 'id'
+	}
+};
 })(jQuery);
\ No newline at end of file
Index: controlies/trunk/applications/controlies/static/js/jdgrid/src/i18n/grid.locale-sk.js
===================================================================
--- controlies/trunk/applications/controlies/static/js/jdgrid/src/i18n/grid.locale-sk.js	(revision 240)
+++ controlies/trunk/applications/controlies/static/js/jdgrid/src/i18n/grid.locale-sk.js	(revision 241)
@@ -1,127 +1,127 @@
-;(function($){
-/**
- * jqGrid Slovak Translation
- * Milan Cibulka
- * http://trirand.com/blog/ 
- * Dual licensed under the MIT and GPL licenses:
- * http://www.opensource.org/licenses/mit-license.php
- * http://www.gnu.org/licenses/gpl.html
-**/
-$.jgrid = {
-	defaults : {
-		recordtext: "Zobrazených {0} - {1} z {2} záznamov",
-	    emptyrecords: "Neboli nájdené žiadne záznamy",
-		loadtext: "Načítám...",
-		pgtext : "Strana {0} z {1}"
-	},
-	search : {
-		caption: "Vyhľadávam...",
-		Find: "Hľadať",
-		Reset: "Reset",
-	    odata : ['rovná sa', 'nerovná sa', 'menšie', 'menšie alebo rovnajúce sa','väčšie', 'väčšie alebo rovnajúce sa', 'začína s', 'nezačína s', 'je v', 'nie je v', 'končí s', 'nekončí s', 'obahuje', 'neobsahuje'],
-	    groupOps: [	{ op: "AND", text: "všetkých" },	{ op: "OR",  text: "niektorého z" }	],
-		matchText: " hľadať podla",
-		rulesText: " pravidiel"
-	},
-	edit : {
-		addCaption: "Pridať záznam",
-		editCaption: "Editácia záznamov",
-		bSubmit: "Uložiť",
-		bCancel: "Storno",
-		bClose: "Zavrieť",
-		saveData: "Údaje boli zmenené! Uložiť zmeny?",
-		bYes : "Ano",
-		bNo : "Nie",
-		bExit : "Zrušiť",
-		msg: {
-		    required:"Pole je požadované",
-		    number:"Prosím, vložte valídne číslo",
-		    minValue:"hodnota musí býť väčšia ako alebo rovná ",
-		    maxValue:"hodnota musí býť menšia ako alebo rovná ",
-		    email: "nie je valídny e-mail",
-		    integer: "Prosím, vložte celé číslo",
-			date: "Prosím, vložte valídny dátum",
-			url: "nie je platnou URL. Požadovaný prefix ('http://' alebo 'https://')",
-			nodefined : " nie je definovaný!",
-			novalue : " je vyžadovaná návratová hodnota!",
-			customarray : "Custom function mala vrátiť pole!",
-			customfcheck : "Custom function by mala byť prítomná v prípade custom checking!"
-		}
-	},
-	view : {
-	    caption: "Zobraziť záznam",
-	    bClose: "Zavrieť"
-	},
-	del : {
-		caption: "Zmazať",
-		msg: "Zmazať vybraný(é) záznam(y)?",
-		bSubmit: "Zmazať",
-		bCancel: "Storno"
-	},
-	nav : {
-		edittext: " ",
-		edittitle: "Editovať vybraný riadok",
-		addtext:" ",
-		addtitle: "Pridať nový riadek",
-		deltext: " ",
-		deltitle: "Zmazať vybraný záznam ",
-		searchtext: " ",
-		searchtitle: "Nájsť záznamy",
-		refreshtext: "",
-		refreshtitle: "Obnoviť tabuľku",
-		alertcap: "Varovanie",
-		alerttext: "Prosím, vyberte riadok",
-		viewtext: "",
-		viewtitle: "Zobraziť vybraný riadok"
-	},
-	col : {
-		caption: "Zobrazit/Skrýť stĺpce",
-		bSubmit: "Uložiť",
-		bCancel: "Storno"	
-	},
-	errors : {
-		errcap : "Chyba",
-		nourl : "Nie je nastavená url",
-		norecords: "Žiadne záznamy k spracovaniu",
-		model : "Dĺžka colNames <> colModel!"
-	},
-	formatter : {
-		integer : {thousandsSeparator: " ", defaultValue: '0'},
-		number : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0.00'},
-		currency : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0.00'},
-		date : {
-			dayNames:   [
-				"Ne", "Po", "Ut", "St", "Št", "Pi", "So",
-				"Nedela", "Pondelok", "Utorok", "Streda", "Štvrtok", "Piatek", "Sobota"
-			],
-			monthNames: [
-				"Jan", "Feb", "Mar", "Apr", "Máj", "Jún", "Júl", "Aug", "Sep", "Okt", "Nov", "Dec",
-				"Január", "Február", "Marec", "Apríl", "Máj", "Jún", "Júl", "August", "September", "Október", "November", "December"
-			],
-			AmPm : ["do","od","DO","OD"],
-			S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'},
-			srcformat: 'Y-m-d',
-			newformat: 'd/m/Y',
-			masks : {
-		        ISO8601Long:"Y-m-d H:i:s",
-		        ISO8601Short:"Y-m-d",
-		        ShortDate: "n/j/Y",
-		        LongDate: "l, F d, Y",
-		        FullDateTime: "l, F d, Y g:i:s A",
-		        MonthDay: "F d",
-		        ShortTime: "g:i A",
-		        LongTime: "g:i:s A",
-		        SortableDateTime: "Y-m-d\\TH:i:s",
-		        UniversalSortableDateTime: "Y-m-d H:i:sO",
-		        YearMonth: "F, Y"
-		    },
-		    reformatAfterEdit : false
-		},
-		baseLinkUrl: '',
-		showAction: '',
-	    target: '',
-	    checkbox : {disabled:true},
-		idName : 'id'
-	}
-};
-})(jQuery);
+;(function($){
+/**
+ * jqGrid Slovak Translation
+ * Milan Cibulka
+ * http://trirand.com/blog/ 
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl.html
+**/
+$.jgrid = {
+	defaults : {
+		recordtext: "Zobrazených {0} - {1} z {2} záznamov",
+	    emptyrecords: "Neboli nájdené žiadne záznamy",
+		loadtext: "Načítám...",
+		pgtext : "Strana {0} z {1}"
+	},
+	search : {
+		caption: "Vyhľadávam...",
+		Find: "Hľadať",
+		Reset: "Reset",
+	    odata : ['rovná sa', 'nerovná sa', 'menšie', 'menšie alebo rovnajúce sa','väčšie', 'väčšie alebo rovnajúce sa', 'začína s', 'nezačína s', 'je v', 'nie je v', 'končí s', 'nekončí s', 'obahuje', 'neobsahuje'],
+	    groupOps: [	{ op: "AND", text: "všetkých" },	{ op: "OR",  text: "niektorého z" }	],
+		matchText: " hľadať podla",
+		rulesText: " pravidiel"
+	},
+	edit : {
+		addCaption: "Pridať záznam",
+		editCaption: "Editácia záznamov",
+		bSubmit: "Uložiť",
+		bCancel: "Storno",
+		bClose: "Zavrieť",
+		saveData: "Údaje boli zmenené! Uložiť zmeny?",
+		bYes : "Ano",
+		bNo : "Nie",
+		bExit : "Zrušiť",
+		msg: {
+		    required:"Pole je požadované",
+		    number:"Prosím, vložte valídne číslo",
+		    minValue:"hodnota musí býť väčšia ako alebo rovná ",
+		    maxValue:"hodnota musí býť menšia ako alebo rovná ",
+		    email: "nie je valídny e-mail",
+		    integer: "Prosím, vložte celé číslo",
+			date: "Prosím, vložte valídny dátum",
+			url: "nie je platnou URL. Požadovaný prefix ('http://' alebo 'https://')",
+			nodefined : " nie je definovaný!",
+			novalue : " je vyžadovaná návratová hodnota!",
+			customarray : "Custom function mala vrátiť pole!",
+			customfcheck : "Custom function by mala byť prítomná v prípade custom checking!"
+		}
+	},
+	view : {
+	    caption: "Zobraziť záznam",
+	    bClose: "Zavrieť"
+	},
+	del : {
+		caption: "Zmazať",
+		msg: "Zmazať vybraný(é) záznam(y)?",
+		bSubmit: "Zmazať",
+		bCancel: "Storno"
+	},
+	nav : {
+		edittext: " ",
+		edittitle: "Editovať vybraný riadok",
+		addtext:" ",
+		addtitle: "Pridať nový riadek",
+		deltext: " ",
+		deltitle: "Zmazať vybraný záznam ",
+		searchtext: " ",
+		searchtitle: "Nájsť záznamy",
+		refreshtext: "",
+		refreshtitle: "Obnoviť tabuľku",
+		alertcap: "Varovanie",
+		alerttext: "Prosím, vyberte riadok",
+		viewtext: "",
+		viewtitle: "Zobraziť vybraný riadok"
+	},
+	col : {
+		caption: "Zobrazit/Skrýť stĺpce",
+		bSubmit: "Uložiť",
+		bCancel: "Storno"	
+	},
+	errors : {
+		errcap : "Chyba",
+		nourl : "Nie je nastavená url",
+		norecords: "Žiadne záznamy k spracovaniu",
+		model : "Dĺžka colNames <> colModel!"
+	},
+	formatter : {
+		integer : {thousandsSeparator: " ", defaultValue: '0'},
+		number : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0.00'},
+		currency : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0.00'},
+		date : {
+			dayNames:   [
+				"Ne", "Po", "Ut", "St", "Št", "Pi", "So",
+				"Nedela", "Pondelok", "Utorok", "Streda", "Štvrtok", "Piatek", "Sobota"
+			],
+			monthNames: [
+				"Jan", "Feb", "Mar", "Apr", "Máj", "Jún", "Júl", "Aug", "Sep", "Okt", "Nov", "Dec",
+				"Január", "Február", "Marec", "Apríl", "Máj", "Jún", "Júl", "August", "September", "Október", "November", "December"
+			],
+			AmPm : ["do","od","DO","OD"],
+			S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'},
+			srcformat: 'Y-m-d',
+			newformat: 'd/m/Y',
+			masks : {
+		        ISO8601Long:"Y-m-d H:i:s",
+		        ISO8601Short:"Y-m-d",
+		        ShortDate: "n/j/Y",
+		        LongDate: "l, F d, Y",
+		        FullDateTime: "l, F d, Y g:i:s A",
+		        MonthDay: "F d",
+		        ShortTime: "g:i A",
+		        LongTime: "g:i:s A",
+		        SortableDateTime: "Y-m-d\\TH:i:s",
+		        UniversalSortableDateTime: "Y-m-d H:i:sO",
+		        YearMonth: "F, Y"
+		    },
+		    reformatAfterEdit : false
+		},
+		baseLinkUrl: '',
+		showAction: '',
+	    target: '',
+	    checkbox : {disabled:true},
+		idName : 'id'
+	}
+};
+})(jQuery);
Index: controlies/trunk/applications/controlies/static/js/jdgrid/src/i18n/grid.locale-ro.js
===================================================================
--- controlies/trunk/applications/controlies/static/js/jdgrid/src/i18n/grid.locale-ro.js	(revision 240)
+++ controlies/trunk/applications/controlies/static/js/jdgrid/src/i18n/grid.locale-ro.js	(revision 241)
@@ -1,139 +1,139 @@
-;(function($){
-/**
- * jqGrid Romanian Translation
- * Alexandru Emil Lupu contact@alecslupu.ro
- * http://www.alecslupu.ro/ 
- * Dual licensed under the MIT and GPL licenses:
- * http://www.opensource.org/licenses/mit-license.php
- * http://www.gnu.org/licenses/gpl.html
-**/
-$.jgrid = {
-	defaults : {
-		recordtext: "Vizualizare {0} - {1} din {2}",
-		emptyrecords: "Nu există înregistrări de vizualizat",
-		loadtext: "Încărcare...",
-		pgtext : "Pagina {0} din {1}"
-	},
-	search : {
-		caption: "Caută...",
-		Find: "Caută",
-		Reset: "Resetare",
-		odata : ['egal', 'diferit', 'mai mic', 'mai mic sau egal','mai mare','mai mare sau egal', 'începe cu','nu începe cu','se găsește în','nu se găsește în','se termină cu','nu se termină cu','conține',''],
-		groupOps: [	{ op: "AND", text: "toate" },	{ op: "OR",  text: "oricare" }	],
-		matchText: " găsite",
-		rulesText: " reguli"
-	},
-	edit : {
-		addCaption: "Adăugare înregistrare",
-		editCaption: "Modificare înregistrare",
-		bSubmit: "Salvează",
-		bCancel: "Anulare",
-		bClose: "Închide",
-		saveData: "Informațiile au fost modificate! Salvați modificările?",
-		bYes : "Da",
-		bNo : "Nu",
-		bExit : "Anulare",
-		msg: {
-			required:"Câmpul este obligatoriu",
-			number:"Vă rugăm introduceți un număr valid",
-			minValue:"valoarea trebuie sa fie mai mare sau egală cu",
-			maxValue:"valoarea trebuie sa fie mai mică sau egală cu",
-			email: "nu este o adresă de e-mail validă",
-			integer: "Vă rugăm introduceți un număr valid",
-			date: "Vă rugăm să introduceți o dată validă",
-			url: "Nu este un URL valid. Prefixul  este necesar('http://' or 'https://')",
-			nodefined : " is not defined!",
-			novalue : " return value is required!",
-			customarray : "Custom function should return array!",
-			customfcheck : "Custom function should be present in case of custom checking!"
-		}
-	},
-	view : {
-		caption: "Vizualizare înregistrare",
-		bClose: "Închidere"
-	},
-	del : {
-		caption: "Ștegere",
-		msg: "Ștergeți înregistrarea (înregistrările) selectate?",
-		bSubmit: "Șterge",
-		bCancel: "Anulare"
-	},
-	nav : {
-		edittext: "",
-		edittitle: "Modifică rândul selectat",
-		addtext:"",
-		addtitle: "Adaugă rând nou",
-		deltext: "",
-		deltitle: "Șterge rândul selectat",
-		searchtext: "",
-		searchtitle: "Căutare înregistrări",
-		refreshtext: "",
-		refreshtitle: "Reîncarcare Grid",
-		alertcap: "Avertisment",
-		alerttext: "Vă rugăm să selectați un rând",
-		viewtext: "",
-		viewtitle: "Vizualizează rândul selectat"
-	},
-	col : {
-		caption: "Arată/Ascunde coloanele",
-		bSubmit: "Salvează",
-		bCancel: "Anulare"
-	},
-	errors : {
-		errcap : "Eroare",
-		nourl : "Niciun url nu este setat",
-		norecords: "Nu sunt înregistrări de procesat",
-		model : "Lungimea colNames <> colModel!"
-	},
-	formatter : {
-		integer : {thousandsSeparator: " ", defaultValue: '0'},
-		number : {decimalSeparator:",", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0,00'},
-		currency : {decimalSeparator:",", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0,00'},
-		date : {
-			dayNames:   [
-				"Dum", "Lun", "Mar", "Mie", "Joi", "Vin", "Sâm",
-				"Duminică", "Luni", "Marți", "Miercuri", "Joi", "Vineri", "Sâmbătă"
-			],
-			monthNames: [
-				"Ian", "Feb", "Mar", "Apr", "Mai", "Iun", "Iul", "Aug", "Sep", "Oct", "Noi", "Dec",
-				"Ianuarie", "Februarie", "Martie", "Aprilie", "Mai", "Iunie", "Iulie", "August", "Septembrie", "Octombrie", "Noiembrie", "Decembrie"
-			],
-			AmPm : ["am","pm","AM","PM"],
-			/*
-			 Here is a problem in romanian: 
-					M	/	F
-			 1st = primul / prima
-			 2nd = Al doilea / A doua
-			 3rd = Al treilea / A treia 
-			 4th = Al patrulea/ A patra
-			 5th = Al cincilea / A cincea 
-			 6th = Al șaselea / A șasea
-			 7th = Al șaptelea / A șaptea
-			 .... 
-			 */
-			S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'},
-			srcformat: 'Y-m-d',
-			newformat: 'd/m/Y',
-			masks : {
-				ISO8601Long:"Y-m-d H:i:s",
-				ISO8601Short:"Y-m-d",
-				ShortDate: "n/j/Y",
-				LongDate: "l, F d, Y",
-				FullDateTime: "l, F d, Y g:i:s A",
-				MonthDay: "F d",
-				ShortTime: "g:i A",
-				LongTime: "g:i:s A",
-				SortableDateTime: "Y-m-d\\TH:i:s",
-				UniversalSortableDateTime: "Y-m-d H:i:sO",
-				YearMonth: "F, Y"
-			},
-			reformatAfterEdit : false
-		},
-		baseLinkUrl: '',
-		showAction: '',
-		target: '',
-		checkbox : {disabled:true},
-		idName : 'id'
-	}
-};
-})(jQuery);
+;(function($){
+/**
+ * jqGrid Romanian Translation
+ * Alexandru Emil Lupu contact@alecslupu.ro
+ * http://www.alecslupu.ro/ 
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl.html
+**/
+$.jgrid = {
+	defaults : {
+		recordtext: "Vizualizare {0} - {1} din {2}",
+		emptyrecords: "Nu există înregistrări de vizualizat",
+		loadtext: "Încărcare...",
+		pgtext : "Pagina {0} din {1}"
+	},
+	search : {
+		caption: "Caută...",
+		Find: "Caută",
+		Reset: "Resetare",
+		odata : ['egal', 'diferit', 'mai mic', 'mai mic sau egal','mai mare','mai mare sau egal', 'începe cu','nu începe cu','se găsește în','nu se găsește în','se termină cu','nu se termină cu','conține',''],
+		groupOps: [	{ op: "AND", text: "toate" },	{ op: "OR",  text: "oricare" }	],
+		matchText: " găsite",
+		rulesText: " reguli"
+	},
+	edit : {
+		addCaption: "Adăugare înregistrare",
+		editCaption: "Modificare înregistrare",
+		bSubmit: "Salvează",
+		bCancel: "Anulare",
+		bClose: "Închide",
+		saveData: "Informațiile au fost modificate! Salvați modificările?",
+		bYes : "Da",
+		bNo : "Nu",
+		bExit : "Anulare",
+		msg: {
+			required:"Câmpul este obligatoriu",
+			number:"Vă rugăm introduceți un număr valid",
+			minValue:"valoarea trebuie sa fie mai mare sau egală cu",
+			maxValue:"valoarea trebuie sa fie mai mică sau egală cu",
+			email: "nu este o adresă de e-mail validă",
+			integer: "Vă rugăm introduceți un număr valid",
+			date: "Vă rugăm să introduceți o dată validă",
+			url: "Nu este un URL valid. Prefixul  este necesar('http://' or 'https://')",
+			nodefined : " is not defined!",
+			novalue : " return value is required!",
+			customarray : "Custom function should return array!",
+			customfcheck : "Custom function should be present in case of custom checking!"
+		}
+	},
+	view : {
+		caption: "Vizualizare înregistrare",
+		bClose: "Închidere"
+	},
+	del : {
+		caption: "Ștegere",
+		msg: "Ștergeți înregistrarea (înregistrările) selectate?",
+		bSubmit: "Șterge",
+		bCancel: "Anulare"
+	},
+	nav : {
+		edittext: "",
+		edittitle: "Modifică rândul selectat",
+		addtext:"",
+		addtitle: "Adaugă rând nou",
+		deltext: "",
+		deltitle: "Șterge rândul selectat",
+		searchtext: "",
+		searchtitle: "Căutare înregistrări",
+		refreshtext: "",
+		refreshtitle: "Reîncarcare Grid",
+		alertcap: "Avertisment",
+		alerttext: "Vă rugăm să selectați un rând",
+		viewtext: "",
+		viewtitle: "Vizualizează rândul selectat"
+	},
+	col : {
+		caption: "Arată/Ascunde coloanele",
+		bSubmit: "Salvează",
+		bCancel: "Anulare"
+	},
+	errors : {
+		errcap : "Eroare",
+		nourl : "Niciun url nu este setat",
+		norecords: "Nu sunt înregistrări de procesat",
+		model : "Lungimea colNames <> colModel!"
+	},
+	formatter : {
+		integer : {thousandsSeparator: " ", defaultValue: '0'},
+		number : {decimalSeparator:",", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0,00'},
+		currency : {decimalSeparator:",", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0,00'},
+		date : {
+			dayNames:   [
+				"Dum", "Lun", "Mar", "Mie", "Joi", "Vin", "Sâm",
+				"Duminică", "Luni", "Marți", "Miercuri", "Joi", "Vineri", "Sâmbătă"
+			],
+			monthNames: [
+				"Ian", "Feb", "Mar", "Apr", "Mai", "Iun", "Iul", "Aug", "Sep", "Oct", "Noi", "Dec",
+				"Ianuarie", "Februarie", "Martie", "Aprilie", "Mai", "Iunie", "Iulie", "August", "Septembrie", "Octombrie", "Noiembrie", "Decembrie"
+			],
+			AmPm : ["am","pm","AM","PM"],
+			/*
+			 Here is a problem in romanian: 
+					M	/	F
+			 1st = primul / prima
+			 2nd = Al doilea / A doua
+			 3rd = Al treilea / A treia 
+			 4th = Al patrulea/ A patra
+			 5th = Al cincilea / A cincea 
+			 6th = Al șaselea / A șasea
+			 7th = Al șaptelea / A șaptea
+			 .... 
+			 */
+			S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'},
+			srcformat: 'Y-m-d',
+			newformat: 'd/m/Y',
+			masks : {
+				ISO8601Long:"Y-m-d H:i:s",
+				ISO8601Short:"Y-m-d",
+				ShortDate: "n/j/Y",
+				LongDate: "l, F d, Y",
+				FullDateTime: "l, F d, Y g:i:s A",
+				MonthDay: "F d",
+				ShortTime: "g:i A",
+				LongTime: "g:i:s A",
+				SortableDateTime: "Y-m-d\\TH:i:s",
+				UniversalSortableDateTime: "Y-m-d H:i:sO",
+				YearMonth: "F, Y"
+			},
+			reformatAfterEdit : false
+		},
+		baseLinkUrl: '',
+		showAction: '',
+		target: '',
+		checkbox : {disabled:true},
+		idName : 'id'
+	}
+};
+})(jQuery);
Index: controlies/trunk/applications/controlies/static/js/jdgrid/src/i18n/grid.locale-pt.js
===================================================================
--- controlies/trunk/applications/controlies/static/js/jdgrid/src/i18n/grid.locale-pt.js	(revision 240)
+++ controlies/trunk/applications/controlies/static/js/jdgrid/src/i18n/grid.locale-pt.js	(revision 241)
@@ -1,125 +1,125 @@
-;(function($){
-/**
- * jqGrid Portuguese Translation
-* Tradu��o da jqGrid em Portugues por Frederico Carvalho, http://www.eyeviewdesign.pt
- * Dual licensed under the MIT and GPL licenses:
- * http://www.opensource.org/licenses/mit-license.php
- * http://www.gnu.org/licenses/gpl.html
-**/
-$.jgrid = {
-	defaults : {
-		recordtext: "View {0} - {1} of {2}",
-	    emptyrecords: "No records to view",
-		loadtext: "A carregar...",
-		pgtext : "Page {0} of {1}"
-	},
-	search : {
-	    caption: "Busca...",
-	    Find: "Procurar",
-	    Reset: "Limpar",
-	    odata : ['equal', 'not equal', 'less', 'less or equal','greater','greater or equal', 'begins with','does not begin with','is in','is not in','ends with','does not end with','contains','does not contain'],
-	    groupOps: [	{ op: "AND", text: "all" },	{ op: "OR",  text: "any" }	],
-		matchText: " match",
-		rulesText: " rules"
-	},
-	edit : {
-	    addCaption: "Adicionar Registo",
-	    editCaption: "Modificar Registo",
-	    bSubmit: "Submeter",
-	    bCancel: "Cancelar",
-		bClose: "Fechar",
-		saveData: "Data has been changed! Save changes?",
-		bYes : "Yes",
-		bNo : "No",
-		bExit : "Cancel",
-	    msg: {
-	        required:"Campo obrigat�rio",
-	        number:"Por favor, introduza um numero",
-	        minValue:"O valor deve ser maior ou igual que",
-	        maxValue:"O valor deve ser menor ou igual a",
-	        email: "N�o � um endere�o de email v�lido",
-	        integer: "Por favor, introduza um numero inteiro",
-			url: "is not a valid URL. Prefix required ('http://' or 'https://')",
-			nodefined : " is not defined!",
-			novalue : " return value is required!",
-			customarray : "Custom function should return array!",
-			customfcheck : "Custom function should be present in case of custom checking!"
-		}
-	},
-	view : {
-	    caption: "View Record",
-	    bClose: "Close"
-	},
-	del : {
-	    caption: "Eliminar",
-	    msg: "Deseja eliminar o(s) registo(s) seleccionado(s)?",
-	    bSubmit: "Eliminar",
-	    bCancel: "Cancelar"
-	},
-	nav : {
-		edittext: " ",
-	    edittitle: "Modificar registo seleccionado",
-		addtext:" ",
-	    addtitle: "Adicionar novo registo",
-	    deltext: " ",
-	    deltitle: "Eliminar registo seleccionado",
-	    searchtext: " ",
-	    searchtitle: "Procurar",
-	    refreshtext: "",
-	    refreshtitle: "Actualizar",
-	    alertcap: "Aviso",
-	    alerttext: "Por favor, seleccione um registo",
-		viewtext: "",
-		viewtitle: "View selected row"
-	},
-	col : {
-	    caption: "Mostrar/Ocultar Colunas",
-	    bSubmit: "Enviar",
-	    bCancel: "Cancelar"	
-	},
-	errors : {
-		errcap : "Erro",
-		nourl : "N�o especificou um url",
-		norecords: "N�o existem dados para processar",
-	    model : "Tamanho do colNames <> colModel!"
-	},
-	formatter : {
-		integer : {thousandsSeparator: " ", defaultValue: '0'},
-		number : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0.00'},
-		currency : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0.00'},
-		date : {
-			dayNames:   [
-				"Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sab",
-				"Domingo", "Segunda-Feira", "Ter�a-Feira", "Quarta-Feira", "Quinta-Feira", "Sexta-Feira", "S�bado"
-			],
-			monthNames: [
-				"Jan", "Fev", "Mar", "Abr", "Mai", "Jun", "Jul", "Ago", "Set", "Out", "Nov", "Dez",
-				"Janeiro", "Fevereiro", "Mar�o", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"
-			],
-			AmPm : ["am","pm","AM","PM"],
-			S: function (j) {return j < 11 || j > 13 ? ['�', '�', '�', '�'][Math.min((j - 1) % 10, 3)] : '�'},
-			srcformat: 'Y-m-d',
-			newformat: 'd/m/Y',
-			masks : {
-	            ISO8601Long:"Y-m-d H:i:s",
-	            ISO8601Short:"Y-m-d",
-	            ShortDate: "n/j/Y",
-	            LongDate: "l, F d, Y",
-	            FullDateTime: "l, F d, Y g:i:s A",
-	            MonthDay: "F d",
-	            ShortTime: "g:i A",
-	            LongTime: "g:i:s A",
-	            SortableDateTime: "Y-m-d\\TH:i:s",
-	            UniversalSortableDateTime: "Y-m-d H:i:sO",
-	            YearMonth: "F, Y"
-	        },
-	        reformatAfterEdit : false
-		},
-		baseLinkUrl: '',
-		showAction: '',
-	    target: '',
-	    checkbox : {disabled:true},
-		idName : 'id'
-	}
-};
-})(jQuery);
+;(function($){
+/**
+ * jqGrid Portuguese Translation
+* Tradu��o da jqGrid em Portugues por Frederico Carvalho, http://www.eyeviewdesign.pt
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl.html
+**/
+$.jgrid = {
+	defaults : {
+		recordtext: "View {0} - {1} of {2}",
+	    emptyrecords: "No records to view",
+		loadtext: "A carregar...",
+		pgtext : "Page {0} of {1}"
+	},
+	search : {
+	    caption: "Busca...",
+	    Find: "Procurar",
+	    Reset: "Limpar",
+	    odata : ['equal', 'not equal', 'less', 'less or equal','greater','greater or equal', 'begins with','does not begin with','is in','is not in','ends with','does not end with','contains','does not contain'],
+	    groupOps: [	{ op: "AND", text: "all" },	{ op: "OR",  text: "any" }	],
+		matchText: " match",
+		rulesText: " rules"
+	},
+	edit : {
+	    addCaption: "Adicionar Registo",
+	    editCaption: "Modificar Registo",
+	    bSubmit: "Submeter",
+	    bCancel: "Cancelar",
+		bClose: "Fechar",
+		saveData: "Data has been changed! Save changes?",
+		bYes : "Yes",
+		bNo : "No",
+		bExit : "Cancel",
+	    msg: {
+	        required:"Campo obrigat�rio",
+	        number:"Por favor, introduza um numero",
+	        minValue:"O valor deve ser maior ou igual que",
+	        maxValue:"O valor deve ser menor ou igual a",
+	        email: "N�o � um endere�o de email v�lido",
+	        integer: "Por favor, introduza um numero inteiro",
+			url: "is not a valid URL. Prefix required ('http://' or 'https://')",
+			nodefined : " is not defined!",
+			novalue : " return value is required!",
+			customarray : "Custom function should return array!",
+			customfcheck : "Custom function should be present in case of custom checking!"
+		}
+	},
+	view : {
+	    caption: "View Record",
+	    bClose: "Close"
+	},
+	del : {
+	    caption: "Eliminar",
+	    msg: "Deseja eliminar o(s) registo(s) seleccionado(s)?",
+	    bSubmit: "Eliminar",
+	    bCancel: "Cancelar"
+	},
+	nav : {
+		edittext: " ",
+	    edittitle: "Modificar registo seleccionado",
+		addtext:" ",
+	    addtitle: "Adicionar novo registo",
+	    deltext: " ",
+	    deltitle: "Eliminar registo seleccionado",
+	    searchtext: " ",
+	    searchtitle: "Procurar",
+	    refreshtext: "",
+	    refreshtitle: "Actualizar",
+	    alertcap: "Aviso",
+	    alerttext: "Por favor, seleccione um registo",
+		viewtext: "",
+		viewtitle: "View selected row"
+	},
+	col : {
+	    caption: "Mostrar/Ocultar Colunas",
+	    bSubmit: "Enviar",
+	    bCancel: "Cancelar"	
+	},
+	errors : {
+		errcap : "Erro",
+		nourl : "N�o especificou um url",
+		norecords: "N�o existem dados para processar",
+	    model : "Tamanho do colNames <> colModel!"
+	},
+	formatter : {
+		integer : {thousandsSeparator: " ", defaultValue: '0'},
+		number : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0.00'},
+		currency : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0.00'},
+		date : {
+			dayNames:   [
+				"Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sab",
+				"Domingo", "Segunda-Feira", "Ter�a-Feira", "Quarta-Feira", "Quinta-Feira", "Sexta-Feira", "S�bado"
+			],
+			monthNames: [
+				"Jan", "Fev", "Mar", "Abr", "Mai", "Jun", "Jul", "Ago", "Set", "Out", "Nov", "Dez",
+				"Janeiro", "Fevereiro", "Mar�o", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"
+			],
+			AmPm : ["am","pm","AM","PM"],
+			S: function (j) {return j < 11 || j > 13 ? ['�', '�', '�', '�'][Math.min((j - 1) % 10, 3)] : '�'},
+			srcformat: 'Y-m-d',
+			newformat: 'd/m/Y',
+			masks : {
+	            ISO8601Long:"Y-m-d H:i:s",
+	            ISO8601Short:"Y-m-d",
+	            ShortDate: "n/j/Y",
+	            LongDate: "l, F d, Y",
+	            FullDateTime: "l, F d, Y g:i:s A",
+	            MonthDay: "F d",
+	            ShortTime: "g:i A",
+	            LongTime: "g:i:s A",
+	            SortableDateTime: "Y-m-d\\TH:i:s",
+	            UniversalSortableDateTime: "Y-m-d H:i:sO",
+	            YearMonth: "F, Y"
+	        },
+	        reformatAfterEdit : false
+		},
+		baseLinkUrl: '',
+		showAction: '',
+	    target: '',
+	    checkbox : {disabled:true},
+		idName : 'id'
+	}
+};
+})(jQuery);
Index: controlies/trunk/applications/controlies/static/js/jdgrid/src/i18n/grid.locale-pt-br.js
===================================================================
--- controlies/trunk/applications/controlies/static/js/jdgrid/src/i18n/grid.locale-pt-br.js	(revision 240)
+++ controlies/trunk/applications/controlies/static/js/jdgrid/src/i18n/grid.locale-pt-br.js	(revision 241)
@@ -1,127 +1,127 @@
-;(function($){
-/**
- * jqGrid Brazilian-Portuguese Translation
- * Sergio Righi sergio.righi@gmail.com
- * http://curve.com.br
- * Dual licensed under the MIT and GPL licenses:
- * http://www.opensource.org/licenses/mit-license.php
- * http://www.gnu.org/licenses/gpl.html
-**/
-$.jgrid = {
-	defaults : {
-		recordtext: "Ver {0} - {1} of {2}",
-	    emptyrecords: "Nenhum registro para visualizar",
-		loadtext: "Carregando...",
-		pgtext : "Página {0} de {1}"
-	},
-	search : {
-	    caption: "Procurar...",
-	    Find: "Procurar",
-	    Reset: "Resetar",
-	    odata : ['equal', 'not equal', 'less', 'less or equal','greater','greater or equal', 'begins with','does not begin with','is in','is not in','ends with','does not end with','contains','does not contain'],
-	    groupOps: [	{ op: "AND", text: "all" },	{ op: "OR",  text: "any" }	],
-		matchText: " iguala",
-		rulesText: " regras"
-	},
-	edit : {
-	    addCaption: "Incluir",
-	    editCaption: "Alterar",
-	    bSubmit: "Enviar",
-	    bCancel: "Cancelar",
-		bClose: "Fechar",
-		saveData: "Os dados foram alterados! Salvar alterações?",
-		bYes : "Sim",
-		bNo : "Não",
-		bExit : "Cancelar",
-	    msg: {
-	        required:"Campo obrigatório",
-	        number:"Por favor, informe um número válido",
-	        minValue:"valor deve ser igual ou maior que ",
-	        maxValue:"valor deve ser menor ou igual a",
-	        email: "este e-mail não é válido",
-	        integer: "Por favor, informe um valor inteiro",
-			date: "Por favor, informe uma data válida",
-			url: "não é uma URL válida. Prefixo obrigatório ('http://' or 'https://')",
-			nodefined : " não está definido!",
-			novalue : " um valor de retorno é obrigatório!",
-			customarray : "Função customizada deve retornar um array!",
-			customfcheck : "Função customizada deve estar presente em caso de validação customizada!"
-		}
-	},
-	view : {
-	    caption: "Ver Registro",
-	    bClose: "Fechar"
-	},
-	del : {
-    caption: "Apagar",
-	    msg: "Apagar registros selecionado(s)?",
-	    bSubmit: "Apagar",
-	    bCancel: "Cancelar"
-	},
-	nav : {
-		edittext: " ",
-	    edittitle: "Alterar registro selecionado",
-		addtext:" ",
-	    addtitle: "Incluir novo registro",
-	    deltext: " ",
-	    deltitle: "Apagar registro selecionado",
-	    searchtext: " ",
-	    searchtitle: "Procurar registros",
-	    refreshtext: "",
-	    refreshtitle: "Recarrgando Tabela",
-	    alertcap: "Aviso",
-	    alerttext: "Por favor, selecione um registro",
-		viewtext: "",
-		viewtitle: "Ver linha selecionada"
-	},
-	col : {
-	    caption: "Mostrar/Esconder Colunas",
-	    bSubmit: "Enviar",
-	    bCancel: "Cancelar"
-	},
-	errors : {
-		errcap : "Erro",
-		nourl : "Nenhuma URL defenida",
-		norecords: "Sem registros para exibir",
-	    model : "Comprimento de colNames <> colModel!"
-	},
-	formatter : {
-		integer : {thousandsSeparator: " ", defaultValue: '0'},
-		number : {decimalSeparator:",", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0,00'},
-		currency : {decimalSeparator:",", thousandsSeparator: ".", decimalPlaces: 2, prefix: "R$ ", suffix:"", defaultValue: '0,00'},
-		date : {
-			dayNames:   [
-				"Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sáb",
-				"Domingo", "Segunda", "Terça", "Quarta", "Quinta", "Sexta", "Sábado"
-			],
-			monthNames: [
-				"Jan", "Fev", "Mar", "Abr", "Mai", "Jun", "Jul", "Ago", "Set", "Out", "Nov", "Dez",
-				"Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"
-			],
-			AmPm : ["am","pm","AM","PM"],
-			S: function (j) {return j < 11 || j > 13 ? ['º', 'º', 'º', 'º'][Math.min((j - 1) % 10, 3)] : 'º'},
-			srcformat: 'Y-m-d',
-			newformat: 'd/m/Y',
-			masks : {
-	            ISO8601Long:"Y-m-d H:i:s",
-	            ISO8601Short:"Y-m-d",
-	            ShortDate: "n/j/Y",
-	            LongDate: "l, F d, Y",
-	            FullDateTime: "l, F d, Y g:i:s A",
-	            MonthDay: "F d",
-	            ShortTime: "g:i A",
-	            LongTime: "g:i:s A",
-	            SortableDateTime: "Y-m-d\\TH:i:s",
-	            UniversalSortableDateTime: "Y-m-d H:i:sO",
-	            YearMonth: "F, Y"
-	        },
-	        reformatAfterEdit : false
-		},
-		baseLinkUrl: '',
-		showAction: '',
-	    target: '',
-	    checkbox : {disabled:true},
-		idName : 'id'
-	}
-};
-})(jQuery);
+;(function($){
+/**
+ * jqGrid Brazilian-Portuguese Translation
+ * Sergio Righi sergio.righi@gmail.com
+ * http://curve.com.br
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl.html
+**/
+$.jgrid = {
+	defaults : {
+		recordtext: "Ver {0} - {1} of {2}",
+	    emptyrecords: "Nenhum registro para visualizar",
+		loadtext: "Carregando...",
+		pgtext : "Página {0} de {1}"
+	},
+	search : {
+	    caption: "Procurar...",
+	    Find: "Procurar",
+	    Reset: "Resetar",
+	    odata : ['equal', 'not equal', 'less', 'less or equal','greater','greater or equal', 'begins with','does not begin with','is in','is not in','ends with','does not end with','contains','does not contain'],
+	    groupOps: [	{ op: "AND", text: "all" },	{ op: "OR",  text: "any" }	],
+		matchText: " iguala",
+		rulesText: " regras"
+	},
+	edit : {
+	    addCaption: "Incluir",
+	    editCaption: "Alterar",
+	    bSubmit: "Enviar",
+	    bCancel: "Cancelar",
+		bClose: "Fechar",
+		saveData: "Os dados foram alterados! Salvar alterações?",
+		bYes : "Sim",
+		bNo : "Não",
+		bExit : "Cancelar",
+	    msg: {
+	        required:"Campo obrigatório",
+	        number:"Por favor, informe um número válido",
+	        minValue:"valor deve ser igual ou maior que ",
+	        maxValue:"valor deve ser menor ou igual a",
+	        email: "este e-mail não é válido",
+	        integer: "Por favor, informe um valor inteiro",
+			date: "Por favor, informe uma data válida",
+			url: "não é uma URL válida. Prefixo obrigatório ('http://' or 'https://')",
+			nodefined : " não está definido!",
+			novalue : " um valor de retorno é obrigatório!",
+			customarray : "Função customizada deve retornar um array!",
+			customfcheck : "Função customizada deve estar presente em caso de validação customizada!"
+		}
+	},
+	view : {
+	    caption: "Ver Registro",
+	    bClose: "Fechar"
+	},
+	del : {
+    caption: "Apagar",
+	    msg: "Apagar registros selecionado(s)?",
+	    bSubmit: "Apagar",
+	    bCancel: "Cancelar"
+	},
+	nav : {
+		edittext: " ",
+	    edittitle: "Alterar registro selecionado",
+		addtext:" ",
+	    addtitle: "Incluir novo registro",
+	    deltext: " ",
+	    deltitle: "Apagar registro selecionado",
+	    searchtext: " ",
+	    searchtitle: "Procurar registros",
+	    refreshtext: "",
+	    refreshtitle: "Recarrgando Tabela",
+	    alertcap: "Aviso",
+	    alerttext: "Por favor, selecione um registro",
+		viewtext: "",
+		viewtitle: "Ver linha selecionada"
+	},
+	col : {
+	    caption: "Mostrar/Esconder Colunas",
+	    bSubmit: "Enviar",
+	    bCancel: "Cancelar"
+	},
+	errors : {
+		errcap : "Erro",
+		nourl : "Nenhuma URL defenida",
+		norecords: "Sem registros para exibir",
+	    model : "Comprimento de colNames <> colModel!"
+	},
+	formatter : {
+		integer : {thousandsSeparator: " ", defaultValue: '0'},
+		number : {decimalSeparator:",", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0,00'},
+		currency : {decimalSeparator:",", thousandsSeparator: ".", decimalPlaces: 2, prefix: "R$ ", suffix:"", defaultValue: '0,00'},
+		date : {
+			dayNames:   [
+				"Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sáb",
+				"Domingo", "Segunda", "Terça", "Quarta", "Quinta", "Sexta", "Sábado"
+			],
+			monthNames: [
+				"Jan", "Fev", "Mar", "Abr", "Mai", "Jun", "Jul", "Ago", "Set", "Out", "Nov", "Dez",
+				"Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"
+			],
+			AmPm : ["am","pm","AM","PM"],
+			S: function (j) {return j < 11 || j > 13 ? ['º', 'º', 'º', 'º'][Math.min((j - 1) % 10, 3)] : 'º'},
+			srcformat: 'Y-m-d',
+			newformat: 'd/m/Y',
+			masks : {
+	            ISO8601Long:"Y-m-d H:i:s",
+	            ISO8601Short:"Y-m-d",
+	            ShortDate: "n/j/Y",
+	            LongDate: "l, F d, Y",
+	            FullDateTime: "l, F d, Y g:i:s A",
+	            MonthDay: "F d",
+	            ShortTime: "g:i A",
+	            LongTime: "g:i:s A",
+	            SortableDateTime: "Y-m-d\\TH:i:s",
+	            UniversalSortableDateTime: "Y-m-d H:i:sO",
+	            YearMonth: "F, Y"
+	        },
+	        reformatAfterEdit : false
+		},
+		baseLinkUrl: '',
+		showAction: '',
+	    target: '',
+	    checkbox : {disabled:true},
+		idName : 'id'
+	}
+};
+})(jQuery);
Index: controlies/trunk/applications/controlies/static/js/jdgrid/src/i18n/grid.locale-tr.js
===================================================================
--- controlies/trunk/applications/controlies/static/js/jdgrid/src/i18n/grid.locale-tr.js	(revision 240)
+++ controlies/trunk/applications/controlies/static/js/jdgrid/src/i18n/grid.locale-tr.js	(revision 241)
@@ -1,126 +1,126 @@
-;(function($){
-/**
- * jqGrid Turkish Translation
- * Erhan Gündoğan (erhan@trposta.net)
- * http://blog.zakkum.com
- * Dual licensed under the MIT and GPL licenses:
- * http://www.opensource.org/licenses/mit-license.php
- * http://www.gnu.org/licenses/gpl.html
-**/
-$.jgrid = {
-	defaults : {
-		recordtext: "{0}-{1} listeleniyor. Toplam:{2}",
-	    emptyrecords: "Kayıt bulunamadı",
-		loadtext: "Yükleniyor...",
-		pgtext : "{0}/{1}. Sayfa"
-	},
-	search : {
-	    caption: "Arama...",
-	    Find: "Bul",
-	    Reset: "Temizle",	    
-	    odata : ['eşit', 'eşit değil', 'daha az', 'daha az veya eşit', 'daha fazla', 'daha fazla veya eşit', 'ile başlayan', 'ile başlamayan', 'içinde', 'içinde değil', 'ile biten', 'ile bitmeyen', 'içeren', 'içermeyen'],
-	    groupOps: [	{ op: "VE", text: "tüm" },	{ op: "VEYA",  text: "herhangi" }	],
-		matchText: " uyan",
-		rulesText: " kurallar"
-	},
-	edit : {
-	    addCaption: "Kayıt Ekle",
-	    editCaption: "Kayıt Düzenle",
-	    bSubmit: "Gönder",
-	    bCancel: "İptal",
-		bClose: "Kapat",
-		saveData: "Veriler değişti! Kayıt edilsin mi?",
-		bYes : "Evet",
-		bNo : "Hayıt",
-		bExit : "İptal",
-	    msg: {
-	        required:"Alan gerekli",
-	        number:"Lütfen bir numara giriniz",
-	        minValue:"girilen değer daha büyük ya da buna eşit olmalıdır",
-	        maxValue:"girilen değer daha küçük ya da buna eşit olmalıdır",
-	        email: "geçerli bir e-posta adresi değildir",
-	        integer: "Lütfen bir tamsayı giriniz",
-			url: "Geçerli bir URL değil. ('http://' or 'https://') ön eki gerekli.",
-			nodefined : " is not defined!",
-			novalue : " return value is required!",
-			customarray : "Custom function should return array!",
-			customfcheck : "Custom function should be present in case of custom checking!"
-		}
-	},
-	view : {
-	    caption: "Kayıt Görüntüle",
-	    bClose: "Kapat"
-	},
-	del : {
-	    caption: "Sil",
-	    msg: "Seçilen kayıtlar silinsin mi?",
-	    bSubmit: "Sil",
-	    bCancel: "İptal"
-	},
-	nav : {
-		edittext: " ",
-	    edittitle: "Seçili satırı düzenle",
-		addtext:" ",
-	    addtitle: "Yeni satır ekle",
-	    deltext: " ",
-	    deltitle: "Seçili satırı sil",
-	    searchtext: " ",
-	    searchtitle: "Kayıtları bul",
-	    refreshtext: "",
-	    refreshtitle: "Tabloyu yenile",
-	    alertcap: "Uyarı",
-	    alerttext: "Lütfen bir satır seçiniz",
-		viewtext: "",
-		viewtitle: "Seçilen satırı görüntüle"
-	},
-	col : {
-	    caption: "Sütunları göster/gizle",
-	    bSubmit: "Gönder",
-	    bCancel: "İptal"	
-	},
-	errors : {
-		errcap : "Hata",
-		nourl : "Bir url yapılandırılmamış",
-		norecords: "İşlem yapılacak bir kayıt yok",
-	    model : "colNames uzunluğu <> colModel!"
-	},
-	formatter : {
-		integer : {thousandsSeparator: " ", defaultValue: '0'},
-		number : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0.00'},
-		currency : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0.00'},
-		date : {
-			dayNames:   [
-				"Paz", "Pts", "Sal", "Çar", "Per", "Cum", "Cts",
-				"Pazar", "Pazartesi", "Salı", "Çarşamba", "Perşembe", "Cuma", "Cumartesi"
-			],
-			monthNames: [
-				"Oca", "Şub", "Mar", "Nis", "May", "Haz", "Tem", "Ağu", "Eyl", "Eki", "Kas", "Ara",
-				"Ocak", "Şubat", "Mart", "Nisan", "Mayıs", "Haziran", "Temmuz", "Ağustos", "Eylül", "Ekim", "Kasım", "Aralık"
-			],
-			AmPm : ["am","pm","AM","PM"],
-			S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'},
-			srcformat: 'Y-m-d',
-			newformat: 'd/m/Y',
-			masks : {
-	            ISO8601Long:"Y-m-d H:i:s",
-	            ISO8601Short:"Y-m-d",
-	            ShortDate: "n/j/Y",
-	            LongDate: "l, F d, Y",
-	            FullDateTime: "l, F d, Y g:i:s A",
-	            MonthDay: "F d",
-	            ShortTime: "g:i A",
-	            LongTime: "g:i:s A",
-	            SortableDateTime: "Y-m-d\\TH:i:s",
-	            UniversalSortableDateTime: "Y-m-d H:i:sO",
-	            YearMonth: "F, Y"
-	        },
-	        reformatAfterEdit : false
-		},
-		baseLinkUrl: '',
-		showAction: '',
-	    target: '',
-	    checkbox : {disabled:true},
-		idName : 'id'
-	}
-};
-})(jQuery);
+;(function($){
+/**
+ * jqGrid Turkish Translation
+ * Erhan Gündoğan (erhan@trposta.net)
+ * http://blog.zakkum.com
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl.html
+**/
+$.jgrid = {
+	defaults : {
+		recordtext: "{0}-{1} listeleniyor. Toplam:{2}",
+	    emptyrecords: "Kayıt bulunamadı",
+		loadtext: "Yükleniyor...",
+		pgtext : "{0}/{1}. Sayfa"
+	},
+	search : {
+	    caption: "Arama...",
+	    Find: "Bul",
+	    Reset: "Temizle",	    
+	    odata : ['eşit', 'eşit değil', 'daha az', 'daha az veya eşit', 'daha fazla', 'daha fazla veya eşit', 'ile başlayan', 'ile başlamayan', 'içinde', 'içinde değil', 'ile biten', 'ile bitmeyen', 'içeren', 'içermeyen'],
+	    groupOps: [	{ op: "VE", text: "tüm" },	{ op: "VEYA",  text: "herhangi" }	],
+		matchText: " uyan",
+		rulesText: " kurallar"
+	},
+	edit : {
+	    addCaption: "Kayıt Ekle",
+	    editCaption: "Kayıt Düzenle",
+	    bSubmit: "Gönder",
+	    bCancel: "İptal",
+		bClose: "Kapat",
+		saveData: "Veriler değişti! Kayıt edilsin mi?",
+		bYes : "Evet",
+		bNo : "Hayıt",
+		bExit : "İptal",
+	    msg: {
+	        required:"Alan gerekli",
+	        number:"Lütfen bir numara giriniz",
+	        minValue:"girilen değer daha büyük ya da buna eşit olmalıdır",
+	        maxValue:"girilen değer daha küçük ya da buna eşit olmalıdır",
+	        email: "geçerli bir e-posta adresi değildir",
+	        integer: "Lütfen bir tamsayı giriniz",
+			url: "Geçerli bir URL değil. ('http://' or 'https://') ön eki gerekli.",
+			nodefined : " is not defined!",
+			novalue : " return value is required!",
+			customarray : "Custom function should return array!",
+			customfcheck : "Custom function should be present in case of custom checking!"
+		}
+	},
+	view : {
+	    caption: "Kayıt Görüntüle",
+	    bClose: "Kapat"
+	},
+	del : {
+	    caption: "Sil",
+	    msg: "Seçilen kayıtlar silinsin mi?",
+	    bSubmit: "Sil",
+	    bCancel: "İptal"
+	},
+	nav : {
+		edittext: " ",
+	    edittitle: "Seçili satırı düzenle",
+		addtext:" ",
+	    addtitle: "Yeni satır ekle",
+	    deltext: " ",
+	    deltitle: "Seçili satırı sil",
+	    searchtext: " ",
+	    searchtitle: "Kayıtları bul",
+	    refreshtext: "",
+	    refreshtitle: "Tabloyu yenile",
+	    alertcap: "Uyarı",
+	    alerttext: "Lütfen bir satır seçiniz",
+		viewtext: "",
+		viewtitle: "Seçilen satırı görüntüle"
+	},
+	col : {
+	    caption: "Sütunları göster/gizle",
+	    bSubmit: "Gönder",
+	    bCancel: "İptal"	
+	},
+	errors : {
+		errcap : "Hata",
+		nourl : "Bir url yapılandırılmamış",
+		norecords: "İşlem yapılacak bir kayıt yok",
+	    model : "colNames uzunluğu <> colModel!"
+	},
+	formatter : {
+		integer : {thousandsSeparator: " ", defaultValue: '0'},
+		number : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0.00'},
+		currency : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0.00'},
+		date : {
+			dayNames:   [
+				"Paz", "Pts", "Sal", "Çar", "Per", "Cum", "Cts",
+				"Pazar", "Pazartesi", "Salı", "Çarşamba", "Perşembe", "Cuma", "Cumartesi"
+			],
+			monthNames: [
+				"Oca", "Şub", "Mar", "Nis", "May", "Haz", "Tem", "Ağu", "Eyl", "Eki", "Kas", "Ara",
+				"Ocak", "Şubat", "Mart", "Nisan", "Mayıs", "Haziran", "Temmuz", "Ağustos", "Eylül", "Ekim", "Kasım", "Aralık"
+			],
+			AmPm : ["am","pm","AM","PM"],
+			S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'},
+			srcformat: 'Y-m-d',
+			newformat: 'd/m/Y',
+			masks : {
+	            ISO8601Long:"Y-m-d H:i:s",
+	            ISO8601Short:"Y-m-d",
+	            ShortDate: "n/j/Y",
+	            LongDate: "l, F d, Y",
+	            FullDateTime: "l, F d, Y g:i:s A",
+	            MonthDay: "F d",
+	            ShortTime: "g:i A",
+	            LongTime: "g:i:s A",
+	            SortableDateTime: "Y-m-d\\TH:i:s",
+	            UniversalSortableDateTime: "Y-m-d H:i:sO",
+	            YearMonth: "F, Y"
+	        },
+	        reformatAfterEdit : false
+		},
+		baseLinkUrl: '',
+		showAction: '',
+	    target: '',
+	    checkbox : {disabled:true},
+		idName : 'id'
+	}
+};
+})(jQuery);
Index: controlies/trunk/applications/controlies/static/js/jdgrid/src/i18n/grid.locale-fa.js
===================================================================
--- controlies/trunk/applications/controlies/static/js/jdgrid/src/i18n/grid.locale-fa.js	(revision 240)
+++ controlies/trunk/applications/controlies/static/js/jdgrid/src/i18n/grid.locale-fa.js	(revision 241)
@@ -1,125 +1,145 @@
-﻿;(function($){
-/**
- * jqGrid Persian Translation
- * Dual licensed under the MIT and GPL licenses:
- * http://www.opensource.org/licenses/mit-license.php
- * http://www.gnu.org/licenses/gpl.html
-**/
-$.jgrid = {
-	defaults : {
-		recordtext: "View {0} - {1} of {2}",
-	    emptyrecords: "No records to view",
-		loadtext: "بارگزاري...",
-		pgtext : "Page {0} of {1}"
-	},
-	search : {
-	    caption: "جستجو...",
-	    Find: "يافته ها",
-	    Reset: "نتايج",
-	    odata : ['equal', 'not equal', 'less', 'less or equal','greater','greater or equal', 'begins with','does not begin with','is in','is not in','ends with','does not end with','contains','does not contain'],
-	    groupOps: [	{ op: "AND", text: "all" },	{ op: "OR",  text: "any" }	],
-		matchText: " match",
-		rulesText: " rules"
-	},
-	edit : {
-	    addCaption: "اضافه کردن رکورد",
-	    editCaption: "ويرايش رکورد",
-	    bSubmit: "ثبت",
-	    bCancel: "انصراف",
-		bClose: "بستن",
-		saveData: "Data has been changed! Save changes?",
-		bYes : "Yes",
-		bNo : "No",
-		bExit : "Cancel",
-	    msg: {
-	        required:"فيلدها بايد ختما پر شوند",
-	        number:"لطفا عدد وعتبر وارد کنيد",
-	        minValue:"مقدار وارد شده بايد بزرگتر يا مساوي با",
-	        maxValue:"مقدار وارد شده بايد کوچکتر يا مساوي",
-	        email: "پست الکترونيک وارد شده معتبر نيست",
-	        integer: "لطفا يک عدد صحيح وارد کنيد",
-			date: "لطفا يک تاريخ معتبر وارد کنيد",
-			url: "is not a valid URL. Prefix required ('http://' or 'https://')",
-			nodefined : " is not defined!",
-			novalue : " return value is required!",
-			customarray : "Custom function should return array!",
-			customfcheck : "Custom function should be present in case of custom checking!"
-		}
-	},
-	view : {
-	    caption: "View Record",
-	    bClose: "Close"
-	},
-	del : {
-	    caption: "حذف",
-	    msg: "از حذف گزينه هاي انتخاب شده مطمئن هستيد؟",
-	    bSubmit: "حذف",
-	    bCancel: "ابطال"
-	},
-	nav : {
-		edittext: " ",
-	    edittitle: "ويرايش رديف هاي انتخاب شده",
-		addtext:" ",
-	    addtitle: "افزودن رديف جديد",
-	    deltext: " ",
-	    deltitle: "حذف ردبف هاي انتخاب شده",
-	    searchtext: " ",
-	    searchtitle: "جستجوي رديف",
-	    refreshtext: "",
-	    refreshtitle: "بازيابي مجدد صفحه",
-	    alertcap: "اخطار",
-	    alerttext: "لطفا يک رديف انتخاب کنيد",
-		viewtext: "",
-		viewtitle: "View selected row"
-	},
-	col : {
-	    caption: "نمايش/عدم نمايش ستون",
-	    bSubmit: "ثبت",
-	    bCancel: "انصراف"	
-	},
-	errors : {
-		errcap : "خطا",
-		nourl : "هيچ آدرسي تنظيم نشده است",
-		norecords: "هيچ رکوردي براي پردازش موجود نيست",
-	    model : "طول نام ستون ها محالف ستون هاي مدل مي باشد!"
-	},
-	formatter : {
-		integer : {thousandsSeparator: " ", defaultValue: '0'},
-		number : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0.00'},
-		currency : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0.00'},
-		date : {
-			dayNames:   [
-				"يک", "دو", "سه", "چهار", "پنج", "جمع", "شنب",
-				"يکشنبه", "دوشنبه", "سه شنبه", "چهارشنبه", "پنجشنبه", "جمعه", "شنبه"
-			],
-			monthNames: [
-				"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
-				"ژانويه", "فوريه", "مارس", "آوريل", "مه", "ژوئن", "ژوئيه", "اوت", "سپتامبر", "اکتبر", "نوامبر", "December"
-			],
-			AmPm : ["ب.ظ","ب.ظ","ق.ظ","ق.ظ"],
-			S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'},
-			srcformat: 'Y-m-d',
-			newformat: 'd/m/Y',
-			masks : {
-	            ISO8601Long:"Y-m-d H:i:s",
-	            ISO8601Short:"Y-m-d",
-	            ShortDate: "n/j/Y",
-	            LongDate: "l, F d, Y",
-	            FullDateTime: "l, F d, Y g:i:s A",
-	            MonthDay: "F d",
-	            ShortTime: "g:i A",
-	            LongTime: "g:i:s A",
-	            SortableDateTime: "Y-m-d\\TH:i:s",
-	            UniversalSortableDateTime: "Y-m-d H:i:sO",
-	            YearMonth: "F, Y"
-	        },
-	        reformatAfterEdit : false
-		},
-		baseLinkUrl: '',
-		showAction: 'نمايش',
-	    target: '',
-	    checkbox : {disabled:true},
-		idName : 'id'
-	}
-};
-})(jQuery);
+;(function ($) {
+/**
+ * jqGrid Persian Translation
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl.html
+**/
+	$.jgrid = {
+        defaults: {
+            recordtext: "نمابش {0} - {1} از {2}",
+            emptyrecords: "رکوردی یافت نشد",
+            loadtext: "بارگزاري...",
+            pgtext: "صفحه {0} از {1}"
+        },
+        search: {
+            caption: "جستجو...",
+            Find: "يافته ها",
+            Reset: "از نو",
+            odata: ['برابر', 'نا برابر', 'به', 'کوچکتر', 'از', 'بزرگتر', 'شروع با', 'شروع نشود با', 'نباشد', 'عضو این نباشد', 'اتمام با', 'تمام نشود با', 'حاوی', 'نباشد حاوی'],
+            groupOps: [{
+                op: "AND",
+                text: "کل"
+            },
+            {
+                op: "OR",
+                text: "مجموع"
+            }],
+            matchText: " حاوی",
+            rulesText: " اطلاعات"
+        },
+        edit: {
+            addCaption: "اضافه کردن رکورد",
+            editCaption: "ويرايش رکورد",
+            bSubmit: "ثبت",
+            bCancel: "انصراف",
+            bClose: "بستن",
+            saveData: "دیتا تعییر کرد! ذخیره شود؟",
+            bYes: "بله",
+            bNo: "خیر",
+            bExit: "انصراف",
+            msg: {
+                required: "فيلدها بايد ختما پر شوند",
+                number: "لطفا عدد وعتبر وارد کنيد",
+                minValue: "مقدار وارد شده بايد بزرگتر يا مساوي با",
+                maxValue: "مقدار وارد شده بايد کوچکتر يا مساوي",
+                email: "پست الکترونيک وارد شده معتبر نيست",
+                integer: "لطفا يک عدد صحيح وارد کنيد",
+                date: "لطفا يک تاريخ معتبر وارد کنيد",
+                url: "این آدرس صحیح نمی باشد. پیشوند نیاز است ('http://' یا 'https://')",
+                nodefined: " تعریف نشده!",
+                novalue: " مقدار برگشتی اجباری است!",
+                customarray: "تابع شما باید مقدار آرایه داشته باشد!",
+                customfcheck: "برای داشتن متد دلخواه شما باید سطون با چکینگ دلخواه داشته باشید!"
+            }
+        },
+        view: {
+            caption: "نمایش رکورد",
+            bClose: "بستن"
+        },
+        del: {
+            caption: "حذف",
+            msg: "از حذف گزينه هاي انتخاب شده مطمئن هستيد؟",
+            bSubmit: "حذف",
+            bCancel: "ابطال"
+        },
+        nav: {
+            edittext: " ",
+            edittitle: "ويرايش رديف هاي انتخاب شده",
+            addtext: " ",
+            addtitle: "افزودن رديف جديد",
+            deltext: " ",
+            deltitle: "حذف ردبف هاي انتخاب شده",
+            searchtext: " ",
+            searchtitle: "جستجوي رديف",
+            refreshtext: "",
+            refreshtitle: "بازيابي مجدد صفحه",
+            alertcap: "اخطار",
+            alerttext: "لطفا يک رديف انتخاب کنيد",
+            viewtext: "",
+            viewtitle: "نمایش رکورد های انتخاب شده"
+        },
+        col: {
+            caption: "نمايش/عدم نمايش ستون",
+            bSubmit: "ثبت",
+            bCancel: "انصراف"
+        },
+        errors: {
+            errcap: "خطا",
+            nourl: "هيچ آدرسي تنظيم نشده است",
+            norecords: "هيچ رکوردي براي پردازش موجود نيست",
+            model: "طول نام ستون ها محالف ستون هاي مدل مي باشد!"
+        },
+        formatter: {
+            integer: {
+                thousandsSeparator: " ",
+                defaultValue: "0"
+            },
+            number: {
+                decimalSeparator: ".",
+                thousandsSeparator: " ",
+                decimalPlaces: 2,
+                defaultValue: "0.00"
+            },
+            currency: {
+                decimalSeparator: ".",
+                thousandsSeparator: " ",
+                decimalPlaces: 2,
+                prefix: "",
+                suffix: "",
+                defaultValue: "0"
+            },
+            date: {
+                dayNames: ["يک", "دو", "سه", "چهار", "پنج", "جمع", "شنب", "يکشنبه", "دوشنبه", "سه شنبه", "چهارشنبه", "پنجشنبه", "جمعه", "شنبه"],
+                monthNames: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", "ژانويه", "فوريه", "مارس", "آوريل", "مه", "ژوئن", "ژوئيه", "اوت", "سپتامبر", "اکتبر", "نوامبر", "December"],
+                AmPm: ["ب.ظ", "ب.ظ", "ق.ظ", "ق.ظ"],
+                S: function (b) {
+                    return b < 11 || b > 13 ? ["st", "nd", "rd", "th"][Math.min((b - 1) % 10, 3)] : "th"
+                },
+                srcformat: "Y-m-d",
+                newformat: "d/m/Y",
+                masks: {
+                    ISO8601Long: "Y-m-d H:i:s",
+                    ISO8601Short: "Y-m-d",
+                    ShortDate: "n/j/Y",
+                    LongDate: "l, F d, Y",
+                    FullDateTime: "l, F d, Y g:i:s A",
+                    MonthDay: "F d",
+                    ShortTime: "g:i A",
+                    LongTime: "g:i:s A",
+                    SortableDateTime: "Y-m-d\\TH:i:s",
+                    UniversalSortableDateTime: "Y-m-d H:i:sO",
+                    YearMonth: "F, Y"
+                },
+                reformatAfterEdit: false
+            },
+            baseLinkUrl: "",
+            showAction: "نمايش",
+            target: "",
+            checkbox: {
+                disabled: true
+            },
+            idName: "id"
+        }
+    }
+})(jQuery);
\ No newline at end of file
Index: controlies/trunk/applications/controlies/static/js/jdgrid/src/i18n/grid.locale-ru.js
===================================================================
--- controlies/trunk/applications/controlies/static/js/jdgrid/src/i18n/grid.locale-ru.js	(revision 240)
+++ controlies/trunk/applications/controlies/static/js/jdgrid/src/i18n/grid.locale-ru.js	(revision 241)
@@ -1,127 +1,127 @@
-;(function($){
-/**
- * jqGrid Russian Translation v1.0 02.07.2009 (based on translation by Alexey Kanaev v1.1 21.01.2009, http://softcore.com.ru)
- * Sergey Dyagovchenko
- * http://d.sumy.ua
- * Dual licensed under the MIT and GPL licenses:
- * http://www.opensource.org/licenses/mit-license.php
- * http://www.gnu.org/licenses/gpl.html
-**/
-$.jgrid = {
-	defaults : {
-		recordtext: "Просмотр {0} - {1} из {2}",
-	  emptyrecords: "Нет записей для просмотра",
-		loadtext: "Загрузка...",
-		pgtext : "Стр. {0} из {1}"
-	},
-	search : {
-    caption: "Поиск...",
-    Find: "Найти",
-    Reset: "Сброс",
-    odata : ['равно', 'не равно', 'меньше', 'меньше или равно','больше','больше или равно', 'начинается с','не начинается с','находится в','не находится в','заканчивается на','не заканчивается на','содержит','не содержит'],
-    groupOps: [	{ op: "AND", text: "все" },	{ op: "OR",  text: "любой" }	],
-    matchText: " совпадает",
-    rulesText: " правила"
-	},
-	edit : {
-    addCaption: "Добавить запись",
-    editCaption: "Редактировать запись",
-    bSubmit: "Сохранить",
-    bCancel: "Отмена",
-		bClose: "Закрыть",
-		saveData: "Данные были измененны! Сохранить изменения?",
-		bYes : "Да",
-		bNo : "Нет",
-		bExit : "Отмена",
-	    msg: {
-        required:"Поле является обязательным",
-        number:"Пожалуйста, введите правильное число",
-        minValue:"значение должно быть больше либо равно",
-        maxValue:"значение должно быть меньше либо равно",
-        email: "некорректное значение e-mail",
-        integer: "Пожалуйста, введите целое число",
-        date: "Пожалуйста, введите правильную дату",
-        url: "неверная ссылка. Необходимо ввести префикс ('http://' or 'https://')",
-		nodefined : " is not defined!",
-		novalue : " return value is required!",
-		customarray : "Custom function should return array!",
-		customfcheck : "Custom function should be present in case of custom checking!"
-		}
-	},
-	view : {
-	    caption: "Просмотр записи",
-	    bClose: "Закрыть"
-	},
-	del : {
-	    caption: "Удалить",
-	    msg: "Удалить выбранную запись(и)?",
-	    bSubmit: "Удалить",
-	    bCancel: "Отмена"
-	},
-	nav : {
-  		edittext: " ",
-	    edittitle: "Редактировать выбранную запись",
-  		addtext:" ",
-	    addtitle: "Добавить новую запись",
-	    deltext: " ",
-	    deltitle: "Удалить выбранную запись",
-	    searchtext: " ",
-	    searchtitle: "Найти записи",
-	    refreshtext: "",
-	    refreshtitle: "Обновить таблицу",
-	    alertcap: "Внимание",
-	    alerttext: "Пожалуйста, выберите запись",
-  		viewtext: "",
-  		viewtitle: "Просмотреть выбранную запись"
-	},
-	col : {
-	    caption: "Показать/скрыть столбцы",
-	    bSubmit: "Сохранить",
-	    bCancel: "Отмена"	
-	},
-	errors : {
-		errcap : "Ошибка",
-		nourl : "URL не установлен",
-		norecords: "Нет записей для обработки",
-    model : "Число полей не соответствует числу столбцов таблицы!"
-	},
-	formatter : {
-		integer : {thousandsSeparator: " ", defaultValue: '0'},
-		number : {decimalSeparator:",", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0,00'},
-		currency : {decimalSeparator:",", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0,00'},
-		date : {
-			dayNames:   [
-				"Вс", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб",
-				"Воскресение", "Понедельник", "Вторник", "Среда", "Четверг", "Пятница", "Суббота"
-			],
-			monthNames: [
-				"Янв", "Фев", "Мар", "Апр", "Май", "Июн", "Июл", "Авг", "Сен", "Окт", "Ноя", "Дек",
-				"Январь", "Февраль", "Март", "Апрель", "Май", "Июнь", "Июль", "Август", "Сентябрь", "Октябрь", "Ноябрь", "Декабрь"
-			],
-			AmPm : ["am","pm","AM","PM"],
-			S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'},
-			srcformat: 'Y-m-d',
-			newformat: 'd.m.Y',
-			masks : {
-	            ISO8601Long:"Y-m-d H:i:s",
-	            ISO8601Short:"Y-m-d",
-	            ShortDate: "n.j.Y",
-	            LongDate: "l, F d, Y",
-	            FullDateTime: "l, F d, Y G:i:s",
-	            MonthDay: "F d",
-	            ShortTime: "G:i",
-	            LongTime: "G:i:s",
-	            SortableDateTime: "Y-m-d\\TH:i:s",
-	            UniversalSortableDateTime: "Y-m-d H:i:sO",
-	            YearMonth: "F, Y"
-	        },
-	        reformatAfterEdit : false
-		},
-		baseLinkUrl: '',
-		showAction: '',
-	  target: '',
-	  checkbox : {disabled:true},
-		idName : 'id'
-	}
-};
-})(jQuery);
+;(function($){
+/**
+ * jqGrid Russian Translation v1.0 02.07.2009 (based on translation by Alexey Kanaev v1.1 21.01.2009, http://softcore.com.ru)
+ * Sergey Dyagovchenko
+ * http://d.sumy.ua
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl.html
+**/
+$.jgrid = {
+	defaults : {
+		recordtext: "Просмотр {0} - {1} из {2}",
+	  emptyrecords: "Нет записей для просмотра",
+		loadtext: "Загрузка...",
+		pgtext : "Стр. {0} из {1}"
+	},
+	search : {
+    caption: "Поиск...",
+    Find: "Найти",
+    Reset: "Сброс",
+    odata : ['равно', 'не равно', 'меньше', 'меньше или равно','больше','больше или равно', 'начинается с','не начинается с','находится в','не находится в','заканчивается на','не заканчивается на','содержит','не содержит'],
+    groupOps: [	{ op: "AND", text: "все" },	{ op: "OR",  text: "любой" }	],
+    matchText: " совпадает",
+    rulesText: " правила"
+	},
+	edit : {
+    addCaption: "Добавить запись",
+    editCaption: "Редактировать запись",
+    bSubmit: "Сохранить",
+    bCancel: "Отмена",
+		bClose: "Закрыть",
+		saveData: "Данные были измененны! Сохранить изменения?",
+		bYes : "Да",
+		bNo : "Нет",
+		bExit : "Отмена",
+	    msg: {
+        required:"Поле является обязательным",
+        number:"Пожалуйста, введите правильное число",
+        minValue:"значение должно быть больше либо равно",
+        maxValue:"значение должно быть меньше либо равно",
+        email: "некорректное значение e-mail",
+        integer: "Пожалуйста, введите целое число",
+        date: "Пожалуйста, введите правильную дату",
+        url: "неверная ссылка. Необходимо ввести префикс ('http://' or 'https://')",
+		nodefined : " is not defined!",
+		novalue : " return value is required!",
+		customarray : "Custom function should return array!",
+		customfcheck : "Custom function should be present in case of custom checking!"
+		}
+	},
+	view : {
+	    caption: "Просмотр записи",
+	    bClose: "Закрыть"
+	},
+	del : {
+	    caption: "Удалить",
+	    msg: "Удалить выбранную запись(и)?",
+	    bSubmit: "Удалить",
+	    bCancel: "Отмена"
+	},
+	nav : {
+  		edittext: " ",
+	    edittitle: "Редактировать выбранную запись",
+  		addtext:" ",
+	    addtitle: "Добавить новую запись",
+	    deltext: " ",
+	    deltitle: "Удалить выбранную запись",
+	    searchtext: " ",
+	    searchtitle: "Найти записи",
+	    refreshtext: "",
+	    refreshtitle: "Обновить таблицу",
+	    alertcap: "Внимание",
+	    alerttext: "Пожалуйста, выберите запись",
+  		viewtext: "",
+  		viewtitle: "Просмотреть выбранную запись"
+	},
+	col : {
+	    caption: "Показать/скрыть столбцы",
+	    bSubmit: "Сохранить",
+	    bCancel: "Отмена"	
+	},
+	errors : {
+		errcap : "Ошибка",
+		nourl : "URL не установлен",
+		norecords: "Нет записей для обработки",
+    model : "Число полей не соответствует числу столбцов таблицы!"
+	},
+	formatter : {
+		integer : {thousandsSeparator: " ", defaultValue: '0'},
+		number : {decimalSeparator:",", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0,00'},
+		currency : {decimalSeparator:",", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0,00'},
+		date : {
+			dayNames:   [
+				"Вс", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб",
+				"Воскресение", "Понедельник", "Вторник", "Среда", "Четверг", "Пятница", "Суббота"
+			],
+			monthNames: [
+				"Янв", "Фев", "Мар", "Апр", "Май", "Июн", "Июл", "Авг", "Сен", "Окт", "Ноя", "Дек",
+				"Январь", "Февраль", "Март", "Апрель", "Май", "Июнь", "Июль", "Август", "Сентябрь", "Октябрь", "Ноябрь", "Декабрь"
+			],
+			AmPm : ["am","pm","AM","PM"],
+			S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'},
+			srcformat: 'Y-m-d',
+			newformat: 'd.m.Y',
+			masks : {
+	            ISO8601Long:"Y-m-d H:i:s",
+	            ISO8601Short:"Y-m-d",
+	            ShortDate: "n.j.Y",
+	            LongDate: "l, F d, Y",
+	            FullDateTime: "l, F d, Y G:i:s",
+	            MonthDay: "F d",
+	            ShortTime: "G:i",
+	            LongTime: "G:i:s",
+	            SortableDateTime: "Y-m-d\\TH:i:s",
+	            UniversalSortableDateTime: "Y-m-d H:i:sO",
+	            YearMonth: "F, Y"
+	        },
+	        reformatAfterEdit : false
+		},
+		baseLinkUrl: '',
+		showAction: '',
+	  target: '',
+	  checkbox : {disabled:true},
+		idName : 'id'
+	}
+};
+})(jQuery);
Index: controlies/trunk/applications/controlies/static/js/jdgrid/src/ui.multiselect.js
===================================================================
--- controlies/trunk/applications/controlies/static/js/jdgrid/src/ui.multiselect.js	(revision 240)
+++ controlies/trunk/applications/controlies/static/js/jdgrid/src/ui.multiselect.js	(revision 241)
@@ -1,314 +1,314 @@
-/*
- * jQuery UI Multiselect
- *
- * Authors:
- *  Michael Aufreiter (quasipartikel.at)
- *  Yanick Rochon (yanick.rochon[at]gmail[dot]com)
- * 
- * Dual licensed under the MIT (MIT-LICENSE.txt)
- * and GPL (GPL-LICENSE.txt) licenses.
- * 
- * http://www.quasipartikel.at/multiselect/
- *
- * 
- * Depends:
- *	ui.core.js
- *	ui.sortable.js
- *
- * Optional:
- * localization (http://plugins.jquery.com/project/localisation)
- * scrollTo (http://plugins.jquery.com/project/ScrollTo)
- * 
- * Todo:
- *  Make batch actions faster
- *  Implement dynamic insertion through remote calls
- */
-
-
-(function($) {
-
-$.widget("ui.multiselect", {
-	_init: function() {
-		this.element.hide();
-		this.id = this.element.attr("id");
-		this.container = $('<div class="ui-multiselect ui-helper-clearfix ui-widget"></div>').insertAfter(this.element);
-		this.count = 0; // number of currently selected options
-		this.selectedContainer = $('<div class="selected"></div>').appendTo(this.container);
-		this.availableContainer = $('<div class="available"></div>').appendTo(this.container);
-		this.selectedActions = $('<div class="actions ui-widget-header ui-helper-clearfix"><span class="count">0 '+$.ui.multiselect.locale.itemsCount+'</span><a href="#" class="remove-all">'+$.ui.multiselect.locale.removeAll+'</a></div>').appendTo(this.selectedContainer);
-		this.availableActions = $('<div class="actions ui-widget-header ui-helper-clearfix"><input type="text" class="search empty ui-widget-content ui-corner-all"/><a href="#" class="add-all">'+$.ui.multiselect.locale.addAll+'</a></div>').appendTo(this.availableContainer);
-		this.selectedList = $('<ul class="selected connected-list"><li class="ui-helper-hidden-accessible"></li></ul>').bind('selectstart', function(){return false;}).appendTo(this.selectedContainer);
-		this.availableList = $('<ul class="available connected-list"><li class="ui-helper-hidden-accessible"></li></ul>').bind('selectstart', function(){return false;}).appendTo(this.availableContainer);
-		
-		var that = this;
-
-		// set dimensions
-		this.container.width(this.element.width()+1);
-		this.selectedContainer.width(Math.floor(this.element.width()*this.options.dividerLocation));
-		this.availableContainer.width(Math.floor(this.element.width()*(1-this.options.dividerLocation)));
-
-		// fix list height to match <option> depending on their individual header's heights
-		this.selectedList.height(Math.max(this.element.height()-this.selectedActions.height(),1));
-		this.availableList.height(Math.max(this.element.height()-this.availableActions.height(),1));
-		
-		if ( !this.options.animated ) {
-			this.options.show = 'show';
-			this.options.hide = 'hide';
-		}
-		
-		// init lists
-		this._populateLists(this.element.find('option'));
-		
-		// make selection sortable
-		if (this.options.sortable) {
-			$("ul.selected").sortable({
-				placeholder: 'ui-state-highlight',
-				axis: 'y',
-				update: function(event, ui) {
-					// apply the new sort order to the original selectbox
-					that.selectedList.find('li').each(function() {
-						if ($(this).data('optionLink'))
-							$(this).data('optionLink').remove().appendTo(that.element);
-					});
-				},
-				receive: function(event, ui) {
-					ui.item.data('optionLink').attr('selected', true);
-					// increment count
-					that.count += 1;
-					that._updateCount();
-					// workaround, because there's no way to reference 
-					// the new element, see http://dev.jqueryui.com/ticket/4303
-					that.selectedList.children('.ui-draggable').each(function() {
-						$(this).removeClass('ui-draggable');
-						$(this).data('optionLink', ui.item.data('optionLink'));
-						$(this).data('idx', ui.item.data('idx'));
-						that._applyItemState($(this), true);
-					});
-			
-					// workaround according to http://dev.jqueryui.com/ticket/4088
-					setTimeout(function() { ui.item.remove(); }, 1);
-				}
-			});
-		}
-		
-		// set up livesearch
-		if (this.options.searchable) {
-			this._registerSearchEvents(this.availableContainer.find('input.search'));
-		} else {
-			$('.search').hide();
-		}
-		
-		// batch actions
-		$(".remove-all").click(function() {
-			that._populateLists(that.element.find('option').removeAttr('selected'));
-			return false;
-		});
-		$(".add-all").click(function() {
-			that._populateLists(that.element.find('option').attr('selected', 'selected'));
-			return false;
-		});
-	},
-	destroy: function() {
-		this.element.show();
-		this.container.remove();
-
-		$.widget.prototype.destroy.apply(this, arguments);
-	},
-	_populateLists: function(options) {
-		this.selectedList.children('.ui-element').remove();
-		this.availableList.children('.ui-element').remove();
-		this.count = 0;
-
-		var that = this;
-		var items = $(options.map(function(i) {
-	      var item = that._getOptionNode(this).appendTo(this.selected ? that.selectedList : that.availableList).show();
-
-			if (this.selected) that.count += 1;
-			that._applyItemState(item, this.selected);
-			item.data('idx', i);
-			return item[0];
-    }));
-		
-		// update count
-		this._updateCount();
-  },
-	_updateCount: function() {
-		this.selectedContainer.find('span.count').text(this.count+" "+$.ui.multiselect.locale.itemsCount);
-	},
-	_getOptionNode: function(option) {
-		option = $(option);
-		var node = $('<li class="ui-state-default ui-element" title="'+option.text()+'"><span class="ui-icon"/>'+option.text()+'<a href="#" class="action"><span class="ui-corner-all ui-icon"/></a></li>').hide();
-		node.data('optionLink', option);
-		return node;
-	},
-	// clones an item with associated data
-	// didn't find a smarter away around this
-	_cloneWithData: function(clonee) {
-		var clone = clonee.clone();
-		clone.data('optionLink', clonee.data('optionLink'));
-		clone.data('idx', clonee.data('idx'));
-		return clone;
-	},
-	_setSelected: function(item, selected) {
-		item.data('optionLink').attr('selected', selected);
-
-		if (selected) {
-			var selectedItem = this._cloneWithData(item);
-			item[this.options.hide](this.options.animated, function() { $(this).remove(); });
-			selectedItem.appendTo(this.selectedList).hide()[this.options.show](this.options.animated);
-			
-			this._applyItemState(selectedItem, true);
-			return selectedItem;
-		} else {
-			
-			// look for successor based on initial option index
-			var items = this.availableList.find('li'), comparator = this.options.nodeComparator;
-			var succ = null, i = item.data('idx'), direction = comparator(item, $(items[i]));
-
-			// TODO: test needed for dynamic list populating
-			if ( direction ) {
-				while (i>=0 && i<items.length) {
-					direction > 0 ? i++ : i--;
-					if ( direction != comparator(item, $(items[i])) ) {
-						// going up, go back one item down, otherwise leave as is
-						succ = items[direction > 0 ? i : i+1];
-						break;
-					}
-				}
-			} else {
-				succ = items[i];
-			}
-			
-			var availableItem = this._cloneWithData(item);
-			succ ? availableItem.insertBefore($(succ)) : availableItem.appendTo(this.availableList);
-			item[this.options.hide](this.options.animated, function() { $(this).remove(); });
-			availableItem.hide()[this.options.show](this.options.animated);
-			
-			this._applyItemState(availableItem, false);
-			return availableItem;
-		}
-	},
-	_applyItemState: function(item, selected) {
-		if (selected) {
-			if (this.options.sortable)
-				item.children('span').addClass('ui-icon-arrowthick-2-n-s').removeClass('ui-helper-hidden').addClass('ui-icon');
-			else
-				item.children('span').removeClass('ui-icon-arrowthick-2-n-s').addClass('ui-helper-hidden').removeClass('ui-icon');
-			item.find('a.action span').addClass('ui-icon-minus').removeClass('ui-icon-plus');
-			this._registerRemoveEvents(item.find('a.action'));
-			
-		} else {
-			item.children('span').removeClass('ui-icon-arrowthick-2-n-s').addClass('ui-helper-hidden').removeClass('ui-icon');
-			item.find('a.action span').addClass('ui-icon-plus').removeClass('ui-icon-minus');
-			this._registerAddEvents(item.find('a.action'));
-		}
-		
-		this._registerHoverEvents(item);
-	},
-	// taken from John Resig's liveUpdate script
-	_filter: function(list) {
-		var input = $(this);
-		var rows = list.children('li'),
-			cache = rows.map(function(){
-				
-				return $(this).text().toLowerCase();
-			});
-		
-		var term = $.trim(input.val().toLowerCase()), scores = [];
-		
-		if (!term) {
-			rows.show();
-		} else {
-			rows.hide();
-
-			cache.each(function(i) {
-				if (this.indexOf(term)>-1) { scores.push(i); }
-			});
-
-			$.each(scores, function() {
-				$(rows[this]).show();
-			});
-		}
-	},
-	_registerHoverEvents: function(elements) {
-		elements.removeClass('ui-state-hover');
-		elements.mouseover(function() {
-			$(this).addClass('ui-state-hover');
-		});
-		elements.mouseout(function() {
-			$(this).removeClass('ui-state-hover');
-		});
-	},
-	_registerAddEvents: function(elements) {
-		var that = this;
-		elements.click(function() {
-			var item = that._setSelected($(this).parent(), true);
-			that.count += 1;
-			that._updateCount();
-			return false;
-		})
-		// make draggable
-		.each(function() {
-			$(this).parent().draggable({
-	      connectToSortable: 'ul.selected',
-				helper: function() {
-					var selectedItem = that._cloneWithData($(this)).width($(this).width() - 50);
-					selectedItem.width($(this).width());
-					return selectedItem;
-				},
-				appendTo: '.ui-multiselect',
-				containment: '.ui-multiselect',
-				revert: 'invalid'
-	    });
-		});
-	},
-	_registerRemoveEvents: function(elements) {
-		var that = this;
-		elements.click(function() {
-			that._setSelected($(this).parent(), false);
-			that.count -= 1;
-			that._updateCount();
-			return false;
-		});
- 	},
-	_registerSearchEvents: function(input) {
-		var that = this;
-
-		input.focus(function() {
-			$(this).addClass('ui-state-active');
-		})
-		.blur(function() {
-			$(this).removeClass('ui-state-active');
-		})
-		.keypress(function(e) {
-			if (e.keyCode == 13)
-				return false;
-		})
-		.keyup(function() {
-			that._filter.apply(this, [that.availableList]);
-		});
-	}
-});
-		
-$.extend($.ui.multiselect, {
-	defaults: {
-		sortable: true,
-		searchable: true,
-		animated: 'fast',
-		show: 'slideDown',
-		hide: 'slideUp',
-		dividerLocation: 0.6,
-		nodeComparator: function(node1,node2) {
-			var text1 = node1.text(),
-			    text2 = node2.text();
-			return text1 == text2 ? 0 : (text1 < text2 ? -1 : 1);
-		}
-	},
-	locale: {
-		addAll:'Add all',
-		removeAll:'Remove all',
-		itemsCount:'items selected'
-	}
-});
-
-})(jQuery);
+/*
+ * jQuery UI Multiselect
+ *
+ * Authors:
+ *  Michael Aufreiter (quasipartikel.at)
+ *  Yanick Rochon (yanick.rochon[at]gmail[dot]com)
+ * 
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * and GPL (GPL-LICENSE.txt) licenses.
+ * 
+ * http://www.quasipartikel.at/multiselect/
+ *
+ * 
+ * Depends:
+ *	ui.core.js
+ *	ui.sortable.js
+ *
+ * Optional:
+ * localization (http://plugins.jquery.com/project/localisation)
+ * scrollTo (http://plugins.jquery.com/project/ScrollTo)
+ * 
+ * Todo:
+ *  Make batch actions faster
+ *  Implement dynamic insertion through remote calls
+ */
+
+
+(function($) {
+
+$.widget("ui.multiselect", {
+	_init: function() {
+		this.element.hide();
+		this.id = this.element.attr("id");
+		this.container = $('<div class="ui-multiselect ui-helper-clearfix ui-widget"></div>').insertAfter(this.element);
+		this.count = 0; // number of currently selected options
+		this.selectedContainer = $('<div class="selected"></div>').appendTo(this.container);
+		this.availableContainer = $('<div class="available"></div>').appendTo(this.container);
+		this.selectedActions = $('<div class="actions ui-widget-header ui-helper-clearfix"><span class="count">0 '+$.ui.multiselect.locale.itemsCount+'</span><a href="#" class="remove-all">'+$.ui.multiselect.locale.removeAll+'</a></div>').appendTo(this.selectedContainer);
+		this.availableActions = $('<div class="actions ui-widget-header ui-helper-clearfix"><input type="text" class="search empty ui-widget-content ui-corner-all"/><a href="#" class="add-all">'+$.ui.multiselect.locale.addAll+'</a></div>').appendTo(this.availableContainer);
+		this.selectedList = $('<ul class="selected connected-list"><li class="ui-helper-hidden-accessible"></li></ul>').bind('selectstart', function(){return false;}).appendTo(this.selectedContainer);
+		this.availableList = $('<ul class="available connected-list"><li class="ui-helper-hidden-accessible"></li></ul>').bind('selectstart', function(){return false;}).appendTo(this.availableContainer);
+		
+		var that = this;
+
+		// set dimensions
+		this.container.width(this.element.width()+1);
+		this.selectedContainer.width(Math.floor(this.element.width()*this.options.dividerLocation));
+		this.availableContainer.width(Math.floor(this.element.width()*(1-this.options.dividerLocation)));
+
+		// fix list height to match <option> depending on their individual header's heights
+		this.selectedList.height(Math.max(this.element.height()-this.selectedActions.height(),1));
+		this.availableList.height(Math.max(this.element.height()-this.availableActions.height(),1));
+		
+		if ( !this.options.animated ) {
+			this.options.show = 'show';
+			this.options.hide = 'hide';
+		}
+		
+		// init lists
+		this._populateLists(this.element.find('option'));
+		
+		// make selection sortable
+		if (this.options.sortable) {
+			$("ul.selected").sortable({
+				placeholder: 'ui-state-highlight',
+				axis: 'y',
+				update: function(event, ui) {
+					// apply the new sort order to the original selectbox
+					that.selectedList.find('li').each(function() {
+						if ($(this).data('optionLink'))
+							$(this).data('optionLink').remove().appendTo(that.element);
+					});
+				},
+				receive: function(event, ui) {
+					ui.item.data('optionLink').attr('selected', true);
+					// increment count
+					that.count += 1;
+					that._updateCount();
+					// workaround, because there's no way to reference 
+					// the new element, see http://dev.jqueryui.com/ticket/4303
+					that.selectedList.children('.ui-draggable').each(function() {
+						$(this).removeClass('ui-draggable');
+						$(this).data('optionLink', ui.item.data('optionLink'));
+						$(this).data('idx', ui.item.data('idx'));
+						that._applyItemState($(this), true);
+					});
+			
+					// workaround according to http://dev.jqueryui.com/ticket/4088
+					setTimeout(function() { ui.item.remove(); }, 1);
+				}
+			});
+		}
+		
+		// set up livesearch
+		if (this.options.searchable) {
+			this._registerSearchEvents(this.availableContainer.find('input.search'));
+		} else {
+			$('.search').hide();
+		}
+		
+		// batch actions
+		$(".remove-all").click(function() {
+			that._populateLists(that.element.find('option').removeAttr('selected'));
+			return false;
+		});
+		$(".add-all").click(function() {
+			that._populateLists(that.element.find('option').attr('selected', 'selected'));
+			return false;
+		});
+	},
+	destroy: function() {
+		this.element.show();
+		this.container.remove();
+
+		$.widget.prototype.destroy.apply(this, arguments);
+	},
+	_populateLists: function(options) {
+		this.selectedList.children('.ui-element').remove();
+		this.availableList.children('.ui-element').remove();
+		this.count = 0;
+
+		var that = this;
+		var items = $(options.map(function(i) {
+	      var item = that._getOptionNode(this).appendTo(this.selected ? that.selectedList : that.availableList).show();
+
+			if (this.selected) that.count += 1;
+			that._applyItemState(item, this.selected);
+			item.data('idx', i);
+			return item[0];
+    }));
+		
+		// update count
+		this._updateCount();
+  },
+	_updateCount: function() {
+		this.selectedContainer.find('span.count').text(this.count+" "+$.ui.multiselect.locale.itemsCount);
+	},
+	_getOptionNode: function(option) {
+		option = $(option);
+		var node = $('<li class="ui-state-default ui-element" title="'+option.text()+'"><span class="ui-icon"/>'+option.text()+'<a href="#" class="action"><span class="ui-corner-all ui-icon"/></a></li>').hide();
+		node.data('optionLink', option);
+		return node;
+	},
+	// clones an item with associated data
+	// didn't find a smarter away around this
+	_cloneWithData: function(clonee) {
+		var clone = clonee.clone();
+		clone.data('optionLink', clonee.data('optionLink'));
+		clone.data('idx', clonee.data('idx'));
+		return clone;
+	},
+	_setSelected: function(item, selected) {
+		item.data('optionLink').attr('selected', selected);
+
+		if (selected) {
+			var selectedItem = this._cloneWithData(item);
+			item[this.options.hide](this.options.animated, function() { $(this).remove(); });
+			selectedItem.appendTo(this.selectedList).hide()[this.options.show](this.options.animated);
+			
+			this._applyItemState(selectedItem, true);
+			return selectedItem;
+		} else {
+			
+			// look for successor based on initial option index
+			var items = this.availableList.find('li'), comparator = this.options.nodeComparator;
+			var succ = null, i = item.data('idx'), direction = comparator(item, $(items[i]));
+
+			// TODO: test needed for dynamic list populating
+			if ( direction ) {
+				while (i>=0 && i<items.length) {
+					direction > 0 ? i++ : i--;
+					if ( direction != comparator(item, $(items[i])) ) {
+						// going up, go back one item down, otherwise leave as is
+						succ = items[direction > 0 ? i : i+1];
+						break;
+					}
+				}
+			} else {
+				succ = items[i];
+			}
+			
+			var availableItem = this._cloneWithData(item);
+			succ ? availableItem.insertBefore($(succ)) : availableItem.appendTo(this.availableList);
+			item[this.options.hide](this.options.animated, function() { $(this).remove(); });
+			availableItem.hide()[this.options.show](this.options.animated);
+			
+			this._applyItemState(availableItem, false);
+			return availableItem;
+		}
+	},
+	_applyItemState: function(item, selected) {
+		if (selected) {
+			if (this.options.sortable)
+				item.children('span').addClass('ui-icon-arrowthick-2-n-s').removeClass('ui-helper-hidden').addClass('ui-icon');
+			else
+				item.children('span').removeClass('ui-icon-arrowthick-2-n-s').addClass('ui-helper-hidden').removeClass('ui-icon');
+			item.find('a.action span').addClass('ui-icon-minus').removeClass('ui-icon-plus');
+			this._registerRemoveEvents(item.find('a.action'));
+			
+		} else {
+			item.children('span').removeClass('ui-icon-arrowthick-2-n-s').addClass('ui-helper-hidden').removeClass('ui-icon');
+			item.find('a.action span').addClass('ui-icon-plus').removeClass('ui-icon-minus');
+			this._registerAddEvents(item.find('a.action'));
+		}
+		
+		this._registerHoverEvents(item);
+	},
+	// taken from John Resig's liveUpdate script
+	_filter: function(list) {
+		var input = $(this);
+		var rows = list.children('li'),
+			cache = rows.map(function(){
+				
+				return $(this).text().toLowerCase();
+			});
+		
+		var term = $.trim(input.val().toLowerCase()), scores = [];
+		
+		if (!term) {
+			rows.show();
+		} else {
+			rows.hide();
+
+			cache.each(function(i) {
+				if (this.indexOf(term)>-1) { scores.push(i); }
+			});
+
+			$.each(scores, function() {
+				$(rows[this]).show();
+			});
+		}
+	},
+	_registerHoverEvents: function(elements) {
+		elements.removeClass('ui-state-hover');
+		elements.mouseover(function() {
+			$(this).addClass('ui-state-hover');
+		});
+		elements.mouseout(function() {
+			$(this).removeClass('ui-state-hover');
+		});
+	},
+	_registerAddEvents: function(elements) {
+		var that = this;
+		elements.click(function() {
+			var item = that._setSelected($(this).parent(), true);
+			that.count += 1;
+			that._updateCount();
+			return false;
+		})
+		// make draggable
+		.each(function() {
+			$(this).parent().draggable({
+	      connectToSortable: 'ul.selected',
+				helper: function() {
+					var selectedItem = that._cloneWithData($(this)).width($(this).width() - 50);
+					selectedItem.width($(this).width());
+					return selectedItem;
+				},
+				appendTo: '.ui-multiselect',
+				containment: '.ui-multiselect',
+				revert: 'invalid'
+	    });
+		});
+	},
+	_registerRemoveEvents: function(elements) {
+		var that = this;
+		elements.click(function() {
+			that._setSelected($(this).parent(), false);
+			that.count -= 1;
+			that._updateCount();
+			return false;
+		});
+ 	},
+	_registerSearchEvents: function(input) {
+		var that = this;
+
+		input.focus(function() {
+			$(this).addClass('ui-state-active');
+		})
+		.blur(function() {
+			$(this).removeClass('ui-state-active');
+		})
+		.keypress(function(e) {
+			if (e.keyCode == 13)
+				return false;
+		})
+		.keyup(function() {
+			that._filter.apply(this, [that.availableList]);
+		});
+	}
+});
+		
+$.extend($.ui.multiselect, {
+	defaults: {
+		sortable: true,
+		searchable: true,
+		animated: 'fast',
+		show: 'slideDown',
+		hide: 'slideUp',
+		dividerLocation: 0.6,
+		nodeComparator: function(node1,node2) {
+			var text1 = node1.text(),
+			    text2 = node2.text();
+			return text1 == text2 ? 0 : (text1 < text2 ? -1 : 1);
+		}
+	},
+	locale: {
+		addAll:'Add all',
+		removeAll:'Remove all',
+		itemsCount:'items selected'
+	}
+});
+
+})(jQuery);
Index: controlies/trunk/applications/controlies/static/js/jdgrid/src/grid.filter.js
===================================================================
--- controlies/trunk/applications/controlies/static/js/jdgrid/src/grid.filter.js	(nonexistent)
+++ controlies/trunk/applications/controlies/static/js/jdgrid/src/grid.filter.js	(revision 241)
@@ -0,0 +1,723 @@
+/*
+ * jqFilter  jQuery jqGrid filter addon.
+ * Copyright (c) 2011, Tony Tomov, tony@trirand.com
+ * Dual licensed under the MIT and GPL licenses
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl-2.0.html
+ * 
+ * The work is inspired from this Stefan Pirvu
+ * http://www.codeproject.com/KB/scripting/json-filtering.aspx
+ *
+ * The filter uses JSON entities to hold filter rules and groups. Here is an example of a filter:
+
+{ "groupOp": "AND",
+      "groups" : [ 
+        { "groupOp": "OR",
+            "rules": [
+                { "field": "name", "op": "eq", "data": "England" }, 
+                { "field": "id", "op": "le", "data": "5"}
+             ]
+        } 
+      ],
+      "rules": [
+        { "field": "name", "op": "eq", "data": "Romania" }, 
+        { "field": "id", "op": "le", "data": "1"}
+      ]
+}
+*/
+/*global jQuery, $, window, navigator */
+
+(function ($) {
+
+$.fn.jqFilter = function( arg ) {
+	if (typeof arg === 'string') {
+		
+		var fn = $.fn.jqFilter[arg];
+		if (!fn) {
+			throw ("jqFilter - No such method: " + arg);
+		}
+		var args = $.makeArray(arguments).slice(1);
+		return fn.apply(this,args);
+	}
+
+	var p = $.extend(true,{
+		filter: null,
+		columns: [],
+		onChange : null,
+		afterRedraw : null,
+		checkValues : null,
+		error: false,
+		errmsg : "",
+		errorcheck : true,
+		showQuery : true,
+		sopt : null,
+		ops : [
+			{"name": "eq", "description": "equal", "operator":"="},
+			{"name": "ne", "description": "not equal", "operator":"<>"},
+			{"name": "lt", "description": "less", "operator":"<"},
+			{"name": "le", "description": "less or equal","operator":"<="},
+			{"name": "gt", "description": "greater", "operator":">"},
+			{"name": "ge", "description": "greater or equal", "operator":">="},
+			{"name": "bw", "description": "begins with", "operator":"LIKE"},
+			{"name": "bn", "description": "does not begin with", "operator":"NOT LIKE"},
+			{"name": "in", "description": "in", "operator":"IN"},
+			{"name": "ni", "description": "not in", "operator":"NOT IN"},
+			{"name": "ew", "description": "ends with", "operator":"LIKE"},
+			{"name": "en", "description": "does not end with", "operator":"NOT LIKE"},
+			{"name": "cn", "description": "contains", "operator":"LIKE"},
+			{"name": "nc", "description": "does not contain", "operator":"NOT LIKE"},
+			{"name": "nu", "description": "is null", "operator":"IS NULL"},
+			{"name": "nn", "description": "is not null", "operator":"IS NOT NULL"}
+		],
+		numopts : ['eq','ne', 'lt', 'le', 'gt', 'ge', 'nu', 'nn', 'in', 'ni'],
+		stropts : ['eq', 'ne', 'bw', 'bn', 'ew', 'en', 'cn', 'nc', 'nu', 'nn', 'in', 'ni'],
+		_gridsopt : [], // grid translated strings, do not tuch
+		groupOps : ["AND", "OR"],
+		groupButton : true,
+		ruleButtons : true,
+		direction : "ltr"
+	}, arg || {});
+	return this.each( function() {
+		if (this.filter) {return;}
+		this.p = p;
+		// setup filter in case if they is not defined
+		if (this.p.filter === null || this.p.filter === undefined) {
+			this.p.filter = {
+				groupOp: this.p.groupOps[0],
+				rules: [],
+				groups: []
+			};
+		}
+		var i, len = this.p.columns.length, cl,
+		isIE = /msie/i.test(navigator.userAgent) && !window.opera;
+
+		// translating the options
+		if(this.p._gridsopt.length) {
+			// ['eq','ne','lt','le','gt','ge','bw','bn','in','ni','ew','en','cn','nc']
+			for(i=0;i<this.p._gridsopt.length;i++) {
+				this.p.ops[i].description = this.p._gridsopt[i];
+			}
+		}
+		this.p.initFilter = $.extend(true,{},this.p.filter);
+
+		// set default values for the columns if they are not set
+		if( !len ) {return;}
+		for(i=0; i < len; i++) {
+			cl = this.p.columns[i];
+			if( cl.stype ) {
+				// grid compatibility
+				cl.inputtype = cl.stype;
+			} else if(!cl.inputtype) {
+				cl.inputtype = 'text';
+			}
+			if( cl.sorttype ) {
+				// grid compatibility
+				cl.searchtype = cl.sorttype;
+			} else if (!cl.searchtype) {
+				cl.searchtype = 'string';
+			}
+			if(cl.hidden === undefined) {
+				// jqGrid compatibility
+				cl.hidden = false;
+			}
+			if(!cl.label) {
+				cl.label = cl.name;
+			}
+			if(cl.index) {
+				cl.name = cl.index;
+			}
+			if(!cl.hasOwnProperty('searchoptions')) {
+				cl.searchoptions = {};
+			}
+			if(!cl.hasOwnProperty('searchrules')) {
+				cl.searchrules = {};
+			}
+
+		}
+		if(this.p.showQuery) {
+			$(this).append("<table class='queryresult ui-widget ui-widget-content' style='display:block;max-width:440px;border:0px none;' dir='"+this.p.direction+"'><tbody><tr><td class='query'></td></tr></tbody></table>");
+		}
+		/*
+		 *Perform checking.
+		 *
+		*/
+		var checkData = function(val, colModelItem) {
+			var ret = [true,""];
+			if($.isFunction(colModelItem.searchrules)) {
+				ret = colModelItem.searchrules(val, colModelItem);
+			} else if($.jgrid && $.jgrid.checkValues) {
+				try {
+					ret = $.jgrid.checkValues(val, -1, null, colModelItem.searchrules, colModelItem.label);
+				} catch (e) {}
+			}
+			if(ret && ret.length && ret[0] === false) {
+				p.error = !ret[0];
+				p.errmsg = ret[1];
+			}
+		};
+		/* moving to common
+		randId = function() {
+			return Math.floor(Math.random()*10000).toString();
+		};
+		*/
+
+		this.onchange = function (  ){
+			// clear any error 
+			this.p.error = false;
+			this.p.errmsg="";
+			return $.isFunction(this.p.onChange) ? this.p.onChange.call( this, this.p ) : false;
+		};
+		/*
+		 * Redraw the filter every time when new field is added/deleted
+		 * and field is  changed
+		 */
+		this.reDraw = function() {
+			$("table.group:first",this).remove();
+			var t = this.createTableForGroup(p.filter, null);
+			$(this).append(t);
+			if($.isFunction(this.p.afterRedraw) ) {
+				this.p.afterRedraw.call(this, this.p);
+			}
+		};
+		/*
+		 * Creates a grouping data for the filter
+		 * @param group - object
+		 * @param parentgroup - object
+		 */
+		this.createTableForGroup = function(group, parentgroup) {
+			var that = this,  i;
+
+			// this table will hold all the group (tables) and rules (rows)
+			var table = $("<table class='group ui-widget ui-widget-content' style='border:0px none;'><tbody></tbody></table>"),
+			// create error message row
+			align = "left";
+			if(this.p.direction == "rtl") {
+				align = "right";
+				table.attr("dir","rtl");
+			}
+			if(parentgroup === null) {
+				table.append("<tr class='error' style='display:none;'><th colspan='5' class='ui-state-error' align='"+align+"'></th></tr>");
+			}
+
+			var tr = $("<tr></tr>");
+			table.append(tr);
+			// this header will hold the group operator type and group action buttons for
+			// creating subgroup "+ {}", creating rule "+" or deleting the group "-"
+			var th = $("<th colspan='5' align='"+align+"'></th>");
+			tr.append(th);
+
+			if(this.p.ruleButtons === true) {
+			// dropdown for: choosing group operator type
+			var groupOpSelect = $("<select class='opsel'></select>");
+			th.append(groupOpSelect);
+			// populate dropdown with all posible group operators: or, and
+			var str= "", selected;
+			for (i = 0; i < p.groupOps.length; i++) {
+				selected =  group.groupOp === that.p.groupOps[i] ? " selected='selected'" :"";
+				str += "<option value='"+that.p.groupOps[i]+"'" + selected+">"+that.p.groupOps[i]+"</option>";
+			}
+
+			groupOpSelect
+			.append(str)
+			.bind('change',function() {
+				group.groupOp = $(groupOpSelect).val();
+				that.onchange(); // signals that the filter has changed
+			});
+			}
+			// button for adding a new subgroup
+			var inputAddSubgroup ="<span></span>";
+			if(this.p.groupButton) {
+				inputAddSubgroup = $("<input type='button' value='+ {}' title='Add subgroup' class='add-group'/>");
+				inputAddSubgroup.bind('click',function() {
+					if (group.groups === undefined ) {
+						group.groups = [];
+					}
+
+					group.groups.push({
+						groupOp: p.groupOps[0],
+						rules: [],
+						groups: []
+					}); // adding a new group
+
+					that.reDraw(); // the html has changed, force reDraw
+
+					that.onchange(); // signals that the filter has changed
+					return false;
+				});
+			}
+			th.append(inputAddSubgroup);
+			if(this.p.ruleButtons === true) {
+			// button for adding a new rule
+			var inputAddRule = $("<input type='button' value='+' title='Add rule' class='add-rule ui-add'/>"), cm;
+			inputAddRule.bind('click',function() {
+				//if(!group) { group = {};}
+				if (group.rules === undefined) {
+					group.rules = [];
+				}
+				for (i = 0; i < that.p.columns.length; i++) {
+				// but show only serchable and serchhidden = true fields
+					var searchable = (typeof that.p.columns[i].search === 'undefined') ?  true: that.p.columns[i].search ,
+					hidden = (that.p.columns[i].hidden === true),
+					ignoreHiding = (that.p.columns[i].searchoptions.searchhidden === true);
+					if ((ignoreHiding && searchable) || (searchable && !hidden)) {
+						cm = that.p.columns[i];
+						break;
+					}
+				}
+				var opr;
+				if( cm.searchoptions.sopt ) {opr = cm.searchoptions.sopt;}
+				else if(that.p.sopt) { opr= that.p.sopt; }
+				else if  (cm.searchtype === 'string') {opr = that.p.stropts;}
+				else {opr = that.p.numopts;}
+
+				group.rules.push({
+					field: cm.name,
+					op: opr[0],
+					data: ""
+				}); // adding a new rule
+
+				that.reDraw(); // the html has changed, force reDraw
+				// for the moment no change have been made to the rule, so
+				// this will not trigger onchange event
+				return false;
+			});
+			th.append(inputAddRule);
+			}
+
+			// button for delete the group
+			if (parentgroup !== null) { // ignore the first group
+				var inputDeleteGroup = $("<input type='button' value='-' title='Delete group' class='delete-group'/>");
+				th.append(inputDeleteGroup);
+				inputDeleteGroup.bind('click',function() {
+				// remove group from parent
+					for (i = 0; i < parentgroup.groups.length; i++) {
+						if (parentgroup.groups[i] === group) {
+							parentgroup.groups.splice(i, 1);
+							break;
+						}
+					}
+
+					that.reDraw(); // the html has changed, force reDraw
+
+					that.onchange(); // signals that the filter has changed
+					return false;
+				});
+			}
+
+			// append subgroup rows
+			if (group.groups !== undefined) {
+				for (i = 0; i < group.groups.length; i++) {
+					var trHolderForSubgroup = $("<tr></tr>");
+					table.append(trHolderForSubgroup);
+
+					var tdFirstHolderForSubgroup = $("<td class='first'></td>");
+					trHolderForSubgroup.append(tdFirstHolderForSubgroup);
+
+					var tdMainHolderForSubgroup = $("<td colspan='4'></td>");
+					tdMainHolderForSubgroup.append(this.createTableForGroup(group.groups[i], group));
+					trHolderForSubgroup.append(tdMainHolderForSubgroup);
+				}
+			}
+			if(group.groupOp === undefined) {
+				group.groupOp = that.p.groupOps[0];
+			}
+
+			// append rules rows
+			if (group.rules !== undefined) {
+				for (i = 0; i < group.rules.length; i++) {
+					table.append(
+                       this.createTableRowForRule(group.rules[i], group)
+					);
+				}
+			}
+
+			return table;
+		};
+		/*
+		 * Create the rule data for the filter
+		 */
+		this.createTableRowForRule = function(rule, group ) {
+			// save current entity in a variable so that it could
+			// be referenced in anonimous method calls
+
+			var that=this, tr = $("<tr></tr>"),
+			//document.createElement("tr"),
+
+			// first column used for padding
+			//tdFirstHolderForRule = document.createElement("td"),
+			i, op, trpar, cm, str="", selected;
+			//tdFirstHolderForRule.setAttribute("class", "first");
+			tr.append("<td class='first'></td>");
+
+
+			// create field container
+			var ruleFieldTd = $("<td class='columns'></td>");
+			tr.append(ruleFieldTd);
+
+
+			// dropdown for: choosing field
+			var ruleFieldSelect = $("<select></select>"), ina, aoprs = [];
+			ruleFieldTd.append(ruleFieldSelect);
+			ruleFieldSelect.bind('change',function() {
+				rule.field = $(ruleFieldSelect).val();
+
+				trpar = $(this).parents("tr:first");
+				for (i=0;i<that.p.columns.length;i++) {
+					if(that.p.columns[i].name ===  rule.field) {
+						cm = that.p.columns[i];
+						break;
+					}
+				}
+				if(!cm) {return;}
+				cm.searchoptions.id = $.jgrid.randId();
+				if(isIE && cm.inputtype === "text") {
+					if(!cm.searchoptions.size) {
+						cm.searchoptions.size = 10;
+					}
+				}
+				var elm = $.jgrid.createEl(cm.inputtype,cm.searchoptions, "", true, that.p.ajaxSelectOptions, true);
+				$(elm).addClass("input-elm");
+				//that.createElement(rule, "");
+
+				if( cm.searchoptions.sopt ) {op = cm.searchoptions.sopt;}
+				else if(that.p.sopt) { op= that.p.sopt; }
+				else if  (cm.searchtype === 'string') {op = that.p.stropts;}
+				else {op = that.p.numopts;}
+				// operators
+				var s ="", so = 0;
+				aoprs = [];
+				$.each(that.p.ops, function() { aoprs.push(this.name) });
+				for ( i = 0 ; i < op.length; i++) {
+					ina = $.inArray(op[i],aoprs);
+					if(ina !== -1) {
+						if(so===0) {
+							rule.op = that.p.ops[ina].name;
+						}
+						s += "<option value='"+that.p.ops[ina].name+"'>"+that.p.ops[ina].description+"</option>";
+						so++;
+					}
+				}
+				$(".selectopts",trpar).empty().append( s );
+				$(".selectopts",trpar)[0].selectedIndex = 0;
+				if( $.browser.msie && $.browser.version < 9) {
+					var sw = parseInt($("select.selectopts",trpar)[0].offsetWidth) + 1;
+					$(".selectopts",trpar).width( sw );
+					$(".selectopts",trpar).css("width","auto");
+				}
+				// data
+				$(".data",trpar).empty().append( elm );
+				$(".input-elm",trpar).bind('change',function() {
+					rule.data = $(this).val();
+					that.onchange(); // signals that the filter has changed
+				});
+				setTimeout(function(){ //IE, Opera, Chrome
+				rule.data = $(elm).val();
+				that.onchange();  // signals that the filter has changed
+				}, 0);
+			});
+
+			// populate drop down with user provided column definitions
+			var j=0;
+			for (i = 0; i < that.p.columns.length; i++) {
+				// but show only serchable and serchhidden = true fields
+		        var searchable = (typeof that.p.columns[i].search === 'undefined') ?  true: that.p.columns[i].search ,
+		        hidden = (that.p.columns[i].hidden === true),
+				ignoreHiding = (that.p.columns[i].searchoptions.searchhidden === true);
+				if ((ignoreHiding && searchable) || (searchable && !hidden)) {
+					selected = "";
+					if(rule.field === that.p.columns[i].name) {
+						selected = " selected='selected'";
+						j=i;
+					}
+					str += "<option value='"+that.p.columns[i].name+"'" +selected+">"+that.p.columns[i].label+"</option>";
+				}
+			}
+			ruleFieldSelect.append( str );
+
+
+			// create operator container
+			var ruleOperatorTd = $("<td class='operators'></td>");
+			tr.append(ruleOperatorTd);
+			cm = p.columns[j];
+			// create it here so it can be referentiated in the onchange event
+			//var RD = that.createElement(rule, rule.data);
+			cm.searchoptions.id = $.jgrid.randId();
+			if(isIE && cm.inputtype === "text") {
+				if(!cm.searchoptions.size) {
+					cm.searchoptions.size = 10;
+				}
+			}
+			var ruleDataInput = $.jgrid.createEl(cm.inputtype,cm.searchoptions, rule.data, true, that.p.ajaxSelectOptions, true);
+
+			// dropdown for: choosing operator
+			var ruleOperatorSelect = $("<select class='selectopts'></select>");
+			ruleOperatorTd.append(ruleOperatorSelect);
+			ruleOperatorSelect.bind('change',function() {
+				rule.op = $(ruleOperatorSelect).val();
+				trpar = $(this).parents("tr:first");
+				var rd = $(".input-elm",trpar)[0];
+				if (rule.op === "nu" || rule.op === "nn") { // disable for operator "is null" and "is not null"
+					rule.data = "";
+					rd.value = "";
+					rd.setAttribute("readonly", "true");
+					rd.setAttribute("disabled", "true");
+				} else {
+					rd.removeAttribute("readonly");
+					rd.removeAttribute("disabled");
+				}
+
+				that.onchange();  // signals that the filter has changed
+			});
+
+			// populate drop down with all available operators
+			if( cm.searchoptions.sopt ) {op = cm.searchoptions.sopt;}
+			else if(that.p.sopt) { op= that.p.sopt; }
+			else if  (cm.searchtype === 'string') {op = p.stropts;}
+			else {op = that.p.numopts;}
+			str="";
+			$.each(that.p.ops, function() { aoprs.push(this.name) });
+			for ( i = 0; i < op.length; i++) {
+				ina = $.inArray(op[i],aoprs);
+				if(ina !== -1) {
+					selected = rule.op === that.p.ops[ina].name ? " selected='selected'" : "";
+					str += "<option value='"+that.p.ops[ina].name+"'"+selected+">"+that.p.ops[ina].description+"</option>";
+				}
+			}
+			ruleOperatorSelect.append( str );
+			// create data container
+			var ruleDataTd = $("<td class='data'></td>");
+			tr.append(ruleDataTd);
+
+			// textbox for: data
+			// is created previously
+			//ruleDataInput.setAttribute("type", "text");
+			ruleDataTd.append(ruleDataInput);
+
+			$(ruleDataInput)
+			.addClass("input-elm")
+			.bind('change', function() {
+				rule.data = $(this).val();
+				that.onchange(); // signals that the filter has changed
+			});
+
+			// create action container
+			var ruleDeleteTd = $("<td></td>");
+			tr.append(ruleDeleteTd);
+
+			// create button for: delete rule
+			if(this.p.ruleButtons === true) {
+			var ruleDeleteInput = $("<input type='button' value='-' title='Delete rule' class='delete-rule ui-del'/>");
+			ruleDeleteTd.append(ruleDeleteInput);
+			//$(ruleDeleteInput).html("").height(20).width(30).button({icons: {  primary: "ui-icon-minus", text:false}});
+			ruleDeleteInput.bind('click',function() {
+				// remove rule from group
+				for (i = 0; i < group.rules.length; i++) {
+					if (group.rules[i] === rule) {
+						group.rules.splice(i, 1);
+						break;
+					}
+				}
+
+				that.reDraw(); // the html has changed, force reDraw
+
+				that.onchange(); // signals that the filter has changed
+				return false;
+			});
+			}
+			return tr;
+		};
+
+		this.getStringForGroup = function(group) {
+			var s = "(", index;
+			if (group.groups !== undefined) {
+				for (index = 0; index < group.groups.length; index++) {
+					if (s.length > 1) {
+						s += " " + group.groupOp + " ";
+					}
+					try {
+						s += this.getStringForGroup(group.groups[index]);
+					} catch (eg) {alert(eg);}
+				}
+			}
+
+			if (group.rules !== undefined) {
+				try{
+					for (index = 0; index < group.rules.length; index++) {
+						if (s.length > 1) {
+							s += " " + group.groupOp + " ";
+						}
+						s += this.getStringForRule(group.rules[index]);
+					}
+				} catch (e) {alert(e);}
+			}
+
+			s += ")";
+
+			if (s === "()") {
+				return ""; // ignore groups that don't have rules
+			} else {
+				return s;
+			}
+		};
+		this.getStringForRule = function(rule) {
+			var opUF = "",opC="", i, cm, ret, val,
+			numtypes = ['int', 'integer', 'float', 'number', 'currency']; // jqGrid
+			for (i = 0; i < this.p.ops.length; i++) {
+				if (this.p.ops[i].name === rule.op) {
+					opUF = this.p.ops[i].operator;
+					opC = this.p.ops[i].name;
+					break;
+				}
+			}
+			for (i=0; i<this.p.columns.length; i++) {
+				if(this.p.columns[i].name === rule.field) {
+					cm = this.p.columns[i];
+					break;
+				}
+			}
+			val = rule.data;
+			if(opC === 'bw' || opC === 'bn') { val = val+"%"; }
+			if(opC === 'ew' || opC === 'en') { val = "%"+val; }
+			if(opC === 'cn' || opC === 'nc') { val = "%"+val+"%"; }
+			if(opC === 'in' || opC === 'ni') { val = " ("+val+")"; }
+			if(p.errorcheck) { checkData(rule.data, cm); }
+			if($.inArray(cm.searchtype, numtypes) !== -1 || opC === 'nn' || opC === 'nu') { ret = rule.field + " " + opUF + " " + val; }
+			else { ret = rule.field + " " + opUF + " \"" + val + "\""; }
+			return ret;
+		};
+		this.resetFilter = function () {
+			this.p.filter = $.extend(true,{},this.p.initFilter);
+			this.reDraw();
+			this.onchange();
+		};
+		this.hideError = function() {
+			$("th.ui-state-error", this).html("");
+			$("tr.error", this).hide();
+		};
+		this.showError = function() {
+			$("th.ui-state-error", this).html(this.p.errmsg);
+			$("tr.error", this).show();
+		};
+		this.toUserFriendlyString = function() {
+			return this.getStringForGroup(p.filter);
+		};
+		this.toString = function() {
+			// this will obtain a string that can be used to match an item.
+			var that = this;
+			function getStringRule(rule) {
+				if(that.p.errorcheck) {
+					var i, cm;
+					for (i=0; i<that.p.columns.length; i++) {
+						if(that.p.columns[i].name === rule.field) {
+							cm = that.p.columns[i];
+							break;
+						}
+					}
+					if(cm) {checkData(rule.data, cm);}
+				}
+				return rule.op + "(item." + rule.field + ",'" + rule.data + "')";
+			}
+
+			function getStringForGroup(group) {
+				var s = "(", index;
+
+				if (group.groups !== undefined) {
+					for (index = 0; index < group.groups.length; index++) {
+						if (s.length > 1) {
+							if (group.groupOp === "OR") {
+								s += " || ";
+							}
+							else {
+								s += " && ";
+							}
+						}
+						s += getStringForGroup(group.groups[index]);
+					}
+				}
+
+				if (group.rules !== undefined) {
+					for (index = 0; index < group.rules.length; index++) {
+						if (s.length > 1) {
+							if (group.groupOp === "OR") {
+								s += " || ";
+							}
+							else  {
+								s += " && ";
+							}
+						}
+						s += getStringRule(group.rules[index]);
+					}
+				}
+
+				s += ")";
+
+				if (s === "()") {
+					return ""; // ignore groups that don't have rules
+				} else {
+					return s;
+				}
+			}
+
+			return getStringForGroup(this.p.filter);
+		};
+
+		// Here we init the filter
+		this.reDraw();
+
+		if(this.p.showQuery) {
+			this.onchange();
+		}
+		// mark is as created so that it will not be created twice on this element
+		this.filter = true;
+	});
+};
+$.extend($.fn.jqFilter,{
+	/*
+	 * Return SQL like string. Can be used directly
+	 */
+	toSQLString : function()
+	{
+		var s ="";
+		this.each(function(){
+			s = this.toUserFriendlyString();
+		});
+		return s;
+	},
+	/*
+	 * Return filter data as object.
+	 */
+	filterData : function()
+	{
+		var s;
+		this.each(function(){
+			s = this.p.filter;
+		});
+		return s;
+
+	},
+	getParameter : function (param) {
+		if(param !== undefined) {
+			if (this.p.hasOwnProperty(param) ) {
+				return this.p[param];
+			}
+		}
+		return this.p;
+	},
+	resetFilter: function() {
+		return this.each(function(){
+			this.resetFilter();
+		});
+	},
+	addFilter: function (pfilter) {
+		if (typeof pfilter === "string") {
+			pfilter = jQuery.jgrid.parse( pfilter );
+	}
+		this.each(function(){
+			this.p.filter = pfilter;
+			this.reDraw();
+			this.onchange();
+		});
+	}
+
+});
+})(jQuery);
Index: controlies/trunk/applications/controlies/static/js/jdgrid/src/grid.celledit.js
===================================================================
--- controlies/trunk/applications/controlies/static/js/jdgrid/src/grid.celledit.js	(revision 240)
+++ controlies/trunk/applications/controlies/static/js/jdgrid/src/grid.celledit.js	(revision 241)
@@ -1,483 +1,488 @@
-;(function($){
-/*
-**
- * jqGrid extension for cellediting Grid Data
- * Tony Tomov tony@trirand.com
- * http://trirand.com/blog/ 
- * Dual licensed under the MIT and GPL licenses:
- * http://www.opensource.org/licenses/mit-license.php
- * http://www.gnu.org/licenses/gpl-2.0.html
-**/ 
-/**
- * all events and options here are aded anonynous and not in the base grid
- * since the array is to big. Here is the order of execution.
- * From this point we use jQuery isFunction
- * formatCell
- * beforeEditCell,
- * onSelectCell (used only for noneditable cels)
- * afterEditCell,
- * beforeSaveCell, (called before validation of values if any)
- * beforeSubmitCell (if cellsubmit remote (ajax))
- * afterSubmitCell(if cellsubmit remote (ajax)),
- * afterSaveCell,
- * errorCell,
- * serializeCellData - new
- * Options
- * cellsubmit (remote,clientArray) (added in grid options)
- * cellurl
- * ajaxCellOptions
-* */
-$.jgrid.extend({
-	editCell : function (iRow,iCol, ed){
-		return this.each(function (){
-			var $t = this, nm, tmp,cc;
-			if (!$t.grid || $t.p.cellEdit !== true) {return;}
-			iCol = parseInt(iCol,10);
-			// select the row that can be used for other methods
-			$t.p.selrow = $t.rows[iRow].id;
-			if (!$t.p.knv) {$($t).jqGrid("GridNav");}
-			// check to see if we have already edited cell
-			if ($t.p.savedRow.length>0) {
-				// prevent second click on that field and enable selects
-				if (ed===true ) {
-					if(iRow == $t.p.iRow && iCol == $t.p.iCol){
-						return;
-					}
-				}
-				// save the cell
-				$($t).jqGrid("saveCell",$t.p.savedRow[0].id,$t.p.savedRow[0].ic);
-			} else {
-				window.setTimeout(function () { $("#"+$t.p.knv).attr("tabindex","-1").focus();},0);
-			}
-			nm = $t.p.colModel[iCol].name;
-			if (nm=='subgrid' || nm=='cb' || nm=='rn') {return;}
-			cc = $("td:eq("+iCol+")",$t.rows[iRow]);
-			if ($t.p.colModel[iCol].editable===true && ed===true && !cc.hasClass("not-editable-cell")) {
-				if(parseInt($t.p.iCol,10)>=0  && parseInt($t.p.iRow,10)>=0) {
-					$("td:eq("+$t.p.iCol+")",$t.rows[$t.p.iRow]).removeClass("edit-cell ui-state-highlight");
-					$($t.rows[$t.p.iRow]).removeClass("selected-row ui-state-hover");
-				}
-				$(cc).addClass("edit-cell ui-state-highlight");
-				$($t.rows[iRow]).addClass("selected-row ui-state-hover");
-				try {
-					tmp =  $.unformat(cc,{rowId: $t.rows[iRow].id, colModel:$t.p.colModel[iCol]},iCol);
-				} catch (_) {
-					tmp = $(cc).html();
-				}
-				if($t.p.autoencode) { tmp = $.jgrid.htmlDecode(tmp); }
-				if (!$t.p.colModel[iCol].edittype) {$t.p.colModel[iCol].edittype = "text";}
-				$t.p.savedRow.push({id:iRow,ic:iCol,name:nm,v:tmp});
-				if($.isFunction($t.p.formatCell)) {
-					var tmp2 = $t.p.formatCell($t.rows[iRow].id,nm,tmp,iRow,iCol);
-					if(tmp2 !== undefined ) {tmp = tmp2;}
-				}
-				var opt = $.extend({}, $t.p.colModel[iCol].editoptions || {} ,{id:iRow+"_"+nm,name:nm});
-				var elc = createEl($t.p.colModel[iCol].edittype,opt,tmp,true,$.extend({},$.jgrid.ajaxOptions,$t.p.ajaxSelectOptions || {}));
-				if ($.isFunction($t.p.beforeEditCell)) {
-					$t.p.beforeEditCell($t.rows[iRow].id,nm,tmp,iRow,iCol);
-				}
-				$(cc).html("").append(elc).attr("tabindex","0");
-				window.setTimeout(function () { $(elc).focus();},0);
-				$("input, select, textarea",cc).bind("keydown",function(e) { 
-					if (e.keyCode === 27) {
-						if($("input.hasDatepicker",cc).length >0) {
-							if( $(".ui-datepicker").is(":hidden") )  { $($t).jqGrid("restoreCell",iRow,iCol); }
-							else { $("input.hasDatepicker",cc).datepicker('hide'); }
-						} else {
-							$($t).jqGrid("restoreCell",iRow,iCol);
-						}
-					} //ESC
-					if (e.keyCode === 13) {$($t).jqGrid("saveCell",iRow,iCol);}//Enter
-					if (e.keyCode == 9)  {
-						if(!$t.grid.hDiv.loading ) {
-							if (e.shiftKey) {$($t).jqGrid("prevCell",iRow,iCol);} //Shift TAb
-							else {$($t).jqGrid("nextCell",iRow,iCol);} //Tab
-						} else {
-							return false;
-						}
-					}
-					e.stopPropagation();
-				});
-				if ($.isFunction($t.p.afterEditCell)) {
-					$t.p.afterEditCell($t.rows[iRow].id,nm,tmp,iRow,iCol);
-				}
-			} else {
-				if (parseInt($t.p.iCol,10)>=0  && parseInt($t.p.iRow,10)>=0) {
-					$("td:eq("+$t.p.iCol+")",$t.rows[$t.p.iRow]).removeClass("edit-cell ui-state-highlight");
-					$($t.rows[$t.p.iRow]).removeClass("selected-row ui-state-hover");
-				}
-				cc.addClass("edit-cell ui-state-highlight");
-				$($t.rows[iRow]).addClass("selected-row ui-state-hover"); 
-				if ($.isFunction($t.p.onSelectCell)) {
-					tmp = cc.html().replace(/\&#160\;/ig,'');
-					$t.p.onSelectCell($t.rows[iRow].id,nm,tmp,iRow,iCol);
-				}
-			}
-			$t.p.iCol = iCol; $t.p.iRow = iRow;
-		});
-	},
-	saveCell : function (iRow, iCol){
-		return this.each(function(){
-			var $t= this, fr;
-			if (!$t.grid || $t.p.cellEdit !== true) {return;}
-			if ( $t.p.savedRow.length >= 1) {fr = 0;} else {fr=null;} 
-			if(fr !== null) {
-				var cc = $("td:eq("+iCol+")",$t.rows[iRow]),v,v2,
-				cm = $t.p.colModel[iCol], nm = cm.name, nmjq = $.jgrid.jqID(nm) ;
-				switch (cm.edittype) {
-					case "select":
-						if(!cm.editoptions.multiple) {
-							v = $("#"+iRow+"_"+nmjq+">option:selected",$t.rows[iRow]).val();
-							v2 = $("#"+iRow+"_"+nmjq+">option:selected",$t.rows[iRow]).text();
-						} else {
-							var sel = $("#"+iRow+"_"+nmjq,$t.rows[iRow]), selectedText = [];
-							v = $(sel).val();
-							if(v) { v.join(",");} else { v=""; }
-							$("option:selected",sel).each(
-								function(i,selected){
-									selectedText[i] = $(selected).text();
-								}
-							);
-							v2 = selectedText.join(",");
-						}
-						if(cm.formatter) { v2 = v; }
-						break;
-					case "checkbox":
-						var cbv  = ["Yes","No"];
-						if(cm.editoptions){
-							cbv = cm.editoptions.value.split(":");
-						}
-						v = $("#"+iRow+"_"+nmjq,$t.rows[iRow]).attr("checked") ? cbv[0] : cbv[1];
-						v2=v;
-						break;
-					case "password":
-					case "text":
-					case "textarea":
-					case "button" :
-						v = $("#"+iRow+"_"+nmjq,$t.rows[iRow]).val();
-						v2=v;
-						break;
-					case 'custom' :
-						try {
-							if(cm.editoptions && $.isFunction(cm.editoptions.custom_value)) {
-								v = cm.editoptions.custom_value($(".customelement",cc),'get');
-								if (v===undefined) { throw "e2";} else { v2=v; }
-							} else { throw "e1"; }
-						} catch (e) {
-							if (e=="e1") { info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+$.jgrid.edit.msg.nodefined,jQuery.jgrid.edit.bClose); }
-							if (e=="e2") { info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+$.jgrid.edit.msg.novalue,jQuery.jgrid.edit.bClose); }
-							else {info_dialog(jQuery.jgrid.errors.errcap,e.message,jQuery.jgrid.edit.bClose); }
-						}
-						break;
-				}
-				// The common approach is if nothing changed do not do anything
-				if (v2 != $t.p.savedRow[fr].v){
-					if ($.isFunction($t.p.beforeSaveCell)) {
-						var vv = $t.p.beforeSaveCell($t.rows[iRow].id,nm, v, iRow,iCol);
-						if (vv) {v = vv;}
-					}
-					var cv = checkValues(v,iCol,$t);
-					if(cv[0] === true) {
-						var addpost = {};
-						if ($.isFunction($t.p.beforeSubmitCell)) {
-							addpost = $t.p.beforeSubmitCell($t.rows[iRow].id,nm, v, iRow,iCol);
-							if (!addpost) {addpost={};}
-						}
-						if( $("input.hasDatepicker",cc).length >0) { $("input.hasDatepicker",cc).datepicker('hide'); }
-						if ($t.p.cellsubmit == 'remote') {
-							if ($t.p.cellurl) {
-								var postdata = {};
-								if($t.p.autoencode) { v = $.jgrid.htmlEncode(v); }
-								postdata[nm] = v;
-								var idname,oper, opers;
-								opers = $t.p.prmNames;
-								idname = opers.id;
-								oper = opers.oper;
-								postdata[idname] = $t.rows[iRow].id;
-								postdata[oper] = opers.editoper;
-								postdata = $.extend(addpost,postdata);
-								$("#lui_"+$t.p.id).show();
-								$t.grid.hDiv.loading = true;
-								$.ajax( $.extend( {
-									url: $t.p.cellurl,
-									data :$.isFunction($t.p.serializeCellData) ? $t.p.serializeCellData(postdata) : postdata,
-									type: "POST",
-									complete: function (result, stat) {
-										$("#lui_"+$t.p.id).hide();
-										$t.grid.hDiv.loading = false;
-										if (stat == 'success') {
-											if ($.isFunction($t.p.afterSubmitCell)) {
-												var ret = $t.p.afterSubmitCell(result,postdata.id,nm,v,iRow,iCol);
-												if(ret[0] === true) {
-													$(cc).empty();
-													$($t).jqGrid("setCell",$t.rows[iRow].id, iCol, v2, false, false, true);
-													$(cc).addClass("dirty-cell");
-													$($t.rows[iRow]).addClass("edited");
-													if ($.isFunction($t.p.afterSaveCell)) {
-														$t.p.afterSaveCell($t.rows[iRow].id,nm, v, iRow,iCol);
-													}
-													$t.p.savedRow.splice(0,1);
-												} else {
-													info_dialog($.jgrid.errors.errcap,ret[1],$.jgrid.edit.bClose);
-													$($t).jqGrid("restoreCell",iRow,iCol);
-												}
-											} else {
-												$(cc).empty();
-												$($t).jqGrid("setCell",$t.rows[iRow].id, iCol, v2, false, false, true);
-												$(cc).addClass("dirty-cell");
-												$($t.rows[iRow]).addClass("edited");
-												if ($.isFunction($t.p.afterSaveCell)) {
-													$t.p.afterSaveCell($t.rows[iRow].id,nm, v, iRow,iCol);
-												}
-												$t.p.savedRow.splice(0,1);
-											}
-										}
-									},
-									error:function(res,stat) {
-										$("#lui_"+$t.p.id).hide();
-										$t.grid.hDiv.loading = false;
-										if ($.isFunction($t.p.errorCell)) {
-											$t.p.errorCell(res,stat);
-											$($t).jqGrid("restoreCell",iRow,iCol);
-										} else {
-											info_dialog($.jgrid.errors.errcap,res.status+" : "+res.statusText+"<br/>"+stat,$.jgrid.edit.bClose);
-											$($t).jqGrid("restoreCell",iRow,iCol);
-										}
-									}
-								}, $.jgrid.ajaxOptions, $t.p.ajaxCellOptions || {}));
-							} else {
-								try {
-									info_dialog($.jgrid.errors.errcap,$.jgrid.errors.nourl,$.jgrid.edit.bClose);
-									$($t).jqGrid("restoreCell",iRow,iCol);
-								} catch (e) {}
-							}
-						}
-						if ($t.p.cellsubmit == 'clientArray') {
-							$(cc).empty();
-							$($t).jqGrid("setCell",$t.rows[iRow].id,iCol, v2, false, false, true);
-							$(cc).addClass("dirty-cell");
-							$($t.rows[iRow]).addClass("edited");
-							if ($.isFunction($t.p.afterSaveCell)) {
-								$t.p.afterSaveCell($t.rows[iRow].id,nm, v, iRow,iCol);
-							}
-							$t.p.savedRow.splice(0,1);
-						}
-					} else {
-						try {
-							window.setTimeout(function(){info_dialog($.jgrid.errors.errcap,v+" "+cv[1],$.jgrid.edit.bClose);},100);
-							$($t).jqGrid("restoreCell",iRow,iCol);
-						} catch (e) {}
-					}
-				} else {
-					$($t).jqGrid("restoreCell",iRow,iCol);
-				}
-			}
-			if ($.browser.opera) {
-				$("#"+$t.p.knv).attr("tabindex","-1").focus();
-			} else {
-				window.setTimeout(function () { $("#"+$t.p.knv).attr("tabindex","-1").focus();},0);
-			}
-		});
-	},
-	restoreCell : function(iRow, iCol) {
-		return this.each(function(){
-			var $t= this, fr;
-			if (!$t.grid || $t.p.cellEdit !== true ) {return;}
-			if ( $t.p.savedRow.length >= 1) {fr = 0;} else {fr=null;}
-			if(fr !== null) {
-				var cc = $("td:eq("+iCol+")",$t.rows[iRow]);
-				// datepicker fix
-				if($.isFunction($.fn.datepicker)) {
-					try {
-						$("input.hasDatepicker",cc).datepicker('hide');
-					} catch (e) {}
-				}
-				$(cc).empty().attr("tabindex","-1");
-				$($t).jqGrid("setCell",$t.rows[iRow].id, iCol, $t.p.savedRow[fr].v, false, false, true);
-				$t.p.savedRow.splice(0,1);
-			}
-			window.setTimeout(function () { $("#"+$t.p.knv).attr("tabindex","-1").focus();},0);
-		});
-	},
-	nextCell : function (iRow,iCol) {
-		return this.each(function (){
-			var $t = this, nCol=false;
-			if (!$t.grid || $t.p.cellEdit !== true) {return;}
-			// try to find next editable cell
-			for (var i=iCol+1; i<$t.p.colModel.length; i++) {
-				if ( $t.p.colModel[i].editable ===true) {
-					nCol = i; break;
-				}
-			}
-			if(nCol !== false) {
-				$($t).jqGrid("editCell",iRow,nCol,true);
-			} else {
-				if ($t.p.savedRow.length >0) {
-					$($t).jqGrid("saveCell",iRow,iCol);
-				}
-			}
-		});
-	},
-	prevCell : function (iRow,iCol) {
-		return this.each(function (){
-			var $t = this, nCol=false;
-			if (!$t.grid || $t.p.cellEdit !== true) {return;}
-			// try to find next editable cell
-			for (var i=iCol-1; i>=0; i--) {
-				if ( $t.p.colModel[i].editable ===true) {
-					nCol = i; break;
-				}
-			}
-			if(nCol !== false) {
-				$($t).jqGrid("editCell",iRow,nCol,true);
-			} else {
-				if ($t.p.savedRow.length >0) {
-					$($t).jqGrid("saveCell",iRow,iCol);
-				}
-			}
-		});
-	},
-	GridNav : function() {
-		return this.each(function () {
-			var  $t = this;
-			if (!$t.grid || $t.p.cellEdit !== true ) {return;}
-			// trick to process keydown on non input elements
-			$t.p.knv = $t.p.id + "_kn";
-			var selection = $("<span style='width:0px;height:0px;background-color:black;' tabindex='0'><span tabindex='-1' style='width:0px;height:0px;background-color:grey' id='"+$t.p.knv+"'></span></span>"),
-			i, kdir;
-			$(selection).insertBefore($t.grid.cDiv);
-			$("#"+$t.p.knv)
-			.focus()
-			.keydown(function (e){
-				kdir = e.keyCode;
-				if($t.p.direction == "rtl") {
-					if(kdir==37) { kdir = 39;}
-					else if (kdir==39) { kdir = 37; }
-				}
-				switch (kdir) {
-					case 38:
-						if ($t.p.iRow-1 >=0 ) {
-							scrollGrid($t.p.iRow-1,$t.p.iCol,'vu');
-							$($t).jqGrid("editCell",$t.p.iRow-1,$t.p.iCol,false);
-						}
-					break;
-					case 40 :
-						if ($t.p.iRow+1 <=  $t.rows.length-1) {
-							scrollGrid($t.p.iRow+1,$t.p.iCol,'vd');
-							$($t).jqGrid("editCell",$t.p.iRow+1,$t.p.iCol,false);
-						}
-					break;
-					case 37 :
-						if ($t.p.iCol -1 >=  0) {
-							i = findNextVisible($t.p.iCol-1,'lft');
-							scrollGrid($t.p.iRow, i,'h');
-							$($t).jqGrid("editCell",$t.p.iRow, i,false);
-						}
-					break;
-					case 39 :
-						if ($t.p.iCol +1 <=  $t.p.colModel.length-1) {
-							i = findNextVisible($t.p.iCol+1,'rgt');
-							scrollGrid($t.p.iRow,i,'h');
-							$($t).jqGrid("editCell",$t.p.iRow,i,false);
-						}
-					break;
-					case 13:
-						if (parseInt($t.p.iCol,10)>=0 && parseInt($t.p.iRow,10)>=0) {
-							$($t).jqGrid("editCell",$t.p.iRow,$t.p.iCol,true);
-						}
-					break;
-				}
-				return false;
-			});
-			function scrollGrid(iR, iC, tp){
-				if (tp.substr(0,1)=='v') {
-					var ch = $($t.grid.bDiv)[0].clientHeight,
-					st = $($t.grid.bDiv)[0].scrollTop,
-					nROT = $t.rows[iR].offsetTop+$t.rows[iR].clientHeight,
-					pROT = $t.rows[iR].offsetTop;
-					if(tp == 'vd') {
-						if(nROT >= ch) {
-							$($t.grid.bDiv)[0].scrollTop = $($t.grid.bDiv)[0].scrollTop + $t.rows[iR].clientHeight;
-						}
-					}
-					if(tp == 'vu'){					
-						if (pROT < st) {
-							$($t.grid.bDiv)[0].scrollTop = $($t.grid.bDiv)[0].scrollTop - $t.rows[iR].clientHeight;
-						}
-					}
-				}
-				if(tp=='h') {
-					var cw = $($t.grid.bDiv)[0].clientWidth,
-					sl = $($t.grid.bDiv)[0].scrollLeft,
-					nCOL = $t.rows[iR].cells[iC].offsetLeft+$t.rows[iR].cells[iC].clientWidth,
-					pCOL = $t.rows[iR].cells[iC].offsetLeft;
-					if(nCOL >= cw+parseInt(sl,10)) {
-						$($t.grid.bDiv)[0].scrollLeft = $($t.grid.bDiv)[0].scrollLeft + $t.rows[iR].cells[iC].clientWidth;
-					} else if (pCOL < sl) {
-						$($t.grid.bDiv)[0].scrollLeft = $($t.grid.bDiv)[0].scrollLeft - $t.rows[iR].cells[iC].clientWidth;
-					}
-				}
-			}
-			function findNextVisible(iC,act){
-				var ind, i;
-				if(act == 'lft') {
-					ind = iC+1;
-					for (i=iC;i>=0;i--){
-						if ($t.p.colModel[i].hidden !== true) {
-							ind = i;
-							break;
-						}
-					}
-				}
-				if(act == 'rgt') {
-					ind = iC-1;
-					for (i=iC; i<$t.p.colModel.length;i++){
-						if ($t.p.colModel[i].hidden !== true) {
-							ind = i;
-							break;
-						}						
-					}
-				}
-				return ind;
-			}
-		});
-	},
-	getChangedCells : function (mthd) {
-		var ret=[];
-		if (!mthd) {mthd='all';}
-		this.each(function(){
-			var $t= this,nm;
-			if (!$t.grid || $t.p.cellEdit !== true ) {return;}
-			$($t.rows).each(function(j){
-				var res = {};
-				if ($(this).hasClass("edited")) {
-					$('td',this).each( function(i) {
-						nm = $t.p.colModel[i].name;
-						if ( nm !== 'cb' && nm !== 'subgrid') {
-							if (mthd=='dirty') {
-								if ($(this).hasClass('dirty-cell')) {
-									try {
-										res[nm] = $.unformat(this,{rowId:$t.rows[j].id, colModel:$t.p.colModel[i]},i);
-									} catch (e){
-										res[nm] = $.jgrid.htmlDecode($(this).html());
-									}
-								}
-							} else {
-								try {
-									res[nm] = $.unformat(this,{rowId:$t.rows[j].id,colModel:$t.p.colModel[i]},i);
-								} catch (e) {
-									res[nm] = $.jgrid.htmlDecode($(this).html());
-								}
-							}
-						}
-					});
-					res.id = this.id;
-					ret.push(res);
-				}
-			});
-		});
-		return ret;
-	}
-/// end  cell editing
-});
-})(jQuery);
+;(function($){
+/*
+**
+ * jqGrid extension for cellediting Grid Data
+ * Tony Tomov tony@trirand.com
+ * http://trirand.com/blog/ 
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl-2.0.html
+**/ 
+/**
+ * all events and options here are aded anonynous and not in the base grid
+ * since the array is to big. Here is the order of execution.
+ * From this point we use jQuery isFunction
+ * formatCell
+ * beforeEditCell,
+ * onSelectCell (used only for noneditable cels)
+ * afterEditCell,
+ * beforeSaveCell, (called before validation of values if any)
+ * beforeSubmitCell (if cellsubmit remote (ajax))
+ * afterSubmitCell(if cellsubmit remote (ajax)),
+ * afterSaveCell,
+ * errorCell,
+ * serializeCellData - new
+ * Options
+ * cellsubmit (remote,clientArray) (added in grid options)
+ * cellurl
+ * ajaxCellOptions
+* */
+$.jgrid.extend({
+	editCell : function (iRow,iCol, ed){
+		return this.each(function (){
+			var $t = this, nm, tmp,cc, cm;
+			if (!$t.grid || $t.p.cellEdit !== true) {return;}
+			iCol = parseInt(iCol,10);
+			// select the row that can be used for other methods
+			$t.p.selrow = $t.rows[iRow].id;
+			if (!$t.p.knv) {$($t).jqGrid("GridNav");}
+			// check to see if we have already edited cell
+			if ($t.p.savedRow.length>0) {
+				// prevent second click on that field and enable selects
+				if (ed===true ) {
+					if(iRow == $t.p.iRow && iCol == $t.p.iCol){
+						return;
+					}
+				}
+				// save the cell
+				$($t).jqGrid("saveCell",$t.p.savedRow[0].id,$t.p.savedRow[0].ic);
+			} else {
+				window.setTimeout(function () { $("#"+$t.p.knv).attr("tabindex","-1").focus();},0);
+			}
+			cm = $t.p.colModel[iCol];
+			nm = cm.name;
+			if (nm=='subgrid' || nm=='cb' || nm=='rn') {return;}
+			cc = $("td:eq("+iCol+")",$t.rows[iRow]);
+			if (cm.editable===true && ed===true && !cc.hasClass("not-editable-cell")) {
+				if(parseInt($t.p.iCol,10)>=0  && parseInt($t.p.iRow,10)>=0) {
+					$("td:eq("+$t.p.iCol+")",$t.rows[$t.p.iRow]).removeClass("edit-cell ui-state-highlight");
+					$($t.rows[$t.p.iRow]).removeClass("selected-row ui-state-hover");
+				}
+				$(cc).addClass("edit-cell ui-state-highlight");
+				$($t.rows[iRow]).addClass("selected-row ui-state-hover");
+				try {
+					tmp =  $.unformat(cc,{rowId: $t.rows[iRow].id, colModel:cm},iCol);
+				} catch (_) {
+					tmp = ( cm.edittype && cm.edittype == 'textarea' ) ? $(cc).text() : $(cc).html();
+				}
+				if($t.p.autoencode) { tmp = $.jgrid.htmlDecode(tmp); }
+				if (!cm.edittype) {cm.edittype = "text";}
+				$t.p.savedRow.push({id:iRow,ic:iCol,name:nm,v:tmp});
+				if(tmp == "&nbsp;" || tmp == "&#160;" || (tmp.length==1 && tmp.charCodeAt(0)==160) ) {tmp='';}
+				if($.isFunction($t.p.formatCell)) {
+					var tmp2 = $t.p.formatCell.call($t, $t.rows[iRow].id,nm,tmp,iRow,iCol);
+					if(tmp2 !== undefined ) {tmp = tmp2;}
+				}
+				var opt = $.extend({}, cm.editoptions || {} ,{id:iRow+"_"+nm,name:nm});
+				var elc = $.jgrid.createEl(cm.edittype,opt,tmp,true,$.extend({},$.jgrid.ajaxOptions,$t.p.ajaxSelectOptions || {}));
+				if ($.isFunction($t.p.beforeEditCell)) {
+					$t.p.beforeEditCell.call($t, $t.rows[iRow].id,nm,tmp,iRow,iCol);
+				}
+				$(cc).html("").append(elc).attr("tabindex","0");
+				window.setTimeout(function () { $(elc).focus();},0);
+				$("input, select, textarea",cc).bind("keydown",function(e) { 
+					if (e.keyCode === 27) {
+						if($("input.hasDatepicker",cc).length >0) {
+							if( $(".ui-datepicker").is(":hidden") )  { $($t).jqGrid("restoreCell",iRow,iCol); }
+							else { $("input.hasDatepicker",cc).datepicker('hide'); }
+						} else {
+							$($t).jqGrid("restoreCell",iRow,iCol);
+						}
+					} //ESC
+					if (e.keyCode === 13) {$($t).jqGrid("saveCell",iRow,iCol);}//Enter
+					if (e.keyCode == 9)  {
+						if(!$t.grid.hDiv.loading ) {
+							if (e.shiftKey) {$($t).jqGrid("prevCell",iRow,iCol);} //Shift TAb
+							else {$($t).jqGrid("nextCell",iRow,iCol);} //Tab
+						} else {
+							return false;
+						}
+					}
+					e.stopPropagation();
+				});
+				if ($.isFunction($t.p.afterEditCell)) {
+					$t.p.afterEditCell.call($t, $t.rows[iRow].id,nm,tmp,iRow,iCol);
+				}
+			} else {
+				if (parseInt($t.p.iCol,10)>=0  && parseInt($t.p.iRow,10)>=0) {
+					$("td:eq("+$t.p.iCol+")",$t.rows[$t.p.iRow]).removeClass("edit-cell ui-state-highlight");
+					$($t.rows[$t.p.iRow]).removeClass("selected-row ui-state-hover");
+				}
+				cc.addClass("edit-cell ui-state-highlight");
+				$($t.rows[iRow]).addClass("selected-row ui-state-hover"); 
+				if ($.isFunction($t.p.onSelectCell)) {
+					tmp = cc.html().replace(/\&#160\;/ig,'');
+					$t.p.onSelectCell.call($t, $t.rows[iRow].id,nm,tmp,iRow,iCol);
+				}
+			}
+			$t.p.iCol = iCol; $t.p.iRow = iRow;
+		});
+	},
+	saveCell : function (iRow, iCol){
+		return this.each(function(){
+			var $t= this, fr;
+			if (!$t.grid || $t.p.cellEdit !== true) {return;}
+			if ( $t.p.savedRow.length >= 1) {fr = 0;} else {fr=null;} 
+			if(fr !== null) {
+				var cc = $("td:eq("+iCol+")",$t.rows[iRow]),v,v2,
+				cm = $t.p.colModel[iCol], nm = cm.name, nmjq = $.jgrid.jqID(nm) ;
+				switch (cm.edittype) {
+					case "select":
+						if(!cm.editoptions.multiple) {
+							v = $("#"+iRow+"_"+nmjq+">option:selected",$t.rows[iRow]).val();
+							v2 = $("#"+iRow+"_"+nmjq+">option:selected",$t.rows[iRow]).text();
+						} else {
+							var sel = $("#"+iRow+"_"+nmjq,$t.rows[iRow]), selectedText = [];
+							v = $(sel).val();
+							if(v) { v.join(",");} else { v=""; }
+							$("option:selected",sel).each(
+								function(i,selected){
+									selectedText[i] = $(selected).text();
+								}
+							);
+							v2 = selectedText.join(",");
+						}
+						if(cm.formatter) { v2 = v; }
+						break;
+					case "checkbox":
+						var cbv  = ["Yes","No"];
+						if(cm.editoptions){
+							cbv = cm.editoptions.value.split(":");
+						}
+						v = $("#"+iRow+"_"+nmjq,$t.rows[iRow]).is(":checked") ? cbv[0] : cbv[1];
+						v2=v;
+						break;
+					case "password":
+					case "text":
+					case "textarea":
+					case "button" :
+						v = $("#"+iRow+"_"+nmjq,$t.rows[iRow]).val();
+						v2=v;
+						break;
+					case 'custom' :
+						try {
+							if(cm.editoptions && $.isFunction(cm.editoptions.custom_value)) {
+								v = cm.editoptions.custom_value.call($t, $(".customelement",cc),'get');
+								if (v===undefined) { throw "e2";} else { v2=v; }
+							} else { throw "e1"; }
+						} catch (e) {
+							if (e=="e1") { $.jgrid.info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+$.jgrid.edit.msg.nodefined,jQuery.jgrid.edit.bClose); }
+							if (e=="e2") { $.jgrid.info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+$.jgrid.edit.msg.novalue,jQuery.jgrid.edit.bClose); }
+							else {$.jgrid.info_dialog(jQuery.jgrid.errors.errcap,e.message,jQuery.jgrid.edit.bClose); }
+						}
+						break;
+				}
+				// The common approach is if nothing changed do not do anything
+				if (v2 !== $t.p.savedRow[fr].v){
+					if ($.isFunction($t.p.beforeSaveCell)) {
+						var vv = $t.p.beforeSaveCell.call($t, $t.rows[iRow].id,nm, v, iRow,iCol);
+						if (vv) {v = vv; v2=vv;}
+					}
+					var cv = $.jgrid.checkValues(v,iCol,$t);
+					if(cv[0] === true) {
+						var addpost = {};
+						if ($.isFunction($t.p.beforeSubmitCell)) {
+							addpost = $t.p.beforeSubmitCell.call($t, $t.rows[iRow].id,nm, v, iRow,iCol);
+							if (!addpost) {addpost={};}
+						}
+						if( $("input.hasDatepicker",cc).length >0) { $("input.hasDatepicker",cc).datepicker('hide'); }
+						if ($t.p.cellsubmit == 'remote') {
+							if ($t.p.cellurl) {
+								var postdata = {};
+								if($t.p.autoencode) { v = $.jgrid.htmlEncode(v); }
+								postdata[nm] = v;
+								var idname,oper, opers;
+								opers = $t.p.prmNames;
+								idname = opers.id;
+								oper = opers.oper;
+								postdata[idname] = $.jgrid.stripPref($t.p.idPrefix, $t.rows[iRow].id);
+								postdata[oper] = opers.editoper;
+								postdata = $.extend(addpost,postdata);
+								$("#lui_"+$t.p.id).show();
+								$t.grid.hDiv.loading = true;
+								$.ajax( $.extend( {
+									url: $t.p.cellurl,
+									data :$.isFunction($t.p.serializeCellData) ? $t.p.serializeCellData.call($t, postdata) : postdata,
+									type: "POST",
+									complete: function (result, stat) {
+										$("#lui_"+$t.p.id).hide();
+										$t.grid.hDiv.loading = false;
+										if (stat == 'success') {
+											if ($.isFunction($t.p.afterSubmitCell)) {
+												var ret = $t.p.afterSubmitCell.call($t, result,postdata.id,nm,v,iRow,iCol);
+												if(ret[0] === true) {
+													$(cc).empty();
+													$($t).jqGrid("setCell",$t.rows[iRow].id, iCol, v2, false, false, true);
+													$(cc).addClass("dirty-cell");
+													$($t.rows[iRow]).addClass("edited");
+													if ($.isFunction($t.p.afterSaveCell)) {
+														$t.p.afterSaveCell.call($t, $t.rows[iRow].id,nm, v, iRow,iCol);
+													}
+													$t.p.savedRow.splice(0,1);
+												} else {
+													$.jgrid.info_dialog($.jgrid.errors.errcap,ret[1],$.jgrid.edit.bClose);
+													$($t).jqGrid("restoreCell",iRow,iCol);
+												}
+											} else {
+												$(cc).empty();
+												$($t).jqGrid("setCell",$t.rows[iRow].id, iCol, v2, false, false, true);
+												$(cc).addClass("dirty-cell");
+												$($t.rows[iRow]).addClass("edited");
+												if ($.isFunction($t.p.afterSaveCell)) {
+													$t.p.afterSaveCell.call($t, $t.rows[iRow].id,nm, v, iRow,iCol);
+												}
+												$t.p.savedRow.splice(0,1);
+											}
+										}
+									},
+									error:function(res,stat) {
+										$("#lui_"+$t.p.id).hide();
+										$t.grid.hDiv.loading = false;
+										if ($.isFunction($t.p.errorCell)) {
+											$t.p.errorCell.call($t, res,stat);
+											$($t).jqGrid("restoreCell",iRow,iCol);
+										} else {
+											$.jgrid.info_dialog($.jgrid.errors.errcap,res.status+" : "+res.statusText+"<br/>"+stat,$.jgrid.edit.bClose);
+											$($t).jqGrid("restoreCell",iRow,iCol);
+										}
+									}
+								}, $.jgrid.ajaxOptions, $t.p.ajaxCellOptions || {}));
+							} else {
+								try {
+									$.jgrid.info_dialog($.jgrid.errors.errcap,$.jgrid.errors.nourl,$.jgrid.edit.bClose);
+									$($t).jqGrid("restoreCell",iRow,iCol);
+								} catch (e) {}
+							}
+						}
+						if ($t.p.cellsubmit == 'clientArray') {
+							$(cc).empty();
+							$($t).jqGrid("setCell",$t.rows[iRow].id,iCol, v2, false, false, true);
+							$(cc).addClass("dirty-cell");
+							$($t.rows[iRow]).addClass("edited");
+							if ($.isFunction($t.p.afterSaveCell)) {
+								$t.p.afterSaveCell.call($t, $t.rows[iRow].id,nm, v, iRow,iCol);
+							}
+							$t.p.savedRow.splice(0,1);
+						}
+					} else {
+						try {
+							window.setTimeout(function(){$.jgrid.info_dialog($.jgrid.errors.errcap,v+" "+cv[1],$.jgrid.edit.bClose);},100);
+							$($t).jqGrid("restoreCell",iRow,iCol);
+						} catch (e) {}
+					}
+				} else {
+					$($t).jqGrid("restoreCell",iRow,iCol);
+				}
+			}
+			if ($.browser.opera) {
+				$("#"+$t.p.knv).attr("tabindex","-1").focus();
+			} else {
+				window.setTimeout(function () { $("#"+$t.p.knv).attr("tabindex","-1").focus();},0);
+			}
+		});
+	},
+	restoreCell : function(iRow, iCol) {
+		return this.each(function(){
+			var $t= this, fr;
+			if (!$t.grid || $t.p.cellEdit !== true ) {return;}
+			if ( $t.p.savedRow.length >= 1) {fr = 0;} else {fr=null;}
+			if(fr !== null) {
+				var cc = $("td:eq("+iCol+")",$t.rows[iRow]);
+				// datepicker fix
+				if($.isFunction($.fn.datepicker)) {
+					try {
+						$("input.hasDatepicker",cc).datepicker('hide');
+					} catch (e) {}
+				}
+				$(cc).empty().attr("tabindex","-1");
+				$($t).jqGrid("setCell",$t.rows[iRow].id, iCol, $t.p.savedRow[fr].v, false, false, true);
+				if ($.isFunction($t.p.afterRestoreCell)) {
+					$t.p.afterRestoreCell.call($t, $t.rows[iRow].id, $t.p.savedRow[fr].v, iRow, iCol);
+				}				
+				$t.p.savedRow.splice(0,1);
+			}
+			window.setTimeout(function () { $("#"+$t.p.knv).attr("tabindex","-1").focus();},0);
+		});
+	},
+	nextCell : function (iRow,iCol) {
+		return this.each(function (){
+			var $t = this, nCol=false;
+			if (!$t.grid || $t.p.cellEdit !== true) {return;}
+			// try to find next editable cell
+			for (var i=iCol+1; i<$t.p.colModel.length; i++) {
+				if ( $t.p.colModel[i].editable ===true) {
+					nCol = i; break;
+				}
+			}
+			if(nCol !== false) {
+				$($t).jqGrid("editCell",iRow,nCol,true);
+			} else {
+				if ($t.p.savedRow.length >0) {
+					$($t).jqGrid("saveCell",iRow,iCol);
+				}
+			}
+		});
+	},
+	prevCell : function (iRow,iCol) {
+		return this.each(function (){
+			var $t = this, nCol=false;
+			if (!$t.grid || $t.p.cellEdit !== true) {return;}
+			// try to find next editable cell
+			for (var i=iCol-1; i>=0; i--) {
+				if ( $t.p.colModel[i].editable ===true) {
+					nCol = i; break;
+				}
+			}
+			if(nCol !== false) {
+				$($t).jqGrid("editCell",iRow,nCol,true);
+			} else {
+				if ($t.p.savedRow.length >0) {
+					$($t).jqGrid("saveCell",iRow,iCol);
+				}
+			}
+		});
+	},
+	GridNav : function() {
+		return this.each(function () {
+			var  $t = this;
+			if (!$t.grid || $t.p.cellEdit !== true ) {return;}
+			// trick to process keydown on non input elements
+			$t.p.knv = $t.p.id + "_kn";
+			var selection = $("<span style='width:0px;height:0px;background-color:black;' tabindex='0'><span tabindex='-1' style='width:0px;height:0px;background-color:grey' id='"+$t.p.knv+"'></span></span>"),
+			i, kdir;
+			$(selection).insertBefore($t.grid.cDiv);
+			$("#"+$t.p.knv)
+			.focus()
+			.keydown(function (e){
+				kdir = e.keyCode;
+				if($t.p.direction == "rtl") {
+					if(kdir==37) { kdir = 39;}
+					else if (kdir==39) { kdir = 37; }
+				}
+				switch (kdir) {
+					case 38:
+						if ($t.p.iRow-1 >0 ) {
+							scrollGrid($t.p.iRow-1,$t.p.iCol,'vu');
+							$($t).jqGrid("editCell",$t.p.iRow-1,$t.p.iCol,false);
+						}
+					break;
+					case 40 :
+						if ($t.p.iRow+1 <=  $t.rows.length-1) {
+							scrollGrid($t.p.iRow+1,$t.p.iCol,'vd');
+							$($t).jqGrid("editCell",$t.p.iRow+1,$t.p.iCol,false);
+						}
+					break;
+					case 37 :
+						if ($t.p.iCol -1 >=  0) {
+							i = findNextVisible($t.p.iCol-1,'lft');
+							scrollGrid($t.p.iRow, i,'h');
+							$($t).jqGrid("editCell",$t.p.iRow, i,false);
+						}
+					break;
+					case 39 :
+						if ($t.p.iCol +1 <=  $t.p.colModel.length-1) {
+							i = findNextVisible($t.p.iCol+1,'rgt');
+							scrollGrid($t.p.iRow,i,'h');
+							$($t).jqGrid("editCell",$t.p.iRow,i,false);
+						}
+					break;
+					case 13:
+						if (parseInt($t.p.iCol,10)>=0 && parseInt($t.p.iRow,10)>=0) {
+							$($t).jqGrid("editCell",$t.p.iRow,$t.p.iCol,true);
+						}
+					break;
+				}
+				return false;
+			});
+			function scrollGrid(iR, iC, tp){
+				if (tp.substr(0,1)=='v') {
+					var ch = $($t.grid.bDiv)[0].clientHeight,
+					st = $($t.grid.bDiv)[0].scrollTop,
+					nROT = $t.rows[iR].offsetTop+$t.rows[iR].clientHeight,
+					pROT = $t.rows[iR].offsetTop;
+					if(tp == 'vd') {
+						if(nROT >= ch) {
+							$($t.grid.bDiv)[0].scrollTop = $($t.grid.bDiv)[0].scrollTop + $t.rows[iR].clientHeight;
+						}
+					}
+					if(tp == 'vu'){
+						if (pROT < st ) {
+							$($t.grid.bDiv)[0].scrollTop = $($t.grid.bDiv)[0].scrollTop - $t.rows[iR].clientHeight;
+						}
+					}
+				}
+				if(tp=='h') {
+					var cw = $($t.grid.bDiv)[0].clientWidth,
+					sl = $($t.grid.bDiv)[0].scrollLeft,
+					nCOL = $t.rows[iR].cells[iC].offsetLeft+$t.rows[iR].cells[iC].clientWidth,
+					pCOL = $t.rows[iR].cells[iC].offsetLeft;
+					if(nCOL >= cw+parseInt(sl,10)) {
+						$($t.grid.bDiv)[0].scrollLeft = $($t.grid.bDiv)[0].scrollLeft + $t.rows[iR].cells[iC].clientWidth;
+					} else if (pCOL < sl) {
+						$($t.grid.bDiv)[0].scrollLeft = $($t.grid.bDiv)[0].scrollLeft - $t.rows[iR].cells[iC].clientWidth;
+					}
+				}
+			}
+			function findNextVisible(iC,act){
+				var ind, i;
+				if(act == 'lft') {
+					ind = iC+1;
+					for (i=iC;i>=0;i--){
+						if ($t.p.colModel[i].hidden !== true) {
+							ind = i;
+							break;
+						}
+					}
+				}
+				if(act == 'rgt') {
+					ind = iC-1;
+					for (i=iC; i<$t.p.colModel.length;i++){
+						if ($t.p.colModel[i].hidden !== true) {
+							ind = i;
+							break;
+						}						
+					}
+				}
+				return ind;
+			}
+		});
+	},
+	getChangedCells : function (mthd) {
+		var ret=[];
+		if (!mthd) {mthd='all';}
+		this.each(function(){
+			var $t= this,nm;
+			if (!$t.grid || $t.p.cellEdit !== true ) {return;}
+			$($t.rows).each(function(j){
+				var res = {};
+				if ($(this).hasClass("edited")) {
+					$('td',this).each( function(i) {
+						nm = $t.p.colModel[i].name;
+						if ( nm !== 'cb' && nm !== 'subgrid') {
+							if (mthd=='dirty') {
+								if ($(this).hasClass('dirty-cell')) {
+									try {
+										res[nm] = $.unformat(this,{rowId:$t.rows[j].id, colModel:$t.p.colModel[i]},i);
+									} catch (e){
+										res[nm] = $.jgrid.htmlDecode($(this).html());
+									}
+								}
+							} else {
+								try {
+									res[nm] = $.unformat(this,{rowId:$t.rows[j].id,colModel:$t.p.colModel[i]},i);
+								} catch (e) {
+									res[nm] = $.jgrid.htmlDecode($(this).html());
+								}
+							}
+						}
+					});
+					res.id = this.id;
+					ret.push(res);
+				}
+			});
+		});
+		return ret;
+	}
+/// end  cell editing
+});
+})(jQuery);
Index: controlies/trunk/applications/controlies/static/js/jdgrid/css/ui.jqgrid.css
===================================================================
--- controlies/trunk/applications/controlies/static/js/jdgrid/css/ui.jqgrid.css	(revision 240)
+++ controlies/trunk/applications/controlies/static/js/jdgrid/css/ui.jqgrid.css	(revision 241)
@@ -1,2 +1,136 @@
-.ui-jqgrid{position:relative;font-size:11px;}.ui-jqgrid .ui-jqgrid-view{position:relative;left:0;top:0;padding:.0em;}.ui-jqgrid .ui-jqgrid-titlebar{padding:.3em .2em .2em .3em;position:relative;border-left:0 none;border-right:0 none;border-top:0 none;}.ui-jqgrid .ui-jqgrid-title{float:left;margin:.1em 0 .2em;}.ui-jqgrid .ui-jqgrid-titlebar-close{position:absolute;top:50%;width:19px;margin:-10px 0 0 0;padding:1px;height:18px;}.ui-jqgrid .ui-jqgrid-titlebar-close span{display:block;margin:1px;}.ui-jqgrid .ui-jqgrid-titlebar-close:hover{padding:0;}.ui-jqgrid .ui-jqgrid-hdiv{position:relative;margin:0;padding:0;overflow-x:hidden;overflow-y:auto;border-left:0 none!important;border-top:0 none!important;border-right:0 none!important;}.ui-jqgrid .ui-jqgrid-hbox{float:left;padding-right:20px;}.ui-jqgrid .ui-jqgrid-htable{table-layout:fixed;margin:0;}.ui-jqgrid .ui-jqgrid-htable th{height:22px;padding:0 2px 0 2px;}.ui-jqgrid .ui-jqgrid-htable th div{overflow:hidden;position:relative;height:17px;}.ui-th-column,.ui-jqgrid .ui-jqgrid-htable th.ui-th-column{overflow:hidden;white-space:nowrap;text-align:center;border-top:0 none;border-bottom:0 none;}.ui-th-ltr,.ui-jqgrid .ui-jqgrid-htable th.ui-th-ltr{border-left:0 none;}.ui-th-rtl,.ui-jqgrid .ui-jqgrid-htable th.ui-th-rtl{border-right:0 none;}.ui-jqgrid .ui-th-div-ie{white-space:nowrap;zoom:1;height:17px;}.ui-jqgrid .ui-jqgrid-resize{height:20px!important;position:relative;cursor:e-resize;display:inline;overflow:hidden;}.ui-jqgrid .ui-grid-ico-sort{overflow:hidden;position:absolute;display:inline;cursor:pointer!important;}.ui-jqgrid .ui-icon-asc{margin-top:-3px;height:12px;}.ui-jqgrid .ui-icon-desc{margin-top:3px;height:12px;}.ui-jqgrid .ui-i-asc{margin-top:0;height:16px;}.ui-jqgrid .ui-i-desc{margin-top:0;margin-left:13px;height:16px;}.ui-jqgrid .ui-jqgrid-sortable{cursor:pointer;}.ui-jqgrid tr.ui-search-toolbar th{border-top-width:1px!important;border-top-color:inherit!important;border-top-style:ridge!important;}tr.ui-search-toolbar input{margin:1px 0 0 0;}tr.ui-search-toolbar select{margin:1px 0 0 0;}.ui-jqgrid .ui-jqgrid-bdiv{position:relative;margin:0;padding:0;overflow:auto;text-align:left;}.ui-jqgrid .ui-jqgrid-btable{table-layout:fixed;margin:0;}.ui-jqgrid tr.jqgrow td{font-weight:normal;overflow:hidden;white-space:pre;height:22px;padding:0 2px 0 2px;border-bottom-width:1px;border-bottom-color:inherit;border-bottom-style:solid;}.ui-jqgrid tr.ui-row-ltr td{text-align:left;border-right-width:1px;border-right-color:inherit;border-right-style:solid;}.ui-jqgrid tr.ui-row-rtl td{text-align:right;border-left-width:1px;border-left-color:inherit;border-left-style:solid;}.ui-jqgrid td.jqgrid-rownum{padding:0 2px 0 2px;margin:0;border:0 none;}.ui-jqgrid .ui-jqgrid-resize-mark{width:2px;left:0;background-color:#777;cursor:e-resize;cursor:col-resize;position:absolute;top:0;height:100px;overflow:hidden;display:none;border:0 none;}.ui-jqgrid .ui-jqgrid-sdiv{position:relative;margin:0;padding:0;overflow:hidden;border-left:0 none!important;border-top:0 none!important;border-right:0 none!important;}.ui-jqgrid .ui-jqgrid-ftable{table-layout:fixed;margin-bottom:0;}.ui-jqgrid tr.footrow td{font-weight:bold;overflow:hidden;white-space:nowrap;height:21px;padding:0 2px 0 2px;border-top-width:1px;border-top-color:inherit;border-top-style:solid;}.ui-jqgrid tr.footrow-ltr td{text-align:left;border-right-width:1px;border-right-color:inherit;border-right-style:solid;}.ui-jqgrid tr.footrow-rtl td{text-align:right;border-left-width:1px;border-left-color:inherit;border-left-style:solid;}.ui-jqgrid .ui-jqgrid-pager{border-left:0 none!important;border-right:0 none!important;border-bottom:0 none!important;margin:0!important;padding:0!important;position:relative;height:25px;white-space:nowrap;overflow:hidden;}.ui-jqgrid .ui-pager-control{position:relative;}.ui-jqgrid .ui-pg-table{position:relative;padding-bottom:2px;width:auto;margin:0;}.ui-jqgrid .ui-pg-table td{font-weight:normal;vertical-align:middle;padding:1px;}.ui-jqgrid .ui-pg-button{height:19px!important;}.ui-jqgrid .ui-pg-button span{display:block;margin:1px;float:left;}.ui-jqgrid .ui-pg-button:hover{padding:0;}.ui-jqgrid .ui-state-disabled:hover{padding:1px;}.ui-jqgrid .ui-pg-input{height:13px;font-size:.8em;margin:0;}.ui-jqgrid .ui-pg-selbox{font-size:.8em;line-height:18px;display:block;height:18px;margin:0;}.ui-jqgrid .ui-separator{height:18px;border-left:1px solid #ccc;border-right:1px solid #ccc;margin:1px;float:right;}.ui-jqgrid .ui-paging-info{font-weight:normal;height:19px;margin-top:3px;margin-right:4px;}.ui-jqgrid .ui-jqgrid-pager .ui-pg-div{padding:1px 0;float:left;list-style-image:none;list-style-position:outside;list-style-type:none;position:relative;}.ui-jqgrid .ui-jqgrid-pager .ui-pg-button{cursor:pointer;}.ui-jqgrid .ui-jqgrid-pager .ui-pg-div span.ui-icon{float:left;margin:0 2px;}.ui-jqgrid td input,.ui-jqgrid td select .ui-jqgrid td textarea{margin:0;}.ui-jqgrid td textarea{width:auto;height:auto;}.ui-jqgrid .ui-jqgrid-toppager{border-left:0 none!important;border-right:0 none!important;border-top:0 none!important;margin:0!important;padding:0!important;position:relative;height:25px!important;white-space:nowrap;overflow:hidden;}.ui-jqgrid .ui-jqgrid-btable .ui-sgcollapsed span{display:block;}.ui-jqgrid .ui-subgrid{margin:0;padding:0;width:100%;}.ui-jqgrid .ui-subgrid table{table-layout:fixed;}.ui-jqgrid .ui-subgrid tr.ui-subtblcell td{height:18px;border-right-width:1px;border-right-color:inherit;border-right-style:solid;border-bottom-width:1px;border-bottom-color:inherit;border-bottom-style:solid;}.ui-jqgrid .ui-subgrid td.subgrid-data{border-top:0 none!important;}.ui-jqgrid .ui-subgrid td.subgrid-cell{border-width:0 0 1px 0;}.ui-jqgrid .ui-th-subgrid{height:20px;}.ui-jqgrid .loading{position:absolute;top:45%;left:45%;width:auto;z-index:101;padding:6px;margin:5px;text-align:center;font-weight:bold;display:none;border-width:2px!important;}.ui-jqgrid .jqgrid-overlay{display:none;z-index:100;}* html .jqgrid-overlay{width:expression(this.parentNode.offsetWidth+'px');height:expression(this.parentNode.offsetHeight+'px');}* .jqgrid-overlay iframe{position:absolute;top:0;left:0;z-index:-1;width:expression(this.parentNode.offsetWidth+'px');height:expression(this.parentNode.offsetHeight+'px');}.ui-jqgrid .ui-userdata{border-left:0 none;border-right:0 none;height:21px;overflow:hidden;}.ui-jqdialog{display:none;width:300px;position:absolute;padding:.2em;font-size:11px;overflow:visible;}.ui-jqdialog .ui-jqdialog-titlebar{padding:.3em .2em;position:relative;}.ui-jqdialog .ui-jqdialog-title{margin:.1em 0 .2em;}.ui-jqdialog .ui-jqdialog-titlebar-close{position:absolute;top:50%;width:19px;margin:-10px 0 0 0;padding:1px;height:18px;}.ui-jqdialog .ui-jqdialog-titlebar-close span{display:block;margin:1px;}.ui-jqdialog .ui-jqdialog-titlebar-close:hover,.ui-jqdialog .ui-jqdialog-titlebar-close:focus{padding:0;}.ui-jqdialog-content,.ui-jqdialog .ui-jqdialog-content{border:0;padding:.3em .2em;background:none;height:auto;}.ui-jqdialog .ui-jqconfirm{padding:.4em 1em;border-width:3px;position:absolute;bottom:10px;right:10px;overflow:visible;display:none;height:80px;width:220px;text-align:center;}.ui-jqdialog-content .FormGrid{margin:0;}.ui-jqdialog-content .EditTable{width:100%;margin-bottom:0;}.ui-jqdialog-content .DelTable{width:100%;margin-bottom:0;}.EditTable td input,.EditTable td select,.EditTable td textarea{margin:0;}.EditTable td textarea{width:auto;height:auto;}.ui-jqdialog-content td.EditButton{text-align:right;border-top:0 none;border-left:0 none;border-right:0 none;padding-bottom:5px;padding-top:5px;}.ui-jqdialog-content td.navButton{text-align:center;border-left:0 none;border-top:0 none;border-right:0 none;padding-bottom:5px;padding-top:5px;}.ui-jqdialog-content .CaptionTD{text-align:left;vertical-align:top;border-left:0 none;border-right:0 none;border-bottom:0 none;padding:1px;white-space:nowrap;}.ui-jqdialog-content .DataTD{padding:1px;border-left:0 none;border-right:0 none;border-bottom:0 none;vertical-align:top;}.ui-jqdialog-content .form-view-data{white-space:pre;}.fm-button{display:inline-block;margin:0 4px 0 0;padding:.4em .5em;text-decoration:none!important;cursor:pointer;position:relative;text-align:center;zoom:1;}.fm-button-icon-left{padding-left:1.9em;}.fm-button-icon-right{padding-right:1.9em;}.fm-button-icon-left .ui-icon{right:auto;left:.2em;margin-left:0;position:absolute;top:50%;margin-top:-8px;}.fm-button-icon-right .ui-icon{left:auto;right:.2em;margin-left:0;position:absolute;top:50%;margin-top:-8px;}#nData,#pData{float:left;margin:3px;padding:0;width:15px;}.ui-jqgrid .selected-row,div.ui-jqgrid .selected-row td{font-style:normal;border-left:0 none;}.ui-jqgrid .tree-wrap{float:left;position:relative;height:18px;white-space:nowrap;overflow:hidden;}.ui-jqgrid .tree-minus{position:absolute;height:18px;width:18px;overflow:hidden;}.ui-jqgrid .tree-plus{position:absolute;height:18px;width:18px;overflow:hidden;}.ui-jqgrid .tree-leaf{position:absolute;height:18px;width:18px;overflow:hidden;}.ui-jqgrid .treeclick{cursor:pointer;}.jqmOverlay{background-color:#000;}* iframe.jqm{position:absolute;top:0;left:0;z-index:-1;width:expression(this.parentNode.offsetWidth+'px');height:expression(this.parentNode.offsetHeight+'px');}.ui-jqgrid-dnd tr td{border-right-width:1px;border-right-color:inherit;border-right-style:solid;height:20px;}.ui-jqgrid .ui-jqgrid-title-rtl{float:right;margin:.1em 0 .2em;}.ui-jqgrid .ui-jqgrid-hbox-rtl{float:right;padding-left:20px;}.ui-jqgrid .ui-jqgrid-resize-ltr{float:right;margin:-2px -2px -2px 0;}.ui-jqgrid .ui-jqgrid-resize-rtl{float:left;margin:-2px 0 -1px -3px;}.ui-jqgrid .ui-sort-rtl{left:0;}.ui-jqgrid .tree-wrap-ltr{float:left;}.ui-jqgrid .tree-wrap-rtl{float:right;}.ui-jqgrid .ui-ellipsis{text-overflow:ellipsis;-moz-binding:url('ellipsis-xbl.xml#ellipsis');}
-.ui-searchFilter{display:none;position:absolute;z-index:770;overflow:visible;}.ui-searchFilter table{position:relative;margin:0;width:auto;}.ui-searchFilter table td{margin:0;padding:1px;}.ui-searchFilter table td input,.ui-searchFilter table td select{margin:.1em;}.ui-searchFilter .ui-state-default{cursor:pointer;}.ui-searchFilter .divider{height:1px;}.ui-searchFilter .divider div{background-color:black;height:1px;}
\ No newline at end of file
+/*Grid*/
+.ui-jqgrid {position: relative; font-size:11px;}
+.ui-jqgrid .ui-jqgrid-view {position: relative;left:0px; top: 0px; padding: .0em;}
+/* caption*/
+.ui-jqgrid .ui-jqgrid-titlebar {padding: .3em .2em .2em .3em; position: relative; border-left: 0px none;border-right: 0px none; border-top: 0px none;}
+.ui-jqgrid .ui-jqgrid-title { float: left; margin: .1em 0 .2em; }
+.ui-jqgrid .ui-jqgrid-titlebar-close { position: absolute;top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height:18px;}.ui-jqgrid .ui-jqgrid-titlebar-close span { display: block; margin: 1px; }
+.ui-jqgrid .ui-jqgrid-titlebar-close:hover { padding: 0; }
+/* header*/
+.ui-jqgrid .ui-jqgrid-hdiv {position: relative; margin: 0em;padding: 0em; overflow-x: hidden; border-left: 0px none !important; border-top : 0px none !important; border-right : 0px none !important;}
+.ui-jqgrid .ui-jqgrid-hbox {float: left; padding-right: 20px;}
+.ui-jqgrid .ui-jqgrid-htable {table-layout:fixed;margin:0em;}
+.ui-jqgrid .ui-jqgrid-htable th {height:22px;padding: 0 2px 0 2px;}
+.ui-jqgrid .ui-jqgrid-htable th div {overflow: hidden; position:relative; height:17px;}
+.ui-th-column, .ui-jqgrid .ui-jqgrid-htable th.ui-th-column {overflow: hidden;white-space: nowrap;text-align:center;border-top : 0px none;border-bottom : 0px none;}
+.ui-th-ltr, .ui-jqgrid .ui-jqgrid-htable th.ui-th-ltr {border-left : 0px none;}
+.ui-th-rtl, .ui-jqgrid .ui-jqgrid-htable th.ui-th-rtl {border-right : 0px none;}
+.ui-first-th-ltr {border-right: 1px solid; }
+.ui-first-th-rtl {border-left: 1px solid; }
+.ui-jqgrid .ui-th-div-ie {white-space: nowrap; zoom :1; height:17px;}
+.ui-jqgrid .ui-jqgrid-resize {height:20px !important;position: relative; cursor :e-resize;display: inline;overflow: hidden;}
+.ui-jqgrid .ui-grid-ico-sort {overflow:hidden;position:absolute;display:inline; cursor: pointer !important;}
+.ui-jqgrid .ui-icon-asc {margin-top:-3px; height:12px;}
+.ui-jqgrid .ui-icon-desc {margin-top:3px;height:12px;}
+.ui-jqgrid .ui-i-asc {margin-top:0px;height:16px;}
+.ui-jqgrid .ui-i-desc {margin-top:0px;margin-left:13px;height:16px;}
+.ui-jqgrid .ui-jqgrid-sortable {cursor:pointer;}
+.ui-jqgrid tr.ui-search-toolbar th { border-top-width: 1px !important; border-top-color: inherit !important; border-top-style: ridge !important }
+tr.ui-search-toolbar input {margin: 1px 0px 0px 0px}
+tr.ui-search-toolbar select {margin: 1px 0px 0px 0px}
+/* body */ 
+.ui-jqgrid .ui-jqgrid-bdiv {position: relative; margin: 0em; padding:0; overflow: auto; text-align:left;}
+.ui-jqgrid .ui-jqgrid-btable {table-layout:fixed; margin:0em; outline-style: none; }
+.ui-jqgrid tr.jqgrow { outline-style: none; }
+.ui-jqgrid tr.jqgroup { outline-style: none; }
+.ui-jqgrid tr.jqgrow td {font-weight: normal; overflow: hidden; white-space: pre; height: 22px;padding: 0 2px 0 2px;border-bottom-width: 1px; border-bottom-color: inherit; border-bottom-style: solid;}
+.ui-jqgrid tr.jqgfirstrow td {padding: 0 2px 0 2px;border-right-width: 1px; border-right-style: solid;}
+.ui-jqgrid tr.jqgroup td {font-weight: normal; overflow: hidden; white-space: pre; height: 22px;padding: 0 2px 0 2px;border-bottom-width: 1px; border-bottom-color: inherit; border-bottom-style: solid;}
+.ui-jqgrid tr.jqfoot td {font-weight: bold; overflow: hidden; white-space: pre; height: 22px;padding: 0 2px 0 2px;border-bottom-width: 1px; border-bottom-color: inherit; border-bottom-style: solid;}
+.ui-jqgrid tr.ui-row-ltr td {text-align:left;border-right-width: 1px; border-right-color: inherit; border-right-style: solid;}
+.ui-jqgrid tr.ui-row-rtl td {text-align:right;border-left-width: 1px; border-left-color: inherit; border-left-style: solid;}
+.ui-jqgrid td.jqgrid-rownum { padding: 0 2px 0 2px; margin: 0px; border: 0px none;}
+.ui-jqgrid .ui-jqgrid-resize-mark { width:2px; left:0; background-color:#777; cursor: e-resize; cursor: col-resize; position:absolute; top:0; height:100px; overflow:hidden; display:none;	border:0 none;}
+/* footer */
+.ui-jqgrid .ui-jqgrid-sdiv {position: relative; margin: 0em;padding: 0em; overflow: hidden; border-left: 0px none !important; border-top : 0px none !important; border-right : 0px none !important;}
+.ui-jqgrid .ui-jqgrid-ftable {table-layout:fixed; margin-bottom:0em;}
+.ui-jqgrid tr.footrow td {font-weight: bold; overflow: hidden; white-space:nowrap; height: 21px;padding: 0 2px 0 2px;border-top-width: 1px; border-top-color: inherit; border-top-style: solid;}
+.ui-jqgrid tr.footrow-ltr td {text-align:left;border-right-width: 1px; border-right-color: inherit; border-right-style: solid;}
+.ui-jqgrid tr.footrow-rtl td {text-align:right;border-left-width: 1px; border-left-color: inherit; border-left-style: solid;}
+/* Pager*/
+.ui-jqgrid .ui-jqgrid-pager { border-left: 0px none !important;border-right: 0px none !important; border-bottom: 0px none !important; margin: 0px !important; padding: 0px !important; position: relative; height: 25px;white-space: nowrap;overflow: hidden;}
+.ui-jqgrid .ui-pager-control {position: relative;}
+.ui-jqgrid .ui-pg-table {position: relative; padding-bottom:2px; width:auto; margin: 0em;}
+.ui-jqgrid .ui-pg-table td {font-weight:normal; vertical-align:middle; padding:1px;}
+.ui-jqgrid .ui-pg-button  { height:19px !important;}
+.ui-jqgrid .ui-pg-button span { display: block; margin: 1px; float:left;}
+.ui-jqgrid .ui-pg-button:hover { padding: 0px; }
+.ui-jqgrid .ui-state-disabled:hover {padding:1px;}
+.ui-jqgrid .ui-pg-input { height:13px;font-size:.8em; margin: 0em;}
+.ui-jqgrid .ui-pg-selbox {font-size:.8em; line-height:18px; display:block; height:18px; margin: 0em;}
+.ui-jqgrid .ui-separator {height: 18px; border-left: 1px solid #ccc ; border-right: 1px solid #ccc ; margin: 1px; float: right;}
+.ui-jqgrid .ui-paging-info {font-weight: normal;height:19px; margin-top:3px;margin-right:4px;}
+.ui-jqgrid .ui-jqgrid-pager .ui-pg-div {padding:1px 0;float:left;list-style-image:none;list-style-position:outside;list-style-type:none;position:relative;}
+.ui-jqgrid .ui-jqgrid-pager .ui-pg-button { cursor:pointer; }
+.ui-jqgrid .ui-jqgrid-pager .ui-pg-div  span.ui-icon {float:left;margin:0 2px;}
+.ui-jqgrid td input, .ui-jqgrid td select .ui-jqgrid td textarea { margin: 0em;}
+.ui-jqgrid td textarea {width:auto;height:auto;}
+.ui-jqgrid .ui-jqgrid-toppager {border-left: 0px none !important;border-right: 0px none !important; border-top: 0px none !important; margin: 0px !important; padding: 0px !important; position: relative; height: 25px !important;white-space: nowrap;overflow: hidden;}
+/*subgrid*/
+.ui-jqgrid .ui-jqgrid-btable .ui-sgcollapsed span {display: block;}
+.ui-jqgrid .ui-subgrid {margin:0em;padding:0em; width:100%;}
+.ui-jqgrid .ui-subgrid table {table-layout: fixed;}
+.ui-jqgrid .ui-subgrid tr.ui-subtblcell td {height:18px;border-right-width: 1px; border-right-color: inherit; border-right-style: solid;border-bottom-width: 1px; border-bottom-color: inherit; border-bottom-style: solid;}
+.ui-jqgrid .ui-subgrid td.subgrid-data {border-top:  0px none !important;}
+.ui-jqgrid .ui-subgrid td.subgrid-cell {border-width: 0px 0px 1px 0px;}
+.ui-jqgrid .ui-th-subgrid {height:20px;}
+/* loading */
+.ui-jqgrid .loading {position: absolute; top: 45%;left: 45%;width: auto;z-index:101;padding: 6px; margin: 5px;text-align: center;font-weight: bold;display: none;border-width: 2px !important;}
+.ui-jqgrid .jqgrid-overlay {display:none;z-index:100;}
+* html .jqgrid-overlay {width: expression(this.parentNode.offsetWidth+'px');height: expression(this.parentNode.offsetHeight+'px');}
+* .jqgrid-overlay iframe {position:absolute;top:0;left:0;z-index:-1;width: expression(this.parentNode.offsetWidth+'px');height: expression(this.parentNode.offsetHeight+'px');}
+/* end loading div */
+/* toolbar */
+.ui-jqgrid .ui-userdata {border-left: 0px none;	border-right: 0px none;	height : 21px;overflow: hidden;	}
+/*Modal Window */
+.ui-jqdialog { display: none; width: 300px; position: absolute; padding: .2em; font-size:11px; overflow:visible;}
+.ui-jqdialog .ui-jqdialog-titlebar { padding: .3em .2em; position: relative;  }
+.ui-jqdialog .ui-jqdialog-title { margin: .1em 0 .2em; } 
+.ui-jqdialog .ui-jqdialog-titlebar-close { position: absolute;  top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; }
+
+.ui-jqdialog .ui-jqdialog-titlebar-close span { display: block; margin: 1px; }
+.ui-jqdialog .ui-jqdialog-titlebar-close:hover, .ui-jqdialog .ui-jqdialog-titlebar-close:focus { padding: 0; }
+.ui-jqdialog-content, .ui-jqdialog .ui-jqdialog-content { border: 0; padding: .3em .2em; background: none; height:auto;}
+.ui-jqdialog .ui-jqconfirm {padding: .4em 1em; border-width:3px;position:absolute;bottom:10px;right:10px;overflow:visible;display:none;height:80px;width:220px;text-align:center;}
+/* end Modal window*/
+/* Form edit */
+.ui-jqdialog-content .FormGrid {margin: 0px;}
+.ui-jqdialog-content .EditTable { width: 100%; margin-bottom:0em;}
+.ui-jqdialog-content .DelTable { width: 100%; margin-bottom:0em;}
+.EditTable td input, .EditTable td select, .EditTable td textarea {margin: 0em;}
+.EditTable td textarea { width:auto; height:auto;}
+.ui-jqdialog-content td.EditButton {text-align: right;border-top: 0px none;border-left: 0px none;border-right: 0px none; padding-bottom:5px; padding-top:5px;}
+.ui-jqdialog-content td.navButton {text-align: center; border-left: 0px none;border-top: 0px none;border-right: 0px none; padding-bottom:5px; padding-top:5px;}
+.ui-jqdialog-content input.FormElement {padding:.3em}
+.ui-jqdialog-content .data-line {padding-top:.1em;border: 0px none;}
+
+.ui-jqdialog-content .CaptionTD {text-align: left; vertical-align: middle;border: 0px none; padding: 2px;white-space: nowrap;}
+.ui-jqdialog-content .DataTD {padding: 2px; border: 0px none; vertical-align: top;}
+.ui-jqdialog-content .form-view-data {white-space:pre}
+.fm-button { display: inline-block; margin:0 4px 0 0; padding: .4em .5em; text-decoration:none !important; cursor:pointer; position: relative; text-align: center; zoom: 1; }
+.fm-button-icon-left { padding-left: 1.9em; }
+.fm-button-icon-right { padding-right: 1.9em; }
+.fm-button-icon-left .ui-icon { right: auto; left: .2em; margin-left: 0; position: absolute; top: 50%; margin-top: -8px; }
+.fm-button-icon-right .ui-icon { left: auto; right: .2em; margin-left: 0; position: absolute; top: 50%; margin-top: -8px;}
+#nData, #pData { float: left; margin:3px;padding: 0; width: 15px; }
+/* End Eorm edit */
+/*.ui-jqgrid .edit-cell {}*/
+.ui-jqgrid .selected-row, div.ui-jqgrid .selected-row td {font-style : normal;border-left: 0px none;}
+/* Tree Grid */
+.ui-jqgrid .tree-wrap {float: left; position: relative;height: 18px;white-space: nowrap;overflow: hidden;}
+.ui-jqgrid .tree-minus {position: absolute; height: 18px; width: 18px; overflow: hidden;}
+.ui-jqgrid .tree-plus {position: absolute;	height: 18px; width: 18px;	overflow: hidden;}
+.ui-jqgrid .tree-leaf {position: absolute;	height: 18px; width: 18px;overflow: hidden;}
+.ui-jqgrid .treeclick {cursor: pointer;}
+/* moda dialog */
+* iframe.jqm {position:absolute;top:0;left:0;z-index:-1;width: expression(this.parentNode.offsetWidth+'px');height: expression(this.parentNode.offsetHeight+'px');}
+.ui-jqgrid-dnd tr td {border-right-width: 1px; border-right-color: inherit; border-right-style: solid; height:20px}
+/* RTL Support */
+.ui-jqgrid .ui-jqgrid-title-rtl {float:right;margin: .1em 0 .2em; }
+.ui-jqgrid .ui-jqgrid-hbox-rtl {float: right; padding-left: 20px;}
+.ui-jqgrid .ui-jqgrid-resize-ltr {float: right;margin: -2px -2px -2px 0px;}
+.ui-jqgrid .ui-jqgrid-resize-rtl {float: left;margin: -2px 0px -1px -3px;}
+.ui-jqgrid .ui-sort-rtl {left:0px;}
+.ui-jqgrid .tree-wrap-ltr {float: left;}
+.ui-jqgrid .tree-wrap-rtl {float: right;}
+.ui-jqgrid .ui-ellipsis {text-overflow:ellipsis; -moz-binding:url('ellipsis-xbl.xml#ellipsis');}
Index: controlies/trunk/applications/controlies/static/js/jdgrid/css/ellipsis-xbl.xml
===================================================================
--- controlies/trunk/applications/controlies/static/js/jdgrid/css/ellipsis-xbl.xml	(revision 240)
+++ controlies/trunk/applications/controlies/static/js/jdgrid/css/ellipsis-xbl.xml	(revision 241)
@@ -1,13 +1,13 @@
-<?xml version="1.0"?>
-<bindings
-    xmlns="http://www.mozilla.org/xbl"
-    xmlns:xbl="http://www.mozilla.org/xbl"
-    xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
-    <binding id="ellipsis">
-        <content>
-            <xul:window><!-- xul:window tag required for FF2 -->
-                <xul:description crop="end" xbl:inherits="value=xbl:text"><children/></xul:description>
-            </xul:window>
-        </content>
-    </binding>
-</bindings>
+<?xml version="1.0"?>
+<bindings
+    xmlns="http://www.mozilla.org/xbl"
+    xmlns:xbl="http://www.mozilla.org/xbl"
+    xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+    <binding id="ellipsis">
+        <content>
+            <xul:window><!-- xul:window tag required for FF2 -->
+                <xul:description crop="end" xbl:inherits="value=xbl:text"><children/></xul:description>
+            </xul:window>
+        </content>
+    </binding>
+</bindings>
Index: controlies/trunk/applications/controlies/static/js/jdgrid/jquery.jqGrid.min.js
===================================================================
--- controlies/trunk/applications/controlies/static/js/jdgrid/jquery.jqGrid.min.js	(revision 240)
+++ controlies/trunk/applications/controlies/static/js/jdgrid/jquery.jqGrid.min.js	(revision 241)
@@ -1,117 +1,487 @@
 /* 
-* jqGrid  3.6.5 - jQuery Grid 
+* jqGrid  4.2.0 - jQuery Grid 
 * Copyright (c) 2008, Tony Tomov, tony@trirand.com 
 * Dual licensed under the MIT and GPL licenses 
 * http://www.opensource.org/licenses/mit-license.php 
 * http://www.gnu.org/licenses/gpl-2.0.html 
-* Date:2010-05-05 
-* Modules: grid.base.js; 
+* Date:2011-10-11 
+* Modules: grid.base.js; jquery.fmatter.js; grid.custom.js; grid.common.js; grid.formedit.js; grid.filter.js; grid.inlinedit.js; grid.celledit.js; jqModal.js; jqDnR.js; grid.subgrid.js; grid.grouping.js; grid.treegrid.js; grid.import.js; JsonXml.js; grid.tbltogrid.js; grid.jqueryui.js; 
 */
-(function(b){b.jgrid=b.jgrid||{};b.extend(b.jgrid,{htmlDecode:function(f){if(f=="&nbsp;"||f=="&#160;"||f.length==1&&f.charCodeAt(0)==160)return"";return!f?f:String(f).replace(/&amp;/g,"&").replace(/&gt;/g,">").replace(/&lt;/g,"<").replace(/&quot;/g,'"')},htmlEncode:function(f){return!f?f:String(f).replace(/&/g,"&amp;").replace(/>/g,"&gt;").replace(/</g,"&lt;").replace(/\"/g,"&quot;")},format:function(f){var k=b.makeArray(arguments).slice(1);if(f===undefined)f="";return f.replace(/\{(\d+)\}/g,function(i,
-h){return k[h]})},getCellIndex:function(f){f=b(f);f=(!f.is("td")&&!f.is("th")?f.closest("td,th"):f)[0];if(b.browser.msie)return b.inArray(f,f.parentNode.cells);return f.cellIndex},stripHtml:function(f){f+="";var k=/<("[^"]*"|'[^']*'|[^'">])*>/gi;if(f)return(f=f.replace(k,""))&&f!=="&nbsp;"&&f!=="&#160;"?f.replace(/\"/g,"'"):"";else return f},stringToDoc:function(f){var k;if(typeof f!=="string")return f;try{k=(new DOMParser).parseFromString(f,"text/xml")}catch(i){k=new ActiveXObject("Microsoft.XMLDOM");
-k.async=false;k.loadXML(f)}return k&&k.documentElement&&k.documentElement.tagName!="parsererror"?k:null},parse:function(f){f=f;if(f.substr(0,9)=="while(1);")f=f.substr(9);if(f.substr(0,2)=="/*")f=f.substr(2,f.length-4);f||(f="{}");return b.jgrid.useJSON===true&&typeof JSON==="object"&&typeof JSON.parse==="function"?JSON.parse(f):eval("("+f+")")},jqID:function(f){f+="";return f.replace(/([\.\:\[\]])/g,"\\$1")},ajaxOptions:{},extend:function(f){b.extend(b.fn.jqGrid,f);this.no_legacy_api||b.fn.extend(f)}});
-b.fn.jqGrid=function(f){if(typeof f=="string"){var k=b.fn.jqGrid[f];if(!k)throw"jqGrid - No such method: "+f;var i=b.makeArray(arguments).slice(1);return k.apply(this,i)}return this.each(function(){if(!this.grid){var h=b.extend(true,{url:"",height:150,page:1,rowNum:20,records:0,pager:"",pgbuttons:true,pginput:true,colModel:[],rowList:[],colNames:[],sortorder:"asc",sortname:"",datatype:"xml",mtype:"GET",altRows:false,selarrrow:[],savedRow:[],shrinkToFit:true,xmlReader:{},jsonReader:{},subGrid:false,
-subGridModel:[],reccount:0,lastpage:0,lastsort:0,selrow:null,beforeSelectRow:null,onSelectRow:null,onSortCol:null,ondblClickRow:null,onRightClickRow:null,onPaging:null,onSelectAll:null,loadComplete:null,gridComplete:null,loadError:null,loadBeforeSend:null,afterInsertRow:null,beforeRequest:null,onHeaderClick:null,viewrecords:false,loadonce:false,multiselect:false,multikey:false,editurl:null,search:false,caption:"",hidegrid:true,hiddengrid:false,postData:{},userData:{},treeGrid:false,treeGridModel:"nested",
-treeReader:{},treeANode:-1,ExpandColumn:null,tree_root_level:0,prmNames:{page:"page",rows:"rows",sort:"sidx",order:"sord",search:"_search",nd:"nd",id:"id",oper:"oper",editoper:"edit",addoper:"add",deloper:"del",subgridid:"id",npage:null},forceFit:false,gridstate:"visible",cellEdit:false,cellsubmit:"remote",nv:0,loadui:"enable",toolbar:[false,""],scroll:false,multiboxonly:false,deselectAfterSort:true,scrollrows:false,autowidth:false,scrollOffset:18,cellLayout:5,subGridWidth:20,multiselectWidth:20,
-gridview:false,rownumWidth:25,rownumbers:false,pagerpos:"center",recordpos:"right",footerrow:false,userDataOnFooter:false,hoverrows:true,altclass:"ui-priority-secondary",viewsortcols:[false,"vertical",true],resizeclass:"",autoencode:false,remapColumns:[],ajaxGridOptions:{},direction:"ltr",toppager:false,headertitles:false,scrollTimeout:200},b.jgrid.defaults,f||{}),g={headers:[],cols:[],footers:[],dragStart:function(c,d,e){this.resizing={idx:c,startX:d.clientX,sOL:e[0]};this.hDiv.style.cursor="col-resize";
-this.curGbox=b("#rs_m"+h.id,"#gbox_"+h.id);this.curGbox.css({display:"block",left:e[0],top:e[1],height:e[2]});b.isFunction(h.resizeStart)&&h.resizeStart.call(this,d,c);document.onselectstart=function(){return false}},dragMove:function(c){if(this.resizing){var d=c.clientX-this.resizing.startX;c=this.headers[this.resizing.idx];var e=h.direction==="ltr"?c.width+d:c.width-d,l;if(e>33){this.curGbox.css({left:this.resizing.sOL+d});if(h.forceFit===true){l=this.headers[this.resizing.idx+h.nv];d=h.direction===
-"ltr"?l.width-d:l.width+d;if(d>33){c.newWidth=e;l.newWidth=d}}else{this.newWidth=h.direction==="ltr"?h.tblwidth+d:h.tblwidth-d;c.newWidth=e}}}},dragEnd:function(){this.hDiv.style.cursor="default";if(this.resizing){var c=this.resizing.idx,d=this.headers[c].newWidth||this.headers[c].width;d=parseInt(d,10);this.resizing=false;b("#rs_m"+h.id).css("display","none");h.colModel[c].width=d;this.headers[c].width=d;this.headers[c].el.style.width=d+"px";if(this.cols.length>0)this.cols[c].style.width=d+"px";
-if(this.footers.length>0)this.footers[c].style.width=d+"px";if(h.forceFit===true){d=this.headers[c+h.nv].newWidth||this.headers[c+h.nv].width;this.headers[c+h.nv].width=d;this.headers[c+h.nv].el.style.width=d+"px";if(this.cols.length>0)this.cols[c+h.nv].style.width=d+"px";if(this.footers.length>0)this.footers[c+h.nv].style.width=d+"px";h.colModel[c+h.nv].width=d}else{h.tblwidth=this.newWidth||h.tblwidth;b("table:first",this.bDiv).css("width",h.tblwidth+"px");b("table:first",this.hDiv).css("width",
-h.tblwidth+"px");this.hDiv.scrollLeft=this.bDiv.scrollLeft;if(h.footerrow){b("table:first",this.sDiv).css("width",h.tblwidth+"px");this.sDiv.scrollLeft=this.bDiv.scrollLeft}}b.isFunction(h.resizeStop)&&h.resizeStop.call(this,d,c)}this.curGbox=null;document.onselectstart=function(){return true}},populateVisible:function(){g.timer&&clearTimeout(g.timer);g.timer=null;var c=b(g.bDiv).height();if(c){var d=b("table:first",g.bDiv),e=b("> tbody > tr:visible:first",d).outerHeight()||g.prevRowHeight;if(e){g.prevRowHeight=
-e;var l=h.rowNum,n=g.scrollTop=g.bDiv.scrollTop,o=Math.round(d.position().top)-n,p=o+d.height();e=e*l;var w,y,s;if(o<=0&&(h.lastpage===undefined||parseInt((p+n+e-1)/e,10)<=h.lastpage)){y=parseInt((c-p+e-1)/e,10);if(p>=0||y<2||h.scroll===true){w=Math.round((p+n)/e)+1;o=-1}else o=1}if(o>0){w=parseInt(n/e,10)+1;y=parseInt((n+c)/e,10)+2-w;s=true}if(y)if(!(h.lastpage&&w>h.lastpage))if(g.hDiv.loading)g.timer=setTimeout(g.populateVisible,h.scrollTimeout);else{h.page=w;if(s){g.selectionPreserver(d[0]);g.emptyRows(g.bDiv,
-false)}g.populate(y)}}}},scrollGrid:function(){if(h.scroll){var c=g.bDiv.scrollTop;if(c!=g.scrollTop){g.scrollTop=c;g.timer&&clearTimeout(g.timer);g.timer=setTimeout(g.populateVisible,200)}}g.hDiv.scrollLeft=g.bDiv.scrollLeft;if(h.footerrow)g.sDiv.scrollLeft=g.bDiv.scrollLeft},selectionPreserver:function(c){var d=c.p,e=d.selrow,l=d.selarrrow?b.makeArray(d.selarrrow):null,n=c.grid.bDiv.scrollLeft,o=d.gridComplete;d.gridComplete=function(){d.selrow=null;d.selarrrow=[];if(d.multiselect&&l&&l.length>
-0)for(var p=0;p<l.length;p++)l[p]!=e&&b(c).jqGrid("setSelection",l[p],false);e&&b(c).jqGrid("setSelection",e,false);c.grid.bDiv.scrollLeft=n;d.gridComplete=o;d.gridComplete&&o()}}};this.p=h;var j,m,a;if(this.p.colNames.length===0)for(j=0;j<this.p.colModel.length;j++)this.p.colNames[j]=this.p.colModel[j].label||this.p.colModel[j].name;if(this.p.colNames.length!==this.p.colModel.length)alert(b.jgrid.errors.model);else{var q=b("<div class='ui-jqgrid-view'></div>"),t,x=b.browser.msie?true:false,C=b.browser.safari?
-true:false;a=this;a.p.direction=b.trim(a.p.direction.toLowerCase());if(b.inArray(a.p.direction,["ltr","rtl"])==-1)a.p.direction="ltr";m=a.p.direction;b(q).insertBefore(this);b(this).appendTo(q).removeClass("scroll");var K=b("<div class='ui-jqgrid ui-widget ui-widget-content ui-corner-all'></div>");b(K).insertBefore(q).attr({id:"gbox_"+this.id,dir:m});b(q).appendTo(K).attr("id","gview_"+this.id);t=x&&b.browser.version<=6?'<iframe style="display:block;position:absolute;z-index:-1;filter:Alpha(Opacity=\'0\');" src="javascript:false;"></iframe>':
-"";b("<div class='ui-widget-overlay jqgrid-overlay' id='lui_"+this.id+"'></div>").append(t).insertBefore(q);b("<div class='loading ui-state-default ui-state-active' id='load_"+this.id+"'>"+this.p.loadtext+"</div>").insertBefore(q);b(this).attr({cellSpacing:"0",cellPadding:"0",border:"0",role:"grid","aria-multiselectable":!!this.p.multiselect,"aria-labelledby":"gbox_"+this.id});var J=function(c,d){c=parseInt(c,10);return isNaN(c)?d?d:0:c},F=function(c,d,e){var l=a.p.colModel[c],n=l.align,o='style="',
-p=l.classes,w=l.name;if(n)o+="text-align:"+n+";";if(l.hidden===true)o+="display:none;";if(d===0)o+="width: "+g.headers[c].width+"px;";o+='"'+(p!==undefined?' class="'+p+'"':"")+(l.title&&e?' title="'+b.jgrid.stripHtml(e)+'"':"");o+=' aria-describedby="'+a.p.id+"_"+w+'"';return o},Q=function(c){return c===undefined||c===null||c===""?"&#160;":a.p.autoencode?b.jgrid.htmlEncode(c):c+""},M=function(c,d,e,l,n){e=a.p.colModel[e];if(typeof e.formatter!=="undefined"){c={rowId:c,colModel:e,gid:a.p.id};d=b.isFunction(e.formatter)?
-e.formatter.call(a,d,c,l,n):b.fmatter?b.fn.fmatter(e.formatter,d,c,l,n):Q(d)}else d=Q(d);return d},R=function(c,d,e,l,n){c=M(c,d,e,n,"add");return'<td role="gridcell" '+F(e,l,c)+">"+c+"</td>"},u=function(c,d,e){c='<input role="checkbox" type="checkbox" id="jqg_'+c+'" class="cbox" name="jqg_'+c+'"/>';d=F(d,e,"");return'<td role="gridcell" aria-describedby="'+a.p.id+'_cb" '+d+">"+c+"</td>"},la=function(c,d,e,l){e=(parseInt(e,10)-1)*parseInt(l,10)+1+d;c=F(c,d,"");return'<td role="gridcell" aria-describedby="'+
-a.p.id+'_rn" class="ui-state-default jqgrid-rownum" '+c+">"+e+"</td>"},ca=function(c){var d,e=[],l=0,n;for(n=0;n<a.p.colModel.length;n++){d=a.p.colModel[n];if(d.name!=="cb"&&d.name!=="subgrid"&&d.name!=="rn"){e[l]=c=="xml"?d.xmlmap||d.name:d.jsonmap||d.name;l++}}return e},fa=function(c){var d=a.p.remapColumns;if(!d||!d.length)d=b.map(a.p.colModel,function(e,l){return l});if(c)d=b.map(d,function(e){return e<c?null:e-c});return d},aa=function(c,d){a.p.deepempty?b("tbody:first tr",c).remove():b("tbody:first",
-c).empty();if(d&&a.p.scroll){b(">div:first",c).css({height:"auto"}).children("div:first").css({height:0,display:"none"});c.scrollTop=0}},U=function(c,d){var e,l,n,o;if(typeof d==="function")return d(c);e=c[d];if(e===undefined){if(typeof d==="string")n=d.split(".");try{if(o=n.length)for(e=c;e&&o--;){l=n.shift();e=e[l]}}catch(p){}}return e},ia=function(c,d,e,l,n){var o=new Date;a.p.reccount=0;if(b.isXMLDoc(c)){if(a.p.treeANode===-1&&!a.p.scroll){aa(d,false);e=0}else e=e>0?e:0;var p,w=0,y,s,r=0,v=0,
-z=0,D,N,L=[],P,G={},da=a.rows.length,E,W,B=[],S=0,ga=a.p.altRows===true?" "+a.p.altclass:"";a.p.xmlReader.repeatitems||(L=ca("xml"));D=a.p.keyIndex===false?a.p.xmlReader.id:a.p.keyIndex;if(L.length>0&&!isNaN(D)){if(a.p.remapColumns&&a.p.remapColumns.length)D=b.inArray(D,a.p.remapColumns);D=L[D]}N=(D+"").indexOf("[")===-1?L.length?function(X,V){return b(D,X).text()||V}:function(X,V){return b(a.p.xmlReader.cell,X).eq(D).text()||V}:function(X,V){return X.getAttribute(D.replace(/[\[\]]/g,""))||V};a.p.userData=
-{};b(a.p.xmlReader.page,c).each(function(){a.p.page=this.textContent||this.text||0});b(a.p.xmlReader.total,c).each(function(){a.p.lastpage=this.textContent||this.text;if(a.p.lastpage===undefined)a.p.lastpage=1});b(a.p.xmlReader.records,c).each(function(){a.p.records=this.textContent||this.text||0});b(a.p.xmlReader.userdata,c).each(function(){a.p.userData[this.getAttribute("name")]=this.textContent||this.text});c=b(a.p.xmlReader.root+" "+a.p.xmlReader.row,c);var ha=c.length,O=0;if(c&&ha){var ma=parseInt(a.p.rowNum,
-10),wa=a.p.scroll?(parseInt(a.p.page,10)-1)*ma+1:1;if(n)ma*=n+1;for(n=b.isFunction(a.p.afterInsertRow);O<ha;){E=c[O];W=N(E,wa+O);p=e===0?0:e+1;p=(p+O)%2==1?ga:"";B[S++]='<tr id="'+W+'" role="row" class ="ui-widget-content jqgrow ui-row-'+a.p.direction+""+p+'">';if(a.p.rownumbers===true){B[S++]=la(0,O,a.p.page,a.p.rowNum);z=1}if(a.p.multiselect===true){B[S++]=u(W,z,O);r=1}if(a.p.subGrid===true){B[S++]=b(a).jqGrid("addSubGridCell",r+z,O+e);v=1}if(a.p.xmlReader.repeatitems){P||(P=fa(r+v+z));var za=b(a.p.xmlReader.cell,
-E);b.each(P,function(X){var V=za[this];if(!V)return false;y=V.textContent||V.text;G[a.p.colModel[X+r+v+z].name]=y;B[S++]=R(W,y,X+r+v+z,O+e,E)})}else for(p=0;p<L.length;p++){y=b(L[p],E).text();G[a.p.colModel[p+r+v+z].name]=y;B[S++]=R(W,y,p+r+v+z,O+e,E)}B[S++]="</tr>";if(a.p.gridview===false){if(a.p.treeGrid===true){p=a.p.treeANode>=-1?a.p.treeANode:0;s=b(B.join(""))[0];try{b(a).jqGrid("setTreeNode",G,s)}catch(Fa){}da===0?b("tbody:first",d).append(s):b(a.rows[O+p+e]).after(s)}else b("tbody:first",d).append(B.join(""));
-if(a.p.subGrid===true)try{b(a).jqGrid("addSubGrid",a.rows[a.rows.length-1],r+z)}catch(Ga){}n&&a.p.afterInsertRow.call(a,W,G,E);B=[];S=0}G={};w++;O++;if(w==ma)break}}a.p.gridview===true&&b("tbody:first",d).append(B.join(""));a.p.totaltime=new Date-o;if(w>0){a.grid.cols=a.rows[0].cells;if(a.p.records===0)a.p.records=ha}B=null;if(!a.p.treeGrid&&!a.p.scroll)a.grid.bDiv.scrollTop=0;a.p.reccount=w;a.p.treeANode=-1;a.p.userDataOnFooter&&b(a).jqGrid("footerData","set",a.p.userData,true);l||na(false,true)}},
-ra=function(c,d,e,l,n){var o=new Date;a.p.reccount=0;if(c){if(a.p.treeANode===-1&&!a.p.scroll){aa(d,false);e=0}else e=e>0?e:0;var p=0,w,y,s,r=[],v,z=0,D=0,N=0,L,P,G,da={},E,W=a.rows.length,B;s=[];E=0;var S=a.p.altRows===true?" "+a.p.altclass:"";a.p.page=U(c,a.p.jsonReader.page)||0;G=U(c,a.p.jsonReader.total);a.p.lastpage=G===undefined?1:G;a.p.records=U(c,a.p.jsonReader.records)||0;a.p.userData=U(c,a.p.jsonReader.userdata)||{};a.p.jsonReader.repeatitems||(v=r=ca("json"));G=a.p.keyIndex===false?a.p.jsonReader.id:
-a.p.keyIndex;if(r.length>0&&!isNaN(G)){if(a.p.remapColumns&&a.p.remapColumns.length)G=b.inArray(G,a.p.remapColumns);G=r[G]}if(P=U(c,a.p.jsonReader.root)){L=P.length;c=0;var ga=parseInt(a.p.rowNum,10),ha=a.p.scroll?(parseInt(a.p.page,10)-1)*ga+1:1;if(n)ga*=n+1;for(var O=b.isFunction(a.p.afterInsertRow);c<L;){n=P[c];B=U(n,G);if(B===undefined){B=ha+c;if(r.length===0)if(a.p.jsonReader.cell)B=n[a.p.jsonReader.cell][G]||B}w=e===0?0:e+1;w=(w+c)%2==1?S:"";s[E++]='<tr id="'+B+'" role="row" class= "ui-widget-content jqgrow ui-row-'+
-a.p.direction+""+w+'">';if(a.p.rownumbers===true){s[E++]=la(0,c,a.p.page,a.p.rowNum);N=1}if(a.p.multiselect){s[E++]=u(B,N,c);z=1}if(a.p.subGrid){s[E++]=b(a).jqGrid("addSubGridCell",z+N,c+e);D=1}if(a.p.jsonReader.repeatitems){if(a.p.jsonReader.cell)n=U(n,a.p.jsonReader.cell);v||(v=fa(z+D+N))}for(y=0;y<v.length;y++){w=U(n,v[y]);s[E++]=R(B,w,y+z+D+N,c+e,n);da[a.p.colModel[y+z+D+N].name]=w}s[E++]="</tr>";if(a.p.gridview===false){if(a.p.treeGrid===true){E=a.p.treeANode>=-1?a.p.treeANode:0;s=b(s.join(""))[0];
-try{b(a).jqGrid("setTreeNode",da,s)}catch(ma){}W===0?b("tbody:first",d).append(s):b(a.rows[c+E+e]).after(s)}else b("tbody:first",d).append(s.join(""));if(a.p.subGrid===true)try{b(a).jqGrid("addSubGrid",a.rows[a.rows.length-1],z+N)}catch(wa){}O&&a.p.afterInsertRow.call(a,B,da,n);s=[];E=0}da={};p++;c++;if(p==ga)break}a.p.gridview===true&&b("tbody:first",d).append(s.join(""));a.p.totaltime=new Date-o;if(p>0){a.grid.cols=a.rows[0].cells;if(a.p.records===0)a.p.records=L}}if(!a.p.treeGrid&&!a.p.scroll)a.grid.bDiv.scrollTop=
-0;a.p.reccount=p;a.p.treeANode=-1;a.p.userDataOnFooter&&b(a).jqGrid("footerData","set",a.p.userData,true);l||na(false,true)}},na=function(c,d){var e,l,n,o,p,w,y,s="";n=parseInt(a.p.page,10)-1;if(n<0)n=0;n*=parseInt(a.p.rowNum,10);p=n+a.p.reccount;if(a.p.scroll){e=b("tbody:first > tr",a.grid.bDiv);n=p-e.length;if(l=e.outerHeight()){e=n*l;l=parseInt(a.p.records,10)*l;b(">div:first",a.grid.bDiv).css({height:l}).children("div:first").css({height:e,display:e?"":"none"})}}s=a.p.pager?a.p.pager:"";s+=a.p.toppager?
-s?","+a.p.toppager:a.p.toppager:"";if(s){y=b.jgrid.formatter.integer||{};if(a.p.loadonce){e=l=1;a.p.lastpage=a.page=1;b(".selbox",s).attr("disabled",true)}else{e=J(a.p.page);l=J(a.p.lastpage);b(".selbox",s).attr("disabled",false)}if(a.p.pginput===true){b(".ui-pg-input",s).val(a.p.page);b("#sp_1",s).html(b.fmatter?b.fmatter.util.NumberFormat(a.p.lastpage,y):a.p.lastpage)}if(a.p.viewrecords)if(a.p.reccount===0)b(".ui-paging-info",s).html(a.p.emptyrecords);else{o=n+1;w=a.p.records;if(b.fmatter){o=b.fmatter.util.NumberFormat(o,
-y);p=b.fmatter.util.NumberFormat(p,y);w=b.fmatter.util.NumberFormat(w,y)}b(".ui-paging-info",s).html(b.jgrid.format(a.p.recordtext,o,p,w))}if(a.p.pgbuttons===true){if(e<=0)e=l=0;if(e==1||e===0){b("#first, #prev",a.p.pager).addClass("ui-state-disabled").removeClass("ui-state-hover");a.p.toppager&&b("#first_t, #prev_t",a.p.toppager).addClass("ui-state-disabled").removeClass("ui-state-hover")}else{b("#first, #prev",a.p.pager).removeClass("ui-state-disabled");a.p.toppager&&b("#first_t, #prev_t",a.p.toppager).removeClass("ui-state-disabled")}if(e==
-l||e===0){b("#next, #last",a.p.pager).addClass("ui-state-disabled").removeClass("ui-state-hover");a.p.toppager&&b("#next_t, #last_t",a.p.toppager).addClass("ui-state-disabled").removeClass("ui-state-hover")}else{b("#next, #last",a.p.pager).removeClass("ui-state-disabled");a.p.toppager&&b("#next_t, #last_t",a.p.toppager).removeClass("ui-state-disabled")}}}c===true&&a.p.rownumbers===true&&b("td.jqgrid-rownum",a.rows).each(function(r){b(this).html(n+1+r)});d&&a.p.jqgdnd&&b(a).jqGrid("gridDnD","updateDnD");
-b.isFunction(a.p.gridComplete)&&a.p.gridComplete.call(a)},Y=function(c){if(!a.grid.hDiv.loading){var d=a.p.scroll&&c===false,e={},l,n=a.p.prmNames;if(a.p.page<=0)a.p.page=1;if(n.search!==null)e[n.search]=a.p.search;if(n.nd!==null)e[n.nd]=(new Date).getTime();if(n.rows!==null)e[n.rows]=a.p.rowNum;if(n.page!==null)e[n.page]=a.p.page;if(n.sort!==null)e[n.sort]=a.p.sortname;if(n.order!==null)e[n.order]=a.p.sortorder;var o=a.p.loadComplete,p=b.isFunction(o);p||(o=null);var w=0;c=c||1;if(c>1)if(n.npage!==
-null){e[n.npage]=c;w=c-1;c=1}else o=function(s){p&&a.p.loadComplete.call(a,s);a.grid.hDiv.loading=false;a.p.page++;Y(c-1)};else n.npage!==null&&delete a.p.postData[n.npage];b.extend(a.p.postData,e);var y=!a.p.scroll?0:a.rows.length-1;if(b.isFunction(a.p.datatype))a.p.datatype.call(a,a.p.postData,"load_"+a.p.id);else{b.isFunction(a.p.beforeRequest)&&a.p.beforeRequest.call(a);l=a.p.datatype.toLowerCase();switch(l){case "json":case "jsonp":case "xml":case "script":b.ajax(b.extend({url:a.p.url,type:a.p.mtype,
-dataType:l,data:b.isFunction(a.p.serializeGridData)?a.p.serializeGridData.call(a,a.p.postData):a.p.postData,success:function(s){l==="xml"?ia(s,a.grid.bDiv,y,c>1,w):ra(s,a.grid.bDiv,y,c>1,w);o&&o.call(a,s);d&&a.grid.populateVisible();if(a.p.loadonce||a.p.treeGrid)a.p.datatype="local";ja()},error:function(s,r,v){b.isFunction(a.p.loadError)&&a.p.loadError.call(a,s,r,v);ja()},beforeSend:function(s){oa();b.isFunction(a.p.loadBeforeSend)&&a.p.loadBeforeSend.call(a,s)}},b.jgrid.ajaxOptions,a.p.ajaxGridOptions));
-break;case "xmlstring":oa();e=b.jgrid.stringToDoc(a.p.datastr);p&&a.p.loadComplete.call(a,e);ia(e,a.grid.bDiv);a.p.datatype="local";a.p.datastr=null;ja();break;case "jsonstring":oa();e=typeof a.p.datastr=="string"?b.jgrid.parse(a.p.datastr):a.p.datastr;p&&a.p.loadComplete.call(a,e);ra(e,a.grid.bDiv);a.p.datatype="local";a.p.datastr=null;ja();break;case "local":case "clientside":oa();a.p.datatype="local";p&&a.p.loadComplete.call(a,"");Aa();na(true,true);ja();break}}}},oa=function(){a.grid.hDiv.loading=
-true;if(!a.p.hiddengrid)switch(a.p.loadui){case "disable":break;case "enable":b("#load_"+a.p.id).show();break;case "block":b("#lui_"+a.p.id).show();b("#load_"+a.p.id).show();break}},ja=function(){a.grid.hDiv.loading=false;switch(a.p.loadui){case "disable":break;case "enable":b("#load_"+a.p.id).hide();break;case "block":b("#lui_"+a.p.id).hide();b("#load_"+a.p.id).hide();break}},Aa=function(){var c=/[\$,%]/g,d=[],e=0,l,n,o,p=a.p.sortorder=="asc"?1:-1,w=false,y;b.each(a.p.colModel,function(r){if(this.index==
-a.p.sortname||this.name==a.p.sortname){if(a.p.lastsort==r)w=true;e=r;l=this.sorttype;return false}});o=l=="float"||l=="number"||l=="currency"?function(r){r=parseFloat(r.replace(c,""));return isNaN(r)?0:r}:l=="int"||l=="integer"?function(r){return J(r.replace(c,""),0)}:l=="date"||l=="datetime"?function(r){return Ba(a.p.colModel[e].datefmt||"Y-m-d",r).getTime()}:b.isFunction(l)?l:function(r){return b.trim(r.toUpperCase())};y=a.p.colModel[e];b.each(a.rows,function(r,v){try{n=b.unformat(b(v).children("td").eq(e),
-{rowId:v.id,colModel:y},e,true)}catch(z){n=b(v).children("td").eq(e).text()}v.sortKey=o(n);d[r]=this});if(a.p.treeGrid)b(a).jqGrid("SortTree",p);else{w?d.reverse():d.sort(function(r,v){if(r.sortKey<v.sortKey)return-p;if(r.sortKey>v.sortKey)return p;return 0});if(d[0]){b("td",d[0]).each(function(r){b(this).css("width",g.headers[r].width+"px")});a.grid.cols=d[0].cells}var s="";if(a.p.altRows)s=a.p.altclass;b.each(d,function(r,v){if(s)r%2==1?b(v).addClass(s):b(v).removeClass(s);b("tbody",a.grid.bDiv).append(v);
-v.sortKey=null})}a.grid.bDiv.scrollTop=0},Ba=function(c,d){var e={m:1,d:1,y:1970,h:0,i:0,s:0},l,n,o;if(d=b.trim(d)){d=d.split(/[\\\/:_;.\t\T\s-]/);c=c.split(/[\\\/:_;.\t\T\s-]/);var p=b.jgrid.formatter.date.monthNames,w=b.jgrid.formatter.date.AmPm,y=function(s,r){if(s===0){if(r==12)r=0}else if(r!=12)r+=12;return r};l=0;for(n=c.length;l<n;l++){if(c[l]=="M"){o=b.inArray(d[l],p);if(o!==-1&&o<12)d[l]=o+1}if(c[l]=="F"){o=b.inArray(d[l],p);if(o!==-1&&o>11)d[l]=o+1-12}if(c[l]=="a"){o=b.inArray(d[l],w);if(o!==
--1&&o<2&&d[l]==w[o]){d[l]=o;e.h=y(d[l],e.h)}}if(c[l]=="A"){o=b.inArray(d[l],w);if(o!==-1&&o>1&&d[l]==w[o]){d[l]=o-2;e.h=y(d[l],e.h)}}e[c[l].toLowerCase()]=parseInt(d[l],10)}e.m=parseInt(e.m,10)-1;c=e.y;if(c>=70&&c<=99)e.y=1900+e.y;else if(c>=0&&c<=69)e.y=2E3+e.y}return new Date(e.y,e.m,e.d,e.h,e.i,e.s,0)};t=function(c,d){var e="",l="<table cellspacing='0' cellpadding='0' border='0' style='table-layout:auto;' class='ui-pg-table'><tbody><tr>",n="",o,p,w,y,s=function(r){var v;if(b.isFunction(a.p.onPaging))v=
-a.p.onPaging.call(a,r);a.p.selrow=null;if(a.p.multiselect){a.p.selarrrow=[];b("#cb_"+b.jgrid.jqID(a.p.id),a.grid.hDiv).attr("checked",false)}a.p.savedRow=[];if(v=="stop")return false;return true};c=c.substr(1);o="pg_"+c;p=c+"_left";w=c+"_center";y=c+"_right";b("#"+c).append("<div id='"+o+"' class='ui-pager-control' role='group'><table cellspacing='0' cellpadding='0' border='0' class='ui-pg-table' style='width:100%;table-layout:fixed;' role='row'><tbody><tr><td id='"+p+"' align='left'></td><td id='"+
-w+"' align='center' style='white-space:pre;'></td><td id='"+y+"' align='right'></td></tr></tbody></table></div>").attr("dir","ltr");if(a.p.rowList.length>0){n="<td dir='"+m+"'>";n+="<select class='ui-pg-selbox' role='listbox'>";for(p=0;p<a.p.rowList.length;p++)n+="<option role='option' value='"+a.p.rowList[p]+"'"+(a.p.rowNum==a.p.rowList[p]?" selected":"")+">"+a.p.rowList[p]+"</option>";n+="</select></td>"}if(m=="rtl")l+=n;if(a.p.pginput===true)e="<td dir='"+m+"'>"+b.jgrid.format(a.p.pgtext||"","<input class='ui-pg-input' type='text' size='2' maxlength='7' value='0' role='textbox'/>",
-"<span id='sp_1'></span>")+"</td>";if(a.p.pgbuttons===true){p=["first"+d,"prev"+d,"next"+d,"last"+d];m=="rtl"&&p.reverse();l+="<td id='"+p[0]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-first'></span></td>";l+="<td id='"+p[1]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-prev'></span></td>";l+=e!=""?"<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='ui-separator'></span></td>"+e+"<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='ui-separator'></span></td>":
-"";l+="<td id='"+p[2]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-next'></span></td>";l+="<td id='"+p[3]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-end'></span></td>"}else if(e!="")l+=e;if(m=="ltr")l+=n;l+="</tr></tbody></table>";a.p.viewrecords===true&&b("td#"+c+"_"+a.p.recordpos,"#"+o).append("<div dir='"+m+"' style='text-align:"+a.p.recordpos+"' class='ui-paging-info'></div>");b("td#"+c+"_"+a.p.pagerpos,"#"+o).append(l);n=b(".ui-jqgrid").css("font-size")||
-"11px";b("body").append("<div id='testpg' class='ui-jqgrid ui-widget ui-widget-content' style='font-size:"+n+";visibility:hidden;' ></div>");l=b(l).clone().appendTo("#testpg").width();b("#testpg").remove();if(l>0){if(e!="")l+=50;b("td#"+c+"_"+a.p.pagerpos,"#"+o).width(l)}a.p._nvtd=[];a.p._nvtd[0]=l?Math.floor((a.p.width-l)/2):Math.floor(a.p.width/3);a.p._nvtd[1]=0;l=null;b(".ui-pg-selbox","#"+o).bind("change",function(){a.p.page=Math.round(a.p.rowNum*(a.p.page-1)/this.value-0.5)+1;a.p.rowNum=this.value;
-if(d)b(".ui-pg-selbox",a.p.pager).val(this.value);else a.p.toppager&&b(".ui-pg-selbox",a.p.toppager).val(this.value);if(!s("records"))return false;Y();return false});if(a.p.pgbuttons===true){b(".ui-pg-button","#"+o).hover(function(){if(b(this).hasClass("ui-state-disabled"))this.style.cursor="default";else{b(this).addClass("ui-state-hover");this.style.cursor="pointer"}},function(){if(!b(this).hasClass("ui-state-disabled")){b(this).removeClass("ui-state-hover");this.style.cursor="default"}});b("#first"+
-d+", #prev"+d+", #next"+d+", #last"+d,"#"+c).click(function(){var r=J(a.p.page,1),v=J(a.p.lastpage,1),z=false,D=true,N=true,L=true,P=true;if(v===0||v===1)P=L=N=D=false;else if(v>1&&r>=1)if(r===1)N=D=false;else{if(!(r>1&&r<v))if(r===v)P=L=false}else if(v>1&&r===0){P=L=false;r=v-1}if(this.id==="first"+d&&D){a.p.page=1;z=true}if(this.id==="prev"+d&&N){a.p.page=r-1;z=true}if(this.id==="next"+d&&L){a.p.page=r+1;z=true}if(this.id==="last"+d&&P){a.p.page=v;z=true}if(z){if(!s(this.id))return false;Y()}return false})}a.p.pginput===
-true&&b("input.ui-pg-input","#"+o).keypress(function(r){if((r.charCode?r.charCode:r.keyCode?r.keyCode:0)==13){a.p.page=b(this).val()>0?b(this).val():a.p.page;if(!s("user"))return false;Y();return false}return this})};var xa=function(c,d,e,l){if(a.p.colModel[d].sortable)if(!(a.p.savedRow.length>0)){if(!e){if(a.p.lastsort==d)if(a.p.sortorder=="asc")a.p.sortorder="desc";else{if(a.p.sortorder=="desc")a.p.sortorder="asc"}else a.p.sortorder=a.p.colModel[d].firstsortorder||"asc";a.p.page=1}if(l)if(a.p.lastsort==
-d&&a.p.sortorder==l&&!e)return;else a.p.sortorder=l;e=b("thead:first",a.grid.hDiv).get(0);b("tr th:eq("+a.p.lastsort+") span.ui-grid-ico-sort",e).addClass("ui-state-disabled");b("tr th:eq("+a.p.lastsort+")",e).attr("aria-selected","false");b("tr th:eq("+d+") span.ui-icon-"+a.p.sortorder,e).removeClass("ui-state-disabled");b("tr th:eq("+d+")",e).attr("aria-selected","true");if(!a.p.viewsortcols[0])if(a.p.lastsort!=d){b("tr th:eq("+a.p.lastsort+") span.s-ico",e).hide();b("tr th:eq("+d+") span.s-ico",
-e).show()}c=c.substring(5);a.p.sortname=a.p.colModel[d].index||c;e=a.p.sortorder;if(b.isFunction(a.p.onSortCol))if(a.p.onSortCol.call(a,c,d,e)=="stop"){a.p.lastsort=d;return}if(a.p.datatype=="local")a.p.deselectAfterSort&&b(a).jqGrid("resetSelection");else{a.p.selrow=null;a.p.multiselect&&b("#cb_"+b.jgrid.jqID(a.p.id),a.grid.hDiv).attr("checked",false);a.p.selarrrow=[];a.p.savedRow=[];a.p.scroll&&aa(a.grid.bDiv,true)}a.p.subGrid&&a.p.datatype=="local"&&b("td.sgexpanded","#"+a.p.id).each(function(){b(this).trigger("click")});
-Y();a.p.lastsort=d;if(a.p.sortname!=c&&d)a.p.lastsort=d}},Ca=function(c){var d=c,e;for(e=c+1;e<a.p.colModel.length;e++)if(a.p.colModel[e].hidden!==true){d=e;break}return d-c},Da=function(c){var d,e={},l=C?0:a.p.cellLayout;for(d=e[0]=e[1]=e[2]=0;d<=c;d++)if(a.p.colModel[d].hidden===false)e[0]+=a.p.colModel[d].width+l;if(a.p.direction=="rtl")e[0]=a.p.width-e[0];e[0]-=a.grid.bDiv.scrollLeft;if(b(a.grid.cDiv).is(":visible"))e[1]+=b(a.grid.cDiv).height()+parseInt(b(a.grid.cDiv).css("padding-top"),10)+
-parseInt(b(a.grid.cDiv).css("padding-bottom"),10);if(a.p.toolbar[0]===true&&(a.p.toolbar[1]=="top"||a.p.toolbar[1]=="both"))e[1]+=b(a.grid.uDiv).height()+parseInt(b(a.grid.uDiv).css("border-top-width"),10)+parseInt(b(a.grid.uDiv).css("border-bottom-width"),10);if(a.p.toppager)e[1]+=b(a.grid.topDiv).height()+parseInt(b(a.grid.topDiv).css("border-bottom-width"),10);e[2]+=b(a.grid.bDiv).height()+b(a.grid.hDiv).height();return e};this.p.id=this.id;if(b.inArray(a.p.multikey,["shiftKey","altKey","ctrlKey"])==
--1)a.p.multikey=false;a.p.keyIndex=false;for(j=0;j<a.p.colModel.length;j++)if(a.p.colModel[j].key===true){a.p.keyIndex=j;break}a.p.sortorder=a.p.sortorder.toLowerCase();if(this.p.treeGrid===true)try{b(this).jqGrid("setTreeGrid")}catch(Ha){}if(this.p.subGrid)try{b(a).jqGrid("setSubGrid")}catch(Ia){}if(this.p.multiselect){this.p.colNames.unshift("<input role='checkbox' id='cb_"+this.p.id+"' class='cbox' type='checkbox'/>");this.p.colModel.unshift({name:"cb",width:C?a.p.multiselectWidth+a.p.cellLayout:
-a.p.multiselectWidth,sortable:false,resizable:false,hidedlg:true,search:false,align:"center",fixed:true})}if(this.p.rownumbers){this.p.colNames.unshift("");this.p.colModel.unshift({name:"rn",width:a.p.rownumWidth,sortable:false,resizable:false,hidedlg:true,search:false,align:"center",fixed:true})}a.p.xmlReader=b.extend(true,{root:"rows",row:"row",page:"rows>page",total:"rows>total",records:"rows>records",repeatitems:true,cell:"cell",id:"[id]",userdata:"userdata",subgrid:{root:"rows",row:"row",repeatitems:true,
-cell:"cell"}},a.p.xmlReader);a.p.jsonReader=b.extend(true,{root:"rows",page:"page",total:"total",records:"records",repeatitems:true,cell:"cell",id:"id",userdata:"userdata",subgrid:{root:"rows",repeatitems:true,cell:"cell"}},a.p.jsonReader);if(a.p.scroll){a.p.pgbuttons=false;a.p.pginput=false;a.p.rowList=[]}var H="<thead><tr class='ui-jqgrid-labels' role='rowheader'>",ya,ba,sa,ka,pa,I,A,ea;ba=ea="";if(a.p.shrinkToFit===true&&a.p.forceFit===true)for(j=a.p.colModel.length-1;j>=0;j--)if(!a.p.colModel[j].hidden){a.p.colModel[j].resizable=
-false;break}if(a.p.viewsortcols[1]=="horizontal"){ea=" ui-i-asc";ba=" ui-i-desc"}ya=x?"class='ui-th-div-ie'":"";ea="<span class='s-ico' style='display:none'><span sort='asc' class='ui-grid-ico-sort ui-icon-asc"+ea+" ui-state-disabled ui-icon ui-icon-triangle-1-n ui-sort-"+m+"'></span>";ea+="<span sort='desc' class='ui-grid-ico-sort ui-icon-desc"+ba+" ui-state-disabled ui-icon ui-icon-triangle-1-s ui-sort-"+m+"'></span></span>";for(j=0;j<this.p.colNames.length;j++){ba=a.p.headertitles?' title="'+b.jgrid.stripHtml(a.p.colNames[j])+
-'"':"";H+="<th id='"+a.p.id+"_"+a.p.colModel[j].name+"' role='columnheader' class='ui-state-default ui-th-column ui-th-"+m+"'"+ba+">";ba=a.p.colModel[j].index||a.p.colModel[j].name;H+="<div id='jqgh_"+a.p.colModel[j].name+"' "+ya+">"+a.p.colNames[j];a.p.colModel[j].width=a.p.colModel[j].width?parseInt(a.p.colModel[j].width,10):150;if(typeof a.p.colModel[j].title!=="boolean")a.p.colModel[j].title=true;if(ba==a.p.sortname)a.p.lastsort=j;H+=ea+"</div></th>"}H+="</tr></thead>";b(this).append(H);b("thead tr:first th",
-this).hover(function(){b(this).addClass("ui-state-hover")},function(){b(this).removeClass("ui-state-hover")});if(this.p.multiselect){var ta=[],qa;b("#cb_"+b.jgrid.jqID(a.p.id),this).bind("click",function(){if(this.checked){b("[id^=jqg_]",a.rows).attr("checked",true);b(a.rows).each(function(c){if(!b(this).hasClass("subgrid")){b(this).addClass("ui-state-highlight").attr("aria-selected","true");a.p.selarrrow[c]=a.p.selrow=this.id}});qa=true;ta=[]}else{b("[id^=jqg_]",a.rows).attr("checked",false);b(a.rows).each(function(c){if(!b(this).hasClass("subgrid")){b(this).removeClass("ui-state-highlight").attr("aria-selected",
-"false");ta[c]=this.id}});a.p.selarrrow=[];a.p.selrow=null;qa=false}if(b.isFunction(a.p.onSelectAll))a.p.onSelectAll.call(a,qa?a.p.selarrrow:ta,qa)})}if(a.p.autowidth===true){H=b(K).innerWidth();a.p.width=H>0?H:"nw"}(function(){var c=0,d=a.p.cellLayout,e=0,l,n=a.p.scrollOffset,o,p=false,w,y=0,s=0,r=0,v;if(C)d=0;b.each(a.p.colModel,function(){if(typeof this.hidden==="undefined")this.hidden=false;if(this.hidden===false){c+=J(this.width,0);if(this.fixed){y+=this.width;s+=this.width+d}else e++;r++}});
-if(isNaN(a.p.width))a.p.width=g.width=c;else g.width=a.p.width;a.p.tblwidth=c;if(a.p.shrinkToFit===false&&a.p.forceFit===true)a.p.forceFit=false;if(a.p.shrinkToFit===true&&e>0){w=g.width-d*e-s;if(!isNaN(a.p.height)){w-=n;p=true}c=0;b.each(a.p.colModel,function(z){if(this.hidden===false&&!this.fixed){this.width=o=Math.round(w*this.width/(a.p.tblwidth-y));c+=o;l=z}});v=0;if(p){if(g.width-s-(c+d*e)!==n)v=g.width-s-(c+d*e)-n}else if(!p&&Math.abs(g.width-s-(c+d*e))!==1)v=g.width-s-(c+d*e);a.p.colModel[l].width+=
-v;a.p.tblwidth=c+v+y+r*d;if(a.p.tblwidth>a.p.width){a.p.colModel[l].width-=a.p.tblwidth-parseInt(a.p.width,10);a.p.tblwidth=a.p.width}}})();b(K).css("width",g.width+"px").append("<div class='ui-jqgrid-resize-mark' id='rs_m"+a.p.id+"'>&#160;</div>");b(q).css("width",g.width+"px");H=b("thead:first",a).get(0);var ua="<table role='grid' style='width:"+a.p.tblwidth+"px' class='ui-jqgrid-ftable' cellspacing='0' cellpadding='0' border='0'><tbody><tr role='row' class='ui-widget-content footrow footrow-"+
-m+"'>";q=b("tr:first",H);a.p.disableClick=false;b("th",q).each(function(c){sa=a.p.colModel[c].width;if(typeof a.p.colModel[c].resizable==="undefined")a.p.colModel[c].resizable=true;if(a.p.colModel[c].resizable){ka=document.createElement("span");b(ka).html("&#160;").addClass("ui-jqgrid-resize ui-jqgrid-resize-"+m);b.browser.opera||b(ka).css("cursor","col-resize");b(this).addClass(a.p.resizeclass)}else ka="";b(this).css("width",sa+"px").prepend(ka);a.p.colModel[c].hidden&&b(this).css("display","none");
-g.headers[c]={width:sa,el:this};pa=a.p.colModel[c].sortable;if(typeof pa!=="boolean")pa=a.p.colModel[c].sortable=true;var d=a.p.colModel[c].name;d=="cb"||d=="subgrid"||d=="rn"||a.p.viewsortcols[2]&&b("div",this).addClass("ui-jqgrid-sortable");if(pa)if(a.p.viewsortcols[0]){b("div span.s-ico",this).show();c==a.p.lastsort&&b("div span.ui-icon-"+a.p.sortorder,this).removeClass("ui-state-disabled")}else if(c==a.p.lastsort){b("div span.s-ico",this).show();b("div span.ui-icon-"+a.p.sortorder,this).removeClass("ui-state-disabled")}ua+=
-"<td role='gridcell' "+F(c,0,"")+">&#160;</td>"}).mousedown(function(c){if(b(c.target).closest("th>span.ui-jqgrid-resize").length==1){var d=b.jgrid.getCellIndex(this);if(a.p.forceFit===true)a.p.nv=Ca(d);g.dragStart(d,c,Da(d));return false}}).click(function(c){if(a.p.disableClick)return a.p.disableClick=false;var d="th>div.ui-jqgrid-sortable",e,l;a.p.viewsortcols[2]||(d="th>div>span>span.ui-grid-ico-sort");c=b(c.target).closest(d);if(c.length==1){d=b.jgrid.getCellIndex(this);if(!a.p.viewsortcols[2]){e=
-true;l=c.attr("sort")}xa(b("div",this)[0].id,d,e,l);return false}});if(a.p.sortable&&b.fn.sortable)try{b(a).jqGrid("sortableColumns",q)}catch(Ja){}ua+="</tr></tbody></table>";this.appendChild(document.createElement("tbody"));b(this).addClass("ui-jqgrid-btable");q=b("<table class='ui-jqgrid-htable' style='width:"+a.p.tblwidth+"px' role='grid' aria-labelledby='gbox_"+this.id+"' cellspacing='0' cellpadding='0' border='0'></table>").append(H);var T=a.p.caption&&a.p.hiddengrid===true?true:false;H=b("<div class='ui-jqgrid-hbox"+
-(m=="rtl"?"-rtl":"")+"'></div>");g.hDiv=document.createElement("div");b(g.hDiv).css({width:g.width+"px"}).addClass("ui-state-default ui-jqgrid-hdiv").append(H);b(H).append(q);T&&b(g.hDiv).hide();if(a.p.pager){if(typeof a.p.pager=="string"){if(a.p.pager.substr(0,1)!="#")a.p.pager="#"+a.p.pager}else a.p.pager="#"+b(a.p.pager).attr("id");b(a.p.pager).css({width:g.width+"px"}).appendTo(K).addClass("ui-state-default ui-jqgrid-pager ui-corner-bottom");T&&b(a.p.pager).hide();t(a.p.pager,"")}a.p.cellEdit===
-false&&a.p.hoverrows===true&&b(a).bind("mouseover",function(c){A=b(c.target).closest("tr.jqgrow");b(A).attr("class")!=="subgrid"&&b(A).addClass("ui-state-hover");return false}).bind("mouseout",function(c){A=b(c.target).closest("tr.jqgrow");b(A).removeClass("ui-state-hover");return false});var Z,$;b(a).before(g.hDiv).click(function(c){I=c.target;var d=b(I).hasClass("cbox");A=b(I,a.rows).closest("tr.jqgrow");if(b(A).length===0)return this;var e=true;if(b.isFunction(a.p.beforeSelectRow))e=a.p.beforeSelectRow.call(a,
-A[0].id,c);if(I.tagName=="A"||(I.tagName=="INPUT"||I.tagName=="TEXTAREA"||I.tagName=="OPTION"||I.tagName=="SELECT")&&!d)return this;if(e===true){if(a.p.cellEdit===true)if(a.p.multiselect&&d)b(a).jqGrid("setSelection",A[0].id,true);else{Z=A[0].rowIndex;$=b.jgrid.getCellIndex(I);try{b(a).jqGrid("editCell",Z,$,true)}catch(l){}}else if(a.p.multikey)if(c[a.p.multikey])b(a).jqGrid("setSelection",A[0].id,true);else{if(a.p.multiselect&&d){d=b("[id^=jqg_]",A).attr("checked");b("[id^=jqg_]",A).attr("checked",
-!d)}}else{if(a.p.multiselect&&a.p.multiboxonly)if(!d){b(a.p.selarrrow).each(function(n,o){n=a.rows.namedItem(o);b(n).removeClass("ui-state-highlight");b("#jqg_"+b.jgrid.jqID(o),n).attr("checked",false)});a.p.selarrrow=[];b("#cb_"+b.jgrid.jqID(a.p.id),a.grid.hDiv).attr("checked",false)}b(a).jqGrid("setSelection",A[0].id,true)}if(b.isFunction(a.p.onCellSelect)){Z=A[0].id;$=b.jgrid.getCellIndex(I);a.p.onCellSelect.call(a,Z,$,b(I).html(),c)}c.stopPropagation()}else return this}).bind("reloadGrid",function(c,
-d){if(a.p.treeGrid===true)a.p.datatype=a.p.treedatatype;d&&d.current&&a.grid.selectionPreserver(a);if(a.p.datatype=="local")b(a).jqGrid("resetSelection");else if(!a.p.treeGrid){a.p.selrow=null;if(a.p.multiselect){a.p.selarrrow=[];b("#cb_"+b.jgrid.jqID(a.p.id),a.grid.hDiv).attr("checked",false)}a.p.savedRow=[];a.p.scroll&&aa(a.grid.bDiv,true)}if(d&&d.page){c=d.page;if(c>a.p.lastpage)c=a.p.lastpage;if(c<1)c=1;a.p.page=c;a.grid.bDiv.scrollTop=a.grid.prevRowHeight?(c-1)*a.grid.prevRowHeight*a.p.rowNum:
-0}if(a.grid.prevRowHeight&&a.p.scroll){delete a.p.lastpage;a.grid.populateVisible()}else a.grid.populate();return false});b.isFunction(this.p.ondblClickRow)&&b(this).dblclick(function(c){I=c.target;A=b(I,a.rows).closest("tr.jqgrow");if(b(A).length===0)return false;Z=A[0].rowIndex;$=b.jgrid.getCellIndex(I);a.p.ondblClickRow.call(a,b(A).attr("id"),Z,$,c);return false});b.isFunction(this.p.onRightClickRow)&&b(this).bind("contextmenu",function(c){I=c.target;A=b(I,a.rows).closest("tr.jqgrow");if(b(A).length===
-0)return false;a.p.multiselect||b(a).jqGrid("setSelection",A[0].id,true);Z=A[0].rowIndex;$=b.jgrid.getCellIndex(I);a.p.onRightClickRow.call(a,b(A).attr("id"),Z,$,c);return false});g.bDiv=document.createElement("div");b(g.bDiv).append(b('<div style="position:relative;'+(x&&b.browser.version<8?"height:0.01%;":"")+'"></div>').append("<div></div>").append(this)).addClass("ui-jqgrid-bdiv").css({height:a.p.height+(isNaN(a.p.height)?"":"px"),width:g.width+"px"}).scroll(g.scrollGrid);b("table:first",g.bDiv).css({width:a.p.tblwidth+
-"px"});if(x){b("tbody",this).size()==2&&b("tbody:first",this).remove();a.p.multikey&&b(g.bDiv).bind("selectstart",function(){return false})}else a.p.multikey&&b(g.bDiv).bind("mousedown",function(){return false});T&&b(g.bDiv).hide();g.cDiv=document.createElement("div");var va=a.p.hidegrid===true?b("<a role='link' href='javascript:void(0)'/>").addClass("ui-jqgrid-titlebar-close HeaderButton").hover(function(){va.addClass("ui-state-hover")},function(){va.removeClass("ui-state-hover")}).append("<span class='ui-icon ui-icon-circle-triangle-n'></span>").css(m==
-"rtl"?"left":"right","0px"):"";b(g.cDiv).append(va).append("<span class='ui-jqgrid-title"+(m=="rtl"?"-rtl":"")+"'>"+a.p.caption+"</span>").addClass("ui-jqgrid-titlebar ui-widget-header ui-corner-top ui-helper-clearfix");b(g.cDiv).insertBefore(g.hDiv);if(a.p.toolbar[0]){g.uDiv=document.createElement("div");if(a.p.toolbar[1]=="top")b(g.uDiv).insertBefore(g.hDiv);else a.p.toolbar[1]=="bottom"&&b(g.uDiv).insertAfter(g.hDiv);if(a.p.toolbar[1]=="both"){g.ubDiv=document.createElement("div");b(g.uDiv).insertBefore(g.hDiv).addClass("ui-userdata ui-state-default").attr("id",
-"t_"+this.id);b(g.ubDiv).insertAfter(g.hDiv).addClass("ui-userdata ui-state-default").attr("id","tb_"+this.id);T&&b(g.ubDiv).hide()}else b(g.uDiv).width(g.width).addClass("ui-userdata ui-state-default").attr("id","t_"+this.id);T&&b(g.uDiv).hide()}if(a.p.toppager){a.p.toppager=a.p.id+"_toppager";g.topDiv=b("<div id='"+a.p.toppager+"'></div>")[0];a.p.toppager="#"+a.p.toppager;b(g.topDiv).insertBefore(g.hDiv).addClass("ui-state-default ui-jqgrid-toppager").width(g.width);t(a.p.toppager,"_t")}if(a.p.footerrow){g.sDiv=
-b("<div class='ui-jqgrid-sdiv'></div>")[0];H=b("<div class='ui-jqgrid-hbox"+(m=="rtl"?"-rtl":"")+"'></div>");b(g.sDiv).append(H).insertAfter(g.hDiv).width(g.width);b(H).append(ua);g.footers=b(".ui-jqgrid-ftable",g.sDiv)[0].rows[0].cells;if(a.p.rownumbers)g.footers[0].className="ui-state-default jqgrid-rownum";T&&b(g.sDiv).hide()}if(a.p.caption){var Ea=a.p.datatype;if(a.p.hidegrid===true){b(".ui-jqgrid-titlebar-close",g.cDiv).click(function(c){var d=b.isFunction(a.p.onHeaderClick);if(a.p.gridstate==
-"visible"){b(".ui-jqgrid-bdiv, .ui-jqgrid-hdiv","#gview_"+a.p.id).slideUp("fast");a.p.pager&&b(a.p.pager).slideUp("fast");a.p.toppager&&b(a.p.toppager).slideUp("fast");if(a.p.toolbar[0]===true){a.p.toolbar[1]=="both"&&b(g.ubDiv).slideUp("fast");b(g.uDiv).slideUp("fast")}a.p.footerrow&&b(".ui-jqgrid-sdiv","#gbox_"+a.p.id).slideUp("fast");b("span",this).removeClass("ui-icon-circle-triangle-n").addClass("ui-icon-circle-triangle-s");a.p.gridstate="hidden";b("#gbox_"+a.p.id).hasClass("ui-resizable")&&
-b(".ui-resizable-handle","#gbox_"+a.p.id).hide();if(d)T||a.p.onHeaderClick.call(a,a.p.gridstate,c)}else if(a.p.gridstate=="hidden"){b(".ui-jqgrid-hdiv, .ui-jqgrid-bdiv","#gview_"+a.p.id).slideDown("fast");a.p.pager&&b(a.p.pager).slideDown("fast");a.p.toppager&&b(a.p.toppager).slideDown("fast");if(a.p.toolbar[0]===true){a.p.toolbar[1]=="both"&&b(g.ubDiv).slideDown("fast");b(g.uDiv).slideDown("fast")}a.p.footerrow&&b(".ui-jqgrid-sdiv","#gbox_"+a.p.id).slideDown("fast");b("span",this).removeClass("ui-icon-circle-triangle-s").addClass("ui-icon-circle-triangle-n");
-if(T){a.p.datatype=Ea;Y();T=false}a.p.gridstate="visible";b("#gbox_"+a.p.id).hasClass("ui-resizable")&&b(".ui-resizable-handle","#gbox_"+a.p.id).show();d&&a.p.onHeaderClick.call(a,a.p.gridstate,c)}return false});if(T){a.p.datatype="local";b(".ui-jqgrid-titlebar-close",g.cDiv).trigger("click")}}}else b(g.cDiv).hide();b(g.hDiv).after(g.bDiv).mousemove(function(c){if(g.resizing){g.dragMove(c);return false}});b(".ui-jqgrid-labels",g.hDiv).bind("selectstart",function(){return false});b(document).mouseup(function(){if(g.resizing){g.dragEnd();
-return false}return true});this.updateColumns=function(){var c=this.rows[0],d=this;if(c){b("td",c).each(function(e){b(this).css("width",d.grid.headers[e].width+"px")});this.grid.cols=c.cells}return this};a.formatCol=F;a.sortData=xa;a.updatepager=na;a.formatter=function(c,d,e,l,n){return M(c,d,e,l,n)};b.extend(g,{populate:Y,emptyRows:aa});this.grid=g;a.addXmlData=function(c){ia(c,a.grid.bDiv)};a.addJSONData=function(c){ra(c,a.grid.bDiv)};Y();a.p.hiddengrid=false;b(window).unload(function(){a=null})}}})};
-b.jgrid.extend({getGridParam:function(f){var k=this[0];if(k.grid)return f?typeof k.p[f]!="undefined"?k.p[f]:null:k.p},setGridParam:function(f){return this.each(function(){this.grid&&typeof f==="object"&&b.extend(true,this.p,f)})},getDataIDs:function(){var f=[],k=0,i;this.each(function(){if((i=this.rows.length)&&i>0)for(;k<i;){f[k]=this.rows[k].id;k++}});return f},setSelection:function(f,k){return this.each(function(){function i(a){var q=b(h.grid.bDiv)[0].clientHeight,t=b(h.grid.bDiv)[0].scrollTop,
-x=h.rows[a].offsetTop;a=h.rows[a].clientHeight;if(x+a>=q+t)b(h.grid.bDiv)[0].scrollTop=x-(q+t)+a+t;else if(x<q+t)if(x<t)b(h.grid.bDiv)[0].scrollTop=x}var h=this,g,j,m;if(f!==undefined){k=k===false?false:true;if(j=h.rows.namedItem(f+"")){if(h.p.scrollrows===true){g=h.rows.namedItem(f).rowIndex;g>=0&&i(g)}if(h.p.multiselect){h.p.selrow=j.id;m=b.inArray(h.p.selrow,h.p.selarrrow);if(m===-1){j.className!=="ui-subgrid"&&b(j).addClass("ui-state-highlight").attr("aria-selected","true");g=true;b("#jqg_"+b.jgrid.jqID(h.p.selrow),
-h.rows[j.rowIndex]).attr("checked",g);h.p.selarrrow.push(h.p.selrow);h.p.onSelectRow&&k&&h.p.onSelectRow.call(h,h.p.selrow,g)}else{j.className!=="ui-subgrid"&&b(j).removeClass("ui-state-highlight").attr("aria-selected","false");g=false;b("#jqg_"+b.jgrid.jqID(h.p.selrow),h.rows[j.rowIndex]).attr("checked",g);h.p.selarrrow.splice(m,1);h.p.onSelectRow&&k&&h.p.onSelectRow.call(h,h.p.selrow,g);j=h.p.selarrrow[0];h.p.selrow=j===undefined?null:j}}else if(j.className!=="ui-subgrid"){h.p.selrow&&b(h.rows.namedItem(h.p.selrow)).removeClass("ui-state-highlight").attr("aria-selected",
-"false");h.p.selrow=j.id;b(j).addClass("ui-state-highlight").attr("aria-selected","true");h.p.onSelectRow&&k&&h.p.onSelectRow.call(h,h.p.selrow,true)}}}})},resetSelection:function(){return this.each(function(){var f=this,k;if(f.p.multiselect){b(f.p.selarrrow).each(function(i,h){k=f.rows.namedItem(h);b(k).removeClass("ui-state-highlight").attr("aria-selected","false");b("#jqg_"+b.jgrid.jqID(h),k).attr("checked",false)});b("#cb_"+b.jgrid.jqID(f.p.id),f.grid.hDiv).attr("checked",false);f.p.selarrrow=
-[]}else if(f.p.selrow){b("tr#"+b.jgrid.jqID(f.p.selrow),f.grid.bDiv).removeClass("ui-state-highlight").attr("aria-selected","false");f.p.selrow=null}f.p.savedRow=[]})},getRowData:function(f){var k={},i,h=false,g,j=0;this.each(function(){var m=this,a,q;if(typeof f=="undefined"){h=true;i=[];g=m.rows.length}else{q=m.rows.namedItem(f);if(!q)return k;g=1}for(;j<g;){if(h)q=m.rows[j];b("td",q).each(function(t){a=m.p.colModel[t].name;if(a!=="cb"&&a!=="subgrid")if(m.p.treeGrid===true&&a==m.p.ExpandColumn)k[a]=
-b.jgrid.htmlDecode(b("span:first",this).html());else try{k[a]=b.unformat(this,{rowId:q.id,colModel:m.p.colModel[t]},t)}catch(x){k[a]=b.jgrid.htmlDecode(b(this).html())}});j++;if(h){i.push(k);k={}}}});return i?i:k},delRowData:function(f){var k=false,i,h,g;this.each(function(){var j=this;if(i=j.rows.namedItem(f)){g=i.rowIndex;b(i).remove();j.p.records--;j.p.reccount--;j.updatepager(true,false);k=true;if(j.p.multiselect){h=b.inArray(f,j.p.selarrrow);h!=-1&&j.p.selarrrow.splice(h,1)}if(f==j.p.selrow)j.p.selrow=
-null}else return false;g===0&&k&&j.updateColumns();if(j.p.altRows===true&&k){var m=j.p.altclass;b(j.rows).each(function(a){a%2==1?b(this).addClass(m):b(this).removeClass(m)})}});return k},setRowData:function(f,k,i){var h,g=false,j;this.each(function(){var m=this,a,q,t=typeof i;if(!m.grid)return false;q=m.rows.namedItem(f);if(!q)return false;k&&b(this.p.colModel).each(function(x){h=this.name;if(k[h]!==undefined){a=m.formatter(f,k[h],x,k,"edit");j=this.title?{title:b.jgrid.stripHtml(a)}:{};m.p.treeGrid===
-true&&h==m.p.ExpandColumn?b("td:eq("+x+") > span:first",q).html(a).attr(j):b("td:eq("+x+")",q).html(a).attr(j);g=true}});if(t==="string")b(q).addClass(i);else t==="object"&&b(q).css(i)});return g},addRowData:function(f,k,i,h){i||(i="last");var g=false,j,m,a,q,t,x,C,K,J="",F,Q,M,R;if(k){if(b.isArray(k)){F=true;i="last";Q=f}else{k=[k];F=false}this.each(function(){var u=this,la=k.length;t=u.p.rownumbers===true?1:0;a=u.p.multiselect===true?1:0;q=u.p.subGrid===true?1:0;if(!F)if(typeof f!="undefined")f+=
-"";else{f=u.p.records+1+"";if(u.p.keyIndex!==false){Q=u.p.colModel[u.p.keyIndex+a+q+t].name;if(typeof k[0][Q]!="undefined")f=k[0][Q]}}M=u.p.altclass;for(var ca=0,fa="",aa=b.isFunction(u.p.afterInsertRow)?true:false;ca<la;){R=k[ca];m="";if(F){try{f=R[Q]}catch(U){f=u.p.records+1}fa=u.p.altRows===true?(u.rows.length-1)%2===0?M:"":""}if(t){J=u.formatCol(t,1,"");m+='<td role="gridcell" aria-describedby="'+u.p.id+'_rn" class="ui-state-default jqgrid-rownum" '+J+">0</td>"}if(a){K='<input role="checkbox" type="checkbox" id="jqg_'+
-f+'" class="cbox"/>';J=u.formatCol(t,1,"");m+='<td role="gridcell" aria-describedby="'+u.p.id+'_cb" '+J+">"+K+"</td>"}if(q)m+=b(u).jqGrid("addSubGridCell",a+t,1);for(C=a+q+t;C<this.p.colModel.length;C++){j=this.p.colModel[C].name;K=u.formatter(f,R[j],C,R,"add");J=u.formatCol(C,1,K);m+='<td role="gridcell" aria-describedby="'+u.p.id+"_"+j+'" '+J+">"+K+"</td>"}m='<tr id="'+f+'" role="row" class="ui-widget-content jqgrow ui-row-'+u.p.direction+" "+fa+'">'+m+"</tr>";if(u.p.subGrid===true){m=b(m)[0];b(u).jqGrid("addSubGrid",
-m,a+t)}if(u.rows.length===0)b("table:first",u.grid.bDiv).append(m);else switch(i){case "last":b(u.rows[u.rows.length-1]).after(m);break;case "first":b(u.rows[0]).before(m);break;case "after":if(x=u.rows.namedItem(h))b(u.rows[x.rowIndex+1]).hasClass("ui-subgrid")?b(u.rows[x.rowIndex+1]).after(m):b(x).after(m);break;case "before":if(x=u.rows.namedItem(h)){b(x).before(m);x=x.rowIndex}break}u.p.records++;u.p.reccount++;if(!u.grid.cols||!u.grid.cols.length)u.grid.cols=u.rows[0].cells;if(i==="first"||i===
-"before"&&x<=1||u.rows.length===1)u.updateColumns();aa&&u.p.afterInsertRow.call(u,f,R,R);ca++}if(u.p.altRows===true&&!F)if(i=="last")(u.rows.length-1)%2==1&&b(u.rows[u.rows.length-1]).addClass(M);else b(u.rows).each(function(ia){ia%2==1?b(this).addClass(M):b(this).removeClass(M)});u.updatepager(true,true);g=true})}return g},footerData:function(f,k,i){function h(q){for(var t in q)if(q.hasOwnProperty(t))return false;return true}var g,j=false,m={},a;if(typeof f=="undefined")f="get";if(typeof i!="boolean")i=
-true;f=f.toLowerCase();this.each(function(){var q=this,t;if(!q.grid||!q.p.footerrow)return false;if(f=="set")if(h(k))return false;j=true;b(this.p.colModel).each(function(x){g=this.name;if(f=="set"){if(k[g]!==undefined){t=i?q.formatter("",k[g],x,k,"edit"):k[g];a=this.title?{title:b.jgrid.stripHtml(t)}:{};b("tr.footrow td:eq("+x+")",q.grid.sDiv).html(t).attr(a);j=true}}else if(f=="get")m[g]=b("tr.footrow td:eq("+x+")",q.grid.sDiv).html()})});return f=="get"?m:j},ShowHideCol:function(f,k){return this.each(function(){var i=
-this,h=false;if(i.grid){if(typeof f==="string")f=[f];k=k!="none"?"":"none";var g=k==""?true:false;b(this.p.colModel).each(function(j){if(b.inArray(this.name,f)!==-1&&this.hidden===g){b("tr",i.grid.hDiv).each(function(){b("th:eq("+j+")",this).css("display",k)});b(i.rows).each(function(m){b("td:eq("+j+")",i.rows[m]).css("display",k)});i.p.footerrow&&b("td:eq("+j+")",i.grid.sDiv).css("display",k);if(k=="none")i.p.tblwidth-=this.width;else i.p.tblwidth+=this.width;this.hidden=!g;h=true}});if(h===true){b("table:first",
-i.grid.hDiv).width(i.p.tblwidth);b("table:first",i.grid.bDiv).width(i.p.tblwidth);i.grid.hDiv.scrollLeft=i.grid.bDiv.scrollLeft;if(i.p.footerrow){b("table:first",i.grid.sDiv).width(i.p.tblwidth);i.grid.sDiv.scrollLeft=i.grid.bDiv.scrollLeft}}}})},hideCol:function(f){return this.each(function(){b(this).jqGrid("ShowHideCol",f,"none")})},showCol:function(f){return this.each(function(){b(this).jqGrid("ShowHideCol",f,"")})},remapColumns:function(f,k,i){function h(m){var a;a=m.length?b.makeArray(m):b.extend({},
-m);b.each(f,function(q){m[q]=a[this]})}function g(m,a){b(">tr"+(a||""),m).each(function(){var q=this,t=b.makeArray(q.cells);b.each(f,function(){var x=t[this];x&&q.appendChild(x)})})}var j=this.get(0);h(j.p.colModel);h(j.p.colNames);h(j.grid.headers);g(b("thead:first",j.grid.hDiv),i&&":not(.ui-jqgrid-labels)");k&&g(b("tbody:first",j.grid.bDiv),".jqgrow");j.p.footerrow&&g(b("tbody:first",j.grid.sDiv));if(j.p.remapColumns)if(j.p.remapColumns.length)h(j.p.remapColumns);else j.p.remapColumns=b.makeArray(f);
-j.p.lastsort=b.inArray(j.p.lastsort,f);if(j.p.treeGrid)j.p.expColInd=b.inArray(j.p.expColInd,f)},setGridWidth:function(f,k){return this.each(function(){var i=this,h,g=0,j=i.p.cellLayout,m,a=0,q=false,t=i.p.scrollOffset,x,C=0,K=0,J=0,F;if(i.grid){if(typeof k!="boolean")k=i.p.shrinkToFit;if(!isNaN(f)){f=parseInt(f,10);i.grid.width=i.p.width=f;b("#gbox_"+i.p.id).css("width",f+"px");b("#gview_"+i.p.id).css("width",f+"px");b(i.grid.bDiv).css("width",f+"px");b(i.grid.hDiv).css("width",f+"px");i.p.pager&&
-b(i.p.pager).css("width",f+"px");i.p.toppager&&b(i.p.toppager).css("width",f+"px");if(i.p.toolbar[0]===true){b(i.grid.uDiv).css("width",f+"px");i.p.toolbar[1]=="both"&&b(i.grid.ubDiv).css("width",f+"px")}i.p.footerrow&&b(i.grid.sDiv).css("width",f+"px");if(k===false&&i.p.forceFit===true)i.p.forceFit=false;if(k===true){if(b.browser.safari)j=0;b.each(i.p.colModel,function(){if(this.hidden===false){g+=parseInt(this.width,10);if(this.fixed){K+=this.width;C+=this.width+j}else a++;J++}});if(a!==0){i.p.tblwidth=
-g;x=f-j*a-C;if(!isNaN(i.p.height))if(b(i.grid.bDiv)[0].clientHeight<b(i.grid.bDiv)[0].scrollHeight){q=true;x-=t}g=0;var Q=i.grid.cols.length>0;b.each(i.p.colModel,function(M){if(this.hidden===false&&!this.fixed){h=Math.round(x*this.width/(i.p.tblwidth-K));if(!(h<0)){this.width=h;g+=h;i.grid.headers[M].width=h;i.grid.headers[M].el.style.width=h+"px";if(i.p.footerrow)i.grid.footers[M].style.width=h+"px";if(Q)i.grid.cols[M].style.width=h+"px";m=M}}});F=0;if(q){if(f-C-(g+j*a)!==t)F=f-C-(g+j*a)-t}else if(Math.abs(f-
-C-(g+j*a))!==1)F=f-C-(g+j*a);i.p.colModel[m].width+=F;i.p.tblwidth=g+F+K+j*J;if(i.p.tblwidth>f){q=i.p.tblwidth-parseInt(f,10);i.p.tblwidth=f;h=i.p.colModel[m].width-=q}else h=i.p.colModel[m].width;i.grid.headers[m].width=h;i.grid.headers[m].el.style.width=h+"px";if(Q)i.grid.cols[m].style.width=h+"px";b("table:first",i.grid.bDiv).css("width",i.p.tblwidth+"px");b("table:first",i.grid.hDiv).css("width",i.p.tblwidth+"px");i.grid.hDiv.scrollLeft=i.grid.bDiv.scrollLeft;if(i.p.footerrow){i.grid.footers[m].style.width=
-h+"px";b("table:first",i.grid.sDiv).css("width",i.p.tblwidth+"px")}}}}}})},setGridHeight:function(f){return this.each(function(){var k=this;if(k.grid){b(k.grid.bDiv).css({height:f+(isNaN(f)?"":"px")});k.p.height=f;k.p.scroll&&k.grid.populateVisible()}})},setCaption:function(f){return this.each(function(){this.p.caption=f;b("span.ui-jqgrid-title",this.grid.cDiv).html(f);b(this.grid.cDiv).show()})},setLabel:function(f,k,i,h){return this.each(function(){var g=this,j=-1;if(g.grid){if(isNaN(f))b(g.p.colModel).each(function(q){if(this.name==
-f){j=q;return false}});else j=parseInt(f,10);if(j>=0){var m=b("tr.ui-jqgrid-labels th:eq("+j+")",g.grid.hDiv);if(k){var a=b(".s-ico",m);b("[id^=jqgh_]",m).empty().html(k).append(a);g.p.colNames[j]=k}if(i)typeof i==="string"?b(m).addClass(i):b(m).css(i);typeof h==="object"&&b(m).attr(h)}}})},setCell:function(f,k,i,h,g,j){return this.each(function(){var m=this,a=-1,q,t;if(m.grid){if(isNaN(k))b(m.p.colModel).each(function(C){if(this.name==k){a=C;return false}});else a=parseInt(k,10);if(a>=0)if(q=m.rows.namedItem(f)){var x=
-b("td:eq("+a+")",q);if(i!==""||j===true){q=m.formatter(f,i,a,q,"edit");t=m.p.colModel[a].title?{title:b.jgrid.stripHtml(q)}:{};m.p.treeGrid&&b(".tree-wrap",b(x)).length>0?b("span",b(x)).html(q).attr(t):b(x).html(q).attr(t)}if(typeof h==="string")b(x).addClass(h);else h&&b(x).css(h);typeof g==="object"&&b(x).attr(g)}}})},getCell:function(f,k){var i=false;this.each(function(){var h=this,g=-1;if(h.grid){if(isNaN(k))b(h.p.colModel).each(function(a){if(this.name===k){g=a;return false}});else g=parseInt(k,
-10);if(g>=0){var j=h.rows.namedItem(f);if(j)try{i=b.unformat(b("td:eq("+g+")",j),{rowId:j.id,colModel:h.p.colModel[g]},g)}catch(m){i=b.jgrid.htmlDecode(b("td:eq("+g+")",j).html())}}}});return i},getCol:function(f,k,i){var h=[],g,j=0;k=typeof k!="boolean"?false:k;if(typeof i=="undefined")i=false;this.each(function(){var m=this,a=-1;if(m.grid){if(isNaN(f))b(m.p.colModel).each(function(C){if(this.name===f){a=C;return false}});else a=parseInt(f,10);if(a>=0){var q=m.rows.length,t=0;if(q&&q>0){for(;t<q;){try{g=
-b.unformat(b(m.rows[t].cells[a]),{rowId:m.rows[t].id,colModel:m.p.colModel[a]},a)}catch(x){g=b.jgrid.htmlDecode(m.rows[t].cells[a].innerHTML)}if(i)j+=parseFloat(g);else if(k)h.push({id:m.rows[t].id,value:g});else h[t]=g;t++}if(i)switch(i.toLowerCase()){case "sum":h=j;break;case "avg":h=j/q;break;case "count":h=q;break}}}}});return h},clearGridData:function(f){return this.each(function(){var k=this;if(k.grid){if(typeof f!="boolean")f=false;b("tbody:first tr",k.grid.bDiv).remove();k.p.footerrow&&f&&
-b(".ui-jqgrid-ftable td",k.grid.sDiv).html("&#160;");k.p.selrow=null;k.p.selarrrow=[];k.p.savedRow=[];k.p.records=0;k.p.page="0";k.p.lastpage="0";k.p.reccount=0;k.updatepager(true,false)}})},getInd:function(f,k){var i=false,h;this.each(function(){if(h=this.rows.namedItem(f))i=k===true?h:h.rowIndex});return i}})})(jQuery);
+/*
+ jqGrid  4.2.0  - jQuery Grid
+ Copyright (c) 2008, Tony Tomov, tony@trirand.com
+ Dual licensed under the MIT and GPL licenses
+ http://www.opensource.org/licenses/mit-license.php
+ http://www.gnu.org/licenses/gpl-2.0.html
+ Date: 2011-10-11
+*/
+(function(b){b.jgrid=b.jgrid||{};b.extend(b.jgrid,{htmlDecode:function(f){if(f&&(f=="&nbsp;"||f=="&#160;"||f.length==1&&f.charCodeAt(0)==160))return"";return!f?f:String(f).replace(/&gt;/g,">").replace(/&lt;/g,"<").replace(/&quot;/g,'"').replace(/&amp;/g,"&")},htmlEncode:function(f){return!f?f:String(f).replace(/&/g,"&amp;").replace(/\"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")},format:function(f){var i=b.makeArray(arguments).slice(1);if(f===undefined)f="";return f.replace(/\{(\d+)\}/g,
+function(h,c){return i[c]})},getCellIndex:function(f){f=b(f);if(f.is("tr"))return-1;f=(!f.is("td")&&!f.is("th")?f.closest("td,th"):f)[0];if(b.browser.msie)return b.inArray(f,f.parentNode.cells);return f.cellIndex},stripHtml:function(f){f+="";var i=/<("[^"]*"|'[^']*'|[^'">])*>/gi;if(f)return(f=f.replace(i,""))&&f!=="&nbsp;"&&f!=="&#160;"?f.replace(/\"/g,"'"):"";else return f},stripPref:function(f,i){var h=Object.prototype.toString.call(f).slice(8,-1);if(h=="String"||h=="Number"){f=String(f);i=f!=""?
+String(i).replace(String(f),""):i}return i},stringToDoc:function(f){var i;if(typeof f!=="string")return f;try{i=(new DOMParser).parseFromString(f,"text/xml")}catch(h){i=new ActiveXObject("Microsoft.XMLDOM");i.async=false;i.loadXML(f)}return i&&i.documentElement&&i.documentElement.tagName!="parsererror"?i:null},parse:function(f){if(f.substr(0,9)=="while(1);")f=f.substr(9);if(f.substr(0,2)=="/*")f=f.substr(2,f.length-4);f||(f="{}");return b.jgrid.useJSON===true&&typeof JSON==="object"&&typeof JSON.parse===
+"function"?JSON.parse(f):eval("("+f+")")},parseDate:function(f,i){var h={m:1,d:1,y:1970,h:0,i:0,s:0},c,g,k;c=/[\\\/:_;.,\t\T\s-]/;if(i&&i!==null&&i!==undefined){i=b.trim(i);i=i.split(c);f=f.split(c);var l=b.jgrid.formatter.date.monthNames,a=b.jgrid.formatter.date.AmPm,r=function(x,y){if(x===0){if(y==12)y=0}else if(y!=12)y+=12;return y};c=0;for(g=f.length;c<g;c++){if(f[c]=="M"){k=b.inArray(i[c],l);if(k!==-1&&k<12)i[c]=k+1}if(f[c]=="F"){k=b.inArray(i[c],l);if(k!==-1&&k>11)i[c]=k+1-12}if(f[c]=="a"){k=
+b.inArray(i[c],a);if(k!==-1&&k<2&&i[c]==a[k]){i[c]=k;h.h=r(i[c],h.h)}}if(f[c]=="A"){k=b.inArray(i[c],a);if(k!==-1&&k>1&&i[c]==a[k]){i[c]=k-2;h.h=r(i[c],h.h)}}if(i[c]!==undefined)h[f[c].toLowerCase()]=parseInt(i[c],10)}h.m=parseInt(h.m,10)-1;c=h.y;if(c>=70&&c<=99)h.y=1900+h.y;else if(c>=0&&c<=69)h.y=2E3+h.y}return new Date(h.y,h.m,h.d,h.h,h.i,h.s,0)},jqID:function(f){return String(f).replace(/[!"#$%&'()*+,.\/:;<=>?@\[\\\]\^`{|}~]/g,"\\$&")},guid:1,uidPref:"jqg",randId:function(f){return(f?f:b.jgrid.uidPref)+
+b.jgrid.guid++},getAccessor:function(f,i){var h,c,g=[],k;if(typeof i==="function")return i(f);h=f[i];if(h===undefined)try{if(typeof i==="string")g=i.split(".");if(k=g.length)for(h=f;h&&k--;){c=g.shift();h=h[c]}}catch(l){}return h},ajaxOptions:{},from:function(f){return new function(i,h){if(typeof i=="string")i=b.data(i);var c=this,g=i,k=true,l=false,a=h,r=/[\$,%]/g,x=null,y=null,H=0,L=false,M="",P=[],U=true;if(typeof i=="object"&&i.push){if(i.length>0)U=typeof i[0]!="object"?false:true}else throw"data provides is not an array";
+this._hasData=function(){return g===null?false:g.length===0?false:true};this._getStr=function(o){var n=[];l&&n.push("jQuery.trim(");n.push("String("+o+")");l&&n.push(")");k||n.push(".toLowerCase()");return n.join("")};this._strComp=function(o){return typeof o=="string"?".toString()":""};this._group=function(o,n){return{field:o.toString(),unique:n,items:[]}};this._toStr=function(o){if(l)o=b.trim(o);k||(o=o.toLowerCase());return o=o.toString().replace(/\\/g,"\\\\").replace(/\"/g,'\\"')};this._funcLoop=
+function(o){var n=[];b.each(g,function(s,D){n.push(o(D))});return n};this._append=function(o){var n;if(a===null)a="";else a+=M===""?" && ":M;for(n=0;n<H;n++)a+="(";if(L)a+="!";a+="("+o+")";L=false;M="";H=0};this._setCommand=function(o,n){x=o;y=n};this._resetNegate=function(){L=false};this._repeatCommand=function(o,n){if(x===null)return c;if(o!==null&&n!==null)return x(o,n);if(y===null)return x(o);if(!U)return x(o);return x(y,o)};this._equals=function(o,n){return c._compare(o,n,1)===0};this._compare=
+function(o,n,s){if(s===undefined)s=1;if(o===undefined)o=null;if(n===undefined)n=null;if(o===null&&n===null)return 0;if(o===null&&n!==null)return 1;if(o!==null&&n===null)return-1;if(!k&&typeof o!=="number"&&typeof n!=="number"){o=String(o).toLowerCase();n=String(n).toLowerCase()}if(o<n)return-s;if(o>n)return s;return 0};this._performSort=function(){if(P.length!==0)g=c._doSort(g,0)};this._doSort=function(o,n){var s=P[n].by,D=P[n].dir,T=P[n].type,J=P[n].datefmt;if(n==P.length-1)return c._getOrder(o,
+s,D,T,J);n++;s=c._getGroup(o,s,D,T,J);D=[];for(T=0;T<s.length;T++){J=c._doSort(s[T].items,n);for(var C=0;C<J.length;C++)D.push(J[C])}return D};this._getOrder=function(o,n,s,D,T){var J=[],C=[],ca=s=="a"?1:-1,V,fa;if(D===undefined)D="text";fa=D=="float"||D=="number"||D=="currency"||D=="numeric"?function(R){R=parseFloat(String(R).replace(r,""));return isNaN(R)?0:R}:D=="int"||D=="integer"?function(R){return R?parseFloat(String(R).replace(r,"")):0}:D=="date"||D=="datetime"?function(R){return b.jgrid.parseDate(T,
+R).getTime()}:b.isFunction(D)?D:function(R){R||(R="");return b.trim(String(R).toUpperCase())};b.each(o,function(R,$){V=n!==""?b.jgrid.getAccessor($,n):$;if(V===undefined)V="";V=fa(V,$);C.push({vSort:V,index:R})});C.sort(function(R,$){R=R.vSort;$=$.vSort;return c._compare(R,$,ca)});D=0;for(var oa=o.length;D<oa;){s=C[D].index;J.push(o[s]);D++}return J};this._getGroup=function(o,n,s,D,T){var J=[],C=null,ca=null,V;b.each(c._getOrder(o,n,s,D,T),function(fa,oa){V=b.jgrid.getAccessor(oa,n);if(V===undefined)V=
+"";if(!c._equals(ca,V)){ca=V;C!==null&&J.push(C);C=c._group(n,V)}C.items.push(oa)});C!==null&&J.push(C);return J};this.ignoreCase=function(){k=false;return c};this.useCase=function(){k=true;return c};this.trim=function(){l=true;return c};this.noTrim=function(){l=false;return c};this.execute=function(){var o=a,n=[];if(o===null)return c;b.each(g,function(){eval(o)&&n.push(this)});g=n;return c};this.data=function(){return g};this.select=function(o){c._performSort();if(!c._hasData())return[];c.execute();
+if(b.isFunction(o)){var n=[];b.each(g,function(s,D){n.push(o(D))});return n}return g};this.hasMatch=function(){if(!c._hasData())return false;c.execute();return g.length>0};this.andNot=function(o,n,s){L=!L;return c.and(o,n,s)};this.orNot=function(o,n,s){L=!L;return c.or(o,n,s)};this.not=function(o,n,s){return c.andNot(o,n,s)};this.and=function(o,n,s){M=" && ";if(o===undefined)return c;return c._repeatCommand(o,n,s)};this.or=function(o,n,s){M=" || ";if(o===undefined)return c;return c._repeatCommand(o,
+n,s)};this.orBegin=function(){H++;return c};this.orEnd=function(){if(a!==null)a+=")";return c};this.isNot=function(o){L=!L;return c.is(o)};this.is=function(o){c._append("this."+o);c._resetNegate();return c};this._compareValues=function(o,n,s,D,T){var J;J=U?"jQuery.jgrid.getAccessor(this,'"+n+"')":"this";if(s===undefined)s=null;var C=s,ca=T.stype===undefined?"text":T.stype;if(s!==null)switch(ca){case "int":case "integer":C=isNaN(Number(C))||C===""?"0":C;J="parseInt("+J+",10)";C="parseInt("+C+",10)";
+break;case "float":case "number":case "numeric":C=String(C).replace(r,"");C=isNaN(Number(C))||C===""?"0":C;J="parseFloat("+J+")";C="parseFloat("+C+")";break;case "date":case "datetime":C=String(b.jgrid.parseDate(T.newfmt||"Y-m-d",C).getTime());J='jQuery.jgrid.parseDate("'+T.srcfmt+'",'+J+").getTime()";break;default:J=c._getStr(J);C=c._getStr('"'+c._toStr(C)+'"')}c._append(J+" "+D+" "+C);c._setCommand(o,n);c._resetNegate();return c};this.equals=function(o,n,s){return c._compareValues(c.equals,o,n,
+"==",s)};this.notEquals=function(o,n,s){return c._compareValues(c.equals,o,n,"!==",s)};this.isNull=function(o,n,s){return c._compareValues(c.equals,o,null,"===",s)};this.greater=function(o,n,s){return c._compareValues(c.greater,o,n,">",s)};this.less=function(o,n,s){return c._compareValues(c.less,o,n,"<",s)};this.greaterOrEquals=function(o,n,s){return c._compareValues(c.greaterOrEquals,o,n,">=",s)};this.lessOrEquals=function(o,n,s){return c._compareValues(c.lessOrEquals,o,n,"<=",s)};this.startsWith=
+function(o,n){var s=n===undefined||n===null?o:n;s=l?b.trim(s.toString()).length:s.toString().length;if(U)c._append(c._getStr("jQuery.jgrid.getAccessor(this,'"+o+"')")+".substr(0,"+s+") == "+c._getStr('"'+c._toStr(n)+'"'));else{s=l?b.trim(n.toString()).length:n.toString().length;c._append(c._getStr("this")+".substr(0,"+s+") == "+c._getStr('"'+c._toStr(o)+'"'))}c._setCommand(c.startsWith,o);c._resetNegate();return c};this.endsWith=function(o,n){var s=n===undefined||n===null?o:n;s=l?b.trim(s.toString()).length:
+s.toString().length;U?c._append(c._getStr("jQuery.jgrid.getAccessor(this,'"+o+"')")+".substr("+c._getStr("jQuery.jgrid.getAccessor(this,'"+o+"')")+".length-"+s+","+s+') == "'+c._toStr(n)+'"'):c._append(c._getStr("this")+".substr("+c._getStr("this")+'.length-"'+c._toStr(o)+'".length,"'+c._toStr(o)+'".length) == "'+c._toStr(o)+'"');c._setCommand(c.endsWith,o);c._resetNegate();return c};this.contains=function(o,n){U?c._append(c._getStr("jQuery.jgrid.getAccessor(this,'"+o+"')")+'.indexOf("'+c._toStr(n)+
+'",0) > -1'):c._append(c._getStr("this")+'.indexOf("'+c._toStr(o)+'",0) > -1');c._setCommand(c.contains,o);c._resetNegate();return c};this.groupBy=function(o,n,s,D){if(!c._hasData())return null;return c._getGroup(g,o,n,s,D)};this.orderBy=function(o,n,s,D){n=n===undefined||n===null?"a":b.trim(n.toString().toLowerCase());if(s===null||s===undefined)s="text";if(D===null||D===undefined)D="Y-m-d";if(n=="desc"||n=="descending")n="d";if(n=="asc"||n=="ascending")n="a";P.push({by:o,dir:n,type:s,datefmt:D});
+return c};return c}(f,null)},extend:function(f){b.extend(b.fn.jqGrid,f);this.no_legacy_api||b.fn.extend(f)}});b.fn.jqGrid=function(f){if(typeof f=="string"){var i=b.jgrid.getAccessor(b.fn.jqGrid,f);if(!i)throw"jqGrid - No such method: "+f;var h=b.makeArray(arguments).slice(1);return i.apply(this,h)}return this.each(function(){if(!this.grid){var c=b.extend(true,{url:"",height:150,page:1,rowNum:20,rowTotal:null,records:0,pager:"",pgbuttons:true,pginput:true,colModel:[],rowList:[],colNames:[],sortorder:"asc",
+sortname:"",datatype:"xml",mtype:"GET",altRows:false,selarrrow:[],savedRow:[],shrinkToFit:true,xmlReader:{},jsonReader:{},subGrid:false,subGridModel:[],reccount:0,lastpage:0,lastsort:0,selrow:null,beforeSelectRow:null,onSelectRow:null,onSortCol:null,ondblClickRow:null,onRightClickRow:null,onPaging:null,onSelectAll:null,loadComplete:null,gridComplete:null,loadError:null,loadBeforeSend:null,afterInsertRow:null,beforeRequest:null,beforeProcessing:null,onHeaderClick:null,viewrecords:false,loadonce:false,
+multiselect:false,multikey:false,editurl:null,search:false,caption:"",hidegrid:true,hiddengrid:false,postData:{},userData:{},treeGrid:false,treeGridModel:"nested",treeReader:{},treeANode:-1,ExpandColumn:null,tree_root_level:0,prmNames:{page:"page",rows:"rows",sort:"sidx",order:"sord",search:"_search",nd:"nd",id:"id",oper:"oper",editoper:"edit",addoper:"add",deloper:"del",subgridid:"id",npage:null,totalrows:"totalrows"},forceFit:false,gridstate:"visible",cellEdit:false,cellsubmit:"remote",nv:0,loadui:"enable",
+toolbar:[false,""],scroll:false,multiboxonly:false,deselectAfterSort:true,scrollrows:false,autowidth:false,scrollOffset:18,cellLayout:5,subGridWidth:20,multiselectWidth:20,gridview:false,rownumWidth:25,rownumbers:false,pagerpos:"center",recordpos:"right",footerrow:false,userDataOnFooter:false,hoverrows:true,altclass:"ui-priority-secondary",viewsortcols:[false,"vertical",true],resizeclass:"",autoencode:false,remapColumns:[],ajaxGridOptions:{},direction:"ltr",toppager:false,headertitles:false,scrollTimeout:40,
+data:[],_index:{},grouping:false,groupingView:{groupField:[],groupOrder:[],groupText:[],groupColumnShow:[],groupSummary:[],showSummaryOnHide:false,sortitems:[],sortnames:[],groupDataSorted:false,summary:[],summaryval:[],plusicon:"ui-icon-circlesmall-plus",minusicon:"ui-icon-circlesmall-minus"},ignoreCase:false,cmTemplate:{},idPrefix:""},b.jgrid.defaults,f||{}),g={headers:[],cols:[],footers:[],dragStart:function(d,e,j){this.resizing={idx:d,startX:e.clientX,sOL:j[0]};this.hDiv.style.cursor="col-resize";
+this.curGbox=b("#rs_m"+b.jgrid.jqID(c.id),"#gbox_"+b.jgrid.jqID(c.id));this.curGbox.css({display:"block",left:j[0],top:j[1],height:j[2]});b.isFunction(c.resizeStart)&&c.resizeStart.call(this,e,d);document.onselectstart=function(){return false}},dragMove:function(d){if(this.resizing){var e=d.clientX-this.resizing.startX;d=this.headers[this.resizing.idx];var j=c.direction==="ltr"?d.width+e:d.width-e,m;if(j>33){this.curGbox.css({left:this.resizing.sOL+e});if(c.forceFit===true){m=this.headers[this.resizing.idx+
+c.nv];e=c.direction==="ltr"?m.width-e:m.width+e;if(e>33){d.newWidth=j;m.newWidth=e}}else{this.newWidth=c.direction==="ltr"?c.tblwidth+e:c.tblwidth-e;d.newWidth=j}}}},dragEnd:function(){this.hDiv.style.cursor="default";if(this.resizing){var d=this.resizing.idx,e=this.headers[d].newWidth||this.headers[d].width;e=parseInt(e,10);this.resizing=false;b("#rs_m"+b.jgrid.jqID(c.id)).css("display","none");c.colModel[d].width=e;this.headers[d].width=e;this.headers[d].el.style.width=e+"px";this.cols[d].style.width=
+e+"px";if(this.footers.length>0)this.footers[d].style.width=e+"px";if(c.forceFit===true){e=this.headers[d+c.nv].newWidth||this.headers[d+c.nv].width;this.headers[d+c.nv].width=e;this.headers[d+c.nv].el.style.width=e+"px";this.cols[d+c.nv].style.width=e+"px";if(this.footers.length>0)this.footers[d+c.nv].style.width=e+"px";c.colModel[d+c.nv].width=e}else{c.tblwidth=this.newWidth||c.tblwidth;b("table:first",this.bDiv).css("width",c.tblwidth+"px");b("table:first",this.hDiv).css("width",c.tblwidth+"px");
+this.hDiv.scrollLeft=this.bDiv.scrollLeft;if(c.footerrow){b("table:first",this.sDiv).css("width",c.tblwidth+"px");this.sDiv.scrollLeft=this.bDiv.scrollLeft}}b.isFunction(c.resizeStop)&&c.resizeStop.call(this,e,d)}this.curGbox=null;document.onselectstart=function(){return true}},populateVisible:function(){g.timer&&clearTimeout(g.timer);g.timer=null;var d=b(g.bDiv).height();if(d){var e=b("table:first",g.bDiv),j,m;if(e[0].rows.length)try{m=(j=e[0].rows[1])?b(j).outerHeight()||g.prevRowHeight:g.prevRowHeight}catch(p){m=
+g.prevRowHeight}if(m){g.prevRowHeight=m;var B=c.rowNum;j=g.scrollTop=g.bDiv.scrollTop;var t=Math.round(e.position().top)-j,E=t+e.height();m*=B;var v,z,u;if(E<d&&t<=0&&(c.lastpage===undefined||parseInt((E+j+m-1)/m,10)<=c.lastpage)){z=parseInt((d-E+m-1)/m,10);if(E>=0||z<2||c.scroll===true){v=Math.round((E+j)/m)+1;t=-1}else t=1}if(t>0){v=parseInt(j/m,10)+1;z=parseInt((j+d)/m,10)+2-v;u=true}if(z)if(!(c.lastpage&&v>c.lastpage||c.lastpage==1||v===c.page&&v===c.lastpage))if(g.hDiv.loading)g.timer=setTimeout(g.populateVisible,
+c.scrollTimeout);else{c.page=v;if(u){g.selectionPreserver(e[0]);g.emptyRows(g.bDiv,false,false)}g.populate(z)}}}},scrollGrid:function(d){if(c.scroll){var e=g.bDiv.scrollTop;if(g.scrollTop===undefined)g.scrollTop=0;if(e!=g.scrollTop){g.scrollTop=e;g.timer&&clearTimeout(g.timer);g.timer=setTimeout(g.populateVisible,c.scrollTimeout)}}g.hDiv.scrollLeft=g.bDiv.scrollLeft;if(c.footerrow)g.sDiv.scrollLeft=g.bDiv.scrollLeft;d&&d.stopPropagation()},selectionPreserver:function(d){var e=d.p,j=e.selrow,m=e.selarrrow?
+b.makeArray(e.selarrrow):null,p=d.grid.bDiv.scrollLeft,B=e.gridComplete;e.gridComplete=function(){e.selrow=null;e.selarrrow=[];if(e.multiselect&&m&&m.length>0)for(var t=0;t<m.length;t++)m[t]!=j&&b(d).jqGrid("setSelection",m[t],false);j&&b(d).jqGrid("setSelection",j,false);d.grid.bDiv.scrollLeft=p;e.gridComplete=B;e.gridComplete&&B()}}};if(this.tagName.toUpperCase()!="TABLE")alert("Element is not a table");else{b(this).empty().attr("tabindex","1");this.p=c;this.p.useProp=!!b.fn.prop;var k,l,a;if(this.p.colNames.length===
+0)for(k=0;k<this.p.colModel.length;k++)this.p.colNames[k]=this.p.colModel[k].label||this.p.colModel[k].name;if(this.p.colNames.length!==this.p.colModel.length)alert(b.jgrid.errors.model);else{var r=b("<div class='ui-jqgrid-view'></div>"),x,y=b.browser.msie?true:false,H=b.browser.webkit||b.browser.safari?true:false;a=this;a.p.direction=b.trim(a.p.direction.toLowerCase());if(b.inArray(a.p.direction,["ltr","rtl"])==-1)a.p.direction="ltr";l=a.p.direction;b(r).insertBefore(this);b(this).appendTo(r).removeClass("scroll");
+var L=b("<div class='ui-jqgrid ui-widget ui-widget-content ui-corner-all'></div>");b(L).insertBefore(r).attr({id:"gbox_"+this.id,dir:l});b(r).appendTo(L).attr("id","gview_"+this.id);x=y&&b.browser.version<=6?'<iframe style="display:block;position:absolute;z-index:-1;filter:Alpha(Opacity=\'0\');" src="javascript:false;"></iframe>':"";b("<div class='ui-widget-overlay jqgrid-overlay' id='lui_"+this.id+"'></div>").append(x).insertBefore(r);b("<div class='loading ui-state-default ui-state-active' id='load_"+
+this.id+"'>"+this.p.loadtext+"</div>").insertBefore(r);b(this).attr({cellspacing:"0",cellpadding:"0",border:"0",role:"grid","aria-multiselectable":!!this.p.multiselect,"aria-labelledby":"gbox_"+this.id});var M=function(d,e){d=parseInt(d,10);return isNaN(d)?e?e:0:d},P=function(d,e,j,m,p,B){var t=a.p.colModel[d],E=t.align,v='style="',z=t.classes,u=t.name,q=[];if(E)v+="text-align:"+E+";";if(t.hidden===true)v+="display:none;";if(e===0)v+="width: "+g.headers[d].width+"px;";else if(t.cellattr&&b.isFunction(t.cellattr))if((d=
+t.cellattr.call(a,p,j,m,t,B))&&typeof d==="string"){d=d.replace(/style/i,"style").replace(/title/i,"title");if(d.indexOf("title")>-1)t.title=false;if(d.indexOf("class")>-1)z=undefined;q=d.split("style");if(q.length===2){q[1]=b.trim(q[1].replace("=",""));if(q[1].indexOf("'")===0||q[1].indexOf('"')===0)q[1]=q[1].substring(1);v+=q[1].replace(/'/gi,'"')}else v+='"'}if(!q.length){q[0]="";v+='"'}v+=(z!==undefined?' class="'+z+'"':"")+(t.title&&j?' title="'+b.jgrid.stripHtml(j)+'"':"");v+=' aria-describedby="'+
+a.p.id+"_"+u+'"';return v+q[0]},U=function(d){return d===undefined||d===null||d===""?"&#160;":a.p.autoencode?b.jgrid.htmlEncode(d):d+""},o=function(d,e,j,m,p){var B=a.p.colModel[j];if(typeof B.formatter!=="undefined"){d={rowId:d,colModel:B,gid:a.p.id,pos:j};e=b.isFunction(B.formatter)?B.formatter.call(a,e,d,m,p):b.fmatter?b.fn.fmatter(B.formatter,e,d,m,p):U(e)}else e=U(e);return e},n=function(d,e,j,m,p){e=o(d,e,j,p,"add");return'<td role="gridcell" '+P(j,m,e,p,d,true)+">"+e+"</td>"},s=function(d,
+e,j){var m='<input role="checkbox" type="checkbox" id="jqg_'+a.p.id+"_"+d+'" class="cbox" name="jqg_'+a.p.id+"_"+d+'"/>';return'<td role="gridcell" '+P(e,j,"",null,d,true)+">"+m+"</td>"},D=function(d,e,j,m){j=(parseInt(j,10)-1)*parseInt(m,10)+1+e;return'<td role="gridcell" class="ui-state-default jqgrid-rownum" '+P(d,e,j,null,e,true)+">"+j+"</td>"},T=function(d){var e,j=[],m=0,p;for(p=0;p<a.p.colModel.length;p++){e=a.p.colModel[p];if(e.name!=="cb"&&e.name!=="subgrid"&&e.name!=="rn"){j[m]=d=="local"?
+e.name:d=="xml"?e.xmlmap||e.name:e.jsonmap||e.name;m++}}return j},J=function(d){var e=a.p.remapColumns;if(!e||!e.length)e=b.map(a.p.colModel,function(j,m){return m});if(d)e=b.map(e,function(j){return j<d?null:j-d});return e},C=function(d,e,j){if(a.p.deepempty)b("#"+b.jgrid.jqID(a.p.id)+" tbody:first tr:gt(0)").remove();else{var m=b("#"+b.jgrid.jqID(a.p.id)+" tbody:first tr:first")[0];b("#"+b.jgrid.jqID(a.p.id)+" tbody:first").empty().append(m)}if(e&&a.p.scroll){b(">div:first",d).css({height:"auto"}).children("div:first").css({height:0,
+display:"none"});d.scrollTop=0}if(j===true)if(a.p.treeGrid===true){a.p.data=[];a.p._index={}}},ca=function(){var d=a.p.data.length,e,j,m;e=a.p.rownumbers===true?1:0;j=a.p.multiselect===true?1:0;m=a.p.subGrid===true?1:0;e=a.p.keyIndex===false||a.p.loadonce===true?a.p.localReader.id:a.p.colModel[a.p.keyIndex+j+m+e].name;for(j=0;j<d;j++){m=b.jgrid.getAccessor(a.p.data[j],e);a.p._index[m]=j}},V=function(d,e,j,m,p){var B=new Date,t=a.p.datatype!="local"&&a.p.loadonce||a.p.datatype=="xmlstring",E=a.p.datatype==
+"local"?"local":"xml";if(t){a.p.data=[];a.p._index={};a.p.localReader.id="_id_"}a.p.reccount=0;if(b.isXMLDoc(d)){if(a.p.treeANode===-1&&!a.p.scroll){C(e,false,true);j=1}else j=j>1?j:1;var v,z,u=0,q,F=0,S=0,N=0,K,O=[],Y,I={},w,A,G=[],ia=a.p.altRows===true?" "+a.p.altclass:"";a.p.xmlReader.repeatitems||(O=T(E));K=a.p.keyIndex===false?a.p.xmlReader.id:a.p.keyIndex;if(O.length>0&&!isNaN(K)){if(a.p.remapColumns&&a.p.remapColumns.length)K=b.inArray(K,a.p.remapColumns);K=O[K]}E=(K+"").indexOf("[")===-1?
+O.length?function(ga,aa){return b(K,ga).text()||aa}:function(ga,aa){return b(a.p.xmlReader.cell,ga).eq(K).text()||aa}:function(ga,aa){return ga.getAttribute(K.replace(/[\[\]]/g,""))||aa};a.p.userData={};b(a.p.xmlReader.page,d).each(function(){a.p.page=this.textContent||this.text||0});b(a.p.xmlReader.total,d).each(function(){a.p.lastpage=this.textContent||this.text;if(a.p.lastpage===undefined)a.p.lastpage=1});b(a.p.xmlReader.records,d).each(function(){a.p.records=this.textContent||this.text||0});b(a.p.xmlReader.userdata,
+d).each(function(){a.p.userData[this.getAttribute("name")]=b(this).text()});(d=b(a.p.xmlReader.root+" "+a.p.xmlReader.row,d))||(d=[]);var ba=d.length,W=0,Z={},ha;if(d&&ba){ha=parseInt(a.p.rowNum,10);var pa=a.p.scroll?b.jgrid.randId():1;if(p)ha*=p+1;p=b.isFunction(a.p.afterInsertRow);var qa="";if(a.p.grouping&&a.p.groupingView.groupCollapse===true)qa=' style="display:none;"';for(;W<ba;){w=d[W];A=E(w,pa+W);A=a.p.idPrefix+A;v=j===0?0:j+1;v=(v+W)%2==1?ia:"";G.push("<tr"+qa+' id="'+A+'" tabindex="-1" role="row" class ="ui-widget-content jqgrow ui-row-'+
+a.p.direction+""+v+'">');if(a.p.rownumbers===true){G.push(D(0,W,a.p.page,a.p.rowNum));N=1}if(a.p.multiselect===true){G.push(s(A,N,W));F=1}if(a.p.subGrid===true){G.push(b(a).jqGrid("addSubGridCell",F+N,W+j));S=1}if(a.p.xmlReader.repeatitems){Y||(Y=J(F+S+N));var Ba=b(a.p.xmlReader.cell,w);b.each(Y,function(ga){var aa=Ba[this];if(!aa)return false;q=aa.textContent||aa.text;I[a.p.colModel[ga+F+S+N].name]=q;G.push(n(A,q,ga+F+S+N,W+j,w))})}else for(v=0;v<O.length;v++){q=b(O[v],w).text();I[a.p.colModel[v+
+F+S+N].name]=q;G.push(n(A,q,v+F+S+N,W+j,w))}G.push("</tr>");if(a.p.grouping){v=a.p.groupingView.groupField.length;for(var xa=[],ya=0;ya<v;ya++)xa.push(I[a.p.groupingView.groupField[ya]]);Z=b(a).jqGrid("groupingPrepare",G,xa,Z,I);G=[]}if(t||a.p.treeGrid===true){I._id_=A;a.p.data.push(I);a.p._index[A]=a.p.data.length-1}if(a.p.gridview===false){b("tbody:first",e).append(G.join(""));p&&a.p.afterInsertRow.call(a,A,I,w);G=[]}I={};u++;W++;if(u==ha)break}}if(a.p.gridview===true){z=a.p.treeANode>-1?a.p.treeANode:
+0;if(a.p.grouping){b(a).jqGrid("groupingRender",Z,a.p.colModel.length);Z=null}else a.p.treeGrid===true&&z>0?b(a.rows[z]).after(G.join("")):b("tbody:first",e).append(G.join(""))}if(a.p.subGrid===true)try{b(a).jqGrid("addSubGrid",F+N)}catch(Ia){}a.p.totaltime=new Date-B;if(u>0)if(a.p.records===0)a.p.records=ba;G=null;if(a.p.treeGrid===true)try{b(a).jqGrid("setTreeNode",z+1,u+z+1)}catch(Ja){}if(!a.p.treeGrid&&!a.p.scroll)a.grid.bDiv.scrollTop=0;a.p.reccount=u;a.p.treeANode=-1;a.p.userDataOnFooter&&b(a).jqGrid("footerData",
+"set",a.p.userData,true);if(t){a.p.records=ba;a.p.lastpage=Math.ceil(ba/ha)}m||a.updatepager(false,true);if(t)for(;u<ba;){w=d[u];A=E(w,u);A=a.p.idPrefix+A;if(a.p.xmlReader.repeatitems){Y||(Y=J(F+S+N));var Fa=b(a.p.xmlReader.cell,w);b.each(Y,function(ga){var aa=Fa[this];if(!aa)return false;q=aa.textContent||aa.text;I[a.p.colModel[ga+F+S+N].name]=q})}else for(v=0;v<O.length;v++){q=b(O[v],w).text();I[a.p.colModel[v+F+S+N].name]=q}I._id_=A;a.p.data.push(I);a.p._index[A]=a.p.data.length-1;I={};u++}}},
+fa=function(d,e,j,m,p){var B=new Date;if(d){if(a.p.treeANode===-1&&!a.p.scroll){C(e,false,true);j=1}else j=j>1?j:1;var t,E=a.p.datatype!="local"&&a.p.loadonce||a.p.datatype=="jsonstring";if(E){a.p.data=[];a.p._index={};a.p.localReader.id="_id_"}a.p.reccount=0;if(a.p.datatype=="local"){e=a.p.localReader;t="local"}else{e=a.p.jsonReader;t="json"}var v=0,z,u,q=[],F,S=0,N=0,K=0,O,Y,I={},w,A,G=[],ia=a.p.altRows===true?" "+a.p.altclass:"";a.p.page=b.jgrid.getAccessor(d,e.page)||0;O=b.jgrid.getAccessor(d,
+e.total);a.p.lastpage=O===undefined?1:O;a.p.records=b.jgrid.getAccessor(d,e.records)||0;a.p.userData=b.jgrid.getAccessor(d,e.userdata)||{};e.repeatitems||(F=q=T(t));t=a.p.keyIndex===false?e.id:a.p.keyIndex;if(q.length>0&&!isNaN(t)){if(a.p.remapColumns&&a.p.remapColumns.length)t=b.inArray(t,a.p.remapColumns);t=q[t]}(Y=b.jgrid.getAccessor(d,e.root))||(Y=[]);O=Y.length;d=0;var ba=parseInt(a.p.rowNum,10),W=a.p.scroll?b.jgrid.randId():1;if(p)ba*=p+1;var Z=b.isFunction(a.p.afterInsertRow),ha={},pa="";if(a.p.grouping&&
+a.p.groupingView.groupCollapse===true)pa=' style="display:none;"';for(;d<O;){p=Y[d];A=b.jgrid.getAccessor(p,t);if(A===undefined){A=W+d;if(q.length===0)if(e.cell)A=b.jgrid.getAccessor(p,e.cell)[t]||A}A=a.p.idPrefix+A;z=j===1?0:j;z=(z+d)%2==1?ia:"";G.push("<tr"+pa+' id="'+A+'" tabindex="-1" role="row" class= "ui-widget-content jqgrow ui-row-'+a.p.direction+""+z+'">');if(a.p.rownumbers===true){G.push(D(0,d,a.p.page,a.p.rowNum));K=1}if(a.p.multiselect){G.push(s(A,K,d));S=1}if(a.p.subGrid){G.push(b(a).jqGrid("addSubGridCell",
+S+K,d+j));N=1}if(e.repeatitems){if(e.cell)p=b.jgrid.getAccessor(p,e.cell);F||(F=J(S+N+K))}for(u=0;u<F.length;u++){z=b.jgrid.getAccessor(p,F[u]);G.push(n(A,z,u+S+N+K,d+j,p));I[a.p.colModel[u+S+N+K].name]=z}G.push("</tr>");if(a.p.grouping){z=a.p.groupingView.groupField.length;u=[];for(var qa=0;qa<z;qa++)u.push(I[a.p.groupingView.groupField[qa]]);ha=b(a).jqGrid("groupingPrepare",G,u,ha,I);G=[]}if(E||a.p.treeGrid===true){I._id_=A;a.p.data.push(I);a.p._index[A]=a.p.data.length-1}if(a.p.gridview===false){b("#"+
+b.jgrid.jqID(a.p.id)+" tbody:first").append(G.join(""));Z&&a.p.afterInsertRow.call(a,A,I,p);G=[]}I={};v++;d++;if(v==ba)break}if(a.p.gridview===true){w=a.p.treeANode>-1?a.p.treeANode:0;if(a.p.grouping)b(a).jqGrid("groupingRender",ha,a.p.colModel.length);else a.p.treeGrid===true&&w>0?b(a.rows[w]).after(G.join("")):b("#"+b.jgrid.jqID(a.p.id)+" tbody:first").append(G.join(""))}if(a.p.subGrid===true)try{b(a).jqGrid("addSubGrid",S+K)}catch(Ba){}a.p.totaltime=new Date-B;if(v>0)if(a.p.records===0)a.p.records=
+O;if(a.p.treeGrid===true)try{b(a).jqGrid("setTreeNode",w+1,v+w+1)}catch(xa){}if(!a.p.treeGrid&&!a.p.scroll)a.grid.bDiv.scrollTop=0;a.p.reccount=v;a.p.treeANode=-1;a.p.userDataOnFooter&&b(a).jqGrid("footerData","set",a.p.userData,true);if(E){a.p.records=O;a.p.lastpage=Math.ceil(O/ba)}m||a.updatepager(false,true);if(E)for(;v<O&&Y[v];){p=Y[v];A=b.jgrid.getAccessor(p,t);if(A===undefined){A=W+v;if(q.length===0)if(e.cell)A=b.jgrid.getAccessor(p,e.cell)[t]||A}if(p){A=a.p.idPrefix+A;if(e.repeatitems){if(e.cell)p=
+b.jgrid.getAccessor(p,e.cell);F||(F=J(S+N+K))}for(u=0;u<F.length;u++){z=b.jgrid.getAccessor(p,F[u]);I[a.p.colModel[u+S+N+K].name]=z}I._id_=A;a.p.data.push(I);a.p._index[A]=a.p.data.length-1;I={}}v++}}},oa=function(){function d(w){var A=0,G,ia,ba,W,Z;if(w.groups!==undefined){(ia=w.groups.length&&w.groupOp.toString().toUpperCase()==="OR")&&q.orBegin();for(G=0;G<w.groups.length;G++){A>0&&ia&&q.or();try{d(w.groups[G])}catch(ha){alert(ha)}A++}ia&&q.orEnd()}if(w.rules!==undefined){if(A>0){ia=q.select();
+q=b.jgrid.from(ia);if(a.p.ignoreCase)q=q.ignoreCase()}try{(ba=w.rules.length&&w.groupOp.toString().toUpperCase()==="OR")&&q.orBegin();for(G=0;G<w.rules.length;G++){Z=w.rules[G];W=w.groupOp.toString().toUpperCase();if(u[Z.op]&&Z.field){if(A>0&&W&&W==="OR")q=q.or();q=u[Z.op](q,W)(Z.field,Z.data,m[Z.field])}A++}ba&&q.orEnd()}catch(pa){alert(pa)}}}var e,j=false,m={},p=[],B=[],t,E,v;if(b.isArray(a.p.data)){var z=a.p.grouping?a.p.groupingView:false;b.each(a.p.colModel,function(){E=this.sorttype||"text";
+if(E=="date"||E=="datetime"){if(this.formatter&&typeof this.formatter==="string"&&this.formatter=="date"){t=this.formatoptions&&this.formatoptions.srcformat?this.formatoptions.srcformat:b.jgrid.formatter.date.srcformat;v=this.formatoptions&&this.formatoptions.newformat?this.formatoptions.newformat:b.jgrid.formatter.date.newformat}else t=v=this.datefmt||"Y-m-d";m[this.name]={stype:E,srcfmt:t,newfmt:v}}else m[this.name]={stype:E,srcfmt:"",newfmt:""};if(a.p.grouping&&this.name==z.groupField[0]){var w=
+this.name;if(typeof this.index!="undefined")w=this.index;p[0]=m[w];B.push(w)}if(!j&&(this.index==a.p.sortname||this.name==a.p.sortname)){e=this.name;j=true}});if(a.p.treeGrid)b(a).jqGrid("SortTree",e,a.p.sortorder,m[e].stype,m[e].srcfmt);else{var u={eq:function(w){return w.equals},ne:function(w){return w.notEquals},lt:function(w){return w.less},le:function(w){return w.lessOrEquals},gt:function(w){return w.greater},ge:function(w){return w.greaterOrEquals},cn:function(w){return w.contains},nc:function(w,
+A){return A==="OR"?w.orNot().contains:w.andNot().contains},bw:function(w){return w.startsWith},bn:function(w,A){return A==="OR"?w.orNot().startsWith:w.andNot().startsWith},en:function(w,A){return A==="OR"?w.orNot().endsWith:w.andNot().endsWith},ew:function(w){return w.endsWith},ni:function(w,A){return A==="OR"?w.orNot().equals:w.andNot().equals},"in":function(w){return w.equals},nu:function(w){return w.isNull},nn:function(w,A){return A==="OR"?w.orNot().isNull:w.andNot().isNull}},q=b.jgrid.from(a.p.data);
+if(a.p.ignoreCase)q=q.ignoreCase();if(a.p.search===true){var F=a.p.postData.filters;if(F){if(typeof F=="string")F=b.jgrid.parse(F);d(F)}else try{q=u[a.p.postData.searchOper](q)(a.p.postData.searchField,a.p.postData.searchString,m[a.p.postData.searchField])}catch(S){}}if(a.p.grouping){q.orderBy(B,z.groupOrder[0],p[0].stype,p[0].srcfmt);z.groupDataSorted=true}if(e&&a.p.sortorder&&j)a.p.sortorder.toUpperCase()=="DESC"?q.orderBy(a.p.sortname,"d",m[e].stype,m[e].srcfmt):q.orderBy(a.p.sortname,"a",m[e].stype,
+m[e].srcfmt);F=q.select();var N=parseInt(a.p.rowNum,10),K=F.length,O=parseInt(a.p.page,10),Y=Math.ceil(K/N),I={};F=F.slice((O-1)*N,O*N);m=q=null;I[a.p.localReader.total]=Y;I[a.p.localReader.page]=O;I[a.p.localReader.records]=K;I[a.p.localReader.root]=F;I[a.p.localReader.userdata]=a.p.userData;F=null;return I}}},R=function(){a.grid.hDiv.loading=true;if(!a.p.hiddengrid)switch(a.p.loadui){case "enable":b("#load_"+b.jgrid.jqID(a.p.id)).show();break;case "block":b("#lui_"+b.jgrid.jqID(a.p.id)).show();
+b("#load_"+b.jgrid.jqID(a.p.id)).show()}},$=function(){a.grid.hDiv.loading=false;switch(a.p.loadui){case "enable":b("#load_"+b.jgrid.jqID(a.p.id)).hide();break;case "block":b("#lui_"+b.jgrid.jqID(a.p.id)).hide();b("#load_"+b.jgrid.jqID(a.p.id)).hide()}},ja=function(d){if(!a.grid.hDiv.loading){var e=a.p.scroll&&d===false,j={},m,p=a.p.prmNames;if(a.p.page<=0)a.p.page=1;if(p.search!==null)j[p.search]=a.p.search;if(p.nd!==null)j[p.nd]=(new Date).getTime();if(p.rows!==null)j[p.rows]=a.p.rowNum;if(p.page!==
+null)j[p.page]=a.p.page;if(p.sort!==null)j[p.sort]=a.p.sortname;if(p.order!==null)j[p.order]=a.p.sortorder;if(a.p.rowTotal!==null&&p.totalrows!==null)j[p.totalrows]=a.p.rowTotal;var B=a.p.loadComplete,t=b.isFunction(B);t||(B=null);var E=0;d=d||1;if(d>1)if(p.npage!==null){j[p.npage]=d;E=d-1;d=1}else B=function(z){a.p.page++;a.grid.hDiv.loading=false;t&&a.p.loadComplete.call(a,z);ja(d-1)};else p.npage!==null&&delete a.p.postData[p.npage];if(a.p.grouping){b(a).jqGrid("groupingSetup");if(a.p.groupingView.groupDataSorted===
+true)j[p.sort]=a.p.groupingView.groupField[0]+" "+a.p.groupingView.groupOrder[0]+", "+j[p.sort]}b.extend(a.p.postData,j);var v=!a.p.scroll?1:a.rows.length-1;if(b.isFunction(a.p.datatype))a.p.datatype.call(a,a.p.postData,"load_"+a.p.id);else{if(b.isFunction(a.p.beforeRequest)){j=a.p.beforeRequest.call(a);if(j===undefined)j=true;if(j===false)return}m=a.p.datatype.toLowerCase();switch(m){case "json":case "jsonp":case "xml":case "script":b.ajax(b.extend({url:a.p.url,type:a.p.mtype,dataType:m,data:b.isFunction(a.p.serializeGridData)?
+a.p.serializeGridData.call(a,a.p.postData):a.p.postData,success:function(z,u,q){b.isFunction(a.p.beforeProcessing)&&a.p.beforeProcessing.call(a,z,u,q);m==="xml"?V(z,a.grid.bDiv,v,d>1,E):fa(z,a.grid.bDiv,v,d>1,E);B&&B.call(a,z);e&&a.grid.populateVisible();if(a.p.loadonce||a.p.treeGrid)a.p.datatype="local";d===1&&$()},error:function(z,u,q){b.isFunction(a.p.loadError)&&a.p.loadError.call(a,z,u,q);d===1&&$()},beforeSend:function(z,u){var q=true;if(b.isFunction(a.p.loadBeforeSend))q=a.p.loadBeforeSend.call(a,
+z,u);if(q===undefined)q=true;if(q===false)return false;else R()}},b.jgrid.ajaxOptions,a.p.ajaxGridOptions));break;case "xmlstring":R();j=b.jgrid.stringToDoc(a.p.datastr);V(j,a.grid.bDiv);t&&a.p.loadComplete.call(a,j);a.p.datatype="local";a.p.datastr=null;$();break;case "jsonstring":R();j=typeof a.p.datastr=="string"?b.jgrid.parse(a.p.datastr):a.p.datastr;fa(j,a.grid.bDiv);t&&a.p.loadComplete.call(a,j);a.p.datatype="local";a.p.datastr=null;$();break;case "local":case "clientside":R();a.p.datatype=
+"local";j=oa();fa(j,a.grid.bDiv,v,d>1,E);B&&B.call(a,j);e&&a.grid.populateVisible();$()}}}};x=function(d,e){var j="",m="<table cellspacing='0' cellpadding='0' border='0' style='table-layout:auto;' class='ui-pg-table'><tbody><tr>",p="",B,t,E,v,z=function(u){var q;if(b.isFunction(a.p.onPaging))q=a.p.onPaging.call(a,u);a.p.selrow=null;if(a.p.multiselect){a.p.selarrrow=[];b("#cb_"+b.jgrid.jqID(a.p.id),a.grid.hDiv)[a.p.useProp?"prop":"attr"]("checked",false)}a.p.savedRow=[];if(q=="stop")return false;return true};
+d=d.substr(1);e+="_"+d;B="pg_"+d;t=d+"_left";E=d+"_center";v=d+"_right";b("#"+b.jgrid.jqID(d)).append("<div id='"+B+"' class='ui-pager-control' role='group'><table cellspacing='0' cellpadding='0' border='0' class='ui-pg-table' style='width:100%;table-layout:fixed;height:100%;' role='row'><tbody><tr><td id='"+t+"' align='left'></td><td id='"+E+"' align='center' style='white-space:pre;'></td><td id='"+v+"' align='right'></td></tr></tbody></table></div>").attr("dir","ltr");if(a.p.rowList.length>0){p=
+"<td dir='"+l+"'>";p+="<select class='ui-pg-selbox' role='listbox'>";for(t=0;t<a.p.rowList.length;t++)p+='<option role="option" value="'+a.p.rowList[t]+'"'+(a.p.rowNum==a.p.rowList[t]?' selected="selected"':"")+">"+a.p.rowList[t]+"</option>";p+="</select></td>"}if(l=="rtl")m+=p;if(a.p.pginput===true)j="<td dir='"+l+"'>"+b.jgrid.format(a.p.pgtext||"","<input class='ui-pg-input' type='text' size='2' maxlength='7' value='0' role='textbox'/>","<span id='sp_1_"+b.jgrid.jqID(d)+"'></span>")+"</td>";if(a.p.pgbuttons===
+true){t=["first"+e,"prev"+e,"next"+e,"last"+e];l=="rtl"&&t.reverse();m+="<td id='"+t[0]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-first'></span></td>";m+="<td id='"+t[1]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-prev'></span></td>";m+=j!==""?"<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='ui-separator'></span></td>"+j+"<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='ui-separator'></span></td>":
+"";m+="<td id='"+t[2]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-next'></span></td>";m+="<td id='"+t[3]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-end'></span></td>"}else if(j!=="")m+=j;if(l=="ltr")m+=p;m+="</tr></tbody></table>";a.p.viewrecords===true&&b("td#"+d+"_"+a.p.recordpos,"#"+B).append("<div dir='"+l+"' style='text-align:"+a.p.recordpos+"' class='ui-paging-info'></div>");b("td#"+d+"_"+a.p.pagerpos,"#"+B).append(m);p=b(".ui-jqgrid").css("font-size")||
+"11px";b(document.body).append("<div id='testpg' class='ui-jqgrid ui-widget ui-widget-content' style='font-size:"+p+";visibility:hidden;' ></div>");m=b(m).clone().appendTo("#testpg").width();b("#testpg").remove();if(m>0){if(j!=="")m+=50;b("td#"+d+"_"+a.p.pagerpos,"#"+B).width(m)}a.p._nvtd=[];a.p._nvtd[0]=m?Math.floor((a.p.width-m)/2):Math.floor(a.p.width/3);a.p._nvtd[1]=0;m=null;b(".ui-pg-selbox","#"+B).bind("change",function(){a.p.page=Math.round(a.p.rowNum*(a.p.page-1)/this.value-0.5)+1;a.p.rowNum=
+this.value;if(e)b(".ui-pg-selbox",a.p.pager).val(this.value);else a.p.toppager&&b(".ui-pg-selbox",a.p.toppager).val(this.value);if(!z("records"))return false;ja();return false});if(a.p.pgbuttons===true){b(".ui-pg-button","#"+B).hover(function(){if(b(this).hasClass("ui-state-disabled"))this.style.cursor="default";else{b(this).addClass("ui-state-hover");this.style.cursor="pointer"}},function(){if(!b(this).hasClass("ui-state-disabled")){b(this).removeClass("ui-state-hover");this.style.cursor="default"}});
+b("#first"+b.jgrid.jqID(e)+", #prev"+b.jgrid.jqID(e)+", #next"+b.jgrid.jqID(e)+", #last"+b.jgrid.jqID(e)).click(function(){var u=M(a.p.page,1),q=M(a.p.lastpage,1),F=false,S=true,N=true,K=true,O=true;if(q===0||q===1)O=K=N=S=false;else if(q>1&&u>=1)if(u===1)N=S=false;else{if(!(u>1&&u<q))if(u===q)O=K=false}else if(q>1&&u===0){O=K=false;u=q-1}if(this.id==="first"+e&&S){a.p.page=1;F=true}if(this.id==="prev"+e&&N){a.p.page=u-1;F=true}if(this.id==="next"+e&&K){a.p.page=u+1;F=true}if(this.id==="last"+e&&
+O){a.p.page=q;F=true}if(F){if(!z(this.id))return false;ja()}return false})}a.p.pginput===true&&b("input.ui-pg-input","#"+B).keypress(function(u){if((u.charCode?u.charCode:u.keyCode?u.keyCode:0)==13){a.p.page=b(this).val()>0?b(this).val():a.p.page;if(!z("user"))return false;ja();return false}return this})};var Ca=function(d,e,j,m){if(a.p.colModel[e].sortable)if(!(a.p.savedRow.length>0)){if(!j){if(a.p.lastsort==e)if(a.p.sortorder=="asc")a.p.sortorder="desc";else{if(a.p.sortorder=="desc")a.p.sortorder=
+"asc"}else a.p.sortorder=a.p.colModel[e].firstsortorder||"asc";a.p.page=1}if(m)if(a.p.lastsort==e&&a.p.sortorder==m&&!j)return;else a.p.sortorder=m;j=a.grid.headers[a.p.lastsort].el;m=a.grid.headers[e].el;b("span.ui-grid-ico-sort",j).addClass("ui-state-disabled");b(j).attr("aria-selected","false");b("span.ui-icon-"+a.p.sortorder,m).removeClass("ui-state-disabled");b(m).attr("aria-selected","true");if(!a.p.viewsortcols[0])if(a.p.lastsort!=e){b("span.s-ico",j).hide();b("span.s-ico",m).show()}d=d.substring(5+
+a.p.id.length+1);a.p.sortname=a.p.colModel[e].index||d;j=a.p.sortorder;if(b.isFunction(a.p.onSortCol))if(a.p.onSortCol.call(a,d,e,j)=="stop"){a.p.lastsort=e;return}if(a.p.datatype=="local")a.p.deselectAfterSort&&b(a).jqGrid("resetSelection");else{a.p.selrow=null;if(a.p.multiselect)b("#cb_"+b.jgrid.jqID(a.p.id),a.grid.hDiv)[a.p.useProp?"prop":"attr"]("checked",false);a.p.selarrrow=[];a.p.savedRow=[]}if(a.p.scroll){j=a.grid.bDiv.scrollLeft;C(a.grid.bDiv,true,false);a.grid.hDiv.scrollLeft=j}a.p.subGrid&&
+a.p.datatype=="local"&&b("td.sgexpanded","#"+b.jgrid.jqID(a.p.id)).each(function(){b(this).trigger("click")});ja();a.p.lastsort=e;if(a.p.sortname!=d&&e)a.p.lastsort=e}},Ga=function(d){var e,j={},m=H?0:a.p.cellLayout;for(e=j[0]=j[1]=j[2]=0;e<=d;e++)if(a.p.colModel[e].hidden===false)j[0]+=a.p.colModel[e].width+m;if(a.p.direction=="rtl")j[0]=a.p.width-j[0];j[0]-=a.grid.bDiv.scrollLeft;if(b(a.grid.cDiv).is(":visible"))j[1]+=b(a.grid.cDiv).height()+parseInt(b(a.grid.cDiv).css("padding-top"),10)+parseInt(b(a.grid.cDiv).css("padding-bottom"),
+10);if(a.p.toolbar[0]===true&&(a.p.toolbar[1]=="top"||a.p.toolbar[1]=="both"))j[1]+=b(a.grid.uDiv).height()+parseInt(b(a.grid.uDiv).css("border-top-width"),10)+parseInt(b(a.grid.uDiv).css("border-bottom-width"),10);if(a.p.toppager)j[1]+=b(a.grid.topDiv).height()+parseInt(b(a.grid.topDiv).css("border-bottom-width"),10);j[2]+=b(a.grid.bDiv).height()+b(a.grid.hDiv).height();return j},Da=function(d){var e,j=a.grid.headers,m=b.jgrid.getCellIndex(d);for(e=0;e<j.length;e++)if(d===j[e].el){m=e;break}return m};
+this.p.id=this.id;if(b.inArray(a.p.multikey,["shiftKey","altKey","ctrlKey"])==-1)a.p.multikey=false;a.p.keyIndex=false;for(k=0;k<a.p.colModel.length;k++){a.p.colModel[k]=b.extend(true,{},a.p.cmTemplate,a.p.colModel[k].template||{},a.p.colModel[k]);if(a.p.keyIndex===false&&a.p.colModel[k].key===true)a.p.keyIndex=k}a.p.sortorder=a.p.sortorder.toLowerCase();if(a.p.grouping===true){a.p.scroll=false;a.p.rownumbers=false;a.p.subGrid=false;a.p.treeGrid=false;a.p.gridview=true}if(this.p.treeGrid===true){try{b(this).jqGrid("setTreeGrid")}catch(Ka){}if(a.p.datatype!=
+"local")a.p.localReader={id:"_id_"}}if(this.p.subGrid)try{b(a).jqGrid("setSubGrid")}catch(La){}if(this.p.multiselect){this.p.colNames.unshift("<input role='checkbox' id='cb_"+this.p.id+"' class='cbox' type='checkbox'/>");this.p.colModel.unshift({name:"cb",width:H?a.p.multiselectWidth+a.p.cellLayout:a.p.multiselectWidth,sortable:false,resizable:false,hidedlg:true,search:false,align:"center",fixed:true})}if(this.p.rownumbers){this.p.colNames.unshift("");this.p.colModel.unshift({name:"rn",width:a.p.rownumWidth,
+sortable:false,resizable:false,hidedlg:true,search:false,align:"center",fixed:true})}a.p.xmlReader=b.extend(true,{root:"rows",row:"row",page:"rows>page",total:"rows>total",records:"rows>records",repeatitems:true,cell:"cell",id:"[id]",userdata:"userdata",subgrid:{root:"rows",row:"row",repeatitems:true,cell:"cell"}},a.p.xmlReader);a.p.jsonReader=b.extend(true,{root:"rows",page:"page",total:"total",records:"records",repeatitems:true,cell:"cell",id:"id",userdata:"userdata",subgrid:{root:"rows",repeatitems:true,
+cell:"cell"}},a.p.jsonReader);a.p.localReader=b.extend(true,{root:"rows",page:"page",total:"total",records:"records",repeatitems:false,cell:"cell",id:"id",userdata:"userdata",subgrid:{root:"rows",repeatitems:true,cell:"cell"}},a.p.localReader);if(a.p.scroll){a.p.pgbuttons=false;a.p.pginput=false;a.p.rowList=[]}a.p.data.length&&ca();var da="<thead><tr class='ui-jqgrid-labels' role='rowheader'>",Ea,ma,sa,ra,ta,X,Q,na;ma=na="";if(a.p.shrinkToFit===true&&a.p.forceFit===true)for(k=a.p.colModel.length-
+1;k>=0;k--)if(!a.p.colModel[k].hidden){a.p.colModel[k].resizable=false;break}if(a.p.viewsortcols[1]=="horizontal"){na=" ui-i-asc";ma=" ui-i-desc"}Ea=y?"class='ui-th-div-ie'":"";na="<span class='s-ico' style='display:none'><span sort='asc' class='ui-grid-ico-sort ui-icon-asc"+na+" ui-state-disabled ui-icon ui-icon-triangle-1-n ui-sort-"+l+"'></span>";na+="<span sort='desc' class='ui-grid-ico-sort ui-icon-desc"+ma+" ui-state-disabled ui-icon ui-icon-triangle-1-s ui-sort-"+l+"'></span></span>";for(k=
+0;k<this.p.colNames.length;k++){ma=a.p.headertitles?' title="'+b.jgrid.stripHtml(a.p.colNames[k])+'"':"";da+="<th id='"+a.p.id+"_"+a.p.colModel[k].name+"' role='columnheader' class='ui-state-default ui-th-column ui-th-"+l+"'"+ma+">";ma=a.p.colModel[k].index||a.p.colModel[k].name;da+="<div id='jqgh_"+a.p.id+"_"+a.p.colModel[k].name+"' "+Ea+">"+a.p.colNames[k];a.p.colModel[k].width=a.p.colModel[k].width?parseInt(a.p.colModel[k].width,10):150;if(typeof a.p.colModel[k].title!=="boolean")a.p.colModel[k].title=
+true;if(ma==a.p.sortname)a.p.lastsort=k;da+=na+"</div></th>"}da+="</tr></thead>";na=null;b(this).append(da);b("thead tr:first th",this).hover(function(){b(this).addClass("ui-state-hover")},function(){b(this).removeClass("ui-state-hover")});if(this.p.multiselect){var za=[],ua;b("#cb_"+b.jgrid.jqID(a.p.id),this).bind("click",function(){a.p.selarrrow=[];if(this.checked){b(a.rows).each(function(d){if(d>0)if(!b(this).hasClass("ui-subgrid")&&!b(this).hasClass("jqgroup")&&!b(this).hasClass("ui-state-disabled")){b("#jqg_"+
+b.jgrid.jqID(a.p.id)+"_"+b.jgrid.jqID(this.id))[a.p.useProp?"prop":"attr"]("checked",true);b(this).addClass("ui-state-highlight").attr("aria-selected","true");a.p.selarrrow.push(this.id);a.p.selrow=this.id}});ua=true;za=[]}else{b(a.rows).each(function(d){if(d>0)if(!b(this).hasClass("ui-subgrid")&&!b(this).hasClass("ui-state-disabled")){b("#jqg_"+b.jgrid.jqID(a.p.id)+"_"+b.jgrid.jqID(this.id))[a.p.useProp?"prop":"attr"]("checked",false);b(this).removeClass("ui-state-highlight").attr("aria-selected",
+"false");za.push(this.id)}});a.p.selrow=null;ua=false}if(b.isFunction(a.p.onSelectAll))a.p.onSelectAll.call(a,ua?a.p.selarrrow:za,ua)})}if(a.p.autowidth===true){da=b(L).innerWidth();a.p.width=da>0?da:"nw"}(function(){var d=0,e=H?0:a.p.cellLayout,j=0,m,p=a.p.scrollOffset,B,t=false,E,v=0,z=0,u;b.each(a.p.colModel,function(){if(typeof this.hidden==="undefined")this.hidden=false;this.widthOrg=B=M(this.width,0);if(this.hidden===false){d+=B+e;if(this.fixed)v+=B+e;else j++;z++}});if(isNaN(a.p.width))a.p.width=
+g.width=d;else g.width=a.p.width;a.p.tblwidth=d;if(a.p.shrinkToFit===false&&a.p.forceFit===true)a.p.forceFit=false;if(a.p.shrinkToFit===true&&j>0){E=g.width-e*j-v;if(!isNaN(a.p.height)){E-=p;t=true}d=0;b.each(a.p.colModel,function(q){if(this.hidden===false&&!this.fixed){this.width=B=Math.round(E*this.width/(a.p.tblwidth-e*j-v));d+=B;m=q}});u=0;if(t){if(g.width-v-(d+e*j)!==p)u=g.width-v-(d+e*j)-p}else if(!t&&Math.abs(g.width-v-(d+e*j))!==1)u=g.width-v-(d+e*j);a.p.colModel[m].width+=u;a.p.tblwidth=
+d+u+e*j+v;if(a.p.tblwidth>a.p.width){a.p.colModel[m].width-=a.p.tblwidth-parseInt(a.p.width,10);a.p.tblwidth=a.p.width}}})();b(L).css("width",g.width+"px").append("<div class='ui-jqgrid-resize-mark' id='rs_m"+a.p.id+"'>&#160;</div>");b(r).css("width",g.width+"px");da=b("thead:first",a).get(0);var va="";if(a.p.footerrow)va+="<table role='grid' style='width:"+a.p.tblwidth+"px' class='ui-jqgrid-ftable' cellspacing='0' cellpadding='0' border='0'><tbody><tr role='row' class='ui-widget-content footrow footrow-"+
+l+"'>";r=b("tr:first",da);var wa="<tr class='jqgfirstrow' role='row' style='height:auto'>";a.p.disableClick=false;b("th",r).each(function(d){sa=a.p.colModel[d].width;if(typeof a.p.colModel[d].resizable==="undefined")a.p.colModel[d].resizable=true;if(a.p.colModel[d].resizable){ra=document.createElement("span");b(ra).html("&#160;").addClass("ui-jqgrid-resize ui-jqgrid-resize-"+l);b.browser.opera||b(ra).css("cursor","col-resize");b(this).addClass(a.p.resizeclass)}else ra="";b(this).css("width",sa+"px").prepend(ra);
+var e="";if(a.p.colModel[d].hidden){b(this).css("display","none");e="display:none;"}wa+="<td role='gridcell' style='height:0px;width:"+sa+"px;"+e+"'></td>";g.headers[d]={width:sa,el:this};ta=a.p.colModel[d].sortable;if(typeof ta!=="boolean")ta=a.p.colModel[d].sortable=true;e=a.p.colModel[d].name;e=="cb"||e=="subgrid"||e=="rn"||a.p.viewsortcols[2]&&b("div",this).addClass("ui-jqgrid-sortable");if(ta)if(a.p.viewsortcols[0]){b("div span.s-ico",this).show();d==a.p.lastsort&&b("div span.ui-icon-"+a.p.sortorder,
+this).removeClass("ui-state-disabled")}else if(d==a.p.lastsort){b("div span.s-ico",this).show();b("div span.ui-icon-"+a.p.sortorder,this).removeClass("ui-state-disabled")}if(a.p.footerrow)va+="<td role='gridcell' "+P(d,0,"",null,"",false)+">&#160;</td>"}).mousedown(function(d){if(b(d.target).closest("th>span.ui-jqgrid-resize").length==1){var e=Da(this);if(a.p.forceFit===true){var j=a.p,m=e,p;for(p=e+1;p<a.p.colModel.length;p++)if(a.p.colModel[p].hidden!==true){m=p;break}j.nv=m-e}g.dragStart(e,d,Ga(e));
+return false}}).click(function(d){if(a.p.disableClick)return a.p.disableClick=false;var e="th>div.ui-jqgrid-sortable",j,m;a.p.viewsortcols[2]||(e="th>div>span>span.ui-grid-ico-sort");d=b(d.target).closest(e);if(d.length==1){e=Da(this);if(!a.p.viewsortcols[2]){j=true;m=d.attr("sort")}Ca(b("div",this)[0].id,e,j,m);return false}});if(a.p.sortable&&b.fn.sortable)try{b(a).jqGrid("sortableColumns",r)}catch(Ma){}if(a.p.footerrow)va+="</tr></tbody></table>";wa+="</tr>";this.appendChild(document.createElement("tbody"));
+b(this).addClass("ui-jqgrid-btable").append(wa);wa=null;r=b("<table class='ui-jqgrid-htable' style='width:"+a.p.tblwidth+"px' role='grid' aria-labelledby='gbox_"+this.id+"' cellspacing='0' cellpadding='0' border='0'></table>").append(da);var ea=a.p.caption&&a.p.hiddengrid===true?true:false;k=b("<div class='ui-jqgrid-hbox"+(l=="rtl"?"-rtl":"")+"'></div>");da=null;g.hDiv=document.createElement("div");b(g.hDiv).css({width:g.width+"px"}).addClass("ui-state-default ui-jqgrid-hdiv").append(k);b(k).append(r);
+r=null;ea&&b(g.hDiv).hide();if(a.p.pager){if(typeof a.p.pager=="string"){if(a.p.pager.substr(0,1)!="#")a.p.pager="#"+a.p.pager}else a.p.pager="#"+b(a.p.pager).attr("id");b(a.p.pager).css({width:g.width+"px"}).appendTo(L).addClass("ui-state-default ui-jqgrid-pager ui-corner-bottom");ea&&b(a.p.pager).hide();x(a.p.pager,"")}a.p.cellEdit===false&&a.p.hoverrows===true&&b(a).bind("mouseover",function(d){Q=b(d.target).closest("tr.jqgrow");b(Q).attr("class")!=="ui-subgrid"&&b(Q).addClass("ui-state-hover")}).bind("mouseout",
+function(d){Q=b(d.target).closest("tr.jqgrow");b(Q).removeClass("ui-state-hover")});var ka,la;b(a).before(g.hDiv).click(function(d){X=d.target;Q=b(X,a.rows).closest("tr.jqgrow");if(b(Q).length===0||Q[0].className.indexOf("ui-state-disabled")>-1)return this;var e=b(X).hasClass("cbox"),j=true;if(b.isFunction(a.p.beforeSelectRow))j=a.p.beforeSelectRow.call(a,Q[0].id,d);if(X.tagName=="A"||(X.tagName=="INPUT"||X.tagName=="TEXTAREA"||X.tagName=="OPTION"||X.tagName=="SELECT")&&!e)return this;if(j===true){if(a.p.cellEdit===
+true)if(a.p.multiselect&&e)b(a).jqGrid("setSelection",Q[0].id,true);else{ka=Q[0].rowIndex;la=b.jgrid.getCellIndex(X);try{b(a).jqGrid("editCell",ka,la,true)}catch(m){}}else if(a.p.multikey)if(d[a.p.multikey])b(a).jqGrid("setSelection",Q[0].id,true);else{if(a.p.multiselect&&e){e=b("#jqg_"+b.jgrid.jqID(a.p.id)+"_"+Q[0].id).is(":checked");b("#jqg_"+b.jgrid.jqID(a.p.id)+"_"+Q[0].id)[a.p.useProp?"prop":"attr"]("checked",e)}}else{if(a.p.multiselect&&a.p.multiboxonly)if(!e){b(a.p.selarrrow).each(function(p,
+B){var t=a.rows.namedItem(B);b(t).removeClass("ui-state-highlight");b("#jqg_"+b.jgrid.jqID(a.p.id)+"_"+b.jgrid.jqID(B))[a.p.useProp?"prop":"attr"]("checked",false)});a.p.selarrrow=[];b("#cb_"+b.jgrid.jqID(a.p.id),a.grid.hDiv)[a.p.useProp?"prop":"attr"]("checked",false)}b(a).jqGrid("setSelection",Q[0].id,true)}if(b.isFunction(a.p.onCellSelect)){ka=Q[0].id;la=b.jgrid.getCellIndex(X);a.p.onCellSelect.call(a,ka,la,b(X).html(),d)}}return this}).bind("reloadGrid",function(d,e){if(a.p.treeGrid===true)a.p.datatype=
+a.p.treedatatype;e&&e.current&&a.grid.selectionPreserver(a);if(a.p.datatype=="local"){b(a).jqGrid("resetSelection");a.p.data.length&&ca()}else if(!a.p.treeGrid){a.p.selrow=null;if(a.p.multiselect){a.p.selarrrow=[];b("#cb_"+b.jgrid.jqID(a.p.id),a.grid.hDiv)[a.p.useProp?"prop":"attr"]("checked",false)}a.p.savedRow=[]}a.p.scroll&&C(a.grid.bDiv,true,false);if(e&&e.page){var j=e.page;if(j>a.p.lastpage)j=a.p.lastpage;if(j<1)j=1;a.p.page=j;a.grid.bDiv.scrollTop=a.grid.prevRowHeight?(j-1)*a.grid.prevRowHeight*
+a.p.rowNum:0}if(a.grid.prevRowHeight&&a.p.scroll){delete a.p.lastpage;a.grid.populateVisible()}else a.grid.populate();return false});b.isFunction(this.p.ondblClickRow)&&b(this).dblclick(function(d){X=d.target;Q=b(X,a.rows).closest("tr.jqgrow");if(b(Q).length===0)return false;ka=Q[0].rowIndex;la=b.jgrid.getCellIndex(X);a.p.ondblClickRow.call(a,b(Q).attr("id"),ka,la,d);return false});b.isFunction(this.p.onRightClickRow)&&b(this).bind("contextmenu",function(d){X=d.target;Q=b(X,a.rows).closest("tr.jqgrow");
+if(b(Q).length===0)return false;a.p.multiselect||b(a).jqGrid("setSelection",Q[0].id,true);ka=Q[0].rowIndex;la=b.jgrid.getCellIndex(X);a.p.onRightClickRow.call(a,b(Q).attr("id"),ka,la,d);return false});g.bDiv=document.createElement("div");if(y)if(String(a.p.height).toLowerCase()==="auto")a.p.height="100%";b(g.bDiv).append(b('<div style="position:relative;'+(y&&b.browser.version<8?"height:0.01%;":"")+'"></div>').append("<div></div>").append(this)).addClass("ui-jqgrid-bdiv").css({height:a.p.height+(isNaN(a.p.height)?
+"":"px"),width:g.width+"px"}).scroll(g.scrollGrid);b("table:first",g.bDiv).css({width:a.p.tblwidth+"px"});if(y){b("tbody",this).size()==2&&b("tbody:gt(0)",this).remove();a.p.multikey&&b(g.bDiv).bind("selectstart",function(){return false})}else a.p.multikey&&b(g.bDiv).bind("mousedown",function(){return false});ea&&b(g.bDiv).hide();g.cDiv=document.createElement("div");var Aa=a.p.hidegrid===true?b("<a role='link' href='javascript:void(0)'/>").addClass("ui-jqgrid-titlebar-close HeaderButton").hover(function(){Aa.addClass("ui-state-hover")},
+function(){Aa.removeClass("ui-state-hover")}).append("<span class='ui-icon ui-icon-circle-triangle-n'></span>").css(l=="rtl"?"left":"right","0px"):"";b(g.cDiv).append(Aa).append("<span class='ui-jqgrid-title"+(l=="rtl"?"-rtl":"")+"'>"+a.p.caption+"</span>").addClass("ui-jqgrid-titlebar ui-widget-header ui-corner-top ui-helper-clearfix");b(g.cDiv).insertBefore(g.hDiv);if(a.p.toolbar[0]){g.uDiv=document.createElement("div");if(a.p.toolbar[1]=="top")b(g.uDiv).insertBefore(g.hDiv);else a.p.toolbar[1]==
+"bottom"&&b(g.uDiv).insertAfter(g.hDiv);if(a.p.toolbar[1]=="both"){g.ubDiv=document.createElement("div");b(g.uDiv).insertBefore(g.hDiv).addClass("ui-userdata ui-state-default").attr("id","t_"+this.id);b(g.ubDiv).insertAfter(g.hDiv).addClass("ui-userdata ui-state-default").attr("id","tb_"+this.id);ea&&b(g.ubDiv).hide()}else b(g.uDiv).width(g.width).addClass("ui-userdata ui-state-default").attr("id","t_"+this.id);ea&&b(g.uDiv).hide()}if(a.p.toppager){a.p.toppager=b.jgrid.jqID(a.p.id)+"_toppager";g.topDiv=
+b("<div id='"+a.p.toppager+"'></div>")[0];a.p.toppager="#"+a.p.toppager;b(g.topDiv).insertBefore(g.hDiv).addClass("ui-state-default ui-jqgrid-toppager").width(g.width);x(a.p.toppager,"_t")}if(a.p.footerrow){g.sDiv=b("<div class='ui-jqgrid-sdiv'></div>")[0];k=b("<div class='ui-jqgrid-hbox"+(l=="rtl"?"-rtl":"")+"'></div>");b(g.sDiv).append(k).insertAfter(g.hDiv).width(g.width);b(k).append(va);g.footers=b(".ui-jqgrid-ftable",g.sDiv)[0].rows[0].cells;if(a.p.rownumbers)g.footers[0].className="ui-state-default jqgrid-rownum";
+ea&&b(g.sDiv).hide()}k=null;if(a.p.caption){var Ha=a.p.datatype;if(a.p.hidegrid===true){b(".ui-jqgrid-titlebar-close",g.cDiv).click(function(d){var e=b.isFunction(a.p.onHeaderClick),j=".ui-jqgrid-bdiv, .ui-jqgrid-hdiv, .ui-jqgrid-pager, .ui-jqgrid-sdiv",m,p=this;if(a.p.toolbar[0]===true){if(a.p.toolbar[1]=="both")j+=", #"+b(g.ubDiv).attr("id");j+=", #"+b(g.uDiv).attr("id")}m=b(j,"#gview_"+b.jgrid.jqID(a.p.id)).length;if(a.p.gridstate=="visible")b(j,"#gbox_"+b.jgrid.jqID(a.p.id)).slideUp("fast",function(){m--;
+if(m===0){b("span",p).removeClass("ui-icon-circle-triangle-n").addClass("ui-icon-circle-triangle-s");a.p.gridstate="hidden";b("#gbox_"+b.jgrid.jqID(a.p.id)).hasClass("ui-resizable")&&b(".ui-resizable-handle","#gbox_"+b.jgrid.jqID(a.p.id)).hide();if(e)ea||a.p.onHeaderClick.call(a,a.p.gridstate,d)}});else a.p.gridstate=="hidden"&&b(j,"#gbox_"+b.jgrid.jqID(a.p.id)).slideDown("fast",function(){m--;if(m===0){b("span",p).removeClass("ui-icon-circle-triangle-s").addClass("ui-icon-circle-triangle-n");if(ea){a.p.datatype=
+Ha;ja();ea=false}a.p.gridstate="visible";b("#gbox_"+b.jgrid.jqID(a.p.id)).hasClass("ui-resizable")&&b(".ui-resizable-handle","#gbox_"+b.jgrid.jqID(a.p.id)).show();if(e)ea||a.p.onHeaderClick.call(a,a.p.gridstate,d)}});return false});if(ea){a.p.datatype="local";b(".ui-jqgrid-titlebar-close",g.cDiv).trigger("click")}}}else b(g.cDiv).hide();b(g.hDiv).after(g.bDiv).mousemove(function(d){if(g.resizing){g.dragMove(d);return false}});b(".ui-jqgrid-labels",g.hDiv).bind("selectstart",function(){return false});
+b(document).mouseup(function(){if(g.resizing){g.dragEnd();return false}return true});a.formatCol=P;a.sortData=Ca;a.updatepager=function(d,e){var j,m,p,B,t,E,v,z="",u=a.p.pager?"_"+b.jgrid.jqID(a.p.pager.substr(1)):"",q=a.p.toppager?"_"+a.p.toppager.substr(1):"";p=parseInt(a.p.page,10)-1;if(p<0)p=0;p*=parseInt(a.p.rowNum,10);t=p+a.p.reccount;if(a.p.scroll){j=b("tbody:first > tr:gt(0)",a.grid.bDiv);p=t-j.length;a.p.reccount=j.length;if(m=j.outerHeight()||a.grid.prevRowHeight){j=p*m;m*=parseInt(a.p.records,
+10);b(">div:first",a.grid.bDiv).css({height:m}).children("div:first").css({height:j,display:j?"":"none"})}a.grid.bDiv.scrollLeft=a.grid.hDiv.scrollLeft}z=a.p.pager?a.p.pager:"";z+=a.p.toppager?z?","+a.p.toppager:a.p.toppager:"";if(z){v=b.jgrid.formatter.integer||{};j=M(a.p.page);m=M(a.p.lastpage);b(".selbox",z)[this.p.useProp?"prop":"attr"]("disabled",false);if(a.p.pginput===true){b(".ui-pg-input",z).val(a.p.page);B=a.p.toppager?"#sp_1"+u+",#sp_1"+q:"#sp_1"+u;b(B).html(b.fmatter?b.fmatter.util.NumberFormat(a.p.lastpage,
+v):a.p.lastpage)}if(a.p.viewrecords)if(a.p.reccount===0)b(".ui-paging-info",z).html(a.p.emptyrecords);else{B=p+1;E=a.p.records;if(b.fmatter){B=b.fmatter.util.NumberFormat(B,v);t=b.fmatter.util.NumberFormat(t,v);E=b.fmatter.util.NumberFormat(E,v)}b(".ui-paging-info",z).html(b.jgrid.format(a.p.recordtext,B,t,E))}if(a.p.pgbuttons===true){if(j<=0)j=m=0;if(j==1||j===0){b("#first"+u+", #prev"+u).addClass("ui-state-disabled").removeClass("ui-state-hover");a.p.toppager&&b("#first_t"+q+", #prev_t"+q).addClass("ui-state-disabled").removeClass("ui-state-hover")}else{b("#first"+
+u+", #prev"+u).removeClass("ui-state-disabled");a.p.toppager&&b("#first_t"+q+", #prev_t"+q).removeClass("ui-state-disabled")}if(j==m||j===0){b("#next"+u+", #last"+u).addClass("ui-state-disabled").removeClass("ui-state-hover");a.p.toppager&&b("#next_t"+q+", #last_t"+q).addClass("ui-state-disabled").removeClass("ui-state-hover")}else{b("#next"+u+", #last"+u).removeClass("ui-state-disabled");a.p.toppager&&b("#next_t"+q+", #last_t"+q).removeClass("ui-state-disabled")}}}d===true&&a.p.rownumbers===true&&
+b("td.jqgrid-rownum",a.rows).each(function(F){b(this).html(p+1+F)});e&&a.p.jqgdnd&&b(a).jqGrid("gridDnD","updateDnD");b.isFunction(a.p.gridComplete)&&a.p.gridComplete.call(a)};a.refreshIndex=ca;a.formatter=function(d,e,j,m,p){return o(d,e,j,m,p)};b.extend(g,{populate:ja,emptyRows:C});this.grid=g;a.addXmlData=function(d){V(d,a.grid.bDiv)};a.addJSONData=function(d){fa(d,a.grid.bDiv)};this.grid.cols=this.rows[0].cells;ja();a.p.hiddengrid=false;b(window).unload(function(){a=null})}}}})};b.jgrid.extend({getGridParam:function(f){var i=
+this[0];if(i&&i.grid)return f?typeof i.p[f]!="undefined"?i.p[f]:null:i.p},setGridParam:function(f){return this.each(function(){this.grid&&typeof f==="object"&&b.extend(true,this.p,f)})},getDataIDs:function(){var f=[],i=0,h,c=0;this.each(function(){if((h=this.rows.length)&&h>0)for(;i<h;){if(b(this.rows[i]).hasClass("jqgrow")){f[c]=this.rows[i].id;c++}i++}});return f},setSelection:function(f,i){return this.each(function(){function h(a){var r=b(c.grid.bDiv)[0].clientHeight,x=b(c.grid.bDiv)[0].scrollTop,
+y=c.rows[a].offsetTop;a=c.rows[a].clientHeight;if(y+a>=r+x)b(c.grid.bDiv)[0].scrollTop=y-(r+x)+a+x;else if(y<r+x)if(y<x)b(c.grid.bDiv)[0].scrollTop=y}var c=this,g,k,l;if(f!==undefined){i=i===false?false:true;k=c.rows.namedItem(f+"");if(!(!k||k.className.indexOf("ui-state-disabled")>-1)){if(c.p.scrollrows===true){g=c.rows.namedItem(f).rowIndex;g>=0&&h(g)}if(c.p.multiselect){b("#cb_"+b.jgrid.jqID(c.p.id),c.grid.hDiv)[c.p.useProp?"prop":"attr"]("checked",false);c.p.selrow=k.id;l=b.inArray(c.p.selrow,
+c.p.selarrrow);if(l===-1){k.className!=="ui-subgrid"&&b(k).addClass("ui-state-highlight").attr("aria-selected","true");g=true;b("#jqg_"+b.jgrid.jqID(c.p.id)+"_"+b.jgrid.jqID(c.p.selrow))[c.p.useProp?"prop":"attr"]("checked",g);c.p.selarrrow.push(c.p.selrow)}else{k.className!=="ui-subgrid"&&b(k).removeClass("ui-state-highlight").attr("aria-selected","false");g=false;b("#jqg_"+b.jgrid.jqID(c.p.id)+"_"+b.jgrid.jqID(c.p.selrow))[c.p.useProp?"prop":"attr"]("checked",g);c.p.selarrrow.splice(l,1);l=c.p.selarrrow[0];
+c.p.selrow=l===undefined?null:l}c.p.onSelectRow&&i&&c.p.onSelectRow.call(c,k.id,g)}else if(k.className!=="ui-subgrid"){if(c.p.selrow!=k.id){b(c.rows.namedItem(c.p.selrow)).removeClass("ui-state-highlight").attr({"aria-selected":"false",tabindex:"-1"});b(k).addClass("ui-state-highlight").attr({"aria-selected":"true",tabindex:"0"});g=true}else g=false;c.p.selrow=k.id;c.p.onSelectRow&&i&&c.p.onSelectRow.call(c,k.id,g)}}}})},resetSelection:function(f){return this.each(function(){var i=this,h,c;if(typeof f!==
+"undefined"){c=f===i.p.selrow?i.p.selrow:f;b("#"+b.jgrid.jqID(i.p.id)+" tbody:first tr#"+b.jgrid.jqID(c)).removeClass("ui-state-highlight").attr("aria-selected","false");if(i.p.multiselect){b("#jqg_"+b.jgrid.jqID(i.p.id)+"_"+b.jgrid.jqID(c))[i.p.useProp?"prop":"attr"]("checked",false);b("#cb_"+b.jgrid.jqID(i.p.id))[i.p.useProp?"prop":"attr"]("checked",false)}c=null}else if(i.p.multiselect){b(i.p.selarrrow).each(function(g,k){h=i.rows.namedItem(k);b(h).removeClass("ui-state-highlight").attr("aria-selected",
+"false");b("#jqg_"+b.jgrid.jqID(i.p.id)+"_"+b.jgrid.jqID(k))[i.p.useProp?"prop":"attr"]("checked",false)});b("#cb_"+b.jgrid.jqID(i.p.id))[i.p.useProp?"prop":"attr"]("checked",false);i.p.selarrrow=[]}else if(i.p.selrow){b("#"+b.jgrid.jqID(i.p.id)+" tbody:first tr#"+b.jgrid.jqID(i.p.selrow)).removeClass("ui-state-highlight").attr("aria-selected","false");i.p.selrow=null}if(i.p.cellEdit===true)if(parseInt(i.p.iCol,10)>=0&&parseInt(i.p.iRow,10)>=0){b("td:eq("+i.p.iCol+")",i.rows[i.p.iRow]).removeClass("edit-cell ui-state-highlight");
+b(i.rows[i.p.iRow]).removeClass("selected-row ui-state-hover")}i.p.savedRow=[]})},getRowData:function(f){var i={},h,c=false,g,k=0;this.each(function(){var l=this,a,r;if(typeof f=="undefined"){c=true;h=[];g=l.rows.length}else{r=l.rows.namedItem(f);if(!r)return i;g=2}for(;k<g;){if(c)r=l.rows[k];if(b(r).hasClass("jqgrow")){b("td",r).each(function(x){a=l.p.colModel[x].name;if(a!=="cb"&&a!=="subgrid"&&a!=="rn")if(l.p.treeGrid===true&&a==l.p.ExpandColumn)i[a]=b.jgrid.htmlDecode(b("span:first",this).html());
+else try{i[a]=b.unformat(this,{rowId:r.id,colModel:l.p.colModel[x]},x)}catch(y){i[a]=b.jgrid.htmlDecode(b(this).html())}});if(c){h.push(i);i={}}}k++}});return h?h:i},delRowData:function(f){var i=false,h,c;this.each(function(){if(h=this.rows.namedItem(f)){b(h).remove();this.p.records--;this.p.reccount--;this.updatepager(true,false);i=true;if(this.p.multiselect){c=b.inArray(f,this.p.selarrrow);c!=-1&&this.p.selarrrow.splice(c,1)}if(f==this.p.selrow)this.p.selrow=null}else return false;if(this.p.datatype==
+"local"){var g=this.p._index[f];if(typeof g!="undefined"){this.p.data.splice(g,1);this.refreshIndex()}}if(this.p.altRows===true&&i){var k=this.p.altclass;b(this.rows).each(function(l){l%2==1?b(this).addClass(k):b(this).removeClass(k)})}});return i},setRowData:function(f,i,h){var c,g=true,k;this.each(function(){if(!this.grid)return false;var l=this,a,r,x=typeof h,y={};r=l.rows.namedItem(f);if(!r)return false;if(i)try{b(this.p.colModel).each(function(P){c=this.name;if(i[c]!==undefined){y[c]=this.formatter&&
+typeof this.formatter==="string"&&this.formatter=="date"?b.unformat.date(i[c],this):i[c];a=l.formatter(f,i[c],P,i,"edit");k=this.title?{title:b.jgrid.stripHtml(a)}:{};l.p.treeGrid===true&&c==l.p.ExpandColumn?b("td:eq("+P+") > span:first",r).html(a).attr(k):b("td:eq("+P+")",r).html(a).attr(k)}});if(l.p.datatype=="local"){var H=l.p._index[f];if(l.p.treeGrid)for(var L in l.p.treeReader)y.hasOwnProperty(l.p.treeReader[L])&&delete y[l.p.treeReader[L]];if(typeof H!="undefined")l.p.data[H]=b.extend(true,
+l.p.data[H],y);y=null}}catch(M){g=false}if(g)if(x==="string")b(r).addClass(h);else x==="object"&&b(r).css(h)});return g},addRowData:function(f,i,h,c){h||(h="last");var g=false,k,l,a,r,x,y,H,L,M="",P,U,o,n,s;if(i){if(b.isArray(i)){P=true;h="last";U=f}else{i=[i];P=false}this.each(function(){var D=i.length;x=this.p.rownumbers===true?1:0;a=this.p.multiselect===true?1:0;r=this.p.subGrid===true?1:0;if(!P)if(typeof f!="undefined")f+="";else{f=b.jgrid.randId();if(this.p.keyIndex!==false){U=this.p.colModel[this.p.keyIndex+
+a+r+x].name;if(typeof i[0][U]!="undefined")f=i[0][U]}}o=this.p.altclass;for(var T=0,J="",C={},ca=b.isFunction(this.p.afterInsertRow)?true:false;T<D;){n=i[T];l="";if(P){try{f=n[U]}catch(V){f=b.jgrid.randId()}J=this.p.altRows===true?(this.rows.length-1)%2===0?o:"":""}f=this.p.idPrefix+f;if(x){M=this.formatCol(0,1,"",null,f,true);l+='<td role="gridcell" aria-describedby="'+this.p.id+'_rn" class="ui-state-default jqgrid-rownum" '+M+">0</td>"}if(a){L='<input role="checkbox" type="checkbox" id="jqg_'+this.p.id+
+"_"+f+'" class="cbox"/>';M=this.formatCol(x,1,"",null,f,true);l+='<td role="gridcell" aria-describedby="'+this.p.id+'_cb" '+M+">"+L+"</td>"}if(r)l+=b(this).jqGrid("addSubGridCell",a+x,1);for(H=a+r+x;H<this.p.colModel.length;H++){s=this.p.colModel[H];k=s.name;C[k]=s.formatter&&typeof s.formatter==="string"&&s.formatter=="date"?b.unformat.date(n[k],s):n[k];L=this.formatter(f,b.jgrid.getAccessor(n,k),H,n,"edit");M=this.formatCol(H,1,L,n,f,true);l+='<td role="gridcell" aria-describedby="'+this.p.id+"_"+
+k+'" '+M+">"+L+"</td>"}l='<tr id="'+f+'" role="row" tabindex="-1" class="ui-widget-content jqgrow ui-row-'+this.p.direction+" "+J+'">'+l+"</tr>";if(this.rows.length===0)b("table:first",this.grid.bDiv).append(l);else switch(h){case "last":b(this.rows[this.rows.length-1]).after(l);y=this.rows.length-1;break;case "first":b(this.rows[0]).after(l);y=1;break;case "after":if(y=this.rows.namedItem(c))b(this.rows[y.rowIndex+1]).hasClass("ui-subgrid")?b(this.rows[y.rowIndex+1]).after(l):b(y).after(l);y++;break;
+case "before":if(y=this.rows.namedItem(c)){b(y).before(l);y=y.rowIndex}y--}this.p.subGrid===true&&b(this).jqGrid("addSubGrid",a+x,y);this.p.records++;this.p.reccount++;ca&&this.p.afterInsertRow.call(this,f,n,n);T++;if(this.p.datatype=="local"){C[this.p.localReader.id]=f;this.p._index[f]=this.p.data.length;this.p.data.push(C);C={}}}if(this.p.altRows===true&&!P)if(h=="last")(this.rows.length-1)%2==1&&b(this.rows[this.rows.length-1]).addClass(o);else b(this.rows).each(function(fa){fa%2==1?b(this).addClass(o):
+b(this).removeClass(o)});this.updatepager(true,true);g=true})}return g},footerData:function(f,i,h){function c(r){for(var x in r)if(r.hasOwnProperty(x))return false;return true}var g,k=false,l={},a;if(typeof f=="undefined")f="get";if(typeof h!="boolean")h=true;f=f.toLowerCase();this.each(function(){var r=this,x;if(!r.grid||!r.p.footerrow)return false;if(f=="set")if(c(i))return false;k=true;b(this.p.colModel).each(function(y){g=this.name;if(f=="set"){if(i[g]!==undefined){x=h?r.formatter("",i[g],y,i,
+"edit"):i[g];a=this.title?{title:b.jgrid.stripHtml(x)}:{};b("tr.footrow td:eq("+y+")",r.grid.sDiv).html(x).attr(a);k=true}}else if(f=="get")l[g]=b("tr.footrow td:eq("+y+")",r.grid.sDiv).html()})});return f=="get"?l:k},showHideCol:function(f,i){return this.each(function(){var h=this,c=false,g=b.browser.webkit||b.browser.safari?0:h.p.cellLayout,k;if(h.grid){if(typeof f==="string")f=[f];i=i!="none"?"":"none";var l=i===""?true:false,a=h.p.groupHeader&&(typeof h.p.groupHeader==="object"||b.isFunction(h.p.groupHeader));
+a&&b(h).jqGrid("destroyGroupHeader",false);b(this.p.colModel).each(function(r){if(b.inArray(this.name,f)!==-1&&this.hidden===l){b("tr",h.grid.hDiv).each(function(){b(this.cells[r]).css("display",i)});b(h.rows).each(function(){b(this.cells[r]).css("display",i)});h.p.footerrow&&b("tr.footrow td:eq("+r+")",h.grid.sDiv).css("display",i);k=this.widthOrg?this.widthOrg:parseInt(this.width,10);if(i==="none")h.p.tblwidth-=k+g;else h.p.tblwidth+=k+g;this.hidden=!l;c=true}});if(c===true)b(h).jqGrid("setGridWidth",
+h.p.shrinkToFit===true?h.p.tblwidth:h.p.width);a&&b(h).jqGrid("setGroupHeaders",h.p.groupHeader)}})},hideCol:function(f){return this.each(function(){b(this).jqGrid("showHideCol",f,"none")})},showCol:function(f){return this.each(function(){b(this).jqGrid("showHideCol",f,"")})},remapColumns:function(f,i,h){function c(l){var a;a=l.length?b.makeArray(l):b.extend({},l);b.each(f,function(r){l[r]=a[this]})}function g(l,a){b(">tr"+(a||""),l).each(function(){var r=this,x=b.makeArray(r.cells);b.each(f,function(){var y=
+x[this];y&&r.appendChild(y)})})}var k=this.get(0);c(k.p.colModel);c(k.p.colNames);c(k.grid.headers);g(b("thead:first",k.grid.hDiv),h&&":not(.ui-jqgrid-labels)");i&&g(b("#"+b.jgrid.jqID(k.p.id)+" tbody:first"),".jqgfirstrow, tr.jqgrow, tr.jqfoot");k.p.footerrow&&g(b("tbody:first",k.grid.sDiv));if(k.p.remapColumns)if(k.p.remapColumns.length)c(k.p.remapColumns);else k.p.remapColumns=b.makeArray(f);k.p.lastsort=b.inArray(k.p.lastsort,f);if(k.p.treeGrid)k.p.expColInd=b.inArray(k.p.expColInd,f)},setGridWidth:function(f,
+i){return this.each(function(){if(this.grid){var h=this,c,g=0,k=b.browser.webkit||b.browser.safari?0:h.p.cellLayout,l,a=0,r=false,x=h.p.scrollOffset,y,H=0,L=0,M;if(typeof i!="boolean")i=h.p.shrinkToFit;if(!isNaN(f)){f=parseInt(f,10);h.grid.width=h.p.width=f;b("#gbox_"+b.jgrid.jqID(h.p.id)).css("width",f+"px");b("#gview_"+b.jgrid.jqID(h.p.id)).css("width",f+"px");b(h.grid.bDiv).css("width",f+"px");b(h.grid.hDiv).css("width",f+"px");h.p.pager&&b(h.p.pager).css("width",f+"px");h.p.toppager&&b(h.p.toppager).css("width",
+f+"px");if(h.p.toolbar[0]===true){b(h.grid.uDiv).css("width",f+"px");h.p.toolbar[1]=="both"&&b(h.grid.ubDiv).css("width",f+"px")}h.p.footerrow&&b(h.grid.sDiv).css("width",f+"px");if(i===false&&h.p.forceFit===true)h.p.forceFit=false;if(i===true){b.each(h.p.colModel,function(){if(this.hidden===false){c=this.widthOrg?this.widthOrg:parseInt(this.width,10);g+=c+k;if(this.fixed)H+=c+k;else a++;L++}});if(a===0)return;h.p.tblwidth=g;y=f-k*a-H;if(!isNaN(h.p.height))if(b(h.grid.bDiv)[0].clientHeight<b(h.grid.bDiv)[0].scrollHeight||
+h.rows.length===1){r=true;y-=x}g=0;var P=h.grid.cols.length>0;b.each(h.p.colModel,function(U){if(this.hidden===false&&!this.fixed){c=this.widthOrg?this.widthOrg:parseInt(this.width,10);c=Math.round(y*c/(h.p.tblwidth-k*a-H));if(!(c<0)){this.width=c;g+=c;h.grid.headers[U].width=c;h.grid.headers[U].el.style.width=c+"px";if(h.p.footerrow)h.grid.footers[U].style.width=c+"px";if(P)h.grid.cols[U].style.width=c+"px";l=U}}});if(!l)return;M=0;if(r){if(f-H-(g+k*a)!==x)M=f-H-(g+k*a)-x}else if(Math.abs(f-H-(g+
+k*a))!==1)M=f-H-(g+k*a);h.p.colModel[l].width+=M;h.p.tblwidth=g+M+k*a+H;if(h.p.tblwidth>f){r=h.p.tblwidth-parseInt(f,10);h.p.tblwidth=f;c=h.p.colModel[l].width-=r}else c=h.p.colModel[l].width;h.grid.headers[l].width=c;h.grid.headers[l].el.style.width=c+"px";if(P)h.grid.cols[l].style.width=c+"px";if(h.p.footerrow)h.grid.footers[l].style.width=c+"px"}if(h.p.tblwidth){b("table:first",h.grid.bDiv).css("width",h.p.tblwidth+"px");b("table:first",h.grid.hDiv).css("width",h.p.tblwidth+"px");h.grid.hDiv.scrollLeft=
+h.grid.bDiv.scrollLeft;h.p.footerrow&&b("table:first",h.grid.sDiv).css("width",h.p.tblwidth+"px")}}}})},setGridHeight:function(f){return this.each(function(){if(this.grid){b(this.grid.bDiv).css({height:f+(isNaN(f)?"":"px")});this.p.height=f;this.p.scroll&&this.grid.populateVisible()}})},setCaption:function(f){return this.each(function(){this.p.caption=f;b("span.ui-jqgrid-title",this.grid.cDiv).html(f);b(this.grid.cDiv).show()})},setLabel:function(f,i,h,c){return this.each(function(){var g=-1;if(this.grid)if(typeof f!=
+"undefined"){b(this.p.colModel).each(function(a){if(this.name==f){g=a;return false}});if(g>=0){var k=b("tr.ui-jqgrid-labels th:eq("+g+")",this.grid.hDiv);if(i){var l=b(".s-ico",k);b("[id^=jqgh_]",k).empty().html(i).append(l);this.p.colNames[g]=i}if(h)typeof h==="string"?b(k).addClass(h):b(k).css(h);typeof c==="object"&&b(k).attr(c)}}})},setCell:function(f,i,h,c,g,k){return this.each(function(){var l=-1,a,r;if(this.grid){if(isNaN(i))b(this.p.colModel).each(function(y){if(this.name==i){l=y;return false}});
+else l=parseInt(i,10);if(l>=0)if(a=this.rows.namedItem(f)){var x=b("td:eq("+l+")",a);if(h!==""||k===true){a=this.formatter(f,h,l,a,"edit");r=this.p.colModel[l].title?{title:b.jgrid.stripHtml(a)}:{};this.p.treeGrid&&b(".tree-wrap",b(x)).length>0?b("span",b(x)).html(a).attr(r):b(x).html(a).attr(r);if(this.p.datatype=="local"){a=this.p.colModel[l];h=a.formatter&&typeof a.formatter==="string"&&a.formatter=="date"?b.unformat.date(h,a):h;r=this.p._index[f];if(typeof r!="undefined")this.p.data[r][a.name]=
+h}}if(typeof c==="string")b(x).addClass(c);else c&&b(x).css(c);typeof g==="object"&&b(x).attr(g)}}})},getCell:function(f,i){var h=false;this.each(function(){var c=-1;if(this.grid){if(isNaN(i))b(this.p.colModel).each(function(l){if(this.name===i){c=l;return false}});else c=parseInt(i,10);if(c>=0){var g=this.rows.namedItem(f);if(g)try{h=b.unformat(b("td:eq("+c+")",g),{rowId:g.id,colModel:this.p.colModel[c]},c)}catch(k){h=b.jgrid.htmlDecode(b("td:eq("+c+")",g).html())}}}});return h},getCol:function(f,
+i,h){var c=[],g,k=0,l=0,a=0,r;i=typeof i!="boolean"?false:i;if(typeof h=="undefined")h=false;this.each(function(){var x=-1;if(this.grid){if(isNaN(f))b(this.p.colModel).each(function(M){if(this.name===f){x=M;return false}});else x=parseInt(f,10);if(x>=0){var y=this.rows.length,H=0;if(y&&y>0){for(;H<y;){if(b(this.rows[H]).hasClass("jqgrow")){try{g=b.unformat(b(this.rows[H].cells[x]),{rowId:this.rows[H].id,colModel:this.p.colModel[x]},x)}catch(L){g=b.jgrid.htmlDecode(this.rows[H].cells[x].innerHTML)}if(h){r=
+parseFloat(g);k+=r;l=Math.min(l,r);a=Math.max(a,r)}else i?c.push({id:this.rows[H].id,value:g}):c.push(g)}H++}if(h)switch(h.toLowerCase()){case "sum":c=k;break;case "avg":c=k/y;break;case "count":c=y;break;case "min":c=l;break;case "max":c=a}}}}});return c},clearGridData:function(f){return this.each(function(){if(this.grid){if(typeof f!="boolean")f=false;if(this.p.deepempty)b("#"+b.jgrid.jqID(this.p.id)+" tbody:first tr:gt(0)").remove();else{var i=b("#"+b.jgrid.jqID(this.p.id)+" tbody:first tr:first")[0];
+b("#"+b.jgrid.jqID(this.p.id)+" tbody:first").empty().append(i)}this.p.footerrow&&f&&b(".ui-jqgrid-ftable td",this.grid.sDiv).html("&#160;");this.p.selrow=null;this.p.selarrrow=[];this.p.savedRow=[];this.p.records=0;this.p.page=1;this.p.lastpage=0;this.p.reccount=0;this.p.data=[];this.p._index={};this.updatepager(true,false)}})},getInd:function(f,i){var h=false,c;this.each(function(){if(c=this.rows.namedItem(f))h=i===true?c:c.rowIndex});return h},bindKeys:function(f){var i=b.extend({onEnter:null,
+onSpace:null,onLeftKey:null,onRightKey:null,scrollingRows:true},f||{});return this.each(function(){var h=this;b("body").is("[role]")||b("body").attr("role","application");h.p.scrollrows=i.scrollingRows;b(h).keydown(function(c){var g=b(h).find("tr[tabindex=0]")[0],k,l,a,r=h.p.treeReader.expanded_field;if(g){a=h.p._index[g.id];if(c.keyCode===37||c.keyCode===38||c.keyCode===39||c.keyCode===40){if(c.keyCode===38){l=g.previousSibling;k="";if(l)if(b(l).is(":hidden"))for(;l;){l=l.previousSibling;if(!b(l).is(":hidden")&&
+b(l).hasClass("jqgrow")){k=l.id;break}}else k=l.id;b(h).jqGrid("setSelection",k)}if(c.keyCode===40){l=g.nextSibling;k="";if(l)if(b(l).is(":hidden"))for(;l;){l=l.nextSibling;if(!b(l).is(":hidden")&&b(l).hasClass("jqgrow")){k=l.id;break}}else k=l.id;b(h).jqGrid("setSelection",k)}if(c.keyCode===37){h.p.treeGrid&&h.p.data[a][r]&&b(g).find("div.treeclick").trigger("click");b.isFunction(i.onLeftKey)&&i.onLeftKey.call(h,h.p.selrow)}if(c.keyCode===39){h.p.treeGrid&&!h.p.data[a][r]&&b(g).find("div.treeclick").trigger("click");
+b.isFunction(i.onRightKey)&&i.onRightKey.call(h,h.p.selrow)}}else if(c.keyCode===13)b.isFunction(i.onEnter)&&i.onEnter.call(h,h.p.selrow);else c.keyCode===32&&b.isFunction(i.onSpace)&&i.onSpace.call(h,h.p.selrow)}})})},unbindKeys:function(){return this.each(function(){b(this).unbind("keydown")})},getLocalRow:function(f){var i=false,h;this.each(function(){if(typeof f!=="undefined"){h=this.p._index[f];if(h>=0)i=this.p.data[h]}});return i}})})(jQuery);
+(function(b){b.fmatter={};b.extend(b.fmatter,{isBoolean:function(a){return typeof a==="boolean"},isObject:function(a){return a&&(typeof a==="object"||b.isFunction(a))||false},isString:function(a){return typeof a==="string"},isNumber:function(a){return typeof a==="number"&&isFinite(a)},isNull:function(a){return a===null},isUndefined:function(a){return typeof a==="undefined"},isValue:function(a){return this.isObject(a)||this.isString(a)||this.isNumber(a)||this.isBoolean(a)},isEmpty:function(a){if(!this.isString(a)&&
+this.isValue(a))return false;else if(!this.isValue(a))return true;a=b.trim(a).replace(/\&nbsp\;/ig,"").replace(/\&#160\;/ig,"");return a===""}});b.fn.fmatter=function(a,c,d,e,f){var g=c;d=b.extend({},b.jgrid.formatter,d);if(b.fn.fmatter[a])g=b.fn.fmatter[a](c,d,e,f);return g};b.fmatter.util={NumberFormat:function(a,c){b.fmatter.isNumber(a)||(a*=1);if(b.fmatter.isNumber(a)){var d=a<0,e=a+"",f=c.decimalSeparator?c.decimalSeparator:".",g;if(b.fmatter.isNumber(c.decimalPlaces)){var h=c.decimalPlaces;
+e=Math.pow(10,h);e=Math.round(a*e)/e+"";g=e.lastIndexOf(".");if(h>0){if(g<0){e+=f;g=e.length-1}else if(f!==".")e=e.replace(".",f);for(;e.length-1-g<h;)e+="0"}}if(c.thousandsSeparator){h=c.thousandsSeparator;g=e.lastIndexOf(f);g=g>-1?g:e.length;f=e.substring(g);for(var i=-1,j=g;j>0;j--){i++;if(i%3===0&&j!==g&&(!d||j>1))f=h+f;f=e.charAt(j-1)+f}e=f}e=c.prefix?c.prefix+e:e;return e=c.suffix?e+c.suffix:e}else return a},DateFormat:function(a,c,d,e){var f=/^\/Date\((([-+])?[0-9]+)(([-+])([0-9]{2})([0-9]{2}))?\)\/$/,
+g=typeof c==="string"?c.match(f):null;f=function(m,r){m=String(m);for(r=parseInt(r,10)||2;m.length<r;)m="0"+m;return m};var h={m:1,d:1,y:1970,h:0,i:0,s:0,u:0},i=0,j,k=["i18n"];k.i18n={dayNames:e.dayNames,monthNames:e.monthNames};if(a in e.masks)a=e.masks[a];if(!isNaN(c-0)&&String(a).toLowerCase()=="u")i=new Date(parseFloat(c)*1E3);else if(c.constructor===Date)i=c;else if(g!==null){i=new Date(parseInt(g[1],10));if(g[3]){a=Number(g[5])*60+Number(g[6]);a*=g[4]=="-"?1:-1;a-=i.getTimezoneOffset();i.setTime(Number(Number(i)+
+a*6E4))}}else{c=String(c).split(/[\\\/:_;.,\t\T\s-]/);a=a.split(/[\\\/:_;.,\t\T\s-]/);g=0;for(j=a.length;g<j;g++){if(a[g]=="M"){i=b.inArray(c[g],k.i18n.monthNames);if(i!==-1&&i<12)c[g]=i+1}if(a[g]=="F"){i=b.inArray(c[g],k.i18n.monthNames);if(i!==-1&&i>11)c[g]=i+1-12}if(c[g])h[a[g].toLowerCase()]=parseInt(c[g],10)}if(h.f)h.m=h.f;if(h.m===0&&h.y===0&&h.d===0)return"&#160;";h.m=parseInt(h.m,10)-1;i=h.y;if(i>=70&&i<=99)h.y=1900+h.y;else if(i>=0&&i<=69)h.y=2E3+h.y;i=new Date(h.y,h.m,h.d,h.h,h.i,h.s,h.u)}if(d in
+e.masks)d=e.masks[d];else d||(d="Y-m-d");a=i.getHours();c=i.getMinutes();h=i.getDate();g=i.getMonth()+1;j=i.getTimezoneOffset();var l=i.getSeconds(),o=i.getMilliseconds(),n=i.getDay(),p=i.getFullYear(),q=(n+6)%7+1,s=(new Date(p,g-1,h)-new Date(p,0,1))/864E5,t={d:f(h),D:k.i18n.dayNames[n],j:h,l:k.i18n.dayNames[n+7],N:q,S:e.S(h),w:n,z:s,W:q<5?Math.floor((s+q-1)/7)+1:Math.floor((s+q-1)/7)||(((new Date(p-1,0,1)).getDay()+6)%7<4?53:52),F:k.i18n.monthNames[g-1+12],m:f(g),M:k.i18n.monthNames[g-1],n:g,t:"?",
+L:"?",o:"?",Y:p,y:String(p).substring(2),a:a<12?e.AmPm[0]:e.AmPm[1],A:a<12?e.AmPm[2]:e.AmPm[3],B:"?",g:a%12||12,G:a,h:f(a%12||12),H:f(a),i:f(c),s:f(l),u:o,e:"?",I:"?",O:(j>0?"-":"+")+f(Math.floor(Math.abs(j)/60)*100+Math.abs(j)%60,4),P:"?",T:(String(i).match(/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g)||[""]).pop().replace(/[^-+\dA-Z]/g,""),Z:"?",c:"?",r:"?",U:Math.floor(i/1E3)};return d.replace(/\\.|[dDjlNSwzWFmMntLoYyaABgGhHisueIOPTZcrU]/g,
+function(m){return m in t?t[m]:m.substring(1)})}};b.fn.fmatter.defaultFormat=function(a,c){return b.fmatter.isValue(a)&&a!==""?a:c.defaultValue?c.defaultValue:"&#160;"};b.fn.fmatter.email=function(a,c){return b.fmatter.isEmpty(a)?b.fn.fmatter.defaultFormat(a,c):'<a href="mailto:'+a+'">'+a+"</a>"};b.fn.fmatter.checkbox=function(a,c){var d=b.extend({},c.checkbox),e;b.fmatter.isUndefined(c.colModel.formatoptions)||(d=b.extend({},d,c.colModel.formatoptions));e=d.disabled===true?'disabled="disabled"':
+"";if(b.fmatter.isEmpty(a)||b.fmatter.isUndefined(a))a=b.fn.fmatter.defaultFormat(a,d);a+="";a=a.toLowerCase();return'<input type="checkbox" '+(a.search(/(false|0|no|off)/i)<0?" checked='checked' ":"")+' value="'+a+'" offval="no" '+e+"/>"};b.fn.fmatter.link=function(a,c){var d={target:c.target},e="";b.fmatter.isUndefined(c.colModel.formatoptions)||(d=b.extend({},d,c.colModel.formatoptions));if(d.target)e="target="+d.target;return b.fmatter.isEmpty(a)?b.fn.fmatter.defaultFormat(a,c):"<a "+e+' href="'+
+a+'">'+a+"</a>"};b.fn.fmatter.showlink=function(a,c){var d={baseLinkUrl:c.baseLinkUrl,showAction:c.showAction,addParam:c.addParam||"",target:c.target,idName:c.idName},e="";b.fmatter.isUndefined(c.colModel.formatoptions)||(d=b.extend({},d,c.colModel.formatoptions));if(d.target)e="target="+d.target;d=d.baseLinkUrl+d.showAction+"?"+d.idName+"="+c.rowId+d.addParam;return b.fmatter.isString(a)||b.fmatter.isNumber(a)?"<a "+e+' href="'+d+'">'+a+"</a>":b.fn.fmatter.defaultFormat(a,c)};b.fn.fmatter.integer=
+function(a,c){var d=b.extend({},c.integer);b.fmatter.isUndefined(c.colModel.formatoptions)||(d=b.extend({},d,c.colModel.formatoptions));if(b.fmatter.isEmpty(a))return d.defaultValue;return b.fmatter.util.NumberFormat(a,d)};b.fn.fmatter.number=function(a,c){var d=b.extend({},c.number);b.fmatter.isUndefined(c.colModel.formatoptions)||(d=b.extend({},d,c.colModel.formatoptions));if(b.fmatter.isEmpty(a))return d.defaultValue;return b.fmatter.util.NumberFormat(a,d)};b.fn.fmatter.currency=function(a,c){var d=
+b.extend({},c.currency);b.fmatter.isUndefined(c.colModel.formatoptions)||(d=b.extend({},d,c.colModel.formatoptions));if(b.fmatter.isEmpty(a))return d.defaultValue;return b.fmatter.util.NumberFormat(a,d)};b.fn.fmatter.date=function(a,c,d,e){d=b.extend({},c.date);b.fmatter.isUndefined(c.colModel.formatoptions)||(d=b.extend({},d,c.colModel.formatoptions));return!d.reformatAfterEdit&&e=="edit"?b.fn.fmatter.defaultFormat(a,c):b.fmatter.isEmpty(a)?b.fn.fmatter.defaultFormat(a,c):b.fmatter.util.DateFormat(d.srcformat,
+a,d.newformat,d)};b.fn.fmatter.select=function(a,c){a+="";var d=false,e=[];if(b.fmatter.isUndefined(c.colModel.formatoptions)){if(!b.fmatter.isUndefined(c.colModel.editoptions))d=c.colModel.editoptions.value}else d=c.colModel.formatoptions.value;if(d){var f=c.colModel.editoptions.multiple===true?true:false,g=[],h;if(f){g=a.split(",");g=b.map(g,function(l){return b.trim(l)})}if(b.fmatter.isString(d))for(var i=d.split(";"),j=0,k=0;k<i.length;k++){h=i[k].split(":");if(h.length>2)h[1]=jQuery.map(h,function(l,
+o){if(o>0)return l}).join(":");if(f){if(jQuery.inArray(h[0],g)>-1){e[j]=h[1];j++}}else if(b.trim(h[0])==b.trim(a)){e[0]=h[1];break}}else if(b.fmatter.isObject(d))if(f)e=jQuery.map(g,function(l){return d[l]});else e[0]=d[a]||""}a=e.join(", ");return a===""?b.fn.fmatter.defaultFormat(a,c):a};b.fn.fmatter.rowactions=function(a,c,d,e){var f={keys:false,onEdit:null,onSuccess:null,afterSave:null,onError:null,afterRestore:null,extraparam:{oper:"edit"},url:null,delOptions:{},editOptions:{}};a=b.jgrid.jqID(a);
+c=b.jgrid.jqID(c);e=b("#"+c)[0].p.colModel[e];b.fmatter.isUndefined(e.formatoptions)||(f=b.extend(f,e.formatoptions));if(!b.fmatter.isUndefined(b("#"+c)[0].p.editOptions))f.editOptions=b("#"+c)[0].p.editOptions;if(!b.fmatter.isUndefined(b("#"+c)[0].p.delOptions))f.delOptions=b("#"+c)[0].p.delOptions;e=function(h){f.afterSave&&f.afterSave(h);b("tr#"+a+" div.ui-inline-edit, tr#"+a+" div.ui-inline-del","#"+c+".ui-jqgrid-btable:first").show();b("tr#"+a+" div.ui-inline-save, tr#"+a+" div.ui-inline-cancel",
+"#"+c+".ui-jqgrid-btable:first").hide()};var g=function(h){f.afterRestore&&f.afterRestore(h);b("tr#"+a+" div.ui-inline-edit, tr#"+a+" div.ui-inline-del","#"+c+".ui-jqgrid-btable:first").show();b("tr#"+a+" div.ui-inline-save, tr#"+a+" div.ui-inline-cancel","#"+c+".ui-jqgrid-btable:first").hide()};switch(d){case "edit":b("#"+c).jqGrid("editRow",a,f.keys,f.onEdit,f.onSuccess,f.url,f.extraparam,e,f.onError,g);b("tr#"+a+" div.ui-inline-edit, tr#"+a+" div.ui-inline-del","#"+c+".ui-jqgrid-btable:first").hide();
+b("tr#"+a+" div.ui-inline-save, tr#"+a+" div.ui-inline-cancel","#"+c+".ui-jqgrid-btable:first").show();break;case "save":if(b("#"+c).jqGrid("saveRow",a,f.onSuccess,f.url,f.extraparam,e,f.onError,g)){b("tr#"+a+" div.ui-inline-edit, tr#"+a+" div.ui-inline-del","#"+c+".ui-jqgrid-btable:first").show();b("tr#"+a+" div.ui-inline-save, tr#"+a+" div.ui-inline-cancel","#"+c+".ui-jqgrid-btable:first").hide()}break;case "cancel":b("#"+c).jqGrid("restoreRow",a,g);b("tr#"+a+" div.ui-inline-edit, tr#"+a+" div.ui-inline-del",
+"#"+c+".ui-jqgrid-btable:first").show();b("tr#"+a+" div.ui-inline-save, tr#"+a+" div.ui-inline-cancel","#"+c+".ui-jqgrid-btable:first").hide();break;case "del":b("#"+c).jqGrid("delGridRow",a,f.delOptions);break;case "formedit":b("#"+c).jqGrid("setSelection",a);b("#"+c).jqGrid("editGridRow",a,f.editOptions)}};b.fn.fmatter.actions=function(a,c){var d={keys:false,editbutton:true,delbutton:true,editformbutton:false};b.fmatter.isUndefined(c.colModel.formatoptions)||(d=b.extend(d,c.colModel.formatoptions));
+var e=c.rowId,f="",g;if(typeof e=="undefined"||b.fmatter.isEmpty(e))return"";if(d.editformbutton){g="onclick=jQuery.fn.fmatter.rowactions('"+e+"','"+c.gid+"','formedit',"+c.pos+"); onmouseover=jQuery(this).addClass('ui-state-hover'); onmouseout=jQuery(this).removeClass('ui-state-hover'); ";f=f+"<div title='"+b.jgrid.nav.edittitle+"' style='float:left;cursor:pointer;' class='ui-pg-div ui-inline-edit' "+g+"><span class='ui-icon ui-icon-pencil'></span></div>"}else if(d.editbutton){g="onclick=jQuery.fn.fmatter.rowactions('"+
+e+"','"+c.gid+"','edit',"+c.pos+"); onmouseover=jQuery(this).addClass('ui-state-hover'); onmouseout=jQuery(this).removeClass('ui-state-hover') ";f=f+"<div title='"+b.jgrid.nav.edittitle+"' style='float:left;cursor:pointer;' class='ui-pg-div ui-inline-edit' "+g+"><span class='ui-icon ui-icon-pencil'></span></div>"}if(d.delbutton){g="onclick=jQuery.fn.fmatter.rowactions('"+e+"','"+c.gid+"','del',"+c.pos+"); onmouseover=jQuery(this).addClass('ui-state-hover'); onmouseout=jQuery(this).removeClass('ui-state-hover'); ";
+f=f+"<div title='"+b.jgrid.nav.deltitle+"' style='float:left;margin-left:5px;' class='ui-pg-div ui-inline-del' "+g+"><span class='ui-icon ui-icon-trash'></span></div>"}g="onclick=jQuery.fn.fmatter.rowactions('"+e+"','"+c.gid+"','save',"+c.pos+"); onmouseover=jQuery(this).addClass('ui-state-hover'); onmouseout=jQuery(this).removeClass('ui-state-hover'); ";f=f+"<div title='"+b.jgrid.edit.bSubmit+"' style='float:left;display:none' class='ui-pg-div ui-inline-save' "+g+"><span class='ui-icon ui-icon-disk'></span></div>";
+g="onclick=jQuery.fn.fmatter.rowactions('"+e+"','"+c.gid+"','cancel',"+c.pos+"); onmouseover=jQuery(this).addClass('ui-state-hover'); onmouseout=jQuery(this).removeClass('ui-state-hover'); ";f=f+"<div title='"+b.jgrid.edit.bCancel+"' style='float:left;display:none;margin-left:5px;' class='ui-pg-div ui-inline-cancel' "+g+"><span class='ui-icon ui-icon-cancel'></span></div>";return"<div style='margin-left:8px;'>"+f+"</div>"};b.unformat=function(a,c,d,e){var f,g=c.colModel.formatter,h=c.colModel.formatoptions||
+{},i=/([\.\*\_\'\(\)\{\}\+\?\\])/g,j=c.colModel.unformat||b.fn.fmatter[g]&&b.fn.fmatter[g].unformat;if(typeof j!=="undefined"&&b.isFunction(j))f=j(b(a).text(),c,a);else if(!b.fmatter.isUndefined(g)&&b.fmatter.isString(g)){f=b.jgrid.formatter||{};switch(g){case "integer":h=b.extend({},f.integer,h);c=h.thousandsSeparator.replace(i,"\\$1");f=b(a).text().replace(RegExp(c,"g"),"");break;case "number":h=b.extend({},f.number,h);c=h.thousandsSeparator.replace(i,"\\$1");f=b(a).text().replace(RegExp(c,"g"),
+"").replace(h.decimalSeparator,".");break;case "currency":h=b.extend({},f.currency,h);c=h.thousandsSeparator.replace(i,"\\$1");f=b(a).text().replace(RegExp(c,"g"),"").replace(h.decimalSeparator,".").replace(h.prefix,"").replace(h.suffix,"");break;case "checkbox":h=c.colModel.editoptions?c.colModel.editoptions.value.split(":"):["Yes","No"];f=b("input",a).is(":checked")?h[0]:h[1];break;case "select":f=b.unformat.select(a,c,d,e);break;case "actions":return"";default:f=b(a).text()}}return f!==undefined?
+f:e===true?b(a).text():b.jgrid.htmlDecode(b(a).html())};b.unformat.select=function(a,c,d,e){d=[];a=b(a).text();if(e===true)return a;c=b.extend({},c.colModel.editoptions);if(c.value){var f=c.value;c=c.multiple===true?true:false;e=[];var g;if(c){e=a.split(",");e=b.map(e,function(k){return b.trim(k)})}if(b.fmatter.isString(f))for(var h=f.split(";"),i=0,j=0;j<h.length;j++){g=h[j].split(":");if(g.length>2)g[1]=jQuery.map(g,function(k,l){if(l>0)return k}).join(":");if(c){if(jQuery.inArray(g[1],e)>-1){d[i]=
+g[0];i++}}else if(b.trim(g[1])==b.trim(a)){d[0]=g[0];break}}else if(b.fmatter.isObject(f)||b.isArray(f)){c||(e[0]=a);d=jQuery.map(e,function(k){var l;b.each(f,function(o,n){if(n==k){l=o;return false}});if(typeof l!="undefined")return l})}return d.join(", ")}else return a||""};b.unformat.date=function(a,c){var d=b.jgrid.formatter.date||{};b.fmatter.isUndefined(c.formatoptions)||(d=b.extend({},d,c.formatoptions));return b.fmatter.isEmpty(a)?b.fn.fmatter.defaultFormat(a,c):b.fmatter.util.DateFormat(d.newformat,
+a,d.srcformat,d)}})(jQuery);
+(function(a){a.jgrid.extend({getColProp:function(c){var g={},b=this[0];if(!b.grid)return false;b=b.p.colModel;for(var i=0;i<b.length;i++)if(b[i].name==c){g=b[i];break}return g},setColProp:function(c,g){return this.each(function(){if(this.grid)if(g)for(var b=this.p.colModel,i=0;i<b.length;i++)if(b[i].name==c){a.extend(this.p.colModel[i],g);break}})},sortGrid:function(c,g,b){return this.each(function(){var i=-1;if(this.grid){if(!c)c=this.p.sortname;for(var l=0;l<this.p.colModel.length;l++)if(this.p.colModel[l].index==
+c||this.p.colModel[l].name==c){i=l;break}if(i!=-1){l=this.p.colModel[i].sortable;if(typeof l!=="boolean")l=true;if(typeof g!=="boolean")g=false;l&&this.sortData("jqgh_"+this.p.id+"_"+c,i,g,b)}}})},GridDestroy:function(){return this.each(function(){if(this.grid){this.p.pager&&a(this.p.pager).remove();var c=this.id;try{a("#gbox_"+c).remove()}catch(g){}}})},GridUnload:function(){return this.each(function(){if(this.grid){var c={id:a(this).attr("id"),cl:a(this).attr("class")};this.p.pager&&a(this.p.pager).empty().removeClass("ui-state-default ui-jqgrid-pager corner-bottom");
+var g=document.createElement("table");a(g).attr({id:c.id});g.className=c.cl;c=this.id;a(g).removeClass("ui-jqgrid-btable");if(a(this.p.pager).parents("#gbox_"+c).length===1){a(g).insertBefore("#gbox_"+c).show();a(this.p.pager).insertBefore("#gbox_"+c)}else a(g).insertBefore("#gbox_"+c).show();a("#gbox_"+c).remove()}})},setGridState:function(c){return this.each(function(){if(this.grid)if(c=="hidden"){a(".ui-jqgrid-bdiv, .ui-jqgrid-hdiv","#gview_"+this.p.id).slideUp("fast");this.p.pager&&a(this.p.pager).slideUp("fast");
+this.p.toppager&&a(this.p.toppager).slideUp("fast");if(this.p.toolbar[0]===true){this.p.toolbar[1]=="both"&&a(this.grid.ubDiv).slideUp("fast");a(this.grid.uDiv).slideUp("fast")}this.p.footerrow&&a(".ui-jqgrid-sdiv","#gbox_"+this.p.id).slideUp("fast");a(".ui-jqgrid-titlebar-close span",this.grid.cDiv).removeClass("ui-icon-circle-triangle-n").addClass("ui-icon-circle-triangle-s");this.p.gridstate="hidden"}else if(c=="visible"){a(".ui-jqgrid-hdiv, .ui-jqgrid-bdiv","#gview_"+this.p.id).slideDown("fast");
+this.p.pager&&a(this.p.pager).slideDown("fast");this.p.toppager&&a(this.p.toppager).slideDown("fast");if(this.p.toolbar[0]===true){this.p.toolbar[1]=="both"&&a(this.grid.ubDiv).slideDown("fast");a(this.grid.uDiv).slideDown("fast")}this.p.footerrow&&a(".ui-jqgrid-sdiv","#gbox_"+this.p.id).slideDown("fast");a(".ui-jqgrid-titlebar-close span",this.grid.cDiv).removeClass("ui-icon-circle-triangle-s").addClass("ui-icon-circle-triangle-n");this.p.gridstate="visible"}})},filterToolbar:function(c){c=a.extend({autosearch:true,
+searchOnEnter:true,beforeSearch:null,afterSearch:null,beforeClear:null,afterClear:null,searchurl:"",stringResult:false,groupOp:"AND",defaultSearch:"bw"},c||{});return this.each(function(){function g(d,f){var j=a(d);j[0]&&jQuery.each(f,function(){this.data!==undefined?j.bind(this.type,this.data,this.fn):j.bind(this.type,this.fn)})}var b=this;if(!this.ftoolbar){var i=function(){var d={},f=0,j,e,h={},n;a.each(b.p.colModel,function(){e=this.index||this.name;switch(this.stype){case "select":n=this.searchoptions&&
+this.searchoptions.sopt?this.searchoptions.sopt[0]:"eq";if(j=a("#gs_"+a.jgrid.jqID(this.name),b.grid.hDiv).val()){d[e]=j;h[e]=n;f++}else try{delete b.p.postData[e]}catch(r){}break;case "text":n=this.searchoptions&&this.searchoptions.sopt?this.searchoptions.sopt[0]:c.defaultSearch;if(j=a("#gs_"+a.jgrid.jqID(this.name),b.grid.hDiv).val()){d[e]=j;h[e]=n;f++}else try{delete b.p.postData[e]}catch(u){}}});var o=f>0?true:false;if(c.stringResult===true||b.p.datatype=="local"){var k='{"groupOp":"'+c.groupOp+
+'","rules":[',t=0;a.each(d,function(r,u){if(t>0)k+=",";k+='{"field":"'+r+'",';k+='"op":"'+h[r]+'",';u+="";k+='"data":"'+u.replace(/\\/g,"\\\\").replace(/\"/g,'\\"')+'"}';t++});k+="]}";a.extend(b.p.postData,{filters:k});a.each(["searchField","searchString","searchOper"],function(r,u){b.p.postData.hasOwnProperty(u)&&delete b.p.postData[u]})}else a.extend(b.p.postData,d);var m;if(b.p.searchurl){m=b.p.url;a(b).jqGrid("setGridParam",{url:b.p.searchurl})}var q=false;if(a.isFunction(c.beforeSearch))q=c.beforeSearch.call(b);
+q||a(b).jqGrid("setGridParam",{search:o}).trigger("reloadGrid",[{page:1}]);m&&a(b).jqGrid("setGridParam",{url:m});a.isFunction(c.afterSearch)&&c.afterSearch()},l=a("<tr class='ui-search-toolbar' role='rowheader'></tr>"),p;a.each(b.p.colModel,function(){var d=this,f,j,e,h;j=a("<th role='columnheader' class='ui-state-default ui-th-column ui-th-"+b.p.direction+"'></th>");f=a("<div style='width:100%;position:relative;height:100%;padding-right:0.3em;'></div>");this.hidden===true&&a(j).css("display","none");
+this.search=this.search===false?false:true;if(typeof this.stype=="undefined")this.stype="text";e=a.extend({},this.searchoptions||{});if(this.search)switch(this.stype){case "select":if(h=this.surl||e.dataUrl)a.ajax(a.extend({url:h,dataType:"html",success:function(m){if(e.buildSelect!==undefined)(m=e.buildSelect(m))&&a(f).append(m);else a(f).append(m);e.defaultValue&&a("select",f).val(e.defaultValue);a("select",f).attr({name:d.index||d.name,id:"gs_"+d.name});e.attr&&a("select",f).attr(e.attr);a("select",
+f).css({width:"100%"});e.dataInit!==undefined&&e.dataInit(a("select",f)[0]);e.dataEvents!==undefined&&g(a("select",f)[0],e.dataEvents);c.autosearch===true&&a("select",f).change(function(){i();return false});m=null}},a.jgrid.ajaxOptions,b.p.ajaxSelectOptions||{}));else{var n;if(d.searchoptions&&d.searchoptions.value)n=d.searchoptions.value;else if(d.editoptions&&d.editoptions.value)n=d.editoptions.value;if(n){h=document.createElement("select");h.style.width="100%";a(h).attr({name:d.index||d.name,id:"gs_"+
+d.name});var o,k;if(typeof n==="string"){n=n.split(";");for(var t=0;t<n.length;t++){o=n[t].split(":");k=document.createElement("option");k.value=o[0];k.innerHTML=o[1];h.appendChild(k)}}else if(typeof n==="object")for(o in n)if(n.hasOwnProperty(o)){k=document.createElement("option");k.value=o;k.innerHTML=n[o];h.appendChild(k)}e.defaultValue&&a(h).val(e.defaultValue);e.attr&&a(h).attr(e.attr);e.dataInit!==undefined&&e.dataInit(h);e.dataEvents!==undefined&&g(h,e.dataEvents);a(f).append(h);c.autosearch===
+true&&a(h).change(function(){i();return false})}}break;case "text":h=e.defaultValue?e.defaultValue:"";a(f).append("<input type='text' style='width:95%;padding:0px;' name='"+(d.index||d.name)+"' id='gs_"+d.name+"' value='"+h+"'/>");e.attr&&a("input",f).attr(e.attr);e.dataInit!==undefined&&e.dataInit(a("input",f)[0]);e.dataEvents!==undefined&&g(a("input",f)[0],e.dataEvents);if(c.autosearch===true)c.searchOnEnter?a("input",f).keypress(function(m){if((m.charCode?m.charCode:m.keyCode?m.keyCode:0)==13){i();
+return false}return this}):a("input",f).keydown(function(m){switch(m.which){case 13:return false;case 9:case 16:case 37:case 38:case 39:case 40:case 27:break;default:p&&clearTimeout(p);p=setTimeout(function(){i()},500)}})}a(j).append(f);a(l).append(j)});a("table thead",b.grid.hDiv).append(l);this.ftoolbar=true;this.triggerToolbar=i;this.clearToolbar=function(d){var f={},j,e=0,h;d=typeof d!="boolean"?true:d;a.each(b.p.colModel,function(){j=this.searchoptions&&this.searchoptions.defaultValue?this.searchoptions.defaultValue:
+"";h=this.index||this.name;switch(this.stype){case "select":var q;a("#gs_"+a.jgrid.jqID(h)+" option",b.grid.hDiv).each(function(s){if(s===0)this.selected=true;if(a(this).text()==j){this.selected=true;q=a(this).val();return false}});if(q){f[h]=q;e++}else try{delete b.p.postData[h]}catch(r){}break;case "text":a("#gs_"+a.jgrid.jqID(h),b.grid.hDiv).val(j);if(j){f[h]=j;e++}else try{delete b.p.postData[h]}catch(u){}}});var n=e>0?true:false;if(c.stringResult===true||b.p.datatype=="local"){var o='{"groupOp":"'+
+c.groupOp+'","rules":[',k=0;a.each(f,function(q,r){if(k>0)o+=",";o+='{"field":"'+q+'",';o+='"op":"eq",';r+="";o+='"data":"'+r.replace(/\\/g,"\\\\").replace(/\"/g,'\\"')+'"}';k++});o+="]}";a.extend(b.p.postData,{filters:o});a.each(["searchField","searchString","searchOper"],function(q,r){b.p.postData.hasOwnProperty(r)&&delete b.p.postData[r]})}else a.extend(b.p.postData,f);var t;if(b.p.searchurl){t=b.p.url;a(b).jqGrid("setGridParam",{url:b.p.searchurl})}var m=false;if(a.isFunction(c.beforeClear))m=
+c.beforeClear.call(b);m||d&&a(b).jqGrid("setGridParam",{search:n}).trigger("reloadGrid",[{page:1}]);t&&a(b).jqGrid("setGridParam",{url:t});a.isFunction(c.afterClear)&&c.afterClear()};this.toggleToolbar=function(){var d=a("tr.ui-search-toolbar",b.grid.hDiv);d.css("display")=="none"?d.show():d.hide()}}})},destroyGroupHeader:function(c){if(typeof c=="undefined")c=true;return this.each(function(){var g,b,i,l,p,d;b=this.grid;var f=a("table.ui-jqgrid-htable thead",b.hDiv),j=this.p.colModel;if(b){g=a("<tr>",
+{role:"rowheader"}).addClass("ui-jqgrid-labels");l=b.headers;b=0;for(i=l.length;b<i;b++){p=j[b].hidden?"none":"";p=a(l[b].el).width(l[b].width).removeAttr("rowSpan").css("display",p);g.append(p);d=p.children("span.ui-jqgrid-resize");if(d.length>0)d[0].style.height="";p.children("div")[0].style.top=""}a(f).children("tr.ui-jqgrid-labels").remove();a(f).prepend(g);c===true&&a(this).jqGrid("setGridParam",{groupHeader:null})}})},setGroupHeaders:function(c){c=a.extend({useColSpanStyle:false,groupHeaders:[]},
+c||{});return this.each(function(){this.p.groupHeader=c;var g=this,b,i,l=0,p,d,f,j,e,h=g.p.colModel,n=h.length,o=g.grid.headers,k=a("table.ui-jqgrid-htable",g.grid.hDiv),t=k.children("thead").children("tr.ui-jqgrid-labels:last").addClass("jqg-second-row-header");p=k.children("thead");var m,q=k.find(".jqg-first-row-header");if(q.html()===null)q=a("<tr>",{role:"row","aria-hidden":"true"}).addClass("jqg-first-row-header").css("height","auto");else q.empty();var r,u=function(s,v){for(var w=0,x=v.length;w<
+x;w++)if(v[w].startColumnName===s)return w;return-1};a(g).prepend(p);p=a("<tr>",{role:"rowheader"}).addClass("ui-jqgrid-labels jqg-third-row-header");for(b=0;b<n;b++){f=o[b].el;j=a(f);i=h[b];d={height:"0px",width:o[b].width+"px",display:i.hidden?"none":""};a("<th>",{role:"gridcell"}).css(d).addClass("ui-first-th-"+g.p.direction).appendTo(q);f.style.width="";d=u(i.name,c.groupHeaders);if(d>=0){d=c.groupHeaders[d];l=d.numberOfColumns;e=d.titleText;for(d=i=0;d<l&&b+d<n;d++)h[b+d].hidden||i++;d=a("<th>",
+{colspan:String(i),role:"columnheader"}).addClass("ui-state-default ui-th-column-header ui-th-"+g.p.direction).css({height:"22px","border-top":"0px none"}).html(e);g.p.headertitles&&d.attr("title",d.text());i===0&&d.hide();j.before(d);p.append(f);l-=1}else if(l===0)if(c.useColSpanStyle)j.attr("rowspan","2");else{a("<th>",{role:"columnheader"}).addClass("ui-state-default ui-th-column-header ui-th-"+g.p.direction).css({display:i.hidden?"none":"","border-top":"0px none"}).insertBefore(j);p.append(f)}else{p.append(f);
+l--}}h=a(g).children("thead");h.prepend(q);p.insertAfter(t);k.append(h);if(c.useColSpanStyle){k.find("span.ui-jqgrid-resize").each(function(){var s=a(this).parent();if(s.is(":visible"))this.style.cssText="height: "+s.height()+"px !important; cursor: col-resize;"});k.find("div.ui-jqgrid-sortable").each(function(){var s=a(this),v=s.parent();v.is(":visible")&&s.css("top",(v.height()-s.outerHeight())/2+"px")})}if(a.isFunction(g.p.resizeStop))m=g.p.resizeStop;r=h.find("tr.jqg-first-row-header");g.p.resizeStop=
+function(s,v){r.find("th").eq(v).width(s);a.isFunction(m)&&m.call(g,s,v)}})}})})(jQuery);
+(function(a){a.extend(a.jgrid,{showModal:function(b){b.w.show()},closeModal:function(b){b.w.hide().attr("aria-hidden","true");b.o&&b.o.remove()},hideModal:function(b,c){c=a.extend({jqm:true,gb:""},c||{});if(c.onClose){var d=c.onClose(b);if(typeof d=="boolean"&&!d)return}if(a.fn.jqm&&c.jqm===true)a(b).attr("aria-hidden","true").jqmHide();else{if(c.gb!=="")try{a(".jqgrid-overlay:first",c.gb).hide()}catch(f){}a(b).hide().attr("aria-hidden","true")}},findPos:function(b){var c=0,d=0;if(b.offsetParent){do{c+=
+b.offsetLeft;d+=b.offsetTop}while(b=b.offsetParent)}return[c,d]},createModal:function(b,c,d,f,g,h,j){var e=document.createElement("div"),k,m=this;j=a.extend({},j||{});k=a(d.gbox).attr("dir")=="rtl"?true:false;e.className="ui-widget ui-widget-content ui-corner-all ui-jqdialog";e.id=b.themodal;var i=document.createElement("div");i.className="ui-jqdialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix";i.id=b.modalhead;a(i).append("<span class='ui-jqdialog-title'>"+d.caption+"</span>");var q=
+a("<a href='javascript:void(0)' class='ui-jqdialog-titlebar-close ui-corner-all'></a>").hover(function(){q.addClass("ui-state-hover")},function(){q.removeClass("ui-state-hover")}).append("<span class='ui-icon ui-icon-closethick'></span>");a(i).append(q);if(k){e.dir="rtl";a(".ui-jqdialog-title",i).css("float","right");a(".ui-jqdialog-titlebar-close",i).css("left","0.3em")}else{e.dir="ltr";a(".ui-jqdialog-title",i).css("float","left");a(".ui-jqdialog-titlebar-close",i).css("right","0.3em")}var l=document.createElement("div");
+a(l).addClass("ui-jqdialog-content ui-widget-content").attr("id",b.modalcontent);a(l).append(c);e.appendChild(l);a(e).prepend(i);if(h===true)a("body").append(e);else typeof h=="string"?a(h).append(e):a(e).insertBefore(f);a(e).css(j);if(typeof d.jqModal==="undefined")d.jqModal=true;c={};if(a.fn.jqm&&d.jqModal===true){if(d.left===0&&d.top===0&&d.overlay){j=[];j=this.findPos(g);d.left=j[0]+4;d.top=j[1]+4}c.top=d.top+"px";c.left=d.left}else if(d.left!==0||d.top!==0){c.left=d.left;c.top=d.top+"px"}a("a.ui-jqdialog-titlebar-close",
+i).click(function(){var p=a("#"+b.themodal).data("onClose")||d.onClose,o=a("#"+b.themodal).data("gbox")||d.gbox;m.hideModal("#"+b.themodal,{gb:o,jqm:d.jqModal,onClose:p});return false});if(d.width===0||!d.width)d.width=300;if(d.height===0||!d.height)d.height=200;if(!d.zIndex){f=a(f).parents("*[role=dialog]").filter(":first").css("z-index");d.zIndex=f?parseInt(f,10)+1:950}f=0;if(k&&c.left&&!h){f=a(d.gbox).width()-(!isNaN(d.width)?parseInt(d.width,10):0)-8;c.left=parseInt(c.left,10)+parseInt(f,10)}if(c.left)c.left+=
+"px";a(e).css(a.extend({width:isNaN(d.width)?"auto":d.width+"px",height:isNaN(d.height)?"auto":d.height+"px",zIndex:d.zIndex,overflow:"hidden"},c)).attr({tabIndex:"-1",role:"dialog","aria-labelledby":b.modalhead,"aria-hidden":"true"});if(typeof d.drag=="undefined")d.drag=true;if(typeof d.resize=="undefined")d.resize=true;if(d.drag){a(i).css("cursor","move");if(a.fn.jqDrag)a(e).jqDrag(i);else try{a(e).draggable({handle:a("#"+i.id)})}catch(n){}}if(d.resize)if(a.fn.jqResize){a(e).append("<div class='jqResize ui-resizable-handle ui-resizable-se ui-icon ui-icon-gripsmall-diagonal-se ui-icon-grip-diagonal-se'></div>");
+a("#"+b.themodal).jqResize(".jqResize",b.scrollelm?"#"+b.scrollelm:false)}else try{a(e).resizable({handles:"se, sw",alsoResize:b.scrollelm?"#"+b.scrollelm:false})}catch(r){}d.closeOnEscape===true&&a(e).keydown(function(p){if(p.which==27){p=a("#"+b.themodal).data("onClose")||d.onClose;m.hideModal(this,{gb:d.gbox,jqm:d.jqModal,onClose:p})}})},viewModal:function(b,c){c=a.extend({toTop:true,overlay:10,modal:false,overlayClass:"ui-widget-overlay",onShow:this.showModal,onHide:this.closeModal,gbox:"",jqm:true,
+jqM:true},c||{});if(a.fn.jqm&&c.jqm===true)c.jqM?a(b).attr("aria-hidden","false").jqm(c).jqmShow():a(b).attr("aria-hidden","false").jqmShow();else{if(c.gbox!==""){a(".jqgrid-overlay:first",c.gbox).show();a(b).data("gbox",c.gbox)}a(b).show().attr("aria-hidden","false");try{a(":input:visible",b)[0].focus()}catch(d){}}},info_dialog:function(b,c,d,f){var g={width:290,height:"auto",dataheight:"auto",drag:true,resize:false,caption:"<b>"+b+"</b>",left:250,top:170,zIndex:1E3,jqModal:true,modal:false,closeOnEscape:true,
+align:"center",buttonalign:"center",buttons:[]};a.extend(g,f||{});var h=g.jqModal,j=this;if(a.fn.jqm&&!h)h=false;b="";if(g.buttons.length>0)for(f=0;f<g.buttons.length;f++){if(typeof g.buttons[f].id=="undefined")g.buttons[f].id="info_button_"+f;b+="<a href='javascript:void(0)' id='"+g.buttons[f].id+"' class='fm-button ui-state-default ui-corner-all'>"+g.buttons[f].text+"</a>"}f=isNaN(g.dataheight)?g.dataheight:g.dataheight+"px";var e="<div id='info_id'>";e+="<div id='infocnt' style='margin:0px;padding-bottom:1em;width:100%;overflow:auto;position:relative;height:"+
+f+";"+("text-align:"+g.align+";")+"'>"+c+"</div>";e+=d?"<div class='ui-widget-content ui-helper-clearfix' style='text-align:"+g.buttonalign+";padding-bottom:0.8em;padding-top:0.5em;background-image: none;border-width: 1px 0 0 0;'><a href='javascript:void(0)' id='closedialog' class='fm-button ui-state-default ui-corner-all'>"+d+"</a>"+b+"</div>":b!==""?"<div class='ui-widget-content ui-helper-clearfix' style='text-align:"+g.buttonalign+";padding-bottom:0.8em;padding-top:0.5em;background-image: none;border-width: 1px 0 0 0;'>"+
+b+"</div>":"";e+="</div>";try{a("#info_dialog").attr("aria-hidden")=="false"&&this.hideModal("#info_dialog",{jqm:h});a("#info_dialog").remove()}catch(k){}this.createModal({themodal:"info_dialog",modalhead:"info_head",modalcontent:"info_content",scrollelm:"infocnt"},e,g,"","",true);b&&a.each(g.buttons,function(i){a("#"+this.id,"#info_id").bind("click",function(){g.buttons[i].onClick.call(a("#info_dialog"));return false})});a("#closedialog","#info_id").click(function(){j.hideModal("#info_dialog",{jqm:h});
+return false});a(".fm-button","#info_dialog").hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});a.isFunction(g.beforeOpen)&&g.beforeOpen();this.viewModal("#info_dialog",{onHide:function(i){i.w.hide().remove();i.o&&i.o.remove()},modal:g.modal,jqm:h});a.isFunction(g.afterOpen)&&g.afterOpen();try{a("#info_dialog").focus()}catch(m){}},createEl:function(b,c,d,f,g){function h(l,n){a.isFunction(n.dataInit)&&n.dataInit(l);n.dataEvents&&a.each(n.dataEvents,
+function(){this.data!==undefined?a(l).bind(this.type,this.data,this.fn):a(l).bind(this.type,this.fn)});return n}function j(l,n,r){var p=["dataInit","dataEvents","dataUrl","buildSelect","sopt","searchhidden","defaultValue","attr"];if(typeof r!="undefined"&&a.isArray(r))p=a.extend(p,r);a.each(n,function(o,s){a.inArray(o,p)===-1&&a(l).attr(o,s)});n.hasOwnProperty("id")||a(l).attr("id",a.jgrid.randId())}var e="";switch(b){case "textarea":e=document.createElement("textarea");if(f)c.cols||a(e).css({width:"98%"});
+else if(!c.cols)c.cols=20;if(!c.rows)c.rows=2;if(d=="&nbsp;"||d=="&#160;"||d.length==1&&d.charCodeAt(0)==160)d="";e.value=d;j(e,c);c=h(e,c);a(e).attr({role:"textbox",multiline:"true"});break;case "checkbox":e=document.createElement("input");e.type="checkbox";if(c.value){b=c.value.split(":");if(d===b[0]){e.checked=true;e.defaultChecked=true}e.value=b[0];a(e).attr("offval",b[1])}else{b=d.toLowerCase();if(b.search(/(false|0|no|off|undefined)/i)<0&&b!==""){e.checked=true;e.defaultChecked=true;e.value=
+d}else e.value="on";a(e).attr("offval","off")}j(e,c,["value"]);c=h(e,c);a(e).attr("role","checkbox");break;case "select":e=document.createElement("select");e.setAttribute("role","select");f=[];if(c.multiple===true){b=true;e.multiple="multiple";a(e).attr("aria-multiselectable","true")}else b=false;if(typeof c.dataUrl!="undefined")a.ajax(a.extend({url:c.dataUrl,type:"GET",dataType:"html",context:{elem:e,options:c,vl:d},success:function(l){var n=[],r=this.elem,p=this.vl,o=a.extend({},this.options),s=
+o.multiple===true;if(typeof o.buildSelect!="undefined")l=o.buildSelect(l);if(l=a(l).html()){a(r).append(l);j(r,o);o=h(r,o);if(typeof o.size==="undefined")o.size=s?3:1;if(s){n=p.split(",");n=a.map(n,function(t){return a.trim(t)})}else n[0]=a.trim(p);setTimeout(function(){a("option",r).each(function(){a(this).attr("role","option");if(a.inArray(a.trim(a(this).text()),n)>-1||a.inArray(a.trim(a(this).val()),n)>-1)this.selected="selected"})},0)}}},g||{}));else if(c.value){var k;if(typeof c.size==="undefined")c.size=
+b?3:1;if(b){f=d.split(",");f=a.map(f,function(l){return a.trim(l)})}if(typeof c.value==="function")c.value=c.value();var m,i;if(typeof c.value==="string"){m=c.value.split(";");for(k=0;k<m.length;k++){i=m[k].split(":");if(i.length>2)i[1]=a.map(i,function(l,n){if(n>0)return l}).join(":");g=document.createElement("option");g.setAttribute("role","option");g.value=i[0];g.innerHTML=i[1];e.appendChild(g);if(!b&&(a.trim(i[0])==a.trim(d)||a.trim(i[1])==a.trim(d)))g.selected="selected";if(b&&(a.inArray(a.trim(i[1]),
+f)>-1||a.inArray(a.trim(i[0]),f)>-1))g.selected="selected"}}else if(typeof c.value==="object"){m=c.value;for(k in m)if(m.hasOwnProperty(k)){g=document.createElement("option");g.setAttribute("role","option");g.value=k;g.innerHTML=m[k];e.appendChild(g);if(!b&&(a.trim(k)==a.trim(d)||a.trim(m[k])==a.trim(d)))g.selected="selected";if(b&&(a.inArray(a.trim(m[k]),f)>-1||a.inArray(a.trim(k),f)>-1))g.selected="selected"}}j(e,c,["value"]);c=h(e,c)}break;case "text":case "password":case "button":k=b=="button"?
+"button":"textbox";e=document.createElement("input");e.type=b;e.value=d;j(e,c);c=h(e,c);if(b!="button")if(f)c.size||a(e).css({width:"98%"});else if(!c.size)c.size=20;a(e).attr("role",k);break;case "image":case "file":e=document.createElement("input");e.type=b;j(e,c);c=h(e,c);break;case "custom":e=document.createElement("span");try{if(a.isFunction(c.custom_element))if(m=c.custom_element.call(this,d,c)){m=a(m).addClass("customelement").attr({id:c.id,name:c.name});a(e).empty().append(m)}else throw"e2";
+else throw"e1";}catch(q){q=="e1"&&this.info_dialog(a.jgrid.errors.errcap,"function 'custom_element' "+a.jgrid.edit.msg.nodefined,a.jgrid.edit.bClose);q=="e2"?this.info_dialog(a.jgrid.errors.errcap,"function 'custom_element' "+a.jgrid.edit.msg.novalue,a.jgrid.edit.bClose):this.info_dialog(a.jgrid.errors.errcap,typeof q==="string"?q:q.message,a.jgrid.edit.bClose)}}return e},checkDate:function(b,c){var d={},f;b=b.toLowerCase();f=b.indexOf("/")!=-1?"/":b.indexOf("-")!=-1?"-":b.indexOf(".")!=-1?".":"/";
+b=b.split(f);c=c.split(f);if(c.length!=3)return false;f=-1;for(var g,h=-1,j=-1,e=0;e<b.length;e++){g=isNaN(c[e])?0:parseInt(c[e],10);d[b[e]]=g;g=b[e];if(g.indexOf("y")!=-1)f=e;if(g.indexOf("m")!=-1)j=e;if(g.indexOf("d")!=-1)h=e}g=b[f]=="y"||b[f]=="yyyy"?4:b[f]=="yy"?2:-1;e=function(m){for(var i=1;i<=m;i++){this[i]=31;if(i==4||i==6||i==9||i==11)this[i]=30;if(i==2)this[i]=29}return this}(12);var k;if(f===-1)return false;else{k=d[b[f]].toString();if(g==2&&k.length==1)g=1;if(k.length!=g||d[b[f]]===0&&
+c[f]!="00")return false}if(j===-1)return false;else{k=d[b[j]].toString();if(k.length<1||d[b[j]]<1||d[b[j]]>12)return false}if(h===-1)return false;else{k=d[b[h]].toString();if(k.length<1||d[b[h]]<1||d[b[h]]>31||d[b[j]]==2&&d[b[h]]>(d[b[f]]%4===0&&(d[b[f]]%100!==0||d[b[f]]%400===0)?29:28)||d[b[h]]>e[d[b[j]]])return false}return true},isEmpty:function(b){return b.match(/^\s+$/)||b===""?true:false},checkTime:function(b){var c=/^(\d{1,2}):(\d{2})([ap]m)?$/;if(!this.isEmpty(b))if(b=b.match(c)){if(b[3]){if(b[1]<
+1||b[1]>12)return false}else if(b[1]>23)return false;if(b[2]>59)return false}else return false;return true},checkValues:function(b,c,d,f,g){var h,j;if(typeof f==="undefined")if(typeof c=="string"){f=0;for(g=d.p.colModel.length;f<g;f++)if(d.p.colModel[f].name==c){h=d.p.colModel[f].editrules;c=f;try{j=d.p.colModel[f].formoptions.label}catch(e){}break}}else{if(c>=0)h=d.p.colModel[c].editrules}else{h=f;j=g===undefined?"_":g}if(h){j||(j=d.p.colNames[c]);if(h.required===true)if(this.isEmpty(b))return[false,
+j+": "+a.jgrid.edit.msg.required,""];f=h.required===false?false:true;if(h.number===true)if(!(f===false&&this.isEmpty(b)))if(isNaN(b))return[false,j+": "+a.jgrid.edit.msg.number,""];if(typeof h.minValue!="undefined"&&!isNaN(h.minValue))if(parseFloat(b)<parseFloat(h.minValue))return[false,j+": "+a.jgrid.edit.msg.minValue+" "+h.minValue,""];if(typeof h.maxValue!="undefined"&&!isNaN(h.maxValue))if(parseFloat(b)>parseFloat(h.maxValue))return[false,j+": "+a.jgrid.edit.msg.maxValue+" "+h.maxValue,""];if(h.email===
+true)if(!(f===false&&this.isEmpty(b))){g=/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i;
+if(!g.test(b))return[false,j+": "+a.jgrid.edit.msg.email,""]}if(h.integer===true)if(!(f===false&&this.isEmpty(b))){if(isNaN(b))return[false,j+": "+a.jgrid.edit.msg.integer,""];if(b%1!==0||b.indexOf(".")!=-1)return[false,j+": "+a.jgrid.edit.msg.integer,""]}if(h.date===true)if(!(f===false&&this.isEmpty(b))){c=d.p.colModel[c].formatoptions&&d.p.colModel[c].formatoptions.newformat?d.p.colModel[c].formatoptions.newformat:d.p.colModel[c].datefmt||"Y-m-d";if(!this.checkDate(c,b))return[false,j+": "+a.jgrid.edit.msg.date+
+" - "+c,""]}if(h.time===true)if(!(f===false&&this.isEmpty(b)))if(!this.checkTime(b))return[false,j+": "+a.jgrid.edit.msg.date+" - hh:mm (am/pm)",""];if(h.url===true)if(!(f===false&&this.isEmpty(b))){g=/^(((https?)|(ftp)):\/\/([\-\w]+\.)+\w{2,3}(\/[%\-\w]+(\.\w{2,})?)*(([\w\-\.\?\\\/+@&#;`~=%!]*)(\.\w{2,})?)*\/?)/i;if(!g.test(b))return[false,j+": "+a.jgrid.edit.msg.url,""]}if(h.custom===true)if(!(f===false&&this.isEmpty(b)))if(a.isFunction(h.custom_func)){b=h.custom_func.call(d,b,j);return a.isArray(b)?
+b:[false,a.jgrid.edit.msg.customarray,""]}else return[false,a.jgrid.edit.msg.customfcheck,""]}return[true,"",""]}})})(jQuery);
+(function(a){var d={};a.jgrid.extend({searchGrid:function(f){f=a.extend({recreateFilter:false,drag:true,sField:"searchField",sValue:"searchString",sOper:"searchOper",sFilter:"filters",loadDefaults:true,beforeShowSearch:null,afterShowSearch:null,onInitializeSearch:null,afterRedraw:null,closeAfterSearch:false,closeAfterReset:false,closeOnEscape:false,multipleSearch:false,multipleGroup:false,top:0,left:0,jqModal:true,modal:false,resize:true,width:450,height:"auto",dataheight:"auto",showQuery:false,errorcheck:true,
+sopt:null,stringResult:undefined,onClose:null,onSearch:null,onReset:null,toTop:true,overlay:30,columns:[],tmplNames:null,tmplFilters:null,tmplLabel:" Template: ",showOnLoad:false,layer:null},a.jgrid.search,f||{});return this.each(function(){function b(){if(a.isFunction(f.beforeShowSearch)){x=f.beforeShowSearch(a("#"+r));if(typeof x==="undefined")x=true}if(x){a.jgrid.viewModal("#"+D.themodal,{gbox:"#gbox_"+r,jqm:f.jqModal,modal:f.modal,overlay:f.overlay,toTop:f.toTop});a.isFunction(f.afterShowSearch)&&
+f.afterShowSearch(a("#"+r))}}var e=this;if(e.grid){var r="fbox_"+e.p.id,x=true,D={themodal:"searchmod"+r,modalhead:"searchhd"+r,modalcontent:"searchcnt"+r,scrollelm:r},F=e.p.postData[f.sFilter];if(typeof F==="string")F=a.jgrid.parse(F);f.recreateFilter===true&&a("#"+D.themodal).remove();if(a("#"+D.themodal).html()!==null)b();else{var y=a("<div><div id='"+r+"' class='searchFilter' style='overflow:auto'></div></div>").insertBefore("#gview_"+e.p.id),o="left",k="";if(e.p.direction=="rtl"){o="right";k=
+" style='text-align:left'";y.attr("dir","rtl")}if(a.isFunction(f.onInitializeSearch))f.onInitializeSearch(a("#"+r));var s=a.extend([],e.p.colModel),N="<a href='javascript:void(0)' id='"+r+"_search' class='fm-button ui-state-default ui-corner-all fm-button-icon-right ui-reset'><span class='ui-icon ui-icon-search'></span>"+f.Find+"</a>",c="<a href='javascript:void(0)' id='"+r+"_reset' class='fm-button ui-state-default ui-corner-all fm-button-icon-left ui-search'><span class='ui-icon ui-icon-arrowreturnthick-1-w'></span>"+
+f.Reset+"</a>",t="",p="",j,n=false,G=-1;if(f.showQuery)t="<a href='javascript:void(0)' id='"+r+"_query' class='fm-button ui-state-default ui-corner-all fm-button-icon-left'><span class='ui-icon ui-icon-comment'></span>Query</a>";if(f.columns.length)s=f.columns;else a.each(s,function(u,E){if(!E.label)E.label=e.p.colNames[u];if(!n){var B=typeof E.search==="undefined"?true:E.search,m=E.hidden===true;if(E.searchoptions&&E.searchoptions.searchhidden===true&&B||B&&!m){n=true;j=E.index||E.name;G=u}}});if(!F&&
+j||f.multipleSearch===false){var J="eq";if(G>=0&&s[G].searchoptions&&s[G].searchoptions.sopt)J=s[G].searchoptions.sopt[0];else if(f.sopt&&f.sopt.length)J=f.sopt[0];F={groupOp:"AND",rules:[{field:j,op:J,data:""}]}}n=false;if(f.tmplNames&&f.tmplNames.length){n=true;p=f.tmplLabel;p+="<select class='ui-template'>";p+="<option value='default'>Default</option>";a.each(f.tmplNames,function(u,E){p+="<option value='"+u+"'>"+E+"</option>"});p+="</select>"}o="<table class='EditTable' style='border:0px none;margin-top:5px' id='"+
+r+"_2'><tbody><tr><td colspan='2'><hr class='ui-widget-content' style='margin:1px'/></td></tr><tr><td class='EditButton' style='text-align:"+o+"'>"+c+p+"</td><td class='EditButton' "+k+">"+t+N+"</td></tr></tbody></table>";a("#"+r).jqFilter({columns:s,filter:f.loadDefaults?F:null,showQuery:f.showQuery,errorcheck:f.errorcheck,sopt:f.sopt,groupButton:f.multipleGroup,ruleButtons:f.multipleSearch,afterRedraw:f.afterRedraw,_gridsopt:a.jgrid.search.odata,onChange:function(){this.p.showQuery&&a(".query",
+this).html(this.toUserFriendlyString())},direction:e.p.direction});y.append(o);n&&f.tmplFilters&&f.tmplFilters.length&&a(".ui-template",y).bind("change",function(){var u=a(this).val();u=="default"?a("#"+r).jqFilter("addFilter",F):a("#"+r).jqFilter("addFilter",f.tmplFilters[parseInt(u,10)]);return false});if(f.multipleGroup===true)f.multipleSearch=true;if(a.isFunction(f.onInitializeSearch))f.onInitializeSearch(a("#"+r));f.gbox="#gbox_"+r;f.layer?a.jgrid.createModal(D,y,f,"#gview_"+e.p.id,a("#gbox_"+
+e.p.id)[0],"#"+f.layer,{position:"relative"}):a.jgrid.createModal(D,y,f,"#gview_"+e.p.id,a("#gbox_"+e.p.id)[0]);t&&a("#"+r+"_query").bind("click",function(){a(".queryresult",y).toggle();return false});if(f.stringResult===undefined)f.stringResult=f.multipleSearch;a("#"+r+"_search").bind("click",function(){var u=a("#"+r),E={},B,m=u.jqFilter("filterData");if(f.errorcheck){u[0].hideError();f.showQuery||u.jqFilter("toSQLString");if(u[0].p.error){u[0].showError();return false}}if(f.stringResult){try{B=
+xmlJsonClass.toJson(m,"","",false)}catch(z){try{B=JSON.stringify(m)}catch(h){}}if(typeof B==="string"){E[f.sFilter]=B;a.each([f.sField,f.sValue,f.sOper],function(){E[this]=""})}}else if(f.multipleSearch){E[f.sFilter]=m;a.each([f.sField,f.sValue,f.sOper],function(){E[this]=""})}else{E[f.sField]=m.rules[0].field;E[f.sValue]=m.rules[0].data;E[f.sOper]=m.rules[0].op;E[f.sFilter]=""}e.p.search=true;a.extend(e.p.postData,E);if(a.isFunction(f.onSearch))f.onSearch();a(e).trigger("reloadGrid",[{page:1}]);
+f.closeAfterSearch&&a.jgrid.hideModal("#"+D.themodal,{gb:"#gbox_"+e.p.id,jqm:f.jqModal,onClose:f.onClose});return false});a("#"+r+"_reset").bind("click",function(){var u={},E=a("#"+r);e.p.search=false;if(f.multipleSearch===false)u[f.sField]=u[f.sValue]=u[f.sOper]="";else u[f.sFilter]="";E[0].resetFilter();n&&a(".ui-template",y).val("default");a.extend(e.p.postData,u);if(a.isFunction(f.onReset))f.onReset();a(e).trigger("reloadGrid",[{page:1}]);return false});b();a(".fm-button:not(.ui-state-disabled)",
+y).hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")})}}})},editGridRow:function(f,b){b=a.extend({top:0,left:0,width:300,height:"auto",dataheight:"auto",modal:false,overlay:30,drag:true,resize:true,url:null,mtype:"POST",clearAfterAdd:true,closeAfterEdit:false,reloadAfterSubmit:true,onInitializeForm:null,beforeInitData:null,beforeShowForm:null,afterShowForm:null,beforeSubmit:null,afterSubmit:null,onclickSubmit:null,afterComplete:null,onclickPgButtons:null,
+afterclickPgButtons:null,editData:{},recreateForm:false,jqModal:true,closeOnEscape:false,addedrow:"first",topinfo:"",bottominfo:"",saveicon:[],closeicon:[],savekey:[false,13],navkeys:[false,38,40],checkOnSubmit:false,checkOnUpdate:false,_savedData:{},processing:false,onClose:null,ajaxEditOptions:{},serializeEditData:null,viewPagerButtons:true},a.jgrid.edit,b||{});d[a(this)[0].p.id]=b;return this.each(function(){function e(){a("#"+j+" > tbody > tr > td > .FormElement").each(function(){var g=a(".customelement",
+this);if(g.length){var l=a(g[0]).attr("name");a.each(c.p.colModel,function(){if(this.name===l&&this.editoptions&&a.isFunction(this.editoptions.custom_value)){try{h[l]=this.editoptions.custom_value(a("#"+a.jgrid.jqID(l),"#"+j),"get");if(h[l]===undefined)throw"e1";}catch(q){q==="e1"?a.jgrid.info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+a.jgrid.edit.msg.novalue,jQuery.jgrid.edit.bClose):a.jgrid.info_dialog(jQuery.jgrid.errors.errcap,q.message,jQuery.jgrid.edit.bClose)}return true}})}else{switch(a(this).get(0).type){case "checkbox":if(a(this).is(":checked"))h[this.name]=
+a(this).val();else{g=a(this).attr("offval");h[this.name]=g}break;case "select-one":h[this.name]=a("option:selected",this).val();P[this.name]=a("option:selected",this).text();break;case "select-multiple":h[this.name]=a(this).val();h[this.name]=h[this.name]?h[this.name].join(","):"";var w=[];a("option:selected",this).each(function(q,H){w[q]=a(H).text()});P[this.name]=w.join(",");break;case "password":case "text":case "textarea":case "button":h[this.name]=a(this).val()}if(c.p.autoencode)h[this.name]=
+a.jgrid.htmlEncode(h[this.name])}});return true}function r(g,l,w,q){var H,C,v,K=0,A,Q,I,U=[],M=false,aa="",S;for(S=1;S<=q;S++)aa+="<td class='CaptionTD'>&#160;</td><td class='DataTD'>&#160;</td>";if(g!="_empty")M=a(l).jqGrid("getInd",g);a(l.p.colModel).each(function(T){H=this.name;Q=(C=this.editrules&&this.editrules.edithidden===true?false:this.hidden===true?true:false)?"style='display:none'":"";if(H!=="cb"&&H!=="subgrid"&&this.editable===true&&H!=="rn"){if(M===false)A="";else if(H==l.p.ExpandColumn&&
+l.p.treeGrid===true)A=a("td:eq("+T+")",l.rows[M]).text();else{try{A=a.unformat(a("td:eq("+T+")",l.rows[M]),{rowId:g,colModel:this},T)}catch(ga){A=this.edittype&&this.edittype=="textarea"?a("td:eq("+T+")",l.rows[M]).text():a("td:eq("+T+")",l.rows[M]).html()}if(!A||A=="&nbsp;"||A=="&#160;"||A.length==1&&A.charCodeAt(0)==160)A=""}var Y=a.extend({},this.editoptions||{},{id:H,name:H}),Z=a.extend({},{elmprefix:"",elmsuffix:"",rowabove:false,rowcontent:""},this.formoptions||{}),ea=parseInt(Z.rowpos,10)||
+K+1,ha=parseInt((parseInt(Z.colpos,10)||1)*2,10);if(g=="_empty"&&Y.defaultValue)A=a.isFunction(Y.defaultValue)?Y.defaultValue():Y.defaultValue;if(!this.edittype)this.edittype="text";if(c.p.autoencode)A=a.jgrid.htmlDecode(A);I=a.jgrid.createEl(this.edittype,Y,A,false,a.extend({},a.jgrid.ajaxOptions,l.p.ajaxSelectOptions||{}));if(A===""&&this.edittype=="checkbox")A=a(I).attr("offval");if(A===""&&this.edittype=="select")A=a("option:eq(0)",I).text();if(d[c.p.id].checkOnSubmit||d[c.p.id].checkOnUpdate)d[c.p.id]._savedData[H]=
+A;a(I).addClass("FormElement");if(this.edittype=="text"||this.edittype=="textarea")a(I).addClass("ui-widget-content ui-corner-all");v=a(w).find("tr[rowpos="+ea+"]");if(Z.rowabove){Y=a("<tr><td class='contentinfo' colspan='"+q*2+"'>"+Z.rowcontent+"</td></tr>");a(w).append(Y);Y[0].rp=ea}if(v.length===0){v=a("<tr "+Q+" rowpos='"+ea+"'></tr>").addClass("FormData").attr("id","tr_"+H);a(v).append(aa);a(w).append(v);v[0].rp=ea}a("td:eq("+(ha-2)+")",v[0]).html(typeof Z.label==="undefined"?l.p.colNames[T]:
+Z.label);a("td:eq("+(ha-1)+")",v[0]).append(Z.elmprefix).append(I).append(Z.elmsuffix);U[K]=T;K++}});if(K>0){S=a("<tr class='FormData' style='display:none'><td class='CaptionTD'></td><td colspan='"+(q*2-1)+"' class='DataTD'><input class='FormElement' id='id_g' type='text' name='"+l.p.id+"_id' value='"+g+"'/></td></tr>");S[0].rp=K+999;a(w).append(S);if(d[c.p.id].checkOnSubmit||d[c.p.id].checkOnUpdate)d[c.p.id]._savedData[l.p.id+"_id"]=g}return U}function x(g,l,w){var q,H=0,C,v,K,A,Q;if(d[c.p.id].checkOnSubmit||
+d[c.p.id].checkOnUpdate){d[c.p.id]._savedData={};d[c.p.id]._savedData[l.p.id+"_id"]=g}var I=l.p.colModel;if(g=="_empty"){a(I).each(function(){q=this.name;K=a.extend({},this.editoptions||{});if((v=a("#"+a.jgrid.jqID(q),"#"+w))&&v.length&&v[0]!==null){A="";if(K.defaultValue){A=a.isFunction(K.defaultValue)?K.defaultValue():K.defaultValue;if(v[0].type=="checkbox"){Q=A.toLowerCase();if(Q.search(/(false|0|no|off|undefined)/i)<0&&Q!==""){v[0].checked=true;v[0].defaultChecked=true;v[0].value=A}else{v[0].checked=
+false;v[0].defaultChecked=false}}else v.val(A)}else if(v[0].type=="checkbox"){v[0].checked=false;v[0].defaultChecked=false;A=a(v).attr("offval")}else if(v[0].type&&v[0].type.substr(0,6)=="select")v[0].selectedIndex=0;else v.val(A);if(d[c.p.id].checkOnSubmit===true||d[c.p.id].checkOnUpdate)d[c.p.id]._savedData[q]=A}});a("#id_g","#"+w).val(g)}else{var U=a(l).jqGrid("getInd",g,true);if(U){a("td",U).each(function(M){q=I[M].name;if(q!=="cb"&&q!=="subgrid"&&q!=="rn"&&I[M].editable===true){if(q==l.p.ExpandColumn&&
+l.p.treeGrid===true)C=a(this).text();else try{C=a.unformat(a(this),{rowId:g,colModel:I[M]},M)}catch(aa){C=I[M].edittype=="textarea"?a(this).text():a(this).html()}if(c.p.autoencode)C=a.jgrid.htmlDecode(C);if(d[c.p.id].checkOnSubmit===true||d[c.p.id].checkOnUpdate)d[c.p.id]._savedData[q]=C;q=a.jgrid.jqID(q);switch(I[M].edittype){case "password":case "text":case "button":case "image":case "textarea":if(C=="&nbsp;"||C=="&#160;"||C.length==1&&C.charCodeAt(0)==160)C="";a("#"+q,"#"+w).val(C);break;case "select":var S=
+C.split(",");S=a.map(S,function(ga){return a.trim(ga)});a("#"+q+" option","#"+w).each(function(){this.selected=!I[M].editoptions.multiple&&(a.trim(C)==a.trim(a(this).text())||S[0]==a.trim(a(this).text())||S[0]==a.trim(a(this).val()))?true:I[M].editoptions.multiple?a.inArray(a.trim(a(this).text()),S)>-1||a.inArray(a.trim(a(this).val()),S)>-1?true:false:false});break;case "checkbox":C+="";if(I[M].editoptions&&I[M].editoptions.value)if(I[M].editoptions.value.split(":")[0]==C){a("#"+q,"#"+w)[c.p.useProp?
+"prop":"attr"]("checked",true);a("#"+q,"#"+w)[c.p.useProp?"prop":"attr"]("defaultChecked",true)}else{a("#"+q,"#"+w)[c.p.useProp?"prop":"attr"]("checked",false);a("#"+q,"#"+w)[c.p.useProp?"prop":"attr"]("defaultChecked",false)}else{C=C.toLowerCase();if(C.search(/(false|0|no|off|undefined)/i)<0&&C!==""){a("#"+q,"#"+w)[c.p.useProp?"prop":"attr"]("checked",true);a("#"+q,"#"+w)[c.p.useProp?"prop":"attr"]("defaultChecked",true)}else{a("#"+q,"#"+w)[c.p.useProp?"prop":"attr"]("checked",false);a("#"+q,"#"+
+w)[c.p.useProp?"prop":"attr"]("defaultChecked",false)}}break;case "custom":try{if(I[M].editoptions&&a.isFunction(I[M].editoptions.custom_value))I[M].editoptions.custom_value(a("#"+q,"#"+w),"set",C);else throw"e1";}catch(T){T=="e1"?a.jgrid.info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+a.jgrid.edit.msg.nodefined,jQuery.jgrid.edit.bClose):a.jgrid.info_dialog(jQuery.jgrid.errors.errcap,T.message,jQuery.jgrid.edit.bClose)}}H++}});H>0&&a("#id_g","#"+j).val(g)}}}function D(){var g,l=
+[true,"",""],w={},q=c.p.prmNames,H,C,v,K;if(a.isFunction(d[c.p.id].beforeCheckValues)){var A=d[c.p.id].beforeCheckValues(h,a("#"+p),h[c.p.id+"_id"]=="_empty"?q.addoper:q.editoper);if(A&&typeof A==="object")h=A}for(v in h)if(h.hasOwnProperty(v)){l=a.jgrid.checkValues(h[v],v,c);if(l[0]===false)break}y();if(l[0]){if(a.isFunction(d[c.p.id].onclickSubmit))w=d[c.p.id].onclickSubmit(d[c.p.id],h)||{};if(a.isFunction(d[c.p.id].beforeSubmit))l=d[c.p.id].beforeSubmit(h,a("#"+p))}if(l[0]&&!d[c.p.id].processing){d[c.p.id].processing=
+true;a("#sData","#"+j+"_2").addClass("ui-state-active");C=q.oper;H=q.id;h[C]=a.trim(h[c.p.id+"_id"])=="_empty"?q.addoper:q.editoper;if(h[C]!=q.addoper)h[H]=h[c.p.id+"_id"];else if(h[H]===undefined)h[H]=h[c.p.id+"_id"];delete h[c.p.id+"_id"];h=a.extend(h,d[c.p.id].editData,w);if(c.p.treeGrid===true){if(h[C]==q.addoper){K=a(c).jqGrid("getGridParam","selrow");h[c.p.treeGridModel=="adjacency"?c.p.treeReader.parent_id_field:"parent_id"]=K}for(i in c.p.treeReader){w=c.p.treeReader[i];if(h.hasOwnProperty(w))h[C]==
+q.addoper&&i==="parent_id_field"||delete h[w]}}h[H]=a.jgrid.stripPref(c.p.idPrefix,h[H]);w=a.extend({url:d[c.p.id].url?d[c.p.id].url:a(c).jqGrid("getGridParam","editurl"),type:d[c.p.id].mtype,data:a.isFunction(d[c.p.id].serializeEditData)?d[c.p.id].serializeEditData(h):h,complete:function(Q,I){h[H]=c.p.idPrefix+h[H];if(I!="success"){l[0]=false;l[1]=a.isFunction(d[c.p.id].errorTextFormat)?d[c.p.id].errorTextFormat(Q):I+" Status: '"+Q.statusText+"'. Error code: "+Q.status}else if(a.isFunction(d[c.p.id].afterSubmit))l=
+d[c.p.id].afterSubmit(Q,h);if(l[0]===false){a("#FormError>td","#"+j).html(l[1]);a("#FormError","#"+j).show()}else{a.each(c.p.colModel,function(){if(P[this.name]&&this.formatter&&this.formatter=="select")try{delete P[this.name]}catch(aa){}});h=a.extend(h,P);c.p.autoencode&&a.each(h,function(aa,S){h[aa]=a.jgrid.htmlDecode(S)});if(h[C]==q.addoper){l[2]||(l[2]=a.jgrid.randId());h[H]=l[2];if(d[c.p.id].closeAfterAdd){if(d[c.p.id].reloadAfterSubmit)a(c).trigger("reloadGrid");else if(c.p.treeGrid===true)a(c).jqGrid("addChildNode",
+l[2],K,h);else{a(c).jqGrid("addRowData",l[2],h,b.addedrow);a(c).jqGrid("setSelection",l[2])}a.jgrid.hideModal("#"+n.themodal,{gb:"#gbox_"+t,jqm:b.jqModal,onClose:d[c.p.id].onClose})}else if(d[c.p.id].clearAfterAdd){if(d[c.p.id].reloadAfterSubmit)a(c).trigger("reloadGrid");else c.p.treeGrid===true?a(c).jqGrid("addChildNode",l[2],K,h):a(c).jqGrid("addRowData",l[2],h,b.addedrow);x("_empty",c,p)}else if(d[c.p.id].reloadAfterSubmit)a(c).trigger("reloadGrid");else c.p.treeGrid===true?a(c).jqGrid("addChildNode",
+l[2],K,h):a(c).jqGrid("addRowData",l[2],h,b.addedrow)}else{if(d[c.p.id].reloadAfterSubmit){a(c).trigger("reloadGrid");d[c.p.id].closeAfterEdit||setTimeout(function(){a(c).jqGrid("setSelection",h[H])},1E3)}else c.p.treeGrid===true?a(c).jqGrid("setTreeRow",h[H],h):a(c).jqGrid("setRowData",h[H],h);d[c.p.id].closeAfterEdit&&a.jgrid.hideModal("#"+n.themodal,{gb:"#gbox_"+t,jqm:b.jqModal,onClose:d[c.p.id].onClose})}if(a.isFunction(d[c.p.id].afterComplete)){g=Q;setTimeout(function(){d[c.p.id].afterComplete(g,
+h,a("#"+p));g=null},500)}if(d[c.p.id].checkOnSubmit||d[c.p.id].checkOnUpdate){a("#"+p).data("disabled",false);if(d[c.p.id]._savedData[c.p.id+"_id"]!="_empty")for(var U in d[c.p.id]._savedData)if(h[U])d[c.p.id]._savedData[U]=h[U]}}d[c.p.id].processing=false;a("#sData","#"+j+"_2").removeClass("ui-state-active");try{a(":input:visible","#"+p)[0].focus()}catch(M){}}},a.jgrid.ajaxOptions,d[c.p.id].ajaxEditOptions);if(!w.url&&!d[c.p.id].useDataProxy)if(a.isFunction(c.p.dataProxy))d[c.p.id].useDataProxy=
+true;else{l[0]=false;l[1]+=" "+a.jgrid.errors.nourl}if(l[0])if(d[c.p.id].useDataProxy){v=c.p.dataProxy.call(c,w,"set_"+c.p.id);if(typeof v=="undefined")v=[true,""];if(v[0]===false){l[0]=false;l[1]=v[1]||"Error deleting the selected row!"}else{w.data.oper==q.addoper&&d[c.p.id].closeAfterAdd&&a.jgrid.hideModal("#"+n.themodal,{gb:"#gbox_"+t,jqm:b.jqModal,onClose:d[c.p.id].onClose});w.data.oper==q.editoper&&d[c.p.id].closeAfterEdit&&a.jgrid.hideModal("#"+n.themodal,{gb:"#gbox_"+t,jqm:b.jqModal,onClose:d[c.p.id].onClose})}}else a.ajax(w)}if(l[0]===
+false){a("#FormError>td","#"+j).html(l[1]);a("#FormError","#"+j).show()}}function F(g,l){var w=false,q;for(q in g)if(g[q]!=l[q]){w=true;break}return w}function y(){a.each(c.p.colModel,function(g,l){if(l.editoptions&&l.editoptions.NullIfEmpty===true)if(h.hasOwnProperty(l.name)&&h[l.name]=="")h[l.name]="null"})}function o(){var g=true;a("#FormError","#"+j).hide();if(d[c.p.id].checkOnUpdate){h={};P={};e();O=a.extend({},h,P);if(V=F(O,d[c.p.id]._savedData)){a("#"+p).data("disabled",true);a(".confirm",
+"#"+n.themodal).show();g=false}}return g}function k(){if(f!=="_empty"&&typeof c.p.savedRow!=="undefined"&&c.p.savedRow.length>0&&a.isFunction(a.fn.jqGrid.restoreRow))for(var g=0;g<c.p.savedRow.length;g++)if(c.p.savedRow[g].id==f){a(c).jqGrid("restoreRow",f);break}}function s(g,l){g===0?a("#pData","#"+j+"_2").addClass("ui-state-disabled"):a("#pData","#"+j+"_2").removeClass("ui-state-disabled");g==l?a("#nData","#"+j+"_2").addClass("ui-state-disabled"):a("#nData","#"+j+"_2").removeClass("ui-state-disabled")}
+function N(){var g=a(c).jqGrid("getDataIDs"),l=a("#id_g","#"+j).val();return[a.inArray(l,g),g]}var c=this;if(c.grid&&f){var t=c.p.id,p="FrmGrid_"+t,j="TblGrid_"+t,n={themodal:"editmod"+t,modalhead:"edithd"+t,modalcontent:"editcnt"+t,scrollelm:p},G=a.isFunction(d[c.p.id].beforeShowForm)?d[c.p.id].beforeShowForm:false,J=a.isFunction(d[c.p.id].afterShowForm)?d[c.p.id].afterShowForm:false,u=a.isFunction(d[c.p.id].beforeInitData)?d[c.p.id].beforeInitData:false,E=a.isFunction(d[c.p.id].onInitializeForm)?
+d[c.p.id].onInitializeForm:false,B=true,m=1,z=0,h,P,O,V;if(f==="new"){f="_empty";b.caption=d[c.p.id].addCaption}else b.caption=d[c.p.id].editCaption;b.recreateForm===true&&a("#"+n.themodal).html()!==null&&a("#"+n.themodal).remove();var R=true;if(b.checkOnUpdate&&b.jqModal&&!b.modal)R=false;if(a("#"+n.themodal).html()!==null){if(u){B=u(a("#"+p));if(typeof B=="undefined")B=true}if(B===false)return;k();a(".ui-jqdialog-title","#"+n.modalhead).html(b.caption);a("#FormError","#"+j).hide();if(d[c.p.id].topinfo){a(".topinfo",
+"#"+j).html(d[c.p.id].topinfo);a(".tinfo","#"+j).show()}else a(".tinfo","#"+j).hide();if(d[c.p.id].bottominfo){a(".bottominfo","#"+j+"_2").html(d[c.p.id].bottominfo);a(".binfo","#"+j+"_2").show()}else a(".binfo","#"+j+"_2").hide();x(f,c,p);f=="_empty"||!d[c.p.id].viewPagerButtons?a("#pData, #nData","#"+j+"_2").hide():a("#pData, #nData","#"+j+"_2").show();if(d[c.p.id].processing===true){d[c.p.id].processing=false;a("#sData","#"+j+"_2").removeClass("ui-state-active")}if(a("#"+p).data("disabled")===
+true){a(".confirm","#"+n.themodal).hide();a("#"+p).data("disabled",false)}G&&G(a("#"+p));a("#"+n.themodal).data("onClose",d[c.p.id].onClose);a.jgrid.viewModal("#"+n.themodal,{gbox:"#gbox_"+t,jqm:b.jqModal,jqM:false,overlay:b.overlay,modal:b.modal});R||a(".jqmOverlay").click(function(){if(!o())return false;a.jgrid.hideModal("#"+n.themodal,{gb:"#gbox_"+t,jqm:b.jqModal,onClose:d[c.p.id].onClose});return false});J&&J(a("#"+p))}else{var L=isNaN(b.dataheight)?b.dataheight:b.dataheight+"px";L=a("<form name='FormPost' id='"+
+p+"' class='FormGrid' onSubmit='return false;' style='width:100%;overflow:auto;position:relative;height:"+L+";'></form>").data("disabled",false);var W=a("<table id='"+j+"' class='EditTable' cellspacing='0' cellpadding='0' border='0'><tbody></tbody></table>");if(u){B=u(a("#"+p));if(typeof B=="undefined")B=true}if(B===false)return;k();a(c.p.colModel).each(function(){var g=this.formoptions;m=Math.max(m,g?g.colpos||0:0);z=Math.max(z,g?g.rowpos||0:0)});a(L).append(W);u=a("<tr id='FormError' style='display:none'><td class='ui-state-error' colspan='"+
+m*2+"'></td></tr>");u[0].rp=0;a(W).append(u);u=a("<tr style='display:none' class='tinfo'><td class='topinfo' colspan='"+m*2+"'>"+d[c.p.id].topinfo+"</td></tr>");u[0].rp=0;a(W).append(u);B=(u=c.p.direction=="rtl"?true:false)?"nData":"pData";var X=u?"pData":"nData";r(f,c,W,m);B="<a href='javascript:void(0)' id='"+B+"' class='fm-button ui-state-default ui-corner-left'><span class='ui-icon ui-icon-triangle-1-w'></span></a>";X="<a href='javascript:void(0)' id='"+X+"' class='fm-button ui-state-default ui-corner-right'><span class='ui-icon ui-icon-triangle-1-e'></span></a>";
+var ba="<a href='javascript:void(0)' id='sData' class='fm-button ui-state-default ui-corner-all'>"+b.bSubmit+"</a>",$="<a href='javascript:void(0)' id='cData' class='fm-button ui-state-default ui-corner-all'>"+b.bCancel+"</a>";B="<table border='0' cellspacing='0' cellpadding='0' class='EditTable' id='"+j+"_2'><tbody><tr><td colspan='2'><hr class='ui-widget-content' style='margin:1px'/></td></tr><tr id='Act_Buttons'><td class='navButton'>"+(u?X+B:B+X)+"</td><td class='EditButton'>"+ba+$+"</td></tr>";
+B+="<tr style='display:none' class='binfo'><td class='bottominfo' colspan='2'>"+d[c.p.id].bottominfo+"</td></tr>";B+="</tbody></table>";if(z>0){var ca=[],da={};a.each(a(W)[0].rows,function(g,l){ca[g]=l});ca.sort(function(g,l){if(g.rp>l.rp)return 1;if(g.rp<l.rp)return-1;return 0});a.each(ca,function(g,l){da.html+=l});a("tbody",W).append(da.html)}b.gbox="#gbox_"+t;var fa=false;if(b.closeOnEscape===true){b.closeOnEscape=false;fa=true}L=a("<span></span>").append(L).append(B);a.jgrid.createModal(n,L,b,
+"#gview_"+c.p.id,a("#gbox_"+c.p.id)[0]);if(u){a("#pData, #nData","#"+j+"_2").css("float","right");a(".EditButton","#"+j+"_2").css("text-align","left")}d[c.p.id].topinfo&&a(".tinfo","#"+j).show();d[c.p.id].bottominfo&&a(".binfo","#"+j+"_2").show();B=L=null;a("#"+n.themodal).keydown(function(g){var l=g.target;if(a("#"+p).data("disabled")===true)return false;if(d[c.p.id].savekey[0]===true&&g.which==d[c.p.id].savekey[1])if(l.tagName!="TEXTAREA"){a("#sData","#"+j+"_2").trigger("click");return false}if(g.which===
+27){if(!o())return false;fa&&a.jgrid.hideModal(this,{gb:b.gbox,jqm:b.jqModal,onClose:d[c.p.id].onClose});return false}if(d[c.p.id].navkeys[0]===true){if(a("#id_g","#"+j).val()=="_empty")return true;if(g.which==d[c.p.id].navkeys[1]){a("#pData","#"+j+"_2").trigger("click");return false}if(g.which==d[c.p.id].navkeys[2]){a("#nData","#"+j+"_2").trigger("click");return false}}});if(b.checkOnUpdate){a("a.ui-jqdialog-titlebar-close span","#"+n.themodal).removeClass("jqmClose");a("a.ui-jqdialog-titlebar-close",
+"#"+n.themodal).unbind("click").click(function(){if(!o())return false;a.jgrid.hideModal("#"+n.themodal,{gb:"#gbox_"+t,jqm:b.jqModal,onClose:d[c.p.id].onClose});return false})}b.saveicon=a.extend([true,"left","ui-icon-disk"],b.saveicon);b.closeicon=a.extend([true,"left","ui-icon-close"],b.closeicon);if(b.saveicon[0]===true)a("#sData","#"+j+"_2").addClass(b.saveicon[1]=="right"?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon "+b.saveicon[2]+"'></span>");if(b.closeicon[0]===
+true)a("#cData","#"+j+"_2").addClass(b.closeicon[1]=="right"?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon "+b.closeicon[2]+"'></span>");if(d[c.p.id].checkOnSubmit||d[c.p.id].checkOnUpdate){ba="<a href='javascript:void(0)' id='sNew' class='fm-button ui-state-default ui-corner-all' style='z-index:1002'>"+b.bYes+"</a>";X="<a href='javascript:void(0)' id='nNew' class='fm-button ui-state-default ui-corner-all' style='z-index:1002'>"+b.bNo+"</a>";$="<a href='javascript:void(0)' id='cNew' class='fm-button ui-state-default ui-corner-all' style='z-index:1002'>"+
+b.bExit+"</a>";L=b.zIndex||999;L++;a("<div class='ui-widget-overlay jqgrid-overlay confirm' style='z-index:"+L+";display:none;'>&#160;"+(a.browser.msie&&a.browser.version==6?'<iframe style="display:block;position:absolute;z-index:-1;filter:Alpha(Opacity=\'0\');" src="javascript:false;"></iframe>':"")+"</div><div class='confirm ui-widget-content ui-jqconfirm' style='z-index:"+(L+1)+"'>"+b.saveData+"<br/><br/>"+ba+X+$+"</div>").insertAfter("#"+p);a("#sNew","#"+n.themodal).click(function(){D();a("#"+
+p).data("disabled",false);a(".confirm","#"+n.themodal).hide();return false});a("#nNew","#"+n.themodal).click(function(){a(".confirm","#"+n.themodal).hide();a("#"+p).data("disabled",false);setTimeout(function(){a(":input","#"+p)[0].focus()},0);return false});a("#cNew","#"+n.themodal).click(function(){a(".confirm","#"+n.themodal).hide();a("#"+p).data("disabled",false);a.jgrid.hideModal("#"+n.themodal,{gb:"#gbox_"+t,jqm:b.jqModal,onClose:d[c.p.id].onClose});return false})}E&&E(a("#"+p));f=="_empty"||
+!d[c.p.id].viewPagerButtons?a("#pData,#nData","#"+j+"_2").hide():a("#pData,#nData","#"+j+"_2").show();G&&G(a("#"+p));a("#"+n.themodal).data("onClose",d[c.p.id].onClose);a.jgrid.viewModal("#"+n.themodal,{gbox:"#gbox_"+t,jqm:b.jqModal,overlay:b.overlay,modal:b.modal});R||a(".jqmOverlay").click(function(){if(!o())return false;a.jgrid.hideModal("#"+n.themodal,{gb:"#gbox_"+t,jqm:b.jqModal,onClose:d[c.p.id].onClose});return false});J&&J(a("#"+p));a(".fm-button","#"+n.themodal).hover(function(){a(this).addClass("ui-state-hover")},
+function(){a(this).removeClass("ui-state-hover")});a("#sData","#"+j+"_2").click(function(){h={};P={};a("#FormError","#"+j).hide();e();if(h[c.p.id+"_id"]=="_empty")D();else if(b.checkOnSubmit===true){O=a.extend({},h,P);if(V=F(O,d[c.p.id]._savedData)){a("#"+p).data("disabled",true);a(".confirm","#"+n.themodal).show()}else D()}else D();return false});a("#cData","#"+j+"_2").click(function(){if(!o())return false;a.jgrid.hideModal("#"+n.themodal,{gb:"#gbox_"+t,jqm:b.jqModal,onClose:d[c.p.id].onClose});
+return false});a("#nData","#"+j+"_2").click(function(){if(!o())return false;a("#FormError","#"+j).hide();var g=N();g[0]=parseInt(g[0],10);if(g[0]!=-1&&g[1][g[0]+1]){if(a.isFunction(b.onclickPgButtons))b.onclickPgButtons("next",a("#"+p),g[1][g[0]]);x(g[1][g[0]+1],c,p);a(c).jqGrid("setSelection",g[1][g[0]+1]);a.isFunction(b.afterclickPgButtons)&&b.afterclickPgButtons("next",a("#"+p),g[1][g[0]+1]);s(g[0]+1,g[1].length-1)}return false});a("#pData","#"+j+"_2").click(function(){if(!o())return false;a("#FormError",
+"#"+j).hide();var g=N();if(g[0]!=-1&&g[1][g[0]-1]){if(a.isFunction(b.onclickPgButtons))b.onclickPgButtons("prev",a("#"+p),g[1][g[0]]);x(g[1][g[0]-1],c,p);a(c).jqGrid("setSelection",g[1][g[0]-1]);a.isFunction(b.afterclickPgButtons)&&b.afterclickPgButtons("prev",a("#"+p),g[1][g[0]-1]);s(g[0]-1,g[1].length-1)}return false})}G=N();s(G[0],G[1].length-1)}})},viewGridRow:function(f,b){b=a.extend({top:0,left:0,width:0,height:"auto",dataheight:"auto",modal:false,overlay:30,drag:true,resize:true,jqModal:true,
+closeOnEscape:false,labelswidth:"30%",closeicon:[],navkeys:[false,38,40],onClose:null,beforeShowForm:null,beforeInitData:null,viewPagerButtons:true},a.jgrid.view,b||{});return this.each(function(){function e(){if(b.closeOnEscape===true||b.navkeys[0]===true)setTimeout(function(){a(".ui-jqdialog-titlebar-close","#"+N.modalhead).focus()},0)}function r(m,z,h,P){for(var O,V,R,L=0,W,X,ba=[],$=false,ca="<td class='CaptionTD form-view-label ui-widget-content' width='"+b.labelswidth+"'>&#160;</td><td class='DataTD form-view-data ui-helper-reset ui-widget-content'>&#160;</td>",
+da="",fa=["integer","number","currency"],g=0,l=0,w,q,H,C=1;C<=P;C++)da+=C==1?ca:"<td class='CaptionTD form-view-label ui-widget-content'>&#160;</td><td class='DataTD form-view-data ui-widget-content'>&#160;</td>";a(z.p.colModel).each(function(){V=this.editrules&&this.editrules.edithidden===true?false:this.hidden===true?true:false;if(!V&&this.align==="right")if(this.formatter&&a.inArray(this.formatter,fa)!==-1)g=Math.max(g,parseInt(this.width,10));else l=Math.max(l,parseInt(this.width,10))});w=g!==
+0?g:l!==0?l:0;$=a(z).jqGrid("getInd",m);a(z.p.colModel).each(function(v){O=this.name;q=false;X=(V=this.editrules&&this.editrules.edithidden===true?false:this.hidden===true?true:false)?"style='display:none'":"";H=typeof this.viewable!="boolean"?true:this.viewable;if(O!=="cb"&&O!=="subgrid"&&O!=="rn"&&H){W=$===false?"":O==z.p.ExpandColumn&&z.p.treeGrid===true?a("td:eq("+v+")",z.rows[$]).text():a("td:eq("+v+")",z.rows[$]).html();q=this.align==="right"&&w!==0?true:false;a.extend({},this.editoptions||
+{},{id:O,name:O});var K=a.extend({},{rowabove:false,rowcontent:""},this.formoptions||{}),A=parseInt(K.rowpos,10)||L+1,Q=parseInt((parseInt(K.colpos,10)||1)*2,10);if(K.rowabove){var I=a("<tr><td class='contentinfo' colspan='"+P*2+"'>"+K.rowcontent+"</td></tr>");a(h).append(I);I[0].rp=A}R=a(h).find("tr[rowpos="+A+"]");if(R.length===0){R=a("<tr "+X+" rowpos='"+A+"'></tr>").addClass("FormData").attr("id","trv_"+O);a(R).append(da);a(h).append(R);R[0].rp=A}a("td:eq("+(Q-2)+")",R[0]).html("<b>"+(typeof K.label===
+"undefined"?z.p.colNames[v]:K.label)+"</b>");a("td:eq("+(Q-1)+")",R[0]).append("<span>"+W+"</span>").attr("id","v_"+O);q&&a("td:eq("+(Q-1)+") span",R[0]).css({"text-align":"right",width:w+"px"});ba[L]=v;L++}});if(L>0){m=a("<tr class='FormData' style='display:none'><td class='CaptionTD'></td><td colspan='"+(P*2-1)+"' class='DataTD'><input class='FormElement' id='id_g' type='text' name='id' value='"+m+"'/></td></tr>");m[0].rp=L+99;a(h).append(m)}return ba}function x(m,z){var h,P,O=0,V,R;if(R=a(z).jqGrid("getInd",
+m,true)){a("td",R).each(function(L){h=z.p.colModel[L].name;P=z.p.colModel[L].editrules&&z.p.colModel[L].editrules.edithidden===true?false:z.p.colModel[L].hidden===true?true:false;if(h!=="cb"&&h!=="subgrid"&&h!=="rn"){V=h==z.p.ExpandColumn&&z.p.treeGrid===true?a(this).text():a(this).html();a.extend({},z.p.colModel[L].editoptions||{});h=a.jgrid.jqID("v_"+h);a("#"+h+" span","#"+s).html(V);P&&a("#"+h,"#"+s).parents("tr:first").hide();O++}});O>0&&a("#id_g","#"+s).val(m)}}function D(m,z){m===0?a("#pData",
+"#"+s+"_2").addClass("ui-state-disabled"):a("#pData","#"+s+"_2").removeClass("ui-state-disabled");m==z?a("#nData","#"+s+"_2").addClass("ui-state-disabled"):a("#nData","#"+s+"_2").removeClass("ui-state-disabled")}function F(){var m=a(y).jqGrid("getDataIDs"),z=a("#id_g","#"+s).val();return[a.inArray(z,m),m]}var y=this;if(y.grid&&f){var o=y.p.id,k="ViewGrid_"+o,s="ViewTbl_"+o,N={themodal:"viewmod"+o,modalhead:"viewhd"+o,modalcontent:"viewcnt"+o,scrollelm:k},c=a.isFunction(b.beforeInitData)?b.beforeInitData:
+false,t=true,p=1,j=0;if(a("#"+N.themodal).html()!==null){if(c){t=c(a("#"+k));if(typeof t=="undefined")t=true}if(t===false)return;a(".ui-jqdialog-title","#"+N.modalhead).html(b.caption);a("#FormError","#"+s).hide();x(f,y);a.isFunction(b.beforeShowForm)&&b.beforeShowForm(a("#"+k));a.jgrid.viewModal("#"+N.themodal,{gbox:"#gbox_"+o,jqm:b.jqModal,jqM:false,overlay:b.overlay,modal:b.modal});e()}else{var n=isNaN(b.dataheight)?b.dataheight:b.dataheight+"px";n=a("<form name='FormPost' id='"+k+"' class='FormGrid' style='width:100%;overflow:auto;position:relative;height:"+
+n+";'></form>");var G=a("<table id='"+s+"' class='EditTable' cellspacing='1' cellpadding='2' border='0' style='table-layout:fixed'><tbody></tbody></table>");if(c){t=c(a("#"+k));if(typeof t=="undefined")t=true}if(t===false)return;a(y.p.colModel).each(function(){var m=this.formoptions;p=Math.max(p,m?m.colpos||0:0);j=Math.max(j,m?m.rowpos||0:0)});a(n).append(G);r(f,y,G,p);c=y.p.direction=="rtl"?true:false;t="<a href='javascript:void(0)' id='"+(c?"nData":"pData")+"' class='fm-button ui-state-default ui-corner-left'><span class='ui-icon ui-icon-triangle-1-w'></span></a>";
+var J="<a href='javascript:void(0)' id='"+(c?"pData":"nData")+"' class='fm-button ui-state-default ui-corner-right'><span class='ui-icon ui-icon-triangle-1-e'></span></a>",u="<a href='javascript:void(0)' id='cData' class='fm-button ui-state-default ui-corner-all'>"+b.bClose+"</a>";if(j>0){var E=[];a.each(a(G)[0].rows,function(m,z){E[m]=z});E.sort(function(m,z){if(m.rp>z.rp)return 1;if(m.rp<z.rp)return-1;return 0});a.each(E,function(m,z){a("tbody",G).append(z)})}b.gbox="#gbox_"+o;var B=false;if(b.closeOnEscape===
+true){b.closeOnEscape=false;B=true}n=a("<span></span>").append(n).append("<table border='0' class='EditTable' id='"+s+"_2'><tbody><tr id='Act_Buttons'><td class='navButton' width='"+b.labelswidth+"'>"+(c?J+t:t+J)+"</td><td class='EditButton'>"+u+"</td></tr></tbody></table>");a.jgrid.createModal(N,n,b,"#gview_"+y.p.id,a("#gview_"+y.p.id)[0]);if(c){a("#pData, #nData","#"+s+"_2").css("float","right");a(".EditButton","#"+s+"_2").css("text-align","left")}b.viewPagerButtons||a("#pData, #nData","#"+s+"_2").hide();
+n=null;a("#"+N.themodal).keydown(function(m){if(m.which===27){B&&a.jgrid.hideModal(this,{gb:b.gbox,jqm:b.jqModal,onClose:b.onClose});return false}if(b.navkeys[0]===true){if(m.which===b.navkeys[1]){a("#pData","#"+s+"_2").trigger("click");return false}if(m.which===b.navkeys[2]){a("#nData","#"+s+"_2").trigger("click");return false}}});b.closeicon=a.extend([true,"left","ui-icon-close"],b.closeicon);if(b.closeicon[0]===true)a("#cData","#"+s+"_2").addClass(b.closeicon[1]=="right"?"fm-button-icon-right":
+"fm-button-icon-left").append("<span class='ui-icon "+b.closeicon[2]+"'></span>");a.isFunction(b.beforeShowForm)&&b.beforeShowForm(a("#"+k));a.jgrid.viewModal("#"+N.themodal,{gbox:"#gbox_"+o,jqm:b.jqModal,modal:b.modal});a(".fm-button:not(.ui-state-disabled)","#"+s+"_2").hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});e();a("#cData","#"+s+"_2").click(function(){a.jgrid.hideModal("#"+N.themodal,{gb:"#gbox_"+o,jqm:b.jqModal,onClose:b.onClose});
+return false});a("#nData","#"+s+"_2").click(function(){a("#FormError","#"+s).hide();var m=F();m[0]=parseInt(m[0],10);if(m[0]!=-1&&m[1][m[0]+1]){if(a.isFunction(b.onclickPgButtons))b.onclickPgButtons("next",a("#"+k),m[1][m[0]]);x(m[1][m[0]+1],y);a(y).jqGrid("setSelection",m[1][m[0]+1]);a.isFunction(b.afterclickPgButtons)&&b.afterclickPgButtons("next",a("#"+k),m[1][m[0]+1]);D(m[0]+1,m[1].length-1)}e();return false});a("#pData","#"+s+"_2").click(function(){a("#FormError","#"+s).hide();var m=F();if(m[0]!=
+-1&&m[1][m[0]-1]){if(a.isFunction(b.onclickPgButtons))b.onclickPgButtons("prev",a("#"+k),m[1][m[0]]);x(m[1][m[0]-1],y);a(y).jqGrid("setSelection",m[1][m[0]-1]);a.isFunction(b.afterclickPgButtons)&&b.afterclickPgButtons("prev",a("#"+k),m[1][m[0]-1]);D(m[0]-1,m[1].length-1)}e();return false})}n=F();D(n[0],n[1].length-1)}})},delGridRow:function(f,b){b=a.extend({top:0,left:0,width:240,height:"auto",dataheight:"auto",modal:false,overlay:30,drag:true,resize:true,url:"",mtype:"POST",reloadAfterSubmit:true,
+beforeShowForm:null,beforeInitData:null,afterShowForm:null,beforeSubmit:null,onclickSubmit:null,afterSubmit:null,jqModal:true,closeOnEscape:false,delData:{},delicon:[],cancelicon:[],onClose:null,ajaxDelOptions:{},processing:false,serializeDelData:null,useDataProxy:false},a.jgrid.del,b||{});d[a(this)[0].p.id]=b;return this.each(function(){var e=this;if(e.grid)if(f){var r=a.isFunction(d[e.p.id].beforeShowForm),x=a.isFunction(d[e.p.id].afterShowForm),D=a.isFunction(d[e.p.id].beforeInitData)?d[e.p.id].beforeInitData:
+false,F=e.p.id,y={},o=true,k="DelTbl_"+F,s,N,c,t,p={themodal:"delmod"+F,modalhead:"delhd"+F,modalcontent:"delcnt"+F,scrollelm:k};if(jQuery.isArray(f))f=f.join();if(a("#"+p.themodal).html()!==null){if(D){o=D(a("#"+k));if(typeof o=="undefined")o=true}if(o===false)return;a("#DelData>td","#"+k).text(f);a("#DelError","#"+k).hide();if(d[e.p.id].processing===true){d[e.p.id].processing=false;a("#dData","#"+k).removeClass("ui-state-active")}r&&d[e.p.id].beforeShowForm(a("#"+k));a.jgrid.viewModal("#"+p.themodal,
+{gbox:"#gbox_"+F,jqm:d[e.p.id].jqModal,jqM:false,overlay:d[e.p.id].overlay,modal:d[e.p.id].modal})}else{var j=isNaN(d[e.p.id].dataheight)?d[e.p.id].dataheight:d[e.p.id].dataheight+"px";j="<div id='"+k+"' class='formdata' style='width:100%;overflow:auto;position:relative;height:"+j+";'>";j+="<table class='DelTable'><tbody>";j+="<tr id='DelError' style='display:none'><td class='ui-state-error'></td></tr>";j+="<tr id='DelData' style='display:none'><td >"+f+"</td></tr>";j+='<tr><td class="delmsg" style="white-space:pre;">'+
+d[e.p.id].msg+"</td></tr><tr><td >&#160;</td></tr>";j+="</tbody></table></div>";j+="<table cellspacing='0' cellpadding='0' border='0' class='EditTable' id='"+k+"_2'><tbody><tr><td><hr class='ui-widget-content' style='margin:1px'/></td></tr><tr><td class='DelButton EditButton'>"+("<a href='javascript:void(0)' id='dData' class='fm-button ui-state-default ui-corner-all'>"+b.bSubmit+"</a>")+"&#160;"+("<a href='javascript:void(0)' id='eData' class='fm-button ui-state-default ui-corner-all'>"+b.bCancel+
+"</a>")+"</td></tr></tbody></table>";b.gbox="#gbox_"+F;a.jgrid.createModal(p,j,b,"#gview_"+e.p.id,a("#gview_"+e.p.id)[0]);if(D){o=D(a("#"+k));if(typeof o=="undefined")o=true}if(o===false)return;a(".fm-button","#"+k+"_2").hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});b.delicon=a.extend([true,"left","ui-icon-scissors"],d[e.p.id].delicon);b.cancelicon=a.extend([true,"left","ui-icon-cancel"],d[e.p.id].cancelicon);if(b.delicon[0]===true)a("#dData",
+"#"+k+"_2").addClass(b.delicon[1]=="right"?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon "+b.delicon[2]+"'></span>");if(b.cancelicon[0]===true)a("#eData","#"+k+"_2").addClass(b.cancelicon[1]=="right"?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon "+b.cancelicon[2]+"'></span>");a("#dData","#"+k+"_2").click(function(){var n=[true,""];y={};var G=a("#DelData>td","#"+k).text();if(a.isFunction(d[e.p.id].onclickSubmit))y=d[e.p.id].onclickSubmit(d[e.p.id],
+G)||{};if(a.isFunction(d[e.p.id].beforeSubmit))n=d[e.p.id].beforeSubmit(G);if(n[0]&&!d[e.p.id].processing){d[e.p.id].processing=true;a(this).addClass("ui-state-active");c=e.p.prmNames;s=a.extend({},d[e.p.id].delData,y);t=c.oper;s[t]=c.deloper;N=c.id;G=G.split(",");for(var J in G)if(G.hasOwnProperty(J))G[J]=a.jgrid.stripPref(e.p.idPrefix,G[J]);s[N]=G.join();J=a.extend({url:d[e.p.id].url?d[e.p.id].url:a(e).jqGrid("getGridParam","editurl"),type:d[e.p.id].mtype,data:a.isFunction(d[e.p.id].serializeDelData)?
+d[e.p.id].serializeDelData(s):s,complete:function(u,E){if(E!="success"){n[0]=false;n[1]=a.isFunction(d[e.p.id].errorTextFormat)?d[e.p.id].errorTextFormat(u):E+" Status: '"+u.statusText+"'. Error code: "+u.status}else if(a.isFunction(d[e.p.id].afterSubmit))n=d[e.p.id].afterSubmit(u,s);if(n[0]===false){a("#DelError>td","#"+k).html(n[1]);a("#DelError","#"+k).show()}else{if(d[e.p.id].reloadAfterSubmit&&e.p.datatype!="local")a(e).trigger("reloadGrid");else{var B=[];B=G.split(",");if(e.p.treeGrid===true)try{a(e).jqGrid("delTreeNode",
+e.p.idPrefix+B[0])}catch(m){}else for(var z=0;z<B.length;z++)a(e).jqGrid("delRowData",e.p.idPrefix+B[z]);e.p.selrow=null;e.p.selarrrow=[]}a.isFunction(d[e.p.id].afterComplete)&&setTimeout(function(){d[e.p.id].afterComplete(u,G)},500)}d[e.p.id].processing=false;a("#dData","#"+k+"_2").removeClass("ui-state-active");n[0]&&a.jgrid.hideModal("#"+p.themodal,{gb:"#gbox_"+F,jqm:b.jqModal,onClose:d[e.p.id].onClose})}},a.jgrid.ajaxOptions,d[e.p.id].ajaxDelOptions);if(!J.url&&!d[e.p.id].useDataProxy)if(a.isFunction(e.p.dataProxy))d[e.p.id].useDataProxy=
+true;else{n[0]=false;n[1]+=" "+a.jgrid.errors.nourl}if(n[0])if(d[e.p.id].useDataProxy){J=e.p.dataProxy.call(e,J,"del_"+e.p.id);if(typeof J=="undefined")J=[true,""];if(J[0]===false){n[0]=false;n[1]=J[1]||"Error deleting the selected row!"}else a.jgrid.hideModal("#"+p.themodal,{gb:"#gbox_"+F,jqm:b.jqModal,onClose:d[e.p.id].onClose})}else a.ajax(J)}if(n[0]===false){a("#DelError>td","#"+k).html(n[1]);a("#DelError","#"+k).show()}return false});a("#eData","#"+k+"_2").click(function(){a.jgrid.hideModal("#"+
+p.themodal,{gb:"#gbox_"+F,jqm:d[e.p.id].jqModal,onClose:d[e.p.id].onClose});return false});r&&d[e.p.id].beforeShowForm(a("#"+k));a.jgrid.viewModal("#"+p.themodal,{gbox:"#gbox_"+F,jqm:d[e.p.id].jqModal,overlay:d[e.p.id].overlay,modal:d[e.p.id].modal})}x&&d[e.p.id].afterShowForm(a("#"+k));d[e.p.id].closeOnEscape===true&&setTimeout(function(){a(".ui-jqdialog-titlebar-close","#"+p.modalhead).focus()},0)}})},navGrid:function(f,b,e,r,x,D,F){b=a.extend({edit:true,editicon:"ui-icon-pencil",add:true,addicon:"ui-icon-plus",
+del:true,delicon:"ui-icon-trash",search:true,searchicon:"ui-icon-search",refresh:true,refreshicon:"ui-icon-refresh",refreshstate:"firstpage",view:false,viewicon:"ui-icon-document",position:"left",closeOnEscape:true,beforeRefresh:null,afterRefresh:null,cloneToTop:false,alertwidth:200,alertheight:"auto",alerttop:null,alertleft:null,alertzIndex:null},a.jgrid.nav,b||{});return this.each(function(){if(!this.nav){var y={themodal:"alertmod",modalhead:"alerthd",modalcontent:"alertcnt"},o=this,k;if(!(!o.grid||
+typeof f!="string")){if(a("#"+y.themodal).html()===null){if(!b.alerttop&&!b.alertleft){if(typeof window.innerWidth!="undefined"){b.alertleft=window.innerWidth;b.alerttop=window.innerHeight}else if(typeof document.documentElement!="undefined"&&typeof document.documentElement.clientWidth!="undefined"&&document.documentElement.clientWidth!==0){b.alertleft=document.documentElement.clientWidth;b.alerttop=document.documentElement.clientHeight}else{b.alertleft=1024;b.alerttop=768}b.alertleft=b.alertleft/
+2-parseInt(b.alertwidth,10)/2;b.alerttop=b.alerttop/2-25}a.jgrid.createModal(y,"<div>"+b.alerttext+"</div><span tabindex='0'><span tabindex='-1' id='jqg_alrt'></span></span>",{gbox:"#gbox_"+o.p.id,jqModal:true,drag:true,resize:true,caption:b.alertcap,top:b.alerttop,left:b.alertleft,width:b.alertwidth,height:b.alertheight,closeOnEscape:b.closeOnEscape,zIndex:b.alertzIndex},"","",true)}var s=1;if(b.cloneToTop&&o.p.toppager)s=2;for(var N=0;N<s;N++){var c=a("<table cellspacing='0' cellpadding='0' border='0' class='ui-pg-table navtable' style='float:left;table-layout:auto;'><tbody><tr></tr></tbody></table>"),
+t,p;if(N===0){t=f;p=o.p.id;if(t==o.p.toppager){p+="_top";s=1}}else{t=o.p.toppager;p=o.p.id+"_top"}o.p.direction=="rtl"&&a(c).attr("dir","rtl").css("float","right");if(b.add){r=r||{};k=a("<td class='ui-pg-button ui-corner-all'></td>");a(k).append("<div class='ui-pg-div'><span class='ui-icon "+b.addicon+"'></span>"+b.addtext+"</div>");a("tr",c).append(k);a(k,c).attr({title:b.addtitle||"",id:r.id||"add_"+p}).click(function(){a(this).hasClass("ui-state-disabled")||(a.isFunction(b.addfunc)?b.addfunc():
+a(o).jqGrid("editGridRow","new",r));return false}).hover(function(){a(this).hasClass("ui-state-disabled")||a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});k=null}if(b.edit){k=a("<td class='ui-pg-button ui-corner-all'></td>");e=e||{};a(k).append("<div class='ui-pg-div'><span class='ui-icon "+b.editicon+"'></span>"+b.edittext+"</div>");a("tr",c).append(k);a(k,c).attr({title:b.edittitle||"",id:e.id||"edit_"+p}).click(function(){if(!a(this).hasClass("ui-state-disabled")){var j=
+o.p.selrow;if(j)a.isFunction(b.editfunc)?b.editfunc(j):a(o).jqGrid("editGridRow",j,e);else{a.jgrid.viewModal("#"+y.themodal,{gbox:"#gbox_"+o.p.id,jqm:true});a("#jqg_alrt").focus()}}return false}).hover(function(){a(this).hasClass("ui-state-disabled")||a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});k=null}if(b.view){k=a("<td class='ui-pg-button ui-corner-all'></td>");F=F||{};a(k).append("<div class='ui-pg-div'><span class='ui-icon "+b.viewicon+"'></span>"+b.viewtext+
+"</div>");a("tr",c).append(k);a(k,c).attr({title:b.viewtitle||"",id:F.id||"view_"+p}).click(function(){if(!a(this).hasClass("ui-state-disabled")){var j=o.p.selrow;if(j)a.isFunction(b.viewfunc)?b.viewfunc(j):a(o).jqGrid("viewGridRow",j,F);else{a.jgrid.viewModal("#"+y.themodal,{gbox:"#gbox_"+o.p.id,jqm:true});a("#jqg_alrt").focus()}}return false}).hover(function(){a(this).hasClass("ui-state-disabled")||a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});k=null}if(b.del){k=
+a("<td class='ui-pg-button ui-corner-all'></td>");x=x||{};a(k).append("<div class='ui-pg-div'><span class='ui-icon "+b.delicon+"'></span>"+b.deltext+"</div>");a("tr",c).append(k);a(k,c).attr({title:b.deltitle||"",id:x.id||"del_"+p}).click(function(){if(!a(this).hasClass("ui-state-disabled")){var j;if(o.p.multiselect){j=o.p.selarrrow;if(j.length===0)j=null}else j=o.p.selrow;if(j)"function"==typeof b.delfunc?b.delfunc(j):a(o).jqGrid("delGridRow",j,x);else{a.jgrid.viewModal("#"+y.themodal,{gbox:"#gbox_"+
+o.p.id,jqm:true});a("#jqg_alrt").focus()}}return false}).hover(function(){a(this).hasClass("ui-state-disabled")||a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});k=null}if(b.add||b.edit||b.del||b.view)a("tr",c).append("<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='ui-separator'></span></td>");if(b.search){k=a("<td class='ui-pg-button ui-corner-all'></td>");D=D||{};a(k).append("<div class='ui-pg-div'><span class='ui-icon "+b.searchicon+
+"'></span>"+b.searchtext+"</div>");a("tr",c).append(k);a(k,c).attr({title:b.searchtitle||"",id:D.id||"search_"+p}).click(function(){a(this).hasClass("ui-state-disabled")||a(o).jqGrid("searchGrid",D);return false}).hover(function(){a(this).hasClass("ui-state-disabled")||a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});D.showOnLoad&&D.showOnLoad===true&&a(k,c).click();k=null}if(b.refresh){k=a("<td class='ui-pg-button ui-corner-all'></td>");a(k).append("<div class='ui-pg-div'><span class='ui-icon "+
+b.refreshicon+"'></span>"+b.refreshtext+"</div>");a("tr",c).append(k);a(k,c).attr({title:b.refreshtitle||"",id:"refresh_"+p}).click(function(){if(!a(this).hasClass("ui-state-disabled")){a.isFunction(b.beforeRefresh)&&b.beforeRefresh();o.p.search=false;try{var j=o.p.id;o.p.postData.filters="";a("#fbox_"+j).jqFilter("resetFilter");a.isFunction(o.clearToolbar)&&o.clearToolbar(false)}catch(n){}switch(b.refreshstate){case "firstpage":a(o).trigger("reloadGrid",[{page:1}]);break;case "current":a(o).trigger("reloadGrid",
+[{current:true}])}a.isFunction(b.afterRefresh)&&b.afterRefresh()}return false}).hover(function(){a(this).hasClass("ui-state-disabled")||a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});k=null}k=a(".ui-jqgrid").css("font-size")||"11px";a("body").append("<div id='testpg2' class='ui-jqgrid ui-widget ui-widget-content' style='font-size:"+k+";visibility:hidden;' ></div>");k=a(c).clone().appendTo("#testpg2").width();a("#testpg2").remove();a(t+"_"+b.position,t).append(c);
+if(o.p._nvtd){if(k>o.p._nvtd[0]){a(t+"_"+b.position,t).width(k);o.p._nvtd[0]=k}o.p._nvtd[1]=k}c=k=k=null;this.nav=true}}}})},navButtonAdd:function(f,b){b=a.extend({caption:"newButton",title:"",buttonicon:"ui-icon-newwin",onClickButton:null,position:"last",cursor:"pointer"},b||{});return this.each(function(){if(this.grid){if(f.indexOf("#")!==0)f="#"+f;var e=a(".navtable",f)[0],r=this;if(e)if(!(b.id&&a("#"+b.id,e).html()!==null)){var x=a("<td></td>");b.buttonicon.toString().toUpperCase()=="NONE"?a(x).addClass("ui-pg-button ui-corner-all").append("<div class='ui-pg-div'>"+
+b.caption+"</div>"):a(x).addClass("ui-pg-button ui-corner-all").append("<div class='ui-pg-div'><span class='ui-icon "+b.buttonicon+"'></span>"+b.caption+"</div>");b.id&&a(x).attr("id",b.id);if(b.position=="first")e.rows[0].cells.length===0?a("tr",e).append(x):a("tr td:eq(0)",e).before(x);else a("tr",e).append(x);a(x,e).attr("title",b.title||"").click(function(D){a(this).hasClass("ui-state-disabled")||a.isFunction(b.onClickButton)&&b.onClickButton.call(r,D);return false}).hover(function(){a(this).hasClass("ui-state-disabled")||
+a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")})}}})},navSeparatorAdd:function(f,b){b=a.extend({sepclass:"ui-separator",sepcontent:""},b||{});return this.each(function(){if(this.grid){if(f.indexOf("#")!==0)f="#"+f;var e=a(".navtable",f)[0];if(e){var r="<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='"+b.sepclass+"'></span>"+b.sepcontent+"</td>";a("tr",e).append(r)}}})},GridToForm:function(f,b){return this.each(function(){var e=this;
+if(e.grid){var r=a(e).jqGrid("getRowData",f);if(r)for(var x in r)a("[name="+a.jgrid.jqID(x)+"]",b).is("input:radio")||a("[name="+a.jgrid.jqID(x)+"]",b).is("input:checkbox")?a("[name="+a.jgrid.jqID(x)+"]",b).each(function(){if(a(this).val()==r[x])a(this)[e.p.useProp?"prop":"attr"]("checked",true);else a(this)[e.p.useProp?"prop":"attr"]("checked",false)}):a("[name="+a.jgrid.jqID(x)+"]",b).val(r[x])}})},FormToGrid:function(f,b,e,r){return this.each(function(){if(this.grid){e||(e="set");r||(r="first");
+var x=a(b).serializeArray(),D={};a.each(x,function(F,y){D[y.name]=y.value});if(e=="add")a(this).jqGrid("addRowData",f,D,r);else e=="set"&&a(this).jqGrid("setRowData",f,D)}})}})})(jQuery);
+(function(c){c.fn.jqFilter=function(k){if(typeof k==="string"){var w=c.fn.jqFilter[k];if(!w)throw"jqFilter - No such method: "+k;var B=c.makeArray(arguments).slice(1);return w.apply(this,B)}var o=c.extend(true,{filter:null,columns:[],onChange:null,afterRedraw:null,checkValues:null,error:false,errmsg:"",errorcheck:true,showQuery:true,sopt:null,ops:[{name:"eq",description:"equal",operator:"="},{name:"ne",description:"not equal",operator:"<>"},{name:"lt",description:"less",operator:"<"},{name:"le",description:"less or equal",
+operator:"<="},{name:"gt",description:"greater",operator:">"},{name:"ge",description:"greater or equal",operator:">="},{name:"bw",description:"begins with",operator:"LIKE"},{name:"bn",description:"does not begin with",operator:"NOT LIKE"},{name:"in",description:"in",operator:"IN"},{name:"ni",description:"not in",operator:"NOT IN"},{name:"ew",description:"ends with",operator:"LIKE"},{name:"en",description:"does not end with",operator:"NOT LIKE"},{name:"cn",description:"contains",operator:"LIKE"},{name:"nc",
+description:"does not contain",operator:"NOT LIKE"},{name:"nu",description:"is null",operator:"IS NULL"},{name:"nn",description:"is not null",operator:"IS NOT NULL"}],numopts:["eq","ne","lt","le","gt","ge","nu","nn","in","ni"],stropts:["eq","ne","bw","bn","ew","en","cn","nc","nu","nn","in","ni"],_gridsopt:[],groupOps:["AND","OR"],groupButton:true,ruleButtons:true,direction:"ltr"},k||{});return this.each(function(){if(!this.filter){this.p=o;if(this.p.filter===null||this.p.filter===undefined)this.p.filter=
+{groupOp:this.p.groupOps[0],rules:[],groups:[]};var q,x=this.p.columns.length,j,y=/msie/i.test(navigator.userAgent)&&!window.opera;if(this.p._gridsopt.length)for(q=0;q<this.p._gridsopt.length;q++)this.p.ops[q].description=this.p._gridsopt[q];this.p.initFilter=c.extend(true,{},this.p.filter);if(x){for(q=0;q<x;q++){j=this.p.columns[q];if(j.stype)j.inputtype=j.stype;else if(!j.inputtype)j.inputtype="text";if(j.sorttype)j.searchtype=j.sorttype;else if(!j.searchtype)j.searchtype="string";if(j.hidden===
+undefined)j.hidden=false;if(!j.label)j.label=j.name;if(j.index)j.name=j.index;if(!j.hasOwnProperty("searchoptions"))j.searchoptions={};if(!j.hasOwnProperty("searchrules"))j.searchrules={}}this.p.showQuery&&c(this).append("<table class='queryresult ui-widget ui-widget-content' style='display:block;max-width:440px;border:0px none;' dir='"+this.p.direction+"'><tbody><tr><td class='query'></td></tr></tbody></table>");var z=function(d,g){var a=[true,""];if(c.isFunction(g.searchrules))a=g.searchrules(d,
+g);else if(c.jgrid&&c.jgrid.checkValues)try{a=c.jgrid.checkValues(d,-1,null,g.searchrules,g.label)}catch(b){}if(a&&a.length&&a[0]===false){o.error=!a[0];o.errmsg=a[1]}};this.onchange=function(){this.p.error=false;this.p.errmsg="";return c.isFunction(this.p.onChange)?this.p.onChange.call(this,this.p):false};this.reDraw=function(){c("table.group:first",this).remove();var d=this.createTableForGroup(o.filter,null);c(this).append(d);c.isFunction(this.p.afterRedraw)&&this.p.afterRedraw.call(this,this.p)};
+this.createTableForGroup=function(d,g){var a=this,b,e=c("<table class='group ui-widget ui-widget-content' style='border:0px none;'><tbody></tbody></table>"),i="left";if(this.p.direction=="rtl"){i="right";e.attr("dir","rtl")}g===null&&e.append("<tr class='error' style='display:none;'><th colspan='5' class='ui-state-error' align='"+i+"'></th></tr>");var f=c("<tr></tr>");e.append(f);i=c("<th colspan='5' align='"+i+"'></th>");f.append(i);if(this.p.ruleButtons===true){var h=c("<select class='opsel'></select>");
+i.append(h);f="";var l;for(b=0;b<o.groupOps.length;b++){l=d.groupOp===a.p.groupOps[b]?" selected='selected'":"";f+="<option value='"+a.p.groupOps[b]+"'"+l+">"+a.p.groupOps[b]+"</option>"}h.append(f).bind("change",function(){d.groupOp=c(h).val();a.onchange()})}f="<span></span>";if(this.p.groupButton){f=c("<input type='button' value='+ {}' title='Add subgroup' class='add-group'/>");f.bind("click",function(){if(d.groups===undefined)d.groups=[];d.groups.push({groupOp:o.groupOps[0],rules:[],groups:[]});
+a.reDraw();a.onchange();return false})}i.append(f);if(this.p.ruleButtons===true){f=c("<input type='button' value='+' title='Add rule' class='add-rule ui-add'/>");var m;f.bind("click",function(){if(d.rules===undefined)d.rules=[];for(b=0;b<a.p.columns.length;b++){var n=typeof a.p.columns[b].search==="undefined"?true:a.p.columns[b].search,s=a.p.columns[b].hidden===true;if(a.p.columns[b].searchoptions.searchhidden===true&&n||n&&!s){m=a.p.columns[b];break}}d.rules.push({field:m.name,op:(m.searchoptions.sopt?
+m.searchoptions.sopt:a.p.sopt?a.p.sopt:m.searchtype==="string"?a.p.stropts:a.p.numopts)[0],data:""});a.reDraw();return false});i.append(f)}if(g!==null){f=c("<input type='button' value='-' title='Delete group' class='delete-group'/>");i.append(f);f.bind("click",function(){for(b=0;b<g.groups.length;b++)if(g.groups[b]===d){g.groups.splice(b,1);break}a.reDraw();a.onchange();return false})}if(d.groups!==undefined)for(b=0;b<d.groups.length;b++){i=c("<tr></tr>");e.append(i);f=c("<td class='first'></td>");
+i.append(f);f=c("<td colspan='4'></td>");f.append(this.createTableForGroup(d.groups[b],d));i.append(f)}if(d.groupOp===undefined)d.groupOp=a.p.groupOps[0];if(d.rules!==undefined)for(b=0;b<d.rules.length;b++)e.append(this.createTableRowForRule(d.rules[b],d));return e};this.createTableRowForRule=function(d,g){var a=this,b=c("<tr></tr>"),e,i,f,h,l="",m;b.append("<td class='first'></td>");var n=c("<td class='columns'></td>");b.append(n);var s=c("<select></select>"),p,t=[];n.append(s);s.bind("change",function(){d.field=
+c(s).val();f=c(this).parents("tr:first");for(e=0;e<a.p.columns.length;e++)if(a.p.columns[e].name===d.field){h=a.p.columns[e];break}if(h){h.searchoptions.id=c.jgrid.randId();if(y&&h.inputtype==="text")if(!h.searchoptions.size)h.searchoptions.size=10;var r=c.jgrid.createEl(h.inputtype,h.searchoptions,"",true,a.p.ajaxSelectOptions,true);c(r).addClass("input-elm");i=h.searchoptions.sopt?h.searchoptions.sopt:a.p.sopt?a.p.sopt:h.searchtype==="string"?a.p.stropts:a.p.numopts;var u="",A=0;t=[];c.each(a.p.ops,
+function(){t.push(this.name)});for(e=0;e<i.length;e++){p=c.inArray(i[e],t);if(p!==-1){if(A===0)d.op=a.p.ops[p].name;u+="<option value='"+a.p.ops[p].name+"'>"+a.p.ops[p].description+"</option>";A++}}c(".selectopts",f).empty().append(u);c(".selectopts",f)[0].selectedIndex=0;if(c.browser.msie&&c.browser.version<9){u=parseInt(c("select.selectopts",f)[0].offsetWidth)+1;c(".selectopts",f).width(u);c(".selectopts",f).css("width","auto")}c(".data",f).empty().append(r);c(".input-elm",f).bind("change",function(){d.data=
+c(this).val();a.onchange()});setTimeout(function(){d.data=c(r).val();a.onchange()},0)}});for(e=n=0;e<a.p.columns.length;e++){m=typeof a.p.columns[e].search==="undefined"?true:a.p.columns[e].search;var C=a.p.columns[e].hidden===true;if(a.p.columns[e].searchoptions.searchhidden===true&&m||m&&!C){m="";if(d.field===a.p.columns[e].name){m=" selected='selected'";n=e}l+="<option value='"+a.p.columns[e].name+"'"+m+">"+a.p.columns[e].label+"</option>"}}s.append(l);l=c("<td class='operators'></td>");b.append(l);
+h=o.columns[n];h.searchoptions.id=c.jgrid.randId();if(y&&h.inputtype==="text")if(!h.searchoptions.size)h.searchoptions.size=10;n=c.jgrid.createEl(h.inputtype,h.searchoptions,d.data,true,a.p.ajaxSelectOptions,true);var v=c("<select class='selectopts'></select>");l.append(v);v.bind("change",function(){d.op=c(v).val();f=c(this).parents("tr:first");var r=c(".input-elm",f)[0];if(d.op==="nu"||d.op==="nn"){d.data="";r.value="";r.setAttribute("readonly","true");r.setAttribute("disabled","true")}else{r.removeAttribute("readonly");
+r.removeAttribute("disabled")}a.onchange()});i=h.searchoptions.sopt?h.searchoptions.sopt:a.p.sopt?a.p.sopt:h.searchtype==="string"?o.stropts:a.p.numopts;l="";c.each(a.p.ops,function(){t.push(this.name)});for(e=0;e<i.length;e++){p=c.inArray(i[e],t);if(p!==-1){m=d.op===a.p.ops[p].name?" selected='selected'":"";l+="<option value='"+a.p.ops[p].name+"'"+m+">"+a.p.ops[p].description+"</option>"}}v.append(l);l=c("<td class='data'></td>");b.append(l);l.append(n);c(n).addClass("input-elm").bind("change",function(){d.data=
+c(this).val();a.onchange()});l=c("<td></td>");b.append(l);if(this.p.ruleButtons===true){n=c("<input type='button' value='-' title='Delete rule' class='delete-rule ui-del'/>");l.append(n);n.bind("click",function(){for(e=0;e<g.rules.length;e++)if(g.rules[e]===d){g.rules.splice(e,1);break}a.reDraw();a.onchange();return false})}return b};this.getStringForGroup=function(d){var g="(",a;if(d.groups!==undefined)for(a=0;a<d.groups.length;a++){if(g.length>1)g+=" "+d.groupOp+" ";try{g+=this.getStringForGroup(d.groups[a])}catch(b){alert(b)}}if(d.rules!==
+undefined)try{for(a=0;a<d.rules.length;a++){if(g.length>1)g+=" "+d.groupOp+" ";g+=this.getStringForRule(d.rules[a])}}catch(e){alert(e)}g+=")";return g==="()"?"":g};this.getStringForRule=function(d){var g="",a="",b,e;for(b=0;b<this.p.ops.length;b++)if(this.p.ops[b].name===d.op){g=this.p.ops[b].operator;a=this.p.ops[b].name;break}for(b=0;b<this.p.columns.length;b++)if(this.p.columns[b].name===d.field){e=this.p.columns[b];break}b=d.data;if(a==="bw"||a==="bn")b+="%";if(a==="ew"||a==="en")b="%"+b;if(a===
+"cn"||a==="nc")b="%"+b+"%";if(a==="in"||a==="ni")b=" ("+b+")";o.errorcheck&&z(d.data,e);return c.inArray(e.searchtype,["int","integer","float","number","currency"])!==-1||a==="nn"||a==="nu"?d.field+" "+g+" "+b:d.field+" "+g+' "'+b+'"'};this.resetFilter=function(){this.p.filter=c.extend(true,{},this.p.initFilter);this.reDraw();this.onchange()};this.hideError=function(){c("th.ui-state-error",this).html("");c("tr.error",this).hide()};this.showError=function(){c("th.ui-state-error",this).html(this.p.errmsg);
+c("tr.error",this).show()};this.toUserFriendlyString=function(){return this.getStringForGroup(o.filter)};this.toString=function(){function d(a){var b="(",e;if(a.groups!==undefined)for(e=0;e<a.groups.length;e++){if(b.length>1)b+=a.groupOp==="OR"?" || ":" && ";b+=d(a.groups[e])}if(a.rules!==undefined)for(e=0;e<a.rules.length;e++){if(b.length>1)b+=a.groupOp==="OR"?" || ":" && ";var i=a.rules[e];if(g.p.errorcheck){var f=void 0,h=void 0;for(f=0;f<g.p.columns.length;f++)if(g.p.columns[f].name===i.field){h=
+g.p.columns[f];break}h&&z(i.data,h)}b+=i.op+"(item."+i.field+",'"+i.data+"')"}b+=")";return b==="()"?"":b}var g=this;return d(this.p.filter)};this.reDraw();if(this.p.showQuery)this.onchange();this.filter=true}}})};c.extend(c.fn.jqFilter,{toSQLString:function(){var k="";this.each(function(){k=this.toUserFriendlyString()});return k},filterData:function(){var k;this.each(function(){k=this.p.filter});return k},getParameter:function(k){if(k!==undefined)if(this.p.hasOwnProperty(k))return this.p[k];return this.p},
+resetFilter:function(){return this.each(function(){this.resetFilter()})},addFilter:function(k){if(typeof k==="string")k=jQuery.jgrid.parse(k);this.each(function(){this.p.filter=k;this.reDraw();this.onchange()})}})})(jQuery);
+(function(a){a.jgrid.extend({editRow:function(g,x,m,s,u,y,v,l,t){var h={keys:x||false,oneditfunc:m||null,successfunc:s||null,url:u||null,extraparam:y||{},aftersavefunc:v||null,errorfunc:l||null,afterrestorefunc:t||null,restoreAfterError:true,mtype:"POST"},o=a.makeArray(arguments).slice(1),b;b=o[0]&&typeof o[0]=="object"&&!a.isFunction(o[0])?a.extend(h,o[0]):h;return this.each(function(){var d=this,c,j,q=0,r=null,p={},k,e;if(d.grid){k=a(d).jqGrid("getInd",g,true);if(k!==false)if((a(k).attr("editable")||
+"0")=="0"&&!a(k).hasClass("not-editable-row")){e=d.p.colModel;a("td",k).each(function(f){c=e[f].name;var A=d.p.treeGrid===true&&c==d.p.ExpandColumn;if(A)j=a("span:first",this).html();else try{j=a.unformat(this,{rowId:g,colModel:e[f]},f)}catch(n){j=e[f].edittype&&e[f].edittype=="textarea"?a(this).text():a(this).html()}if(c!="cb"&&c!="subgrid"&&c!="rn"){if(d.p.autoencode)j=a.jgrid.htmlDecode(j);p[c]=j;if(e[f].editable===true){if(r===null)r=f;A?a("span:first",this).html(""):a(this).html("");var i=a.extend({},
+e[f].editoptions||{},{id:g+"_"+c,name:c});if(!e[f].edittype)e[f].edittype="text";if(j=="&nbsp;"||j=="&#160;"||j.length==1&&j.charCodeAt(0)==160)j="";i=a.jgrid.createEl(e[f].edittype,i,j,true,a.extend({},a.jgrid.ajaxOptions,d.p.ajaxSelectOptions||{}));a(i).addClass("editable");A?a("span:first",this).append(i):a(this).append(i);e[f].edittype=="select"&&typeof e[f].editoptions!=="undefined"&&e[f].editoptions.multiple===true&&typeof e[f].editoptions.dataUrl==="undefined"&&a.browser.msie&&a(i).width(a(i).width());
+q++}}});if(q>0){p.id=g;d.p.savedRow.push(p);a(k).attr("editable","1");a("td:eq("+r+") input",k).focus();b.keys===true&&a(k).bind("keydown",function(f){f.keyCode===27&&a(d).jqGrid("restoreRow",g,t);if(f.keyCode===13){if(f.target.tagName=="TEXTAREA")return true;a(d).jqGrid("saveRow",g,b);return false}f.stopPropagation()});a.isFunction(b.oneditfunc)&&b.oneditfunc.call(d,g)}}}})},saveRow:function(g,x,m,s,u,y,v){var l={successfunc:x||null,url:m||null,extraparam:s||{},aftersavefunc:u||null,errorfunc:y||
+null,afterrestorefunc:v||null,restoreAfterError:true,mtype:"POST"},t=a.makeArray(arguments).slice(1),h;h=t[0]&&typeof t[0]=="object"&&!a.isFunction(t[0])?a.extend(l,t[0]):l;var o=false,b=this[0],d,c={},j={},q={},r,p,k;if(!b.grid)return o;k=a(b).jqGrid("getInd",g,true);if(k===false)return o;l=a(k).attr("editable");h.url=h.url?h.url:b.p.editurl;if(l==="1"){var e;a("td",k).each(function(n){e=b.p.colModel[n];d=e.name;if(d!="cb"&&d!="subgrid"&&e.editable===true&&d!="rn"&&!a(this).hasClass("not-editable-cell")){switch(e.edittype){case "checkbox":var i=
+["Yes","No"];if(e.editoptions)i=e.editoptions.value.split(":");c[d]=a("input",this).is(":checked")?i[0]:i[1];break;case "text":case "password":case "textarea":case "button":c[d]=a("input, textarea",this).val();break;case "select":if(e.editoptions.multiple){i=a("select",this);var w=[];c[d]=a(i).val();c[d]=c[d]?c[d].join(","):"";a("select option:selected",this).each(function(B,C){w[B]=a(C).text()});j[d]=w.join(",")}else{c[d]=a("select option:selected",this).val();j[d]=a("select option:selected",this).text()}if(e.formatter&&
+e.formatter=="select")j={};break;case "custom":try{if(e.editoptions&&a.isFunction(e.editoptions.custom_value)){c[d]=e.editoptions.custom_value.call(b,a(".customelement",this),"get");if(c[d]===undefined)throw"e2";}else throw"e1";}catch(z){z=="e1"&&a.jgrid.info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+a.jgrid.edit.msg.nodefined,jQuery.jgrid.edit.bClose);z=="e2"?a.jgrid.info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+a.jgrid.edit.msg.novalue,jQuery.jgrid.edit.bClose):
+a.jgrid.info_dialog(jQuery.jgrid.errors.errcap,z.message,jQuery.jgrid.edit.bClose)}}p=a.jgrid.checkValues(c[d],n,b);if(p[0]===false){p[1]=c[d]+" "+p[1];return false}if(b.p.autoencode)c[d]=a.jgrid.htmlEncode(c[d]);if(h.url!=="clientArray"&&e.editoptions&&e.editoptions.NullIfEmpty===true)if(c[d]=="")q[d]="null"}});if(p[0]===false){try{var f=a.jgrid.findPos(a("#"+a.jgrid.jqID(g),b.grid.bDiv)[0]);a.jgrid.info_dialog(a.jgrid.errors.errcap,p[1],a.jgrid.edit.bClose,{left:f[0],top:f[1]})}catch(A){alert(p[1])}return o}l=
+b.p.prmNames;t=l.oper;f=l.id;if(c){c[t]=l.editoper;c[f]=g;if(typeof b.p.inlineData=="undefined")b.p.inlineData={};c=a.extend({},c,b.p.inlineData,h.extraparam)}if(h.url=="clientArray"){c=a.extend({},c,j);b.p.autoencode&&a.each(c,function(n,i){c[n]=a.jgrid.htmlDecode(i)});f=a(b).jqGrid("setRowData",g,c);a(k).attr("editable","0");for(l=0;l<b.p.savedRow.length;l++)if(b.p.savedRow[l].id==g){r=l;break}r>=0&&b.p.savedRow.splice(r,1);a.isFunction(h.aftersavefunc)&&h.aftersavefunc.call(b,g,f);o=true;a(k).unbind("keydown")}else{a("#lui_"+
+b.p.id).show();q=a.extend({},c,q);q[f]=a.jgrid.stripPref(b.p.idPrefix,q[f]);a.ajax(a.extend({url:h.url,data:a.isFunction(b.p.serializeRowData)?b.p.serializeRowData.call(b,q):q,type:h.mtype,async:false,complete:function(n,i){a("#lui_"+b.p.id).hide();if(i==="success")if((a.isFunction(h.successfunc)?h.successfunc.call(b,n):true)===true){b.p.autoencode&&a.each(c,function(z,B){c[z]=a.jgrid.htmlDecode(B)});c=a.extend({},c,j);a(b).jqGrid("setRowData",g,c);a(k).attr("editable","0");for(var w=0;w<b.p.savedRow.length;w++)if(b.p.savedRow[w].id==
+g){r=w;break}r>=0&&b.p.savedRow.splice(r,1);a.isFunction(h.aftersavefunc)&&h.aftersavefunc.call(b,g,n);o=true;a(k).unbind("keydown")}else{a.isFunction(h.errorfunc)&&h.errorfunc.call(b,g,n,i);h.restoreAfterError===true&&a(b).jqGrid("restoreRow",g,h.afterrestorefunc)}},error:function(n,i){a("#lui_"+b.p.id).hide();if(a.isFunction(h.errorfunc))h.errorfunc.call(b,g,n,i);else try{jQuery.jgrid.info_dialog(jQuery.jgrid.errors.errcap,'<div class="ui-state-error">'+n.responseText+"</div>",jQuery.jgrid.edit.bClose,
+{buttonalign:"right"})}catch(w){alert(n.responseText)}h.restoreAfterError===true&&a(b).jqGrid("restoreRow",g,h.afterrestorefunc)}},a.jgrid.ajaxOptions,b.p.ajaxRowOptions||{}))}}return o},restoreRow:function(g,x){return this.each(function(){var m=this,s,u,y={};if(m.grid){u=a(m).jqGrid("getInd",g,true);if(u!==false){for(var v=0;v<m.p.savedRow.length;v++)if(m.p.savedRow[v].id==g){s=v;break}if(s>=0){if(a.isFunction(a.fn.datepicker))try{a("input.hasDatepicker","#"+a.jgrid.jqID(u.id)).datepicker("hide")}catch(l){}a.each(m.p.colModel,
+function(){if(this.editable===true&&this.name in m.p.savedRow[s]&&!a(this).hasClass("not-editable-cell"))y[this.name]=m.p.savedRow[s][this.name]});a(m).jqGrid("setRowData",g,y);a(u).attr("editable","0").unbind("keydown");m.p.savedRow.splice(s,1)}a.isFunction(x)&&x.call(m,g)}}})}})})(jQuery);
+(function(b){b.jgrid.extend({editCell:function(d,f,a){return this.each(function(){var c=this,h,e,g,i;if(!(!c.grid||c.p.cellEdit!==true)){f=parseInt(f,10);c.p.selrow=c.rows[d].id;c.p.knv||b(c).jqGrid("GridNav");if(c.p.savedRow.length>0){if(a===true)if(d==c.p.iRow&&f==c.p.iCol)return;b(c).jqGrid("saveCell",c.p.savedRow[0].id,c.p.savedRow[0].ic)}else window.setTimeout(function(){b("#"+c.p.knv).attr("tabindex","-1").focus()},0);i=c.p.colModel[f];h=i.name;if(!(h=="subgrid"||h=="cb"||h=="rn")){g=b("td:eq("+
+f+")",c.rows[d]);if(i.editable===true&&a===true&&!g.hasClass("not-editable-cell")){if(parseInt(c.p.iCol,10)>=0&&parseInt(c.p.iRow,10)>=0){b("td:eq("+c.p.iCol+")",c.rows[c.p.iRow]).removeClass("edit-cell ui-state-highlight");b(c.rows[c.p.iRow]).removeClass("selected-row ui-state-hover")}b(g).addClass("edit-cell ui-state-highlight");b(c.rows[d]).addClass("selected-row ui-state-hover");try{e=b.unformat(g,{rowId:c.rows[d].id,colModel:i},f)}catch(k){e=i.edittype&&i.edittype=="textarea"?b(g).text():b(g).html()}if(c.p.autoencode)e=
+b.jgrid.htmlDecode(e);if(!i.edittype)i.edittype="text";c.p.savedRow.push({id:d,ic:f,name:h,v:e});if(e=="&nbsp;"||e=="&#160;"||e.length==1&&e.charCodeAt(0)==160)e="";if(b.isFunction(c.p.formatCell)){var j=c.p.formatCell.call(c,c.rows[d].id,h,e,d,f);if(j!==undefined)e=j}j=b.extend({},i.editoptions||{},{id:d+"_"+h,name:h});var m=b.jgrid.createEl(i.edittype,j,e,true,b.extend({},b.jgrid.ajaxOptions,c.p.ajaxSelectOptions||{}));b.isFunction(c.p.beforeEditCell)&&c.p.beforeEditCell.call(c,c.rows[d].id,h,e,
+d,f);b(g).html("").append(m).attr("tabindex","0");window.setTimeout(function(){b(m).focus()},0);b("input, select, textarea",g).bind("keydown",function(l){if(l.keyCode===27)if(b("input.hasDatepicker",g).length>0)b(".ui-datepicker").is(":hidden")?b(c).jqGrid("restoreCell",d,f):b("input.hasDatepicker",g).datepicker("hide");else b(c).jqGrid("restoreCell",d,f);l.keyCode===13&&b(c).jqGrid("saveCell",d,f);if(l.keyCode==9)if(c.grid.hDiv.loading)return false;else l.shiftKey?b(c).jqGrid("prevCell",d,f):b(c).jqGrid("nextCell",
+d,f);l.stopPropagation()});b.isFunction(c.p.afterEditCell)&&c.p.afterEditCell.call(c,c.rows[d].id,h,e,d,f)}else{if(parseInt(c.p.iCol,10)>=0&&parseInt(c.p.iRow,10)>=0){b("td:eq("+c.p.iCol+")",c.rows[c.p.iRow]).removeClass("edit-cell ui-state-highlight");b(c.rows[c.p.iRow]).removeClass("selected-row ui-state-hover")}g.addClass("edit-cell ui-state-highlight");b(c.rows[d]).addClass("selected-row ui-state-hover");if(b.isFunction(c.p.onSelectCell)){e=g.html().replace(/\&#160\;/ig,"");c.p.onSelectCell.call(c,
+c.rows[d].id,h,e,d,f)}}c.p.iCol=f;c.p.iRow=d}}})},saveCell:function(d,f){return this.each(function(){var a=this,c;if(!(!a.grid||a.p.cellEdit!==true)){c=a.p.savedRow.length>=1?0:null;if(c!==null){var h=b("td:eq("+f+")",a.rows[d]),e,g,i=a.p.colModel[f],k=i.name,j=b.jgrid.jqID(k);switch(i.edittype){case "select":if(i.editoptions.multiple){j=b("#"+d+"_"+j,a.rows[d]);var m=[];if(e=b(j).val())e.join(",");else e="";b("option:selected",j).each(function(o,p){m[o]=b(p).text()});g=m.join(",")}else{e=b("#"+d+
+"_"+j+">option:selected",a.rows[d]).val();g=b("#"+d+"_"+j+">option:selected",a.rows[d]).text()}if(i.formatter)g=e;break;case "checkbox":var l=["Yes","No"];if(i.editoptions)l=i.editoptions.value.split(":");g=e=b("#"+d+"_"+j,a.rows[d]).is(":checked")?l[0]:l[1];break;case "password":case "text":case "textarea":case "button":g=e=b("#"+d+"_"+j,a.rows[d]).val();break;case "custom":try{if(i.editoptions&&b.isFunction(i.editoptions.custom_value)){e=i.editoptions.custom_value.call(a,b(".customelement",h),"get");
+if(e===undefined)throw"e2";else g=e}else throw"e1";}catch(q){q=="e1"&&b.jgrid.info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+b.jgrid.edit.msg.nodefined,jQuery.jgrid.edit.bClose);q=="e2"?b.jgrid.info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+b.jgrid.edit.msg.novalue,jQuery.jgrid.edit.bClose):b.jgrid.info_dialog(jQuery.jgrid.errors.errcap,q.message,jQuery.jgrid.edit.bClose)}}if(g!==a.p.savedRow[c].v){if(b.isFunction(a.p.beforeSaveCell))if(c=a.p.beforeSaveCell.call(a,
+a.rows[d].id,k,e,d,f))g=e=c;var r=b.jgrid.checkValues(e,f,a);if(r[0]===true){c={};if(b.isFunction(a.p.beforeSubmitCell))(c=a.p.beforeSubmitCell.call(a,a.rows[d].id,k,e,d,f))||(c={});b("input.hasDatepicker",h).length>0&&b("input.hasDatepicker",h).datepicker("hide");if(a.p.cellsubmit=="remote")if(a.p.cellurl){var n={};if(a.p.autoencode)e=b.jgrid.htmlEncode(e);n[k]=e;l=a.p.prmNames;i=l.id;j=l.oper;n[i]=b.jgrid.stripPref(a.p.idPrefix,a.rows[d].id);n[j]=l.editoper;n=b.extend(c,n);b("#lui_"+a.p.id).show();
+a.grid.hDiv.loading=true;b.ajax(b.extend({url:a.p.cellurl,data:b.isFunction(a.p.serializeCellData)?a.p.serializeCellData.call(a,n):n,type:"POST",complete:function(o,p){b("#lui_"+a.p.id).hide();a.grid.hDiv.loading=false;if(p=="success")if(b.isFunction(a.p.afterSubmitCell)){var s=a.p.afterSubmitCell.call(a,o,n.id,k,e,d,f);if(s[0]===true){b(h).empty();b(a).jqGrid("setCell",a.rows[d].id,f,g,false,false,true);b(h).addClass("dirty-cell");b(a.rows[d]).addClass("edited");b.isFunction(a.p.afterSaveCell)&&
+a.p.afterSaveCell.call(a,a.rows[d].id,k,e,d,f);a.p.savedRow.splice(0,1)}else{b.jgrid.info_dialog(b.jgrid.errors.errcap,s[1],b.jgrid.edit.bClose);b(a).jqGrid("restoreCell",d,f)}}else{b(h).empty();b(a).jqGrid("setCell",a.rows[d].id,f,g,false,false,true);b(h).addClass("dirty-cell");b(a.rows[d]).addClass("edited");b.isFunction(a.p.afterSaveCell)&&a.p.afterSaveCell.call(a,a.rows[d].id,k,e,d,f);a.p.savedRow.splice(0,1)}},error:function(o,p){b("#lui_"+a.p.id).hide();a.grid.hDiv.loading=false;b.isFunction(a.p.errorCell)?
+a.p.errorCell.call(a,o,p):b.jgrid.info_dialog(b.jgrid.errors.errcap,o.status+" : "+o.statusText+"<br/>"+p,b.jgrid.edit.bClose);b(a).jqGrid("restoreCell",d,f)}},b.jgrid.ajaxOptions,a.p.ajaxCellOptions||{}))}else try{b.jgrid.info_dialog(b.jgrid.errors.errcap,b.jgrid.errors.nourl,b.jgrid.edit.bClose);b(a).jqGrid("restoreCell",d,f)}catch(t){}if(a.p.cellsubmit=="clientArray"){b(h).empty();b(a).jqGrid("setCell",a.rows[d].id,f,g,false,false,true);b(h).addClass("dirty-cell");b(a.rows[d]).addClass("edited");
+b.isFunction(a.p.afterSaveCell)&&a.p.afterSaveCell.call(a,a.rows[d].id,k,e,d,f);a.p.savedRow.splice(0,1)}}else try{window.setTimeout(function(){b.jgrid.info_dialog(b.jgrid.errors.errcap,e+" "+r[1],b.jgrid.edit.bClose)},100);b(a).jqGrid("restoreCell",d,f)}catch(u){}}else b(a).jqGrid("restoreCell",d,f)}b.browser.opera?b("#"+a.p.knv).attr("tabindex","-1").focus():window.setTimeout(function(){b("#"+a.p.knv).attr("tabindex","-1").focus()},0)}})},restoreCell:function(d,f){return this.each(function(){var a=
+this,c;if(!(!a.grid||a.p.cellEdit!==true)){c=a.p.savedRow.length>=1?0:null;if(c!==null){var h=b("td:eq("+f+")",a.rows[d]);if(b.isFunction(b.fn.datepicker))try{b("input.hasDatepicker",h).datepicker("hide")}catch(e){}b(h).empty().attr("tabindex","-1");b(a).jqGrid("setCell",a.rows[d].id,f,a.p.savedRow[c].v,false,false,true);b.isFunction(a.p.afterRestoreCell)&&a.p.afterRestoreCell.call(a,a.rows[d].id,a.p.savedRow[c].v,d,f);a.p.savedRow.splice(0,1)}window.setTimeout(function(){b("#"+a.p.knv).attr("tabindex",
+"-1").focus()},0)}})},nextCell:function(d,f){return this.each(function(){var a=false;if(!(!this.grid||this.p.cellEdit!==true)){for(var c=f+1;c<this.p.colModel.length;c++)if(this.p.colModel[c].editable===true){a=c;break}if(a!==false)b(this).jqGrid("editCell",d,a,true);else this.p.savedRow.length>0&&b(this).jqGrid("saveCell",d,f)}})},prevCell:function(d,f){return this.each(function(){var a=false;if(!(!this.grid||this.p.cellEdit!==true)){for(var c=f-1;c>=0;c--)if(this.p.colModel[c].editable===true){a=
+c;break}if(a!==false)b(this).jqGrid("editCell",d,a,true);else this.p.savedRow.length>0&&b(this).jqGrid("saveCell",d,f)}})},GridNav:function(){return this.each(function(){function d(g,i,k){if(k.substr(0,1)=="v"){var j=b(a.grid.bDiv)[0].clientHeight,m=b(a.grid.bDiv)[0].scrollTop,l=a.rows[g].offsetTop+a.rows[g].clientHeight,q=a.rows[g].offsetTop;if(k=="vd")if(l>=j)b(a.grid.bDiv)[0].scrollTop=b(a.grid.bDiv)[0].scrollTop+a.rows[g].clientHeight;if(k=="vu")if(q<m)b(a.grid.bDiv)[0].scrollTop=b(a.grid.bDiv)[0].scrollTop-
+a.rows[g].clientHeight}if(k=="h"){k=b(a.grid.bDiv)[0].clientWidth;j=b(a.grid.bDiv)[0].scrollLeft;m=a.rows[g].cells[i].offsetLeft;if(a.rows[g].cells[i].offsetLeft+a.rows[g].cells[i].clientWidth>=k+parseInt(j,10))b(a.grid.bDiv)[0].scrollLeft=b(a.grid.bDiv)[0].scrollLeft+a.rows[g].cells[i].clientWidth;else if(m<j)b(a.grid.bDiv)[0].scrollLeft=b(a.grid.bDiv)[0].scrollLeft-a.rows[g].cells[i].clientWidth}}function f(g,i){var k,j;if(i=="lft"){k=g+1;for(j=g;j>=0;j--)if(a.p.colModel[j].hidden!==true){k=j;break}}if(i==
+"rgt"){k=g-1;for(j=g;j<a.p.colModel.length;j++)if(a.p.colModel[j].hidden!==true){k=j;break}}return k}var a=this;if(!(!a.grid||a.p.cellEdit!==true)){a.p.knv=a.p.id+"_kn";var c=b("<span style='width:0px;height:0px;background-color:black;' tabindex='0'><span tabindex='-1' style='width:0px;height:0px;background-color:grey' id='"+a.p.knv+"'></span></span>"),h,e;b(c).insertBefore(a.grid.cDiv);b("#"+a.p.knv).focus().keydown(function(g){e=g.keyCode;if(a.p.direction=="rtl")if(e==37)e=39;else if(e==39)e=37;
+switch(e){case 38:if(a.p.iRow-1>0){d(a.p.iRow-1,a.p.iCol,"vu");b(a).jqGrid("editCell",a.p.iRow-1,a.p.iCol,false)}break;case 40:if(a.p.iRow+1<=a.rows.length-1){d(a.p.iRow+1,a.p.iCol,"vd");b(a).jqGrid("editCell",a.p.iRow+1,a.p.iCol,false)}break;case 37:if(a.p.iCol-1>=0){h=f(a.p.iCol-1,"lft");d(a.p.iRow,h,"h");b(a).jqGrid("editCell",a.p.iRow,h,false)}break;case 39:if(a.p.iCol+1<=a.p.colModel.length-1){h=f(a.p.iCol+1,"rgt");d(a.p.iRow,h,"h");b(a).jqGrid("editCell",a.p.iRow,h,false)}break;case 13:parseInt(a.p.iCol,
+10)>=0&&parseInt(a.p.iRow,10)>=0&&b(a).jqGrid("editCell",a.p.iRow,a.p.iCol,true)}return false})}})},getChangedCells:function(d){var f=[];d||(d="all");this.each(function(){var a=this,c;!a.grid||a.p.cellEdit!==true||b(a.rows).each(function(h){var e={};if(b(this).hasClass("edited")){b("td",this).each(function(g){c=a.p.colModel[g].name;if(c!=="cb"&&c!=="subgrid")if(d=="dirty"){if(b(this).hasClass("dirty-cell"))try{e[c]=b.unformat(this,{rowId:a.rows[h].id,colModel:a.p.colModel[g]},g)}catch(i){e[c]=b.jgrid.htmlDecode(b(this).html())}}else try{e[c]=
+b.unformat(this,{rowId:a.rows[h].id,colModel:a.p.colModel[g]},g)}catch(k){e[c]=b.jgrid.htmlDecode(b(this).html())}});e.id=this.id;f.push(e)}})});return f}})})(jQuery);
+(function(b){b.fn.jqm=function(a){var f={overlay:50,closeoverlay:true,overlayClass:"jqmOverlay",closeClass:"jqmClose",trigger:".jqModal",ajax:e,ajaxText:"",target:e,modal:e,toTop:e,onShow:e,onHide:e,onLoad:e};return this.each(function(){if(this._jqm)return j[this._jqm].c=b.extend({},j[this._jqm].c,a);l++;this._jqm=l;j[l]={c:b.extend(f,b.jqm.params,a),a:e,w:b(this).addClass("jqmID"+l),s:l};f.trigger&&b(this).jqmAddTrigger(f.trigger)})};b.fn.jqmAddClose=function(a){return o(this,a,"jqmHide")};b.fn.jqmAddTrigger=
+function(a){return o(this,a,"jqmShow")};b.fn.jqmShow=function(a){return this.each(function(){b.jqm.open(this._jqm,a)})};b.fn.jqmHide=function(a){return this.each(function(){b.jqm.close(this._jqm,a)})};b.jqm={hash:{},open:function(a,f){var c=j[a],d=c.c,i="."+d.closeClass,g=parseInt(c.w.css("z-index"));g=g>0?g:3E3;var h=b("<div></div>").css({height:"100%",width:"100%",position:"fixed",left:0,top:0,"z-index":g-1,opacity:d.overlay/100});if(c.a)return e;c.t=f;c.a=true;c.w.css("z-index",g);if(d.modal){k[0]||
+setTimeout(function(){p("bind")},1);k.push(a)}else if(d.overlay>0)d.closeoverlay&&c.w.jqmAddClose(h);else h=e;c.o=h?h.addClass(d.overlayClass).prependTo("body"):e;if(q){b("html,body").css({height:"100%",width:"100%"});if(h){h=h.css({position:"absolute"})[0];for(var m in{Top:1,Left:1})h.style.setExpression(m.toLowerCase(),"(_=(document.documentElement.scroll"+m+" || document.body.scroll"+m+"))+'px'")}}if(d.ajax){g=d.target||c.w;h=d.ajax;g=typeof g=="string"?b(g,c.w):b(g);h=h.substr(0,1)=="@"?b(f).attr(h.substring(1)):
+h;g.html(d.ajaxText).load(h,function(){d.onLoad&&d.onLoad.call(this,c);i&&c.w.jqmAddClose(b(i,c.w));r(c)})}else i&&c.w.jqmAddClose(b(i,c.w));d.toTop&&c.o&&c.w.before('<span id="jqmP'+c.w[0]._jqm+'"></span>').insertAfter(c.o);d.onShow?d.onShow(c):c.w.show();r(c);return e},close:function(a){a=j[a];if(!a.a)return e;a.a=e;if(k[0]){k.pop();k[0]||p("unbind")}a.c.toTop&&a.o&&b("#jqmP"+a.w[0]._jqm).after(a.w).remove();if(a.c.onHide)a.c.onHide(a);else{a.w.hide();a.o&&a.o.remove()}return e},params:{}};var l=
+0,j=b.jqm.hash,k=[],q=b.browser.msie&&b.browser.version=="6.0",e=false,r=function(a){var f=b('<iframe src="javascript:false;document.write(\'\');" class="jqm"></iframe>').css({opacity:0});if(q)if(a.o)a.o.html('<p style="width:100%;height:100%"/>').prepend(f);else b("iframe.jqm",a.w)[0]||a.w.prepend(f);s(a)},s=function(a){try{b(":input:visible",a.w)[0].focus()}catch(f){}},p=function(a){b(document)[a]("keypress",n)[a]("keydown",n)[a]("mousedown",n)},n=function(a){var f=j[k[k.length-1]];(a=!b(a.target).parents(".jqmID"+
+f.s)[0])&&s(f);return!a},o=function(a,f,c){return a.each(function(){var d=this._jqm;b(f).each(function(){if(!this[c]){this[c]=[];b(this).click(function(){for(var i in{jqmShow:1,jqmHide:1})for(var g in this[i])if(j[this[i][g]])j[this[i][g]].w[i](this);return e})}this[c].push(d)})})}})(jQuery);
+(function(b){b.fn.jqDrag=function(a){return l(this,a,"d")};b.fn.jqResize=function(a,e){return l(this,a,"r",e)};b.jqDnR={dnr:{},e:0,drag:function(a){if(c.k=="d")d.css({left:c.X+a.pageX-c.pX,top:c.Y+a.pageY-c.pY});else{d.css({width:Math.max(a.pageX-c.pX+c.W,0),height:Math.max(a.pageY-c.pY+c.H,0)});M1&&f.css({width:Math.max(a.pageX-M1.pX+M1.W,0),height:Math.max(a.pageY-M1.pY+M1.H,0)})}return false},stop:function(){b(document).unbind("mousemove",i.drag).unbind("mouseup",i.stop)}};var i=b.jqDnR,c=i.dnr,
+d=i.e,f,l=function(a,e,n,m){return a.each(function(){e=e?b(e,a):a;e.bind("mousedown",{e:a,k:n},function(g){var j=g.data,h={};d=j.e;f=m?b(m):false;if(d.css("position")!="relative")try{d.position(h)}catch(o){}c={X:h.left||k("left")||0,Y:h.top||k("top")||0,W:k("width")||d[0].scrollWidth||0,H:k("height")||d[0].scrollHeight||0,pX:g.pageX,pY:g.pageY,k:j.k};M1=f&&j.k!="d"?{X:h.left||f1("left")||0,Y:h.top||f1("top")||0,W:f[0].offsetWidth||f1("width")||0,H:f[0].offsetHeight||f1("height")||0,pX:g.pageX,pY:g.pageY,
+k:j.k}:false;if(b("input.hasDatepicker",d[0])[0])try{b("input.hasDatepicker",d[0]).datepicker("hide")}catch(p){}b(document).mousemove(b.jqDnR.drag).mouseup(b.jqDnR.stop);return false})})},k=function(a){return parseInt(d.css(a))||false};f1=function(a){return parseInt(f.css(a))||false}})(jQuery);
+(function(b){b.jgrid.extend({setSubGrid:function(){return this.each(function(){var f;this.p.subGridOptions=b.extend({plusicon:"ui-icon-plus",minusicon:"ui-icon-minus",openicon:"ui-icon-carat-1-sw",expandOnLoad:false,delayOnLoad:50,selectOnExpand:false,reloadOnExpand:true},this.p.subGridOptions||{});this.p.colNames.unshift("");this.p.colModel.unshift({name:"subgrid",width:b.browser.safari?this.p.subGridWidth+this.p.cellLayout:this.p.subGridWidth,sortable:false,resizable:false,hidedlg:true,search:false,
+fixed:true});f=this.p.subGridModel;if(f[0]){f[0].align=b.extend([],f[0].align||[]);for(var d=0;d<f[0].name.length;d++)f[0].align[d]=f[0].align[d]||"left"}})},addSubGridCell:function(f,d){var a="",n,s;this.each(function(){a=this.formatCol(f,d);s=this.p.id;n=this.p.subGridOptions.plusicon});return'<td role="grid" aria-describedby="'+s+'_subgrid" class="ui-sgcollapsed sgcollapsed" '+a+"><a href='javascript:void(0);'><span class='ui-icon "+n+"'></span></a></td>"},addSubGrid:function(f,d){return this.each(function(){var a=
+this;if(a.grid){var n=function(g,j,e){j=b("<td align='"+a.p.subGridModel[0].align[e]+"'></td>").html(j);b(g).append(j)},s=function(g,j){var e,c,h,k=b("<table cellspacing='0' cellpadding='0' border='0'><tbody></tbody></table>"),i=b("<tr></tr>");for(c=0;c<a.p.subGridModel[0].name.length;c++){e=b("<th class='ui-state-default ui-th-subgrid ui-th-column ui-th-"+a.p.direction+"'></th>");b(e).html(a.p.subGridModel[0].name[c]);b(e).width(a.p.subGridModel[0].width[c]);b(i).append(e)}b(k).append(i);if(g){h=
+a.p.xmlReader.subgrid;b(h.root+" "+h.row,g).each(function(){i=b("<tr class='ui-widget-content ui-subtblcell'></tr>");if(h.repeatitems===true)b(h.cell,this).each(function(m){n(i,b(this).text()||"&#160;",m)});else{var o=a.p.subGridModel[0].mapping||a.p.subGridModel[0].name;if(o)for(c=0;c<o.length;c++)n(i,b(o[c],this).text()||"&#160;",c)}b(k).append(i)})}e=b("table:first",a.grid.bDiv).attr("id")+"_";b("#"+e+j).append(k);a.grid.hDiv.loading=false;b("#load_"+a.p.id).hide();return false},v=function(g,j){var e,
+c,h,k,i,o=b("<table cellspacing='0' cellpadding='0' border='0'><tbody></tbody></table>"),m=b("<tr></tr>");for(c=0;c<a.p.subGridModel[0].name.length;c++){e=b("<th class='ui-state-default ui-th-subgrid ui-th-column ui-th-"+a.p.direction+"'></th>");b(e).html(a.p.subGridModel[0].name[c]);b(e).width(a.p.subGridModel[0].width[c]);b(m).append(e)}b(o).append(m);if(g){k=a.p.jsonReader.subgrid;e=g[k.root];if(typeof e!=="undefined")for(c=0;c<e.length;c++){h=e[c];m=b("<tr class='ui-widget-content ui-subtblcell'></tr>");
+if(k.repeatitems===true){if(k.cell)h=h[k.cell];for(i=0;i<h.length;i++)n(m,h[i]||"&#160;",i)}else{var u=a.p.subGridModel[0].mapping||a.p.subGridModel[0].name;if(u.length)for(i=0;i<u.length;i++)n(m,h[u[i]]||"&#160;",i)}b(o).append(m)}}c=b("table:first",a.grid.bDiv).attr("id")+"_";b("#"+c+j).append(o);a.grid.hDiv.loading=false;b("#load_"+a.p.id).hide();return false},z=function(g){var j,e,c,h;j=b(g).attr("id");e={nd_:(new Date).getTime()};e[a.p.prmNames.subgridid]=j;if(!a.p.subGridModel[0])return false;
+if(a.p.subGridModel[0].params)for(h=0;h<a.p.subGridModel[0].params.length;h++)for(c=0;c<a.p.colModel.length;c++)if(a.p.colModel[c].name==a.p.subGridModel[0].params[h])e[a.p.colModel[c].name]=b("td:eq("+c+")",g).text().replace(/\&#160\;/ig,"");if(!a.grid.hDiv.loading){a.grid.hDiv.loading=true;b("#load_"+a.p.id).show();if(!a.p.subgridtype)a.p.subgridtype=a.p.datatype;if(b.isFunction(a.p.subgridtype))a.p.subgridtype.call(a,e);else a.p.subgridtype=a.p.subgridtype.toLowerCase();switch(a.p.subgridtype){case "xml":case "json":b.ajax(b.extend({type:a.p.mtype,
+url:a.p.subGridUrl,dataType:a.p.subgridtype,data:b.isFunction(a.p.serializeSubGridData)?a.p.serializeSubGridData.call(a,e):e,complete:function(k){a.p.subgridtype=="xml"?s(k.responseXML,j):v(b.jgrid.parse(k.responseText),j)}},b.jgrid.ajaxOptions,a.p.ajaxSubgridOptions||{}))}}return false},l,t,w,x=0,p,q;b.each(a.p.colModel,function(){if(this.hidden===true||this.name=="rn"||this.name=="cb")x++});var y=a.rows.length,r=1;if(d!==undefined&&d>0){r=d;y=d+1}for(;r<y;){b(a.rows[r]).hasClass("jqgrow")&&b(a.rows[r].cells[f]).bind("click",
+function(){var g=b(this).parent("tr")[0];q=g.nextSibling;if(b(this).hasClass("sgcollapsed")){t=a.p.id;l=g.id;if(a.p.subGridOptions.reloadOnExpand===true||a.p.subGridOptions.reloadOnExpand===false&&!b(q).hasClass("ui-subgrid")){w=f>=1?"<td colspan='"+f+"'>&#160;</td>":"";p=true;if(b.isFunction(a.p.subGridBeforeExpand))p=a.p.subGridBeforeExpand.call(a,t+"_"+l,l);if(p===false)return false;b(g).after("<tr role='row' class='ui-subgrid'>"+w+"<td class='ui-widget-content subgrid-cell'><span class='ui-icon "+
+a.p.subGridOptions.openicon+"'></span></td><td colspan='"+parseInt(a.p.colNames.length-1-x,10)+"' class='ui-widget-content subgrid-data'><div id="+t+"_"+l+" class='tablediv'></div></td></tr>");b.isFunction(a.p.subGridRowExpanded)?a.p.subGridRowExpanded.call(a,t+"_"+l,l):z(g)}else b(q).show();b(this).html("<a href='javascript:void(0);'><span class='ui-icon "+a.p.subGridOptions.minusicon+"'></span></a>").removeClass("sgcollapsed").addClass("sgexpanded");a.p.subGridOptions.selectOnExpand&&b(a).jqGrid("setSelection",
+l)}else if(b(this).hasClass("sgexpanded")){p=true;if(b.isFunction(a.p.subGridRowColapsed)){l=g.id;p=a.p.subGridRowColapsed.call(a,t+"_"+l,l)}if(p===false)return false;if(a.p.subGridOptions.reloadOnExpand===true)b(q).remove(".ui-subgrid");else b(q).hasClass("ui-subgrid")&&b(q).hide();b(this).html("<a href='javascript:void(0);'><span class='ui-icon "+a.p.subGridOptions.plusicon+"'></span></a>").removeClass("sgexpanded").addClass("sgcollapsed")}return false});a.p.subGridOptions.expandOnLoad===true&&
+b(a.rows[r].cells[f]).trigger("click");r++}a.subGridXml=function(g,j){s(g,j)};a.subGridJson=function(g,j){v(g,j)}}})},expandSubGridRow:function(f){return this.each(function(){if(this.grid||f)if(this.p.subGrid===true){var d=b(this).jqGrid("getInd",f,true);if(d)(d=b("td.sgcollapsed",d)[0])&&b(d).trigger("click")}})},collapseSubGridRow:function(f){return this.each(function(){if(this.grid||f)if(this.p.subGrid===true){var d=b(this).jqGrid("getInd",f,true);if(d)(d=b("td.sgexpanded",d)[0])&&b(d).trigger("click")}})},
+toggleSubGridRow:function(f){return this.each(function(){if(this.grid||f)if(this.p.subGrid===true){var d=b(this).jqGrid("getInd",f,true);if(d){var a=b("td.sgcollapsed",d)[0];if(a)b(a).trigger("click");else(a=b("td.sgexpanded",d)[0])&&b(a).trigger("click")}}})}})})(jQuery);
+(function(e){e.jgrid.extend({groupingSetup:function(){return this.each(function(){var a=this.p.groupingView;if(a!==null&&(typeof a==="object"||e.isFunction(a)))if(a.groupField.length){if(typeof a.visibiltyOnNextGrouping=="undefined")a.visibiltyOnNextGrouping=[];for(var c=0;c<a.groupField.length;c++){a.groupOrder[c]||(a.groupOrder[c]="asc");a.groupText[c]||(a.groupText[c]="{0}");if(typeof a.groupColumnShow[c]!="boolean")a.groupColumnShow[c]=true;if(typeof a.groupSummary[c]!="boolean")a.groupSummary[c]=
+false;if(a.groupColumnShow[c]===true){a.visibiltyOnNextGrouping[c]=true;e(this).jqGrid("showCol",a.groupField[c])}else{a.visibiltyOnNextGrouping[c]=e("#"+this.p.id+"_"+a.groupField[c]).is(":visible");e(this).jqGrid("hideCol",a.groupField[c])}a.sortitems[c]=[];a.sortnames[c]=[];a.summaryval[c]=[];if(a.groupSummary[c]){a.summary[c]=[];for(var b=this.p.colModel,d=0,g=b.length;d<g;d++)b[d].summaryType&&a.summary[c].push({nm:b[d].name,st:b[d].summaryType,v:""})}}this.p.scroll=false;this.p.rownumbers=false;
+this.p.subGrid=false;this.p.treeGrid=false;this.p.gridview=true}else this.p.grouping=false;else this.p.grouping=false})},groupingPrepare:function(a,c,b,d){this.each(function(){c[0]+="";var g=c[0].toString().split(" ").join(""),h=this.p.groupingView,f=this;if(b.hasOwnProperty(g))b[g].push(a);else{b[g]=[];b[g].push(a);h.sortitems[0].push(g);h.sortnames[0].push(e.trim(c[0].toString()));h.summaryval[0][g]=e.extend(true,[],h.summary[0])}h.groupSummary[0]&&e.each(h.summaryval[0][g],function(){this.v=e.isFunction(this.st)?
+this.st.call(f,this.v,this.nm,d):e(f).jqGrid("groupingCalculations."+this.st,this.v,this.nm,d)})});return b},groupingToggle:function(a){this.each(function(){var c=this.p.groupingView,b=a.lastIndexOf("_"),d=a.substring(0,b+1);b=parseInt(a.substring(b+1),10)+1;var g=c.minusicon,h=c.plusicon,f=e("#"+a);f=f.length?f[0].nextSibling:null;var k=e("#"+a+" span.tree-wrap-"+this.p.direction),l=false;if(k.hasClass(g)){if(c.showSummaryOnHide&&c.groupSummary[0]){if(f)for(;f;){if(e(f).hasClass("jqfoot"))break;
+e(f).hide();f=f.nextSibling}}else if(f)for(;f;){if(e(f).attr("id")==d+String(b))break;e(f).hide();f=f.nextSibling}k.removeClass(g).addClass(h);l=true}else{if(f)for(;f;){if(e(f).attr("id")==d+String(b))break;e(f).show();f=f.nextSibling}k.removeClass(h).addClass(g)}e.isFunction(this.p.onClickGroup)&&this.p.onClickGroup.call(this,a,l)});return false},groupingRender:function(a,c){return this.each(function(){var b=this,d=b.p.groupingView,g="",h="",f,k=d.groupCollapse?d.plusicon:d.minusicon,l,r,m;if(!d.groupDataSorted){d.sortitems[0].sort();
+d.sortnames[0].sort();if(d.groupOrder[0].toLowerCase()=="desc"){d.sortitems[0].reverse();d.sortnames[0].reverse()}}k+=" tree-wrap-"+b.p.direction;for(m=0;m<c;){if(b.p.colModel[m].name==d.groupField[0]){r=m;break}m++}e.each(d.sortitems[0],function(o,n){f=b.p.id+"ghead_"+o;h="<span style='cursor:pointer;' class='ui-icon "+k+"' onclick=\"jQuery('#"+b.p.id+"').jqGrid('groupingToggle','"+f+"');return false;\"></span>";try{l=b.formatter(f,d.sortnames[0][o],r,d.sortitems[0])}catch(v){l=d.sortnames[0][o]}g+=
+'<tr id="'+f+'" role="row" class= "ui-widget-content jqgroup ui-row-'+b.p.direction+'"><td colspan="'+c+'">'+h+e.jgrid.format(d.groupText[0],l,a[n].length)+"</td></tr>";for(var i=0;i<a[n].length;i++)g+=a[n][i].join("");if(d.groupSummary[0]){i="";if(d.groupCollapse&&!d.showSummaryOnHide)i=' style="display:none;"';g+="<tr"+i+' role="row" class="ui-widget-content jqfoot ui-row-'+b.p.direction+'">';i=d.summaryval[0][n];for(var p=b.p.colModel,q,s=a[n].length,j=0;j<c;j++){var t="<td "+b.formatCol(j,1,"")+
+">&#160;</td>",u="{0}";e.each(i,function(){if(this.nm==p[j].name){if(p[j].summaryTpl)u=p[j].summaryTpl;if(this.st=="avg")if(this.v&&s>0)this.v/=s;try{q=b.formatter("",this.v,j,this)}catch(w){q=this.v}t="<td "+b.formatCol(j,1,"")+">"+e.jgrid.format(u,q)+"</td>";return false}});g+=t}g+="</tr>"}});e("#"+b.p.id+" tbody:first").append(g);g=null})},groupingGroupBy:function(a,c){return this.each(function(){if(typeof a=="string")a=[a];var b=this.p.groupingView;this.p.grouping=true;if(typeof b.visibiltyOnNextGrouping==
+"undefined")b.visibiltyOnNextGrouping=[];var d;for(d=0;d<b.groupField.length;d++)!b.groupColumnShow[d]&&b.visibiltyOnNextGrouping[d]&&e(this).jqGrid("showCol",b.groupField[d]);for(d=0;d<a.length;d++)b.visibiltyOnNextGrouping[d]=e("#"+this.p.id+"_"+a[d]).is(":visible");this.p.groupingView=e.extend(this.p.groupingView,c||{});b.groupField=a;e(this).trigger("reloadGrid")})},groupingRemove:function(a){return this.each(function(){if(typeof a=="undefined")a=true;this.p.grouping=false;if(a===true){for(var c=
+this.p.groupingView,b=0;b<c.groupField.length;b++)!c.groupColumnShow[b]&&c.visibiltyOnNextGrouping[b]&&e(this).jqGrid("showCol",c.groupField);e("tr.jqgroup, tr.jqfoot","#"+this.p.id+" tbody:first").remove();e("tr.jqgrow:hidden","#"+this.p.id+" tbody:first").show()}else e(this).trigger("reloadGrid")})},groupingCalculations:{sum:function(a,c,b){return parseFloat(a||0)+parseFloat(b[c]||0)},min:function(a,c,b){if(a==="")return parseFloat(b[c]||0);return Math.min(parseFloat(a),parseFloat(b[c]||0))},max:function(a,
+c,b){if(a==="")return parseFloat(b[c]||0);return Math.max(parseFloat(a),parseFloat(b[c]||0))},count:function(a,c,b){if(a==="")a=0;return b.hasOwnProperty(c)?a+1:0},avg:function(a,c,b){return parseFloat(a||0)+parseFloat(b[c]||0)}}})})(jQuery);
+(function(d){d.jgrid.extend({setTreeNode:function(a,c){return this.each(function(){var b=this;if(b.grid&&b.p.treeGrid)for(var e=b.p.expColInd,g=b.p.treeReader.expanded_field,h=b.p.treeReader.leaf_field,f=b.p.treeReader.level_field,l=b.p.treeReader.icon_field,i=b.p.treeReader.loaded,j,o,n,k;a<c;){k=b.p.data[b.p._index[b.rows[a].id]];if(b.p.treeGridModel=="nested")if(!k[h]){j=parseInt(k[b.p.treeReader.left_field],10);o=parseInt(k[b.p.treeReader.right_field],10);k[h]=o===j+1?"true":"false";b.rows[a].cells[b.p._treeleafpos].innerHTML=
+k[h]}j=parseInt(k[f],10);if(b.p.tree_root_level===0){n=j+1;o=j}else{n=j;o=j-1}n="<div class='tree-wrap tree-wrap-"+b.p.direction+"' style='width:"+n*18+"px;'>";n+="<div style='"+(b.p.direction=="rtl"?"right:":"left:")+o*18+"px;' class='ui-icon ";if(k[i]!==undefined)k[i]=k[i]=="true"||k[i]===true?true:false;if(k[h]=="true"||k[h]===true){n+=(k[l]!==undefined&&k[l]!==""?k[l]:b.p.treeIcons.leaf)+" tree-leaf treeclick";k[h]=true;o="leaf"}else{k[h]=false;o=""}k[g]=(k[g]=="true"||k[g]===true?true:false)&&
+k[i];n+=k[g]===false?k[h]===true?"'":b.p.treeIcons.plus+" tree-plus treeclick'":k[h]===true?"'":b.p.treeIcons.minus+" tree-minus treeclick'";n+="></div></div>";d(b.rows[a].cells[e]).wrapInner("<span class='cell-wrapper"+o+"'></span>").prepend(n);if(j!==parseInt(b.p.tree_root_level,10))(k=(k=d(b).jqGrid("getNodeParent",k))&&k.hasOwnProperty(g)?k[g]:true)||d(b.rows[a]).css("display","none");d(b.rows[a].cells[e]).find("div.treeclick").bind("click",function(m){m=d(m.target||m.srcElement,b.rows).closest("tr.jqgrow")[0].id;
+m=b.p._index[m];if(!b.p.data[m][h])if(b.p.data[m][g]){d(b).jqGrid("collapseRow",b.p.data[m]);d(b).jqGrid("collapseNode",b.p.data[m])}else{d(b).jqGrid("expandRow",b.p.data[m]);d(b).jqGrid("expandNode",b.p.data[m])}return false});b.p.ExpandColClick===true&&d(b.rows[a].cells[e]).find("span.cell-wrapper").css("cursor","pointer").bind("click",function(m){m=d(m.target||m.srcElement,b.rows).closest("tr.jqgrow")[0].id;var r=b.p._index[m];if(!b.p.data[r][h])if(b.p.data[r][g]){d(b).jqGrid("collapseRow",b.p.data[r]);
+d(b).jqGrid("collapseNode",b.p.data[r])}else{d(b).jqGrid("expandRow",b.p.data[r]);d(b).jqGrid("expandNode",b.p.data[r])}d(b).jqGrid("setSelection",m);return false});a++}})},setTreeGrid:function(){return this.each(function(){var a=this,c=0,b=false,e,g,h=[];if(a.p.treeGrid){a.p.treedatatype||d.extend(a.p,{treedatatype:a.p.datatype});a.p.subGrid=false;a.p.altRows=false;a.p.pgbuttons=false;a.p.pginput=false;a.p.gridview=true;if(a.p.rowTotal===null)a.p.rowNum=1E4;a.p.multiselect=false;a.p.rowList=[];a.p.expColInd=
+0;a.p.treeIcons=d.extend({plus:"ui-icon-triangle-1-"+(a.p.direction=="rtl"?"w":"e"),minus:"ui-icon-triangle-1-s",leaf:"ui-icon-radio-off"},a.p.treeIcons||{});if(a.p.treeGridModel=="nested")a.p.treeReader=d.extend({level_field:"level",left_field:"lft",right_field:"rgt",leaf_field:"isLeaf",expanded_field:"expanded",loaded:"loaded",icon_field:"icon"},a.p.treeReader);else if(a.p.treeGridModel=="adjacency")a.p.treeReader=d.extend({level_field:"level",parent_id_field:"parent",leaf_field:"isLeaf",expanded_field:"expanded",
+loaded:"loaded",icon_field:"icon"},a.p.treeReader);for(g in a.p.colModel)if(a.p.colModel.hasOwnProperty(g)){e=a.p.colModel[g].name;if(e==a.p.ExpandColumn&&!b){b=true;a.p.expColInd=c}c++;for(var f in a.p.treeReader)a.p.treeReader[f]==e&&h.push(e)}d.each(a.p.treeReader,function(l,i){if(i&&d.inArray(i,h)===-1){if(l==="leaf_field")a.p._treeleafpos=c;c++;a.p.colNames.push(i);a.p.colModel.push({name:i,width:1,hidden:true,sortable:false,resizable:false,hidedlg:true,editable:true,search:false})}})}})},expandRow:function(a){this.each(function(){var c=
+this;if(c.grid&&c.p.treeGrid){var b=d(c).jqGrid("getNodeChildren",a),e=c.p.treeReader.expanded_field;d(b).each(function(){var g=d.jgrid.getAccessor(this,c.p.localReader.id);d("#"+g,c.grid.bDiv).css("display","");this[e]&&d(c).jqGrid("expandRow",this)})}})},collapseRow:function(a){this.each(function(){var c=this;if(c.grid&&c.p.treeGrid){var b=d(c).jqGrid("getNodeChildren",a),e=c.p.treeReader.expanded_field;d(b).each(function(){var g=d.jgrid.getAccessor(this,c.p.localReader.id);d("#"+g,c.grid.bDiv).css("display",
+"none");this[e]&&d(c).jqGrid("collapseRow",this)})}})},getRootNodes:function(){var a=[];this.each(function(){var c=this;if(c.grid&&c.p.treeGrid)switch(c.p.treeGridModel){case "nested":var b=c.p.treeReader.level_field;d(c.p.data).each(function(){parseInt(this[b],10)===parseInt(c.p.tree_root_level,10)&&a.push(this)});break;case "adjacency":var e=c.p.treeReader.parent_id_field;d(c.p.data).each(function(){if(this[e]===null||String(this[e]).toLowerCase()=="null")a.push(this)})}});return a},getNodeDepth:function(a){var c=
+null;this.each(function(){if(this.grid&&this.p.treeGrid)switch(this.p.treeGridModel){case "nested":c=parseInt(a[this.p.treeReader.level_field],10)-parseInt(this.p.tree_root_level,10);break;case "adjacency":c=d(this).jqGrid("getNodeAncestors",a).length}});return c},getNodeParent:function(a){var c=null;this.each(function(){if(this.grid&&this.p.treeGrid)switch(this.p.treeGridModel){case "nested":var b=this.p.treeReader.left_field,e=this.p.treeReader.right_field,g=this.p.treeReader.level_field,h=parseInt(a[b],
+10),f=parseInt(a[e],10),l=parseInt(a[g],10);d(this.p.data).each(function(){if(parseInt(this[g],10)===l-1&&parseInt(this[b],10)<h&&parseInt(this[e],10)>f){c=this;return false}});break;case "adjacency":var i=this.p.treeReader.parent_id_field,j=this.p.localReader.id;d(this.p.data).each(function(){if(this[j]==a[i]){c=this;return false}})}});return c},getNodeChildren:function(a){var c=[];this.each(function(){if(this.grid&&this.p.treeGrid)switch(this.p.treeGridModel){case "nested":var b=this.p.treeReader.left_field,
+e=this.p.treeReader.right_field,g=this.p.treeReader.level_field,h=parseInt(a[b],10),f=parseInt(a[e],10),l=parseInt(a[g],10);d(this.p.data).each(function(){parseInt(this[g],10)===l+1&&parseInt(this[b],10)>h&&parseInt(this[e],10)<f&&c.push(this)});break;case "adjacency":var i=this.p.treeReader.parent_id_field,j=this.p.localReader.id;d(this.p.data).each(function(){this[i]==a[j]&&c.push(this)})}});return c},getFullTreeNode:function(a){var c=[];this.each(function(){var b;if(this.grid&&this.p.treeGrid)switch(this.p.treeGridModel){case "nested":var e=
+this.p.treeReader.left_field,g=this.p.treeReader.right_field,h=this.p.treeReader.level_field,f=parseInt(a[e],10),l=parseInt(a[g],10),i=parseInt(a[h],10);d(this.p.data).each(function(){parseInt(this[h],10)>=i&&parseInt(this[e],10)>=f&&parseInt(this[e],10)<=l&&c.push(this)});break;case "adjacency":if(a){c.push(a);var j=this.p.treeReader.parent_id_field,o=this.p.localReader.id;d(this.p.data).each(function(n){b=c.length;for(n=0;n<b;n++)if(c[n][o]==this[j]){c.push(this);break}})}}});return c},getNodeAncestors:function(a){var c=
+[];this.each(function(){if(this.grid&&this.p.treeGrid)for(var b=d(this).jqGrid("getNodeParent",a);b;){c.push(b);b=d(this).jqGrid("getNodeParent",b)}});return c},isVisibleNode:function(a){var c=true;this.each(function(){if(this.grid&&this.p.treeGrid){var b=d(this).jqGrid("getNodeAncestors",a),e=this.p.treeReader.expanded_field;d(b).each(function(){c=c&&this[e];if(!c)return false})}});return c},isNodeLoaded:function(a){var c;this.each(function(){if(this.grid&&this.p.treeGrid){var b=this.p.treeReader.leaf_field;
+c=a!==undefined?a.loaded!==undefined?a.loaded:a[b]||d(this).jqGrid("getNodeChildren",a).length>0?true:false:false}});return c},expandNode:function(a){return this.each(function(){if(this.grid&&this.p.treeGrid){var c=this.p.treeReader.expanded_field,b=this.p.treeReader.parent_id_field,e=this.p.treeReader.loaded,g=this.p.treeReader.level_field,h=this.p.treeReader.left_field,f=this.p.treeReader.right_field;if(!a[c]){var l=d.jgrid.getAccessor(a,this.p.localReader.id),i=d("#"+l,this.grid.bDiv)[0],j=this.p._index[l];
+if(d(this).jqGrid("isNodeLoaded",this.p.data[j])){a[c]=true;d("div.treeclick",i).removeClass(this.p.treeIcons.plus+" tree-plus").addClass(this.p.treeIcons.minus+" tree-minus")}else{a[c]=true;d("div.treeclick",i).removeClass(this.p.treeIcons.plus+" tree-plus").addClass(this.p.treeIcons.minus+" tree-minus");this.p.treeANode=i.rowIndex;this.p.datatype=this.p.treedatatype;this.p.treeGridModel=="nested"?d(this).jqGrid("setGridParam",{postData:{nodeid:l,n_left:a[h],n_right:a[f],n_level:a[g]}}):d(this).jqGrid("setGridParam",
+{postData:{nodeid:l,parentid:a[b],n_level:a[g]}});d(this).trigger("reloadGrid");a[e]=true;this.p.treeGridModel=="nested"?d(this).jqGrid("setGridParam",{postData:{nodeid:"",n_left:"",n_right:"",n_level:""}}):d(this).jqGrid("setGridParam",{postData:{nodeid:"",parentid:"",n_level:""}})}}}})},collapseNode:function(a){return this.each(function(){if(this.grid&&this.p.treeGrid)if(a.expanded){a.expanded=false;var c=d.jgrid.getAccessor(a,this.p.localReader.id);c=d("#"+c,this.grid.bDiv)[0];d("div.treeclick",
+c).removeClass(this.p.treeIcons.minus+" tree-minus").addClass(this.p.treeIcons.plus+" tree-plus")}})},SortTree:function(a,c,b,e){return this.each(function(){if(this.grid&&this.p.treeGrid){var g,h,f,l=[],i=this,j;g=d(this).jqGrid("getRootNodes");g=d.jgrid.from(g);g.orderBy(a,c,b,e);j=g.select();g=0;for(h=j.length;g<h;g++){f=j[g];l.push(f);d(this).jqGrid("collectChildrenSortTree",l,f,a,c,b,e)}d.each(l,function(o){var n=d.jgrid.getAccessor(this,i.p.localReader.id);d("#"+i.p.id+" tbody tr:eq("+o+")").after(d("tr#"+
+n,i.grid.bDiv))});l=j=g=null}})},collectChildrenSortTree:function(a,c,b,e,g,h){return this.each(function(){if(this.grid&&this.p.treeGrid){var f,l,i,j;f=d(this).jqGrid("getNodeChildren",c);f=d.jgrid.from(f);f.orderBy(b,e,g,h);j=f.select();f=0;for(l=j.length;f<l;f++){i=j[f];a.push(i);d(this).jqGrid("collectChildrenSortTree",a,i,b,e,g,h)}}})},setTreeRow:function(a,c){var b=false;this.each(function(){if(this.grid&&this.p.treeGrid)b=d(this).jqGrid("setRowData",a,c)});return b},delTreeNode:function(a){return this.each(function(){var c=
+this.p.localReader.id,b=this.p.treeReader.left_field,e=this.p.treeReader.right_field,g,h,f;if(this.grid&&this.p.treeGrid){var l=this.p._index[a];if(l!==undefined){g=parseInt(this.p.data[l][e],10);h=g-parseInt(this.p.data[l][b],10)+1;l=d(this).jqGrid("getFullTreeNode",this.p.data[l]);if(l.length>0)for(var i=0;i<l.length;i++)d(this).jqGrid("delRowData",l[i][c]);if(this.p.treeGridModel==="nested"){c=d.jgrid.from(this.p.data).greater(b,g,{stype:"integer"}).select();if(c.length)for(f in c)c[f][b]=parseInt(c[f][b],
+10)-h;c=d.jgrid.from(this.p.data).greater(e,g,{stype:"integer"}).select();if(c.length)for(f in c)c[f][e]=parseInt(c[f][e],10)-h}}}})},addChildNode:function(a,c,b){var e=this[0];if(b){var g=e.p.treeReader.expanded_field,h=e.p.treeReader.leaf_field,f=e.p.treeReader.level_field,l=e.p.treeReader.parent_id_field,i=e.p.treeReader.left_field,j=e.p.treeReader.right_field,o=e.p.treeReader.loaded,n,k,m,r,p;n=0;var s=c,t;if(!a){p=e.p.data.length-1;if(p>=0)for(;p>=0;){n=Math.max(n,parseInt(e.p.data[p][e.p.localReader.id],
+10));p--}a=n+1}var u=d(e).jqGrid("getInd",c);t=false;if(c===undefined||c===null||c===""){s=c=null;n="last";r=e.p.tree_root_level;p=e.p.data.length+1}else{n="after";k=e.p._index[c];m=e.p.data[k];c=m[e.p.localReader.id];r=parseInt(m[f],10)+1;p=d(e).jqGrid("getFullTreeNode",m);if(p.length){s=p=p[p.length-1][e.p.localReader.id];p=d(e).jqGrid("getInd",s)+1}else p=d(e).jqGrid("getInd",c)+1;if(m[h]){t=true;m[g]=true;d(e.rows[u]).find("span.cell-wrapperleaf").removeClass("cell-wrapperleaf").addClass("cell-wrapper").end().find("div.tree-leaf").removeClass(e.p.treeIcons.leaf+
+" tree-leaf").addClass(e.p.treeIcons.minus+" tree-minus");e.p.data[k][h]=false;m[o]=true}}k=p+1;b[g]=false;b[o]=true;b[f]=r;b[h]=true;if(e.p.treeGridModel==="adjacency")b[l]=c;if(e.p.treeGridModel==="nested"){var q;if(c!==null){h=parseInt(m[j],10);f=d.jgrid.from(e.p.data);f=f.greaterOrEquals(j,h,{stype:"integer"});f=f.select();if(f.length)for(q in f){f[q][i]=f[q][i]>h?parseInt(f[q][i],10)+2:f[q][i];f[q][j]=f[q][j]>=h?parseInt(f[q][j],10)+2:f[q][j]}b[i]=h;b[j]=h+1}else{h=parseInt(d(e).jqGrid("getCol",
+j,false,"max"),10);f=d.jgrid.from(e.p.data).greater(i,h,{stype:"integer"}).select();if(f.length)for(q in f)f[q][i]=parseInt(f[q][i],10)+2;f=d.jgrid.from(e.p.data).greater(j,h,{stype:"integer"}).select();if(f.length)for(q in f)f[q][j]=parseInt(f[q][j],10)+2;b[i]=h+1;b[j]=h+2}}if(c===null||d(e).jqGrid("isNodeLoaded",m)||t){d(e).jqGrid("addRowData",a,b,n,s);d(e).jqGrid("setTreeNode",p,k)}m&&!m[g]&&d(e.rows[u]).find("div.treeclick").click()}}})})(jQuery);
+(function(b){b.jgrid.extend({jqGridImport:function(a){a=b.extend({imptype:"xml",impstring:"",impurl:"",mtype:"GET",impData:{},xmlGrid:{config:"roots>grid",data:"roots>rows"},jsonGrid:{config:"grid",data:"data"},ajaxOptions:{}},a||{});return this.each(function(){var d=this,c=function(f,g){var e=b(g.xmlGrid.config,f)[0],h=b(g.xmlGrid.data,f)[0],i;if(xmlJsonClass.xml2json&&b.jgrid.parse){e=xmlJsonClass.xml2json(e," ");e=b.jgrid.parse(e);for(var l in e)if(e.hasOwnProperty(l))i=e[l];if(h){h=e.grid.datatype;
+e.grid.datatype="xmlstring";e.grid.datastr=f;b(d).jqGrid(i).jqGrid("setGridParam",{datatype:h})}else b(d).jqGrid(i)}else alert("xml2json or parse are not present")},j=function(f,g){if(f&&typeof f=="string"){var e=b.jgrid.parse(f),h=e[g.jsonGrid.config];if(e=e[g.jsonGrid.data]){var i=h.datatype;h.datatype="jsonstring";h.datastr=e;b(d).jqGrid(h).jqGrid("setGridParam",{datatype:i})}else b(d).jqGrid(h)}};switch(a.imptype){case "xml":b.ajax(b.extend({url:a.impurl,type:a.mtype,data:a.impData,dataType:"xml",
+complete:function(f,g){if(g=="success"){c(f.responseXML,a);b.isFunction(a.importComplete)&&a.importComplete(f)}}},a.ajaxOptions));break;case "xmlstring":if(a.impstring&&typeof a.impstring=="string"){var k=b.jgrid.stringToDoc(a.impstring);if(k){c(k,a);b.isFunction(a.importComplete)&&a.importComplete(k);a.impstring=null}k=null}break;case "json":b.ajax(b.extend({url:a.impurl,type:a.mtype,data:a.impData,dataType:"json",complete:function(f,g){if(g=="success"){j(f.responseText,a);b.isFunction(a.importComplete)&&
+a.importComplete(f)}}},a.ajaxOptions));break;case "jsonstring":if(a.impstring&&typeof a.impstring=="string"){j(a.impstring,a);b.isFunction(a.importComplete)&&a.importComplete(a.impstring);a.impstring=null}}})},jqGridExport:function(a){a=b.extend({exptype:"xmlstring",root:"grid",ident:"\t"},a||{});var d=null;this.each(function(){if(this.grid){var c=b.extend({},b(this).jqGrid("getGridParam"));if(c.rownumbers){c.colNames.splice(0,1);c.colModel.splice(0,1)}if(c.multiselect){c.colNames.splice(0,1);c.colModel.splice(0,
+1)}if(c.subGrid){c.colNames.splice(0,1);c.colModel.splice(0,1)}c.knv=null;if(c.treeGrid)for(var j in c.treeReader)if(c.treeReader.hasOwnProperty(j)){c.colNames.splice(c.colNames.length-1);c.colModel.splice(c.colModel.length-1)}switch(a.exptype){case "xmlstring":d="<"+a.root+">"+xmlJsonClass.json2xml(c,a.ident)+"</"+a.root+">";break;case "jsonstring":d="{"+xmlJsonClass.toJson(c,a.root,a.ident,false)+"}";if(c.postData.filters!==undefined){d=d.replace(/filters":"/,'filters":');d=d.replace(/}]}"/,"}]}")}}}});
+return d},excelExport:function(a){a=b.extend({exptype:"remote",url:null,oper:"oper",tag:"excel",exportOptions:{}},a||{});return this.each(function(){if(this.grid){var d;if(a.exptype=="remote"){d=b.extend({},this.p.postData);d[a.oper]=a.tag;d=jQuery.param(d);d=a.url.indexOf("?")!=-1?a.url+"&"+d:a.url+"?"+d;window.location=d}}})}})})(jQuery);
+var xmlJsonClass={xml2json:function(a,b){if(a.nodeType===9)a=a.documentElement;var h=this.toJson(this.toObj(this.removeWhite(a)),a.nodeName,"\t");return"{\n"+b+(b?h.replace(/\t/g,b):h.replace(/\t|\n/g,""))+"\n}"},json2xml:function(a,b){var h=function(d,c,i){var g="",k,j;if(d instanceof Array)if(d.length===0)g+=i+"<"+c+">__EMPTY_ARRAY_</"+c+">\n";else{k=0;for(j=d.length;k<j;k+=1){var l=i+h(d[k],c,i+"\t")+"\n";g+=l}}else if(typeof d==="object"){k=false;g+=i+"<"+c;for(j in d)if(d.hasOwnProperty(j))if(j.charAt(0)===
+"@")g+=" "+j.substr(1)+'="'+d[j].toString()+'"';else k=true;g+=k?">":"/>";if(k){for(j in d)if(d.hasOwnProperty(j))if(j==="#text")g+=d[j];else if(j==="#cdata")g+="<![CDATA["+d[j]+"]]\>";else if(j.charAt(0)!=="@")g+=h(d[j],j,i+"\t");g+=(g.charAt(g.length-1)==="\n"?i:"")+"</"+c+">"}}else if(typeof d==="function")g+=i+"<"+c+"><![CDATA["+d+"]]\></"+c+">";else{if(d===undefined)d="";g+=d.toString()==='""'||d.toString().length===0?i+"<"+c+">__EMPTY_STRING_</"+c+">":i+"<"+c+">"+d.toString()+"</"+c+">"}return g},
+e="",f;for(f in a)if(a.hasOwnProperty(f))e+=h(a[f],f,"");return b?e.replace(/\t/g,b):e.replace(/\t|\n/g,"")},toObj:function(a){var b={},h=/function/i;if(a.nodeType===1){if(a.attributes.length){var e;for(e=0;e<a.attributes.length;e+=1)b["@"+a.attributes[e].nodeName]=(a.attributes[e].nodeValue||"").toString()}if(a.firstChild){var f=e=0,d=false,c;for(c=a.firstChild;c;c=c.nextSibling)if(c.nodeType===1)d=true;else if(c.nodeType===3&&c.nodeValue.match(/[^ \f\n\r\t\v]/))e+=1;else if(c.nodeType===4)f+=1;
+if(d)if(e<2&&f<2){this.removeWhite(a);for(c=a.firstChild;c;c=c.nextSibling)if(c.nodeType===3)b["#text"]=this.escape(c.nodeValue);else if(c.nodeType===4)if(h.test(c.nodeValue))b[c.nodeName]=[b[c.nodeName],c.nodeValue];else b["#cdata"]=this.escape(c.nodeValue);else if(b[c.nodeName])if(b[c.nodeName]instanceof Array)b[c.nodeName][b[c.nodeName].length]=this.toObj(c);else b[c.nodeName]=[b[c.nodeName],this.toObj(c)];else b[c.nodeName]=this.toObj(c)}else if(a.attributes.length)b["#text"]=this.escape(this.innerXml(a));
+else b=this.escape(this.innerXml(a));else if(e)if(a.attributes.length)b["#text"]=this.escape(this.innerXml(a));else{b=this.escape(this.innerXml(a));if(b==="__EMPTY_ARRAY_")b="[]";else if(b==="__EMPTY_STRING_")b=""}else if(f)if(f>1)b=this.escape(this.innerXml(a));else for(c=a.firstChild;c;c=c.nextSibling)if(h.test(a.firstChild.nodeValue)){b=a.firstChild.nodeValue;break}else b["#cdata"]=this.escape(c.nodeValue)}if(!a.attributes.length&&!a.firstChild)b=null}else if(a.nodeType===9)b=this.toObj(a.documentElement);
+else alert("unhandled node type: "+a.nodeType);return b},toJson:function(a,b,h,e){if(e===undefined)e=true;var f=b?'"'+b+'"':"",d="\t",c="\n";if(!e)c=d="";if(a==="[]")f+=b?":[]":"[]";else if(a instanceof Array){var i,g,k=[];g=0;for(i=a.length;g<i;g+=1)k[g]=this.toJson(a[g],"",h+d,e);f+=(b?":[":"[")+(k.length>1?c+h+d+k.join(","+c+h+d)+c+h:k.join(""))+"]"}else if(a===null)f+=(b&&":")+"null";else if(typeof a==="object"){i=[];for(g in a)if(a.hasOwnProperty(g))i[i.length]=this.toJson(a[g],g,h+d,e);f+=(b?
+":{":"{")+(i.length>1?c+h+d+i.join(","+c+h+d)+c+h:i.join(""))+"}"}else f+=typeof a==="string"?(b&&":")+'"'+a.replace(/\\/g,"\\\\").replace(/\"/g,'\\"')+'"':(b&&":")+'"'+a.toString()+'"';return f},innerXml:function(a){var b="";if("innerHTML"in a)b=a.innerHTML;else{var h=function(e){var f="",d;if(e.nodeType===1){f+="<"+e.nodeName;for(d=0;d<e.attributes.length;d+=1)f+=" "+e.attributes[d].nodeName+'="'+(e.attributes[d].nodeValue||"").toString()+'"';if(e.firstChild){f+=">";for(d=e.firstChild;d;d=d.nextSibling)f+=
+h(d);f+="</"+e.nodeName+">"}else f+="/>"}else if(e.nodeType===3)f+=e.nodeValue;else if(e.nodeType===4)f+="<![CDATA["+e.nodeValue+"]]\>";return f};for(a=a.firstChild;a;a=a.nextSibling)b+=h(a)}return b},escape:function(a){return a.replace(/[\\]/g,"\\\\").replace(/[\"]/g,'\\"').replace(/[\n]/g,"\\n").replace(/[\r]/g,"\\r")},removeWhite:function(a){a.normalize();var b;for(b=a.firstChild;b;)if(b.nodeType===3)if(b.nodeValue.match(/[^ \f\n\r\t\v]/))b=b.nextSibling;else{var h=b.nextSibling;a.removeChild(b);
+b=h}else{b.nodeType===1&&this.removeWhite(b);b=b.nextSibling}return a}};
+function tableToGrid(n,o){jQuery(n).each(function(){if(!this.grid){jQuery(this).width("99%");var a=jQuery(this).width(),d=jQuery("tr td:first-child input[type=checkbox]:first",jQuery(this)),b=jQuery("tr td:first-child input[type=radio]:first",jQuery(this));d=d.length>0;b=!d&&b.length>0;var l=d||b,c=[],g=[];jQuery("th",jQuery(this)).each(function(){if(c.length===0&&l){c.push({name:"__selection__",index:"__selection__",width:0,hidden:true});g.push("__selection__")}else{c.push({name:jQuery(this).attr("id")||
+jQuery.trim(jQuery.jgrid.stripHtml(jQuery(this).html())).split(" ").join("_"),index:jQuery(this).attr("id")||jQuery.trim(jQuery.jgrid.stripHtml(jQuery(this).html())).split(" ").join("_"),width:jQuery(this).width()||150});g.push(jQuery(this).html())}});var f=[],h=[],i=[];jQuery("tbody > tr",jQuery(this)).each(function(){var j={},e=0;jQuery("td",jQuery(this)).each(function(){if(e===0&&l){var k=jQuery("input",jQuery(this)),m=k.attr("value");h.push(m||f.length);k.is(":checked")&&i.push(m);j[c[e].name]=
+k.attr("value")}else j[c[e].name]=jQuery(this).html();e++});e>0&&f.push(j)});jQuery(this).empty();jQuery(this).addClass("scroll");jQuery(this).jqGrid(jQuery.extend({datatype:"local",width:a,colNames:g,colModel:c,multiselect:d},o||{}));for(a=0;a<f.length;a++){b=null;if(h.length>0)if((b=h[a])&&b.replace)b=encodeURIComponent(b).replace(/[.\-%]/g,"_");if(b===null)b=a+1;jQuery(this).jqGrid("addRowData",b,f[a])}for(a=0;a<i.length;a++)jQuery(this).jqGrid("setSelection",i[a])}})};
+(function(a){if(a.browser.msie&&a.browser.version==8)a.expr[":"].hidden=function(b){return b.offsetWidth===0||b.offsetHeight===0||b.style.display=="none"};a.jgrid._multiselect=false;if(a.ui)if(a.ui.multiselect){if(a.ui.multiselect.prototype._setSelected){var q=a.ui.multiselect.prototype._setSelected;a.ui.multiselect.prototype._setSelected=function(b,g){var c=q.call(this,b,g);if(g&&this.selectedList){var f=this.element;this.selectedList.find("li").each(function(){a(this).data("optionLink")&&a(this).data("optionLink").remove().appendTo(f)})}return c}}if(a.ui.multiselect.prototype.destroy)a.ui.multiselect.prototype.destroy=
+function(){this.element.show();this.container.remove();a.Widget===undefined?a.widget.prototype.destroy.apply(this,arguments):a.Widget.prototype.destroy.apply(this,arguments)};a.jgrid._multiselect=true}a.jgrid.extend({sortableColumns:function(b){return this.each(function(){function g(){c.p.disableClick=true}var c=this,f=c.p.id;f={tolerance:"pointer",axis:"x",scrollSensitivity:"1",items:">th:not(:has(#jqgh_"+f+"_cb,#jqgh_"+f+"_rn,#jqgh_"+f+"_subgrid),:hidden)",placeholder:{element:function(h){return a(document.createElement(h[0].nodeName)).addClass(h[0].className+
+" ui-sortable-placeholder ui-state-highlight").removeClass("ui-sortable-helper")[0]},update:function(h,j){j.height(h.currentItem.innerHeight()-parseInt(h.currentItem.css("paddingTop")||0,10)-parseInt(h.currentItem.css("paddingBottom")||0,10));j.width(h.currentItem.innerWidth()-parseInt(h.currentItem.css("paddingLeft")||0,10)-parseInt(h.currentItem.css("paddingRight")||0,10))}},update:function(h,j){var i=a(j.item).parent();i=a(">th",i);var l={},m=c.p.id+"_";a.each(c.p.colModel,function(k){l[this.name]=
+k});var d=[];i.each(function(){var k=a(">div",this).get(0).id.replace(/^jqgh_/,"").replace(m,"");k in l&&d.push(l[k])});a(c).jqGrid("remapColumns",d,true,true);a.isFunction(c.p.sortable.update)&&c.p.sortable.update(d);setTimeout(function(){c.p.disableClick=false},50)}};if(c.p.sortable.options)a.extend(f,c.p.sortable.options);else if(a.isFunction(c.p.sortable))c.p.sortable={update:c.p.sortable};if(f.start){var e=f.start;f.start=function(h,j){g();e.call(this,h,j)}}else f.start=g;if(c.p.sortable.exclude)f.items+=
+":not("+c.p.sortable.exclude+")";b.sortable(f).data("sortable").floating=true})},columnChooser:function(b){function g(d,k){if(d)if(typeof d=="string")a.fn[d]&&a.fn[d].apply(k,a.makeArray(arguments).slice(2));else a.isFunction(d)&&d.apply(k,a.makeArray(arguments).slice(2))}var c=this;if(!a("#colchooser_"+c[0].p.id).length){var f=a('<div id="colchooser_'+c[0].p.id+'" style="position:relative;overflow:hidden"><div><select multiple="multiple"></select></div></div>'),e=a("select",f);b=a.extend({width:420,
+height:240,classname:null,done:function(d){d&&c.jqGrid("remapColumns",d,true)},msel:"multiselect",dlog:"dialog",dlog_opts:function(d){var k={};k[d.bSubmit]=function(){d.apply_perm();d.cleanup(false)};k[d.bCancel]=function(){d.cleanup(true)};return{buttons:k,close:function(){d.cleanup(true)},modal:d.modal?d.modal:false,resizable:d.resizable?d.resizable:true,width:d.width+20}},apply_perm:function(){a("option",e).each(function(){this.selected?c.jqGrid("showCol",h[this.value].name):c.jqGrid("hideCol",
+h[this.value].name)});var d=[];a("option:selected",e).each(function(){d.push(parseInt(this.value,10))});a.each(d,function(){delete i[h[parseInt(this,10)].name]});a.each(i,function(){var k=parseInt(this,10);var p=d,o=k;if(o>=0){var n=p.slice(),r=n.splice(o,Math.max(p.length-o,o));if(o>p.length)o=p.length;n[o]=k;d=n.concat(r)}else d=void 0});b.done&&b.done.call(c,d)},cleanup:function(d){g(b.dlog,f,"destroy");g(b.msel,e,"destroy");f.remove();d&&b.done&&b.done.call(c)},msel_opts:{}},a.jgrid.col,b||{});
+if(a.ui)if(a.ui.multiselect)if(b.msel=="multiselect"){if(!a.jgrid._multiselect){alert("Multiselect plugin loaded after jqGrid. Please load the plugin before the jqGrid!");return}b.msel_opts=a.extend(a.ui.multiselect.defaults,b.msel_opts)}b.caption&&f.attr("title",b.caption);if(b.classname){f.addClass(b.classname);e.addClass(b.classname)}if(b.width){a(">div",f).css({width:b.width,margin:"0 auto"});e.css("width",b.width)}if(b.height){a(">div",f).css("height",b.height);e.css("height",b.height-10)}var h=
+c.jqGrid("getGridParam","colModel"),j=c.jqGrid("getGridParam","colNames"),i={},l=[];e.empty();a.each(h,function(d){i[this.name]=d;if(this.hidedlg)this.hidden||l.push(d);else e.append("<option value='"+d+"' "+(this.hidden?"":"selected='selected'")+">"+j[d]+"</option>")});var m=a.isFunction(b.dlog_opts)?b.dlog_opts.call(c,b):b.dlog_opts;g(b.dlog,f,m);m=a.isFunction(b.msel_opts)?b.msel_opts.call(c,b):b.msel_opts;g(b.msel,e,m)}},sortableRows:function(b){return this.each(function(){var g=this;if(g.grid)if(!g.p.treeGrid)if(a.fn.sortable){b=
+a.extend({cursor:"move",axis:"y",items:".jqgrow"},b||{});if(b.start&&a.isFunction(b.start)){b._start_=b.start;delete b.start}else b._start_=false;if(b.update&&a.isFunction(b.update)){b._update_=b.update;delete b.update}else b._update_=false;b.start=function(c,f){a(f.item).css("border-width","0px");a("td",f.item).each(function(j){this.style.width=g.grid.cols[j].style.width});if(g.p.subGrid){var e=a(f.item).attr("id");try{a(g).jqGrid("collapseSubGridRow",e)}catch(h){}}b._start_&&b._start_.apply(this,
+[c,f])};b.update=function(c,f){a(f.item).css("border-width","");g.p.rownumbers===true&&a("td.jqgrid-rownum",g.rows).each(function(e){a(this).html(e+1+(parseInt(g.p.page,10)-1)*parseInt(g.p.rowNum,10))});b._update_&&b._update_.apply(this,[c,f])};a("tbody:first",g).sortable(b);a("tbody:first",g).disableSelection()}})},gridDnD:function(b){return this.each(function(){function g(){var e=a.data(c,"dnd");a("tr.jqgrow:not(.ui-draggable)",c).draggable(a.isFunction(e.drag)?e.drag.call(a(c),e):e.drag)}var c=
+this;if(c.grid)if(!c.p.treeGrid)if(a.fn.draggable&&a.fn.droppable){a("#jqgrid_dnd").html()===null&&a("body").append("<table id='jqgrid_dnd' class='ui-jqgrid-dnd'></table>");if(typeof b=="string"&&b=="updateDnD"&&c.p.jqgdnd===true)g();else{b=a.extend({drag:function(e){return a.extend({start:function(h,j){if(c.p.subGrid){var i=a(j.helper).attr("id");try{a(c).jqGrid("collapseSubGridRow",i)}catch(l){}}for(i=0;i<a.data(c,"dnd").connectWith.length;i++)a(a.data(c,"dnd").connectWith[i]).jqGrid("getGridParam",
+"reccount")=="0"&&a(a.data(c,"dnd").connectWith[i]).jqGrid("addRowData","jqg_empty_row",{});j.helper.addClass("ui-state-highlight");a("td",j.helper).each(function(m){this.style.width=c.grid.headers[m].width+"px"});e.onstart&&a.isFunction(e.onstart)&&e.onstart.call(a(c),h,j)},stop:function(h,j){if(j.helper.dropped&&!e.dragcopy){var i=a(j.helper).attr("id");a(c).jqGrid("delRowData",i)}for(i=0;i<a.data(c,"dnd").connectWith.length;i++)a(a.data(c,"dnd").connectWith[i]).jqGrid("delRowData","jqg_empty_row");
+e.onstop&&a.isFunction(e.onstop)&&e.onstop.call(a(c),h,j)}},e.drag_opts||{})},drop:function(e){return a.extend({accept:function(h){if(!a(h).hasClass("jqgrow"))return h;var j=a(h).closest("table.ui-jqgrid-btable");if(j.length>0&&a.data(j[0],"dnd")!==undefined){h=a.data(j[0],"dnd").connectWith;return a.inArray("#"+this.id,h)!=-1?true:false}return h},drop:function(h,j){if(a(j.draggable).hasClass("jqgrow")){var i=a(j.draggable).attr("id");i=j.draggable.parent().parent().jqGrid("getRowData",i);if(!e.dropbyname){var l=
+0,m={},d,k=a("#"+this.id).jqGrid("getGridParam","colModel");try{for(var p in i){if(i.hasOwnProperty(p)&&k[l]){d=k[l].name;m[d]=i[p]}l++}i=m}catch(o){}}j.helper.dropped=true;if(e.beforedrop&&a.isFunction(e.beforedrop)){d=e.beforedrop.call(this,h,j,i,a("#"+c.id),a(this));if(typeof d!="undefined"&&d!==null&&typeof d=="object")i=d}if(j.helper.dropped){var n;if(e.autoid)if(a.isFunction(e.autoid))n=e.autoid.call(this,i);else{n=Math.ceil(Math.random()*1E3);n=e.autoidprefix+n}a("#"+this.id).jqGrid("addRowData",
+n,i,e.droppos)}e.ondrop&&a.isFunction(e.ondrop)&&e.ondrop.call(this,h,j,i)}}},e.drop_opts||{})},onstart:null,onstop:null,beforedrop:null,ondrop:null,drop_opts:{activeClass:"ui-state-active",hoverClass:"ui-state-hover"},drag_opts:{revert:"invalid",helper:"clone",cursor:"move",appendTo:"#jqgrid_dnd",zIndex:5E3},dragcopy:false,dropbyname:false,droppos:"first",autoid:true,autoidprefix:"dnd_"},b||{});if(b.connectWith){b.connectWith=b.connectWith.split(",");b.connectWith=a.map(b.connectWith,function(e){return a.trim(e)});
+a.data(c,"dnd",b);c.p.reccount!="0"&&!c.p.jqgdnd&&g();c.p.jqgdnd=true;for(var f=0;f<b.connectWith.length;f++)a(b.connectWith[f]).droppable(a.isFunction(b.drop)?b.drop.call(a(c),b):b.drop)}}}})},gridResize:function(b){return this.each(function(){var g=this;if(g.grid&&a.fn.resizable){b=a.extend({},b||{});if(b.alsoResize){b._alsoResize_=b.alsoResize;delete b.alsoResize}else b._alsoResize_=false;if(b.stop&&a.isFunction(b.stop)){b._stop_=b.stop;delete b.stop}else b._stop_=false;b.stop=function(c,f){a(g).jqGrid("setGridParam",
+{height:a("#gview_"+g.p.id+" .ui-jqgrid-bdiv").height()});a(g).jqGrid("setGridWidth",f.size.width,b.shrinkToFit);b._stop_&&b._stop_.call(g,c,f)};b.alsoResize=b._alsoResize_?eval("("+("{'#gview_"+g.p.id+" .ui-jqgrid-bdiv':true,'"+b._alsoResize_+"':true}")+")"):a(".ui-jqgrid-bdiv","#gview_"+g.p.id);delete b._alsoResize_;a("#gbox_"+g.p.id).resizable(b)}})}})})(jQuery);
Index: controlies/trunk/applications/controlies/modules/Groups.py
===================================================================
--- controlies/trunk/applications/controlies/modules/Groups.py	(revision 240)
+++ controlies/trunk/applications/controlies/modules/Groups.py	(revision 241)
@@ -152,6 +152,61 @@
 		return { "page":page, "total":totalPages, "records":len(search), "rows":result[start:finish] }
 		
 
+    def listUsers(self,args):
+		from applications.controlies.modules.Users import Users
+		
+		# grid parameters
+		limit = int(args['rows'])
+		page = int(args['page'])
+		start = limit * page - limit
+		finish = start + limit;				
+
+		# sort by field
+		sortBy = args['sidx']
+		if sortBy == "cn":
+			sortBy = "id"
+
+		# reverse Sort
+		reverseSort = False
+		if args['sord']== "asc":
+			reverseSort = True
+
+		groupData = self.getGroupData()
+
+		rows = []
+		for i in groupData["memberuid"]:
+			u = Users(self.ldap,"","","","",i,"","","","")
+			userData = u.getUserData()
+
+			row = {
+				"id":userData["user"], 
+				"cell":[userData["name"],userData["user"],userData["nif"]],
+				"cn": userData["name"],
+				"uid": userData["user"],
+				"employeeNumber": userData["nif"]
+			}
+			rows.append(row)			
+								
+			
+		if len(rows) > 0:
+			totalPages = floor( len(rows) / int(limit) )
+			module = len(rows) % int(limit)
+
+			if module > 0:
+				totalPages = totalPages+1
+		else:
+			totalPages = 0
+
+		if page > totalPages:
+			page = totalPages
+
+		# sort rows
+		result = sorted(rows, key=itemgetter(sortBy), reverse=reverseSort)
+
+		return { "page":page, "total":totalPages, "records":len(groupData["memberuid"]), "rows":result[start:finish] }
+
+
+
     def buildFilter(self, args):
 		filter = "(&(cn=*)(|(groupType=school_class)(groupType=school_department))"
 		
Index: controlies/trunk/applications/controlies/modules/Users.py
===================================================================
--- controlies/trunk/applications/controlies/modules/Users.py	(revision 240)
+++ controlies/trunk/applications/controlies/modules/Users.py	(revision 241)
@@ -392,7 +392,7 @@
 
     def getUserGroups(self):
         result = self.ldap.search("ou=Group","(&(memberUid="+self.user+")(|(groupType=school_department)(groupType=school_class)))",["cn","groupType"])
-        
+
         departments = []
         classrooms = []     
         for g in result:
Index: controlies/trunk/applications/controlies/views/grupos/index.html
===================================================================
--- controlies/trunk/applications/controlies/views/grupos/index.html	(revision 240)
+++ controlies/trunk/applications/controlies/views/grupos/index.html	(revision 241)
@@ -36,12 +36,6 @@
         </div>
         
         
-        
-
-
-
-
-
 <script type="text/javascript">  
 
 jQuery(function() {
@@ -66,42 +60,73 @@
             rowNum:25,
             height:335,
             width: 900,
-            rowList:[25,50,75],  
+            rowList:[25,50,75],
             pager: '#pager', 
             sortname: 'cn', 
             autowidth: false,
             viewrecords: true, 
-            sortorder: "desc", 
-            caption:"Grupos"  
+            sortorder: "desc",
+			subGrid: true, 
+            caption:"Grupos",
+			subGridOptions: {
+				"plusicon"  : "ui-icon-triangle-1-e",
+				"minusicon" : "ui-icon-triangle-1-s",
+				"openicon"  : "ui-icon-arrowreturn-1-e",
+				"reloadOnExpand" : false,
+				"selectOnExpand" : true
+			},
+			subGridRowExpanded: function(subgrid_id, row_id) {
+				var subgrid_table_id, pager_id;
+				subgrid_table_id = subgrid_id+"_t";
+				pager_id = "p_"+subgrid_table_id;
+				$("#"+subgrid_id).html("<table id='"+subgrid_table_id+"' class='scroll'></table><div id='"+pager_id+"' class='scroll'></div>");
+				jQuery("#"+subgrid_table_id).jqGrid({
+					//url:"{{=URL(c='grupos',f='call',args=['json','getUsers'])}}",
+					url:"/controlies/grupos/call/json/getUsers?row_id="+row_id,
+					//data: "{}",            
+					mtype: 'GET', 
+					datatype: "json", 
+					colNames: ['Nombre y Apellidos','Usuario','Identificación'],
+					colModel: [
+						{name:"cn",index:"cn",width:400,key:true},
+						{name:"uid",index:"uid",width:200},
+						{name:"employeeNumber",index:"employeeNumber",width:200,align:"center"}
+					],
+					rowNum:30,
+					pager: pager_id,
+					sortname: 'cn',
+					sortorder: "desc",
+					height: 150
+				});
+				jQuery("#"+subgrid_table_id).jqGrid('navGrid',"#"+pager_id,{edit:false,add:false,del:false,search:false,refresh:false})
+			}
     
       }); 
       jQuery("#list").jqGrid('navGrid','#pager',{add:false,edit:false,del:false,search:false,refresh:false});
     
-        jQuery("#list").jqGrid('navButtonAdd','#pager',{
-                caption: "Insertar",
-                buttonicon :'ui-icon-plus',
-                onClickButton : function (){ 
-                    addRecord();
-                } 
-        }); 
-        jQuery("#list").jqGrid('navButtonAdd','#pager',{
-                caption: "Modificar", 
-                buttonicon :'ui-icon-pencil',
-                onClickButton : function (){ 
-                    modifyRecord();
-            } 
-        }); 
-        jQuery("#list").jqGrid('navButtonAdd','#pager',{
-                caption: "Borrar", 
-                buttonicon :'ui-icon-trash',
-                onClickButton : function (){ 
-                    deleteRecord();
-            } 
-        }); 
+		jQuery("#list").jqGrid('navButtonAdd','#pager',{
+				caption: "Insertar",
+				buttonicon :'ui-icon-plus',
+				onClickButton : function (){ 
+					addRecord();
+				} 
+		}); 
+		jQuery("#list").jqGrid('navButtonAdd','#pager',{
+				caption: "Modificar", 
+				buttonicon :'ui-icon-pencil',
+				onClickButton : function (){ 
+					modifyRecord();
+			} 
+		}); 
+		jQuery("#list").jqGrid('navButtonAdd','#pager',{
+				caption: "Borrar", 
+				buttonicon :'ui-icon-trash',
+				onClickButton : function (){ 
+					deleteRecord();
+			} 
+		}); 
     
-      
       jQuery("#list").jqGrid('filterToolbar'); 
-   
 }
 
 
