  /**
    * Launches a pop-up window
    */
  function launchPopup(url, name, width, height, resizable, scrollbars, toolbar, location) {
    popup_window = window.open(url, name, 'width='+width+',height='+height+',resizable='+resizable+',scrollbars='+scrollbars+',toolbar='+toolbar+',location='+location+'');
    popup_window.focus();
  }

  /**
    * Holds a timestamp for use with cookie generation...
    */
  var timestamp = new Date();

  /**
    * Shows a element
    */
  function show(pElementName, pDisplay) {
    //alert('show(' + pElementName + ', '+ pDisplay + ')');
    var voted = document.getElementById(pElementName);
    voted.style.display = pDisplay;
  }
  
  /**
    * Hides an element
    */
  function hide(pElementName) {
    //alert('hide(' + pElementName + ')');
    var voted = document.getElementById(pElementName);
    voted.style.display = "none";
  }
  
  /**
    * Changes two element at once, switching states between them.
    */
  function change(pHideElementName, pShowElementName) {
    //alert('change(' + pHideElementName + ', '+ pShowElementName + ')');
    hide(pHideElementName);
    show(pShowElementName, 'block');
  }

  /**
    * Checkes state
    */
  function mentometerState(pollId) {
    //alert('mentometerState(' + pollId + ')');
    var cookies = document.cookie;
    var pos = cookies.indexOf('mentometer=');
    if (pos != -1) {
      var start = pos + 11;
      var end = cookies.indexOf(';', start);
      if (end == -1) {
        end = cookies.length;
      }
      var value = cookies.substring(start, end);
      value = unescape(value);
      var mentometerIds = value.split('M');
      for (var i = 0; i < mentometerIds.length; i++) {
        if (mentometerIds[i] == pollId) {
          change('vote-' + pollId, 'voted-' + pollId);
          return;
        }
      }
      change('voted-' + pollId, 'vote-' + pollId);
    }
    else {
      change('voted-' + pollId, 'vote-' + pollId);
    }
  }

  /**
    * Calculates the size of one individual width
    */
  function size(pTotalVotes, pVotes, pSize) {
    return Math.round((pSize * percent(pTotalVotes, pVotes)) / 100);
  }
  
  /**
    * Calculates the percentage value of a set
    * of votes represents...
    */
  function percent(pTotalVotes, pVotes) {
    var result = 0;
    if (pTotalVotes > 0) {
      result = (pVotes * 100) / pTotalVotes;
    }
    return Math.round(result);
  }
  
  /**
    * Read's a cookie
    */
  function readCookie(pCookieName) {
    var cookieName = pCookieName + '='
    var cookies = document.cookie;
    var pos = cookies.indexOf(cookieName);
    if (pos != -1) {
      var start = pos + cookieName.length;
      var end = cookies.indexOf(';', start);
      if (end == -1) {
        end = cookies.length;
      }
      return unescape(cookies.substring(start, end));
    }
  }

  /**
    * Set a cookie
    */
  function setCookie(pName, pValue) {
    document.cookie = pName + '=' + escape(pValue);
  }
  
  /**
    * Reads one individual poll cookie
    */
  function readPollCookie(pollId) {
    var pollCookie = readCookie('pollCache');
    if (pollCookie == null) {
      return null;
    }
    var pollCacheCookies = pollCookie.split(';');
    for (var i = 0; i < pollCacheCookies.length; i++) {
      var pollCookie = pollCacheCookies[i];
      if (pollCookie.indexOf(pollId) != -1) {
        return pollCookie;
      }
    }
  }
  
  /**
    * An array of poll cookie id's
    */
  function readPollCookieIds() {
    var pollCookie = readCookie('pollCache');
    if (pollCookie == null) {
      return null;
    }
    var pollCacheCookies = pollCookie.split(';');
    var result = new Array(pollCacheCookies.length);
    for (var i = 0; i < pollCacheCookies.length; i++) {
      var hepp = pollCacheCookies[i].split(':')
      result[i] = hepp[0];
    }
    return result;
  }
  
  /**
    * Set's a poll cookie
    */
  function setPollCookie(pollId, vote) {
    var values = '';
    var pollCookieIds = readPollCookieIds();
    if (pollCookieIds != null) {
      for (var i = 0; i < pollCookieIds.length; i++) {
        values += readPollCookie(pollCookieIds[i]) + ';';
      }
    }
    values += 'pollId-' + pollId + ':' + timestamp + ':' + vote;
    //alert(values);
    setCookie('pollCache', values);
  }

/* ART-POLLSTUFF TRULZ how do we get this reloaded? */

  /**
    * Shows a element
    */
  function showArt(pElementName, pDisplay) {
    //alert('show(' + pElementName + ', '+ pDisplay + ')');
    var votedArt = document.getElementById(pElementName);
    votedArt.style.display = pDisplay;
  }
  
  /**
    * Hides an element
    */
  function hideArt(pElementName) {
    //alert('hide(' + pElementName + ')');
    var votedArt = document.getElementById(pElementName);
    votedArt.style.display = "none";
  }
  
  /**
    * Changes two element at once, switching states between them.
    */
  function changeArt(pHideElementName, pShowElementName) {
    //alert('change(' + pHideElementName + ', '+ pShowElementName + ')');
    hideArt(pHideElementName);
    showArt(pShowElementName, 'block');
  }

  /**
    * Checkes state
    */
  function mentometerStateArt(pollId) {
    //alert('mentometerState(' + pollId + ')');
    var cookies = document.cookie;
    var pos = cookies.indexOf('mentometer=');
    if (pos != -1) {
      var start = pos + 11;
      var end = cookies.indexOf(';', start);
      if (end == -1) {
        end = cookies.length;
      }
      var value = cookies.substring(start, end);
      value = unescape(value);
      var mentometerIds = value.split('M');
      for (var i = 0; i < mentometerIds.length; i++) {
        if (mentometerIds[i] == pollId) {
          changeArt('voteArt-' + pollId, 'votedArt-' + pollId);
          return;
        }
      }
      changeArt('votedArt-' + pollId, 'voteArt-' + pollId);
    }
    else {
      changeArt('votedArt-' + pollId, 'voteArt-' + pollId);
    }
  }

  if (!window.Node) var Node =
        {
          ELEMENT_NODE                :  1,
          ATTRIBUTE_NODE              :  2,
          TEXT_NODE                   :  3,
          CDATA_SECTION_NODE          :  4,
          ENTITY_REFERENCE_NODE       :  5,
          ENTITY_NODE                 :  6,
          PROCESSING_INSTRUCTION_NODE :  7,
          COMMENT_NODE                :  8,
          DOCUMENT_NODE               :  9,
          DOCUMENT_TYPE_NODE          : 10,
          DOCUMENT_FRAGMENT_NODE      : 11,
          NOTATION_NODE               : 12
        }


    function loadAd( element )
    {
        // Move element and display it
        var adloader = $( "adloader_" + element );
        adloader.parentNode.removeChild( adloader );
        $( element ).appendChild( adloader );
        adloader.style.display = "block";

        // Remove our calling scripts
        var remove = $( "adloader_" + element + "_script1" );
        remove.parentNode.removeChild( remove );
        var remove = $( "adloader_" + element + "_script2" );
        remove.parentNode.removeChild( remove );

        // If loader element contains nothing but text, hide it
        var loader_is_empty = true;
        for( var i=0; i<adloader.childNodes.length; i++ )
            if( adloader.childNodes[i].nodeType != Node.TEXT_NODE && adloader.childNodes[i].className != "admarker" )
                loader_is_empty = false;
        if( loader_is_empty )
            adloader.parentNode.style.display = "none";
        else{
            adloader.parentNode.style.display = "block";
            if(element == "bigbang"){
                $("escbody").setStyle({margin:'0'});
            }
        }
    }