function rendererDate(value, p, record){
	return record.get("date");
	//return value.dateFormat('d M Y');
}

/*
function rendererPrix(value, p, record){
	var prix = "<b>A d&eacute;b.</b>"
	if(value != "" && value != 0){
		prix = value+' &euro;';
	}
	return '<span class="moteur_prix">'+prix+'</span>';
}
*/
/*
function rendererPrix(value, p, record){
	var prix = "<b>A d&eacute;b.</b>"
	if(value != "" && value > 0){
		prix = value+' &euro;';
	} else {
		prix = 'A d&eacute;b.';
	}
	return '<span class="moteur_prix">'+prix+'</span>';
}
*/


function rendererPrix(value, p, record){
	var prix = "<b>A d&eacute;b.</b>"
	if(value != "" && value > 0){
		prix = value+' &euro;';
	} else {
		prix = 'A d&eacute;b.';
	}
	
	var str = "";
	var prixpromo = record.get("prixpromo");
	if(prixpromo != null && prixpromo > 0){
		/*str = "<span class='moteur_prix'>"+record.get("prixpromo")+"<span><br/>";
		str += "<strike>"+prix+"</strike>";*/
		
		str = "<span class='moteur_prix'>"+prix+"<span><br/>";
		str += "<strike>"+record.get("prixpromo")+"</strike>";
		
	}else{
		str =  prix;	
	}
	
	return str;
}


function rendererPhoto(value, p, record){
	//return String.format('<b><i>{0}</i></b>', '<img src="/portail/gaaservices/design/img/production/thumbs/NO-Photo.jpg"/>');

	var photo = record.get("tt");
	var urlphoto;
	var visible = record.get("visible");
	if(photo && visible && visible > 1 && photo != 0 && photo != -1){
		urlphoto = "/portail/Commons/images/"+record.get("photo")+"/thumb/"+record.get("photo")+"_1."+record.get("extension");
	}else {//if(photo == 0 || photo == -1 || visible == 1 || visible == 0){
		urlphoto = "/portail/gaaservices/design/img/production/thumbs/NO-Photo.jpg"
	}
	return String.format('<b><i>{0}</i></b>', '<img src="'+urlphoto+'" alt=""/>');
	//return String.format('{0}', '<img src="'+urlphoto+'" alt=""/>');

} 

function rendererAnnonce(value, p, record){
	tabAnnonce = record.data['annonce'];
	clim = "";
	if(tabAnnonce[5] && tabAnnonce[5] == "1" ){
		clim = ",climatis&eacute;";
	}
	if (tabAnnonce[3]) {
		cv = tabAnnonce[3] + 'CV';
	} else {
		cv = "";
	}
	
	var km = "Nc"
	if(tabAnnonce[4] != 0){
		km = tabAnnonce[4]+" Km";
	}
	return String.format('<b><a href="/Visiteur/DetailsAnnonce/index/idannonce/{6}" onclick="return false;">{0}&nbsp;{1}</a></b><a href="#addPAnier" onclick="addPanier({6})" class="panier" title="Ajouter au panier !"><img src="/plateforme/Commons/images/site/Caddie3.jpg" class="panier" alt="Ajouter au panier"/></a>' +
			'<br/>{2}&nbsp;{3}<br/>{4}{5}'
			,tabAnnonce[0],tabAnnonce[1],tabAnnonce[2],cv,km,clim,record.get("idannonce"));
}       

var 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';
    }    