function SortByHeightDesc(n,t){return n.Device.size_height_mm>t.Device.size_height_mm?-1:n.Device.size_height_mm<t.Device.size_height_mm?1:0}function SortByHeightAsc(n,t){return n.Device.size_height_mm<t.Device.size_height_mm?-1:n.Device.size_height_mm>t.Device.size_height_mm?1:0}function SortByWidthDesc(n,t){return n.Device.size_width_mm>t.Device.size_height_mm?-1:n.Device.size_width_mm<t.Device.size_height_mm?1:0}function SortByWidthAsc(n,t){return n.Device.size_width_mm<t.Device.size_width_mm?-1:n.Device.size_width_mm>t.Device.size_width_mm?1:0}function SortByDepthDesc(n,t){return n.Device.size_depth_mm>t.Device.size_depth_mm?-1:n.Device.size_depth_mm<t.Device.size_depth_mm?1:0}function SortByDepthAsc(n,t){return n.Device.size_depth_mm<t.Device.size_depth_mm?-1:n.Device.size_depth_mm>t.Device.size_depth_mm?1:0}function SortByWeightDesc(n,t){return n.Device.size_weight_mm>t.Device.size_weight_mm?-1:n.Device.size_weight_mm<t.Device.size_weight_mm?1:0}function SortByWeightAsc(n,t){return n.Device.size_weight_mm<t.Device.size_weight_mm?-1:n.Device.size_weight_mm>t.Device.size_weight_mm?1:0}function SortByScreenDesc(n,t){return n.Device.display_inches>t.Device.display_inches?-1:n.Device.display_inches<t.Device.display_inches?1:0}function SortByScreenAsc(n,t){return n.Device.display_inches<t.Device.display_inches?-1:n.Device.display_inches>t.Device.display_inches?1:0}function SortByAnnouncedDesc(n,t){return n.Device.announced_date>t.Device.announced_date?-1:n.Device.announced_date<t.Device.announced_date?1:0}function SortByAnnouncedAsc(n,t){return n.Device.announced_date<t.Device.v?-1:n.Device.announced_date>t.Device.announced_date?1:0}function filterByChanged(){var n=parseInt($("#ddl-orderby").val(),10);switch(n){case 1:arrDevices.sort(SortByHeightDesc);break;case 2:arrDevices.sort(SortByHeightAsc);break;case 3:arrDevices.sort(SortByWidthDesc);break;case 4:arrDevices.sort(SortByWidthAsc);break;case 5:arrDevices.sort(SortByDepthDesc);break;case 6:arrDevices.sort(SortByDepthAsc);break;case 7:arrDevices.sort(SortByWeightDesc);break;case 8:arrDevices.sort(SortByWeightAsc);break;case 9:arrDevices.sort(SortByScreenDesc);break;case 10:arrDevices.sort(SortByScreenAsc);break;case 11:arrDevices.sort(SortByAnnouncedDesc);break;case 12:arrDevices.sort(SortByAnnouncedAsc)}drawDevices()}function updateSelectButtons(){arrDevices.length<2||$("#selectSide").val()==="5"||$("#selectSide").val()==="6"?$(".device .select").hide():$(".device .select").show();$(".device").each(function(){var n=parseInt($(this).attr("id").replace("device-",""),10);$.each(arrSelectedDevices,function(t,i){i.Device.id===n&&($("#device-"+n+" .select").attr("data-selected","true"),$("#device-"+n+" .btn").removeClass("not-selected"),$("#device-"+n+" .btn").removeClass("selected"),$("#device-"+n+" .btn").addClass("selected"))})})}function clearAllSelectedDevice(){$.each(arrSelectedDevices,function(n,t){$("#device-"+t.Device.id+" .select").attr("data-selected","false");$("#device-"+t.Device.id+" .btn").removeClass("not-selected");$("#device-"+t.Device.id+" .btn").removeClass("selected");$("#device-"+t.Device.id+" .btn").addClass("not-selected")});arrSelectedDevices=[]}function deviceSelectButtonClicked(n){var l,a;if(n.stopPropagation(),l=parseInt($(this).closest(".device").attr("id").replace("device-",""),10),a=null,$.each(arrDevices,function(n,t){t.Device.id===l&&(a=t)}),$(this).parent().attr("data-selected")==="true")$(this).parent().attr("data-selected","false"),$(this).removeClass("selected"),$(this).addClass("not-selected"),$(arrSelectedDevices).each(function(n){$(this)[0].Device.id===l&&arrSelectedDevices.splice(n,1)});else{if($(arrSelectedDevices).each(function(){if($(this)[0].Device.id===l)return!1}),arrSelectedDevices.length==2)return alert(dict.MaximumTwoDevices),!1;arrSelectedDevices.push(a);$(this).parent().attr("data-selected","true");$(this).removeClass("not-selected");$(this).addClass("selected")}if(arrSelectedDevices.length===2){var h=arrSelectedDevices[0],i=arrSelectedDevices[1],r=h.Device.size_width_mm,u=h.Device.size_height_mm,f=h.Device.size_depth_mm,e=i.Device.size_width_mm,o=i.Device.size_height_mm,s=i.Device.size_depth_mm,c="",t=.0393701;c="<span class='cc'>"+h.Company.name+" "+h.Device.name+"<\/span> "+dict.RelativeTo+" <span class='cc'>"+i.Company.name+" "+i.Device.name+"<\/span>: ";r!==i.w&&(c+="<span class='w'>"+differenceInPercent(Math.max(r,e),Math.min(r,e),1)+"("+differenceInNumbers(Math.max(r,e),Math.min(r,e),1)+"mm / "+differenceInNumbers(Math.max(r*t,e*t),Math.min(r*t,e*t),2)+" in) "+(r<e?"<span class='dd'>"+dict.Narrower+"<\/span>":"<span class='dd'>"+dict.Wider+"<\/span>")+"<\/span>, ");u!==i.h&&(c+="<span class='w'>"+differenceInPercent(Math.max(u,o),Math.min(u,o),1)+"("+differenceInNumbers(Math.max(u,o),Math.min(u,o),1)+"mm / "+differenceInNumbers(Math.max(u*t,o*t),Math.min(u*t,o*t),2)+" in) "+(u<o?"<span class='dd'>"+dict.Shorter+"<\/span>":"<span class='dd'>"+dict.Taller+"<\/span>")+"<\/span>, ");f!==i.h&&(c+="<span class='w'>"+differenceInPercent(Math.max(f,s),Math.min(f,s),1)+"("+differenceInNumbers(Math.max(f,s),Math.min(f,s),1)+"mm / "+differenceInNumbers(Math.max(f*t,s)*t,Math.min(f*t,s*t),2)+" in) "+(f<s?"<span class='dd'>"+dict.Thinner+"<\/span>":"<span class='dd'>"+dict.Thicker+"<\/span>")+"<\/span>");$(".info-content").html(c)}}function differenceInNumbers(n,t,i){return Math.abs((n-t).toFixed(i))}function differenceInPercent(n,t,i,r){return r?Math.abs(([n-t]/t*100).toFixed(i))+"%":Math.abs(([n-t]/n*100).toFixed(i))+"%"}function updateScrollingArrows(){if(arrDevices.length===0)return!1;try{canScrollDirection("left")||canScrollDirection("right")?$(".h-nav").show():$(".h-nav").hide()}catch(n){return!1}}function btnShareButtonClicked(){var n={url:window.location.href};$.ajax({type:"POST",url:"/WebServices/GetData.asmx/ShortenUrl",data:JSON.stringify(n),contentType:"application/json; charset=utf-8",dataType:"json",success:function(n){if(n.d!==null){$("#share-modal .inner-content").html("<h3>"+dict.LinkToComparison+"<\/h3><textarea id='input-shortlink' readonly>"+n.d+"<\/textarea><button  class='copy-button button small' data-clipboard-action='copy' data-clipboard-target='#input-shortlink' >"+dict.CopyToClipboard+"<\/button><span class='copied'>"+dict.Copied+"<\/span>");var t=new ClipboardJS(".copy-button");$("#share-modal").foundation("open");t.on("success",function(){$(".copied").fadeTo(500,1,function(){$(".copied").fadeTo(500,0,function(){})})})}}})}function activateOverlayedMode(){var n,t;gIsOverlayedMode=!0;n=getDeviceLargeWidthHeight();$(".content").css("width",n[0]);$(".content").css("height",n[1]);$(".device").css("position","absolute");$(".device").css("left","0");$(".device").css("bottom","0");gShowinWireframe||($(".device img").css("opacity",""),$(".device img").css("opacity","0.4"));$(".remove").hide();$(".device-name").hide();t=1;$.each($(".device"),function(n,r){for(i=1;i<=gMaxDevicesLimitInView;i++)$(r).removeClass("c"+i);$(r).addClass("c"+t++)});updateContainerSizeInOverlayMode();displayDeviceLegenForOverlayedMode()}function displayDeviceLegenForOverlayedMode(){$(".device-legend .inner").html("");var n=1;$.each(arrDevices,function(t,i){$(".device-legend .inner").append("<div class='legend-item'><span class='square b"+n+++"'><\/span>"+i.Company.name+" "+i.Device.name+"<\/div>")})}function deactivateOverlayedMode(){gIsOverlayedMode=!1;$(".content").css("width","");$(".content").css("height","");$(".device").css("position","");$(".device").css("left","");$(".device").css("bottom","");$(".device img").css("opacity","");$(".device img").css("opacity","1");$(".remove").show();$(".device-name").show();$(".device-legend .inner").html("")}function updateContainerSizeInOverlayMode(){var n=getDeviceLargeWidthHeight();$(".content").css("width",n[0]+"em");$(".content").css("height",n[1]+"em")}function getDeviceLargeWidthHeight(){var i=.3527778,r,u,n=0,t=0;return $.each(arrDevices,function(i,r){switch(parseInt($("#selectSide").val(),10)){case 1:case 2:r.Device.size_width_mm>n&&(n=r.Device.size_width_mm);r.Device.size_height_mm>t&&(t=r.Device.size_height_mm);break;case 3:case 4:r.Device.size_width_mm>n&&(n=r.Device.size_width_mm);r.Device.size_depth_mm>t&&(t=r.Device.size_depth_mm)}}),r=t/i*PHONE_SIZE_MULTIPLIER,u=n/i*PHONE_SIZE_MULTIPLIER,[u,r]}function onRemoveDeviceClick(){var n=parseInt($(this).closest(".device").attr("id").replace("device-",""),10),t=0;$.each(arrDevices,function(i,r){if(r.Device.id===n)return!1;t++});arrDevices.splice(t,1);$("#device-"+n).remove();arrDevices.length===0&&$(".info-content").html(dict.IntoGuide);arrDevices.length<2&&$(".btn-share").hide();updateHash();updateSelectButtons();$(".alert-span").remove()}function onCreditCardClick(){$(".info-content").html(dict.StandardCreditCard+" <span class='size'>85.60 × 53.98 mm  (3.370 × 2.125 in)<\/span>")}function onDeviceClick(){var i,n;if(clearAllSelectedDevice(),i=parseInt($(this).attr("id").replace("device-",""),10),n=null,$.each(arrDevices,function(t,r){r.Device.id===i&&(n=r)}),n===null)return!1;var t=.03937007874,u=new Date(parseInt(n.Device.announced_date.replace(/[^0-9 +]/g,""))),f=n.Device.weight_grams!==null&&n.Device.weight_grams>1?n.Device.weight_grams+" "+dict.Grams+" ("+(n.Device.weight_grams*.035274).toFixed(1)+" "+dict.Ounces+")":"",r="<span class='other-names'>"+dict.OtherNames+": "+n.Device.other_names+"<\/span>",e=n.Device.display_inches!==null?"<span class='info-screen-size'>"+dict.ScreenSize+" "+n.Device.display_inches.toFixed(2)+"-"+dict.Inches+"<\/span>":"";n.Device.other_names===""&&(r="");$(".info-content").html("<span class='title'>"+n.Company.name+" "+n.Device.name+" ("+dict.announced+": "+formatDate(u)+")<\/span><span class='size'>"+n.Device.size_width_mm+"x"+n.Device.size_height_mm+"x"+n.Device.size_depth_mm+" "+dict.MM+" ("+(n.Device.size_width_mm*t).toFixed(1)+"x"+(n.Device.size_height_mm*t).toFixed(1)+"x"+(n.Device.size_depth_mm*t).toFixed(1)+" "+dict.Inches+"); "+f+" / "+e+"<\/span>"+r)}function formatDate(n){return n.toLocaleDateString()}function deviceHasOrientation(n,t){for(var u=arrDevices.length,i,r=0;r<u;r++)if(i=arrDevices[r].Device,i.id===n)switch(t){case enumOrientation.Front:return i.has_front_image?!0:!1;case enumOrientation.Back:return i.has_back_image?!0:!1;case enumOrientation.Bottom:return i.has_bottom_image?!0:!1;case enumOrientation.Left:return i.has_left_image?!0:!1;case enumOrientation.Right:return i.has_right_image?!0:!1;case enumOrientation.Top:return i.has_top_image?!0:!1}}function getImageDefaultSizes(n,t){for(var et=arrDevices.length,i=0,k=.3527778,s=0,r=0,h=0,p=0,c=0,l=0,d,b,tt,it,rt,ut,ft,w=0;w<et;w++)arrDevices[w].Device.id===n&&(i=w);var e=0,o=0,y=parseInt($("#selectSide").val(),10);t!==null&&(y=t);switch(y){case enumOrientation.Front:o=arrDevices[i].Device.front_protrusion_width;e=arrDevices[i].Device.front_protrusion_height;break;case enumOrientation.Back:o=arrDevices[i].Device.back_protrusion_width;e=arrDevices[i].Device.back_protrusion_height;break;case enumOrientation.Bottom:o=arrDevices[i].Device.bottom_protrusion_width;e=arrDevices[i].Device.bottom_protrusion_height;break;case enumOrientation.Left:o=arrDevices[i].Device.left_protrusion_width;e=arrDevices[i].Device.left_protrusion_height;break;case enumOrientation.Right:o=arrDevices[i].Device.right_protrusion_width;e=arrDevices[i].Device.right_protrusion_height;break;case enumOrientation.Top:o=arrDevices[i].Devicetop_protrusion_width;e=arrDevices[i].Device.top_protrusion_height}if(b=arrDevices[i].Device,gDisplayDeviceInItsDefaultOrientation&&(tabletOrientation=b.device_default_orientation),b.device_type_id===enumDeviceType.Tablet)switch(tabletOrientation){case enumTabletOrientaiton.Portrait:b.device_default_orientation===enumTabletOrientaiton.Landscape&&(d=o,o=e,e=d);break;case enumTabletOrientaiton.Landscape:b.device_default_orientation===enumTabletOrientaiton.Portrait&&(d=o,o=e,e=d)}var nt=o*k*PHONE_SIZE_MULTIPLIER,ot=e*k*PHONE_SIZE_MULTIPLIER,st=nt;p=parseFloat(arrDevices[i].Device.size_width_mm,10);c=parseFloat(arrDevices[i].Device.size_height_mm,10);l=parseFloat(arrDevices[i].Device.size_depth_mm,10);r=arrDevices[i].Device.device_type_id===enumDeviceType.Tablet&&tabletOrientation===enumTabletOrientaiton.Portrait&&arrDevices[i].Device.device_default_orientation===enumTabletOrientaiton.Landscape?Math.ceil(p/k*PHONE_SIZE_MULTIPLIER)+nt:Math.ceil(c/k*PHONE_SIZE_MULTIPLIER)+ot;var g,u=0,f=0,a=0,v=0;switch(y){case enumOrientation.Back:case enumOrientation.Front:y===enumOrientation.Back&&arrDevices[i].Device.image_back_size!==null?(u=parseInt(arrDevices[i].Device.image_back_size.split(",")[1],10),f=parseInt(arrDevices[i].Device.image_back_size.split(",")[0],10)):(u=parseInt(arrDevices[i].Device.image_front_size.split(",")[1],10),f=parseInt(arrDevices[i].Device.image_front_size.split(",")[0],10));arrDevices[i].Device.device_type_id===enumDeviceType.Tablet&&tabletOrientation===enumTabletOrientaiton.Portrait&&arrDevices[i].Device.device_default_orientation===enumTabletOrientaiton.Landscape&&(g=u,u=f,f=g);arrDevices[i].Device.device_type_id===enumDeviceType.Tablet&&tabletOrientation===enumTabletOrientaiton.Landscape&&arrDevices[i].Device.device_default_orientation===enumTabletOrientaiton.Portrait&&(g=u,u=f,f=g);v=u/f;arrDevices[i].Device.device_type_id===enumDeviceType.Tablet&&tabletOrientation===enumTabletOrientaiton.Landscape&&arrDevices[i].Device.device_default_orientation===enumTabletOrientaiton.Portrait&&(v=f/u);break;case enumOrientation.Left:arrDevices[i].Device.image_left_size!==null&&(u=parseInt(arrDevices[i].Device.image_left_size.split(",")[1],10),a=parseInt(arrDevices[i].Device.image_left_size.split(",")[0],10));v=u/a;break;case enumOrientation.Right:arrDevices[i].Device.image_right_size!==null&&(u=parseInt(arrDevices[i].Device.image_right_size.split(",")[1],10),a=parseInt(arrDevices[i].Device.image_right_size.split(",")[0],10));v=u/a;break;case enumOrientation.Top:arrDevices[i].Device.image_top_size!==null&&(a=parseInt(arrDevices[i].Device.image_top_size.split(",")[1],10),f=parseInt(arrDevices[i].Device.image_top_size.split(",")[0],10));v=a/f;break;case enumOrientation.Bottom:arrDevices[i].Device.image_bottom_size!==null&&(a=parseInt(arrDevices[i].Device.image_bottom_size.split(",")[1],10),f=parseInt(arrDevices[i].Device.image_bottom_size.split(",")[0],10));v=a/f}h=r/v;s=r/v;switch(y){case enumOrientation.Left:return isNaN(h)||h===null?(tt=r/c,[l*tt,r,l,c]):[h,r,l,c];case enumOrientation.Right:return isNaN(h)||h===null?(it=r/c,[l*it,r,l,c]):[h,r,l,c];case enumOrientation.Top:return[s,h,p,l];case enumOrientation.Bottom:return[s,h,p,l]}return y===enumOrientation.Front&&arrDevices[i].Device.front_has_other_orientation&&arrDevices[i].Device.device_type_id===enumDeviceType.Tablet&&arrDevices[i].Device.device_default_orientation!==tabletOrientation?(rt=s,s=r,r=rt):y===enumOrientation.Back&&arrDevices[i].Device.back_has_other_orientation&&arrDevices[i].Device.device_type_id===enumDeviceType.Tablet&&arrDevices[i].Device.device_default_orientation!==tabletOrientation&&(ut=s,s=r,r=ut),arrDevices[i].Device.device_type_id===enumDeviceType.Tablet&&tabletOrientation===enumTabletOrientaiton.Portrait&&arrDevices[i].Device.device_default_orientation===enumTabletOrientaiton.Landscape&&(ft=s,s=r,r=ft),[s,r,p,c]}function removeObject(n){switch(n){case"credit_card":$(".obj-credit").remove()}}function addObject(n){var t,i,r=.3527778;switch(n){case"credit_card":if($(".obj-credit").length>0)return!1;i=Math.ceil(85.6/r*PHONE_SIZE_MULTIPLIER);t=Math.ceil(53.98/r*PHONE_SIZE_MULTIPLIER);$(".content").append("<img class='obj-credit' src='/Content/images/credit_card.png' style='width:"+i+"em; height:"+t+"em;' alt='' />");$(".obj-credit").pep({startPos:{left:0,top:0},start:function(){onCreditCardClick()}})}}function addReflection(){try{if($("#cb-overlay").prop("checked"))return $(".scrolling-wrapper .reflection").remove(),!1;$(".scrolling-wrapper .reflection").show();$(".scrolling-wrapper .reflection").remove();$(".scrolling-wrapper .device img").each(function(){var n=$(this)[0].style.height,t=$(this)[0].style.width,i=$(this).width()+"px",r=$(this).height()+"px";$(this).after("<div class='reflection' style='background:url("+$(this).attr("src")+"); width:"+t+"; height:"+n+";'><\/div> ")})}catch(n){$(".scrolling-wrapper .reflection").remove()}}function drawDevices(){$(".content").html("");var n=1;$.each(arrDevices,function(t,i){var f=i.Device,l=i.Company,c=$(".content"),r=getImageDefaultSizes(i.Device.id,parseInt($("#selectSide").val(),10)),u=!1,h;if(gShowinWireframe===!0)u=!0;else switch($("#selectSide option:selected").val()){case"2":f.has_back_image||(u=!0);break;case"5":f.has_left_image||(u=!0);break;case"6":f.has_right_image||(u=!0)}var e="",o="",s="";u?(s="c"+n,o="style='width:"+r[0]+"em;height:"+r[1]+"em;'",n++,i.Device.device_type_id===2&&tabletOrientation!==i.Device.device_default_orientation):e=i.Device.device_type_id===2&&tabletOrientation!==i.Device.device_default_orientation?"<img style='width:"+r[0]+"em;height:"+r[1]+"em;' src='"+CDN_DEVICE_IMAGES_URL+"2/"+i.Device.id+"-"+$("#selectSide").val()+"-o.jpg' />":"<img style='width:"+r[0]+"em;height:"+r[1]+"em;' src='"+CDN_DEVICE_IMAGES_URL+"2/"+i.Device.id+"-"+$("#selectSide").val()+".jpg' />";h="<div data-selected='false' class='select'><span class='btn not-selected'>"+dict.Select+"<\/span<<\/div>";c.append("<div id='device-"+i.Device.id+"' class='device "+s+" ' "+o+">"+e+"<div class='device-name'>"+i.Company.name+"  "+i.Device.name+"<\/div><div title='"+dict.removeDevice+"' class='remove'>X<\/div>"+h+"<\/div>")});updateHash();updateScrollingArrows();updateSelectButtons();addReflection();$("#ddl-orderby").prop("selectedIndex",0)}function updateHash(){var n="";$.each(arrDevices,function(t,i){n+=i.Device.id+","});n=n.substring(0,n.length-1);arrDevices.length===0?history.pushState(null,null,location.pathname):history.pushState(null,null,"#"+n)}function isComparePage(){return window.location.href.indexOf("/compare/")>-1?!0:!1}function ajaxLoader(n){n==="show"?($(".spinner-wrapper").remove(),$(".scrolling-wrapper").prepend(loaderHtml)):$(".spinner-wrapper").remove()}function addDevice(n){if($("#device-"+n).length)return $(".info-content").html("<span class='alert-span'>"+dict.DeviceAlreadyAdded+"<\/span>"),!1;if(arrDevices.length>gMaxDevicesLimitInView)return $(".info-content").html("<span class='alert-span'>"+dict.MaximumDevices+"<\/span>"),!1;var t={id:n};ajaxLoader("show");$.ajax({type:"POST",url:"/WebServices/GetData.asmx/GetDevice",data:JSON.stringify(t),contentType:"application/json; charset=utf-8",dataType:"json",success:function(n){arrDevices.push(n.d);drawDevices();gIsOverlayedMode&&activateOverlayedMode();arrDevices.length>=2&&$(".btn-share").show();$("#cb-creditcard").prop("checked",!1);$(".alert-span").remove()}}).done(function(){ajaxLoader("hide")})}function initPage(){var i,n,t;initDeviceDropDownList();gSizeSlider=document.getElementById("slider-size");noUiSlider.create(gSizeSlider,{start:50,step:1,range:{min:0,max:100}});gSizeSlider.noUiSlider.on("update",function(){var n=gSizeSlider.noUiSlider.get();$(".content").css({fontSize:n/50});gIsOverlayedMode&&updateContainerSizeInOverlayMode();updateBackgroundImage();updateScrollingArrows()});isComparePage()&&window.location.hash.length>0&&(i=window.location.hash.replace("#",""),n=i.split(","),isArrayInCorrectFormat(n)?drawDeviceFromHash(n):(t=new URL(window.location),t.hash="",history.replaceState(null,null,t)))}function updateBackgroundImage(){return!1;var n,t,i}function isArrayInCorrectFormat(n){var t=!0;return $.each(n,function(n,i){if(isNaN(i))return t=!1,!1}),t}function drawDeviceFromHash(n){var t={ids:n};ajaxLoader("show");$.ajax({type:"POST",url:"/WebServices/GetData.asmx/GetDeviceByIds",data:JSON.stringify(t),contentType:"application/json; charset=utf-8",dataType:"json",success:function(n){n.d!==null&&(arrDevices=[],$.each(n.d,function(n,t){arrDevices.push(t)}),drawDevices(),arrDevices.length>=2&&$(".btn-share").show())}}).done(function(){ajaxLoader("hide")})}function canScrollDirection(n){var i=document.getElementsByClassName("device").length-1,t="";return n==="right"?(t=determineOverflow(document.getElementsByClassName("device")[i],document.getElementsByClassName("scrolling-wrapper")[0]),t==="right")?!0:!1:n==="left"?(t=determineOverflow(document.getElementsByClassName("device")[0],document.getElementsByClassName("scrolling-wrapper")[0]),t==="left")?!0:!1:void 0}function determineOverflow(n,t){var i=t.getBoundingClientRect(),r=Math.floor(i.right),u=Math.floor(i.left),f=n.getBoundingClientRect(),e=Math.floor(f.right),o=Math.floor(f.left);return u>o&&r<e?"both":o<u?"left":e>r?"right":"none"}function initDeviceDropDownList(){$("#selectDevice").select2({minimumInputLength:2,placeholder:dict.search,language:select2Language,ajax:{delay:200,dataType:"json",url:"/WebServices/GetData.asmx/SearchDevice",data:function(n){return{search:n.term}},processResults:function(n){return{results:n}}}})}var enumOrientation={Front:1,Back:2,Top:3,Bottom:4,Left:5,Right:6,SideLeft:7,SideRight:8},enumDeviceType={MobilePhone:1,Tablet:2},enumObjectsDimensions={CreditCard:[458,306],Battery:[76,290],PokerCard:[362,504],SdCard:[224,300]},loaderHtml='<div class="spinner-wrapper"><div class="spinner"><span class="fragment"><\/span><span class="fragment"><\/span><span class="fragment"><\/span>'+dict.Loading+"<\/div><\/div>",gMaxDevicesLimitInView=8,gSizeSlider,gIsOverlayedMode=!1,gShowinWireframe=!1,enumTabletOrientaiton={Landscape:2,Portrait:1},shareModal,CDN_DEVICE_IMAGES_URL="https://s3.amazonaws.com/mobiledevicesize/images/devices/",tabletOrientation=2,gDisplayDeviceInItsDefaultOrientation=!0,arrDevices=[],arrSelectedDevices=[],PHONE_SIZE_MULTIPLIER=1,$credit_card_draggable;$(document).ready(function(){$(".scrolling-wrapper").on("contextmenu","img",function(){return!1});$(window).resize(function(){updateScrollingArrows()});initPage();$(document).on("change","#ddl-orderby",filterByChanged);$("#select-country-footer").on("change",function(){window.location.href=$(this).val()+"compare/"});$("#select-country-footer > option").each(function(){$(this).val()===window.location.pathname.replace("compare/","")&&$(this).remove()});$(document).on("click",".select .btn",deviceSelectButtonClicked);$("#selectDevice").on("select2:select",function(n){var t=n.params.data.id,i=n.params.data.text;addDevice(t)});$("#btn-expand").on("click",function(){$("#selection-bar").is(":visible")?($("#selection-bar").fadeOut(300),$("#btn-expand").removeClass("fi-arrows-compress"),$("#btn-expand").addClass("fi-arrows-expand"),$(".info-content").addClass("extra-margin-top")):($("#selection-bar").fadeIn(300),$("#btn-expand").removeClass("fi-arrows-expand"),$("#btn-expand").addClass("fi-arrows-compress"),$(".info-content").removeClass("extra-margin-top"))});$(document).on("click",".btn-share",btnShareButtonClicked);$(document).on("change","#selectSide",function(){drawDevices()});$(".scrolling-wrapper").scroll(function(){updateScrollingArrows()});$(".h-nav .left").on("click",function(){$(".scrolling-wrapper").animate({scrollLeft:$(".scrolling-wrapper").scrollLeft()-150},300)});$(".h-nav .right").on("click",function(){$(".scrolling-wrapper").animate({scrollLeft:$(".scrolling-wrapper").scrollLeft()+150},300)});$(document).on("click",".device",onDeviceClick);$(document).on("click",".obj-credit",onCreditCardClick);$(document).on("click",".remove",onRemoveDeviceClick);$("#cb-wireframe").on("change",function(){this.checked?(gShowinWireframe=!0,drawDevices(),gIsOverlayedMode&&activateOverlayedMode()):(gShowinWireframe=!1,drawDevices(),gIsOverlayedMode&&activateOverlayedMode())});$("#cb-creditcard").on("change",function(){this.checked?addObject("credit_card"):removeObject("credit_card")});$("#cb-overlay").on("change",function(){this.checked?(activateOverlayedMode(),$(".h-nav").hide(),addReflection()):(deactivateOverlayedMode(),addReflection(),updateScrollingArrows(),gShowinWireframe||$.each($(".device"),function(n,t){for(i=1;i<=gMaxDevicesLimitInView;i++)$(t).removeClass("c"+i)}))})})