//***browsers
var ns4=document.layers;
var ns6=window.navigator.userAgent.toLowerCase().match(/gecko/);
var opera=window.opera;
var ie4=(document.all && !opera);

//*** névtelen új ablak nevéhez:
var wnow = new Date(); 
var wszam = wnow.getTime();

///////////////////////////////
var honlap="www.elastic91.hu";
///////////////////////////////

//********
var pop_div_tohide =new Array;
//********

//*** kezelői ablak
function a()
{
	window.open('adm','mywin_elastic91');
}


//****** link image ****
function imgover(imgname)
{
	var img_on = new Image;
	img_on.src  = "img/on.gif";
	imgname.src = img_on.src ;
}
function imgout(imgname)
{
	var img_off = new Image;
	img_off.src  = "img/off.gif";
	imgname.src = img_off.src ;
}


/////////////////////////////////////////////////////////////////////
//***** hasznos képernyő méret
var sw,sh;

if( (opera||ns4) && (typeof( window.innerWidth ) == 'number'))
{
	if(opener)
	{
		sw = window.opener.innerWidth;
		sh = window.opener.innerHeight;
		//alert('Nem IE opener ' +sw+' * '+sh);
	}
    		
	else if(window.parent)
	{
		sw = window.parent.innerWidth;
		sh = window.parent.innerHeight;
		//alert('Nem IE window.parent ' +sw+' * '+sh);
	}

	else
	{
		sw = window.innerWidth;
		sh = window.innerHeight;
		//alert('Nem IE ' +sw+' * '+sh);
	}
}
else
{
	sw=window.screen.width;
	sh=window.screen.height;
	//alert('IE ' +sw+' * '+sh);
}

////////////////////////////////////////////////////////////////////

//*****Resize opera és ns4 *****
function reload_opera_ns4(init,sw,sh)
{
	if (init==true)
	{
		if (ns4)
		{
    			document.pgW=sw;
    			document.pgH=sh;
    			onresize=reload_opera_ns4;
    		}
	}
	else if (sw!=document.pgW || sh!=document.pgH)
	{
		location.reload()
	}
}//end func reload_opera_ns4

reload_opera_ns4(true,sw,sh);

////////////////////////////////////////////////////////////////////

//***NewWin*********************
//mb=1 ->menubar=yes
function NewWin(url,w,h,mb,a)
{
	if(!mb){mb=1}
	if(!a){a=0}

	if(opera)
 	{
 		if(sw<=w){sw=w;}
 		if(sh<=h){sh=h;}
 	}
 
	var MX = (sw) ? (sw-w)/2 : 0;
	var MY = (sh) ? (sh-h)/2 : 0;

	if(a==1)
	{
		if(confirm('Ön most elhagyja a ' + honlap + ' honlapot!'))
		{
			var SW = window.open(url,"NewWin"+wszam,"height="+h+",width="+w+",left="+MX+",top="+MY+",screenX="+MX+",screenY="+MY+",menubar="+mb+",resizable=1,scrollbars=1");
			SW.focus();
		}
	}
	else
	{
		var SW = window.open(url,"NewWin"+wszam,"height="+h+",width="+w+",left="+MX+",top="+MY+",screenX="+MX+",screenY="+MY+",menubar="+mb+",resizable=1,scrollbars=1");
		SW.focus();
	}
}//end func

//***********
function elevel(c1,c2){
document.location.href="mailto:"+c1+"@"+c2;
}

//*****Enter tiltása********
function handleEnter (field, event)
{
	var validity=true;
	var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
	if (keyCode == 13)
	{
		var i, j;
		for (j = 0; j < field.form.elements.length; j++)
		{
			if (field == field.form.elements[j])
			{
				break;
			}
		}	
		for (i = (j+1); i < field.form.elements.length; i++)
		{
			with(field.form.elements[i])
			{
				//alert(name);
				if(type=="hidden" || disabled==true || style.display=="none" || style.visibility=="hidden" || type=='checkbox')				
				{
					continue;
				}
				else
				{
					focus();
					return false;
				}
			}
		}
	} 
	else
	{
		validity=true;
	}
	return	validity;
}   


//***flash********
function CreateControl_flash(DIVID, CLASSID, CODEBASE, OBJECTID, WIDTH, HEIGHT, MOVIE, LOOP, WMODE)
{
 if(!ns4)
 {
   document.write('<div id="' + DIVID + '">xxx</div>');
   if(ie4)
   {
	var obj= '<object classid="' + CLASSID + '" ';
	obj += 'codebase="' + CODEBASE + '" ';
	obj += 'id="' + OBJECTID + '" ';
	obj += 'width="' + WIDTH + '" ';
	obj += 'height="' + HEIGHT +'" >';
	
	obj += '<param name="movie" value="' + MOVIE + '" />';
	obj += '<param name="quality" value="high" />';
	obj += '<param name="loop" value="' + LOOP + '" />';
	obj += '<param name="wmode" value="' + WMODE + '" />';
	obj += '</object>';
   }
   else
   {
	var obj= '<object data="' + MOVIE + '" ';
	obj += 'id="' + OBJECTID + '" ';
	obj += 'width="' + WIDTH + '" ';
	obj += 'height="' + HEIGHT + '" ';
	obj += 'type="application/x-shockwave-flash" >';
	obj += '<param name="quality" value="high" />';
	obj += '<param name="loop" value="' + LOOP + '" />';
	obj += '<param name="wmode" value="' + WMODE + '" />';
	obj += '<param name="pluginurl" value="http://www.macromedia.com/go/getflashplayer" />';	
	obj += '</object>';
   }
   document.getElementById(DIVID).innerHTML=obj;
 }
}

//*****************
function addLoadEvent(func)
{
  var oldonload = window.onload;
  if (typeof window.onload != 'function')
  {
    window.onload = func;
  }
  else
  {
    window.onload = function()
    {
      if (oldonload)
      {
        oldonload();
      }
      func();
    };
  }
}

//*****************
function toggleBottomElements(table, BottomElementsDiv)
{
	var tableTop=getY(document.getElementById(table));
	var tableHeight=document.getElementById(table).offsetHeight;
	var helyigeny=(tableHeight+tableTop);

	var myHeight = 0;
	if( typeof( window.innerHeight ) == 'number' )//Non-IE
	{
		myHeight = window.innerHeight;
	}
	else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) )//IE 6+ in 'standards compliant mode'
	{
		myHeight = document.documentElement.clientHeight;
	}
	else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) )//IE 4 compatible
	{
		myHeight = document.body.clientHeight;
	}

	if(helyigeny>myHeight)
	{
		document.getElementById(BottomElementsDiv).style.display='block';
	}
	else
	{
		document.getElementById(BottomElementsDiv).style.display='none';
	}
}//end func

//******
function getY(oElement)//get top position of an element...
{
	var iReturnValue = 0;
	while( oElement != null )
	{
		iReturnValue += oElement.offsetTop;
		oElement = oElement.offsetParent;
	}
	return iReturnValue;
}

//************************

function opDiv(ID,state)
{
	//alert(state);
	
	var o;
	if(document.getElementById)
	{
		o=document.getElementById(ID);
	}
	else if(document.all)
	{
		o=document.all[ID];
	}
	else
	{
		return;
	}
	if(state=="on")
	{
		o.className='opdivon';
	}
	else if(state=="out")
	{
		o.className='opdiv';
	}
	else
	{
		return;
	}
}


/*
function opDiv(o,state)
{
	//alert(o);

	if(state=="on")
	{
		o.className='opdivon';
	}
	else if(state=="out")
	{
		o.className='opdiv';
	}
	else
	{
		return;
	}
}
*/

