function setActiveStyleSheet(title) {
  var i, a, main;
  if(isIE && title == 'Retro')
  {
   alert('Sorry, this skin is not IE < 7 compatible. ');
   return false;
  }
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
      a.disabled = true;
      if(a.getAttribute("title") == title) {
       var expdate = new Date ();
       expdate.setTime(expdate.getTime() + (24 * 60 * 60 * 1000 * 365));

       document.cookie = 'style=' + title + ";expires=" + expdate.toGMTString();
       a.disabled = false;
      }
    }
  }
 return false;
}

function progress()
{
 var tgt = $('stuff');
 if(!tgt)
 {
  return false;
 }
 var pBar = $('pBar');
 if(!pBar)
 {
  pBar = document.createElement('div');
  pBar.id = 'pBar';
  pBar.className = 'progress';
  pBar.innerHTML = 'Sending your vote...<br \/>';
  tgt.appendChild(pBar);
 }
 pBar.innerHTML = pBar.innerHTML + '. ';
// alert(pBar.innerHTML);
 return true;
}

window.onload = function() 
{
 if(isIE) // all retards need hand-holding, no suprise here // aw fuck it, IE can kiss my ass.
 {
/*
  var dl = document.getElementById('nav');
  if(dl && dl.childNodes)
  {
   dl = dl.firstChild;
   while(dl.nextSibling)
   {
    if(dl.nodeName.match(/^dl$/i))
    {
     var x = dl.childNodes;
     for (var i = 0; i <= x.length; i++)
     {
      var nodeX = x[i];
      if(!nodeX)
      {
      	continue;
      }
      if(nodeX.nodeName.match(/^dt$/i))
      {
       nodeX.title = 'Click to (un-)fold. ;)';
       nodeX.onclick = function()
       {
        this.parentNode.className = this.parentNode.className == 'active' ? 'inactive' : 'active';
        return false;
       };
      }
     }
    }
    dl = dl.nextSibling;
   }
  }
*/
 }

 var links = document.getElementsByTagName('a');
 var link;
 for(var i = 0; i < links.length; i++)
 {
  link = links[i];
  if(link.target == '_blank')
  {
   link.target = '';
  }
  if(Element.hasClassName(link, 'ext'))
  {
   link.onclick = function()
   {
    window.open(this.href);
    return false;
   }
  }   
 }
  
 var aPoll = $('poll');

 if(!aPoll || !$('pollVote'))
 {
  return false;
 }
 else
 {
  aPoll.pollVote.disabled = !(aPoll.yes.checked || aPoll.no.checked);
  aPoll.yes.onclick = aPoll.no.onclick = function()
  {
   aPoll.pollVote.disabled = 0;
  }
 
  aPoll.onsubmit = function()
  {
   if(!(aPoll.yes.checked || aPoll.no.checked))
   {
    return false;
   }

   progress();
   
   var bar = setInterval(progress, 10);

   new ajax ('/poll', {
	postBody: 'poll=' + (aPoll.no.checked ? 'no' : 'yes'), 
	update: $('null'),
	onComplete: updatePoll
   });

   function updatePoll(request){
    var pollFx = new fx.Accordion([$('stuff')], [$('poll')], {duration: 250, opacity: true});
    var z = eval('(' + request.responseText + ')' );
    var y = parseInt(z.votes.yp) + '%';
    var n = parseInt(z.votes.np) + '%';
    
    $('pollYes').style.width = y;
    $('pollNo').style.width = n;
    $('pollY').innerHTML = 'Yes! [' + parseInt(z.votes.yes) + ' - ' + y + ']';
    $('pollN').innerHTML = 'No! [' + parseInt(z.votes.no) + ' - ' + n + ']';
    $('voter').innerHTML = '<em>Thank you for voting!</em>';
    
    var expdate = new Date ();

	expdate.setTime(expdate.getTime() + (24 * 60 * 60 * 1000*365)); 

    document.cookie = 'poll=' + z.votes.pollId + ';expires= ' + expdate.toGMTString();
    clearInterval(bar);
    $('stuff').removeChild($('pBar'));
    pollFx.showThisHideOpen($('poll'));
    return false;
   }
   if(aPoll)
   {
    aPoll.pollVote.disabled = true;
   }
   return false;
  }
 }
 return true;
}