var page={isWidthScroll:false,isHeightScroll:false,windowWidth:0,windowHeight:0,documentWidth:0,documentHeight:0,currentX:0,currentY:0,scrollBarWidth:16,iframe:null,setVars:function(){page.isWidthScroll=page.checkWidthScroll();page.isHeightScroll=page.checkHeightScroll();page.windowWidth=window.innerWidth+(page.isWidthScroll?-16:0);page.documentWidth=document.width;page.documentHeight=document.height;page.windowHeight=window.innerHeight+(page.isHeightScroll?-16:0);page.currentX=0;page.currentY=0;if(document.location.hostname=="mail.google.com"){page.iframe=document.getElementById("canvas_frame");page.windowHeight=page.iframe.clientHeight;page.windowWidth=page.iframe.contentDocument.width;page.documentHeight=page.iframe.contentDocument.height;page.documentWidth=page.iframe.contentDocument.width}},scrollToCurrent:function(){if(document.location.hostname=="mail.google.com"){page.iframe.contentDocument.body.scrollTop=page.currentY;page.iframe.contentDocument.body.scrollLeft=page.currentX}else{document.body.scrollTop=page.currentY;document.body.scrollLeft=page.currentX}},computeNextScreen:function(){if(page.currentX+page.windowWidth-16<page.documentWidth){page.currentX+=page.windowWidth-16;return true}else{page.currentX=0;if(page.currentY+page.windowHeight-16>=page.documentHeight){return false}else{page.currentY+=page.windowHeight-16;return true}}},checkWidthScroll:function(){return(document.body.clientWidth<document.body.scrollWidth)},checkHeightScroll:function(){return(document.body.clientHeight<document.body.scrollHeight)},fixedElements_:[],enableFixedPosition:function(h){if(h){for(var f=0,b=this.fixedElements_.length;f<b;++f){this.fixedElements_[f].style.position="fixed"}}else{this.fixedElements_=[];var g=document.createNodeIterator(document.documentElement,NodeFilter.SHOW_ELEMENT,null,false);var d;while(d=g.nextNode()){var c=document.defaultView.getComputedStyle(d,"");if(!c){return}var j=c.getPropertyValue("position");if(j=="fixed"){this.fixedElements_.push(d);d.style.position="absolute"}}}},checkPageIsOnlyEmbedElement:function(){var f=document.body.children;var b=false;for(var d=0;d<f.length;d++){var c=f[d].tagName;if(c=="OBJECT"||c=="EMBED"||c=="VIDEO"||c=="SCRIPT"){b=true}else{if(f[d].style.display!="none"){b=false;break}}}return b},onRequest:function(h,d,g){if(h.type=="takeCapture"){var b={};for(var c=0;c<document.getElementsByTagName("meta").length;c++){a=document.getElementsByTagName("meta")[c];if((a.getAttribute("name")&&a.getAttribute("name").toLowerCase()=="description")){b.description=a.getAttribute("content")}}if(h.start){page.setVars();page.enableFixedPosition(false);try{document.getElementById("presence").style.display="none";window.setTimeout("document.getElementById('presence').style.display=''",10000)}catch(f){}try{document.getElementById("navi-bar").style.display="none";window.setTimeout("document.getElementById('navi-bar').style.display=''",10000)}catch(f){}}page.scrollToCurrent();if(page.iframe){b.top=page.iframe.contentDocument.body.scrollTop;b.left=page.iframe.contentDocument.body.scrollLeft}else{b.top=document.body.scrollTop;b.left=document.body.scrollLeft}b.finish=!page.computeNextScreen();if(b.finish){b.width=page.documentWidth;b.height=page.documentHeight;b.url=document.location.toString();b.title=document.title}g(b)}if(h.type=="finish"){page.enableFixedPosition(true);page.currentX=0;page.currentY=0;page.scrollToCurrent()}}};try{chrome.extension.onRequest.removeListener(page.onRequest)}catch(e){}try{chrome.extension.onRequest.addListener(page.onRequest)}catch(e){};