
// check browser version
var isNC	= (document.layers)?1:0;
var isNC4   = (isNC && parseInt(navigator.appVersion) < 6 ) ? 1 : 0;
var isOPERA = (navigator.userAgent.indexOf('Opera') >= 0)?1:0;
var isIE	= (document.all && !isOPERA)?1:0;
var isDOM	= (document.getElementById && !isIE && !isOPERA)?1:0;
var isWIN	= (navigator.platform == 'Win32')?1:0;
var isMAC	= (navigator.platform == 'MacPPC')?1:0;
if(isNC){ isNC = 0; isDOM = 1; }

// isIE  || isDOM || isOPERA

function site_init()
{
	
}

// tartalom linkek flash vezérléssel
function link(main_url, fomenu, almenu)
{
  top.iframecontent.location = main_url;
  // document.main_swf.SetVariable("_root.all.control_fomenu",fomenu);
  // document.main_swf.SetVariable("_root.all.control_almenu",almenu);
}






function setMainW(newW)
{
    resizes()
}

// ajax content -------------------------------------


function setValue(id, val)
{
	document.getElementById(id).value = val;
}

function MM_openBrWindow(theURL,winName,features)
{
	window.open(theURL,winName,features);
	return false;
}

function MM_openBrWindow2(theURL,winName,features)
{
	window.open(theURL,winName,features);
}

function setValIfVal(obj, val, new_val)
{
	if(obj.value == val) obj.value=new_val;
}

function tr_rollover(trobj, colorto, colorfrom)
{
	trobj.style.background = colorto
	trobj.onmouseout = function(){
	this.style.background = colorfrom
	}
}

function swap_display(id)
{
	s = document.getElementById(id).style;
	if(s.display == 'none') s.display = 'block';
	else  s.display = 'none';
}

function set_display(obj_id, d)
{
	document.getElementById(obj_id).style.display = d;
}


// ajax content -------------------------------------

/* var site_page_get_contents = function(page)
{
	advAJAX.tag_hideInInit = null;
	advAJAX.tag_showLoading = null;
	
	advAJAX.setDefaultParameters({
	    group: "prb_group",
	    onInitialization: function(obj) { obj.tag.style.visibility = ((obj.tag_hideInInit)?"hidden":"visible"); },
	    onLoading: function(obj) { if(obj.tag_showLoading){ obj.tag.innerHTML = '<div style="color: #999999; padding: 0px">Loading...</div>'; obj.tag.style.visibility = "visible"; } },
	    onComplete: function(obj) { if(obj.tag_showLoading){ obj.tag.innerHTML = ''; } },
	    onSuccess: function(obj) { obj.tag.innerHTML = obj.responseText; },
	    onError: function(obj) { obj.tag.innerHTML = obj.status; },
	    onFinalization: function(obj) { obj.tag.style.visibility = "visible"; }
	});
	advAJAX.get({
	    url: site_page_url_prefix +''+ page + '&ajax_site_content_box=right',
	    tag: document.getElementById('right'),
	    tag_hideInInit: false,
	    tag_showLoading: false
	});
	advAJAX.get({
	    url: site_page_url_prefix +''+ page + '&ajax_site_content_box=main',
	    tag: document.getElementById('main'),
	    tag_hideInInit: true,
	    tag_showLoading: true
	});
	document.right_flash.gotoFrame(2);
}
// ------------------------------------------------ */

function symple_form_validate(theForm, elements)
{
	for ( var i in elements )
	{
		if( elements[i] == 'mail_format' )
		{
			var email_addtess = theForm[i].value;
			if ( email_addtess.indexOf('@') == -1 || email_addtess.indexOf('.') == -1 || (email_addtess.length-email_addtess.lastIndexOf('.'))>4 || (email_addtess.length-email_addtess.lastIndexOf('.'))<2 || email_addtess.indexOf('.')==email_addtess.indexOf('@')+1 )
			{
				alert("Az e-mail cím helytelen formárumú");
				return (false);
			}
		}
		else if( elements[i] == 'empty' )
		{
			if ( theForm[i].value == '' )
			{
				alert("Hiányosan adtad meg az adatokat");
				return (false);
			}
		}
	}
	return true;
}

function fmover(obj, level)
{
	// var obj = document.getElementById(id);
	if( level == 3 || level == 4 )
	{
		c1 = '#7FB11F';
		c2 = '#CFE968';
		obj.style.borderBottomColor = c1;
		obj.onmouseout = function() { obj.style.borderBottomColor = c2; }
	}else{
		c1 = '#7FB11F';
		c2 = '#FEE06C';
		obj.style.color = '#FFFFFF';
		obj.style.borderBottomColor = c1;
		obj.style.backgroundColor = c1;
		obj.onmouseout = function()
		{
			obj.style.borderBottomColor = c2;
			obj.style.backgroundColor = c2;
			obj.style.color = '#3D1401';
		}
	}
}

function hmover(id, id2)
{
	var obj = document.getElementById(id);
	var obj2 = document.getElementById(id2);
	// var img = document.getElementById('img_'+id);
	// img.src = "/test/magita/www/images/"+id+"_akt.gif"
	obj.style.background = "url(/test/magita/www/images/hm_bg_over.gif)";
	obj.style.borderLeftColor = '#FAF5E1';
	obj.style.borderRightColor = '#FAF5E1';
	obj2.style.color = '#FFFFFF';
	obj.onmouseout = function()
	{
		// img.src = "/test/magita/www/images/"+id+".gif"
		obj.style.background = "url(/test/magita/www/images/hm_bg_out.gif)";
		obj.style.borderLeftColor = '#F7B700';
		obj.style.borderRightColor = '#F7B700';
		if( id == 'hm_bemutatkozunk' )
		{
			obj.style.borderLeftColor = '#FAF5E1';
		}
		if( id == 'hm_kapcsolat' )
		{
			obj.style.borderRightColor = '#FAF5E1';
		}
		obj2.style.color = '#3D1401';
	}
}


function getImageTop(myImage) {
	// Netscape 4.x call getElementTop(myImage) to get the y co-ordinates
	var y, obj;
	if (document.layers) {
		var img = getImage(myImage);
		if (img.container != null)
			return img.container.pageY + img.y;
		else
			return img.y;
	} else {
		return getElementTop(myImage);
	}
	return -1;
}
function getImageLeft(myImage) {
	// Netscape 4.x call getElementLeft(myImage) to get the x co-ordinates
	var x, obj;
	if (document.layers) {
		var img = getImage(myImage);
    	if (img.container != null)
			return img.container.pageX + img.x;
		else
			return img.x;
  	} else {
		return getElementLeft(myImage);
	}
	return -1;
}
function getElementLeft(Elem) {
	if (isNC4) {
		var elem = getObjNN4(document, Elem);
		return elem.pageX;
	} else {
		var elem;
		if(document.getElementById) {
			var elem = document.getElementById(Elem);
		} else if (document.all){
			var elem = document.all[Elem];
		}
		xPos = elem.offsetLeft;
		tempEl = elem.offsetParent;
  		while (tempEl != null) {
  			xPos += tempEl.offsetLeft;
	  		tempEl = tempEl.offsetParent;
  		}
		return xPos;
	}
}
function getElementTop(Elem) {
	if (isNC4) {
		var elem = getObjNN4(document, Elem);
		return elem.pageY;
	} else {
		if(document.getElementById) {	
			var elem = document.getElementById(Elem);
		} else if (document.all) {
			var elem = document.all[Elem];
		}
		yPos = elem.offsetTop;
		tempEl = elem.offsetParent;
		while (tempEl != null) {
  			yPos += tempEl.offsetTop;
	  		tempEl = tempEl.offsetParent;
  		}
		return yPos;
	}
}
function getObjNN4(obj,name)
{
	var x = obj.layers;
	var foundLayer;
	for (var i=0;i<x.length;i++)
	{
		if (x[i].id == name)
		 	foundLayer = x[i];
		else if (x[i].layers.length)
			var tmp = getObjNN4(x[i],name);
		if (tmp) foundLayer = tmp;
	}
	return foundLayer;
}
