
function BrowserCheck(){ 
  this.ver    = navigator.appVersion;
  this.agent  = navigator.userAgent;
  this.dom    = document.getElementById? 1 : 0;
  this.opera5 = this.agent.indexOf("Opera 5") > -1;
  this.opera6 = this.agent.indexOf("Opera 6") > -1 || this.agent.indexOf("Opera/6") > -1;
  this.opera  = ( this.opera5 || this.opera6 );
  this.ie4    = ( document.all && !this.dom && !this.opera )?1:0;
  this.ie5    = ( this.ver.indexOf("MSIE 5.0") > -1 && this.dom && !this.opera ) ? 1 : 0; 
  this.ie55   = ( this.ver.indexOf("MSIE 5.5") > -1 && this.dom && !this.opera ) ? 1 : 0; 
  this.ie6    = ( this.ver.indexOf("MSIE 6" )  > -1 && this.dom && !this.opera ) ? 1 : 0;
  this.ie7    = ( this.ver.indexOf("MSIE 7" )  > -1 && this.dom && !this.opera ) ? 1 : 0;
  this.ie8    = ( this.ver.indexOf("MSIE 8" )  > -1 && this.dom && !this.opera ) ? 1 : 0;
  this.ie     = this.ie4 || this.ie5 || this.ie55 || this.ie6 || this.ie7 || this.ie8;
  this.ns4    = ( document.layers && !this.dom ) ? 1 : 0;
  this.moz5   = ( this.dom && !this.opera && !this.ie && parseInt(this.ver) >= 5 ) ? 1 : 0;
  this.ns6    = ( this.agent.indexOf("Netscape6") > -1 ) ? 1 : 0;
  this.moz    = ( !this.ns6 ) ? 1 : 0;
  this.mac    = this.agent.indexOf("Mac") > - 1;
  this.ns     = ( this.ns4 || this.ns6 );
  this.bs     = this.ie4 || this.ie5 || this.ie55 || this.ie6 || this.ie7 || this.ie8 || this.ns4 || this.moz5 || this.opera;
  this.min    = ( this.ie8 || this.ie7 || this.ie6 || this.ie55 );
  return this
}

/***        globális változók        ***/
var is               = new BrowserCheck() // Browsercheck
var page_item        = new Array()        // a tartalmak tombje
var loaded           = false;             // betoltodesre igazza valik
var process          = false              // a folyamatok tiltasa
var item_num         = 3;
var img_id           = null;
var page             = null;
var openNewWindow    = null;

/***          inicializacio         ***/
function Init() {
	if ( !is.bs ) return false;
	if ( is.ie ) { 
		if ( document.getElementById("skipintro") ) {
			document.getElementById("skipintro").style.visibility = "hidden";
		}
	}
	var i = 1;
	page_item[i] = new PageItemCons( 'Menu' + i, 'page_item[' + i + ']' );
	page_item[i].x = ( left_division + ( i * 95 ) - 47 - ( Math.floor( page_item[i].width / 2 ) ) );
	page_item[i].css.left = page_item[i].x;
	page_item[i].css.zIndex = 1;

	/*i = 3;
	page_item[i] = new PageItemCons( 'Menu' + i, 'page_item[' + i + ']' );
	page_item[i].x = ( left_division + ( i * 95 ) - 47 - ( Math.floor( page_item[i].width / 2 ) ) );
	page_item[i].css.left = page_item[i].x;
	page_item[i].css.zIndex = 1;*/

	i = 4;
	page_item[i] = new PageItemCons( 'Menu' + i, 'page_item[' + i + ']' );
	page_item[i].x = ( left_division + ( i * 95 ) - 47 + 24 - ( Math.floor( page_item[i].width / 2 ) ) );
	page_item[i].css.left = page_item[i].x;
	page_item[i].css.zIndex = 1;

	i = 5;
	page_item[i] = new PageItemCons( 'Menu' + i, 'page_item[' + i + ']' );
	page_item[i].x = ( left_division + ( i * 95 ) - 47 + 24 - ( Math.floor( page_item[i].width / 2 ) ) );
	page_item[i].css.left = page_item[i].x;
	page_item[i].css.zIndex = 1;

	loaded = true
	
	//if ( openNewWindow != null ) {
	//	eval( openNewWindow );
	//}
	
	OpenFlashWindows()

	//var MenuSubSubInit = new Array('biztonsagtechnika', 'biztonsagtechnika2', 'biztonsagtechnika3')
	for ( var i = 0; i < MenuSubSubInit.length; i++ ) {
		SubSubMenu( MenuSubSubInit[i] )
	}

}
onload = Init


/***          konstruktorok         ***/
function PageItemCons( id, touto ) {
	this.id        = id;
	this.touto     = touto;
	this.css       = ( is.dom ) ? document.getElementById(id).style : ( is.ie4 ) ? document.all[id].style : ( is.ns4 ) ? eval( "document.layers." + id ) : null ;
	this.ref       = ( is.ns4 ) ? eval( 'document.'+id+'.document') : document;
	this.height    = ( is.ns4 ) ? this.ref.height : document.getElementById(id).offsetHeight;
	this.width     = ( is.ns4 ) ? this.ref.width : document.getElementById(id).offsetWidth;
	this.x         = ( is.ns4 ) ? this.css.left : this.css.pixelLeft || document.getElementById(id).offsetLeft;
	if ( is.ie ) document.getElementById(id).style.filter = 'progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)';
		else if ( is.ie5 || is.ie4 ) document.all[id].style.filter = 'alpha(opacity=0)';
	this.alpha     = ( is.min ) ? document.getElementById(id).filters.item("DXImageTransform.Microsoft.Alpha") : ( is.ie4 || is.ie5 ) ? document.all[id].filters.alpha : null ;
	this.AlphaShow = ( is.min ) ? F_AlphaShow : null;
	this.AlphaHide = ( is.min ) ? F_AlphaHide : null;
	this.ShowIt    = F_ShowIt;
	this.HideIt    = F_HideIt;
	this.idozites  = null;
	this.clear     = F_Clear;
	return this
}


/***          vezerles         ***/
function SubSubMenu( _className ) {
	if ( !( is.ie || is.moz5 ) ) return false;
	var myTags = document.getElementsByTagName( 'TR' );
	var myFlag = '';
	if ( myTags ) {
		for ( var i = 0 ; i < myTags.length ; i++ ) {
			if ( myTags[i].className == _className ) {
				myFlag = myTags[i].style.display;
				break;
			}
		}
		for ( var i = 0 ; i < myTags.length ; i++ ) {
			if ( myTags[i].className == _className ) {
				if ( myFlag != 'none' ) { 
					myTags[i].style.display = 'none';
				}
				else {
					if ( is.ie )   myTags[i].style.display = "block";
					if ( is.moz5 ) myTags[i].style.display = "table-row";
				}
			}
		}
	}
}


function LayerShowSub( aktual_layer_item, num ) {
	if ( !loaded ) return false;
	clearTimeout( img_id )
	if ( num != null ) page_item[aktual_layer_item].ref.images["MA"+aktual_layer_item+"_"+num].src = imgexMenuAl[aktual_layer_item][num].src;
	imgover ( aktual_layer_item - 1 )
	page_item[aktual_layer_item].css.zIndex = 2;
	page_item[aktual_layer_item].clear()
	if ( is.min ) {
		page_item[aktual_layer_item].AlphaShow();
	} else {
		page_item[aktual_layer_item].ShowIt();
	}
}

function LayerHide( aktual_layer_item, num ) {
	if ( !loaded ) return false;	

	if ( num || num == 0 ) page_item[aktual_layer_item].ref.images["MA"+aktual_layer_item+"_"+num].src = imgunMenuAl[aktual_layer_item][num].src;
	img_id = setTimeout( 'imgout( '+( aktual_layer_item - 1 )+' )',10)
	page_item[aktual_layer_item].css.zIndex = 1;
	if ( page != 1 || ( page == 1 && is.ie ) ) {
		if ( is.min ) {
			page_item[aktual_layer_item].AlphaHide()
		} else {
			page_item[aktual_layer_item].idozites = setTimeout( 'page_item['+aktual_layer_item+'].HideIt()',100)
		}
	}
}

function LayerShow( aktual_layer_item ) {
	if ( !loaded ) return false;
	imgover ( aktual_layer_item - 1 )
	page_item[aktual_layer_item].css.zIndex = 2;
	if ( page != 1 || ( page == 1 && is.ie ) ) {
		if ( page_item[aktual_layer_item].idozites != null ) {
			page_item[aktual_layer_item].clear()
		}
		if ( is.min ) {
			page_item[aktual_layer_item].AlphaShow()
		} else {
			page_item[aktual_layer_item].ShowIt();
		}
	}
}


/***          segedfunckciok         ***/
function OpenFlashWindows() {
	var i, j, aWindows = [];
	aIds = ['my_flash_system', 'my_flash_internet', 'my_flash_behatolas' ]
	aWindows = ["NewWindow('popup_diagramm.php?select=sss','Noreg',700,460,'no')", "NewWindow('popup_diagramm.php?select=is','Noreg',700,470,'no')", "NewWindow('popup_diagramm.php?select=rs','Noreg',700,470,'no')" ]

	for ( i = 0; i < aIds.length ; i++ ) {
		if ( document.getElementById( aIds[i] ) ) {
			eval( aWindows[i] )
		}
	}
	if ( is.moz5 ) {
		for ( i = 0 ; i < document.embeds.length ; i++ ) {
			for ( j = 0; j < aIds.length ; j++ ) {
				if ( document.embeds[i].id == aIds[j] ) {
					eval( aWindows[j] )
				}
			}
		}
	}
}

function PauseFlash() {
	if ( document.getElementById('my_flash') ) {
	document.getElementById('my_flash').Playing = "false";
	}
	if ( document.getElementById('my_flash_flowchart') ) {
	document.getElementById('my_flash_flowchart').Playing = "false";
	}
}
function PlayFlash() {
	if ( document.getElementById('my_flash') ) {
	document.getElementById('my_flash').Playing = "true";
	}
	if ( document.getElementById('my_flash_flowchart') ) {
	document.getElementById('my_flash_flowchart').Playing = "true";
	}
}

function F_Clear() {
	clearTimeout( this.idozites )
	this.idozites = null
}

function F_AlphaHide() {
	if ( this.alpha.opacity > 0 ) {
		PauseFlash()
		this.clear()
		this.alpha.opacity -= 20;
		this.idozites = setTimeout( this.touto+'.AlphaHide()',5)
	}
	else {
		this.idozites = null
		this.HideIt()
		PlayFlash()
	}
}

function F_AlphaShow() {
	if ( this.alpha.opacity < 100 ) { 
		PauseFlash()
		this.ShowIt()
		this.alpha.opacity += 20
		this.idozites = setTimeout( this.touto+'.AlphaShow()',5)
	}
	else {
		this.idozites = null
		this.ShowIt();
		PlayFlash()
	}
}

function F_ShowIt() { this.css.visibility = "visible" }
function F_HideIt() { this.css.visibility = "hidden" }

function imgover ( num ) {
  document.images["M"+num].src = imgexMenu[num].src;
}

function imgoverAl ( aktual_layer_item, num ) {
  page_item[aktual_layer_item].ref.images["MA"+aktual_layer_item+"_"+num].src = imgexMenuAl[aktual_layer_item][num].src;
}

function imgout ( num ) {
  document.images["M"+num].src = imgunMenu[num].src;
}

function imgoutAl ( aktual_layer_item, num ) {
  page_item[aktual_layer_item].ref.images["MA"+aktual_layer_item+"_"+num].src = imgunMenuAl[aktual_layer_item][num].src;
}



