var _cowbarWidget=null,CowbarManager={_xconfig:{root_url:"http://widgetcow.com/files/cowbar/",search:[],color_scheme:""},loadFile:function(a,b){var c=null,d=document.getElementsByTagName("head")[0];if(a.indexOf(".js")>=0){c=document.createElement("script");c.type="text/javascript";c.src=CowbarManager._xconfig.root_url+a}else if(a.indexOf(".css")>=0){c=document.createElement("link");c.rel="stylesheet";c.type="text/css";c.href=CowbarManager._xconfig.root_url+a}else return c;if(b){var e=false;c.onload=c.onreadystatechange= function(){if(!e&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){e=true;b(c)}}}d.appendChild(c);return c},_getWindowSize:function(){var a=0,b=0;if(typeof window.innerWidth=="number"){a=window.innerWidth;b=window.innerHeight}else if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)){a=document.documentElement.clientWidth;b=document.documentElement.clientHeight}else if(document.body&&(document.body.clientWidth||document.body.clientHeight)){a= document.body.clientWidth;b=document.body.clientHeight}return{width:a,height:b}},_closePopup:function(a){jQuery("body").fadeTo("fast",1);jQuery("#cowbar_popupwindow").fadeOut(600,function(){jQuery("#cowbar_popupwindow").remove();a!=null&&typeof a=="function"&&a()})},_createPopup:function(a,b,c,d,e,f,g){e='
';e+=f?"':g;e+="
";jQuery('').insertAfter("#cowbar_bar");jQuery("#cowbar_pw_head .cow_pwh_right").bind("click",function(){CowbarManager._closePopup(null);jQuery("#cow_opaque").hide()});jQuery("#cow_opaque").show();jQuery("#cowbar_popupwindow").fadeIn(500,function(){var j=jQuery("#cowbar_popupwindow").offset().top; if(j-60>0)j-=60;jQuery("html,body").animate({scrollTop:j},500)})},_openPopup:function(a){var b={x:0,y:0,w:0,h:0,title:"",inframe:false,content:""};for(var c in a)if(typeof b[c]!="undefined")b[c]=a[c];jQuery("#cowbar_popupwindow").exists()?CowbarManager._closePopup(function(){CowbarManager._createPopup(b.x,b.y,b.w,b.h,b.title,b.inframe,b.content)}):CowbarManager._createPopup(b.x,b.y,b.w,b.h,b.title,b.inframe,b.content)},_createMiniwindowArea:function(a){return''}, _createBarItem:function(a){var b="";if(typeof a.miniwindow!="undefined")b=CowbarManager._createMiniwindowArea(a.miniwindow);a='";jQuery("#cowbar_nav").append(a)},_mkseach:function(a,b,c){var d='';d+='';var e={bar:{id:"cow_search",text:d},miniwindow:{id:"cow_searchp_select"}};CowbarManager._createBarItem(e);jQuery("#cowbar_searchbox").cow_search(a,b,c);jQuery("#cow_searchprovider_holder").bind("click",function(){jQuery("#cow_searchp_select").slideToggle();jQuery('#cow_translate_select').slideUp();return false;});b=CowbarManager._getWindowSize();e={x:b.width/2-400,y:b.height/2-300,w:800,h:600,title:"Search",inframe:true,content:""};jQuery("#cowbar_searchbox").keyup(function(f){if(!f)f= window.event;var g=jQuery(this).val();if(!(g==a||g==""))if(f.keyCode==13){f=jQuery("#cow_searchprovider").attr("currid");e.content=CowbarManager._xconfig.search[f].url.replace("{q}",g+"+site:"+window.location.hostname);CowbarManager._openPopup(e)}});jQuery("#cow_search_btn").bind("click",function(){var f=jQuery("#cowbar_searchbox").val();if(!(f==a||f=="")){var g=jQuery("#cow_searchprovider").attr("currid");e.content=CowbarManager._xconfig.search[g].url.replace("{q}",f+"+site:"+window.location.hostname); CowbarManager._openPopup(e)}})},_mksearchProvider:function(){var a=CowbarManager._xconfig.search;for(var b in a)jQuery("#cow_searchp_select").append('
'+a[b].name+'
');jQuery(".cow_sp_row").hover(function(){jQuery(this).removeClass("cow_sp_row").addClass("cow_schema_"+ CowbarManager._xconfig.color_scheme).addClass("cow_sp_row_hover")},function(){jQuery(this).removeClass("cow_schema_"+CowbarManager._xconfig.color_scheme).removeClass("cow_sp_row_hover").addClass("cow_sp_row")});jQuery(".cow_sp_row").bind("click",function(){var c=jQuery("#cow_searchprovider").attr("currid"),d=jQuery(this).attr("currid");jQuery("#cow_searchprovider").attr("currid",d);jQuery("#cow_searchprovider").removeClass("cow_sp_icon_"+a[c].id).addClass("cow_sp_icon_"+a[d].id);jQuery("#cow_searchprovider").click()})}, _onBookmarkSelect:function(a,b,c){a=CowbarManager._getWindowSize();params={x:a.width/2-400,y:a.height/2-300,w:800,h:600,title:"Send to "+b,inframe:true,content:c};CowbarManager._openPopup(params)},_getFontInPx:function(a){if(a.indexOf("em")!=-1){a=parseFloat(a.replace("em",""));a=parseInt(a*16,10)}else if(a.indexOf("pt")!=-1){a=parseFloat(a.replace("em",""));a=parseInt(a+4,10)}else if(a.indexOf("px")!=-1)a=parseInt(a.replace("px",""),10);return a},search:function(a){if(typeof a.providers=="undefined"|| a.providers.length==0)return null;for(var b in a.providers)if(a.providers[b]!=""){var c=null,d=null;switch(a.providers[b]){case "gsearch":c="http://google.com/search?q={q}";d="Google";break;case "ysearch":c="http://search.yahoo.com/search?p={q}";d="Yahoo";break;case "bsearch":c="http://www.bing.com/search?q={q}";d="Bing";break}CowbarManager._xconfig.search[b]={id:a.providers[b],url:c,name:d}}CowbarManager._mkseach("Search...",typeof a.cssa!="undefined"?a.cssa:{color:"#000","font-style":"normal"}, typeof a.cssna!="undefined"?a.cssna:{color:"#aaa","font-style":"italic"});CowbarManager._mksearchProvider()},translate:function(a){CowbarManager._createBarItem({bar:{id:"cow_translate",text:''},miniwindow:{id:"cow_translate_select"}});jQuery("#cow_btn_translate").bind("click",function(){jQuery("#cow_translate_select").slideToggle();jQuery('#cow_searchp_select').slideUp();return false;});var b=a.url.replace("{q}",window.location.href);for(var c in a.languages){var d=b.replace("{l}",a.languages[c].code); jQuery("#cow_translate_select").append('")}jQuery(".cow_t_row").hover(function(){jQuery(this).removeClass("cow_t_row").addClass("cow_schema_"+CowbarManager._xconfig.color_scheme).addClass("cow_t_row_hover")},function(){jQuery(this).removeClass("cow_t_row_hover").removeClass("cow_schema_"+CowbarManager._xconfig.color_scheme).addClass("cow_t_row")})},share:function(a){CowbarManager._createBarItem({bar:{id:"cow_share", text:""}});CowbarManager.loadFile("jquery.bookmark.min.js",function(){var b=a.wconf;b.onSelect=CowbarManager._onBookmarkSelect;jQuery("#cow_share").bookmark(b)})},font:function(a){var b="";if(a.sizemg)b+='';CowbarManager._createBarItem({bar:{id:"cow_text_tools",text:b}});jQuery("#cow_tt_tinc").bind("click",function(){var c=CowbarManager._getFontInPx(jQuery("body").css("font-size")); c++;c>=a.maxsize||jQuery("body").css("font-size",c+"px")});jQuery("#cow_tt_tdec").bind("click",function(){var c=CowbarManager._getFontInPx(jQuery("body").css("font-size"));c--;c<=a.minsize||jQuery("body").css("font-size",c+"px")})},scroller:function(){var a="";a+='';jQuery('').prependTo("body");CowbarManager._createBarItem({bar:{id:"cow_scroll_tools",text:a}});jQuery("#cow_sc_top").bind("click",function(){var b=jQuery("#cow_sc_top_xx").offset().top; jQuery("html,body").animate({scrollTop:b},1E3)})},flike:function(a){var b=typeof a.layout!="undefined"?a.layout:"standard",c=typeof a.show_faces!="undefined"?a.show_faces:true,d=typeof a.width!="undefined"?parseInt(a.width,10):450,e=typeof a.action!="undefined"?a.action:"like";a=typeof a.colorscheme!="undefined"?a.colorscheme:"light";if(b!="standard"&&b!="button_count")b="standard";if(c!=true&&c!=false)c=true;if(e!="like"&&e!="recommend")e="like";if(a!="light"&&a!="dark"&&a!="evil")a="light";b={bar:{id:"cow_facebook_like", text:''}};CowbarManager._createBarItem(b)}}; function Cowbar(a){var b={sections:{},color_scheme:"",bar_config:{collapsed:false}};for(var c in a)if(typeof b[c]!="undefined")b[c]=a[c];var d=function(){b.bar_config.collapsed?jQuery("#cowbar_mini").fadeOut(500,function(){jQuery("#cowbar_main").fadeIn(500)}):jQuery("#cowbar_main").fadeOut(500,function(){jQuery("#cowbar_mini").fadeIn(500)});b.bar_config.collapsed=!b.bar_config.collapsed},e=function(){CowbarManager._xconfig.color_scheme=b.color_scheme;for(var h in b.sections){var k=b.sections[h].data, i=CowbarManager[b.sections[h].func];if(typeof i==="function")i.toString().charAt(0)=="_"||i.toString()=="loadFile"||i(k)}jQuery(document).click(function(){jQuery('#cow_translate_select').slideUp();jQuery('#cow_searchp_select').slideUp();});},f=function(){var h='';jQuery(h).appendTo("body");jQuery("#cowbar_left_holder").addClass("cow_schema_"+ b.color_scheme);jQuery("#cowbar_nav").addClass("cow_bg_"+b.color_scheme);h='';jQuery("#cowbar_mini td").append(h);jQuery(".cow_toggle_bar").bind("click",d)},g=function(){jQuery.fn.exists=function(){return jQuery(this).length>0};jQuery.fn.cow_search=function(h,k,i){jQuery(this).css(i);jQuery(this).focus(function(){if(jQuery(this).val()==h){jQuery(this).val("");jQuery(this).css(k)}});jQuery(this).blur(function(){if(jQuery(this).val()== ""){jQuery(this).val(h);jQuery(this).css(i)}})}},j=function(){g();CowbarManager.loadFile("cowbar.css",null);f();e()};(function(){typeof jQuery=="undefined"?CowbarManager.loadFile("jquery.min.js",function(){jQuery.noConflict();j()}):j()})()}function _cowAddLoadEvent(a){var b=window.onload;window.onload=typeof window.onload!="function"?a:function(){b&&b();a()}} var _cowbarSections=[{func:'search', data:{providers:['gsearch','ysearch','bsearch']}},{func:'translate', data:{url:'http://translate.google.com/translate?hl={l}&u={q}', languages:[{code:'es', name:'Spanish'}]}},{func:'share', data:{wconf:{sites:['digg', 'facebook', 'twitter', 'delicious', 'reddit', 'myspace']}}},
{func:'flike', data:{layout:'standard', show_faces:true, width:300, action:'like', colorscheme:'light'}},
{func:'font', data:{sizemg:true, maxsize:20, minsize:10}},
{func:'scroller', data:{}}],_cowColorScheme="cyan";_cowAddLoadEvent(function(){_cowbarWidget=new Cowbar({color_scheme:_cowColorScheme,sections:_cowbarSections})});