﻿//*****************************************************************//
//**  SCRIPT GENERAL  DE CALL  AJAX (JSON) POUR LISTE MAISON     **//
//*****************************************************************//
//** PAR MARC-ANDRÉ GIROUX BÉCHARD                               **//
//** DATE : 2:09 PM 6/23/2011                                    **//
//** POUR : EGP TECHNOVIRTUEL INC                                **//
//*****************************************************************//

function ResetUIControle() {
    //ResetSliderFromDBVal();	
    $(".dropdownModule").hide();
    UnCheckAllCityResetClick(0);
    UnCheckAllTypeResetClick(0);
    changeAllHardCheckBoxValueClick('0', 0);

    ParamObj.prixMax = ParamObj.maxprice;  //RECHERCHE PAS PRIX MAX 
    ParamObj.prixMin = ParamObj.minprice;        //RECHERCHE PAR PRIX MIN 

    ParamObj.filters = "";

    ParamObj.orderby = "";

    ParamObj.currpage = "0";



    ParamObj.searchVille = "";   //ARRAY LIST 'VILLE_A','VILLE_B','VILLE_C' (WHERE IN LIST) (LINQ FORMAT)
    ParamObj.searchType = "";    //ARRAY LIST 'GENRE_A','GENRE_B','GENRE_C' (WHERE IN LIST) (LINQ FORMAT)
    ParamObj.searchGenre = "";        //PAR GENTRE DE PROPRIÉTÉ  ARRAY LIST 'GENRE_A','GENRE_B','GENRE_C' (WHERE IN LIST) (LINQ FORMAT)
    ParamObj.searchNonGenre = "";    //NOT IN LISTE : PAR GENTRE DE PROPRIÉTÉ  ARRAY LIST 'GENRE_A','GENRE_B','GENRE_C' (WHERE IN LIST) (LINQ FORMAT)
    ParamObj.searchNonVille = "";   //NOT IN ARRAY LIST 'VILLE_A','VILLE_B','VILLE_C' (WHERE IN LIST) (LINQ FORMAT)
    ParamObj.searchNonType = "";    //NOT IN ARRAY LIST 'GENRE_A','GENRE_B','GENRE_C' (WHERE IN LIST) (LINQ FORMAT)


    if (ParamObj.isRemax == "1") {
        ParamObj.orderby = "CityName asc , Price asc";       //ORDRE D'AFFICHAGE DE BASE //DEFAULT : VILLE / PRIX
    } else {
        ParamObj.orderby = "CityName asc , DecimalPrice asc , RantalPrice asc";       //ORDRE D'AFFICHAGE DE BASE //DEFAULT : VILLE / PRIX
    }

    QueryPostBack(ParamObj); //RECHERCHER

    BindPrice();
}


//**************************************************************************************************
//***** FONCTION QUI CONSTRUIT LE (FAKE SQL) (LINQ) POUR ALLER CHERCHER DES FILTRES SPÉCIFIQUE
//**************************************************************************************************
function RebuildFilterFromControle() {

    if (ParamObj.isRemax == "1") {
        ParamObj.filters = "";

        var idV1 = "#monckeckx_Hard_1";
        var idV2 = "#monckeckx_Hard_2";
        var idV3 = "#monckeckx_Hard_3";
        var idV4 = "#monckeckx_Hard_4";

        var attr1 = $(idV1).attr("check");
        var attr2 = $(idV2).attr("check");
        var attr3 = $(idV3).attr("check");
        var attr4 = $(idV4).attr("check");

        if (attr1 == "0" && attr2 == "0" && attr3 == "0" && attr4 == "0") {
            return;
        }

        if (attr1 == "1" && attr2 == "1" && attr3 == "1" && attr4 == "1") {
            return;
        }

        if (attr1 == "1" && attr2 == "1" && attr3 == "1") {
            return;
        }


        ParamObj.filters = " Langue <> '' ";

        if (attr1 == "1" && attr2 == "0") {
            ParamObj.filters = ParamObj.filters + " and NombreTotal >=  1  and  isSold = 0 and Price not like '%month' and Price  not like '%mois'";
        }

        if (attr1 == "0" && attr2 == "1") {
            ParamObj.filters = ParamObj.filters + " and NombreTotal >=  1  and  isSold = 0 and (Price like '%month' or Price like '%mois')";
        }

        if (attr1 == "1" && attr2 == "1") {
            ParamObj.filters = ParamObj.filters + " and NombreTotal >=  0  and  isSold = 0 ";
        }


        if (attr3 == "1") {
            ParamObj.filters = ParamObj.filters + " and isSold = 1 ";
        }

        if (attr4 == "1") {
            ParamObj.filters = ParamObj.filters + " and isOpen = 1 ";
        }
    } else {
        ParamObj.filters = "";

        var idV1 = "#monckeckx_Hard_1";
        var idV2 = "#monckeckx_Hard_2";
        var idV3 = "#monckeckx_Hard_3";
        var idV4 = "#monckeckx_Hard_4";

        var attr1 = $(idV1).attr("check");
        var attr2 = $(idV2).attr("check");
        var attr3 = $(idV3).attr("check");
        var attr4 = $(idV4).attr("check");

        if (attr1 == "0" && attr2 == "0" && attr3 == "0" && attr4 == "0") {
            return;
        }

        if (attr1 == "1" && attr2 == "1" && attr3 == "1" && attr4 == "1") {
            return;
        }

        if (attr1 == "1" && attr2 == "1" && attr3 == "1") {
            return;
        }

        //**********************************************
        /*
        CODE POUR STATU LISTING :
        19	Active
        20	Exhale
        21	Sold 
        22	OpenHouse
        23	OffMarket
        24	Promotion
        25	Other
        26	Deleted
        27	Tested
        */
        //**********************************************


        ParamObj.filters = " Language <> '' ";

        if (attr1 == "1" && attr2 == "0") {
            ParamObj.filters = ParamObj.filters + " and DecimalPrice >=  1  and  IsVendu = 0 and RantalPrice <= 0";
        }

        if (attr1 == "0" && attr2 == "1") {
            ParamObj.filters = ParamObj.filters + " and RantalPrice  >=  1  and  IsVendu = 0 and DecimalPrice  <= 0";
        }

        if (attr1 == "1" && attr2 == "1") {
            ParamObj.filters = ParamObj.filters + " and DecimalPrice >=  0  and  RantalPrice  >=  0 and  IsVendu = 0 ";
        }

        if (attr3 == "1") {
            ParamObj.filters = ParamObj.filters + " and  IsVendu = 1 ";
        }

        if (attr4 == "1") {
            ParamObj.filters = ParamObj.filters + " and IsVisiteLibre = 1 ";
        }
    }
}

//----------------------------------------------
// FONCTION POUR CHANGER DE PAGE
//----------------------------------------------
function ChangeCurrentPage(page) {
    ParamObj.currpage = page;
    QueryPostBack(ParamObj);
};

//----------------------------------------------
// FONCTION QUI MET EN PLACE L'ORDRE D'AFFICHAGE 
// (FILTRE DYNAMIQUE SQL NON PRÃ&#8240;CIT) 
// (ATTENTION C'EST PAS DU SQL MAIS DU DYNAMIC LINQ)
//----------------------------------------------
function ChangeOrdring(orderField, orientation) {
    if (ParamObj.isRemax == "1") {
        if (orderField == "DecimalPrice") {
            orderField = "NombreTotal";
            //CHANGEMENT DE FILTRE
            ParamObj.orderby = orderField + " " + orientation;
            ParamObj.currpage = "0";
            QueryPostBack(ParamObj); //RECHERCHER
        } else {
            //CHANGEMENT DE FILTRE
            ParamObj.orderby = orderField + " " + orientation + " , NombreTotal asc";
            ParamObj.currpage = "0";
            QueryPostBack(ParamObj); //RECHERCHER
        }
    } else {
        if (orderField == "DecimalPrice") {
            //CHANGEMENT DE FILTRE
            ParamObj.orderby = orderField + " " + orientation;
            ParamObj.currpage = "0";
            QueryPostBack(ParamObj); //RECHERCHER
        } else {
            //CHANGEMENT DE FILTRE
            ParamObj.orderby = orderField + " " + orientation + " , DecimalPrice asc , RantalPrice asc";
            ParamObj.currpage = "0";
            QueryPostBack(ParamObj); //RECHERCHER
        }
    }
}


//********************************************************
//****  Refait les filtres acumules les donner et call back la page
//********************************************************
function QueryPostBack(ObjParamPass){
	// ICI C'EST LE SERVEUR .TRANFERT ... REDIRECT NEXT PAGE  
	// ANCIENNEMENT : (CallAjax)
	//alert("JE CALL");
	RebuildFilterFromControle();
	//alert("Filtre = " + ParamObj.filters);

	//alert(ParamObj.isQueryStringLoaded);

	//-----------------------------------------------
	// ADDON : CHECK FOR QUERY STRING OBJECT //
	//-----------------------------------------------
	if(ParamObj.isQueryStringLoaded == "0"){
		ParamObj.isQueryStringLoaded = "1";
		RebuildFormQueryString();
	}
	
	
	CallGeneralDesWebService();
	
}

//***************************************************
//****** GET CURRENT QUERYSTRING OBJECT 
//***************************************************
function getQuerystring(key, default_)
{
  if (default_==null) default_=""; 
  key = key.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regex = new RegExp("[\\?&]"+key+"=([^&#]*)");
  var qs = regex.exec(window.location.href);
  if(qs == null)
	return default_;
  else
	return qs[1];
}


//***************************************************
//****** PERMET LA REDIRECTION DE LA RECHECHE COURRANT
//****** A UNE AUTRE SECTION ! 
//***************************************************
function RedirectParamSearchPage(nextGoingPage){
	var redirFull = nextGoingPage + "?pmrdir=1";
	
	redirFull = redirFull  + "&searchquery=1";
	redirFull = redirFull  + "&filters=" + encodeURIComponent(ParamObj.filters);
	redirFull = redirFull  + "&searchVille=" + encodeURIComponent(ParamObj.searchVille);
	redirFull = redirFull  + "&searchType=" + encodeURIComponent(ParamObj.searchType);
	redirFull = redirFull  + "&searchGenre=" + encodeURIComponent(ParamObj.searchGenre);
	redirFull = redirFull  + "&searchNonGenre=" + encodeURIComponent(ParamObj.searchNonGenre);
	redirFull = redirFull  + "&searchNonVille="+ encodeURIComponent(ParamObj.searchNonVille);
	redirFull = redirFull  + "&searchNonType=" + encodeURIComponent(ParamObj.searchNonType);
		

	window.location.href = redirFull;
	
}


//----------------------------------------------------------
//----- Create query from a string   FORM EXISTING POST : REDIRECT IF  SET TO 1
//----------------------------------------------------------
function CreateQueryStringFromExisting(nextGoingPage, redirect) {
    var redirFulla = ParamObj.PaserellePage + nextGoingPage + "&drop=1";

        var redirFull = "";

        redirFull = redirFull + "&id=" + encodeURIComponent(ParamObj.id);
        redirFull = redirFull + "&langue=" + encodeURIComponent(ParamObj.langue);
        
        redirFull = redirFull + "&filters=" + encodeURIComponent(ParamObj.filters);
        redirFull = redirFull + "&currpage=" + encodeURIComponent(ParamObj.currpage);
        redirFull = redirFull + "&itemperpage=" + encodeURIComponent(ParamObj.itemperpage);
        redirFull = redirFull + "&usepaging=" + encodeURIComponent(ParamObj.usepaging);
        
        redirFull = redirFull + "&searchVille=" + encodeURIComponent(ParamObj.searchVille);
        redirFull = redirFull + "&searchType=" + encodeURIComponent(ParamObj.searchType);
        redirFull = redirFull + "&searchGenre=" + encodeURIComponent(ParamObj.searchGenre);
        
        redirFull = redirFull + "&searchNonGenre=" + encodeURIComponent(ParamObj.searchNonGenre);
        redirFull = redirFull + "&searchNonVille=" + encodeURIComponent(ParamObj.searchNonVille);
        redirFull = redirFull + "&searchNonType=" + encodeURIComponent(ParamObj.searchNonType);
        
        redirFull = redirFull + "&typeList=" + encodeURIComponent(ParamObj.typeList);
        
        redirFull = redirFull + "&prixMax=" + encodeURIComponent(ParamObj.prixMax);
        redirFull = redirFull + "&prixMin=" + encodeURIComponent(ParamObj.prixMin);
        
        redirFull = redirFull + "&maxprice=" + encodeURIComponent(ParamObj.maxprice);
        redirFull = redirFull + "&minprice=" + encodeURIComponent(ParamObj.minprice);

        //rELOAD AGent inFos
        redirFull = redirFull + "&searchquery=" + getQuerystring("searchquery", "");
        redirFull = redirFull + "&searchbyid=" + getQuerystring("searchbyid", "");
        
        redirFull = redirFull + "&returnPage=" + encodeURIComponent(ParamObj.ReturnUrl + "?drop=1" + redirFull);



        
        if (redirect == "1") {
            window.location.href = redirFulla + redirFull;
        }

        return redirFulla + redirFull;
}







//***************************************************
//****** SET LOCAL VARIABLE WITH THE QUERY-STRING VAL 
//***************************************************
function RebuildFormQueryString()
{

    var dropBack = getQuerystring("drop", "0");


	var searchQw = getQuerystring("searchquery","0");

	if (searchQw == "1") 
	{
	    ParamObj.id = getQuerystring("id", ParamObj.id);
	    
		ParamObj.filters = getQuerystring("filters","");
		ParamObj.searchVille = getQuerystring("searchVille","");
		ParamObj.searchType = getQuerystring("searchType","");
		ParamObj.searchGenre = getQuerystring("searchGenre","");
		ParamObj.searchNonGenre = getQuerystring("searchNonGenre","");
		ParamObj.searchNonVille = getQuerystring("searchNonVille","");
		ParamObj.searchNonType = getQuerystring("searchNonType","");


		if(ParamObj.filters   != ""){
			ParamObj.filters  = decodeURIComponent(ParamObj.filters  );
		}
		if(ParamObj.searchVille  != ""){
			ParamObj.searchVille  = decodeURIComponent(ParamObj.searchVille );
		}
		if(ParamObj.searchType   != ""){
			ParamObj.searchType  = decodeURIComponent(ParamObj.searchType );
		}
		if(ParamObj.searchGenre   != ""){
			ParamObj.searchGenre = decodeURIComponent(ParamObj.searchGenre );
		}
		if(ParamObj.searchNonGenre != ""){
			ParamObj.searchNonGenre = decodeURIComponent(ParamObj.searchNonGenre );
		}
		if(ParamObj.searchNonVille  != ""){
			ParamObj.searchNonVille  = decodeURIComponent(ParamObj.searchNonVille );
		}
		if(ParamObj.searchNonType   != ""){
			ParamObj.searchNonType   = decodeURIComponent(ParamObj.searchNonType );
		}
	}

    //Full Reload of memory !
	if (dropBack == "1") {
	
	
	    //
	    ParamObj.id = getQuerystring("id", ParamObj.id);
	    ParamObj.langue = getQuerystring("langue", ParamObj.langue);
	    ParamObj.currpage = getQuerystring("currpage", ParamObj.currpage);
	    ParamObj.itemperpage = getQuerystring("itemperpage", ParamObj.itemperpage);
	    ParamObj.usepaging = getQuerystring("usepaging", ParamObj.usepaging);
	    ParamObj.typeList = getQuerystring("typeList", ParamObj.typeList);
	    ParamObj.prixMax = getQuerystring("prixMax", ParamObj.prixMax);
	    ParamObj.prixMin = getQuerystring("prixMin", ParamObj.prixMin);
	    ParamObj.maxprice = getQuerystring("maxprice", ParamObj.maxprice);
	    ParamObj.maxprice = getQuerystring("maxprice", ParamObj.maxprice);
	  
	    //need to be decoded... 
	    ParamObj.filters = getQuerystring("filters", "");
	    ParamObj.searchVille = getQuerystring("searchVille", "");
	    ParamObj.searchType = getQuerystring("searchType", "");
	    ParamObj.searchGenre = getQuerystring("searchGenre", "");
	    ParamObj.searchNonGenre = getQuerystring("searchNonGenre", "");
	    ParamObj.searchNonVille = getQuerystring("searchNonVille", "");
	    ParamObj.searchNonType = getQuerystring("searchNonType", "");

	    if (ParamObj.filters != "") {
	        ParamObj.filters = decodeURIComponent(ParamObj.filters);
	    }
	    if (ParamObj.searchVille != "") {
	        ParamObj.searchVille = decodeURIComponent(ParamObj.searchVille);
	    }
	    if (ParamObj.searchType != "") {
	        ParamObj.searchType = decodeURIComponent(ParamObj.searchType);
	    }
	    if (ParamObj.searchGenre != "") {
	        ParamObj.searchGenre = decodeURIComponent(ParamObj.searchGenre);
	    }
	    if (ParamObj.searchNonGenre != "") {
	        ParamObj.searchNonGenre = decodeURIComponent(ParamObj.searchNonGenre);
	    }
	    if (ParamObj.searchNonVille != "") {
	        ParamObj.searchNonVille = decodeURIComponent(ParamObj.searchNonVille);
	    }
	    if (ParamObj.searchNonType != "") {
	        ParamObj.searchNonType = decodeURIComponent(ParamObj.searchNonType);
	    }
	}
	
}

//********************************************************
//****  REDIRECTONNE VERS LA FICHE SELON LE PARAM
//********************************************************
function RedirectME(uriParam) {
    // ICI C'EST LE SERVEUR .TRANFERT ... REDIRECT NEXT PAGE

	/*
	var str = "";
	str  = ParamObj.RedirectPage;

	if(str.indexOf("?") != -1){

		//alert(ParamObj.RedirectPage + "&jsrdir=1&" + uriParam);
		
		window.location = ParamObj.RedirectPage + "&jsrdir=1&" + uriParam;
    		
	} else{
		//alert("dfgsg");
		window.location = ParamObj.RedirectPage + "?jsrdir=2&" + uriParam;
	}
	*/
	
	var returnurifull = '&returnurifull=' + document.location.href.replace(/&/gi, "%26");
	//returnurifull = encodeURI(returnurifull);
		
	var str = "";
	str  = ParamObj.RedirectPage;
	
	if(str.indexOf("?") != -1){

		//alert(ParamObj.RedirectPage + "&jsrdir=1&" + uriParam + searchParams);
		window.location = ParamObj.RedirectPage + "&jsrdir=1&" + uriParam + returnurifull;
    		
	} else{
		
		//alert(ParamObj.RedirectPage + "?jsrdir=2&" + uriParam + searchParams);
		window.location = ParamObj.RedirectPage + "?jsrdir=2&" + uriParam + returnurifull;
	}
}

/////////////////////////////////////////////////////////////////////////
//////  CONTROLE DES CHECKS BOXS  : TYPE OU GENRE
/////////////////////////////////////////////////////////////////////////  
function ChangeTypeDataClick(id) {

    //Check and uncheck solution!
    var idV = "#monckeckx_" + id;

    if ($(idV).attr("check") == "0") {
        $(idV).attr('check', '1');
        $(idV).children("img").attr('src', 'images/check.png');
    } else {
        $(idV).attr('check', '0');
        $(idV).children("img").attr('src', 'images/uncheck.png');
    }

    //empty result (SQL INTO)
    $("#t2").empty();

    var irendu = 0;

    $('.checkboxpowerType').each(function() {
        if ($(this).attr('check') == 1) {
            if (irendu == 0) {
                $('#t2').append('\"' + $(this).attr('title') + '\"');
            } else {
                $('#t2').append(', \"' + $(this).attr('title') + '\"');
            }
            irendu++;
        }

    });
    ParamObj.searchGenre = $("#t2").html(); //set sql search


    //alert(ParamObj.searchGenre);

    ParamObj.subcall = "1"; //ne pas recaller les villes pour pas les d&eacute;faire 
    //refrech du webservice
    QueryPostBack(ParamObj); //call du web-service pour avoir le sql In!       
}

/////////////////////////////////////////////////////////////////////////
//////  CONTROLE DES CHECKS BOXS  : TYPE OU GENRE  : CLICK TOUT TOUT
/////////////////////////////////////////////////////////////////////////  
function CheckAllTypeResetClick(aj) {
    $('.checkboxpowerType').each(function() {

        $(this).attr('check') == 1
        $(this).children("img").attr('src', 'images/check.png');


    });

    if (aj == 1) {
        QueryPostBack(ParamObj);
    }

}

/////////////////////////////////////////////////////////////////////////
//////  CONTROLE DES CHECKS BOXS  : TYPE OU GENRE : DÉSELECTIONNE TOUT
/////////////////////////////////////////////////////////////////////////  
function UnCheckAllTypeResetClick(aj) {
    $('.checkboxpowerType').each(function() {

        $(this).attr('check') == 0
        $(this).children("img").attr('src', 'images/uncheck.png');



    });

    if (aj == 1) {
        QueryPostBack(ParamObj);
    }
}

/////////////////////////////////////////////////////////////////////////
//////  CONTROLE DES CHECKS BOXS  : VILLE
/////////////////////////////////////////////////////////////////////////  	
function ChangeCityDataClick(id) {
    //alert(id);
    //Check and uncheck solution!
    var idV = "#monckeck_" + id;

    if ($(idV).attr("check") == "0") {
        $(idV).attr('check', '1');
        $(idV).children("img").attr('src', 'images/check.png');
    } else {
        $(idV).attr('check', '0');
        $(idV).children("img").attr('src', 'images/uncheck.png');
    }

    //empty result (SQL INTO)
    $("#t1").empty();

    var irendu = 0;

    $('.checkboxpowerVille').each(function() {
        if ($(this).attr('check') == 1) {
            if (irendu == 0) {
                $('#t1').append('\"' + $(this).attr('title').replace("'", "''") + '\"');
            } else {
                $('#t1').append(', \"' + $(this).attr('title').replace("'", "''") + '\"');
            }
            irendu++;
        }

    });
    ParamObj.searchVille = $("#t1").html(); //set sql search

    ParamObj.subcall = "1"; //ne pas recaller les villes pour pas les d&eacute;faire 
    //refrech du webservice
    QueryPostBack(ParamObj); //call du web-service pour avoir le sql In!       
}

/////////////////////////////////////////////////////////////////////////
//////  CONTROLE DES CHECKS BOXS  : TYPE OU GENRE : CLICK TOUT 
/////////////////////////////////////////////////////////////////////////  
function CheckAllCityResetClick(aj) {
    $('.checkboxpowerVille').each(function() {

        $(this).attr('check', '1');
        $(this).children("img").attr('src', 'images/check.png');


    });

    if (aj == 1) {
        QueryPostBack(ParamObj);
    }

}

/////////////////////////////////////////////////////////////////////////
//////  CONTROLE DES CHECKS BOXS  : DESELECTIONNE TOUT TOUT
/////////////////////////////////////////////////////////////////////////     
function UnCheckAllCityResetClick(aj) {
    $('.checkboxpowerVille').each(function() {

        $(this).attr('check', '0');
        $(this).children("img").attr('src', 'images/uncheck.png');

    });

    if (aj == 1) {
        QueryPostBack(ParamObj);
    }
}




//****************************************************************
//********** CHANGE SLIDER MONEY VALUE AJAX CALL
//****************************************************************
function ChangeMoneyFinderClick(dmin, dmax) {
    ParamObj.prixMax = dmax;  //RECHERCHE PAS PRIX MAX 
    ParamObj.prixMin = dmin;  //RECHERCHE PAR PRIX MIN 	
    //alert("Je change money");
    QueryPostBack(ParamObj); //call du web-service pour avoir le sql In!     
}

//*************************************************************************
// FONCTION QUI CHNAGE LA VALEUR DES CHECKBOX QUI SON HARDCODER...
//*************************************************************************
function changeHardCheckBoxClick(selBox) {

    var idV = "#" + selBox;

    if ($(idV).attr("check") == "0") {

        $(idV).attr('check', '1');
        $(idV).children("img").attr('src', 'images/check.png');
    } else {
        $(idV).attr('check', '0');
        $(idV).children("img").attr('src', 'images/uncheck.png');
    }

    QueryPostBack(ParamObj); //call du web-service pour avoir le sql In! 
}

//***************************************************************************
//***  FONCTION QUI SELECTIONNE TOUT TOUT LES CHECKS OU LES DESECLECTIONNE
//***************************************************************************
function changeAllHardCheckBoxValueClick(isSel, aj) {
    if (isSel == "1") {
        for (var i = 1; i < 5; i++) {
            var idV = "#monckeckx_Hard_" + i;
            $(idV).attr('check', '1');
            $(idV).children("img").attr('src', 'images/check.png');
        }

    } else {
        for (var i = 1; i < 5; i++) {
            var idV = "#monckeckx_Hard_" + i;
            $(idV).attr('check', '0');
            $(idV).children("img").attr('src', 'images/uncheck.png');
        }
    }
    if (aj == 1) {
        QueryPostBack(ParamObj); //call du web-service pour avoir le sql In!  
    }

}
