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;
				};
			}
		}
	}
}

// play media files on page load

if (typeof jQuery != 'undefined' && typeof $.fn.media != 'undefined') {
$(document).ready(function() {
  if ($('a.media').length && typeof $.cookie !== 'undefined') {

    var c = location.pathname.slice(1) || 'index';

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


});
}