function showImage( id ) {
	var logo = document.getElementById( 'logo' + id ) ;
	var photo = document.getElementById( 'photo' + id ) ;
	
	if ( photo.style.display == 'none' ) {
		photo.style.display = 'block' ;
		logo.style.display = 'none' ;
	} else {
		photo.style.display = 'none' ;
		logo.style.display = 'block' ;
	} ;
} ;

window.onload = function() {
	window.__GET() ;
	window.menuType = 'vertical' ;
	window.submenus = new Array() ;
	window.browser = new window.browser() ;
	window.activeMenu = null ;
	window.timer = null ;
	window.zindex = 101 ;
	window.activeTAB = window._searchActiveTab() ;
	
	var _divs = document.getElementsByTagName( 'DIV' ) ;
	
	for ( var i = 0 ; i < _divs.length ; i++ ) {
		if ( _divs[ i ].id.indexOf( 's_' ) == 0 ) {
			window.submenus[ window.submenus.length ] = _divs[ i ].id ;
			window.resizeSubmenu( _divs[ i ].id ) ;
		} ;
	} ;
	
	window._xmin = window.getX( document.getElementById( 'wrapper' ) ) ;
	window._xmax = window._xmin + document.getElementById( 'wrapper' ).offsetWidth ;
	
	return true ;
} ;

function out( event ) {
	var _menu ;
	
	if ( window.activeMenu == null ) {
		return ;
	} ;
	
	window.timer = setTimeout( 'hide()' , 300 ) ;
	
	return false ;
} ;

function hide() {
	if ( window.activeMenu != null ) {
		window.hideSubmenu( window.activeMenu ) ;
		window.activeMenu = null ;
	} ;
	
	clearTimeout( window.timer ) ;
} ;

function over( event ) {
	var _menu = window.getMenu( event ) ;
	
	if ( window.timer != null ) {
		clearTimeout( window.timer ) ;
	} ;
	
	if ( _menu != window.activeMenu ) {
		if ( _menu.id.indexOf( 'h_' ) != -1 ) {
			_menu.number = _menu.id.replace( 'h_' , '' ) ;
			window.showSubmenu( _menu ) ;
		} else {
			_menu.number = _menu.id.replace( 's_' , '' ) ;
			window.showSubsubmenu( _menu ) ;
		} ;
	} ;
	
	return false ;
} ;

function getMenu( event ) {
	if ( window.browser.ie ) {
		return window.event.srcElement ;
	} else {
		return event.currentTarget ;
	} ;
} ;

function showSubmenu( _menu ) {
	if ( _menu.submenu == null ) {
		
		var _thisSubmenu = window.getSubmenu( _menu.number ) ;
		
		if ( _thisSubmenu != null ) {
			_menu.submenu = document.getElementById( _thisSubmenu ) ;
		} ;
	} ;
	
	if ( window.activeMenu != null ) {
		window.hideSubmenu( window.activeMenu ) ;
	} ;
	
	_menu.style.zIndex = window.zindex + 1 ;
	_menu.className += 'Active' ;
	window.activeMenu = _menu ;
	
	if ( _menu.submenu != null ) {
		var _x = window.getX( _menu ) ;
		var _y = window.getY( _menu ) ;
		
		if ( window.menuType == 'vertical' ) {
			_y += _menu.offsetHeight ;
		} else {
			_x += _menu.offsetWidth ;
		} ;
		
		_menu.submenu.style.zIndex = _menu.style.zIndex + 1 ;
		_menu.submenu.style.left = _x + 'px' ;
		_menu.submenu.style.top = _y + 'px' ;
		_menu.submenu.style.visibility = 'visible' ;
	} ;
} ;

function getX( _menu ) {
	var _x = _menu.offsetLeft ;
	
	if ( _menu.offsetParent != null )	{
		_x += window.getX( _menu.offsetParent ) ;
	} ;
	
	return _x ;
} ;

function getY( _menu ) {
	var _y = _menu.offsetTop ;
	
	if ( _menu.offsetParent != null ) {
		_y += window.getY( _menu.offsetParent ) ;
	} ;
	
	return _y ;
} ;

function hideSubsubmenu( _menu ) {
	if ( _menu.activeItem == null ) {
		return ;
	} ;
	
	if ( _menu.activeItem.submenu != null ) {
		window.hideSubsubmenu( _menu.activeItem.submenu ) ;
		_menu.activeItem.submenu.style.visibility = 'hidden' ;
		_menu.activeItem.submenu = null ;
	} ;
	
	_menu.activeItem.className = _menu.activeItem.className.replace( 'Active' , '' ) ;
	_menu.activeItem = null ;
} ;

function hideSubmenu( _menu ) {
	
	_menu.className = _menu.className.replace( 'Active' , '' ) ;
	
	if ( _menu.submenu != null ) {
		window.hideSubsubmenu( _menu.submenu ) ;
		_menu.submenu.style.visibility = 'hidden' ;
	} ;
} ;

function showSubsubmenu( _menu ) {
	var _thisSubmenu = window.getSubmenu( _menu.number ) ;
	var _parentMenu = window.getParentMenu( _menu ) ;
	
	if ( _parentMenu.activeItem != null ) {
		window.hideSubsubmenu( _parentMenu ) ;
	} ;
	
	if ( _thisSubmenu != null ) {
		_parentMenu.activeItem = _menu ;
		_menu.className += 'Active' ;
		
		if ( _menu.submenu == null ) {
			_menu.submenu = document.getElementById( _thisSubmenu ) ;
		} ;
		
		var _x = window.getX( _menu ) + _menu.offsetWidth - 2 ;
		
		if ( ( _x + _menu.submenu.offsetWidth ) > window._xmax ) {
			_x = window.getX( _menu ) - _menu.submenu.offsetWidth + 2 ;
		} ;
		
		var _y = window.getY( _menu ) ;
		
		_menu.submenu.style.zIndex = _parentMenu.style.zIndex + 1 ;
		_menu.submenu.style.left = _x + 'px' ;
		_menu.submenu.style.top = _y + 'px' ;
		_menu.submenu.style.visibility = 'visible' ;
	} else {
		_parentMenu.activeItem = null ;
	} ;
	
	return ;
} ;

function getParentMenu( _menu ) {
	while ( _menu.tagName != null ) {
		if ( ( _menu.tagName == 'DIV' ) && ( _menu.className.indexOf( 'submenu' ) !=-1 ) ) {
			return _menu ;
		} ;
		_menu = _menu.parentNode ;
	} ;
	
	return _menu ;
} ;

function getSubmenu( _id ) {
	for ( var i = 0; i < window.submenus.length; i++ ) {
		if ( window.submenus[ i ].indexOf( 's_' + _id + '_' ) != -1 ) {
			return window.submenus[ i ] ;
		} ;
	} ;
	
	return null ;
} ;

function resizeSubmenu( submenuId ) {
	var _submenu = document.getElementById( submenuId ) ;
	var _divs = _submenu.getElementsByTagName( 'DIV' ) ;
	var _link = null ;
	var _width = 0 ;
	var _paddingRight = 20 ;
	var _paddingLeft = 10 ;
	
	for ( var i = 0; i < _divs.length; i++ ) {
		_link = _divs[ i ].getElementsByTagName( 'A' ) ;
		
		if ( _link[ 0 ].offsetWidth > _width ) {
			_width = _link[ 0 ].offsetWidth ;
		} ;
	} ;
	
	_submenu.style.width = ( _width + _paddingRight + _paddingLeft ) + 'px' ;
	
	for ( var i = 0; i < _divs.length; i++ ) {
		_link = _divs[ i ].getElementsByTagName( 'A' ) ;
		_link[ 0 ].style.height = 20 + 'px' ;
		
		if ( window.browser.ie ) {
			_link[ 0 ].style.width = _submenu.style.width ;
		} else {
			_link[ 0 ].style.width = ( _width + _paddingRight - 2 ) + 'px' ;
		} ;
		
		_link[ 0 ].style.display = 'block' ;
	} ;
	
	return ;
} ;

function browser() { 
	var agt = navigator.userAgent.toLowerCase() ;
	
	// Browser version
	this.major = parseInt( navigator.appVersion ) ;
	this.minor = parseFloat( navigator.appVersion ) ;
	this.nav = ( ( agt.indexOf( 'mozilla' ) != -1 ) && ( ( agt.indexOf( 'spoofer' ) == -1 ) && ( agt.indexOf( 'compatible' ) == -1 ) ) ) ;
	this.nav2 = ( this.nav && ( this.major == 2 ) ) ;
	this.nav3 = ( this.nav && ( this.major == 3 ) ) ;
	this.nav4 = ( this.nav && ( this.major == 4 ) ) ;
	this.navonly = ( this.nav && ( agt.indexOf( ';nav' ) != -1 ) ) ;
	this.ie = ( agt.indexOf( 'msie' ) != -1 ) ;
	this.ie3 = ( this.ie && ( this.major == 2 ) ) ;
	this.ie4 = ( this.ie && ( this.major == 4 ) ) ;
	this.opera = ( agt.indexOf( 'opera' ) != -1 ) ;
	
	// Platform 
	this.win = ( ( agt.indexOf( 'win' ) != -1 ) || ( agt.indexOf( '16bit' ) != -1 ) ) ;
	this.win95 = ( ( agt.indexOf( 'win95' ) != -1 ) || ( agt.indexOf( 'windows 95' ) != -1 ) ) ;
	this.win98 = ( ( agt.indexOf( 'win98' ) != -1 ) || ( agt.indexOf( 'windows 98' ) != -1 ) ) ;
	this.winnt = ( ( agt.indexOf( 'winnt' ) != -1 ) || ( agt.indexOf( 'windows nt' ) != -1 ) ) ;
	this.win32 = this.win95 || this.winnt || this.win98 || ( ( this.major >= 4 ) && ( navigator.platform == 'Win32' ) ) || ( agt.indexOf( 'win32' ) != -1 ) || ( agt.indexOf( '32bit' ) !=-1 ) ;
	this.mac = ( agt.indexOf( 'mac' ) != -1 ) ;
	this.mac68k = this.mac && ( ( agt.indexOf( '68k' ) != -1 ) || ( agt.indexOf( '68000' ) != -1 ) ) ;
	this.macppc = this.mac && ( ( agt.indexOf( 'ppc' ) != -1 ) || ( agt.indexOf( 'powerpc' ) != -1 ) ) ; 
	this.macosx = this.mac && ( agt.indexOf( 'os x' ) != -1 ) ;
} ;


function $_GET( name ) {
	for ( var i = 0; i < window._GET.length; i++ ) {
		if ( window._GET[ i ].length == 2 ) {
			if ( window._GET[ i ][ 0 ] == name ) {
				return window._GET[ i ][ 1 ] ;
			} ;
		} ;
	} ;
	
	return 'na' ;
} ;

function __GET() {
	window._GET = new Array() ;
	var url = location.search.replace( '?' , '' ) ;
	var variables = url.split( '&' ) ;
	
	for ( var i = 0; i < variables.length; i++ )  {
		window._GET[ i ] = variables[ i ].split( '=' ) ;
	} ;
} ;
