function GetArabicContent(n){switch(n){case"Hotels":return"الفنادق";case"Airports":return"المطارات";case"Cities":return"المدن ";case"Localities":return"المواقع";default:return"الدول"}}var deviceHeight=$(window).height(),deviceWidth=$(window).width(),rghtMrgnPer=94;$(window).resize(function(){deviceHeight=$(window).height();deviceWidth=$(window).width()});$.widget("custom.catcomplete",$.ui.autocomplete,{_create:function(){this._super()},_renderMenu:function(n,t){var s=this,e="",u="acFrstDiv",r="acList",o="",i="",f=1;$.each(t,function(t,h){var c;h.category!=""&&(h.category!=e?(u="acFrstDiv",e=h.category,f==1?(r="acList flight_catagory",f=parseInt(f)+1):r="acList"):(u="acFrstDiv flight_names_auto",r="acList"),c=s._renderItemData(n,h),o=h.airport,i=h.city+", "+h.country,/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)||(h.airport.length>17&&(h.airport=h.airport.substr(0,17)+"..."),i.length>17&&(i=i.substr(0,17)+"...")),h.category&&(c.attr("aria-label",h.category+" : "+h.label),c.attr("class",r),c.html("<div class='"+u+"'><\/div><div class='acScndDiv' title='"+o+"'>"+h.airport+"<div class='acScndDivCountry' title='"+h.city+", "+h.country+"'>"+i+"<\/div><\/div><div class='acThrdDiv'><span class='clsAPCode' style='float:right;'>"+h.id+"<\/span><\/hr><\/div>")))})}});$.widget("custom.catcompletehotel",$.ui.autocomplete,{_create:function(){this._super()},_renderMenu:function(n,t){var v=this,i="",c="",f="acFrstDiv",r="acList",e="",u="",o="",l="",s="",a=!1,h="";n.addClass("ul_cuscontainer");$.each(t,function(y,p){var tt,it,k,rt,d,nt,w,b,ut,g;if(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)?p.name.length>25&&(p.name=p.name.substr(0,25)+"..."):p.name.length>40&&(p.name=p.name.substr(0,40)+"..."),y+1<t.length){tt=y+1;for(it in t[tt])"source"===it&&(h=t[tt][it])}else h="";p.source!=""&&(a=t.length>y&&h!=p.source&&h!=""?!0:!1,i=p.source,c!=i?(i=p.source,c=i,i.trim()=="Cities"?e="firstCityDiv":i.trim()=="Hotels"?u="firstHotelDiv":i.trim()=="Localities"?o="firstLocalityDiv":i.trim()=="Countries"&&(s="firstCountryDiv")):(i=null,e="",u="",o="",l="",s=""),k=v._renderItemData(n,p),w="",i!=null&&(k.attr("class",r),b="",/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)?i=="Hotels"?(b="<img style='margin-top:2px; width: 15px;' src='https://images.rehlat.com/Content/images/HotelIcons/auto@iconsH.png'/>",w="hdrHotels"):i=="Airports"?(b="<img style='width: 15px;' src='https://images.rehlat.com/Content/images/HotelIcons/airport.png'/>",w="hdrAirports"):i=="Cities"?(b="<img style='width: 15px;' src='https://images.rehlat.com/Content/images/HotelIcons/auto@iconsC.png'/>",w="hdrCities"):i=="Localities"?(b="<img style='width: 15px;' src='https://images.rehlat.com/Content/images/HotelIcons/auto@iconsL.png'/>",w="hdrLocalities"):i=="Countries"&&(b="<img style='width: 15px;'style='margin-top:2px;' src='https://images.rehlat.com/Content/images/HotelIcons/Country.png'/>",w="hdrCountries"):i=="Hotels"?(b="<img style='margin-top:2px;' src='https://images.rehlat.com/Content/images/HotelIcons/auto@iconsH.png'/>",w="hdrHotels"):i=="Airports"?(b="<img  src='https://images.rehlat.com/Content/images/HotelIcons/airport.png'/>",w="hdrAirports"):i=="Cities"?(b="<img  src='https://images.rehlat.com/Content/images/HotelIcons/auto@iconsC.png'/>",w="hdrCities"):i=="Localities"?(b="<img src='https://images.rehlat.com/Content/images/HotelIcons/auto@iconsL.png'/>",w="hdrLocalities"):i=="Countries"&&(b="<img  style='margin-top:2px;' src='https://images.rehlat.com/Content/images/HotelIcons/Country.png'/>",w="hdrCountries"),rt=""),ut="",c=="Hotels"?p.name!=null&&(g="",g=u!=""?/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)?"<div style='float:right;border:solid 0px red;margin-right: 8px; font-size: 13px;line-height: 16px; min-width:70px;text-align: right;' id='"+w+"' title='"+i+"'>"+b+"&nbsp;"+i+" <\/div>":"<div style='float:right;border:solid 0px red;line-height: 16px; min-width:100px;text-align: right;' id='"+w+"' title='"+i+"'>"+b+"&nbsp;"+i+" <\/div>":"",k.attr("class",r),p.name.length>24&&(d="<div class='"+f+"'><\/div><div class='CityNames "+u+"'><div class='divLocationName' title='"+p.value+"'> "+p.name+"<\/div>"+g+"<div class='clearfix'><\/div><\/div><div class='acThrdDiv'><\/div>"),p.name.length<=24&&(d="<div class='"+f+"'><\/div><div class='CityNames "+u+"'><div class='divLocationName' title='"+p.value+"'> "+p.name+"<\/div>"+g+"<div class='clearfix'><\/div><\/div><div class='acThrdDiv'><\/div>")):p.name!=null&&(p.name.length>47&&(p.name=p.name.substr(0,47)+"..."),g="",g=e!=""||o!=""||l!=""||s!=""?/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)?"<div style='float:right;border:solid 0px red;margin-right:8px;font-size: 13px;line-height: 24px; min-width:70px;text-align: right;' 'border:1px red solid'  id='"+w+"' title='"+i+"'>"+b+"&nbsp;"+i+" <\/div>":"<div style='float:right;border:solid 0px red;line-height: 24px; min-width:100px;text-align: right;' 'border:1px red solid'  id='"+w+"' title='"+i+"'>"+b+"&nbsp;"+i+" <\/div>":"",k.attr("class",r),d="<div class='"+f+"'><\/div><div class='CityNames "+e+" "+o+" "+l+" "+s+"'>"+g+"<div class='divLocationName' title='"+p.value+"'> "+p.name+" ("+p.hotelcount+" hotels)<\/div><div class='clearfix'><\/div><\/div><div class='acThrdDiv'><\/div>"),a?/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)?(k.prop("style","margin:0px;"),nt="<div style='border-bottom:solid 1px #ccc!important; margin:0 0px 0 0px;'><\/div>"):(k.prop("style","margin:0px;border-bottom:solid 1px #ccc!important;"),nt=""):nt="",i!=null&&(k.attr("class",r),k.html(rt+d)),i=="No Result Found"?(d="<div class='"+f+"'><\/div><div class='divLocationName' title='"+p.value+"'> "+p.name+"<\/div><\/div>",k.attr("class",r),k.html(rt+d)):(k.attr("class",r),k.html(d+nt)))})}});$.widget("custom.catcompletehotelAr",$.ui.autocomplete,{_create:function(){this._super()},_renderMenu:function(n,t){var v=this,i="",h="",c="acFrstDiv",r="acList",u="",f="",e="",l="",o="",a=!1,s="";n.prop("style","background:#fff !important;");n.addClass("ul_cuscontainer");$.each(t,function(y,p){var tt,it,k,rt,d,nt,w,b,g;if(y+1<t.length){tt=y+1;for(it in t[tt])"source"===it&&(s=t[tt][it])}else s="";p.source!=""&&(a=t.length>y&&s!=p.source&&s!=""?!0:!1,i=p.source,h!=i?(i=p.source,h=i,i.trim()=="Cities"?u="firstCityDiv":i.trim()=="Hotels"?f="firstHotelDiv":i.trim()=="Localities"?e="firstLocalityDiv":i.trim()=="Countries"&&(o="firstCountryDiv")):(i=null,u="",f="",e="",l="",o=""),k=v._renderItemData(n,p),w="",i!=null&&(k.attr("class",r),b="",/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)?i=="Hotels"?(b="<img style='width: 15px;' src='https://images.rehlat.com/Content/images/HotelIcons/hotel.png'/>",w="hdrHotels"):i=="Airports"?(b="<img style='width: 15px;'  src='https://images.rehlat.com/Content/images/HotelIcons/airport.png'/>",w="hdrAirports"):i=="Cities"?(b="<img style='width: 15px;'  src='https://images.rehlat.com/Content/images/HotelIcons/cities.png'/>",w="hdrCities"):i=="Localities"?(b="<img style='width: 15px;'  src='https://images.rehlat.com/Content/images/HotelIcons/area.png'/>",w="hdrLocalities"):i=="Countries"&&(b="<img style='width: 15px;'  src='https://images.rehlat.com/Content/images/HotelIcons/Country.png'/>",w="hdrCountries"):i=="Hotels"?(b="<img src='https://images.rehlat.com/Content/images/HotelIcons/hotel.png'/>",w="hdrHotels"):i=="Airports"?(b="<img src='https://images.rehlat.com/Content/images/HotelIcons/airport.png'/>",w="hdrAirports"):i=="Cities"?(b="<img src='https://images.rehlat.com/Content/images/HotelIcons/cities.png'/>",w="hdrCities"):i=="Localities"?(b="<img src='https://images.rehlat.com/Content/images/HotelIcons/area.png'/>",w="hdrLocalities"):i=="Countries"&&(b="<img src='https://images.rehlat.com/Content/images/HotelIcons/Country.png'/>",w="hdrCountries"),rt=""),h=="Hotels"?p.name!=null&&(g="",g=f!=""?/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)?"<div style='float:left;margin-left: 8px;font-size: 12px; ' border:solid 1px red' id='"+w+"' title='"+i+"'>"+b+"&nbsp;"+GetArabicContent(i)+" <\/div>":"<div style='float:left' border:solid 1px red' id='"+w+"' title='"+i+"'>"+b+"&nbsp;"+GetArabicContent(i)+" <\/div>":"",k.attr("class",r),d="<div class='"+c+"'><\/div><div class='CityNames "+f+"'><div class='divLocationNameAr' title='"+p.value+"' style='margin-right: 8px;'> "+p.name+"<\/div>"+g+"<div class='clearfix'><\/div><\/div><div class='acThrdDiv'><\/div>"):p.name!=null&&(g="",g=u!=""||e!=""||l!=""||o!=""?/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)?"<div style='float:left;margin-left: 8px;font-size: 12px;' id='"+w+"' title='"+i+"'>"+b+"&nbsp;"+GetArabicContent(i)+" <\/div>":"<div style='float:left' id='"+w+"' title='"+i+"'>"+b+"&nbsp;"+GetArabicContent(i)+" <\/div>":"",k.attr("class",r),d="<div class='"+c+"'><\/div><div class='CityNames 'EN"+u+" "+e+" "+l+" "+o+"'>"+g+"<div class='divLocationNameAr' title='"+p.value+"' style='margin-right: 8px;'> "+p.name+" ("+getArabicYear(p.hotelcount)+" فنادق)<\/div><div class='clearfix'><\/div><\/div><div class='acThrdDiv'><\/div>"),a?/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)?(k.prop("style","margin:0px;"),nt="<div style='border-bottom:solid 1px #ccc!important; margin:0 0px 4px 0px;'><\/div>"):(k.prop("style","margin:0px;border-bottom:solid 1px #ccc!important;"),nt=""):nt="",i!=null&&(k.attr("class",r),k.html(rt+d)),i=="No Result Found"?(d="<div class='"+c+"'><\/div><div class='divLocationNameAr' title='"+p.value+"'> "+p.name+"<\/div>",k.attr("class",r),k.html(rt+d)):(k.attr("class",r),k.html(d+nt)))})}});
