function displaySpecialOfferInImages(myList) {
    function rand( min, max ) {
        if( max ) {
            return Math.floor(Math.random() * (max - min + 1)) + min;
        } else {
            return Math.floor(Math.random() * (min + 1));
        }
    }
    var max_offer_to_display = 6;
    if (max_offer_to_display > myList.length) {
        max_offer_to_display = myList.length;
    }
    var new_random_array = new Array();
    var tmp_random_array = new Array();
    for (var i = 0; i < max_offer_to_display; i++) {
        var k = rand(0, myList.length - 1);
        if (tmp_random_array[k] == 1) {
            i--;
            continue;
        }		
        new_random_array.push(myList[k]);
        tmp_random_array[k] = 1;
    }
    
    // Special Characters code when creatin DOM
    var EuroSign  = String.fromCharCode(0x20AC);
    var PoundSign = String.fromCharCode(0x00A3);
    var YenSign   = String.fromCharCode(0x00A5);
    var Space     = String.fromCharCode(0x00A0);
    
    var DOM = new CARTRAWLER.DOM();
    
    // First we should remove all current element from the target DOM element
    // to have an empty DOM element. It's done to avoid adding element and 
    // having duplicate
    var children = DOM.gE("rightAd").childNodes.length;
    if (children) {
        for (var i = 0; i < children; i++) {
            DOM.remE(DOM.gE("rightAd").childNodes[0]);
        }
    }	
    
    // Loop Thru the Array result and just display 3 SpecialOffer
    for (var i = 0, j = 1; i < new_random_array.length && j < max_offer_to_display + 1; i++, j++) {
        var div_top = DOM.gE("rightAd");
        var div_title = DOM.cE("div", {
            className: "ct_sptitle",
            id: "ct_sptitle_id"+j
        }, new_random_array[i].LocationName);
        
        //var sym_day = new_random_array[i].Day;
	var sym_day = "/"+ctOTAEngine.translate("DurationDay");
        var span_day = DOM.cE("div", {
            className: "ct_spday",
            id: "ct_spday_id"+j
        }, sym_day);
        
        var text_from = ctOTAEngine.translate("PriceFrom"); // Space;
        var span_from = DOM.cE("div", {
            className: "ct_spsup",
            id: "ct_spsup_id"+j
        }, text_from);
        
        var price = '';
        if(new_random_array[i].Currency === 'EUR') {
            price = EuroSign + new_random_array[i].Amount + new_random_array[i].SymbolOption;
        }
        else if(new_random_array[i].Currency === 'GBP') {
            price = PoundSign + new_random_array[i].Amount + new_random_array[i].SymbolOption;
        }        
        else {
            price = new_random_array[i].Symbol + new_random_array[i].Amount + new_random_array[i].SymbolOption;
        }
        var span_price = DOM.cE("div", {
            className: "ct_spsppricetxt",
            id: "ct_spsppricetxt_id"+j
        }, price);  
        
        var div_price = DOM.cE("div", {
            className: "ct_spprice"+j,
            id: "ct_spspprice_id"+j
        }, span_from);  
        div_price.appendChild(span_price);
        div_price.appendChild(span_day);
        
        var div_mainprice = DOM.cE("div", {
            className: "ct_spprice"+j,
            id: "ct_spprice_id"+j
        }, div_price);

		var div_main = DOM.cE("div", {
			className: "ct_spblock"+j
		}, div_title);

        div_main.appendChild(div_price);
        var text_book = ctOTAEngine.translate("carsBook");
        var ref = "./" + new_random_array[i].Url;
        var span_book = DOM.cE("span", {
        }, text_book);		
        var link_book = DOM.cE("a", {
            href: ref
        }, span_book);
		var div_button = null;
		if (text_book.length >= 17) {
	        div_button = DOM.cE("div", {
        	    className: "ct_spbutton3"
	        }, link_book);
		}
		else if ((text_book.length > 11) && (text_book.length < 17)) {
	        div_button = DOM.cE("div", {
        	    className: "ct_spbutton2"
	        }, link_book);
		}		
		else {
	        div_button = DOM.cE("div", {
        	    className: "ct_spbutton"
	    }, link_book);
	}
/*
	if (text_book.length > 12) {
	max_offer_to_display = 2;
	}
	else {
	max_offer_to_display = 3;
	}
	*/
        div_main.appendChild(div_button);
        div_top.appendChild(div_main);
    }
};

/**
 * Create a new object to handle Special Offer
 *
 * @param element, {options}
 * element: An id or an element where the specialoffers will be added
 * options: 
 * - id, campaign ID
 * - campaign, campaign name
 * - language, language value, English in that example
 * - target, can be 'Test' or 'Production'
 * - day, the localization value of the name 'day'
 * - baseURL, the baseURL when fillEngine is set to 'false'
 * - operation, can be 'list' or 'display'
 *               - if 'display' then the script create the HTML for you and place 
 *                 it in the HTML DOM ID 'eltDOM' declared in your HTML.  
 *               - if 'list' the callback function is called
 * - cssStyle: the name of the cascading style sheet used for displaying
 * - type, 'feed' or 'server'
 * - cssStyle: the name of the stylesheet used
 * - fillEngine: 'true' or 'false' if you want to populate the booking engine form
 * - callback, name of the function which will deal with the data 122070_TESTCODE_EN.xml
 */
function abeSpecialOffers() {
	var so = new CARTRAWLER.SpecialOffers('abe_offers', 'abe_disclaimer', {     
        id: 77445,
        campaign: 'DohopSpecialOffers',
        language: ctOTAEngine.languageID+ctOTAEngine.currencyID, //'EN',
        target: ctOTAEngine.target,
        proxyURL: '/common/abe/otaproxy/otaproxy.php',
	l18n: {
		destination_top: "Rent a car",
		day: ctOTAEngine.translate("DurationDay"),
		from: ctOTAEngine.translate("PriceFrom"),
		book: "BOOK NOW"
	},
        operation: 'display',
        type: 'feed',
        style_name: 'skins',
        style_path: './',
		style_file: 'specialoffers.css',
        currency: ctOTAEngine.currencyID,//'EUR',
        fillEngine: false,
		baseURL: './',
        callback: displaySpecialOfferInImages
    });
}
