// Fathomer 0.6 modified for AIP
var fathomer = { account: 'AmericanIssues', message: "Hey! It looks like you're a member of Twitter too! Join our conversation, you can follow us here!", urlcheck: 'http://twitter.com/account/settings', target: 'body', loadcss: false, altbadge: '', checkcookie: function() { if (document.cookie.match(/fathomer=closed/i)) { return true; } }, setcookie: function() { document.cookie = 'fathomer=closed; expires=Thu, 21 Dec 2012 20:00:00 UTC; path=/'; }, showbadge: function() { jQuery('#fathomerdiscover').remove(); if (typeof this.altbadge != 'function') { jQuery(this.target).append('<div id="fathomer"><div id="fathomerclose"></div><span id="fathomermessage">' + this.message + '</span><span id="fathomerfollow"><a href="http://twitter.com/' + this.account + '" target="_blank">http://twitter.com/' + this.account + '</a></span></span>'); jQuery('#fathomerclose').bind('click', function() { jQuery('#fathomer').fadeOut(1000); fathomer.setcookie(); }); if (this.loadcss) { jQuery('head').append('<style type="text/css">#fathomer{display:none;position:absolute;top:20px;right:20px;width:175px;padding:15px;background-color:#D5331E;border-radius:10px;-moz-border-radius:10px;-webkit-border-radius:10px;border:5px solid #FFD900;color:#FFD900;font-family:arial;font-size:14px;z-index:100}#fathomerclose{width:10px;height:10px;border:1px solid #FFD900;position:absolute;top:5px;right:5px;}#fathomerclose:hover{background-color:#FFD900;cursor:pointer;}#fathomermessage{width:50%;}#fathomerfollow{margin:5px 0 0 0;display:block;}#fathomerfollow a, #fathomerfollow a:visited{font-size:15px;font-weight:bold;color:#FFD900;}</style>'); } jQuery('#fathomer').fadeIn(1000); } else if (typeof this.altbadge == 'function') { this.altbadge(); } }, discover: function() { if (!this.checkcookie()) { jQuery('body').append('<div id="fathomerdiscover"><a href="' + this.urlcheck + '">twit</a><style>#fathomerdiscover{display:none;}#fathomerdiscover a{color:#cc0000;}#fathomerdiscover a:visited{color:#0000cc;}</style>'); matchcolor = this.rgbhex(jQuery('#fathomerdiscover a').css('color')); matchcolor == '#0000cc' ? this.showbadge() : ''; } }, rgbhex: function(rgbval) { var s = rgbval.match(/rgb\s*\x28((?:25[0-5])|(?:2[0-4]\d)|(?:[01]?\d?\d))\s*,\s*((?:25[0-5])|(?:2[0-4]\d)|(?:[01]?\d?\d))\s*,\s*((?:25[0-5])|(?:2[0-4]\d)|(?:[01]?\d?\d))\s*\x29/); if (s) { s = s.splice(1); } if (s && s.length == 3) { d = ''; for (i = 0; i < 3; i++) { e = parseInt(s[i], 10).toString(16); e == "0" ? d += "00" : d += e; } return '#' + d; } else { return rgbval; } }, init: function() { window.onload = function() { fathomer.discover(); } } }