/* Copyright 2006-2007 LiveGadgets.net */
if(!Function.registerBaseMethod){if(!document.head)document.head=document.getElementsByTagName("HEAD")[0];if(!window.registerNamespace)window.registerNamespace=function(d){var b=window,c=d.split(".");for(var a=0;a<c.length;a++){if(!b[c[a]])b[c[a]]={};b=b[c[a]]}};String.prototype.lTrim=function(){return this.replace(/^\s*/,"")};String.prototype.rTrim=function(){return this.replace(/\s*$/,"")};String.prototype.trim=function(){return this.rTrim().lTrim()};String.prototype.endsWith=function(a){return this.substr(this.length-a.length)==a};String.prototype.startsWith=function(a){return this.substr(0,a.length)==a};String.prototype.format=function(){var b=this;for(var a=0;a<arguments.length;a++)b=b.replace(new RegExp("\\{"+a+"\\}","g"),arguments[a]);return b};Function.prototype.registerBaseMethod=function(){};Function.prototype.initializeBase=function(){};Function.prototype.registerClass=function(){};Function.prototype.getBaseMethod=function(){return function(){return}};registerNamespace("Web");Web.Bindings=new function(){this.attachElementBindingSync=function(f,c,d,e,b){var a=new c(f,e,b);a.initialize(d);return a}}};registerNamespace("LiveGadgets.Util");LiveGadgets.Util.Base64=new function(){var b="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",a,g,e,f,i,h,c,d;this.encode=function(j){var k="";a=0;do{g=j.charCodeAt(a);a++;e=j.charCodeAt(a);a++;f=j.charCodeAt(a);a++;i=g>>2;h=(g&3)<<4|e>>4;c=(e&15)<<2|f>>6;d=f&63;if(isNaN(e))c=d=64;else if(isNaN(f))d=64;k+=b.charAt(i)+b.charAt(h)+b.charAt(c)+b.charAt(d);g=e=f="";i=h=c=d=""}while(a<j.length);return k};this.decode=function(j){var k="";j=j.replace(/[^A-Za-z0-9\+\/\=]/g,"");a=0;while(a<j.length){i=b.indexOf(j.charAt(a));a++;h=b.indexOf(j.charAt(a));a++;c=b.indexOf(j.charAt(a));a++;d=b.indexOf(j.charAt(a));a++;g=i<<2|h>>4;e=(h&15)<<4|c>>2;f=(c&3)<<6|d;k+=String.fromCharCode(g);if(c!=64)k+=String.fromCharCode(e);if(d!=64)k+=String.fromCharCode(f)}return k}};registerNamespace("LiveGadgets.Controls");LiveGadgets.Controls.Button=function(j,d){var b=this,h=j.ownerDocument;b.onclick=null;b.ondblclick=null;var c,g,i,f,a;b.initialize=function(){j.className+=" LiveGadgets_Controls_Button";if(d.className)f=d.className+" "+d.className;else throw"LiveGadgets.Controls.Button: must specify p_args.className";a=h.createElement("div");a.ondblclick=m;a.onclick=p;a.onmouseover=l;a.onmouseout=n;a.onmousedown=k;a.onmouseup=o;a.innerHTML=d.text?d.text:"";j.appendChild(a);c=d.disabled?d.disabled:false;g=i=false;e()};b.dispose=function(){a.onclick=a.ondblclick=a.onmouseover=a.onmouseout=a.onmousedown=a.onmouseup=null;b=b.onclick=b.ondblclick=a=j=null};b.disable=function(){c=true;e()};b.enable=function(){c=false;e()};b.getDisabledState=function(){return c};function e(){if(c)a.className=f+"Disabled";else if(i&&g)a.className=f+"Down";else if(g)a.className=f+"Hover";else a.className=f+"Active"}function p(a){var d=a?a:h.parentWindow.event;if(!c&&b.onclick)b.onclick(d,b)}function m(a){var d=a?a:h.parentWindow.event;if(!c&&b.ondblclick)b.ondblclick(d,b)}function l(a){var b=a?a:h.parentWindow.event;g=true;e()}function n(){g=false;e()}function k(a){var b=a?a:h.parentWindow.event;if(b.button===1){i=true;e()}}function o(){i=false;e()}};if(window.parent!=window.self)document.body.style.backgroundColor="transparent";registerNamespace("LiveGadgets");if(!window.LiveGadgets.Environment)LiveGadgets.Environment=new function(){this.SIDEBAR="SIDEBAR";this.WEB="WEB";this.OTHER="OTHER";this.LIVE="LIVE";this.SPACES="SPACES";var a,b;if(window.System&&window.System.Gadget)a=this.SIDEBAR;else if(window.Start&&window.Start.Parser){a=this.WEB;if(document.location.host=="spaces.start.com")b=this.SPACES;else b=this.LIVE}else a=this.OTHER;this.getMode=function(){return a};this.getWebMode=function(){return b}};LiveGadgets.McCain08=function(c,d){LiveGadgets.McCain08.initializeBase(this,arguments);var v,j,a,k,L=/'re=\/"=re/,B,y,x,i,u,h,e,g,l,m,s,q,r,b,f,n,o,p,H;this.initialize=function(H){LiveGadgets.McCain08.getBaseMethod(this,"initialize","Web.Bindings.Base").call(this,H);if(d.module&&d.module.resolveUrl)v=d.module.resolveUrl("hello.mp3");else if(d.feedUrl&&d.feedUrl.toLowerCase().endsWith("/gadget.xml"))v=d.feedUrl.substr(0,d.feedUrl.length-10)+"hello.mp3";var F,B;function D(c,a){var d=a?a:"McCain08.install",f=LiveGadgets.Util.Base64.encode(("h={0}&d={1}").format(encodeURIComponent(c),"")),b="http://services.livegadgets.net/generic.ashx?b={0}&l={1}&a={2}",g=window.navigator.browserLanguage?window.navigator.browserLanguage:navigator.language?navigator.language:"en-us",e=b.format(encodeURIComponent(f),encodeURIComponent(g.toLowerCase()),d);return e}j=new Image;if(LiveGadgets.Environment.getMode()==LiveGadgets.Environment.SIDEBAR){System.Gadget.settingsUI="Settings.html";System.Gadget.onSettingsClosed=G;a="sidebar";F=System.Gadget.Settings.read("r");if(!F){System.Gadget.Settings.write("r","r");j.src=D(a)}else j.src=D(a,"McCain08.imp")}else{a=I().host;if(!a)a=document.location.host;if(a.indexOf(".spaces.live.com")>=0)a="spaces";else if(a=="live.com"||a=="www.live.com")a="live.com";else a="other";if(d.module)F=d.module.getPreference("r");if(!F){if(d.module)d.module.setPreference("r","r");j.src=D(a)}else j.src=D(a,"McCain08.imp");z(c,C()?"LiveGadgets_McCain08_Background":"LiveGadgets_McCain08_BackgroundNoAlpha")}if(v){i=document.createElement("object");i.classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6";i.className="Player";c.appendChild(i);if(i.object){x=i.object;x.settings.autoStart=false;x.URL=v}}h=document.createElement("div");h.className="normalArea";f=document.createElement("div");f.className="expiredArea";f.innerHTML='<a href="http://windowsvista.com" target="_blank">Did you Vote?</a>';h.appendChild(f);b=document.createElement("div");b.className="daysArea";h.appendChild(b);B=document.createElement("div");B.className="electionDay";B.innerHTML="Election Day";b.appendChild(B);u=document.createElement("span");u.className="daysCount";b.appendChild(u);B=document.createElement("span");B.innerHTML="&nbsp;days";b.appendChild(B);B=document.createElement("div");B.className="timeArea";n=document.createElement("div");n.className="hoursCount";n.innerHTML="00";B.appendChild(n);o=document.createElement("div");o.className="minsCount";o.innerHTML="00";B.appendChild(o);p=document.createElement("div");p.className="secsCount";p.innerHTML="00";B.appendChild(p);b.appendChild(B);B=document.createElement("div");B.className="timeTitle";B.innerHTML="hours&nbsp;&nbsp;&nbsp;mins&nbsp;&nbsp;&nbsp;secs&nbsp;";b.appendChild(B);c.appendChild(h);e=document.createElement("div");e.className="hoverMenuArea";h.appendChild(e);g=document.createElement("div");if(LiveGadgets.Environment.getMode()==LiveGadgets.Environment.SIDEBAR)g.title="Add gadget to Live.com or Spaces";else if(LiveGadgets.Environment.getMode()==LiveGadgets.Environment.WEB&&LiveGadgets.Environment.getWebMode()==LiveGadgets.Environment.LIVE)g.title="Add this gadget to Vista Sidebar";else g.title="Get the Gadget";g.className="addButtonContainer";s=Web.Bindings.attachElementBindingSync(g,LiveGadgets.Controls.Button,null,{"className":"AddButton"});s.onclick=function(){j.src=D(a,"McCain08.add");window.open("http://mccain.livegadgets.net/")};e.appendChild(g);l=document.createElement("div");l.title="Countdown to the General Election";l.className="countdownButtonContainer";q=Web.Bindings.attachElementBindingSync(l,LiveGadgets.Controls.Button,null,{"className":"CountdownButton"});q.onclick=E;e.appendChild(l);m=document.createElement("div");m.title="Go to ExploreMcCain.com";m.className="linksButtonContainer";r=Web.Bindings.attachElementBindingSync(m,LiveGadgets.Controls.Button,null,{"className":"LinksButton"});r.onclick=function(){j.src=D(a,"McCain08.home");window.open("http://www.ExploreMcCain.com")};e.appendChild(m);t();if(window.attachEvent){c.attachEvent("onmouseover",w);c.attachEvent("onmouseout",t)}else{c.addEventListener("mouseover",w,false);c.addEventListener("mouseout",t,false)}y=(new Date(2008,10,4,0,0,0,0)).getTime();k=setInterval(A,200);A();B=null};LiveGadgets.McCain08.registerBaseMethod(this,"initialize");this.dispose=function(a){LiveGadgets.McCain08.getBaseMethod(this,"dispose","Web.Bindings.Base").call(this,a);if(k){clearInterval(k);k=null}if(window.attachEvent){c.detachEvent("onmouseover",w);c.detachEvent("onmouseout",t)}else{c.removeEventListener("mouseover",w,false);c.removeEventListener("mouseout",t,false)}if(s){s.dispose();s=null}if(q){q.dispose();q=null}if(r){r.dispose();r=null}x=i=null;g=l=m=null;h=H=e=b=f=n=o=p=null};LiveGadgets.McCain08.registerBaseMethod(this,"dispose");function G(a){if(a.closeAction==a.Action.commit)D()}function D(){}function I(){function c(b){var a=b.split("=");if(!a[1])a[1]="";try{d[a[0].trim()]=decodeURIComponent(a[1]).trim()}catch(c){}}var d={},a,b;b=window.location.search.substr(1).split("&");for(a=0;a<b.length;a++)c(b[a]);b=window.location.hash.substr(1).split("&");for(a=0;a<b.length;a++)c(b[a]);return d}function z(a,b){a.className=(a.className+" "+b).trim()}function w(){if(!f.style.display)e.style.display="block"}function t(){if(!f.style.display)e.style.display=""}function E(){if(!b.style.display)b.style.display="block";else b.style.display=""}function C(){if(c.style.filter!=="")return true;else{var a=/MSIE (\d*)\.(\d*)/,b=a.exec(window.navigator.appVersion);return parseInt(b[1],10)>=7}}function A(){var a,d=(new Date).getTime();if(d<y){var c=Math.floor((y-d)/1000);if(c!=B){B=c;a=Math.floor(c/86400);u.innerHTML=a;a=Math.floor(c/3600)%24;n.innerHTML=a<10?"0"+a:a;a=Math.floor(c/60)%60;o.innerHTML=a<10?"0"+a:a;a=Math.floor(c)%60;p.innerHTML=a<10?"0"+a:a}}else{if(k){clearInterval(k);k=null}f.style.display="block";b.style.display="none"}}};LiveGadgets.McCain08.registerClass("LiveGadgets.McCain08","Web.Bindings.Base");if(LiveGadgets.Environment.getMode()!=LiveGadgets.Environment.WEB)LiveGadgets.SidebarStub=new function(){var d,a;function c(){function g(){a.className="LiveGadgets_McCain08";var b={};b.feedUrl=f+"gadget.xml";d=new LiveGadgets.McCain08(a,b,null);d.initialize(null)}function h(d,c){function b(){if(a&&("loaded"==a.readyState||"complete"==a.readyState)){a.onreadystatechange=null;if(c)c(a)}}var a;if(!a){a=document.createElement("link");a.rel="stylesheet";a.type="text/css";if(!a.readyState){a.readyState="complete";b()}else a.onreadystatechange=b;a.href=d;document.head.appendChild(a)}else b();return a}var i,f="";if(LiveGadgets.Environment.getMode()==LiveGadgets.Environment.OTHER){var c=document.getElementsByTagName("script");for(var b=0;b<c.length;b++)if(c[b].src){var e=(/(.*[\/\\]?)McCain08.js\??(.*)/i).exec(c[b].src);if(e){f=e[1];if(e[2])a=document.getElementById(e[2].substr(3));else{a=document.createElement("div");c[b].parentNode.insertBefore(a,c[b])}break}}h(f+"style.css",g)}else{a=document.getElementById("LiveGadgets_McCain08");g()}}function b(){try{d.dispose(true)}catch(e){}d=a=null;try{if(window.detachEvent){window.detachEvent("onload",c);window.detachEvent("onunload",b)}else{window.removeEventListener("load",c,false);window.removeEventListener("unload",b,false)}}catch(e){}}if(window.attachEvent){window.attachEvent("onload",c);window.attachEvent("onunload",b)}else{window.addEventListener("load",c,false);window.addEventListener("unload",b,false)}}