function iecheck()
{
	var pos = navigator.userAgent.indexOf("MSIE ");
	if (pos == -1) return false;
	var version = navigator.userAgent.substring(pos + 5);
	return (((version.indexOf("5.5") == 0) || (version.indexOf("6") == 0) || (version.indexOf("7")==0) ) && (navigator.platform == ("Win32")));
}


function iepng_alphachannel(imgid,timg,size)
{
	if(iecheck())
	{
		src = document.getElementById(imgid).src;
		document.getElementById(imgid).src = timg;
		document.getElementById(imgid).runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "',sizingMethod='image')";
		document.getElementById(imgid).width = size[0];
		document.getElementById(imgid).height = size[1];
	}
}


function swf_search()
{
	d = document.getElementsByTagName("DIV");
	r = new RegExp("^flash_[0-9]+$");
	for(var i = 0; i<d.length; i++)
	{
		if(r.test(d[i].id))
		{
			path = d[i].innerHTML;
			w = d[i].style.width.replace("px","");
			h = d[i].style.height.replace("px","");
			swf_insert(d[i].id,path,w,h);
		}
	}
}

function swf_insert(to,flash,w,h)
{
	var addflash='';
	addflash+='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="'+w+'" height="'+h+'">';
	addflash+='<param name="movie" value="'+flash+'">';
	addflash+='<param name="quality" value="high">';
	addflash+='</object>';
	if (!iecheck()) {
		addflash+='<object data="'+flash+'" type="application/x-shockwave-flash" width="'+w+'" height="'+h+'">';
		addflash+='<param pluginurl="http://www.macromedia.com/go/getflashplayer">';
		addflash+='<param name="quality" value="high">';
		addflash+='</object>';
	}
	document.getElementById(to).innerHTML=addflash;
}

function galopen(id,kepid)
{
	scrWidth = (screen.availWidth/2)-318;
	scrHeight = (screen.availHeight/2)-225;	
	win = window.open('/templates/kek/process/galeria.php?aid='+id+'&kepid='+kepid,'galeria','width=636,height=450,left='+ scrWidth +',top='+scrHeight);
}

function isempty(str)
{
	r = new RegExp("^[ .*]$");
	return (r.test(str) || str.length == '');
}

function checkValidEmail(mailstr) {
	r = new RegExp("^[0-9a-zA-Z\\._\\-]{2,}@([0-9a-zA-Z_\\-]{2,}\\.){1,7}[a-zA-Z]{2,3}$");
	return r.test(mailstr);
}


function hozza()
{
	if(isempty(document.getElementById('comment').value)) {
		alert("Nem írt hozzászólást!");
	} else {
		document.hozzaszol.submit();
	}
}
