var sound1Frame = null;
var sound2Embed = null;
var sound3Embed = null;
var sound4Embed = null;
var sound5Embed = null;

function init() {
}

function sound1Play() {
if ( !sound1Frame ) {
sound1Frame = document.createElement("iframe");
sound1Frame.src = "frame.html";
sound1Frame.width = 0;
sound1Frame.height = 0;
sound1Frame.style.visibility = "hidden";
}
document.body.appendChild(sound1Frame);
}

function sound1Stop() {
if ( sound1Frame ) document.body.removeChild(sound1Frame);
}

function sound2Play() {
if ( !sound2Embed ) {
sound2Embed = document.createElement("embed");
sound2Embed.setAttribute("src", "machinegun.wav");
sound2Embed.setAttribute("hidden", true);
sound2Embed.setAttribute("autostart", true);
} else sound2Stop();
sound2Embed.removed = false;
document.body.appendChild(sound2Embed);
}

function sound2Stop() {
if ( sound2Embed && !sound2Embed.removed ) {
document.body.removeChild(sound2Embed);
sound2Embed.removed = true;
}
}

function sound3Play() {
sound3Stop();
sound3Embed = document.createElement("embed");
sound3Embed.setAttribute("src", "track1.mp3");
sound3Embed.setAttribute("hidden", true);
sound3Embed.setAttribute("autostart", true);
document.body.appendChild(sound3Embed);
}

function sound3Stop() {
if ( sound3Embed ) {
document.body.removeChild(sound3Embed);
sound3Embed = null;
}
}

function sound4Play() {
sound4Stop();
sound4Embed = document.createElement("embed");
sound4Embed.setAttribute("src", "machinegun.mp3");
sound4Embed.setAttribute("hidden", true);
sound4Embed.setAttribute("autostart", true);
document.body.appendChild(sound4Embed);
}

function sound4Stop() {
if ( sound4Embed ) {
document.body.removeChild(sound4Embed);
sound4Embed = null;
}
}

function sound5Play() {
sound5Stop();
sound5Embed = document.createElement("embed");
sound5Embed.setAttribute("src", "jamminJungle.mid");
sound5Embed.setAttribute("hidden", true);
sound5Embed.setAttribute("autostart", true);
document.body.appendChild(sound5Embed);
}

function sound5Stop() {
if ( sound5Embed ) {
document.body.removeChild(sound5Embed);
sound5Embed = null;
}
}




function getElementsByClass(name) {  
var found = 0;  
var elems = new Array();  
var alltags = document.getElementsByTagName("*");  
if (alltags) {  
	for (i=0; i < alltags.length; i++) {  
		if (alltags[i].className==name) {  
			elems[found++]=alltags[i];  
       }  
    }  
}  
return(elems);  
}  


function addEvent(obj, evType, fn) {  
  if (obj.addEventListener) {  
    obj.addEventListener(evType, fn, true);  
    return true;  
  } else if (obj.attachEvent) {  
    var r = obj.attachEvent("on"+evType, fn);  
    return r;  
  } else {  
    return false;  
  }  
}

function classPopupHandler() {  
  var elems=getElementsByClass('popup');  
  for(i=0;i<elems.length;i++) {  
    if (elems[i].href && elems[i].href!='') {  
      addEvent(elems[i],'click',doPopup);  
    }  
  }  
}


function doPopup(ev) {  
   
  // vagy megkapjuk az esemény objektumot, vagy meg kell szereznünk  
  ev || (ev = window.event);  
  
  // mely objektum váltotta ki az eseményt?  
  var source;  
  if (typeof ev.target != 'undefined') {  
   source = ev.target;  
  } else if (typeof ev.srcElement != 'undefined') {  
    source = ev.srcElement;  
  } else { return(true); }  
   
  window.open(source.href,'popup');  
     
  // eseménnyel mi foglalkoztunk, nem kell továbbvinni  
  if (ev.preventDefault) {  
    ev.preventDefault(); ev.stopPropagation();  
   } else {  
    ev.cancelBubble = true; ev.returnValue = false;  
  }  
  return false;  
}   

function popupMusicPlayer() {
	window.open('http://www.ceges-rendezvenyek.hu/zene-mini.html', 'ceges_rendezvenyek_zene', 'width=200,height=80,status=0,toolbar=0,location=0,menubar=0,directories=0,resizable=0,scrollbars=0');
	return false;
}