function getRandomProduts(){
    try{
      AjaxService.getRandomListings(onRandomListings);
     }catch(err){}
}

DWREngine._errorHandler = '';
DWREngine._warningHandler = '';

function onRandomListings(listings){
    try
    {
        var data;
        var html='';
        for (i=0; i<5; i++) {
            data = listings[i];
            var ebayView = 'http://rover.ebay.com/rover/1/711-1751-2978-71/1?AID=5463217&PID=1536630&SID=randomhome&loc=http%3A//cgi.ebay.com/ws/eBayISAPI.dll%3FViewItem%26item%3D';
            if (data[2]) {
                if (data[2] == 'Australia'){
                    ebayView =  'http://rover.ebay.com/rover/1/705-10061-5969-5/1?AID=10281274&PID=1536630&SID=randomhome&loc=http%3A//cgi.ebay.com.au/ws/eBayISAPI.dll%3FViewItem%26item%3D';
                }else if (data[2] == 'Belgium_Dutch') {
                    ebayView = 'http://rover.ebay.com/rover/1/1553-22136-8894-7/1?AID=10372511&PID=1536630&SID=randomhome&loc=http%3A//cgi.benl.ebay.be/ws/eBayISAPI.dll%3FViewItem%26item%3D';
                }else if (data[2] == 'Canada') {
                    ebayView =  'http://rover.ebay.com/rover/1/706-5367-2978-10/1?AID=8417593&PID=1536630&SID=randomhome&loc=http%3A//cgi.ebay.ca/ws/eBayISAPI.dll%3FViewItem%26item%3D';
                }else if (data[2] == 'France') {
                    ebayView =  'http://rover.ebay.com/rover/1/709-23234-2978-9/1?AID=10367739&PID=1536630&SID=randomhome&loc=http%3A//cgi.ebay.fr/ws/eBayISAPI.dll%3FViewItem%26item%3D';
                }else if (data[2] == 'India') {
                    ebayView =  'http://rover.ebay.com/rover/1/4686-26182-2978-42/1?AID=10382423&PID=1536630&SID=randomhome&loc=http%3A//cgi.ebay.in/ws/eBayISAPI.dll%3FViewItem%26item%3D';
                }else if (data[2] == 'Italy') {
                    ebayView =  'http://rover.ebay.com/rover/1/724-24676-10417-2/1?AID=10383434&PID=1536630&SID=randomhome&loc=http%3A//cgi.ebay.it/ws/eBayISAPI.dll%3FViewItem%26item%3D';
                }else if (data[2] == 'Netherlands') {
                    ebayView =  'http://rover.ebay.com/rover/1/1346-21022-9149-7/1?AID=10363499&PID=1536630&SID=randomhome&loc=http%3A//cgi.ebay.nl/ws/eBayISAPI.dll%3FViewItem%26item%3D';
                }else if (data[2] == 'Singapore') {
                    ebayView =  'http://rover.ebay.com/rover/1/3423-39206-15408/1?AID=10431024&PID=1536630&SID=randomhome&loc=http%3A//cgi.ebay.com.sg/ws/eBayISAPI.dll%3FViewItem%26item%3D';
                }else if (data[2] == 'Spain') {
                    ebayView =  'http://rover.ebay.com/rover/1/1185-24651-10004-2/1?AID=10380493&PID=1536630&SID=randomhome&loc=http%3A//cgi.ebay.es/ws/eBayISAPI.dll%3FViewItem%26item%3D';
                }else if (data[2] == 'UK') {
                    ebayView =  'http://rover.ebay.com/rover/1/710-5232-2978-1/1?AID=9479574&PID=1536630&SID=randomhome&loc=http%3A//cgi.ebay.co.uk/ws/eBayISAPI.dll%3FViewItem%26item%3D';
                }
            }
            var link = ebayView + data[0];
            var classH = 'listingItemB';
            if (i<4){
               var classH = 'listingItem';
            }
            html+="<div class='"+classH+"'><a class='listingItem' target='_blank' href='"+link +"'>"+data[1]+"</a></div>";
        }
        divEl = document.getElementById("listings");
        divEl.innerHTML=html;
        setTimeout("getRandomProduts()", "10000");
    }
    catch(err){}
}


function openInNewWindow(link) {
 // Change "_blank" to something like "newWindow" to load all links in the same new window
    var ebayView =  'http%3A//cgi.ebay.com/ws/eBayISAPI.dll%3FViewItem%26item%3D';
    var cjView = 'http://www.qksrv.net/click-1536630-5463217?loc=';
    var ebaylink = cjView + ebayView + link;
    window.open(ebaylink, 'newWindow');
}

function errorHandler(msg){}

function warningHandler(msg){}



