var snap_preview_anywhere_config = {version:"1.16",
prefix:{image:"http://spa.snap.com/images/v1.16/",
link:"http://spa.snap.com/",
options:"http://spa.snap.com/",
preview:"http://spa.snap.com/",
bg:"http://spa.snap.com/images/v1.16/bg/bg_305x308",
snap:"http://www.snap.com/",
search:"http://www.snap.com/"},
key:"e5a3c1e6dff5de35b1c6e7c470411886",
source:"pub-2311827-www.wordpress.com",
flavor:"wordpress",
search_box:true,
auto_preview:false,
show_internal:true,
search_type:"snap",
delay:{show:500,
hide:150,
move:200},
text:{search_box:"Search the Web"},
img:{submit:"http://spa.snap.com/images/v1.16/t.gif"},
css_pos:{main:{x:0,
y:0,
w:305,
h:308},
ether:{x:null,
y:null,
w:258,
h:32},
body:{x:0,
y:0,
w:305,
h:230},
bg_img:{x:0,
y:0,
w:305,
h:308},
url:{x:14,
y:4,
w:215,
h:20},
url_a:{x:0,
y:0,
w:null,
h:null},
ques_a:{xr:20,
y:5,
w:null,
h:null},
preview_div:{x:13,
y:24,
w:270,
h:161},
preview:{x:0,
y:0,
w:null,
h:null},
loading_img:{x:0,
y:0,
w:null,
h:null},
search:{x:13,
y:195,
w:272,
h:30},
logo_a:{x:182,
y:229,
w:107,
h:21},
box:{x:5,
y:5,
w:210,
h:20},
submit:{x:220,
y:5,
w:46,
h:20},
cobrand_a:{x:16,
y:230,
w:87,
h:19},
options:{x:0,
y:0,
w:305,
h:null},
option_a:{xr:20,
y:5,
w:null,
h:null},
option_iframe:{x:13,
y:21,
w:275,
h:230}},
style:{},
offset:{body:{top:40,
bottom:10},
options:{top:40,
bottom:10}},
hidden:[],
retry_interval:[8000,
5000,
5000,
5000,
5000,
5000],
partial_check:{delay:2000,
attempts:5},
href:{logo:"http://www.snap.com/",
cobrand:"http://wordpress.com/snap"},
palette:{submit:"-107px 0",
cobrand_a:"-153px 0",
logo_a:"0 0"},
ether:{tl:{x:47,
y:0},
tr:{x:0,
y:0},
bl:{x:47,
y:276},
br:{x:0,
y:276}},
el_scan:"all",
fl:""};
function snapPreviewAnywhere(){this.init();}snapPreviewAnywhere.prototype={div:null,timer_id:null,current_orientation:"lr",retry_url_list:{},div_added:null,current_element:null,current_url:null,init:function(){this.div={};this.retry_url_list={};this.timer_id={retry:null,show:null,partial:null};this.div_added=false;this.current_element=null;this.current_url=null;this.domain=null;this.cfg=snap_preview_anywhere_config;if(document.compatMode&&document.compatMode=="CSS1Compat"){this.cfg.css_pos.box.h-=5;this.cfg.css_pos.box.w-=8;}var _1=this;this.observe(window,"load",function(){_1.onload();});var _2=document.getElementById("snap_preview_anywhere");if(_2&&_2.defer){this.timer_id.partial=window.setTimeout(function(){_1.partial_check();},this.cfg.partial_check.delay);}},clear_timer:function(_3){if(this.timer_id[_3]){window.clearTimeout(this.timer_id[_3]);this.timer_id[_3]=0;}},campaign:function(_4){return "spa"+(_4?("_"+_4):"")+"!"+window.location.host.replace(/:\d+$/,"");},is_internal_link:function(_5){var _6=/^(http|file)s?:\/\/(www\.)?(.*?)\//;if(this.domain===null){var m=document.location.href.match(_6);if(m){this.domain=m[3];}else{this.domain="";}}var _8=_5.href.match(_6);if(_8&&(this.domain==_8[3])){return true;}else{return false;}},add_spa:function(_9){var _a=this;_9.snap_preview_added="spa";this.observe(_9,"mouseover",function(ev){_a.show_delay(ev,_a.cfg.delay.show,_a.cfg.delay.move);});this.observe(_9,"mouseout",function(ev){_a.hide_delay(ev,_a.cfg.delay.hide);});},conditional_add_spa:function(_d,_e){if(_d.snap_preview_added){return;}else{if(_d.className.indexOf("snap_nopreview")!=-1){_d.snap_preview_added="no";return;}}if((_d.className.indexOf("snap_preview")!==-1)||((_d.href.indexOf("https://")!=0)&&(this.cfg.auto_preview||_e)&&(this.cfg.show_internal||!this.is_internal_link(_d)))){this.add_spa(_d);}else{_d.snap_preview_added="no";}},add_link_events:function(){var _f;var _10=[];var _11=[];var _12=["a","area"];var _13=[];switch(this.cfg.el_scan){case "all":_13=["*"];break;case "default":_13=["div","span"];break;}for(var tt=0;tt<_13.length;tt++){var els=document.getElementsByTagName(_13[tt]);for(var i=0;i\n
\n\n
Options\n
\n
\n
\n \n
\n
\n
\n
\n\n";this.get_all_spa_nodes(this.div.main,this.div);this.set_css();this.observe(this.div.main,"mouseover",function(ev){spa.highlight(true);});this.observe(this.div.main,"mouseout",function(ev){spa.highlight(false);spa.hide_delay(ev,100);});var spa=this;this.observe(this.div.preview,"load",function(ev){spa.check_image_status(ev);});var _3b=["img_a","url_a"];for(var i=0;i<_3b.length;i++){this.observe(this.div[_3b[i]],"mousedown",function(ev){spa.link_click("down");});this.observe(this.div[_3b[i]],"mouseout",function(ev){spa.link_click("out");});this.observe(this.div[_3b[i]],"mouseup",function(ev){spa.link_click("up");});this.observe(this.div[_3b[i]],"click",function(ev){spa.link_click("click");});}this.observe(this.div.search_form,"submit",function(ev){spa.form_submit(ev);});this.div.box.value=this.cfg.text.search_box;this.observe(this.div.box,"focus",function(ev){if(spa.div.box.value===spa.cfg.text.search_box){spa.div.box.value="";}});var _43="?source="+encodeURIComponent(this.cfg.source)+"&campaign=";this.div.logo_a.href=this.cfg.href.logo+_43+this.campaign("bsblogo");this.div.cobrand_a.href=this.cfg.href.cobrand;if(this.div.cobrand_a.href.indexOf(this.cfg.prefix.snap)==0){this.div.cobrand_a.href+=_43+this.campaign("link");}this.div.search_form.action=this.cfg.prefix.search;var el=document.createElement("input");el.type="hidden";el.name="source";el.value=encodeURIComponent(this.cfg.source);this.div.search_form.appendChild(el);var el=document.createElement("input");el.type="hidden";el.name="campaign";el.value="";this.div.search_form.appendChild(el);this.div.form_campaign=el;this.orientation("bl");},raise_loading_img:function(){this.div.loading_img.style.zIndex=Number(this.div.preview.style.zIndex)+1;},lower_loading_img:function(){this.div.loading_img.style.zIndex=Number(this.div.preview.style.zIndex)-1;},move:function(x,y){this.div.main.style.left=x+"px";this.div.main.style.top=y+"px";},hide_delay:function(ev,_48){this.clear_timer("show");var spa=this;this.timer_id.show=window.setTimeout(function(){spa.hide();},_48);},hide:function(){if(this.div.options.style.display!="none"){this.div.options.style.display="none";this.div.body.style.display="inline";}this.div.main.style.visibility="hidden";},show_delay:function(ev,_4b,_4c){this.clear_timer("show");var _4d;if(ev.srcElement){_4d=ev.srcElement;}else{if(ev.target){_4d=ev.target;}}var ex=this.getPageX(ev);var ey=this.getPageY(ev);var _50=this.getViewportWidth();var _51=this.getViewportHeight();if((/Safari|Konqueror|KHTML/gi).test(navigator.userAgent)){var _52=ev.pageX-window.pageXOffset;var _53=ev.pageY-window.pageYOffset;var _54=(_53>(_51/2))?"b":"t";_54+=(_52>(_50/2))?"r":"l";}else{var _54=(ev.clientY>(_51/2))?"b":"t";_54+=(ev.clientX>(_50/2))?"r":"l";}var _55=null;if(_4d){var _56=_4d;for(var i=0;(i<5)||(!_56);i++){if((_56.tagName=="A"||_56.tagName=="AREA")&&_56.href){_55=_56;break;}_56=_56.parentNode;}}if(_55){var _58=_55.href.match(/^(http)s?:\/\/([^#]*)/);var _59=document.location.href.match(/^(http|file)s?:\/\/([^#]*)/);var spa=this;if(!_58||!_59||(_58[2]==_59[2])||(_58[1]!=="http")){return;}if(this.div.main.style.visibility!="visible"){this.timer_id.show=window.setTimeout(function(){spa.show(_55,ex,ey,_54,_4d);},_4b);}else{if(!_4d||(this.current_element!=_4d)){this.timer_id.show=window.setTimeout(function(){spa.show(_55,ex,ey,_54,_4d);},_4c);}}}},show:function(_5b,ex,ey,_5e,_5f){if(this.div.url_a.href!=_5b.href){this.raise_loading_img();}if(!_5e){_5e=this.current_orientation;}this.orientation(_5e);this.div.box.value=this.cfg.text.search_box;this.div.box.blur();var spa=this;window.setTimeout(function(){spa.show_part2(_5b,ex,ey,_5e,_5f);},0);},show_part2:function(_61,ex,ey,_64,_65){this.preview_url(_61);var pad=5;if(_64.substr(0,1)=="b"){ey-=(this.div.main.offsetHeight+pad);}else{ey+=pad;}if(_64.substr(1,1)=="r"){ex-=this.div.main.offsetWidth;}this.move(ex,ey);this.current_element=_65;this.div.main.style.visibility="visible";},orientation:function(_67,_68){var _69=this.cfg.prefix.bg;switch(_67){case "bl":this.div.body.style.top=this.cfg.offset.body.bottom+"px";this.div.options.style.top=this.cfg.offset.options.bottom+"px";break;case "br":this.div.body.style.top=this.cfg.offset.body.bottom+"px";this.div.options.style.top=this.cfg.offset.options.bottom+"px";break;case "tl":this.div.body.style.top=this.cfg.offset.body.top+"px";this.div.options.style.top=this.cfg.offset.options.top+"px";break;case "tr":this.div.body.style.top=this.cfg.offset.body.top+"px";this.div.options.style.top=this.cfg.offset.options.top+"px";break;default:return;break;}this.div.ether.style.left=this.cfg.ether[_67].x+"px";this.div.ether.style.top=this.cfg.ether[_67].y+"px";_69+="_"+_67;_69+=(_68?"_d.png":".png");if(this.needs_png_fix){this.div.bg_img.runtimeStyle.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+_69+"',sizingMethod='scale')";}else{this.div.main.style.background="url("+_69+")";}this.current_orientation=_67;},highlight:function(_6a){this.clear_timer("show");this.orientation(this.current_orientation,_6a);},preview_url:function(_6b){var url=_6b.href;var _6d=_6b.target;this.current_url=url;this.div.url_a.href=url;this.div.url_a.target=_6d;this.div.img_a.href=url;this.div.img_a.target=_6d;this.div.url_a.innerHTML=url.replace(/\w+:\/\/(www\.)?/,"");var m=url.match(/\w+:\/\/([^\/]*)/);if(m){this.div.preview.title="Go to "+m[1];this.div.loading_img.title="Go to "+m[1];}else{this.div.preview.title="";this.div.loading_img.title="";}this.clear_timer("retry");if(this.retry_url_list[url]){this.div.preview.src=this.retry_url_list[url];}else{this.div.preview.src=this.cfg.prefix.preview+"preview/?url="+encodeURIComponent(url)+"&key="+this.cfg.key+"&src="+encodeURIComponent(this.cfg.source)+"&cp="+this.campaign("preview")+"&sb="+(this.cfg.search_box?"1":"0")+"&v="+this.cfg.version;}},link_click:function(_6f){switch(_6f){case "down":this.div.url_a.style.color="#ff0000";this.div.preview_div.style.borderColor="#ff0000";break;case "up":case "out":this.div.url_a.style.color="#003399";this.div.preview_div.style.borderColor="#003399";break;case "click":var _70=this.cfg.prefix.preview+"explore/?url="+encodeURIComponent(this.current_url)+"&key="+this.cfg.key+"&src="+encodeURIComponent(this.cfg.source)+"&cp="+this.campaign("redir");this.div.url_a.href=_70+"&tol=url";this.div.img_a.href=_70+"&tol=image";break;}},check_image_status:function(ev){this.lower_loading_img();if(this.div.preview.width==274){var _72=1;var url=this.div.preview.src;var _74=/retry=(\d+)/;var _75=url.match(_74);if(_75){_72=Number(_75[1])+1;url=url.replace(_74,"retry="+_72);}else{url+="&retry="+_72;}if(_72>this.cfg.retry_interval.length){return;}if(_72==this.cfg.retry_interval.length){url+="&final=1";}this.retry_url_list[this.div.url_a.href]=url;if(this.div.main.style.visibility=="visible"){var spa=this;var _77=this.cfg.retry_interval[_72-1];this.clear_timer("retry");this.timer_id.retry=window.setTimeout(function(){spa.div.preview.src=url;},_77);}}},form_submit:function(ev){var _79=false;if(this.div.box.value===this.cfg.text.search_box){this.div.form_campaign.value=this.campaign("defaulttext");_79=true;}else{if(this.div.box.value===""){this.div.form_campaign.value=this.campaign("emptybox");_79=true;}else{this.div.form_campaign.value=this.campaign("bsb");}}if(_79){var _7a=this.cfg.prefix.search+"?source="+encodeURIComponent(this.cfg.source)+"&campaign="+this.div.form_campaign.value;if(this.cfg.search_type=="image"){_7a+="&query=sunflower";}window.open(_7a,"_blank");ev.returnValue=false;if(ev.preventDefault){ev.preventDefault();}return false;}},needs_png_fix:(navigator.userAgent.match(/msie (5\.5|6)/i)&&navigator.platform=="Win32"),isFirefox:(navigator.userAgent.match(/firefox/i)),yahoo_yui_section_being:function(){"The following section of code adapted from the Yahoo YUI Library";" Copyright (c) 2006, Yahoo! Inc. All rights reserved.";" Code licensed under the BSD License:";" http://developer.yahoo.net/yui/license.txt";" Version: 0.11.4";},isSafari:(/Safari|Konqueror|KHTML/gi).test(navigator.userAgent),isIE:(!this.isSafari&&!navigator.userAgent.match(/opera/gi)&&navigator.userAgent.match(/msie/gi)),getPageX:function(ev){var x=ev.pageX;if(!x&&0!==x){x=ev.clientX||0;if(this.isIE){x+=this._getScrollLeft();}}return x;},getPageY:function(ev){var y=ev.pageY;if(!y&&0!==y){y=ev.clientY||0;if(this.isIE){y+=this._getScrollTop();}}return y;},_getScrollLeft:function(){return this._getScroll()[1];},_getScrollTop:function(){return this._getScroll()[0];},_getScroll:function(){var dd=document.documentElement,db=document.body;if(dd&&(dd.scrollTop||dd.scrollLeft)){return [dd.scrollTop,dd.scrollLeft];}else{if(db){return [db.scrollTop,db.scrollLeft];}else{return [0,0];}}},getViewportHeight:function(){var _80=-1;var _81=document.compatMode;if((_81||this.isIE)&&!this.isOpera){switch(_81){case "CSS1Compat":_80=document.documentElement.clientHeight;break;default:_80=document.body.clientHeight;}}else{_80=self.innerHeight;}return _80;},getViewportWidth:function(){var _82=-1;var _83=document.compatMode;if(_83||this.isIE){switch(_83){case "CSS1Compat":_82=document.documentElement.clientWidth;break;default:_82=document.body.clientWidth;}}else{_82=self.innerWidth;}return _82;},yahoo_yui_section_end:function(){"End Yahoo YUI Library adapted code section";},log:function(msg,obj){if(!this.isFirefox||typeof console=="undefined"){return;}if(obj){console.log(msg,obj);}else{console.log(msg);}}};var snap_preview_anywhere=new snapPreviewAnywhere();