/*
 * Ext JS Library 1.1.1
 * Copyright(c) 2006-2007, Ext JS, LLC.
 * licensing@extjs.coma
 * 
 * http://www.extjs.com/license
 */

	/**
	 * il faut faire un appelle ajax
	 * pour recupérer le tableau de définition 
	 */
	var grid;
	var ds;
	var fornform;
	var arrFiltre ;
	var filtre;
	var GlobalUrl;
	
//			json = JSON.parse(result.responseText);
// 			 var myJSONText = JSON.stringify(json);
// 			 alert(myJSONText);	

	function initFiltre_ex(myfiltre){
		if(myfiltre){	
			arrFiltre = myfiltre;
			var myparam = new Array();
			for(var i=0; i < arrFiltre.length ;i++ ){
				var el = Ext.get(arrFiltre[i]);
				var elteste = Ext.get("idmarque");
//				var val = champ.dom.value;
				var valteste = elteste.getValue();
//				alert(valteste);
				
				var valeur = el.getValue();
				if(valeur != "choose" && valeur != ""){
//					alert(" champ :: "+arrFiltre[i]+" = "+valeur);
//					myparam[arrFiltre[i]] = champ.dom.value;
 					myparam[arrFiltre[i]] = valeur;
				}
			}
			tt = Ext.get("my_transaction");
			var t = tt.dom.value; // ici vaut achat par Ex
			myparam["transaction"] = t;  
		}else{
			Ext.Msg.alert("status","aucun filtre trouv&eacute;&nbsp;");
		}
		return myparam;
	}
	
	function initFiltre(){
		var myfiltreObj = Ext.get("filtre");
		arrFiltre = '';
		if(myfiltreObj){
			var myfiltre = myfiltreObj.getValue();
			arrFiltre = myfiltreObj.getValue();
		}
		var myparam = new Array();
		if(myfiltre){
			var tabFiltre = myfiltre.split("&");
			for(var i =0 ; i < tabFiltre.length ; i++){
				var splited = tabFiltre[i].split("=");
				if(splited[1] != "" && splited[1] != "choose") myparam[splited[0]] = splited[1];
			}
			/*var tt = Ext.get("my_transaction");
			var t = tt.dom.value; // ici vaut achat par Ex
			myparam["transaction"] = t;*/ 
			 
		}else{
			Ext.Msg.alert("status","aucun filtre trouv&eacute;&nbsp;");
		}
		return myparam;
	}
	
	
	
	function setToFiltre(paramName , paramValue){
		var valF;
		if(arrFiltre){
			valF = arrFiltre.split("&");
		}else{
			var f = Ext.get("filtre");
			var str = f.getValue();
			valF = str.split("&");
		}
		for(var i =0 ; i < valF.length ; i++){
			var keyVal = valF[i].split("=");
			if(keyVal[0] == paramName){
				if(paramValue == "choose") paramValue = "";
				var str = keyVal[0]+"="+paramValue;
				valF[i] = str;
				break; 
			}
//			alert("Les paramétres :: "+keyVal[0]);
		}
		var finFiltre = valF.join("&");
		arrFiltre = finFiltre; 
		hidden = Ext.get("filtre");
//		alert(finFiltre);
		hidden.dom.value = finFiltre;
	}
	
	function getValueFromFiltre(paramName){
//		alert("je donne la valeur de :: "+paramName);
//		alert("je mets  :: "+paramValue+" dans :: "+paramName);
		var ValFin = "";
		if(arrFiltre){
			valF = arrFiltre.split("&");
		}else{
			var f = Ext.get("filtre");
			var str = f.getValue();
			valF = str.split("&");
		}
//		var valF = arrFiltre.split("&");
		for(var i =0 ; i < valF.length ; i++){
			var keyVal = valF[i].split("=");
//			alert(keyVal[0]+" :: "+keyVal[1]+" :: pass :: "+paramName);
			if(keyVal[0] == paramName){
				ValFin = keyVal[1];
//				alert(keyVal[1]);
				break; 
			}
		}
//		alert(ValFin);
		return ValFin;
	}
	
	function getFiltreParams(){
		var myfiltreObj = Ext.get("filtre");
		if(myfiltreObj){
			var myfiltre = myfiltreObj.getValue();
			arrFiltre = myfiltreObj.getValue();
		}
		var myparam = new Array();
		if(myfiltre){
			var tabFiltre = myfiltre.split("&");
			for(var i =0 ; i < tabFiltre.length ; i++){
				var splited = tabFiltre[i].split("=");
				if(splited[1] != "" && splited[1] != "choose"){
					 myparam[splited[0]] = splited[1];
				}
			}
		}else{
			Ext.Msg.alert("status","aucun filtre trouv&eacute;&nbsp;");
		}
		return myparam;
	}
	
	function resetParams(){
		var myfiltreObj = Ext.get("filtre");
		if(myfiltreObj){
			var myfiltre = myfiltreObj.getValue();
			arrFiltre = myfiltreObj.getValue();
		}
		var myparam = new Array();
		if(myfiltre){
			var tabFiltre = myfiltre.split("&");
			for(var i =0 ; i < tabFiltre.length ; i++){
				var splited = tabFiltre[i].split("=");
				if(splited[1] != "" && splited[1] != "choose"){
					 //myparam[splited[0]] = splited[1];
					 setToFiltre(splited[0],"");
				}
			}
		}else{
			Ext.Msg.alert("status","aucun filtre trouv&eacute;&nbsp;");
		}
		return myparam;
	}
		
	/**
	 * permet de construire l'entete du tableau
	 */
	function createHeaderModel(json){
		if(json){
		tab = json.colonneConfig.configAnnonce.definition.champ;
		var mytab = new Array();
		
		for(i =0 ; i < tab.length ; i++){
			obj = tab[i];
			map = new Object();
			map.name = obj.id
			if(obj.type && obj.type == "date"){				
				map.type = "date";
				map.dateFormat = "timestamp"; 
			}
			mytab[i] = map;		
		}
		
		map = new Object();
		map.name = "idannonce";
		mytab[tab.length] = map;

		}else{
			Ext.Msg.alert("status","fichier de configuration est absent dans createHeader !!");
		}
		
    	return mytab;
	}
	
	

	
	/**
	 * retrouve le discriminant
	 */
	function getDiscriminant(json){
    	return dis.discriminant;
	}
	 
	/**
	 * permet de construire la définition des colonnes
	 * Dans la version 2.0 a été renforcée
	 * pour préserver le typage
	 */
	 function createColModel(json){
	 	var tabCol = json.colonneConfig.configAnnonce.definition.champ;
	 	
	 	if(!json){
			Ext.Msg.alert("status","fichier de configuration est absent Dans createModel !!");
	 	}
	 	
	 	for(var i =0 ; i < tabCol.length ; i++){
	 		var ObjetCol = tabCol[i];
	 		stringCol = JSON.stringify(ObjetCol);
	 		var tabAttribut = stringCol.split(",");
	 		for(var j =0 ; j < tabAttribut.length ; j ++ ){
	 			/**
	 			 * on enléve les {} eventuels
	 			 */
	 			tabAttribut[j] = tabAttribut[j].replace(/{/g,"");
	 			tabAttribut[j] = tabAttribut[j].replace(/}/g,"");
	 			/**
	 			 * on teste le type
	 			 */
 	 			
 	 			tabAttribut[j] = tabAttribut[j].replace(/"/g,''); 
 	 			
	 			attribut = tabAttribut[j].split(":");
				 	 			
	 			if(attribut[1] == "true"){
	 				eval("tabCol[i]."+attribut[0]+" = true;");
//					alert("tabCol[i]."+attribut[0]+" = true;");
	 			}else if(attribut[1] == "false"){
	 				eval("tabCol[i]."+attribut[0]+" = false");
//					alert("tabCol[i]."+attribut[0]+" = false");
	 			}else if(!isNaN(attribut[1])){
	 				var myvar = parseInt(attribut[1],10);
	 				var str = "tabCol[i]."+attribut[0]+" = "+myvar+";";
	 				eval(str);
// 					alert(str); 
	 			}
	 			
	 			if(attribut[0] == "listeners" || attribut[0] == "editor"){
	 				var str = "tabCol[i]."+attribut[0]+" = "+attribut[1];
	 				eval(str);
	 			}
	 			
	 			if(attribut[0] == "renderer"){
//	 				alert("ok");
	 				tabCol[i].renderer = eval(attribut[1]);
	 			}
	 			
	 			if(attribut[0] == "valeur"){
	 				eval("delete tabCol[i]."+attribut[0]);
	 			}
	 			
	 		}
//	 		alert(tabCol[i].renderer);
//	 		var myJSONText = JSON.stringify(ObjetCol);
// 			alert(myJSONText);	
	 	}
//	 	alert(tabCol.length);
	 	/**
	 	 * il faut rajouter la colonne idannonce
	 	 */
 		var tabidannonce = [{id: 'idannonce',header: "idannonce",dataIndex:'idannonce',width:1,hidden:true}];
// 		var finalTab = tabidannonce.concat(tabCol);
 		var finalTab = tabCol.concat(tabidannonce);
 		return finalTab;
//		return tabCol;
//		return json.colonneConfig.configAnnonce.definition.champ;
	 }
	 
	 
	function createRenderer(json){

//		json = JSON.parse(json);
		tab = json.colonneConfig.configAnnonce.definition.champ
		
		for(i =0; i< tab.length ; i++){
			
			if(tab[i].renderer){
		    var myJSONText = JSON.stringify(tab[i].renderer);
		    
			pos1 = myJSONText.indexOf('"');
			pos2 = myJSONText.lastIndexOf('"');
			sub = myJSONText.substring(pos1+1,pos2);
//			alert(sub);
			tab[i].renderer = eval(sub);
			} 
		}
		return json;
	} 
	 
	/**
	 * fonction permettant de construire le tableau
	 * on construit notre datastore pour afficher le moteur de recherche à proprement parler
	 */
	function createGrid(headermodel,colmodel,filtre,myurl,plugins,idcontainer){
 	GlobalUrl = myurl;
 	
 	if(typeof(idcontainer) == "undefined"){
 		idcontainer = "topic-grid";
 	}
 	
 		
    var ds = new Ext.data.Store({
        proxy: new Ext.data.HttpProxy({
			url: myurl
        }),
        // create reader that reads the Topic records
        reader: new Ext.data.JsonReader({
            root: 'annonces',
            totalProperty: 'count_annonce',
            id: 'idannonce',
            fields : headermodel
    	}),
        remoteSort: true,
        // les parametres initials
		baseParams : filtre
        // turn on remote sorting
    });
    
    /**
     * on choisie nos plugins pour le paging
     */
    if(plugins && typeof plugins.pagingPlugins != "undefined"){
    	var pagingObj = {
        pageSize: 13,
        store : ds,
        plugins : plugins.pagingPlugins,
        displayInfo: true,
        displayMsg: 'Annonces affich&eacute;es {0} - {1} sur {2}',
        emptyMsg: "Vous n'avez aucune annonce."
    	};
    }else{
    	var pagingObj = {
        pageSize: 13,
        store : ds,
        displayInfo: true,
        displayMsg: 'Annonces affich&eacute;es {0} - {1} sur {2}',
        emptyMsg: "Vous n'avez aucune annonce."
    	};
    }
    
    /*
     * on choisie le mode de selection du moteur
     */
    var mysm; 
    if(plugins && typeof plugins.columnPlugins != "undefined"){
    	mysm = new Ext.grid.CheckboxSelectionModel();
    	colmodel = [mysm].concat(colmodel);	
    }else{
    	mysm = new Ext.grid.RowSelectionModel({singleSelect:true});
    }
    
	var paging = new Ext.PagingToolbar(pagingObj);
    
    if(typeof renderRow == "undefined"){
    	renderRow = function(record, rowIndex, p, store){
                if(this.showPreview){
                    p.body = '<div id="bandeau_details_'+rowIndex+'"></div>';
                    return 'x-grid3-row-expanded';
                }
                return 'x-grid3-row-collapsed';
            }
    }
    
    
    /**
     * instanciation de la grid a proprement parler
     */
//    grid = new Ext.grid.Grid('topic-grid', {
	Ext.get(idcontainer).dom.innerHTML = ""; // Pour effacer le texte de chargement du moteur
		grid = new Ext.grid.GridPanel({
        store: ds,
//        cm: cm,
		columns:colmodel,
		stripeRows: true, 
        //renderTo : 'topic-grid',
        renderTo : idcontainer,
        sm: mysm,
        enableColumnHide : false,
        bbar: paging,
    	viewConfig: {
    		autoFill:true,
            forceFit:true,
            enableRowBody:true,
            showPreview:true,
            getRowClass : renderRow
        },
        loadMask: true,
        autoHeight:true
    });
    
    
    
//      var rz = new Ext.Resizable('topic-grid', {
//        wrap:true,
//        minHeight:100,
//        pinned:true,
//        handles: 's'
//    });
//   
//    rz.on('resize', grid.autoSize, grid);
	/**
	 *  c'est ici que l'on definit notre evenement sur la raw
	 */
	grid.on('rowclick',handleClick);
	
    /**
     * on rend notre grid
     */
//    grid.render('topic-grid');
    
//   	var gridFoot = grid.getView().getFooterPanel(true);
 
    // add a paging toolbar to the grid's footer
//    var paging = new Ext.PagingToolbar(gridFoot, ds, {
//        pageSize: 13,
//        displayInfo: true,
//        displayMsg: 'Annonces affichées {0} - {1} de {2}',
//        emptyMsg: "Vous n'avez aucune annonce."
//    });
	
    ds.load({
    	params:{start:0, limit:13}
    	,callback:myalert});
    	
    ds.on("load",clearRows);	
    
//grid.getView().refresh();
	}/** fin de la fonction create grid **/
	
	function renderGrid(id,nbAnnonce){
		grid.render(id);
		ds = grid.getStore();
		ds.load({params:{start:0, limit:13},callback:myalert});
	}
	
	function cilcksurbouton(){
		alert("kokokok");
	}
	
  	function myalert(){
//  	datas = grid.getDataSource();
	var datas = grid.getStore();
    if(datas.getCount() == 0){
    	 Ext.Msg.alert('Affichage des annonces',"Aucune annonce &agrave; afficher.");
//    	 datas.baseParams = new Array();
//    	 datas.load({params:{start:0,limit:13}});
   	 }
   	 
  	}
  	/**************************************************************************/
  	/******* ceci est un copié coller du render dans la function json *********/
  	/**************************************************************************/
  	
  
//  	Ext.override(Ext.grid.GridView,{
//  			
//  			initRenderBody : function(){
//  				this.renderbodyTmp = this.renderBody;
//  			},
//  			
//  			myRenderBody : function(content,indice){
//  			
//  				return function(){
//  					/**
//  					 * on commence par mettre le grid à niveau
//  					 */
//  					hidden = Ext.get("actiondetails");
//  					var result = this.renderbodyTmp();
//  					htmlcode = result[1];
//  					/**
//  				 	* on formate htmlcode 
//  				 	*/
//  				 	tab = htmlcode.split("</tr>");
//  				 	var tabTemp = new Array();
//  				 	
//  				 	for(var i = 0;i < tab.length-1 ; i++){
//  				 		if(i < indice){
//  				 			tabTemp[i] = tab[i];
//  				 		}else if(i == indice){
//  				 			tabTemp[i+1] = "<tr id='moteur_details_content_tr'><td colspan='6'id='moteur_details_content_td'>"+content+"</td></tr>";
//  				 			tabTemp[i] = tab[i];
//  				 		}else{
//  				 			tabTemp[i+1] = tab[i];
//  				 		}
//  				 	}
//  				 	tabString = tabTemp.join("");			
//					result[1] = tabString; 
//  					return result; 				
//  				}
//  			},	
//  			undoRenderBody : function(){
//  				this.renderBody = this.renderbodyTmp;
//  			}
//  	});
//  	
//  	
  	Ext.override(Ext.PagingToolbar,{
  			
  			onClick : function(which){
  						
  					var myArray = new Array();
//  						for(var i=0 ; i < arrFiltre.length ; i++){
//  							hidden = Ext.get(arrFiltre[i]);
//  							if(hidden){
//  							value = hidden.dom.value;
//  							if(value){
//  								nameval = arrFiltre[i];
//  								myArray[nameval] = value;
//  							}
//  							}
//  						}
  			
//					var tabFiltre = arrFiltre.split("&");
//					for(var i =0 ; i < tabFiltre.length ; i++){
//						var splited = tabFiltre[i].split("=");
//						if(splited[1] != "" && splited[1] != "choose"){
//							 myArray[splited[0]] = splited[1];
//						}
//					}
					
					myArray = getFiltreParams();
						
        			var store = this.store;
        			store.baseParams = myArray;
        			
        			switch(which){
            		case "first":
                		this.doLoad(0);
            		break;
            		case "prev":
                		this.doLoad(Math.max(0, this.cursor-this.pageSize));
            		break;
            		case "next":
                		this.doLoad(this.cursor+this.pageSize);
            		break;
            		case "last":
                		var total = store.getTotalCount();
                		var extra = total % this.pageSize;
                		var lastStart = extra ? (total - extra) : total-this.pageSize;
                		this.doLoad(lastStart);
            		break;
            		case "refresh":
                		this.doLoad(this.cursor);
            		break;
  					}
  			}
  	});
  	
  		
  	function myRenderBody(grid,content,indice){
  		return grid.getView().myRenderBody(content,indice);		
  	}

	function getdetailsAnnonce_ex(id,grid,indice,div){
		var content = "";
		iddetails  = Ext.get("details");
//	 	mask = new Ext.LoadMask('topic-grid',{text:"creation du d&eacute;tail de l&acute;annonce",removeMask :true});
//	 	mask.enable();
		loadMask = new Ext.LoadMask(grid.container,Ext.apply({store:grid.dataSource}, grid.loadMask));

		Ext.Ajax.request({
			url : '/Annonce/index/details/' ,
			params : {idannonce : id},
			success: function( result, request ) {
				content = result.responseText;
				/**
				 * on trouve tous les fils de tbody
				 */
				grid.getView().initRenderBody();
				grid.getView().renderBody = myRenderBody(grid,content,indice);
 				grid.getView().refresh();
				grid.getView().undoRenderBody();		
			 },
			
			failure: function ( result, request) { 
				Ext.MessageBox.alert('Failed',"une erreur est survenue"); 
			},
			callback: function(){
//				grid.autoSize();		
			} 
		});
		
		return content;
	}
	
	function getdetailsAnnonce(id,grid,indice){
		var content = "";
		var t = "vente";
		
		var ar = new Array();
		
		ar["idannonce"] = id;
		if(Ext.get("annonce_template_dir") && Ext.get("annonce_template_dir").getValue() != ""){
			ar["annonce_template_dir"] = Ext.get("annonce_template_dir").getValue();
		}
		t = getValueFromFiltre("my_transaction");
		ar["transaction"] = t;
		
		var showphoto = getValueFromFiltre("showphoto");
		
		if(showphoto && showphoto != '')
		ar["showphoto"] = 1;
		
		var td = Ext.get("bandeau_details_"+indice);
		
		if(Ext.get("annonce_moteur_pro")){
			if(Ext.get("annonce_moteur_pro").getValue())
			ar["annonce_moteur_pro"] = true;
		}
		
		
		td.load({
				url: "/Annonce/index/details/",
				params:ar,
				text: "Chargement des d&eacute;tails..."
				,scripts:true
				,callback : function(){
					var s = grid.getStore();
					for(var i = 0 ; i < s.getCount() ; i++){
						if(indice != i){
							Ext.get("bandeau_details_"+i).update("");
						}else{
							Ext.get("row_index").dom.value = i;
						}
					} 
					var bloc_admin = Ext.get("admin_photo");
					if(bloc_admin){
						//var tabImg = Ext.query(".photo_admin");
						var tabImg = Ext.select(".photo_admin",true);
						tabImg.each(initDeletedPhoto);
						
						
						// vérifie que l'on a la grande photo
						var gF = Ext.get("grand_format");
						if(gF){
							initDeletedPhoto(gF,null,1);
						}
						/*for(i in tabImg){
							alert(typeof(tabImg[i]));
							tabImg[i].on("click",function(){
								// fonction exécuter lors du clique sur la photo
								var lienSupPhoto = "<a href='#' onclick='deletePhoto(\'"+tabImg[i].name+"\')'>Supprimer la photo "+tabImg[i].name+"</a>";
							});
						}*/
					}	
				} 
			});
		return content;
	}
	
	function initDeletedPhoto(el,tabImg,index){
		//if(index == 0){
			var refe = el.dom.name;
			var tabref = refe.split("/");
			var lienSupPhoto = "<a href='#lienphoto1' id='lienphoto1' onclick=\"deletePhoto('"+tabref[0]+"','"+tabref[1]+"')\" >Supprimer la photo "+tabref[1]+"</a>";
			//lienSupPhoto += "<br/>";
			lienSupPhoto += "<a href='#lienphoto2' id='lienphoto2' onclick=\"deleteAllPhoto('"+tabref[0]+"')\">Supprimer toutes les photos de cette annonce</a>";
			if(Ext.get("admin_photo")){
				Ext.get("admin_photo").update(lienSupPhoto);
			}
			
		//}
		if(tabImg != null){ 
			el.on("click",insertDeletedPhotoLink);
		}
	}
	
	function insertDeletedPhotoLink(name,photo){
		// fonction exécuter lors du clique sur la photo
		var tablink = photo.name.split("/");
		
		var lienSupPhoto = "<a href='#lienphoto1' id='lienphoto1' onclick=\"deletePhoto('"+tablink[0]+"','"+tablink[1]+"');return false;\" >Supprimer la photo "+tablink[1]+"</a>";
		//lienSupPhoto += "<br/>";
		lienSupPhoto += "<a href='#lienphoto2' id='lienphoto2' onclick=\"deleteAllPhoto('"+tablink[0]+"');return false;\">Supprimer toutes les photos de cette annonce</a>";
		Ext.get("admin_photo").update(lienSupPhoto);
	}
	
	function oneRowClick(e){
		//alert("teste moi tout a");
	}
	
	function handleClick_ex(grid,ri,e){
  		var hidden = Ext.get("actiondetails");
  		var action = hidden.getValue();
  		var process = true;
		var source = grid.getStore();
		var count = source.getCount();
		Ext.get("row_index").dom.value = "";
  		if(action){
  			tab = action.split("_");
  			
  			if(tab[0] == "close"){
  				// un détail est ouvert
  				ouvert = parseInt(tab[2],10);
  				
  				if(ri == ouvert) process = false;
//  				alert(ouvert);
  				tr = Ext.get("bandeau_details_"+ouvert);
  				tr.update("");
  				hidden.dom.value = "";
  				
  				/**
  				 * on remet le style en place
  				 */
  				//on efface la classe
  				var v = grid.getView();
  				var e = v.getRow(ouvert);
  				e.className = "x-grid3-row x-grid3-row-alt x-grid3-row-expanded"; 
  			}
  		}
  		if(process){
  			row = source.getAt(ri);
  			id = row.get("idannonce");
  			hidden.dom.value = "close_"+id+"_"+ri;
  			
  			
  			var v = grid.getView();
  			var e = v.getRow(ri);
  			e.className = "x-grid3-row x-grid3-row-expanded x-grid3-row-selected 974voshow";
  			
			getdetailsAnnonce(id,grid,ri);
  		}else{
  			//on efface la classe
  			var v = grid.getView();
  			var e = v.getRow(ri);
  			e.className = "x-grid3-row x-grid3-row-alt x-grid3-row-expanded";
  		}
	}
	
	function handleClick(grid,ri,e){
  		var hidden = Ext.get("actiondetails");
  		var action = hidden.getValue();
  		var process = true;
		var source = grid.getStore();
		var count = source.getCount();
  		if(action){
  			tab = action.split("_");
  			
  			if(tab[0] == "close"){
  				// un détail est ouvert
  				ouvert = parseInt(tab[2],10);
  				
  				if(ri == ouvert) process = false;
//  				alert(ouvert);
  				tr = Ext.get("bandeau_details_"+ouvert);
  				tr.update("");
  				hidden.dom.value = "";
  				
  				/**
  				 * on remet le style en place
  				 */
  				//on efface la classe
  				var v = grid.getView();
  				var e = v.getRow(ouvert);
  				e.className = "x-grid3-row x-grid3-row-alt x-grid3-row-expanded"; 
  			}
  		}
  		if(process){
  			row = source.getAt(ri);
  			id = row.get("idannonce");
  			hidden.dom.value = "close_"+id+"_"+ri;
  			
  			
  			var v = grid.getView();
  			var e = v.getRow(ri);
  			e.className = "x-grid3-row x-grid3-row-expanded x-grid3-row-selected 974voshow";
  			
			getdetailsAnnonce(id,grid,ri);
  		}else{
  			//on efface la classe
  			var v = grid.getView();
  			var e = v.getRow(ri);
  			e.className = "x-grid3-row x-grid3-row-alt x-grid3-row-expanded";
  		}
	}
	
	function clearRows(store,records,options){
		var hidden = Ext.get("actiondetails");
		if(hidden){
			hidden.dom.value = "";
		}
	}

