var InitCallbacks = new Array();

function Init() { 
	for( InitFunc in InitCallbacks )
		InitCallbacks[InitFunc]();
}

function SetCookie( c_name, value, exdays ){
	var exdate = new Date(); 
	exdate.setDate( exdate.getDate() + exdays ); 
	
	var c_value = escape( value ) + (( exdays==null ) ? '' : '; expires=' + exdate.toUTCString() ); 
	document.cookie = c_name + '=' + c_value; 
}

function GetCookie( c_name ){
	var i, x, y, ARRcookies = document.cookie.split( ';' ); 
	
	for( i = 0; i < ARRcookies.length; i++ ){
		x = ARRcookies[i].substr( 0, ARRcookies[i].indexOf( '=' ) ); 
		y = ARRcookies[i].substr( ARRcookies[i].indexOf( '=' ) + 1 ); 
		
		x = x.replace( /^\s+|\s+$/g, '' ); 
		
		if( x == c_name )
			return unescape( y ); 
	}
}

function BrowserCheck(){
//	SetCookie( 'HIBC', 'no-check', -5 ); 
	if( GetCookie( 'HIBC' ) != 'no-check' )
		AsyncHTTPRequest( '/include/ns/MKHWBrowserCheck.php', NDAlert )
}

function BrowserCheckResponse(){
	if( document.getElementById( '1' ).checked )
		SetCookie( 'HIBC', 'no-check', 365 ); 
	
	document.getElementById( 'NDAlert' ).style.display = 'none'; 
}

function NDAlert( msg ){
	if( msg.length ){
		document.getElementById( 'NDAlert' ).innerHTML = msg; 
		document.getElementById( 'NDAlert' ).style.display = 'block'; 				
	}
}

// end browser-checking code

/* departments sub-menu */

var DepartmentsVisible = false;

function DepartmentsMenu() {
	DepartmentsVisible = !DepartmentsVisible;
	var Sub = document.getElementById('departments-sub');
	if( DepartmentsVisible )
		Sub.style.display = 'block';
	else
		Sub.style.display = 'none';
}

function DepartmentsHover() {
	var Sub = document.getElementById('departments-sub');
	Sub.style.display = '';
	DepartmentsVisible = false;
}
