function setobjfocus(objid) 
{
	$obj = document.getElementById(objid);
	$obj.focus();
} //function


function email(email)
{
	var regexp = /#/i;
	em = email.replace(regexp,'@');
	var regexp = /\*/i;
	em = em.replace(regexp,'.');

	top.location = 'mailto:'+em;
}

function regexpreplace(str)
{
	var regexp = /[^0-9]+/i;
	str = str.replace(regexp,'');
	return str;
}

//Az i értéket adja vissza, így nem 0, hanem -1 a fals érték
//A totál üres értékeket figyelmen kívül hagyja: ''
function arrsearch(needle, haystack)
{
	if (needle != '')
	for(ikaxxx=0; ikaxxx < haystack.length; ikaxxx++)
	{
		if (haystack[ikaxxx] == needle)
		{
			return ikaxxx;
		}
	} //for
	
	return -1;
}


function setAttr(objname, attrib, value)
{
	obj = document.getElementById(objname);
	obj.setAttribute(attrib, value);
}

function getAttr(objname, attrib)
{
	obj = document.getElementById(objname);
	var tmp = obj.getAttribute(attrib);

	return tmp;
}
 
function setStyleAttr(objname, attrib, value)
{
	obj = document.getElementById(objname);
	obj.style.setAttribute(attrib, value);
}

function getStyleAttr(objname, attrib)
{
	obj = document.getElementById(objname);
	var tmp = obj.style.getAttribute(attrib);

	return tmp;
}


/*	Get Client dimensions (width and height)*/
function getclientdim()
{
	var dim = new Array();
	
	dim[0] = 0;//width
	dim[1] = 0;//height

	if( typeof( window.innerWidth ) == 'number' ) 
	{
	//Non-IE
	dim[0] = window.innerWidth;
	dim[1] = window.innerHeight;
	}
	else if( document.documentElement &&
	( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) 
	{
	//IE 6+ in standards compliant mode
	dim[0] = document.documentElement.clientWidth;
	dim[1] = document.documentElement.clientHeight;
	} 
	else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) 
	{
	//IE 4 compatible
	dim[0] = document.body.clientWidth;
	dim[1] = document.body.clientHeight;
	} //if

	return dim;
} //function

var size_original_image	= 0;
function imageresize(obj,sizeborder)
{
	objref = obj;

	dim = getclientdim();

	var agent    = navigator.userAgent.toLowerCase();
	var is_ie    = ((agent.indexOf("msie") != -1) && (agent.indexOf("opera") == -1));
	var is_opera = (agent.indexOf("opera") != -1);

    var is_nav   = ((agent.indexOf('mozilla')!=-1) && (agent.indexOf('spoofer')==-1)
                 && (agent.indexOf('compatible') == -1) && (agent.indexOf('opera')==-1)
                 && (agent.indexOf('webtv')==-1) && (agent.indexOf('hotjava')==-1));

	widthwborder = dim[0]-sizeborder;

	if (dim[0])
	//Image not yet resized, and it overflows
	if ( objref.width > widthwborder && size_original_image == 0 )
	{
		size_original_image = objref.width;
		objref.width = widthwborder;
	}
	else if(size_original_image != 0)
	{
		objref.width = size_original_image;
		size_original_image = 0;
	} //if
} //function

//Whether the image overflows, so the pointer must be changed
function imagepointer(obj,sizeborder)
{
	objref = obj;

	dim = getclientdim();

	widthwborder = dim[0]-sizeborder;

	if (dim[0])
	//Image not yet resized, and it overflows
	if ( objref.width > widthwborder && size_original_image == 0 )
	{
		obj.style.cursor = 'pointer';
	} //if
} //function




/*		-------------------------------------		*/
/*		-----------FIND OBJ OFFSET-----------		*/
/*		-------------------------------------		*/

/*
http://www.quirksmode.org/js/findpos.html#


In all other browsers it's necessary to use the offsetTop and offsetLeft of the element. These properties give the coordinates of the element. Of course the question is: coordinates relative to what?

The answer is: relative to the offsetParent. Although the browsers have sharp disagreements on the identity of the offsetParent, we do not really need to know, since the offsetParent property always contains a reference to the correct HTML element.

For instance, Mozilla nearly always gives the offset of an element relative to the entire page, while Opera always gives the offset relative to the containing HTML element. So if you ask for the offsetTop of a link in a P, Mozilla gives the offset relative to the HTML element (= the entire page), while Opera gives the offset relative to the containing P.

However, in all browsers the offsetParent property contains a reference to this element: in Mozilla to the HTML element, in Opera to the P element. Therefore the only thing we need to do is to continue calculating the offset as long as there is an offsetParent. In Mozilla we calculate the offset relative to the HTML element and then stop, since the HTML element doesn't have an offsetParent, while in Opera we continue to go up the entire tree: P, BODY and finally HTML. If we add all offsets we have found, in the end we get the correct position in all browsers.

So you don't need to know the details of the calculation, just continue up the offsetParent tree as long as it exists, and in the end you will have found the true position of the element on the screen.



*/

function findposx(obj)
{
	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		} //while
	}
	else if (obj.x)
		curleft += obj.x;
	return curleft;
}

function findposy(obj)
{
	var curtop = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curtop += obj.y;
	return curtop;
}

//
function findposwidth(obj)
{
	var curtop = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curtop += obj.offsetWidth;
			obj = obj.offsetParent;
		}
	}
	return curtop;
}


/*		-------------------------------------		*/
/*		----------FIND OBJ OFFSET END--------		*/
/*		-------------------------------------		*/
