
var MOZILLA = (document.getElementById && (! document.all)) ? true:false;

var imgs = new Array();
var moimgs = new Array();

function mouseover_init()
{
	if (! document.getElementById) return;
	
	var mo_imgSrc = new Array();
	var mo_imgHSrc = new Array();
	var mo_imgarr = document.getElementsByTagName('img');
	
	for(var i = 0; i < mo_imgarr.length; i++)
		if(mo_imgarr[i].getAttribute('hsrc'))
		{
			mo_imgSrc[i] = new Image(); mo_imgSrc[i].src = mo_imgarr[i].getAttribute('src');
			mo_imgHSrc[i] = new Image(); mo_imgHSrc[i].src = mo_imgarr[i].getAttribute('hsrc');
			mo_imgarr[i].setAttribute('moid', i);
			mo_imgarr[i].onmouseover = function(){ this.src = mo_imgHSrc[this.getAttribute('moid')].src; }
			mo_imgarr[i].onmouseout = function(){ this.src = mo_imgSrc[this.getAttribute('moid')].src; }
		}
}

function links2blank(mydomain)
{
	for(i = 0; i <= (document.links.length - 1); i++)
	{
		if(document.links[i].hostname.indexOf(mydomain) == -1 && document.links[i].href.indexOf("http:") != -1)
			if(document.links[i].target == "")
				document.links[i].target = "_blank"
	}
}

function brkframe()
{
	if(top.location) { 	if(self != top) top.location = self.location; }
	else { if(parent.location) { parent.location = self.location; } }
}


/**
 * Gets the value of the specified cookie.
 *
 * name  Name of the desired cookie.
 *
 * Returns a string containing value of specified cookie,
 *   or null if cookie does not exist.
 */
function getCookie(name)
{
    var dc = document.cookie;
    var prefix = name + "=";
    var begin = dc.indexOf("; " + prefix);
    var ck;
    if (begin == -1)
    {
        begin = dc.indexOf(prefix);
        if (begin != 0) return null;
    }
    else
    {
        begin += 2;
    }
    var end = document.cookie.indexOf(";", begin);
    if (end == -1)
    {
        end = dc.length;
    }
    ck = dc.substring(begin + prefix.length, end);
    ck = ck.replace(/\+/g, ' ');
    return unescape(ck);
}


function checkform(frm)
{
	var i, l = 0;
	if((! frm) || (! frm.elements) || (! frm.elements.length)) return true;
	l = frm.elements.length;
	for(i = 0; i < l; i++)
	{
		if(frm.elements[i].getAttribute('must') == "1")
		{
			var obj = frm.elements[i];
			var sett = true;
			switch(obj.tagName)
			{
				case 'INPUT':
				case 'TEXTAREA':
					var t = obj.value;
					if((! t) || (t == '') || (t.length == 0)) sett = false;
					break;

				case 'SELECT':
					if(obj.selectedIndex == 0) sett = false;
					break;
			}

			if(! sett)
			{
				alert('Kérem, minden kötelező mezőt töltsön ki!');
				obj.focus();
				return false;
			}
		}
	}
	return true;
}

function gallpopup(gallid)
{
	var wp, winw = 580, winh = 570;
	if(! gallid) return;
	wp = window.open('/galeria.php?id=' + gallid, 'win_gallery', "left=" + ((screen.width - winw) / 2) + ",top=" + ((screen.height - winh) / 2) + ",width=" + winw + ",height=" + winh + ",resizable=no,scrollbars=no,status=no,toolbar=no,location=no,menubar=no,directories=no");
	wp.focus();
}

function popupwin(url, left, top, width, height, resizable, scrollbars, status, toolbar, location, menubar)
{
	var wp;
	if(! url) return;
	if(! width) width = 580;
	if(! left) left = (screen.width - width) / 2;
	if(! height) height = 570;
	if(! top) top = (screen.height - height) / 2;
	if(! resizable) resizable = 'no';
	if(! scrollbars) scrollbars = 'no';
	if(! status) status = 'no';
	if(! toolbar) toolbar = 'no';
	if(! location) location = 'no';
	if(! menubar) menubar = 'no';
	wp = window.open(url, '', "left=" + left + ",top=" + top + ",width=" + width + ",height=" + height + ",resizable=" + resizable + ",scrollbars=" + scrollbars + ",status=" + status + ",toolbar=" + toolbar + ",location=" + location + ",menubar=" + menubar + ",directories=no");
	wp.focus();
}

var blink_state = 1;
function blink()
{
	if(! document.all) return;
	if(! document.getElementById) return;
	if(navigator.appName == "Netscape") return;
	var bla = document.getElementsByTagName('blink');
	for(var i = 0; i < bla.length; i++)
	{
		if(blink_state) bla[i].style.visibility = "hidden";
		else bla[i].style.visibility = "visible";
	}
	if(blink_state) blink_state = 0;
	else blink_state++;
	setTimeout("blink()", 800);
}	
