/*---- AppelWS.js ----*/

//var _pjpaUrlProxy = "/test/V2/proxy.aspx";
var _pjpaCarrouselServeur = "http://www-dev.annoncesjaunes.fr:8080";
var webServiceCarrouselUrl = '/WebServices/Carrousel.asmx/GetCarrouselAnnonce';
var webServiceAdsSimilairesUrl = '/WebServices/Carrousel.asmx/GetAnnoncesSimilaires';
var webServiceDiaporamaUrl = '/WebServices/Carrousel.asmx/GetDiaporamaAnnonce';
var webServiceNotreSelectionUrl = '/WebServices/Carrousel.asmx/GetNotreSelectionAnnonce';
var webServiceNotreSelectionEmploiUrl = '/WebServices/Carrousel.asmx/GetNotreSelectionEmploi';
var webServiceNotreSelectionServicesUrl = '/WebServices/Carrousel.asmx/GetNotreSelectionServices';
var WebServiceCarrouselContentType = "application/json; charset=utf-8";
var _pjpaUrlProxyCarrousel = "/test/V2/proxy.aspx";
var PJPA_CONTEXT_NS = "Carroussel_notre_selection";
var PJPA_CONTEXT_ADSIM = "Carroussel_annonces_similaires";
var PJPA_CONTEXT_LPC = "Carroussel_annonces_les_plus_consultees";
var PJPA_CONTEXT_ADSIM_ANNEXP = "Carroussel_annonces_similaires_annonce_expiree";

/************Fonction JSON : Liste IMAGE CARROUSEL*************************************************************/
function PJPACarrouselLaunchCall(idannonce, Methode, ip, partenaireID, IdDivToHide, NameVarGlobal, Secteur) {
	if (Methode == "POST") {
        PJPACarrouselLaunchCallPOST(idannonce, ip, partenaireID, IdDivToHide, NameVarGlobal, Secteur);
    }
}

function PJPACarrouselLaunchCallPOST(idannonce, ip, partenaireID, IdDivToHide, NameVarGlobal, Secteur) {
	if (!IsHostGoogleWebCacheOrTranslation()) {
		$.ajax({
			type: "POST",
			url: webServiceCarrouselUrl,
			data: '{ "idannonce" : "' + idannonce + '", "ipUser" : "' + ip + '", "partenaireID" : "' + partenaireID + '"}',
			contentType: WebServiceCarrouselContentType,
			dataType: "json",
			success: PJPACarrouselAjaxCallSucceedJson,
			error: CarrouselAjaxCallError,
			idDivToHide: IdDivToHide,
			nameVarGlobal: NameVarGlobal,
			idAnnonce: idannonce,
			Secteur: Secteur
		});
	}
}

function PJPACarrouselAjaxCallSucceedJson(response) {
    if (response != null && response != undefined) {
        _PJPACarroussel = new PJPACarroussel(this.Secteur, response, this.idDivToHide, 8, 60, 45, true, this.nameVarGlobal, this.nameVarGlobal, PJPA_MODE_CARROUSEL, this.idAnnonce, true, "");
   		_PJPACarroussel.SetTagContext("Annonces_plus_consultees_carroussel");
    }
    else {
        CarrouselAjaxCallError("");
    }
}

function CarrouselAjaxCallError(error) {
    $("#" + this.idDivToHide).hide();
    return;
}
/************Fonction JSON : Liste Annonce SIMILAIRES *************************************************************/
function PJPAAdsSimilairesLaunchCall(idannonce, Methode, ip, partenaireID, IdDivToHide, NameVarGlobal, Secteur, isAnnonceExp) {
	if (Methode == "POST") {
		PJPAAdsSimilairesLaunchCallPOST(idannonce, ip, partenaireID, IdDivToHide, NameVarGlobal, Secteur, isAnnonceExp);
	}
}

function PJPAAdsSimilairesLaunchCallPOST(idannonce, ip, partenaireID, IdDivToHide, NameVarGlobal, Secteur, isAnnonceExp) {
	if (!IsHostGoogleWebCacheOrTranslation()) {
		if (isAnnonceExp) {
			$.ajax({
				type: "POST",
				url: webServiceAdsSimilairesUrl,
				data: '{ "idannonce" : "' + idannonce + '", "ipUser" : "' + ip + '", "partenaireID" : "' + partenaireID + '", "isAnnonceExp" : "' + isAnnonceExp + '" }',
				contentType: WebServiceCarrouselContentType,
				dataType: "json",
				success: PJPAAdsSimilairesAjaxCallSucceedJsonAnnonceExp,
				error: CarrouselAjaxCallError,
				idDivToHide: IdDivToHide,
				nameVarGlobal: NameVarGlobal,
				idAnnonce: idannonce,
				Secteur: Secteur
			});
		}
		else {
			$.ajax({
				type: "POST",
				url: webServiceAdsSimilairesUrl,
				data: '{ "idannonce" : "' + idannonce + '", "ipUser" : "' + ip + '", "partenaireID" : "' + partenaireID + '" , "isAnnonceExp" : "' + isAnnonceExp + '"}',
				contentType: WebServiceCarrouselContentType,
				dataType: "json",
				success: PJPAAdsSimilairesAjaxCallSucceedJson,
				error: CarrouselAjaxCallError,
				idDivToHide: IdDivToHide,
				nameVarGlobal: NameVarGlobal,
				idAnnonce: idannonce,
				Secteur: Secteur
			});
		}
	}
}

function PJPAAdsSimilairesAjaxCallSucceedJson(response) {
	if (response != null && response != undefined) {
		_PJPAAdsSimilaires = new PJPACarroussel(this.Secteur, response, this.idDivToHide, 2, 100, 75, true, this.nameVarGlobal, this.nameVarGlobal, PJPA_MODE_NS, this.idAnnonce, true, "");
		_PJPAAdsSimilaires.SetTagContext("Carroussel_annonces_similaires");
	}
	else {
		CarrouselAjaxCallError("");
	}
}

function PJPAAdsSimilairesAjaxCallSucceedJsonAnnonceExp(response) {
	if (response != null && response != undefined) {
		_PJPAAdsSimilairesExp = new PJPACarroussel(this.Secteur, response, this.idDivToHide, 4, 120, 90, true, this.nameVarGlobal, this.nameVarGlobal, PJPA_MODE_NS, this.idAnnonce, true, "");
		_PJPAAdsSimilairesExp.SetTagContext("Carroussel_annonces_similaires_annonce_expiree");
	}
	else {
		CarrouselAjaxCallError("");
	}
}

/************Fonction JSON : Liste IMAGE Notre Selection*************************************************************/
function PJPANotreSelectionLaunchCall(idtransaction, idbientype, dept, prixmin, prixmax, Methode, ip, partenaireID, IdDivToHide, NameVarGlobal, Secteur, IsVisible, Page ) {
	if (Methode == "POST") {
		PJPANotreSelectionLaunchCallPOST(idtransaction, idbientype, dept, prixmin, prixmax, ip, partenaireID, IdDivToHide, NameVarGlobal, Secteur, IsVisible, Page);
	}
}

function PJPANotreSelectionLaunchCallPOST(idTransaction, idBienType, departement, prixMin, prixMax, ip, partenaireID, IdDivToHide, NameVarGlobal, Secteur, isVisible, Page) {
	if (!IsHostGoogleWebCacheOrTranslation()) {
		$.ajax({
			type: "POST",
			url: webServiceNotreSelectionUrl,
			data: '{ "secteur" : "' + Secteur + '", "idTransaction" : "' + idTransaction + '", "idBienType" : "' + idBienType + '", "departement" : "' + departement + '", "prixMin" : "' + prixMin + '", "prixMax" : "' + prixMax + '", "ipUser" : "' + ip + '", "partenaireID" : "' + partenaireID + '"}',
			contentType: WebServiceCarrouselContentType,
			dataType: "json",
			success: PJPANotreSelectionAjaxCallSucceedJson,
			error: NotreSelectionAjaxCallError,
			idDivToHide: IdDivToHide,
			nameVarGlobal: NameVarGlobal,
			IsVisible: isVisible,
			Secteur: Secteur,
			Page: Page
		});
	}
}

function PJPANotreSelectionAjaxCallSucceedJson(response) {
	if (response != null && response != undefined) {
		if (this.Secteur == "Immobilier") {
			if (this.nameVarGlobal == "_PJPANSImmo") {
				_PJPANSImmo = new PJPACarroussel(this.Secteur, response, this.idDivToHide, 4, 120, 90, true, this.nameVarGlobal, this.nameVarGlobal, PJPA_MODE_NS, "", this.IsVisible, this.Page);
				_PJPANSImmo.SetTagContext(PJPA_CONTEXT_NS);
			}
			else if (this.nameVarGlobal == "_PJPANSImmoLoc") {
				_PJPANSImmoLoc = new PJPACarroussel(this.Secteur, response, this.idDivToHide, 4, 120, 90, true, this.nameVarGlobal, this.nameVarGlobal, PJPA_MODE_NS, "", this.IsVisible, this.Page);
				_PJPANSImmoLoc.SetTagContext(PJPA_CONTEXT_NS);
			}
			else if (this.nameVarGlobal == "_PJPANSImmoVente") {
				_PJPANSImmoVente = new PJPACarroussel(this.Secteur, response, this.idDivToHide, 4, 120, 90, true, this.nameVarGlobal, this.nameVarGlobal, PJPA_MODE_NS, "", this.IsVisible, this.Page);
				_PJPANSImmoVente.SetTagContext(PJPA_CONTEXT_NS);
			}
		}
		else if (this.Secteur == "Automobile") {
		_PJPANSAuto = new PJPACarroussel(this.Secteur, response, this.idDivToHide, 4, 120, 90, true, this.nameVarGlobal, this.nameVarGlobal, PJPA_MODE_NS, "", this.IsVisible, this.Page);
			_PJPANSAuto.SetTagContext(PJPA_CONTEXT_NS);
		}
		else if (this.Secteur == "Moto") {
		_PJPANSMoto = new PJPACarroussel(this.Secteur, response, this.idDivToHide, 4, 120, 90, true, this.nameVarGlobal, this.nameVarGlobal, PJPA_MODE_NS, "", this.IsVisible, this.Page);
			_PJPANSMoto.SetTagContext(PJPA_CONTEXT_NS);
		}
	}
	else {
		NotreSelectionAjaxCallError("");
	}
}

/************Fonction JSON : Liste IMAGE Notre Selection EMPLOI*************************************************************/
function PJPANSEmploiLaunchCall(idPage, titreArticle, Methode, IdDivToFill, IdDivToHide, NameVarGlobal, Secteur, IsVisible) {
	if (Methode == "POST") {
		PJPANSEmploiLaunchCallPOST(idPage, titreArticle, IdDivToFill, IdDivToHide, NameVarGlobal, Secteur, IsVisible);
	}
}

function PJPANSEmploiLaunchCallPOST(idPage, titreArticle, idDivToFill, idDivToHide, NameVarGlobal, Secteur, isVisible) {
	if (!IsHostGoogleWebCacheOrTranslation()) {
		$.ajax({
			type: "POST",
			url: webServiceNotreSelectionEmploiUrl,
			data: '{ "idPage" : "' + idPage + '", "titreArticle" : "' + titreArticle + '"}',
			contentType: WebServiceCarrouselContentType,
			dataType: "json",
			success: PJPANSEmploiAjaxCallSucceedJson,
			error: NotreSelectionAjaxCallError,
			idDivToHide: idDivToHide,
			nameVarGlobal: NameVarGlobal,
			IsVisible: isVisible,
			IdDivToFill: idDivToFill,
			Secteur: Secteur
		});
	}
}

function PJPANSEmploiAjaxCallSucceedJson(response) {
	if (response != null && response != undefined) {
		var obj = document.getElementById(this.IdDivToFill);
		if (obj != undefined) {
			obj.innerHTML = "<div style='height:20px;'></div>" + response ;
		}
		else {
			$("#" + this.idDivToHide).hide();
			return;
		}		
	}
	else {
		NotreSelectionAjaxCallError("");
	}
}
/************Fonction JSON : Liste IMAGE Notre Selection SERVICES*************************************************************/
function PJPANSServicesLaunchCall(isPrestataire, Methode, idDivToHide, NameVarGlobal, Secteur, IsVisible, Page) {
	
	if (Methode == "POST") {
		PJPANSServicesLaunchCallPOST(isPrestataire, idDivToHide, NameVarGlobal, Secteur, IsVisible, Page);
	}
}

function PJPANSServicesLaunchCallPOST(isPrestataire, idDivToHide, NameVarGlobal, Secteur, isVisible, Page) {
	if (!IsHostGoogleWebCacheOrTranslation()) {
		$.ajax({
			type: "POST",
			url: webServiceNotreSelectionServicesUrl,
			data: '{ "isPrestataire" : "' + isPrestataire + '"}',
			contentType: WebServiceCarrouselContentType,
			dataType: "json",
			success: PJPANSServicesAjaxCallSucceedJson,
			error: NotreSelectionAjaxCallError,
			idDivToHide: idDivToHide,
			nameVarGlobal: NameVarGlobal,
			IsVisible: isVisible,
			Secteur: Secteur,
			Page: Page
		});
	}
}

function PJPANSServicesAjaxCallSucceedJson(response) {
	if (response != null && response != undefined) {
		if (this.nameVarGlobal == "_PJPANSServices") {
			_PJPANSServices = new PJPACarroussel(this.Secteur, response, this.idDivToHide, 4, 120, 90, true, this.nameVarGlobal, this.nameVarGlobal, PJPA_MODE_NS, "", this.IsVisible, this.Page);
		}
		else if (this.nameVarGlobal == "_PJPANSServicesPresta") {
		_PJPANSServicesPresta = new PJPACarroussel(this.Secteur, response, this.idDivToHide, 4, 120, 90, true, this.nameVarGlobal, this.nameVarGlobal, PJPA_MODE_NS, "", this.IsVisible, this.Page);
		}
		else if (this.nameVarGlobal == "_PJPANSServicesEmployeur") {
		_PJPANSServicesEmployeur = new PJPACarroussel(this.Secteur, response, this.idDivToHide, 4, 120, 90, true, this.nameVarGlobal, this.nameVarGlobal, PJPA_MODE_NS, "", this.IsVisible, this.Page);
		}	
	}
	else {
		NotreSelectionAjaxCallError("");
	}
}
/************Fonction JSON : Liste IMAGE DIAPORAMA*************************************************************/
function PJPADiaporamaLaunchCall(idannonce, Secteur, Methode, IdDivToHide, NameVarGlobal) {
    if (Methode == "POST") {
    	PJPADiaporamaLaunchCallPOST(idannonce, Secteur, IdDivToHide, NameVarGlobal);
    }
}

function PJPADiaporamaLaunchCallPOST(idannonce, Secteur, IdDivToHide, NameVarGlobal) {
	if (!IsHostGoogleWebCacheOrTranslation()) {
		$.ajax({
			type: "POST",
			url: webServiceDiaporamaUrl,
			data: '{ "idannonce" : "' + idannonce + '"}',
			contentType: WebServiceCarrouselContentType,
			dataType: "json",
			success: PJPADiaporamaAjaxCallSucceedJson,
			error: DiaporamaAjaxCallError,
			idDivToHide: IdDivToHide,
			nameVarGlobal: NameVarGlobal,
			idAnnonce: idannonce,
			secteur: Secteur
		});
	}
}

function PJPADiaporamaAjaxCallSucceedJson(response) {
	if (response != null && response != undefined) {
		_PJPAInterfaceDiaporama = new PJPAInterfaceDiaporama(this.nameVarGlobal + "_diaporama", this.secteur, response, true, false, 341, 255, true, true, true, false, this.nameVarGlobal, this.idAnnonce, this.idDivToHide);
		if (this.secteur == "Immobilier") {
			_PJPAInterfaceDiaporama.SetWithAlerEmail(true);
		}
        callJavascriptLoadXML(this.nameVarGlobal);
    }
    else {
        DiaporamaAjaxCallError("");
    }
}

function DiaporamaAjaxCallError(error) {
    $("#" + this.idDivToHide).hide();
    return;
   }


function IsHostGoogleWebCacheOrTranslation() {
	return (window.location.hostname.indexOf('googleusercontent') != -1);
}


/*---- CallWS.js ----*/

var webServiceCarrousselGenUrl = '/WebServices/Carrousel.asmx/GetCarroussel';

/************Fonction JSON : Liste IMAGE CarrousselGen*************************************************************/
function PJPACarrousselGenLaunchCallPOST(idTransaction, lstIdBienType, codePostal, departement, prixMin, prixMax, surfaceMin, surfaceMax, nbPieces, ip, partenaireID, IdDivToHide, NameVarGlobal, Secteur, isVisible, Page, nbAds, nbItemMax, wImg, hImg, modeCarroussel) {
	if (!IsHostGoogleWebCacheOrTranslation()) {
		$.ajax({
			type: "POST",
			url: webServiceCarrousselGenUrl,
			data: '{ "secteur" : "' + Secteur + '", "idTransaction" : "' + idTransaction + '", "lstIdBienType" : "' + lstIdBienType + '", "codePostal" : "' + codePostal + '", "departement" : "' + departement + '", "prixMin" : "' + prixMin + '", "prixMax" : "' + prixMax + '", "surfaceMin" : "' + surfaceMin + '", "surfaceMax" : "' + surfaceMax + '" , "nbpieces" : "' + nbPieces + '" , "nbItemMax" : "' + nbItemMax + '", "ipUser" : "' + ip + '", "partenaireID" : "' + partenaireID + '"}',
			contentType: WebServiceCarrouselContentType,
			dataType: "json",
			success: PJPACarrousselGenAjaxCallSucceedJson,
			error: NotreSelectionAjaxCallError,
			idDivToHide: IdDivToHide,
			nameVarGlobal: NameVarGlobal,
			IsVisible: isVisible,
			Secteur: Secteur,
			Page: Page,
			NbAds: nbAds,
			WImg: wImg,
			HImg: hImg,
			ModeCarroussel: modeCarroussel
		});
	}
}

function PJPACarrousselGenAjaxCallSucceedJson(response) {
	
	if (response != null && response != undefined && response.length > 0 ) {
		eval(this.nameVarGlobal + ' = new PJPACarroussel("' + this.Secteur + '", undefined, "' + this.IdDivToHide + '", ' + this.NbAds + ', ' + this.WImg + ', ' + this.HImg + ', true, "' + this.nameVarGlobal + '", "' + this.nameVarGlobal + '", "' + this.ModeCarroussel + '", "", ' + this.IsVisible + ', "' + this.Page + '");');
		var obj = eval(this.nameVarGlobal);
		obj.SetData(response);
	}
	else {
		$("#" + this.idDivToHide).hide();
	}
}
/**********/
function NotreSelectionAjaxCallError(error) {
	if (document.getElementById(this.idDivToHide)) {
		$("#" + this.idDivToHide).hide();
	}
	return;
}

/*---- Carroussel.1.1.js ----*/

/******* Debut PJPACarroussel ***/
var _PJPACarroussel = null;
var _pjpaOnCarrousel = false;
var _pjpaOnAds = false;
var _pjpaOnMoveVignette = false;
var PJPA_MODE_CARROUSEL = "Carrousel";
var PJPA_MODE_DIAPO = "Diapo";
var PJPA_MODE_NS = "NotreSelection";
var PJPA_MODE_SEL = "MesSelections";

var PJPA_CONTEXT_NS = "Carroussel_notre_selection";
var PJPA_CONTEXT_ADSIM = "Carroussel_annonces_similaires";
var PJPA_CONTEXT_LPC = "Carroussel_annonces_les_plus_consultees";


function PJPACarroussel(secteur, listeImage, blocCarrousel, nbVignettes, withMaxVignette, heightMaxVignette, withDescription, nameVarGlobal, prefDiv, mode, idannonce, isVisible, page) {
    
    this.ID = nameVarGlobal;
    if (this.ID.indexOf('.') != -1) {
        this.Parent = this.ID.substring(0, this.ID.indexOf('.'));
    }
    
    this.PrefixeDiv = prefDiv;
    this.Mode = mode;
    this.Secteur = secteur;
    this.IdAnnonce = idannonce;
    this.CurrentAnnonce = -1;

    this.ListeImage = listeImage;

    this.BlocCarrousel = document.getElementById(blocCarrousel);

    this.ConteneurDiv = document.getElementById(this.PrefixeDiv + '_CadreImageUL');
    this.ListeUL = document.getElementById(this.PrefixeDiv + '_imageUL');

    if (this.Mode == PJPA_MODE_CARROUSEL) {
    	var objBR = document.getElementById(this.PrefixeDiv + '_div_BarreRightSemidet');
    	if (objBR != undefined) {
    		this.DescriptionDiv = document.getElementById(this.PrefixeDiv + '_div_BarreRightSemidet');
    		$(this.DescriptionDiv).hide();
    		this.DescriptionContenu = $("#" + this.PrefixeDiv + '_div_BarreRightSemidet' + " #" + this.PrefixeDiv + "_" + "contenu");
    	}
    }
    
    this.ImgPrec = -1;
    this.BtnGauche = null;
    this.BtnDroite = null;
    this.Thumbails = null;
    this.CadreThumbails = null;
    this.DivBtnNavigation = null;

    this.WithDescription = withDescription;
    this.NbVignettes = nbVignettes;
    this.WidthMaxVignette = withMaxVignette;
    this.HeightMaxVignette = heightMaxVignette;

    this.Page = page;

    if (this.Mode == PJPA_MODE_NS) {
    	this.EspaceVignette = 15;
    }
    else if (this.Mode == PJPA_MODE_SEL) {
    	this.EspaceVignette = 7;
    } 
    else {
    	this.EspaceVignette = 10;
    }
    
    this.WithTotalBtn = 18 * 2 + 7 * 2;

    this.thumbPrefix = "thumb_";
    this.pas = 5;

    this.Pointer = 1;
    
    this.IsVisible = isVisible;
    if (this.ListeImage != undefined) {
    	this.InitCarroussel();
    }
}

PJPACarroussel.prototype.SetData = function(listeImage) {
	this.ListeImage = listeImage;
	if (this.ListeImage != undefined) {
		this.InitCarroussel();
	}
}

PJPACarroussel.prototype.SetTagContext = function(tagContext) {
	this.TagContext = tagContext;
}

PJPACarroussel.prototype.AddSelection = function(idannonce, urlImage) {

	var nextIndex = this.ListeImage.length;
	for (var i = 0; i < this.ListeImage.length; i++) {
		if (this.ListeImage[i].ImageUrl == "/_Images/commun/pixGris.png") {
			nextIndex = i;
			break;
		}
	}

	var newData = new Object();
	newData.ImageUrl = urlImage;
	newData.IdAnnonce = idannonce;
	if (this.Secteur == "Immobilier") {
		newData.LienAnnonce = "/Immobilier/FicheDetail.aspx?IdAnnonce=" + idannonce;
	}
	else {
		newData.LienAnnonce = "/AutoMoto/FicheDetail.aspx?IdAnnonce=" + idannonce;
	}	
	newData.TagPJPA = "";
	newData.Titre = null;
	newData.PrixAff = null;
	newData.Description1 = null;
	newData.Description2 = null;

	this.ListeImage[nextIndex] = newData;

	this.AddManquant();
	this.Pointer = 1;
	$(this.ConteneurDiv).html("");
	this.ConteneurDiv.innerHTML = "";
	this.InitCarroussel();
}

PJPACarroussel.prototype.RemoveSelection = function(idannonce) {
	var nextIndex = 0;
	var listeImage = new Array();

	for (var i = 0; i < this.ListeImage.length; i++) {
		if (this.ListeImage[i].IdAnnonce != idannonce && this.ListeImage[i].IdAnnonce != undefined) {
			listeImage[nextIndex] = new Object();
			listeImage[nextIndex] = this.ListeImage[i];
			nextIndex++;
		}
	}

	this.ListeImage = listeImage;
	
	this.AddManquant();
	this.Pointer = 1;
	$(this.ConteneurDiv).html("");
	this.ConteneurDiv.innerHTML = "";
	this.InitCarroussel();
}

PJPACarroussel.prototype.SetIsVisible = function(isvisible) {
	this.IsVisible = isvisible;
	if (this.IsVisible) {
		this.LaunchTagPJPA();
	}
}

PJPACarroussel.prototype.AddManquant = function() {
	var Nbmanquant = (this.ListeImage.length % this.NbVignettes != 0 ? (this.NbVignettes - this.ListeImage.length % this.NbVignettes) : 0);
	Nbmanquant = (this.ListeImage.length == 0 ? 4 : Nbmanquant);

	if (Nbmanquant > 0) {
		var currentLength = this.ListeImage.length;
		for (var i = currentLength; i < currentLength + Nbmanquant; i++) {
			var newData = new Object();
			newData.ImageUrl = "/_Images/commun/pixGris.png";
			newData.LienAnnonce = undefined;
			newData.IdAnnonce = undefined;
			newData.TagPJPA = "";
			newData.Titre = null;
			newData.PrixAff = null;
			newData.Description1 = null;
			newData.Description2 = null;

			this.ListeImage[i] = new Object();
			this.ListeImage[i] = newData;
		}
	}
}

function PJPAMesSelectionsCreateDivInterface(nomGlobal, prefDiv) {
	var html = '<div class="carrouselFD" id="' + prefDiv + '_diaporama">';
	html += '<div id="' + prefDiv + '_CadreImageUL"></div>';
	html += '<div class="the_breaker"></div>';
	html += '</div>';
	
	document.writeln(html);
}

function PJPACarrousselCreateDivInterface(nomGlobal, prefDiv) {
    var html = '<div class="carrouselFD" id="' + prefDiv + '_diaporama">';
    html += '<div id="' + prefDiv + '_CadreImageUL"></div>';
    html += '<div class="the_breaker"></div>';
    html += '</div>';
    html += '<div id="' + prefDiv + '_div_BarreRightSemidet" style="display:none;" class="CarrouselSemidet" onmouseover="_pjpaOnAds = true;" onmouseout="_pjpaOnAds = false;' + nomGlobal + '.ThumbailOut();" onmousedown="' + nomGlobal + '.ClickInfosBulle();">';
    html += '<div id="' + prefDiv + '_contener_semi_detaillee" class="carrousel_infosbulle" style="display:block; left:0px;" >';
    html += '<div class="fd_c"  >';
    html += '<div class="fd_h">';
    html += '<div class="fd_b" style=" position:relative;">';
    html += '<div class="contenu" id="' + prefDiv + '_contenu"></div>';
    html += '</div>';
    html += '<div class="the_breaker"></div>';
    html += '</div>';
    html += '<div class="fd_b2"></div>';
    html += '</div>';
    html += '<div class="the_breaker"></div>';
    html += '<div class="flechePopup" id="' + prefDiv + '_flechePopup" ></div>';
    html += '</div>';
    html += '</div>';
    document.writeln(html);
}
/*** NOTRE SELECTION ***/
function PJPANotreSelectionCreateDivInterface(nomGlobal, prefDiv, divDestination, css, isDisplay) {
	var html = '';
	var display = "";
	
	if (isDisplay) {
		display = "block";
	}
	else {
		display = "none";
	}

	html += '<div id="' + divDestination + '" class="' + css + '" style="display:' + display + ';">';
	html += '<div class="carrouselFD" id="' + prefDiv + '_diaporama">';
	html += '<div id="' + prefDiv + '_CadreImageUL"></div>';
	html += '<div class="the_breaker"></div>';
	html += '</div>';

	if (nomGlobal == "_PJPANSServicesEmployeur") {
		var url = "http://services.annoncesjaunes.fr/arborescence/tous-les-etudiants.html";
		html += '<div class="Bouton220_Off" onmouseover="mld(this,\'Bouton220\')"><a class="LienBouton" href="' + url + '" >Voir toutes les offres de jobs</a></div>';
	}
	else if (nomGlobal == "_PJPANSServicesPresta") {
		var url = "http://services.annoncesjaunes.fr/arborescence/tous-les-jobs.html";
		html += '<div class="Bouton240_Off" onmouseover="mld(this,\'Bouton240\')"><a class="LienBouton" href="' + url + '" >Voir tous les prestataires de services</a></div>';
	}
	
	html += '</div>';

	document.writeln(html);
}

PJPACarroussel.prototype.BtnGaucheHide = function() {
	if (NotUndefinedNotNull(this.BtnGauche)) {
		this.BtnGauche.style.visibility = 'hidden';
	}
}

PJPACarroussel.prototype.BtnGaucheShow = function() {
	if (NotUndefinedNotNull(this.BtnGauche)) {
        this.BtnGauche.style.visibility = 'visible';
    }
}

PJPACarroussel.prototype.BtnDroiteHide = function() {
	if (NotUndefinedNotNull(this.BtnDroite)) {
        this.BtnDroite.style.visibility = 'hidden';
    }
}

PJPACarroussel.prototype.BtnDroiteShow = function() {
	if (NotUndefinedNotNull(this.BtnDroite)) {
        this.BtnDroite.style.visibility = 'visible';
    }
}

PJPACarroussel.prototype.ClickThumbail = function(i) {
	/*if (this.Mode == "") {
		PJPATagXitiCarrousel(this.Secteur);
	}
	else {
		var Tag = "Home::H_Vignette_Selection_1"; //Home_Immo::I_Vignette_Selection_1
		//Tag = this.Secteur
		PJPATagXitiCall(Tag);
	}*/
PJPATagXitiCarrousel(this.Secteur, this.TagContext);

	if (NotUndefinedNotNull(this.ListeImage[i].LienAnnonce)) {
		setTimeout('document.location = "' + this.ListeImage[i].LienAnnonce + '";', 200);
	}
}

PJPACarroussel.prototype.ClickThumbailDiapo = function(i) {
	if (this.Parent != undefined) {

		eval(this.Parent + '.Diapo.SetCurrentImgPlay( ' + i + ');');
		eval(this.Parent + '.Diapo.Stop(false, false);');

		var me = getID("myFlashMovie");
		if (me != undefined) {
			var sendText = i;
			me.SetVariable("testValue", sendText);
		}

		var sect = GetTagXitSecteur(this.Secteur);
		var Tag = sect + '::FD_' + sect + '::l_Photos_Carrousel';
		PJPATagXitiCall(Tag);
	}
}

function GetTagXitSecteur(secteur) {
	if (secteur != undefined) {
		if (secteur == "Immobilier") {
			return "Immo";
		}
		else if (secteur == "Automobile") {
			return "Auto";
		}
		else if (secteur == "Moto") {
			return "Moto";
		}
		else if (secteur == "Services") {
			return "Sad";
		}
		else if (secteur == "Emploi" || secteur == "Stage") {
			return secteur;
		}
		else {
			return "Home";
		}
	}
	else {
		return "Home";
	}		
}

PJPACarroussel.Opacity = function(obj, valeur) {
    if (obj != null && obj != undefined) {
        if ($.browser.msie) {
            obj.style.filter = 'alpha(opacity=' + (valeur * 100) + ')';
        }
        else {
            obj.style.opacity = valeur;
        }
    }
}

PJPACarroussel.prototype.ListeImgOut = function() {
    PJPACarroussel.Opacity(this.CadreThumbails, 0.6);
}

PJPACarroussel.prototype.ListeImgOn = function() {
    PJPACarroussel.Opacity(this.CadreThumbails, 1);
}

PJPACarroussel.prototype.BtnDroiteOn = function() {
    PJPACarroussel.Opacity(this.BtnDroite, 1);
    
    _pjpaOnCarrousel = true;
    clearTimeout(_pjpaCacheListeImg);
    setTimeout(this.ID + '.OnMouseOver()', 100);
}

PJPACarroussel.prototype.BtnDroiteOut = function() {
    PJPACarroussel.Opacity(this.BtnDroite, 0.6);

    this.OnMouseOut(this.ID);
}

PJPACarroussel.prototype.BtnGaucheOn = function() {
    PJPACarroussel.Opacity(this.BtnGauche, 1);


    _pjpaOnCarrousel = true;
    clearTimeout(_pjpaCacheListeImg);
    setTimeout(this.ID + '.OnMouseOver()', 100);
}

PJPACarroussel.prototype.BtnGaucheOut = function() {
    PJPACarroussel.Opacity(this.BtnGauche, 0.6);
    this.OnMouseOut(this.ID);
}

PJPACarroussel.prototype.ThumbailOut = function() {
    _pjpaOnAds = false;
    setTimeout("HideDescriptionDiv('" + this.ID + "')", 100);
}

function HideDescriptionDiv(varGlobal) {
    if (!_pjpaOnAds) {
        eval("$(" + varGlobal + ".DescriptionDiv).hide();");
        eval(varGlobal + ".ListeImgOut();");
    }
}

PJPACarroussel.prototype.OnMouseOver = function() {
    if (this.Mode == PJPA_MODE_CARROUSEL) {
        _pjpaOnCarrousel = true;
        this.ListeImgOn();
    }
}

var _pjpaCacheListeImg = null;
PJPACarroussel.prototype.OnMouseOut = function() {
    if (this.Mode == PJPA_MODE_CARROUSEL) {
        _pjpaOnCarrousel = false;
        _pjpaCacheListeImg = setTimeout("GriseCarrousel('" + this.ID + "')", 1000);
    }
}

function GriseCarrousel(varGlobal) {
    if (!_pjpaOnCarrousel && !_pjpaOnAds) {
        eval(varGlobal + ".ListeImgOut();");
    }
}

PJPACarroussel.prototype.InitCarroussel = function() {
	if (this.ListeImage.length == 0) {
		return;
	}

	var urlpixgif = "/_Images/pix.gif"
	var tmp1 = parseInt((this.ListeImage.length / this.NbVignettes));
	this.MaxPointer = tmp1 + ((this.ListeImage.length / this.NbVignettes) - tmp1 > 0 ? 1 : 0);
	var hauteurVignette = (this.HeightMaxVignette + 2);

	var afficheBtnNav = (this.ListeImage.length > this.NbVignettes || this.Mode == PJPA_MODE_SEL);
	var nbvignmax = (this.ListeImage.length > this.NbVignettes ? this.NbVignettes : this.ListeImage.length);
	var widthMax = (nbvignmax * (this.WidthMaxVignette + 2) + (nbvignmax - 1) * this.EspaceVignette);
	var widthAll = (this.ListeImage.length * (this.WidthMaxVignette + 2) + (this.ListeImage.length - 1) * this.EspaceVignette);

	//div deb NAV
	var styleNavigation = 'style="width:' + (widthMax + (afficheBtnNav ? this.WithTotalBtn : 0)) + 'px;" ';
	if (this.Mode != PJPA_MODE_DIAPO) {
		styleNavigation += 'style="width:' + (widthMax + (afficheBtnNav ? this.WithTotalBtn : 0)) + 'px;' + (afficheBtnNav || this.Mode == PJPA_MODE_NS ? '' : 'margin:0px;') + '" ';
	}
	var DivBtnNavigation = '<div class="FdTopNavigation"><div id="' + this.PrefixeDiv + '_BtnNavigation" class="BtnNavigation"' + styleNavigation + ' >';

	//div deb pos nav
	var displayPosNav = "";
	var marginCadreThumbail = "";
	if (!afficheBtnNav) {
		if (this.Mode == PJPA_MODE_DIAPO || this.Mode == PJPA_MODE_SEL) {
			displayPosNav = "display:none;";
		}
		marginCadreThumbail = "margin:0px;";
	}


	var DivPosNav = "";
	if (this.Mode != PJPA_MODE_SEL) {
		DivPosNav = "<div class='PosNav' style='margin-left:" + (widthMax / 2) + "px;" + displayPosNav + "'>";
		if (this.MaxPointer > 1 && this.Mode != PJPA_MODE_SEL) {
			this.PosNav = new Array();
			for (var i = 0; i < this.MaxPointer; i++) {
				if (i == 0) {
					DivPosNav += '<div id="' + this.PrefixeDiv + '_bl_' + i + '" class="IndPosition_' + this.Secteur + '"></div>';
				}
				else {
					DivPosNav += '<div id="' + this.PrefixeDiv + '_bl_' + i + '" class="IndPosition"></div>';
				}
				this.PosNav[i] = this.PrefixeDiv + "_bl_" + i;
			}
			DivPosNav += '<div class="the_breaker"></div>';
		}
		else {
			DivPosNav += '<div style="height:11px;">&nbsp;</div>';
		}

		DivPosNav += '</div>';
		DivPosNav += '<div class="the_breaker"></div>';
	}
	//div fin pos nav

	var DivBtnGauche = '<div id="' + this.PrefixeDiv + '_BtnGauche" style="height:' + hauteurVignette + 'px;" onmousedown="' + this.ID + '.ClickBtnGauche()" onmouseover="' + this.ID + '.BtnGaucheOn()" onmouseout ="' + this.ID + '.BtnGaucheOut()" class="BtnLeft' + this.Secteur + '"></div>';
	var DivBtnDroite = '<div id="' + this.PrefixeDiv + '_BtnDroite" style="height:' + hauteurVignette + 'px;" onmousedown="' + this.ID + '.ClickBtnDroite()" onmouseover="' + this.ID + '.BtnDroiteOn()" onmouseout ="' + this.ID + '.BtnDroiteOut()" class="BtnRight' + this.Secteur + '" xtclib="'+ this.Page +'_Coups_coeur_suivant"></div>';

	//div deb cadre
	var thumbList = "<div id='" + this.PrefixeDiv + "_cadre_thumbails' class='cadreThumbail' style='width:" + (widthMax) + "px;" + marginCadreThumbail + "'><div id='" + this.PrefixeDiv + "_ul_thumbails' class=\"thumbails\"  style='left:0px; width:" + widthAll + "px;'  onmouseover='" + this.ID + ".OnMouseOver()' onmouseout='" + this.ID + ".OnMouseOut()' ><div class='ListeImg'> ";
	var description = "";

	for (var i = 0; i < this.ListeImage.length; i++) {

		this.ListeImage[i].id = "img" + i;

		var classe = "";
		if (i == 0) {
			classe = " class='vign firstli' ";
		}
		else {
			classe = " class='vign' ";
		}

		var onmouseover = "";
		var onmouseout = "";
		var onmouseclick = "";
		var marginLeft = "";

		var haveLienAnnonce = this.ListeImage[i].LienAnnonce != null && this.ListeImage[i].LienAnnonce != undefined;

		if (this.WithDescription && this.Mode == PJPA_MODE_CARROUSEL) {
			onmouseover = " onmouseover=\"" + this.ID + ".ThumbailOver(" + i + ")\" ";
			onmouseout = " onmouseout=\"" + this.ID + ".ThumbailOut(" + i + ")\" ";
			onmouseclick = " onmousedown=\"" + this.ID + ".ClickThumbail(" + i + ")\" ";
		}
		else if (this.WithDescription && this.Mode == PJPA_MODE_NS) {
			onmouseover = " onmouseover=\"" + this.ID + ".ThumbailOverNS(this," + i + ")\" ";
			onmouseout = " onmouseout=\"" + this.ID + ".ThumbailOutNS(this," + i + ")\" ";
			onmouseclick = " onmousedown=\"" + this.ID + ".ClickThumbail(" + i + ")\" ";
			description = "<div class='NS_desc'>" + this.ListeImage[i].Description1 + "</div>";
			hauteurVignette = "160";
			if (i > 0) {
				marginLeft = "margin-left:" + this.EspaceVignette + "px;";
			}
		}
		else if (this.Mode == PJPA_MODE_SEL && haveLienAnnonce) {
			onmouseclick = " onmousedown=\"" + this.ID + ".ClickThumbail(" + i + ")\" ";
		}
		else if (this.Mode == PJPA_MODE_DIAPO) {
			onmouseclick = " onmousedown=\"" + this.ID + ".ClickThumbailDiapo(" + i + ")\" ";
		}

		var tagjpja = "";
		var bAffImage = (i < this.NbVignettes && this.IsVisible);
		if (this.ListeImage[i].TagPJPA != undefined && this.ListeImage[i].TagPJPA != "" && this.Mode != PJPA_MODE_SEL) {
			var urltagpjpa = urlpixgif;
			if (bAffImage) {
				urltagpjpa = this.ListeImage[i].TagPJPA;
			}
			tagjpja = "<img id='" + this.ID + "_tagpjpa_" + this.ListeImage[i].id + "' src='" + urltagpjpa + "' height='0' width='0' />";
		}

		var urlimage = urlpixgif;
		if (bAffImage) {
			urlimage = this.ListeImage[i].ImageUrl;
		}

		if (this.Mode == PJPA_MODE_NS) {
			var xtclib = " xtclib = '" + this.Page + "_Coups_coeur_vignette" + (i + 1) + "' ";
		}

		thumbList += "<div id='" + this.PrefixeDiv + "th_" + this.ListeImage[i].id + "' " + onmouseover + onmouseout + onmouseclick + " " + classe + " style='width:" + (this.WidthMaxVignette + 2) + "px;" + (haveLienAnnonce ? "" : "cursor:default;") + marginLeft + "' >";
		thumbList += "<img id='" + this.ID + "_princ_" + this.ListeImage[i].id + "' class='thumb' src='" + urlimage + "' height='" + this.HeightMaxVignette + "' width='" + this.WidthMaxVignette + "' alt=''" + xtclib + " />" + tagjpja;
		thumbList += description;
		thumbList += "</div>";
	}
	thumbList += "</div></div>"; //div fin cadre
	thumbList += "</div>"; //div deb NAV

	var DivNavigation = DivPosNav;
	if (afficheBtnNav || this.Mode == PJPA_MODE_SEL) {
		DivNavigation += DivBtnNavigation + DivBtnGauche + thumbList + DivBtnDroite + '<div class="the_breaker"></div></div></div>';
	}
	else {
		DivNavigation += DivBtnNavigation + thumbList + '<div class="the_breaker"></div></div></div>';
	}

	DivNavigation += '<div class="FdBottomNavigation"></div>';

	$(this.ConteneurDiv).html($(this.ConteneurDiv).html() + DivNavigation);

	this.Thumbails = document.getElementById(this.PrefixeDiv + "_ul_thumbails");
	this.CadreThumbails = document.getElementById(this.PrefixeDiv + "_cadre_thumbails");
	this.BtnGauche = document.getElementById(this.PrefixeDiv + "_BtnGauche");
	this.BtnDroite = document.getElementById(this.PrefixeDiv + "_BtnDroite");

	this.BtnDroiteOut();
	this.BtnGaucheOut();
	this.BtnGaucheHide();
	
	if (this.Mode == PJPA_MODE_SEL && this.ListeImage.length <= this.NbVignettes) {
		this.BtnDroiteHide();
	}

	this.NewPosition = ($("#" + this.Thumbails.id).css("left")).replace(/px/gi, "");

	if (this.Mode == PJPA_MODE_CARROUSEL) {
		this.ListeImgOut();
	}

	if (this.ListeImage.length > 0 && this.BlocCarrousel != undefined) {
		$(this.BlocCarrousel).show();
	}
	
}

function PJPATagXitiCarrousel(secteur, tagContext) {
	if (secteur == "Immobilier" && tagContext == "Annonces_plus_consultees_carroussel") {
		TagClick('C', '2', 'Actions_FD::Carroussel_ayant_consulte', 'N');
	}
	else if (secteur == "Immobilier" && tagContext == "Carroussel_annonces_similaires") {
		TagClick('C', '2', 'Actions_FD::Arche_droite::Carroussel_annonces_similaires', 'N');
	}
	else if (secteur == "Immobilier" && tagContext == "Carroussel_annonces_similaires_annonce_expiree") {
		TagClick('C', '2', 'Actions_FD::FD_Indispo_Carroussel_annonces_similaires', 'N');
	}
	else if (secteur == "Automobile" && tagContext == "Annonces_plus_consultees_carroussel") {
		TagClick('C', '3', 'Auto::Actions_FD::Carroussel_ayant_consulte', 'N');
	}
	else if (secteur == "Automobile" && tagContext == "Carroussel_annonces_similaires") {
		TagClick('C', '3', 'Auto::Actions_FD::Arche_droite::Carroussel_annonces_similaires', 'N');
	}
	else if (secteur == "Automobile" && tagContext == "Carroussel_annonces_similaires_annonce_expiree") {
		TagClick('C', '3', 'Auto::Actions_FD::FD_Indispo_Carroussel_annonces_similaires', 'N');
	}
	else if (secteur == "Moto" && tagContext == "Annonces_plus_consultees_carroussel") {
		TagClick('C', '3', 'Moto::Actions_FD::Carroussel_ayant_consulte', 'N');
	}
	else if (secteur == "Moto" && tagContext == "Carroussel_annonces_similaires") {
		TagClick('C', '3', 'Moto::Actions_FD::Arche_droite::Carroussel_annonces_similaires', 'N');
	}
	else if (secteur == "Moto" && tagContext == "Carroussel_annonces_similaires_annonce_expiree") {
		TagClick('C', '3', 'Moto::Actions_FD::FD_Indispo_Carroussel_annonces_similaires', 'N');
	}
    /*if (secteur == "Immobilier" || secteur == "Immo") {
        xt_med('C', '0', 'Immo::FD_Immo::I_FD_Carrousel_Annonces', 'N');
    }
    else if (secteur == "Automobile" || secteur == "Auto") {
        xt_med('C', '0', 'Auto::FD_Auto::A_FD_Carrousel_Annonces', 'N');
    }
    else if (secteur == "Moto" || secteur == "Moto") {
        xt_med('C', '0', 'Moto::FD_Moto::M_FD_Carrousel_Annonces', 'N');
    }*/
}

function PJPATagXitiCall(Tag) {
	if (Tag != undefined && Tag != null && Tag != "") {
		xt_med('C', '0', Tag, 'N');
	}
}


PJPACarroussel.prototype.ClickInfosBulle = function() {
    if (this.CurrentAnnonce != undefined && this.CurrentAnnonce != -1) {
        this.ClickThumbail(this.CurrentAnnonce);
    }
}

PJPACarroussel.prototype.ThumbailOverNS = function(obj, i) {
   	if (this.Mode == PJPA_MODE_NS) {
   		$(obj).addClass(" Select");
   	}
}

PJPACarroussel.prototype.ThumbailOutNS = function(obj, i) {
	if (this.Mode == PJPA_MODE_NS) {
		$(obj).removeClass(" Select");
	}
}

PJPACarroussel.prototype.ThumbailOver = function(i) {
	if (!_pjpaOnMoveVignette) {
		this.CurrentAnnonce = i;

		if (this.Mode == PJPA_MODE_CARROUSEL) {
			var ajust = 0;
			var afficheBtnNav = (this.ListeImage.length > this.NbVignettes);
			if ($.browser.msie) {
				ajust = 10;
			}

			if (!afficheBtnNav) {
				ajust = ajust - 25;
			}

			this.DescriptionDiv.style.left = ((((i % this.NbVignettes) * this.WidthMaxVignette + (i % this.NbVignettes) * this.EspaceVignette) + 10) + ajust) + "px";

			$(this.DescriptionContenu).html(this.GetInfos(i));
			$(this.DescriptionDiv).show();
			_pjpaOnCarrousel = true;
			_pjpaOnAds = true;
		}
	}
}

PJPACarroussel.prototype.GetInfos = function(i) {
    var html = this.ListeImage[i].Description1;
    $(this.DescriptionContenu).html(html + '<div class="the_breaker"></div>');
}

PJPACarroussel.prototype.ClickBtnGauche = function() {
	var varGlobal = this.ID;
	var CurrentPosition = $("#" + this.Thumbails.id).css("left");
	CurrentPosition = parseInt(CurrentPosition.replace(/px/gi, ""));

	if (!_pjpaOnMoveVignette && this.NewPosition == CurrentPosition) {
		var offsetL = parseInt($("#" + this.Thumbails.id).css("left")) + (this.WidthMaxVignette + 2 + this.EspaceVignette) * this.NbVignettes;
		this.NewPosition = offsetL;

		_pjpaOnMoveVignette = true;
		if (this.Mode != PJPA_MODE_SEL) {
			var currentPos = document.getElementById(this.PosNav[this.Pointer - 1]);
			currentPos.className = "IndPosition";
		}
		this.Pointer--;
		if (this.Mode != PJPA_MODE_SEL) {
			currentPos = document.getElementById(this.PosNav[this.Pointer - 1]);
			currentPos.className = "IndPosition_" + this.Secteur;
		}
		var pointer = this.Pointer;
		var maxPointer = this.MaxPointer;

		$(this.Thumbails).animate({ left: offsetL + "px" }, 1000, "swing",
        PJPACarrouselCacheBoutonApresClick(varGlobal, pointer, maxPointer)
        );
	}
}

PJPACarroussel.prototype.ClickBtnDroite = function() {
	var varGlobal = this.ID;
	var CurrentPosition = $("#" + this.Thumbails.id).css("left");
	CurrentPosition = parseInt(CurrentPosition.replace(/px/gi, ""));

	if (!_pjpaOnMoveVignette && this.NewPosition == CurrentPosition) {
		var offsetL = parseInt($("#" + this.Thumbails.id).css("left")) - (this.WidthMaxVignette + 2 + this.EspaceVignette) * this.NbVignettes;

		this.NewPosition = offsetL;

		_pjpaOnMoveVignette = true;
		if (this.Mode != PJPA_MODE_SEL) {
			var currentPos = document.getElementById(this.PosNav[this.Pointer - 1]);
			currentPos.className = "IndPosition";
		}
		this.Pointer++;
		if (this.Mode != PJPA_MODE_SEL) {
			currentPos = document.getElementById(this.PosNav[this.Pointer - 1]);
			currentPos.className = "IndPosition_" + this.Secteur;
		}
		var pointer = this.Pointer;
		var maxPointer = this.MaxPointer;

		this.LaunchTagPJPA();

		$(this.Thumbails).animate({ left: offsetL + "px" }, 1000, "swing",
        PJPACarrouselCacheBoutonApresClick(varGlobal, pointer, maxPointer)
        );
	}
}

PJPACarroussel.prototype.LaunchTagPJPA = function() {
	var deb = (this.Pointer - 1) * this.NbVignettes;
	var fin = (this.Pointer) * this.NbVignettes;

	for (var i = deb; i < fin; i++) {
		if (this.ListeImage[i] != undefined) {
			var tag = document.getElementById(this.ID + '_tagpjpa_' + this.ListeImage[i].id);
			if (tag != undefined && tag.src.indexOf('pix.gif') != -1) {
				tag.src = this.ListeImage[i].TagPJPA;
			}
			var img = document.getElementById(this.ID + '_princ_' + this.ListeImage[i].id);
			if (img != undefined && img.src.indexOf('pix.gif') != -1) {
				img.src = this.ListeImage[i].ImageUrl;
			}
		}
	}
}

function PJPACarrouselCacheBoutonApresClick(varGlobal, pointer, maxPointer) {
	_pjpaOnMoveVignette = false;

	var _carroussel = eval(varGlobal);

	if (pointer == 1) {
		_carroussel.BtnGaucheHide();
		_carroussel.BtnDroiteShow();
	}
	else if (pointer == maxPointer) {
		_carroussel.BtnDroiteHide();
		_carroussel.BtnGaucheShow();
	}
	else if (pointer > 1 && pointer < maxPointer) {
		_carroussel.BtnGaucheShow();
		_carroussel.BtnDroiteShow();
	}
	else {
		_carroussel.BtnDroiteShow();
	}    
}

function PJPAGetThumbName(n, prefix) {
    var arr = n.split("/");
    var tl = n.length;
    var w = arr[arr.length - 1].length;
    return n.substr(0, tl - w - 1) + "/" + prefix + arr[arr.length - 1];
}


function PJPATryParseInt(str, defaultValue) {
    var retValue = defaultValue;
    if (str != null) {
        if (str.length > 0) {
            if (!isNaN(str)) {
                retValue = parseInt(str);
            }
        }
    }
    return retValue;
}

// calcule le d�calage � gauche
function PJPACalculateOffsetLeft(r) {
    return PJPACalculateOffset(r, "offsetLeft")
}

// calcule le d�calage vertical
function PJPACalculateOffsetTop(r) {
    return PJPACalculateOffset(r, "offsetTop")
}

function PJPACalculateOffset(r, attr) {
    var kb = 0;
    while (r) {
        kb += r[attr];
        r = r.offsetParent
    }
    return kb
}

// calcule la largeur du champ
function PJPACalculateWidth(input) {
	if (input != undefined && input != null) {
		//return input.offsetWidth;
		return $(input).outerWidth();
	}
	else
		return 300;
        
}
// calcule la largeur du champ
function PJPACalculateHeight(input) {
    if (input != undefined && input != null)
        return input.offsetHeight - 2 * 1 - 4;
    else
        return 210;
}


/******* Fin PJPACarroussel ***/


/*---- SmartCarroussel.Data.js ----*/

var cfgImagePixGris = "/_Images/commun/pixGris.png";

SmartCarroussel.prototype.SetData = function(listeImage) {

	if (listeImage != undefined) {
		this.ListeImage = listeImage;

		//on pré charge la deuxieme page
		if (this.TotalResult > 10 && this.CallWsByPage) {
			this.CallWebService(2, false);
		}
	}
}

SmartCarroussel.prototype.AddData = function(listeImage) {
	if (this.ListeImage != undefined && listeImage != undefined) {
		var currentLength = this.ListeImage.length;
		var NbAddItems = listeImage.length;

		for (var i = 0; i < NbAddItems; i++) {
			this.ListeImage[currentLength + i] = listeImage[i];
		}

		var thumbListADD = this.GetListImagesHTML(currentLength, currentLength + NbAddItems);

		var thumbList = $(this.Thumbails).html() + thumbListADD;
		//$(this.Thumbails).html(thumbList);
		this.Thumbails.innerHTML = thumbList;

		if (this.ModeAffichage == MODE_HORIZONTAL) {
			var widthAll = (this.ListeImage.length * (this.WidthMaxVignette + 2) + (this.ListeImage.length - 1) * this.EspaceVignette) + 10;
			this.Thumbails.style.width = widthAll + 'px';
		}
	}
}

SmartCarroussel.prototype.GetNewItem = function(imageUrl, lienAnnonce, idAnnonce, tagPJPA, titre, prixAff, description1, description2) {
	var newData = new Object();
	newData.ImageUrl = imageUrl;
	newData.LienAnnonce = lienAnnonce;
	newData.IdAnnonce = idAnnonce;
	newData.TagPJPA = tagPJPA;
	newData.Titre = titre;
	newData.PrixAff = prixAff;
	newData.Description1 = description1;
	newData.Description2 = description2;
	return newData;
}

SmartCarroussel.prototype.AddManquantToList = function(nbManquant, imageUrl) {
	if (nbManquant > 0) {
		if (this.ListeImage == undefined ) {
			this.ListeImage = new Array();
		}

		var currentLength = this.ListeImage.length;
		
		for (var i = currentLength; i < currentLength + nbManquant; i++) {
			if (imageUrl == undefined) {
				imageUrl = cfgImagePixGris;
			}
			var newData = this.GetNewItem(imageUrl, undefined, undefined, "", null, null, null, null);
			this.ListeImage[i] = new Object();
			this.ListeImage[i] = newData;
		}
	}
}

SmartCarroussel.prototype.CallWebService = function(currentPage, genIHM) {
	if (!IsHostGoogleWebCacheOrTranslation()) {

		var params = this.Parametres;
		if (this.CallWsByPage) {
			params += ', "currentPage" : "' + currentPage + '"';
		}

		$.ajax({
			type: "POST",
			url: '/WebServices/Carrousel.asmx/' + this.FunctionName,
			data: '{' + params + '}',
			contentType: WebServiceCarrouselContentType,
			dataType: "json",
			success: SmartCarrousselCallSucceedJson,
			IdDivToHide: this.IdDivToHide,
			NameVarGlobal: this.ID,
			CurrentPage: currentPage,
			ObjCarroussel: this,
			GenIHM: genIHM
		});
	}
}

SmartCarrousselCallSucceedJson = function(response) {
	SmartCarrousselInitDATA(response, this.ObjCarroussel, this.CurrentPage, this.GenIHM);
}

SmartCarrousselInitDATA = function(response, objCarroussel, currentPage, genIHM) {

	var obj = objCarroussel;

	if (response != undefined && response != null && response != '') {
		var waitDisplay = false;
		if (response.TotalResult != undefined) {
			waitDisplay = true;
			if (currentPage == 1) {
				obj.TotalResult = response.TotalResult;
				obj.SetData(response.ListElements);
			}
			else {
				obj.AddData(response.ListElements);
			}

		}
		else {
			obj.TotalResult = response.length;
			obj.SetData(response);
		}

		if (obj.AddManquant) {
			var nbElements = obj.ListeImage.length;
			if (nbElements > 0) {
				var nbPg = parseInt(nbElements / objCarroussel.NbVignettes);
				var addpg = nbElements % objCarroussel.NbVignettes > 0 ? 1 : 0;
				nbPg = nbPg + addpg;
				var Nbmanquant = nbPg * objCarroussel.NbVignettes - nbElements;

				obj.AddManquantToList(Nbmanquant);
				obj.TotalResult = obj.ListeImage.length;
			}
		}

		if (genIHM) {
			obj.InitCarroussel();
		}

		if (obj.BlocToHide != undefined) {
			if (waitDisplay) {
				setTimeout("fadeInBloc('" + obj.BlocToHide.id + "')", 4000);
			}
			else {
				//$(obj.BlocToHide).show();
				fadeInBloc(obj.BlocToHide.id);
			}
		}

		obj.XitiChargement();
	}
	else {
		if (obj.AddManquant) {
			obj.AddManquantToList(objCarroussel.NbVignettes);
			obj.TotalResult = objCarroussel.NbVignettes;

			if (genIHM) {
				obj.InitCarroussel();
			}

			if (obj.BlocToHide != undefined) {
				$(obj.BlocToHide).show();
			}

			obj.XitiChargement();
		} else {
			if (obj.BlocToHide != undefined) {
				$(obj.BlocToHide).hide();
			}
		}
	}
}

function fadeInBloc(id) {

	$("#" + id).fadeIn(2000);
	
	
}

/*---- SmartCarroussel.IHMEvents.js ----*/

var _pjpaCacheListeImg = null;

SmartCarroussel.prototype.ListeImgOut = function() {
	SetOpacity(this.CadreThumbails, 0.6);
}

SmartCarroussel.prototype.ListeImgOn = function() {
	SetOpacity(this.CadreThumbails, 1);
}


SmartCarroussel.prototype.OnMouseOver = function() {
	if (this.Mode == MODE_DESC_INFOBULLE) {
		_pjpaOnCarrousel = true;
		this.ListeImgOn();
	}
}

SmartCarroussel.prototype.OnMouseOut = function() {
	if (this.Mode == MODE_DESC_INFOBULLE) {
		_pjpaOnCarrousel = false;
		_pjpaCacheListeImg = setTimeout("GriseCarrousel('" + this.ID + "')", 1000);
	}
}

function GriseCarrousel(varGlobal) {
	if (!_pjpaOnCarrousel && !_pjpaOnAds) {
		eval(varGlobal + ".ListeImgOut();");
	}
}

SmartCarroussel.prototype.BtnPrecOn = function() {
	SetOpacity(this.BtnPrec, 1);
	_pjpaOnCarrousel = true;
	clearTimeout(_pjpaCacheListeImg);
	setTimeout(this.ID + '.OnMouseOver()', 100);
}

SmartCarroussel.prototype.BtnPrecOut = function() {
	SetOpacity(this.BtnPrec, 0.6);
	this.OnMouseOut(this.ID);
}

SmartCarroussel.prototype.BtnSuivOn = function() {
	SetOpacity(this.BtnSuiv, 1);
	_pjpaOnCarrousel = true;
	clearTimeout(_pjpaCacheListeImg);
	setTimeout(this.ID + '.OnMouseOver()', 100);
}

SmartCarroussel.prototype.BtnSuivOut = function() {
	SetOpacity(this.BtnSuiv, 0.6);
	this.OnMouseOut(this.ID);
}


SmartCarroussel.prototype.BtnPrecHide = function() {
	if (NotUndefinedNotNull(this.BtnPrec)) {
		this.BtnPrec.style.visibility = 'hidden';
	}
}

SmartCarroussel.prototype.BtnPrecShow = function() {
	if (NotUndefinedNotNull(this.BtnPrec)) {
		this.BtnPrec.style.visibility = 'visible';
	}
}

SmartCarroussel.prototype.BtnSuivHide = function() {
	if (NotUndefinedNotNull(this.BtnSuiv)) {
		this.BtnSuiv.style.visibility = 'hidden';
	}
}

SmartCarroussel.prototype.BtnSuivShow = function() {
	if (NotUndefinedNotNull(this.BtnSuiv)) {
		this.BtnSuiv.style.visibility = 'visible';
	}
}

SmartCarroussel.prototype.ClickBtnPrec = function() {
	var attribut = this.GetPropertieToChange();
	var varGlobal = this.ID;
	var CurrentPosition = $("#" + this.Thumbails.id).css(attribut);
	CurrentPosition = parseInt(CurrentPosition.replace(/px/gi, ""));

	if (!_pjpaOnMoveVignette && this.NewPosition == CurrentPosition) {
		var offsetNew = parseInt($("#" + this.Thumbails.id).css(attribut));

		if (this.ModeAffichage == MODE_VERTICAL) {
			offsetNew = offsetNew + (this.HeightMaxVignette + 2 + this.EspaceVignette) * this.NbVignettes ;
		}
		else {
			offsetNew = offsetNew + (this.WidthMaxVignette + 2 + this.EspaceVignette) * this.NbVignettes;
		}

		this.NewPosition = offsetNew;

		_pjpaOnMoveVignette = true;
		if (this.AfficheInfoNav && this.ModeAffichage == MODE_HORIZONTAL) {
			var currentPos = document.getElementById(this.PosNav[this.CurrentPage - 1]);
			currentPos.className = "IndPosition";
		}
		this.CurrentPage--;
		if (this.AfficheInfoNav && this.ModeAffichage == MODE_HORIZONTAL) {
			currentPos = document.getElementById(this.PosNav[this.CurrentPage - 1]);
			currentPos.className = "IndPosition_" + this.Secteur;
		}

		var pointer = this.CurrentPage;
		var maxPointer = this.NbPagesTotal;
		
		
		if (this.ModeAffichage == MODE_VERTICAL) {
			$(this.Thumbails).animate({ top: offsetNew + "px" }, 1000, "swing",
		    SmartCarrouselCacheBoutonApresClick(varGlobal, pointer, maxPointer)
	        );
		}
		else {
			$(this.Thumbails).animate({ left: offsetNew + "px" }, 1000, "swing",
		    SmartCarrouselCacheBoutonApresClick(varGlobal, pointer, maxPointer)
	        );
		}
	}
}

SmartCarroussel.prototype.GetPropertieToChange = function() {
	if (this.ModeAffichage == MODE_VERTICAL) {
		return "top";
	}
	else {
		return "left";
	}
}

SmartCarroussel.prototype.ClickBtnSuiv = function() {
	var attribut = this.GetPropertieToChange();
	var varGlobal = this.ID;
	var CurrentPosition = $("#" + this.Thumbails.id).css(attribut);
	CurrentPosition = parseInt(CurrentPosition.replace(/px/gi, ""));

	if (!_pjpaOnMoveVignette && this.NewPosition == CurrentPosition) {

		var offsetNew = parseInt($("#" + this.Thumbails.id).css(attribut));
		if (this.ModeAffichage == MODE_VERTICAL) {
			offsetNew = offsetNew - (this.HeightMaxVignette + 2 + this.EspaceVignette) * this.NbVignettes;
		}
		else {
			offsetNew = offsetNew - (this.WidthMaxVignette + 2 + this.EspaceVignette) * this.NbVignettes;
		}

		this.NewPosition = offsetNew;

		_pjpaOnMoveVignette = true;
		if (this.AfficheInfoNav && this.ModeAffichage == MODE_HORIZONTAL) {
			var currentPos = document.getElementById(this.PosNav[this.CurrentPage - 1]);
			currentPos.className = "IndPosition";
		}
		
		this.CurrentPage++;

		if (this.AfficheInfoNav && this.ModeAffichage == MODE_HORIZONTAL) {
			currentPos = document.getElementById(this.PosNav[this.CurrentPage - 1]);
			currentPos.className = "IndPosition_" + this.Secteur;
		}

		var pointer = this.CurrentPage;
		var maxPointer = this.NbPagesTotal;

		this.LaunchTagPJPA();

		if (this.ModeAffichage == MODE_VERTICAL) {
			$(this.Thumbails).animate({ top: offsetNew + "px" }, 1000, "swing",
			SmartCarrouselCacheBoutonApresClick(varGlobal, pointer, maxPointer)
			);
		}
		else {
			$(this.Thumbails).animate({ left: offsetNew + "px" }, 1000, "swing",
			SmartCarrouselCacheBoutonApresClick(varGlobal, pointer, maxPointer)
			);
		}

		if (this.ListeImage.length < this.TotalResult) {
			this.CallWebService(this.ListeImage.length / 10 + 1, false);
		}

	}
}

SmartCarroussel.prototype.LaunchTagPJPA = function() {
	var deb = (this.CurrentPage - 1) * this.NbVignettes;
	var fin = (this.CurrentPage) * this.NbVignettes;

	if (this.ListeImage != undefined) {

		for (var i = deb; i < fin; i++) {

			if (this.ListeImage[i] != undefined) {
				var tag = document.getElementById(this.ID + '_tagpjpa_' + this.ListeImage[i].id);
				if (tag != undefined && tag.src.indexOf('pix.gif') != -1) {
					tag.src = this.ListeImage[i].TagPJPA;
				}
				var img = document.getElementById(this.ID + '_princ_' + this.ListeImage[i].id);
				if (img != undefined && img.src.indexOf('pix.gif') != -1) {
					img.src = this.ListeImage[i].ImageUrl;

					//alert(img.src + " " + img.style + " " + cfgImagePixGris);
					if (img.src.indexOf(cfgImagePixGris) != -1) {
						//alert(img.src + " " + img.style);

						img.style.width = this.WidthMaxVignette + "px";
						img.style.height = this.HeightMaxVignette + "px";
					}
				}
			}
		}
	}
}

/*
if (urlimage == cfgImagePixGris) {
thumbList += "<img id='" + this.ID + "_princ_" + item.id + "' class='thumb' src='" + urlimage + "' style='height:" + this.HeightMaxVignette + "px;width:" + this.WidthMaxVignette + "px;' alt='' " + xtclib + " />";
}
else {

}*/

SmartCarroussel.prototype.ResizeHeight = function() {
	if (this.ModeAffichage == MODE_VERTICAL && this.NbPagesTotal > 1) {
		if (this.CurrentPage == this.NbPagesTotal) {
			var nbdernierePage = this.TotalResult - this.NbVignettes * (this.NbPagesTotal - 1);
			if (nbdernierePage > 0) {
				var heightMax = (nbdernierePage * (this.HeightMaxVignette + 2) + (nbdernierePage - 1) * this.EspaceVignette);
				$(this.CadreThumbails).css("height", heightMax + "px");
				this.CurrentHeight = PJPACalculateHeight(this.DivToHide);
			}
			
			//Cas particulier et EXCEPTIONEL, à banir si possible
			if (this.ID == "carrousselAntiRebond") {
				$(document).scrollTop(0);
			}
		}
		else {
			var nbvignmax = (this.ListeImage.length > this.NbVignettes ? this.NbVignettes : this.ListeImage.length);
			var heightMax = (nbvignmax * (this.HeightMaxVignette + 2) + (nbvignmax - 1) * this.EspaceVignette);
			$(this.CadreThumbails).css("height", heightMax + "px");
			//this.CurrentHeight = heightMax;
			this.CurrentHeight = PJPACalculateHeight(this.DivToHide);
		}
	}
}

function SmartCarrouselCacheBoutonApresClick(varGlobal, pointer, maxPointer) {
	_pjpaOnMoveVignette = false;

	var _carroussel = eval(varGlobal);

	if (pointer == 1 && maxPointer > 1) {
		_carroussel.BtnPrecHide();
		_carroussel.BtnSuivShow();
	}
	else if (pointer == 1 && maxPointer == 1) {
		if (NotUndefinedNotNull(_carroussel.BtnPrec)) {
			$(_carroussel.BtnPrec).hide();
		}
		if (NotUndefinedNotNull(_carroussel.BtnPrec)) {
			$(_carroussel.BtnSuiv).hide();
		}
	}
	else if (pointer == maxPointer) {
		_carroussel.BtnSuivHide();
		_carroussel.BtnPrecShow();
	}
	else if (pointer > 1 && pointer < maxPointer) {
		_carroussel.BtnPrecShow();
		_carroussel.BtnSuivShow();
	}
	else {
		_carroussel.BtnSuivShow();
	}
	_carroussel.ResizeHeight();
}

SmartCarroussel.prototype.ClickThumbail = function(obj) {

	PJPATagXitiCarrousel(this.Secteur, this.TagContext);

	var item = this.GetItem(obj);

	if (NotUndefinedNotNull(item) && NotUndefinedNotNull(item.LienAnnonce)) {
		setTimeout('document.location = "' + item.LienAnnonce + '";', 200);
	}
}

SmartCarroussel.prototype.ThumbailOut = function() {
	_pjpaOnAds = false;
	setTimeout("HideDescriptionDiv('" + this.ID + "')", 100);
}

function HideDescriptionDiv(varGlobal) {
	if (!_pjpaOnAds) {
		eval("$(" + varGlobal + ".DescriptionDiv).hide();");
		eval(varGlobal + ".ListeImgOut();");
	}
}

SmartCarroussel.prototype.ThumbailOverNS = function(obj) {
	if (this.Mode == MODE_DESC_VISIBLE) {
		$(obj).addClass(" Select");
	}
}

SmartCarroussel.prototype.ThumbailOutNS = function(obj) {
	if (this.Mode == MODE_DESC_VISIBLE) {
		$(obj).removeClass(" Select");
	}
}

SmartCarroussel.prototype.ThumbailOver = function(obj) {
	if (!_pjpaOnMoveVignette) {

		//var item = this.GetItem(obj);
		var i = this.GetItemId(obj);
		this.CurrentAnnonce = this.GetItemId(obj);

		if (this.Mode == MODE_DESC_INFOBULLE) {

			var ajust = 0;
			var afficheBtnNav = (this.ListeImage.length > this.NbVignettes);
			if ($.browser.msie) {
				ajust = 10;
			}

			if (!afficheBtnNav) {
				ajust = ajust - 25;
			}

			var offsetConteneur = $(this.BlocCarrousel).offset();
			var offsetImg = $(obj).offset();
			var offsetInfoBulle = $(this.DescriptionDiv).offset();

			var bottomImg = 40;
			if (this.BottomInfoBulle != 0) {
				bottomImg = this.BottomInfoBulle;
			}

			var leftImg = offsetImg.left - offsetConteneur.left + this.LeftInfoBulle;

			$(this.DescriptionDiv).css({ bottom: bottomImg, left: leftImg });

			$(this.DescriptionContenu).html(this.GetInfos(i));
			$(this.DescriptionDiv).show();
			_pjpaOnCarrousel = true;
			_pjpaOnAds = true;
		}
	}
}

SmartCarroussel.prototype.GetInfos = function(i) {
	var html = this.ListeImage[i].Description1;
	$(this.DescriptionContenu).html(html + '<div class="the_breaker"></div>');
}


SmartCarroussel.prototype.XitiChargement = function() {
	if (this.TagChargement != undefined && this.Xtsite != undefined && this.Xtn2 != undefined) {
		var img = new Image();
		img.src = "http://logc23.xiti.com/hit.xiti?s=" + this.Xtsite + "&s2=" + this.Xtn2 + "&p=" + this.TagChargement + "&di=&an=&ac=";
	}
}

SmartCarroussel.prototype.AddSelection = function(idannonce, urlImage) {

	var nextIndex = this.ListeImage.length;
	for (var i = 0; i < this.ListeImage.length; i++) {
		if (this.ListeImage[i].ImageUrl == "/_Images/commun/pixGris.png") {
			nextIndex = i;
			break;
		}
	}
	
	var newData = new Object();
	newData.ImageUrl = urlImage;
	newData.IdAnnonce = idannonce;
	if (this.Secteur == "Immobilier") {
		newData.LienAnnonce = "/Immobilier/FicheDetail.aspx?IdAnnonce=" + idannonce;
	}
	else {
		newData.LienAnnonce = "/AutoMoto/FicheDetail.aspx?IdAnnonce=" + idannonce;
	}
	newData.TagPJPA = "";
	newData.Titre = null;
	newData.PrixAff = null;
	newData.Description1 = null;
	newData.Description2 = null;

	this.ListeImage[nextIndex] = newData;


	var nbElements = this.ListeImage.length;
	var nbPg = parseInt(nbElements / this.NbVignettes);
	var addpg = nbElements % this.NbVignettes > 0 ? 1 : 0;
	nbPg = nbPg + addpg;
	var Nbmanquant = nbPg * this.NbVignettes - nbElements;

	this.AddManquantToList(Nbmanquant,"/_Images/commun/pixGris.png");
    this.TotalResult = this.ListeImage.length;
    
	this.CurrentPage = 1;
//	$(this.ConteneurDiv).html("");
	this.ConteneurDiv.innerHTML = "";
	this.InitCarroussel();
}

SmartCarroussel.prototype.RemoveSelection = function(idannonce) {
	var nextIndex = 0;
	var listeImage = new Array();

	for (var i = 0; i < this.ListeImage.length; i++) {
		if (this.ListeImage[i].IdAnnonce != idannonce && this.ListeImage[i].IdAnnonce != undefined) {
			listeImage[nextIndex] = new Object();
			listeImage[nextIndex] = this.ListeImage[i];
			nextIndex++;
		}
	}

	this.ListeImage = listeImage;

	var nbElements = this.ListeImage.length;
	var nbPg = parseInt(nbElements / this.NbVignettes);
	var addpg = nbElements % this.NbVignettes > 0 ? 1 : 0;
	nbPg = nbPg + addpg;   

	var Nbmanquant = nbPg * this.NbVignettes - nbElements;
	
	Nbmanquant = (Nbmanquant == 0 && nbPg==0  ? 4 : Nbmanquant);  
   // alert(nbPg +" "+ addpg+" "+nbElements+" " +this.NbVignettes);
    
	this.AddManquantToList(Nbmanquant, "/_Images/commun/pixGris.png");
    this.TotalResult = this.ListeImage.length;

	this.CurrentPage = 1;
//	$(this.ConteneurDiv).html("");
	this.ConteneurDiv.innerHTML = "";
	this.InitCarroussel();
}

SmartCarroussel.prototype.ClickThumbailDiapo = function(obj) {
	if (this.ParentId != undefined) {
		var interfaceDiapo = eval(this.ParentId)

		var i = this.GetItemId(obj);

		interfaceDiapo.Diapo.SetCurrentImgPlay(i);
		interfaceDiapo.Diapo.Stop(false, false);

		var me = getID("myFlashMovie");
		if (me != undefined) {
			var sendText = i;
			me.SetVariable("testValue", sendText);
		}

		var sect = GetTagXitSecteur(this.Secteur);
		var Tag = sect + '::FD_' + sect + '::l_Photos_Carrousel';
		PJPATagXitiCall(Tag);

		TagClick("C", this.Xtn2, Tag, "A");
	}
}




/*---- SmartCarroussel.IHMGenerator.js ----*/

SmartCarroussel.prototype.CreateIHM = function() {
	var html = this.PJPACarrousselCreateDivInterface2(this.PrefixeDiv, this.PrefixeDiv);

	if (html != undefined && html != "") {
		$(this.BlocCarrousel).html(html);

		this.ConteneurDiv = document.getElementById(this.PrefixeDiv + '_CadreImageUL');
		this.ListeUL = document.getElementById(this.PrefixeDiv + '_imageUL');

		if (this.Mode == MODE_DESC_INFOBULLE) {
			var objBR = document.getElementById(this.PrefixeDiv + '_div_BarreRightSemidet');
			if (objBR != undefined) {
				this.DescriptionDiv = document.getElementById(this.PrefixeDiv + '_div_BarreRightSemidet');
				$(this.DescriptionDiv).hide();
				this.DescriptionContenu = $("#" + this.PrefixeDiv + '_div_BarreRightSemidet' + " #" + this.PrefixeDiv + "_" + "contenu");
			}
		}

		this.CallWebService(1, true);
	}
}

SmartCarroussel.prototype.CreateIHMJS = function(data) {

	var html = this.PJPACarrousselCreateDivInterface2(this.PrefixeDiv, this.PrefixeDiv);

	if (html != undefined && html != "") {
		$(this.BlocCarrousel).html(html);

		this.ConteneurDiv = document.getElementById(this.PrefixeDiv + '_CadreImageUL');
		this.ListeUL = document.getElementById(this.PrefixeDiv + '_imageUL');

		if (this.Mode == MODE_DESC_INFOBULLE) {
			var objBR = document.getElementById(this.PrefixeDiv + '_div_BarreRightSemidet');
			if (objBR != undefined) {
				this.DescriptionDiv = document.getElementById(this.PrefixeDiv + '_div_BarreRightSemidet');
				$(this.DescriptionDiv).hide();
				this.DescriptionContenu = $("#" + this.PrefixeDiv + '_div_BarreRightSemidet' + " #" + this.PrefixeDiv + "_" + "contenu");
			}
		}

		SmartCarrousselInitDATA(data, this, this.CurrentPage, true);
	}
}

SmartCarroussel.prototype.PJPACarrousselCreateDivInterface2 = function(nomGlobal, prefDiv) {

	var widthCadreTotal = "";
	var widthCadre = "";
	var classCadre = "";
	if (this.ModeAffichage == MODE_VERTICAL) {
		widthCadre = 'style="width:' + this.WidthMaxVignette + 'px; margin:0px auto;"';
		widthCadreTotal = 'style="width:' + (this.WidthMaxVignette + 2) + 'px; margin:0px auto;"';
		classCadre = "Vertical";
	}

	var html = '<div class="carrouselFD ' + classCadre + '" id="' + prefDiv + '_diaporama" ' + widthCadreTotal + '>';
	html += '<div id="' + prefDiv + '_CadreImageUL" ' + widthCadre + ' ></div>';
	html += '<div class="the_breaker"></div>';
	html += '</div>';
	if (this.Mode == MODE_DESC_INFOBULLE) {
		html += '<div id="' + prefDiv + '_div_BarreRightSemidet" style="display:none;bottom:' + (this.HeightMaxVignette - 5 ) + 'px;" class="CarrouselSemidet" onmouseover="_pjpaOnAds = true;" onmouseout="_pjpaOnAds = false;' + nomGlobal + '.ThumbailOut();" onmousedown="' + nomGlobal + '.ClickInfosBulle();">';
		html += '<div id="' + prefDiv + '_contener_semi_detaillee" class="carrousel_infosbulle" style="display:block; left:0px;" >';
		html += '<div class="fd_c"  >';
		html += '<div class="fd_h">';
		html += '<div class="fd_b" style=" position:relative;">';
		html += '<div class="contenu" id="' + prefDiv + '_contenu"></div>';
		html += '</div>';
		html += '<div class="the_breaker"></div>';
		html += '</div>';
		html += '<div class="fd_b2"></div>';
		html += '</div>';
		html += '<div class="the_breaker"></div>';
		html += '<div class="flechePopup" id="' + prefDiv + '_flechePopup" ></div>';
		html += '</div>';
		html += '</div>';
	}
	//document.writeln(html);
	return html;
}



SmartCarroussel.prototype.PJPAMesSelectionsCreateDivInterface2 = function(nomGlobal, prefDiv) {
	var html = '<div class="carrouselFD" id="' + prefDiv + '_diaporama">';
	html += '<div id="' + prefDiv + '_CadreImageUL"></div>';
	html += '<div class="the_breaker"></div>';
	html += '</div>';

	document.writeln(html);
}

/*** NOTRE SELECTION ***/
function PJPANotreSelectionCreateDivInterface2(nomGlobal, prefDiv, divDestination, css, isDisplay) {
	var html = '';
	var display = "";

	if (isDisplay) {
		display = "block";
	}
	else {
		display = "none";
	}

	html += '<div id="' + divDestination + '" class="' + css + '" style="display:' + display + ';">';
	html += '<div class="carrouselFD" id="' + prefDiv + '_diaporama">';
	html += '<div id="' + prefDiv + '_CadreImageUL"></div>';
	html += '<div class="the_breaker"></div>';
	html += '</div>';

	if (nomGlobal == "_PJPANSServicesEmployeur") {
		var url = "http://services.annoncesjaunes.fr/arborescence/tous-les-etudiants.html";
		html += '<div class="Bouton220_Off" onmouseover="mld(this,\'Bouton220\')"><a class="LienBouton" href="' + url + '" >Voir toutes les offres de jobs</a></div>';
	}
	else if (nomGlobal == "_PJPANSServicesPresta") {
		var url = "http://services.annoncesjaunes.fr/arborescence/tous-les-jobs.html";
		html += '<div class="Bouton240_Off" onmouseover="mld(this,\'Bouton240\')"><a class="LienBouton" href="' + url + '" >Voir tous les prestataires de services</a></div>';
	}

	html += '</div>';

	document.writeln(html);
}


/*---- SmartCarroussel.js ----*/

var MODE_DESC_VISIBLE = "image avec desc. visible";
var MODE_WITH_LINK = "image avec lien";
var MODE_WITH_JS = "image avec click";
var MODE_DESC_INFOBULLE = "image avec desc. en infos bulle";

var MODE_VERTICAL = "1";
var MODE_HORIZONTAL = "2";

function SmartCarroussel(nameVarGlobal, secteur, blocToGen, blocToHide, mode, horizOuVert, addManquant) {

	this.ID = nameVarGlobal;
	this.PrefixeDiv = nameVarGlobal.replace(".", "");
	this.BlocToHide = undefined;
	this.BlocToHide = blocToHide != undefined && blocToHide != null && blocToHide != "" ? document.getElementById(blocToHide) : this.BlocToHide;
	this.BlocCarrousel = document.getElementById(blocToGen);

	this.TotalResult = 0;

	this.Mode = mode;
	this.Secteur = secteur;
	this.ModeAffichage = horizOuVert;

	this.ImgPrec = -1;
	this.BtnPrecedent = null;
	this.BtnSuivant = null;
	this.Thumbails = null;
	this.CadreThumbails = null;
	this.DivBtnNavigation = null;

	this.thumbPrefix = "thumb_";
	this.pas = 5;

	this.CurrentPage = 1;
	this.EspaceVignette = 10;

	this.CallWsByPage = true;

	this.AfficheInfoNav = true;
	this.AfficheAlwaysBtnNav = true;
	this.AfficheDescription = mode;
	this.OnMouseOverImg = "";
	this.OnMouseOutImg = "";
	this.OnMouseClickImg = "";

	this.TagChargement = undefined;
	this.TagBtnPrec = undefined;
	this.TagBtnSuiv = undefined;
	this.TagClickImg = undefined;
	this.XtclibImg = undefined;
	this.XtclibBtnSuiv = undefined;
	this.Xtsite = xtsite;
	this.Xtn2 = xtn2;

	this.LeftInfoBulle = 0;
	this.BottomInfoBulle = 0;

	this.AddManquant = addManquant;

	this.InitMode();
	
}

SmartCarroussel.prototype.SetParent = function(parentId) {
	if (NotNullOrNotEmpty(parentId)) {
		this.ParentId = parentId;
	}
}

SmartCarroussel.prototype.HideInfoNavigation = function() {
	this.AfficheInfoNav = false;
}

SmartCarroussel.prototype.SetParametresWS = function(parametres, functionName) {
	this.Parametres = parametres;
	this.FunctionName = functionName;
}

SmartCarroussel.prototype.SetTagXiti = function(tagChargement, tagBtnPrec, tagBtnSuiv, tagClickImg, xtn2, xtsite) {
	this.Xtsite = (NotNullOrNotEmpty(xtsite) ? xtsite : this.Xtsite);
	this.Xtn2 = (NotNullOrNotEmpty(xtn2) ? xtn2 : this.Xtn2);
	this.TagChargement = (NotNullOrNotEmpty(tagChargement) ? tagChargement : this.TagChargement);

	if (this.Xtn2 != undefined && this.Xtn2 != "") {
		if (NotNullOrNotEmpty(tagBtnPrec)) {
			this.TagBtnPrec = 'TagClick("C", "' + this.Xtn2 + '", "' + tagBtnPrec + '", "A")';
		}
		if (NotNullOrNotEmpty(tagBtnSuiv)) {
			this.TagBtnSuiv = 'TagClick("C", "' + this.Xtn2 + '", "' + tagBtnSuiv + '", "A")';
		}
		if (NotNullOrNotEmpty(tagClickImg)) {
			this.TagClickImg = 'TagClick("C", "' + this.Xtn2 + '", "' + tagClickImg + '", "N")';
		}		
	}
}

SmartCarroussel.prototype.SetXtclib = function(xtclibImg, xtclibBtnSuiv) {
	this.XtclibImg = (NotNullOrNotEmpty(xtclibImg) ? xtclibImg : this.XtclibImg);
	this.XtclibBtnSuiv = (NotNullOrNotEmpty(xtclibBtnSuiv) ? xtclibBtnSuiv : this.XtclibBtnSuiv);
}

SmartCarroussel.prototype.SetPositionInfoBulle = function(left, bottom) {
	this.LeftInfoBulle = (NotNullOrNotEmpty(left) ? left : this.LeftInfoBulle);
	this.BottomInfoBulle = (NotNullOrNotEmpty(bottom) ? bottom : this.BottomInfoBulle);
}

SmartCarroussel.prototype.InitMode = function() {

	if (this.Mode == MODE_DESC_VISIBLE) {
		this.OnMouseOverImg = this.ID + ".ThumbailOverNS(this);";
		this.OnMouseOutImg = this.ID + ".ThumbailOutNS(this);";
		this.OnMouseClickImg = this.ID + ".ClickThumbail(this);";
	}
	if (this.Mode == MODE_WITH_LINK) {
		this.OnMouseClickImg = this.ID + ".ClickThumbail(this);";
	}
	if (this.Mode == MODE_DESC_INFOBULLE) {
		this.OnMouseOverImg = this.ID + ".ThumbailOver(this);";
		this.OnMouseOutImg = this.ID + ".ThumbailOut(this);";
		this.OnMouseClickImg = this.ID + ".ClickThumbail(this);";
	}
	if (this.Mode == MODE_WITH_JS) {
		this.OnMouseClickImg = this.ID + ".ClickThumbailDiapo(this);";
	}
}

SmartCarroussel.prototype.InitEventsCarroussel = function(onMouseOver, onMouseOut, onMouseClick) {
	this.OnMouseOverImg = this.ID + "." + onMouseOver + "(this);";
	this.OnMouseOutImg = this.ID + "." + onMouseOut + "(this);";
	this.OnMouseClickImg = this.ID + "." + onMouseClick + "(this);";
}

SmartCarroussel.prototype.SetVignetteConfig = function(nbVignettes, withMaxVignette, heightMaxVignette, withDescription) {
	this.WithDescription = withDescription;
	this.NbVignettes = nbVignettes;
	this.WidthMaxVignette = withMaxVignette;
	this.HeightMaxVignette = heightMaxVignette;
}

SmartCarroussel.prototype.SetTagContext = function(tagContext) {
	this.TagContext = tagContext;
}

SmartCarroussel.prototype.SetIsVisible = function(isvisible) {
	this.IsVisible = isvisible;
	if (this.IsVisible) {
		this.LaunchTagPJPA();
	}
}

SmartCarroussel.prototype.SetCallWsByPage = function(callWsByPage) {
	this.CallWsByPage = callWsByPage;
}

SmartCarroussel.prototype.GetTotalHeight = function() {
	return this.CurrentHeight;
}

SmartCarroussel.prototype.GetItem = function(obj) {
	if ($(obj).attr("Num") != undefined) {
		return this.ListeImage[parseInt($(obj).attr("Num"))];
	}
	return undefined;
}

SmartCarroussel.prototype.GetItemId = function(obj) {
	if ($(obj).attr("Num") != undefined) {
		return parseInt($(obj).attr("Num"));
	}
	return undefined;
}

SmartCarroussel.prototype.InitCarroussel = function() {

	if (this.ListeImage.length == 0) {
		return;
	}

	var urlpixgif = "/_Images/pix.gif";

	var DivBtnPrec = this.GetBtnPrec();
	var DivBtnSuiv = this.GetBtnSuiv();

	this.SetCadresHTML();

	var thumbList = this.DebCadreHTML;
	thumbList += this.GetListImagesHTML(0, this.ListeImage.length);
	thumbList += this.FinCadreHTML;

	var classeModeAff = this.ModeAffichage == MODE_VERTICAL ? "Vertical" : "Horizontal";

	var divNavigation = this.GetNavigationHTML();

	var DivCarrousselHTML = "<div class='" + classeModeAff + "'>" + DivBtnPrec + thumbList + DivBtnSuiv + "</div></div>";

	var html = $(this.ConteneurDiv).html() + divNavigation + DivCarrousselHTML;


	//ne fonctionne apparement pas sous ie
	//$(this.ConteneurDiv).html(html);
	this.ConteneurDiv.innerHTML = html;

	this.BtnPrec = document.getElementById(this.PrefixeDiv + "_BtnPrec");
	this.BtnSuiv = document.getElementById(this.PrefixeDiv + "_BtnSuiv");

	this.Thumbails = document.getElementById(this.PrefixeDiv + "_ul_thumbails");
	this.CadreThumbails = document.getElementById(this.PrefixeDiv + "_cadre_thumbails");

	var attribut = this.GetPropertieToChange();
	if (this.Thumbails != undefined && this.Thumbails != null) {
		this.NewPosition = ($("#" + this.Thumbails.id).css(attribut)).replace(/px/gi, "");
	}

	$(this.ConteneurDiv).css("width", this.TotalWidthCarroussel + "px");
	$(this.ConteneurDiv).css("margin", "0px auto");

	SmartCarrouselCacheBoutonApresClick(this.ID, this.CurrentPage, this.NbPagesTotal);

}

SmartCarroussel.prototype.SetCadresHTML = function(debHTML, endHTML) {
	this.DebCadreHTML = "";
	this.FinCadreHTML = "";

	var urlpixgif = "/_Images/pix.gif"

	var tmp1 = parseInt((this.TotalResult / this.NbVignettes));
	this.NbPagesTotal = tmp1;
	if (tmp1 * this.NbVignettes < this.TotalResult) {
		this.NbPagesTotal = tmp1 + 1;
	}

	var nbvignmax = (this.ListeImage.length > this.NbVignettes ? this.NbVignettes : this.ListeImage.length);

	var afficheBtnNav = (this.ListeImage.length > this.NbVignettes || this.AfficheAlwaysBtnNav);

	if (this.ModeAffichage == MODE_VERTICAL) {
		var widthMax = this.WidthMaxVignette + 10 * 2 + 2;
		var heightMax = (nbvignmax * (this.HeightMaxVignette + 2) + (nbvignmax - 1) * this.EspaceVignette);
		//this.CurrentHeight = heightMax;

		this.CurrentHeight = PJPACalculateHeight(this.DivToHide);

		this.DebCadreHTML = "<div class='FondCadreCarroussel'><div id='" + this.PrefixeDiv + "_cadre_thumbails' class='cadreThumbail' style='height:" +
		(heightMax) + "px;width:" + (this.WidthMaxVignette + 2) + "px;'><div id='" +
		this.PrefixeDiv + "_ul_thumbails' class=\"thumbails\"  style='top:0px;" +
		"' onmouseover='" + this.ID + ".OnMouseOver()' onmouseout='" + this.ID +
		".OnMouseOut()' > ";
	}
	else {
		var widthMax = (nbvignmax * (this.WidthMaxVignette + 2) + (nbvignmax - 1) * this.EspaceVignette);
		var widthAll = (this.TotalResult * (this.WidthMaxVignette + 2) + (this.TotalResult) * this.EspaceVignette) + 20;

		this.DebCadreHTML = "<div class='FondCadreCarroussel'><div id='" + this.PrefixeDiv + "_cadre_thumbails' class='cadreThumbail' style='width:" +
		(widthMax) + "px;'><div id='" + this.PrefixeDiv +
		"_ul_thumbails' class=\"thumbails\"  style='left:0px; width:" + widthAll + "px;'  onmouseover='" +
		this.ID + ".OnMouseOver()' onmouseout='" + this.ID + ".OnMouseOut()' >";
	}
	this.FinCadreHTML = "</div></div></div>";

	this.TotalWidthCarroussel = widthMax;
	if (this.NbPagesTotal > 1) {
		this.TotalWidthCarroussel += 28 * 2;
	}
}

SmartCarroussel.prototype.GetListImagesHTML = function(deb, fin) {
	var thumbList = "";
	for (var i = deb; i < fin; i++) {
		thumbList += this.GetItemHTML(this.ListeImage[i], i, fin);
	}
	return thumbList;
}

SmartCarroussel.prototype.GetNavigationHTML = function() {

	if (this.AfficheInfoNav && this.ModeAffichage == MODE_HORIZONTAL && this.NbPagesTotal> 1) {

		var debNav = "<div class='Bullet' style='width:" + this.TotalWidthCarroussel + "px;'>";
		var finNav = "</div>";

		var DivPosNav = "";

		DivPosNav = "<div class='PosNav'>";
		if (this.NbPagesTotal > 1) {
			this.PosNav = new Array();
			for (var i = 0; i < this.NbPagesTotal; i++) {
				if (i == 0) {
					DivPosNav += '<div id="' + this.PrefixeDiv + '_bl_' + i + '" class="IndPosition_' + this.Secteur + '"></div>';
				}
				else {
					DivPosNav += '<div id="' + this.PrefixeDiv + '_bl_' + i + '" class="IndPosition"></div>';
				}
				this.PosNav[i] = this.PrefixeDiv + "_bl_" + i;
			}
			DivPosNav += '<div class="the_breaker"></div>';
		}

		DivPosNav += '</div>';
		DivPosNav += '<div class="the_breaker"></div>';

		return debNav + DivPosNav + finNav;
		
	}
	else {
		return "";
	}
}

SmartCarroussel.prototype.GetItemHTML = function(item, i, max) {
	var urlpixgif = "/_Images/pix.gif"
	var classe = "";
	if (i == 0) {
		classe = " class='vign firstli' ";
	}
	else {
		classe = " class='vign' ";
	}

	var tagpjpa = "";
	var onmouseover = "";
	var onmouseout = "";
	var onmouseclick = "";
	var marginLeft = "";
	var description = "";
	var xtclib = "";

	if (i != this.TotalResult - 1) {
		marginLeft = this.ModeAffichage == MODE_VERTICAL ? "margin:0px 0px 10px 0px;" : "margin:0px 10px 0px 0px;";
	}

	var haveLienAnnonce = item.LienAnnonce != null && item.LienAnnonce != undefined && item.LienAnnonce != "";
	var bAffImage = (i < this.NbVignettes && this.IsVisible);

	var urlimage = urlpixgif;
	if (bAffImage) {
		urlimage = this.ListeImage[i].ImageUrl;
	}

	onmouseover = (this.OnMouseOverImg != undefined && this.OnMouseOverImg != "" ? " onmouseover='" + this.OnMouseOverImg + "' " : "");
	onmouseout = (this.OnMouseOutImg != undefined && this.OnMouseOutImg != "" ? " onmouseout='" + this.OnMouseOutImg + "' " : "");
	click = (this.OnMouseClickImg != undefined && this.OnMouseClickImg != "" ? this.OnMouseClickImg : "") + (this.TagClickImg != undefined && this.TagClickImg != "" ? this.TagClickImg : "");
	onmouseclick = (click != undefined && click != "" ? " onmousedown='" + click + "' " : "");

	xtclib = (this.XtclibImg != undefined && this.XtclibImg != "" ? " xtclib='" + (this.XtclibImg + (i + 1)) + "' " : "");

	if (this.AfficheDescription == MODE_DESC_VISIBLE && this.WithDescription && NotUndefinedNotNull(item.Description1)) {
		description = "<div class='NS_desc'>" + item.Description1 + "</div>";
	}

	//cfgImagePixGris

	item.id = "img" + i;
	var thumbList = "<div id='" + this.PrefixeDiv + "th_" + item.id + "' " + onmouseover + onmouseout + onmouseclick + " " + classe + " style='width:" + (this.WidthMaxVignette + 2) + "px;" + (haveLienAnnonce ? "" : "cursor:default;") + marginLeft + "' Num='" + i + "' >";
	thumbList += "<table class='TbImgSize' cellpadding='0' cellspacing='0'  style='height:" + (this.HeightMaxVignette+2) + "px;width:" + this.WidthMaxVignette + "px;' ><tr><td align='center' valign='middle' >";

	/*thumbList += "<img id='" + this.ID + "_princ_" + item.id + "' class='thumb' src='" + urlimage + "' style='height:" + this.HeightMaxVignette + "px;width:" + this.WidthMaxVignette + "px;' alt='' " + xtclib + " />";*/

	if (urlimage == cfgImagePixGris) {
		thumbList += "<img id='" + this.ID + "_princ_" + item.id + "'  src='" + urlimage + "' style='height:" + this.HeightMaxVignette + "px;width:" + this.WidthMaxVignette + "px;' alt='' " + xtclib + " />";
	}
	else {

		var ver = getInternetExplorerVersion();
		if (ver > -1) {

			if (ver >= 8.0)

				thumbList += "<img id='" + this.ID + "_princ_" + item.id + "'   src='" + urlimage + "' style='height:" + this.HeightMaxVignette + "px;width:" + this.WidthMaxVignette + "px;' alt='' " + xtclib + " />";

			else

				thumbList += "<img id='" + this.ID + "_princ_" + item.id + "'  src='" + urlimage + "' style='max-height:" + this.HeightMaxVignette + "px;max-width:" + this.WidthMaxVignette + "px;' alt='' " + xtclib + " />";

		}
		else {

			thumbList += "<img id='" + this.ID + "_princ_" + item.id + "'   src='" + urlimage + "' style='max-height:" + this.HeightMaxVignette + "px;max-width:" + this.WidthMaxVignette + "px;' alt='' " + xtclib + " />";
		
		 }

	}

	thumbList += "</td></tr></table>" + tagpjpa;
	/*thumbList +=  tagpjpa;*/


	thumbList += description;
	thumbList += "</div>";

	return thumbList;
}

SmartCarroussel.prototype.GetBtnPrec = function() {
	var heightWidth = this.ModeAffichage == MODE_VERTICAL ? "width:" + this.WidthMaxVignette + "px;" : "height:" + this.HeightMaxVignette + "px;";
	
	var clickNav = (this.TagBtnPrec != undefined && this.TagBtnPrec != "" ? this.TagBtnPrec : "");

	var DivBtnPrec = '<div id="' + this.PrefixeDiv + '_BtnPrec" style="' + heightWidth + '" onmousedown="' + this.ID + '.ClickBtnPrec();' + clickNav + '" onmouseover="' + this.ID + '.BtnPrecOn()" onmouseout ="' + this.ID + '.BtnPrecOut()" class="BtnPrec"></div>';
	return DivBtnPrec;
}

SmartCarroussel.prototype.GetBtnSuiv = function() {
	var heightWidth = this.ModeAffichage == MODE_VERTICAL ? "width:" + this.WidthMaxVignette + "px;" : "height:" + this.HeightMaxVignette + "px;";

	var clickNav = (this.TagBtnSuiv != undefined && this.TagBtnSuiv != "" ? this.TagBtnSuiv : "");
	var xtclib = (this.XtclibBtnSuiv != undefined && this.XtclibBtnSuiv != "" ? " xtclib='" + this.XtclibBtnSuiv + "' " : "");

	var DivBtnSuiv = '<div id="' + this.PrefixeDiv + '_BtnSuiv" style="' + heightWidth + ';" onmousedown="' + this.ID + '.ClickBtnSuiv();' + clickNav + '" onmouseover="' + this.ID + '.BtnSuivOn()" onmouseout ="' + this.ID + '.BtnSuivOut()" class="BtnSuiv" ' + xtclib + ' ></div>';
	return DivBtnSuiv;
}

SetOpacity = function(obj, valeur) {
	if (obj != null && obj != undefined) {
		if ($.browser.msie) {
			obj.style.filter = 'alpha(opacity=' + (valeur * 100) + ')';
		}
		else {
			obj.style.opacity = valeur;
		}
	}
}
/*
SmartCarroussel.prototype.AddSelection = function(idannonce, urlImage) {

	var nextIndex = this.ListeImage.length;
	for (var i = 0; i < this.ListeImage.length; i++) {
		if (this.ListeImage[i].ImageUrl == "/_Images/commun/pixGris.png") {
			nextIndex = i;
			break;
		}
	}

	var newData = new Object();
	newData.ImageUrl = urlImage;
	newData.IdAnnonce = idannonce;
	if (this.Secteur == "Immobilier") {
		newData.LienAnnonce = "/Immobilier/FicheDetail.aspx?IdAnnonce=" + idannonce;
	}
	else {
		newData.LienAnnonce = "/AutoMoto/FicheDetail.aspx?IdAnnonce=" + idannonce;
	}
	newData.TagPJPA = "";
	newData.Titre = null;
	newData.PrixAff = null;
	newData.Description1 = null;
	newData.Description2 = null;

	this.ListeImage[nextIndex] = newData;

	var Nbmanquant = (this.ListeImage.length % this.NbVignettes != 0 ? (this.NbVignettes - this.ListeImage.length % this.NbVignettes) : 0);
	Nbmanquant = (this.ListeImage.length == 0 ? this.NbVignettes : Nbmanquant);

	this.AddManquantToList(Nbmanquant);
	this.CurrentPage = 1;
	$(this.ConteneurDiv).html("");
	this.ConteneurDiv.innerHTML = "";
	this.InitCarroussel();
}
*/
function getInternetExplorerVersion() {

	var rv = -1; // Return value assumes failure.

	if (navigator.appName == 'Microsoft Internet Explorer') {

		var ua = navigator.userAgent;

		var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");

		if (re.exec(ua) != null)

			rv = parseFloat(RegExp.$1);

	}

	return rv;

}




