function popUp(winUrl) {
  window.open(winUrl,"popup","width=420,height=480");
}
window.onload = prepareLinks;
function prepareLinks() {
  if(document.getElementsByTagName) {
    var links = document.getElementsByTagName("a");
    for (var i=0; i<links.length; i++) {
      if (links[i].className == "popup") {
        links[i].onclick = function() {
          popUp(this.getAttribute("href"));
          return false;
        };
      }
    }
  }
}

(function(doc, docel) {
  docel.className += docel.className ? ' js' : 'js';
  
  $(doc).ready(function() {
    $('a.read-more').click(function(event) {
      event.preventDefault();
      
      if (this.hash) {
        $(this).hide();
        $(this.hash).slideDown();
      }
      
    });
  });
  
})(document, document.documentElement);


// play media files on page load

if (typeof jQuery != 'undefined') {
$(document).ready(function() {
  if ($('a.media').length) {
    if (jQuery.cookie) {
      var c = location.pathname.slice(1) || 'mp3';

      if ($.cookie(c) == 'userplay') {
        $('a.media').media({mp3Player:'/scripts/mediaplayer.swf', height:'36px',width: '300px'}); 
      } else {

        $('a.media').media({autoplay: true, mp3Player:'/scripts/mediaplayer.swf', height:'36px',width: '300px',flashvars: {autostart: true} }); 
        $.cookie(c, 'userplay');
      }
    } else {
      $('a.media').media({autoplay: true, mp3Player:'/scripts/mediaplayer.swf', height:'36px',width: '300px',flashvars: {autostart: true} }); 
    }
  }
});
}
