瀑布流效果
1.HTML代码模板
1 <div class="wf-main" id="wf-main"> 2 <div class="wf-cld"><img src="images/1.jpg" /></div> 3 <div class="wf-cld"><img src="images/2.jpg" /></div> 4 <div class="wf-cld"><img src="images/3.jpg" /></div> 5 <div class="wf-cld"><img src="images/4.jpg" /></div> 6 <div class="wf-cld"><img src="images/5.jpg" /></div> 7 <div class="wf-cld"><img src="images/6.jpg" /></div> 8 <div class="wf-cld"><img src="images/7.jpg" /></div> 9 <div class="wf-cld"><img src="images/8.jpg" /></div> 10 <div class="wf-cld"><img src="images/9.jpg" /></div> 11 <div class="wf-cld"><img src="images/10.jpg" /></div> 12 <div class="wf-cld"><img src="images/11.jpg" /></div> 13 <div class="wf-cld"><img src="images/12.jpg" /></div> 14 <div class="wf-cld"><img src="images/9.jpg" /></div> 15 <div class="wf-cld"><img src="images/10.jpg" /></div> 16 <div class="wf-cld"><img src="images/11.jpg" /></div> 17 <div class="wf-cld"><img src="images/12.jpg" /></div> 18 <div class="wf-cld"><img src="images/10.jpg" /></div> 19 <div class="wf-cld"><img src="images/11.jpg" /></div> 20 <div class="wf-cld"><img src="images/12.jpg" /></div> 21 <div class="wf-cld"><img src="images/10.jpg" /></div> 22 <div class="wf-cld"><img src="images/11.jpg" /></div> 23 <div class="wf-cld"><img src="images/12.jpg" /></div> 24 </div>
2.css 模板
1 img{display:block;} 2 .wf-main{position: relative;width:1100px;overflow: hidden; float:right;} 3 .wf-main .wf-cld{ position: absolute;margin-bottom:10px;line-height:18px;width:238px;left: -9999px;top: -9999px;
border: 1px solid #ccc; 4 border-radius: 4px;overflow: hidden;} 5 .wf-cld .inner{ position: absolute;left: -9999px;top: -9999px;margin-bottom: 5px;width: 73px;overflow: hidden;
border: 1px solid #f00;border-radius: 3px;} 6 .wf-cld .title{margin: 0 0 5px;padding: 5px;width: 63px;color: #f00;font-size: 14px;}
3.js
1 function Waterfall(param){ 2 this.id = typeof param.container == 'string' ? document.getElementById(param.container) : param.container; 3 this.colWidth = param.colWidth; 4 this.colCount = param.colCount || 4; 5 this.cls = param.cls && param.cls != '' ? param.cls : 'wf-cld'; 6 this.init(); 7 } 8 Waterfall.prototype = { 9 getByClass:function(cls,p){ 10 var arr = [],reg = new RegExp("(^|\\s+)" + cls + "(\\s+|$)","g"); 11 var nodes = p.getElementsByTagName("*"),len = nodes.length; 12 for(var i = 0; i < len; i++){ 13 if(reg.test(nodes[i].className)){ 14 arr.push(nodes[i]); 15 reg.lastIndex = 0; 16 } 17 } 18 return arr; 19 }, 20 maxArr:function(arr){ 21 var len = arr.length,temp = arr[0]; 22 for(var ii= 1; ii < len; ii++){ 23 if(temp < arr[ii]){ 24 temp = arr[ii]; 25 } 26 } 27 return temp; 28 }, 29 getMar:function(node){ 30 var dis = 0; 31 if(node.currentStyle){ 32 dis = parseInt(node.currentStyle.marginBottom); 33 }else if(document.defaultView){ 34 dis = parseInt(document.defaultView.getComputedStyle(node,null).marginBottom); 35 } 36 return dis; 37 }, 38 getMinCol:function(arr){ 39 var ca = arr,cl = ca.length,temp = ca[0],minc = 0; 40 for(var ci = 0; ci < cl; ci++){ 41 if(temp > ca[ci]){ 42 temp = ca[ci]; 43 minc = ci; 44 } 45 } 46 return minc; 47 }, 48 init:function(){ 49 var _this = this; 50 var col = [],//列高 51 iArr = [];//索引 52 var nodes = _this.getByClass(_this.cls,_this.id),len = nodes.length; 53 for(var i = 0; i < _this.colCount; i++){ 54 col[i] = 0; 55 } 56 for(var i = 0; i < len; i++){ 57 nodes[i].h = nodes[i].offsetHeight + _this.getMar(nodes[i]); 58 iArr[i] = i; 59 } 60 61 for(var i = 0; i < len; i++){ 62 var ming = _this.getMinCol(col); 63 nodes[i].style.left = ming * _this.colWidth + "px"; 64 nodes[i].style.top = col[ming] + "px"; 65 col[ming] += nodes[i].h; 66 } 67 68 _this.id.style.height = _this.maxArr(col) + "px"; 69 } 70 }; 71 72 new Waterfall({ 73 "container":"wf-main", 74 "colWidth":256, 75 "colCount":4 76 }); 77 </script>
其中瀑布流展示效果的列数和列的宽度可以通过
colCount 和 colWidth 进行配置
引入库文件 show_ads.js
(function(){var n=this,aa=function(a,b,c){return a.call.apply(a.bind,arguments)},ba=function(a,b,c){if(!a)throw Error();if(2<arguments.length){var e=Array.prototype.slice.call(arguments,2);return function(){var c=Array.prototype.slice.call(arguments);Array.prototype.unshift.apply(c,e);return a.apply(b,c)}}return function(){return a.apply(b,arguments)}},q=function(a,b,c){q=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?aa:ba;return q.apply(null,arguments)},ca=function(a, b){var c=Array.prototype.slice.call(arguments,1);return function(){var b=c.slice();b.push.apply(b,arguments);return a.apply(this,b)}},da=Date.now||function(){return+new Date};var w=(new Date).getTime();var x=function(a){a=parseFloat(a);return isNaN(a)||1<a||0>a?0:a},ea=/^([\w-]+\.)*([\w-]{2,})(\:[0-9]+)?$/,fa=function(a,b){if(!a)return b;var c=a.match(ea);return c?c[0]:b};var ga=x("0.15"),ha=x("1.0"),ia=x("0.01"),ja=x("0.001"),ka=x("0.0"),la=x("0.001"),ma=x("0.001"),na=x("0.2"),oa=x("0.001");var pa=/^true$/.test("false")?!0:!1,qa=/^true$/.test("false")?!0:!1;var ra=function(){return fa("","pagead2.googlesyndication.com")};var sa=/&/g,ta=/</g,ua=/>/g,va=/"/g,wa=/'/g,y={"\x00":"\\0","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\x0B":"\\x0B",'"':'\\"',"\\":"\\\\"},z={"'":"\\'"};var B=document,C=window,D,xa=null,E=B.getElementsByTagName("script");E&&E.length&&(xa=E[E.length-1]);D=xa;var G=function(a,b){for(var c in a)Object.prototype.hasOwnProperty.call(a,c)&&b.call(null,a[c],c,a)},H=function(a){return!!a&&"function"==typeof a&&!!a.call},ya=function(a,b){if(!(2>arguments.length))for(var c=1,e=arguments.length;c<e;++c)a.push(arguments[c])};function za(a,b){I(a,"load",b)} var I=function(a,b,c,e){return a.addEventListener?(a.addEventListener(b,c,e||!1),!0):a.attachEvent?(a.attachEvent("on"+b,c),!0):!1},J=function(a,b,c,e){c=q(e,c);return I(a,b,c,void 0)?c:null},K=function(a,b,c){a.removeEventListener?a.removeEventListener(b,c,!1):a.detachEvent&&a.detachEvent("on"+b,c)},Aa=function(a){"google_onload_fired"in a||(a.google_onload_fired=!1,za(a,function(){a.google_onload_fired=!0}))},L=function(a,b){if(!(1E-4>Math.random())){var c=Math.random();if(c<b){try{var e=new Uint16Array(1); window.crypto.getRandomValues(e);c=e[0]/65536}catch(d){c=Math.random()}return a[Math.floor(c*a.length)]}}return null},M=function(a){a=a.google_unique_id;return"number"==typeof a?a:0},Ba=function(a){var b=a.length;if(0==b)return 0;for(var c=305419896,e=0;e<b;e++)c^=(c<<5)+(c>>2)+a.charCodeAt(e)&4294967295;return 0<c?c:4294967296+c},Ca=function(a){for(var b=[],c=0;a&&25>c;++c){var e=9!=a.nodeType&&a.id,e=e?"/"+e:"",d;o:{var f=a.parentElement;d=a.nodeName.toLowerCase();if(f)for(var f=f.childNodes,g= 0,p=0;p<f.length;++p){var h=f[p];if(h.nodeName&&h.nodeName.toLowerCase()==d){if(a==h){d="."+g;break o}++g}}d=""}b.push((a.nodeName&&a.nodeName.toLowerCase())+e+d);a=a.parentElement}return b.join()},Da=function(){var a=C,b=[];if(a)try{for(var c=a.parent,e=0;c&&c!=a&&25>e;++e){for(var d=c.frames,f=0;f<d.length;++f)if(a==d[f]){b.push(f);break}a=c;c=a.parent}}catch(g){}return b.join()},Ea=function(a,b,c){b=[b.google_ad_slot,b.google_ad_format,b.google_ad_type,b.google_ad_width,b.google_ad_height];if(c){c= [];for(var e=0;a&&25>e;a=a.parentNode,++e)c.push(9!=a.nodeType&&a.id||"");(a=c.join())&&b.push(a)}else b.push(Ca(a)),b.push(Da());return Ba(b.join(":")).toString()},N=function(a){try{return!!a.location.href||""===a.location.href}catch(b){return!1}};var Fa=!!window.google_async_iframe_id,Ga=/MSIE [2-7]|PlayStation|Gecko\/20090226|Android 2\.|Opera/i,Ha=/Android/;var O=null,Ia=function(){if(!O){for(var a=window,b=a,c=0;a!=a.parent;)if(a=a.parent,c++,N(a))b=a;else break;O=b}return O};var P=function(a,b,c){c||(c=qa?"https":"http");return[c,"://",a,b].join("")};var Ja=function(){},La=function(a,b,c){switch(typeof b){case "string":Ka(b,c);break;case "number":c.push(isFinite(b)&&!isNaN(b)?b:"null");break;case "boolean":c.push(b);break;case "undefined":c.push("null");break;case "object":if(null==b){c.push("null");break}if(b instanceof Array){var e=b.length;c.push("[");for(var d="",f=0;f<e;f++)c.push(d),La(a,b[f],c),d=",";c.push("]");break}c.push("{");e="";for(d in b)b.hasOwnProperty(d)&&(f=b[d],"function"!=typeof f&&(c.push(e),Ka(d,c),c.push(":"),La(a,f,c), e=","));c.push("}");break;case "function":break;default:throw Error("Unknown type: "+typeof b);}},Ma={'"':'\\"',"\\":"\\\\","/":"\\/","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\x0B":"\\u000b"},Na=/\uffff/.test("\uffff")?/[\\\"\x00-\x1f\x7f-\uffff]/g:/[\\\"\x00-\x1f\x7f-\xff]/g,Ka=function(a,b){b.push('"');b.push(a.replace(Na,function(a){if(a in Ma)return Ma[a];var b=a.charCodeAt(0),d="\\u";16>b?d+="000":256>b?d+="00":4096>b&&(d+="0");return Ma[a]=d+b.toString(16)}));b.push('"')};var Q="google_ad_block google_ad_channel google_ad_client google_ad_format google_ad_height google_ad_host google_ad_host_channel google_ad_host_tier_id google_ad_output google_ad_override google_ad_region google_ad_section google_ad_slot google_ad_type google_ad_unit_key google_ad_unit_key_2 google_ad_width google_adtest google_allow_expandable_ads google_alternate_ad_url google_alternate_color google_analytics_domain_name google_analytics_uacct google_bid google_captcha_token google_city google_color_bg google_color_border google_color_line google_color_link google_color_text google_color_url google_container_id google_contents google_country google_cpm google_ctr_threshold google_cust_age google_cust_ch google_cust_criteria google_cust_gender google_cust_id google_cust_interests google_cust_job google_cust_l google_cust_lh google_cust_u_url google_disable_video_autoplay google_ed google_eids google_enable_ose google_enable_ose_periscope google_encoding google_floating_ad_position google_font_face google_font_size google_frame_id google_gl google_hints google_image_size google_kw google_kw_type google_lact google_language google_loeid google_max_num_ads google_max_radlink_len google_mtl google_num_content_recommendations google_num_radlinks google_num_radlinks_per_unit google_only_ads_with_video google_only_pyv_ads google_only_userchoice_ads google_override_format google_page_url google_previous_watch google_previous_searches google_referrer_url google_region google_reuse_colors google_rl_dest_url google_rl_filtering google_rl_mode google_rt google_safe google_sc_id google_scs google_sui google_skip google_tag_for_child_directed_treatment google_tag_info google_targeting google_tdsma google_tfs google_tl google_ui_features google_ui_version google_video_doc_id google_video_product_type google_video_url_to_fetch google_with_pyv_ads google_yt_pt google_yt_up".split(" "), Oa={google_analytics_domain_name:!0,google_analytics_uacct:!0},Pa=function(a){a.google_page_url&&(a.google_page_url=String(a.google_page_url));var b=[];G(a,function(a,e){if(null!=a){var d;try{var f=[];La(new Ja,a,f);d=f.join("")}catch(g){}d&&ya(b,e,"=",d,";")}});return b.join("")};var Qa=/\.((google(|groups|mail|images|print))|gmail)\./,Ra=function(a){try{var b=Qa.test(a.location.host);return!(!a.postMessage||!a.localStorage||!a.JSON||b)}catch(c){return!1}};var R=function(a){this.b=a;a.google_iframe_oncopy||(a.google_iframe_oncopy={handlers:{},upd:q(this.o,this)});this.m=a.google_iframe_oncopy},Sa;var S="var i=this.id,s=window.google_iframe_oncopy,H=s&&s.handlers,h=H&&H[i],w=this.contentWindow,d;try{d=w.document}catch(e){}if(h&&d&&(!d.body||!d.body.firstChild)){if(h.call){setTimeout(h,0)}else if(h.match){try{h=s.upd(h,i)}catch(e){}w.location.replace(h)}}"; /[&<>"']/.test(S)&&(-1!=S.indexOf("&")&&(S=S.replace(sa,"&")),-1!=S.indexOf("<")&&(S=S.replace(ta,"<")),-1!=S.indexOf(">")&&(S=S.replace(ua,">")),-1!=S.indexOf('"')&&(S=S.replace(va,""")),-1!=S.indexOf("'")&&(S=S.replace(wa,"'")));Sa=S;R.prototype.set=function(a,b){this.m.handlers[a]=b;this.b.addEventListener&&this.b.addEventListener("load",q(this.n,this,a),!1)}; R.prototype.n=function(a){a=this.b.document.getElementById(a);try{var b=a.contentWindow.document;if(a.onload&&b&&(!b.body||!b.body.firstChild))a.onload()}catch(c){}};R.prototype.o=function(a,b){var c=Ta("rx",a),e;o:{if(a&&(e=a.match("dt=([^&]+)"))&&2==e.length){e=e[1];break o}e=""}e=(new Date).getTime()-e;c=c.replace(/&dtd=(\d+|M)/,"&dtd="+(1E4>e?e+"":"M"));this.set(b,c);return c};var Ta=function(a,b){var c=RegExp("\\b"+a+"=(\\d+)"),e=c.exec(b);e&&(b=b.replace(c,a+"="+(+e[1]+1||1)));return b};var T,U,V,Ua,Va=function(){return n.navigator?n.navigator.userAgent:null};Ua=V=U=T=!1;var W;if(W=Va()){var Wa=n.navigator;T=0==W.lastIndexOf("Opera",0);U=!T&&(-1!=W.indexOf("MSIE")||-1!=W.indexOf("Trident"));V=!T&&-1!=W.indexOf("WebKit");Ua=!T&&!V&&!U&&"Gecko"==Wa.product}var Xa=U,Ya=Ua,Za=V;var X;if(T&&n.opera){var $a=n.opera.version;"function"==typeof $a&&$a()}else Ya?X=/rv\:([^\);]+)(\)|;)/:Xa?X=/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/:Za&&(X=/WebKit\/(\S+)/),X&&X.exec(Va());var ab=!0,bb={},db=function(a,b,c,e){var d,f=ab;try{d=c()}catch(g){try{var p,h=g.toString();g.name&&-1==h.indexOf(g.name)&&(h+=": "+g.name);g.message&&-1==h.indexOf(g.message)&&(h+=": "+g.message);if(g.stack){var k=g.stack;c=h;try{-1==k.indexOf(c)&&(k=c+"\n"+k);for(var m;k!=m;)m=k,k=k.replace(/((https?:\/..*\/)[^\/:]*:\d+(?:.|\n)*)\2/,"$1");h=k.replace(/\n */g,"\n")}catch(l){h=c}}p=h;h="";g.fileName&&(h=g.fileName);k=-1;g.lineNumber&&(k=g.lineNumber);var r;o:{try{r=e?e():"";break o}catch(F){}r=""}f= b(a,p,h,k,r)}catch(t){cb({context:"protectAndRun",msg:t.toString()+"\n"+(t.stack||"")})}if(!f)throw g;}return d},fb=function(a,b,c,e,d){a={context:a,msg:b.substring(0,512),eid:d&&d.substring(0,40),file:c,line:e.toString(),url:B.URL.substring(0,512),ref:B.referrer.substring(0,512)};eb(a);cb(a);return ab},cb=function(a){if(0.01>Math.random()){a="/pagead/gen_204?id=jserror"+gb(a);a="http"+("https:"==C.location.protocol?"s":"")+"://pagead2.googlesyndication.com"+a;a=a.substring(0,2E3);C.google_image_requests|| (C.google_image_requests=[]);var b=C.document.createElement("img");b.src=a;C.google_image_requests.push(b)}},eb=function(a){var b=a||{};G(bb,function(a,e){b[e]=C[a]})},hb=function(a,b){return ca(db,a,fb,b,void 0)},gb=function(a){var b="";G(a,function(a,e){if(0===a||a)b+="&"+e+"="+("function"==typeof encodeURIComponent?encodeURIComponent(a):escape(a))});return b};var Y,Z=function(a){this.c=[];this.b=a||window;this.a=0;this.d=null;this.e=0},ib=function(a,b){this.l=a;this.win=b};Z.prototype.q=function(a,b){0!=this.a||0!=this.c.length||b&&b!=window?this.h(a,b):(this.a=2,this.g(new ib(a,window)))};Z.prototype.h=function(a,b){this.c.push(new ib(a,b||this.b));jb(this)};Z.prototype.r=function(a){this.a=1;if(a){var b=hb("sjr::timeout",q(this.f,this,!0));this.d=this.b.setTimeout(b,a)}}; Z.prototype.f=function(a){a&&++this.e;1==this.a&&(null!=this.d&&(this.b.clearTimeout(this.d),this.d=null),this.a=0);jb(this)};Z.prototype.s=function(){return!(!window||!Array)};Z.prototype.t=function(){return this.e};Z.prototype.nq=Z.prototype.q;Z.prototype.nqa=Z.prototype.h;Z.prototype.al=Z.prototype.r;Z.prototype.rl=Z.prototype.f;Z.prototype.sz=Z.prototype.s;Z.prototype.tc=Z.prototype.t;var jb=function(a){var b=hb("sjr::tryrun",q(a.p,a));a.b.setTimeout(b,0)}; Z.prototype.p=function(){if(0==this.a&&this.c.length){var a=this.c.shift();this.a=2;var b=hb("sjr::run",q(this.g,this,a));a.win.setTimeout(b,0);jb(this)}};Z.prototype.g=function(a){this.a=0;a.l()}; var kb=function(a){try{return a.sz()}catch(b){return!1}},lb=function(a){return!!a&&("object"==typeof a||"function"==typeof a)&&kb(a)&&H(a.nq)&&H(a.nqa)&&H(a.al)&&H(a.rl)},mb=function(){if(Y&&kb(Y))return Y;var a=Ia(),b=a.google_jobrunner;return lb(b)?Y=b:a.google_jobrunner=Y=new Z(a)},nb=function(a,b){mb().nq(a,b)},ob=function(a,b){mb().nqa(a,b)};var pb={"120x90":!0,"160x90":!0,"180x90":!0,"200x90":!0,"468x15":!0,"728x15":!0},qb=function(){var a="script";return["<",a,' src="',P(ra(),"/pagead/js/r20140306/r20140311/show_ads_impl.js",""),'"></',a,">"].join("")},rb=function(a,b,c,e){return function(){var d=!1;e&&mb().al(3E4);var f=a.document.getElementById(b);f&&!N(f.contentWindow)&&3==a.google_top_js_status&& (a.google_top_js_status=6);try{if(N(a.document.getElementById(b).contentWindow)){var g=a.document.getElementById(b).contentWindow,p=g.document;p.body&&p.body.firstChild||(p.open(),g.google_async_iframe_close=!0,p.write(c))}else{var h=a.document.getElementById(b).contentWindow,k;f=c;f=String(f);if(f.quote)k=f.quote();else{g=['"'];for(p=0;p<f.length;p++){var m=f.charAt(p),l=m.charCodeAt(0),r=g,F=p+1,t;if(!(t=y[m])){var u;if(31<l&&127>l)u=m;else{var s=m;if(s in z)u=z[s];else if(s in y)u=z[s]=y[s];else{var v= s,A=s.charCodeAt(0);if(31<A&&127>A)v=s;else{if(256>A){if(v="\\x",16>A||256<A)v+="0"}else v="\\u",4096>A&&(v+="0");v+=A.toString(16).toUpperCase()}u=z[s]=v}}t=u}r[F]=t}g.push('"');k=g.join("")}h.location.replace("javascript:"+k)}d=!0}catch(Bb){h=Ia().google_jobrunner,lb(h)&&h.rl()}d&&(d=Ta("google_async_rrc",c),(new R(a)).set(b,rb(a,b,d,!1)))}},sb=function(a){var b=["<iframe"];G(a,function(a,e){null!=a&&b.push(" "+e+'="'+a+'"')});b.push("></iframe>");return b.join("")},tb=function(a,b,c,e){e=e?'"': "";var d=e+"0"+e;a.width=e+b+e;a.height=e+c+e;a.frameborder=d;a.marginwidth=d;a.marginheight=d;a.vspace=d;a.hspace=d;a.allowtransparency=e+"true"+e;a.scrolling=e+"no"+e},ub=function(a,b,c){var e=b.google_ad_output,d=b.google_ad_format;d||"html"!=e&&null!=e||(d=b.google_ad_width+"x"+b.google_ad_height,c&&(d+="_as"));c=!b.google_ad_slot||b.google_override_format||!pb[b.google_ad_width+"x"+b.google_ad_height]&&"aa"==b.google_loader_used;d=d&&c?d.toLowerCase():"";b.google_ad_format=d;b.google_ad_unit_key= Ea(D.parentElement,b,!0);a=a.google_adk2_experiment=a.google_adk2_experiment||L(["C","E"],la)||"N";"E"==a?b.google_ad_unit_key_2=Ea(D,b):"C"==a&&(b.google_ad_unit_key_2="ctrl")},vb=Math.floor(1E6*Math.random()),wb=function(a){for(var b=a.data.split("\n"),c={},e=0;e<b.length;e++){var d=b[e].indexOf("=");-1!=d&&(c[b[e].substr(0,d)]=b[e].substr(d+1))}b=c[3];if(c[1]==vb&&(window.google_top_js_status=4,a.source==top&&0==b.indexOf(a.origin)&&(window.google_top_values=c,window.google_top_js_status=5),window.google_top_js_callbacks)){for(a= 0;a<window.google_top_js_callbacks.length;a++)window.google_top_js_callbacks[a]();window.google_top_js_callbacks.length=0}};var xb=function(a,b,c){this.x=a;this.y=b;this.z=c},yb=function(a,b,c){this.beta=a;this.gamma=b;this.alpha=c},zb=function(a,b){this.deviceAccelerationWithGravity=this.deviceAccelerationWithoutGravity=null;this.deviceMotionEventCallbacks=[];this.deviceOrientation=null;this.deviceOrientationEventCallbacks=[];this.isDeviceOrientationEventListenerRegistered=this.isDeviceMotionEventListenerRegistered=this.didDeviceOrientationCallbacksTimeoutExpire=this.didDeviceMotionCallbacksTimeoutExpire=!1;this.registeredMozOrientationEventListener= this.registeredDeviceOrientationEventListener=this.registeredDeviceMotionEventListener=null;this.sensorsExperiment=b;this.stopTimeStamp=this.startTimeStamp=null;this.win=a},$=function(a){this.a=a;this.a.win.DeviceOrientationEvent?(this.a.registeredDeviceOrientationEventListener=J(this.a.win,"deviceorientation",this,this.j),this.a.isDeviceOrientationEventListenerRegistered=!0):this.a.win.OrientationEvent&&(this.a.registeredMozOrientationEventListener=J(this.a.win,"MozOrientation",this,this.k),this.a.isDeviceOrientationEventListenerRegistered= !0);this.a.win.DeviceMotionEvent&&(this.a.registeredDeviceMotionEventListener=J(this.a.win,"devicemotion",this,this.i),this.a.isDeviceMotionEventListenerRegistered=!0)}; $.prototype.i=function(a){a.acceleration&&(this.a.deviceAccelerationWithoutGravity=new xb(a.acceleration.x,a.acceleration.y,a.acceleration.z));a.accelerationIncludingGravity&&(this.a.deviceAccelerationWithGravity=new xb(a.accelerationIncludingGravity.x,a.accelerationIncludingGravity.y,a.accelerationIncludingGravity.z));Ab(this.a.deviceMotionEventCallbacks);K(this.a.win,"devicemotion",this.a.registeredDeviceMotionEventListener)}; $.prototype.j=function(a){this.a.deviceOrientation=new yb(a.beta,a.gamma,a.alpha);Ab(this.a.deviceOrientationEventCallbacks);K(this.a.win,"deviceorientation",this.a.registeredDeviceOrientationEventListener)};$.prototype.k=function(a){this.a.deviceOrientation=new yb(-90*a.y,90*a.x,null);Ab(this.a.deviceOrientationEventCallbacks);K(this.a.win,"MozOrientation",this.a.registeredMozOrientationEventListener)};var Ab=function(a){for(var b=0;b<a.length;++b)a[b]();a.length=0};ab=!pa;bb={client:"google_ad_client",format:"google_ad_format",slotname:"google_ad_slot",output:"google_ad_output",ad_type:"google_ad_type",async_oa:"google_async_for_oa_experiment",zrtm:"google_ad_handling_mode",dimpr:"google_always_use_delayed_impressions_experiment",peri:"google_top_experiment"};db("sa::main",fb,function(){var a=window;Aa(a);if(!window.google_top_experiment&&!window.google_top_js_status){var b=window;if(2!==(b.top==b?0:N(b.top)?1:2))window.google_top_js_status=0;else if(top.postMessage){var c;try{c=C.top.frames.google_top_static_frame?!0:!1}catch(e){c=!1}if(c){if(window.google_top_experiment=L(["jp_c","jp_zl","jp_wfpmr","jp_zlt","jp_wnt"],ga),"jp_c"!==window.google_top_experiment){I(window,"message",wb);window.google_top_js_status=3;b={0:"google_loc_request",1:vb};c=[];for(var d in b)c.push(d+ "="+b[d]);top.postMessage(c.join("\n"),"*")}}else window.google_top_js_status=2}else window.google_top_js_status=1}var f;f=f||window;d=!1;f&&f.navigator&&f.navigator.userAgent&&(f=f.navigator.userAgent,d=0!=f.indexOf("Opera")&&-1!=f.indexOf("WebKit")&&-1!=f.indexOf("Mobile"));!d||/Android/.test(a.navigator.userAgent)||0!=M(a)||a.google_sensors||(f=null,a.google_top_experiment&&"jp_c"!=a.google_top_experiment||(f=L(["ds_c","ds_zl","ds_wfea"],ka)),f&&(a.google_sensors=new zb(a,f),"ds_c"!=f&&new $(a.google_sensors))); f=window.google_ad_output;void 0!==window.google_always_use_delayed_impressions_experiment||f&&"html"!=f||(window.google_always_use_delayed_impressions_experiment=L(["C","E"],ja));if(Fa?1==M(a):!M(a)){o:if(f=a.google_ad_client,d=navigator,a&&f&&d){try{var g=Ba([f,d.plugins&&d.plugins.length,a.screen&&a.screen.height,(new Date).getTimezoneOffset(),d.userAgent].join())}catch(p){break o}g/=4294967296;g<oa&&(d=["1h","12h","24h"],d=d[Math.floor(g/oa*d.length)],a.google_per_pub_requested=da(),a.google_per_pub_branch= d,b=a.document,g=b.createElement("script"),g.src=P(ra(),"/pagead/js/per_pub_"+d+".js?client="+f),f=b.getElementsByTagName("script")[0],f.parentNode.insertBefore(g,f))}if(g=L(["C","1","5"],ma))a.google_sra_delay_branch=g}(g=!1===window.google_enable_async)||(g=navigator.userAgent,Ga.test(g)?g=!1:(void 0!==window.google_async_for_oa_experiment||!Ha.test(navigator.userAgent)||Ga.test(navigator.userAgent)||(window.google_async_for_oa_experiment=L(["E","C"],ia)),g=Ha.test(g)?"E"===window.google_async_for_oa_experiment: !0),g=!g||window.google_container_id||window.google_ad_output&&"html"!=window.google_ad_output);if(g)a.google_loader_used="sb",a.google_start_time=w,ub(a,a),document.write(qb());else{a.google_unique_id?++a.google_unique_id:a.google_unique_id=1;g={};f=0;for(d=Q.length;f<d;f++)b=Q[f],null!=a[b]&&(g[b]=a[b]);g.google_loader_used="sa";f=0;for(d=Q.length;f<d;f++)b=Q[f],Oa[b]||(a[b]=null);f=g.google_ad_width;d=g.google_ad_height;b={};tb(b,f,d,!0);b.onload='"'+Sa+'"';var h;c=a.document;for(var k=b.id,m= 0;!k||c.getElementById(k);)k="aswift_"+m++;b.id=k;b.name=k;var m=g.google_ad_width,l=g.google_ad_height,k=["<iframe"];for(h in b)b.hasOwnProperty(h)&&ya(k,h+"="+b[h]);k.push('style="left:0;position:absolute;top:0;"');k.push("></iframe>");h="border:none;height:"+l+"px;margin:0;padding:0;position:relative;visibility:visible;width:"+m+"px;background-color:transparent";c.write(['<ins style="display:inline-table;',h,'"><ins id="',b.id+"_anchor",'" style="display:block;',h,'">',k.join(" "),"</ins></ins>"].join("")); h=b.id;b=g.google_override_format||!pb[g.google_ad_width+"x"+g.google_ad_height]&&"aa"==g.google_loader_used?L(["c","e"],na):null;ub(a,g,"e"==b);c=Pa(g);k=Ra(a);m=a.document;m=3==({visible:1,hidden:2,prerender:3,preview:4}[m.webkitVisibilityState||m.mozVisibilityState||m.visibilityState||""]||0);!k||m||void 0!==a.google_ad_handling_mode||a.google_async_for_oa_experiment||(a.google_ad_handling_mode=L(["EI"],ha));k=a.google_ad_handling_mode?String(a.google_ad_handling_mode):null;if(Ra(a)&&1==a.google_unique_id){var m= "zrt_ads_frame"+a.google_unique_id,r,l=g.google_page_url;if(!l){e:{l=a.document;r=f||a.google_ad_width;var F=d||a.google_ad_height;if(a.top==a)l=!1;else{var t=l.documentElement;if(r&&F){var u=1,s=1;a.innerHeight?(u=a.innerWidth,s=a.innerHeight):t&&t.clientHeight?(u=t.clientWidth,s=t.clientHeight):l.body&&(u=l.body.clientWidth,s=l.body.clientHeight);if(s>2*F||u>2*r){l=!1;break e}}l=!0}}l=l?a.document.referrer:a.document.URL}r=encodeURIComponent(l);l=null;"EI"==k&&(l="I-"+(r+"/"+g.google_ad_unit_key+ "/"+a.google_unique_id));g={};tb(g,f,d,!1);g.style="display:none";f=l;g.id=m;g.name=m;f=P(fa("","googleads.g.doubleclick.net"),["/pagead/html/r20140306/r20140311/zrt_lookup.html",f?"#"+encodeURIComponent(f):""].join(""));g.src=f;g=sb(g)}else g=null;f=(new Date).getTime();d=a.google_top_experiment;m=a.google_async_for_oa_experiment;l=a.google_always_use_delayed_impressions_experiment;r=a.google_sra_delay_branch; g=["<!doctype html><html><body>",g,"<script>",c,"google_show_ads_impl=true;google_unique_id=",a.google_unique_id,';google_async_iframe_id="',h,'";google_start_time=',w,";",d?'google_top_experiment="'+d+'";':"",k?'google_ad_handling_mode="'+k+'";':"",m?'google_async_for_oa_experiment="'+m+'";':"",l?'google_always_use_delayed_impressions_experiment="'+l+'";':"",r?'google_sra_delay_branch="'+r+'";':"",b?'google_append_as_for_format_override="'+b+'";':"","google_bpp=",f>w?f-w:1,";google_async_rrc=0;\x3c/script>", qb(),"</body></html>"].join("");(a.document.getElementById(h)?nb:ob)(rb(a,h,g,!0))}});})();