function addEvent(obj, evType, fn){
	if (obj.addEventListener){
		obj.addEventListener(evType, fn, false);
	return true;
	}
	else if (obj.attachEvent){
		var r = obj.attachEvent("on"+evType, fn);
		return r;
	}
	else{
   		return false;
 	}
}

(function(){
 /*Use Object Detection to detect IE6*/
	var  m = document.uniqueID /*IE*/
	&& document.compatMode  /*>=IE6*/
	&& !window.XMLHttpRequest /*<=IE6*/
	&& document.execCommand;
	try{
		if(!!m){
			m("BackgroundImageCache", false, true) /* = IE6 only */ 
		}
	}
	catch(oh){};
})();

function jsemail(email) {
	for(i=email.length-1; i>=0; i--)
		document.write(email.charAt(i));
}

function jsemaillink(email, link, classname) {
	document.write('<a href="'+link+'"'+(classname!=undefined&&classname!='' ? ' class="'+classname+'"' : '')+'>');
	for(i=email.length-1; i>=0; i--)
		document.write(email.charAt(i));
	document.write('</a>');
}

function jsmailto(emailto, email, classname) {
	document.write('<a href="');
	for(i=emailto.length-1; i>=0; i--)
		document.write(emailto.charAt(i));
	document.write('"'+(classname!=undefined&&classname!='' ? ' class="'+classname+'"' : '')+'>');
	for(i=email.length-1; i>=0; i--)
		document.write(email.charAt(i));
	document.write('</a>');
}

function jsmailtolink(email, cim, classname) {
	document.write('<a href="');
	for(i=email.length-1; i>=0; i--)
		document.write(email.charAt(i));
	document.write('"'+(classname!=undefined&&classname!='' ? ' class="'+classname+'"' : '')+'>'+cim+'</a>');
}

function chr(c) {
	var h = c.toString(16);
	if (h.length==1)
		h = '0'+h;
	h = unescape('%'+h);
	return h;
}

function overflowautoinit(){
	var tags=document.getElementsByTagName("div");
	for (i=0; i<tags.length; i++) {
		tag=tags[i];
		if(tag.className=="overflowautox") {
			tag.style.height=(tag.offsetHeight+tag.offsetHeight-tag.clientHeight)+'px';
		} else if (tag.className=="overflowautoy") {
			tag.style.width=(tag.offsetWidth+tag.offsetWidth-tag.clientWidth)+'px';
		}
	}
}

function play(kod, nev) {
	document.getElementById('play').innerHTML = '<div style="color: #fff; width: 183px; text-align: center; padding: 10px 0;"><img src="art/ajax-loader.gif" alt="" /></div>';

	var xmlHttpReq = false;
	if (window.XMLHttpRequest)
		xmlHttpReq = new XMLHttpRequest();
	// IE
	else if (window.ActiveXObject)
		xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");

	xmlHttpReq.open("POST", "ajax.php", true);
	xmlHttpReq.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");

	xmlHttpReq.onreadystatechange = function() {
		if (xmlHttpReq.readyState == 4) {
			if (xmlHttpReq.status == 200) {
				var res = xmlHttpReq.responseText.split('|');

				if (res.length==3) {
					//var so = new SWFObject("mp3player.swf?file="+res[1], "flashmovie_play", "185", "37", "7", "#ffffff");
					var so = new SWFObject("flash/mp3_player.swf?file="+escape('zene.php?kod='+res[1]), "flashmovie_play", "185", "37", "6", "#ffffff");
					so.addParam("quality", "best");
					so.addParam("menu", "false");
					so.addParam("wmode", "transparent");
					so.addParam("salign", "tl");
					so.write("play");
					var version = deconcept.SWFObjectUtil.getPlayerVersion();
					if (document.getElementById && (version['major'] < 7)) {
						document.getElementById('play').innerHTML = '<div style="font-family: verdana; font-size: 10px; color: #fff; width: 300px;">'+(version['major']>0 ? 'Jelenleg a következő verzió számú Flash lejátszó van a gépére telepítve: '+version['major']+'.'+version['minor']+'.'+version['rev'] : 'Az Ön gépe nem rendelkezik a megjelenítéshez szükséges Flash lejátszóval.')+'<br /><a href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash&promoid=BIOW" target="_blank">Kattintson ide a legfrissebb lejátszó letöltéséhez.</a></div>';
					} else {
						document.getElementById('play').innerHTML += '<div style="text-align: center; font-family: verdana; font-size: 10px; color: #fff;">'+nev+'</div>';
					}
				} else {
					document.getElementById('play').innerHTML = xmlHttpReq.responseText;
				}
			} else {
				document.getElementById('play').innerHTML = 'Hiba a kapcsolatban!';
			}
        	}
	}
	xmlHttpReq.send("kod="+kod);
}

addEvent(window, 'load', overflowautoinit);

