var iframeids=["myframe"]
var iframehide="yes"
var getFFVersion=navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1]
var FFextraHeight=parseFloat(getFFVersion)>=0.1? 16 : 0 //extra height in px to add to iframe in FireFox 1.0+ browsers

function resizeCaller() {
var dyniframe=new Array()
for (i=0; i<iframeids.length; i++){
if (document.getElementById)
resizeIframe(iframeids[i])
//reveal iframe for lower end browsers? (see var above):
if ((document.all || document.getElementById) && iframehide=="no"){
var tempobj=document.all? document.all[iframeids[i]] : document.getElementById(iframeids[i])
tempobj.style.display="block"
}
}
}

function resizeIframe(frameid){
var currentfr=document.getElementById(frameid)
if (currentfr && !window.opera){
currentfr.style.display="block"
if (currentfr.contentDocument && currentfr.contentDocument.body.offsetHeight) //ns6 syntax
currentfr.height = currentfr.contentDocument.body.offsetHeight+FFextraHeight; 
else if (currentfr.Document && currentfr.Document.body.scrollHeight) //ie5+ syntax
currentfr.height = currentfr.Document.body.scrollHeight;
if (currentfr.addEventListener)
currentfr.addEventListener("load", readjustIframe, false)
else if (currentfr.attachEvent){
currentfr.detachEvent("onload", readjustIframe) // Bug fix line
currentfr.attachEvent("onload", readjustIframe)
}
}
}

function readjustIframe(loadevt) {
var crossevt=(window.event)? event : loadevt
var iframeroot=(crossevt.currentTarget)? crossevt.currentTarget : crossevt.srcElement
if (iframeroot)
resizeIframe(iframeroot.id);
}

function loadintoIframe(iframeid, url){
if (document.getElementById)
document.getElementById(iframeid).src=url
}

if (window.addEventListener)
window.addEventListener("load", resizeCaller, false)
else if (window.attachEvent)
window.attachEvent("onload", resizeCaller)
else
window.onload=resizeCaller
function windowNew( sAdres, iWidth, iHeight, sTitle, iReturn ){
  if ( !sTitle )
    sTitle = '';
  if( !iReturn )
    iReturn = false;

	if( !iWidth )
		var iWidth = 750;
	if( !iHeight )
		var iHeight = 530;

	if( +iWidth > 750 )
		iWidth = 750;
	else
		iWidth = +iWidth + 40;

	if( +iHeight > 530 )
		iHeight = 530
	else
		iHeight = +iHeight + 40;

	var iX = ( screen.availWidth - iWidth ) / 2;
	var iY = ( screen.availHeight - iHeight ) / 2;

  var refOpen = window.open( sAdres, sTitle, "height="+iHeight+",width="+iWidth+",top="+iY+",left="+iX+",resizable=yes,scrollbars=yes,status=0;" );
  
  if( iReturn == true )
  	return refOpen
}


function windowPhoto( sPhotoAdres, sTitle, sPageUrl, iReturn ){
	if( !sTitle )
		sTitle = 'Photo';
  if( !iReturn )
    iReturn = false;
  if( !sPageUrl )
    sPageUrl = '';

  var refFoto = window.open( sPageUrl + "window.php?p=showPhoto&adresFoto=" + sPhotoAdres + "&sPageTitle=" + sTitle, 'Photo', "heigth=500,width=700,top=20,left=20,resizable=yes,scrollbars=yes,status=0;" );

  if( iReturn == true )
  	return refOpen
}

function windowGallery( iId, iIdLink, iType ){
  var refFoto = window.open( "index.php?p=galleryGalleryShow&iId=" + iId + "&iIdLink="+ iIdLink +"&iType=" + iType, 'Photo', "heigth=500,width=700,top=20,left=20,resizable=yes,scrollbars=yes,status=0;" );
}

function gEBI( objId ){

  return document.getElementById( objId );

}

function fix( f ){
	f	= f.toString( );
	var re	= /\,/gi;
	f	= f.replace( re, "\." );

	f = Math.round( f * 100 );
	f = f.toString( );
	var sMinus = f.slice( 0, 1 );
	if( sMinus == '-' ){
	 f = f.slice( 1, f.length )
	}
	else
	 sMinus = '';
	if( f.length < 3 ) {
		while( f.length < 3 )
			f = '0' + f;
	}

	var w = sMinus + f.slice( 0, f.length-2 ) + "." + f.slice( f.length-2, f.length );

  var poprawnyFloat = /^-?[0-9]{1,}[.]{1}[0-9]{1,}$/i;
	if( w.search( poprawnyFloat ) == -1 )
		w = '0.00';
	return w;

}

_bUa=navigator.userAgent.toLowerCase();
_bOp=(_bUa.indexOf("opera")!=-1?true:false);
_bIe=(_bUa.indexOf("msie")!=-1&&!_bOp?true:false);
_bIe4=(_bIe&&(_bUa.indexOf("msie 2.")!=-1||_bUa.indexOf("msie 3.")!=-1||_bUa.indexOf("msie 4.")!=-1)&&!_bOp?true:false)
isIe=function(){return _bIe;}
isOldIe=function(){return _bIe4;}
var olArray=[];

function AddOnload( f ){
  if( isIe && isOldIe ){
    window.onload = ReadOnload;
    olArray[olArray.length] = f;
  }
  else if( window.onload ){
    if( window.onload != ReadOnload ){
      olArray[0] = window.onload;
      window.onload = ReadOnload;
    }
    olArray[olArray.length] = f;
  }
  else
    window.onload=f;
}

function ReadOnload(){
  for( var i=0; i < olArray.length; i++ ){
    alert( olArray[i] );
    olArray[i]();
  }
}

 function reverse_string(string_in)
 {
  var reversed = '';
  for (var x = string_in.length; x >= 0; x--) reversed += string_in.charAt(x);
  return reversed;
 }
 
 function insert_separator(string_in, separator)
 {
  var tmp = '';
  for (var x = 0; x <= string_in.length; x++)
   if ((x % 3 == 0) && (x != 0) && (x != string_in.length))
    tmp += string_in.charAt(x-1) + separator;
   else
    tmp += string_in.charAt(x-1);

  return tmp;
 }

 function number_format(number, thousand_sep, decimal_sep)
 {
  var tmp = number;
  var tmp2 = '', tmp3 = '';
  var int_part = '', dec_part = '';

  if (tmp.indexOf('.') != -1)
  {
   int_part = tmp.substr(0, tmp.indexOf('.'));
   dec_part = tmp.substr(tmp.indexOf('.')+1);
  }
  else
  {
   int_part = tmp;
   dec_part = '';
  }

  int_part = reverse_string(int_part);
  int_part = insert_separator(int_part, thousand_sep);
  int_part = reverse_string(int_part);

  document.write(int_part);
 }

 function hirlev_cim_ell()
 {
  addr = document.hirlevel_fel_form.emailcim.value;

  if ( (addr.indexOf('@') == -1) || (addr.indexOf('.') == -1) || (addr.indexOf(' ') != -1) || (addr.length < 6) )
  {
   alert('Érvénytelen email cím!');
   document.hirlevel_fel_form.emailcim.focus();
   return false;
  }
  else
  {
   document.hirlevel_fel_form.submit();
  }
 }

 function vizsgal_onfocus()
 {
  if (document.hirlevel_fel_form.emailcim.value == 'email cím') document.hirlevel_fel_form.emailcim.value = '';
 }

 function vizsgal_onblur()
 {
  if (document.hirlevel_fel_form.emailcim.value == '') document.hirlevel_fel_form.emailcim.value = 'email cím';
 }


