
hb_vacancies = {

	open_menu: function( id ){

		var content = document.getElementById('content-text');
		var menu = document.getElementById('menu-' + id);
		var inner_menu = document.getElementById('inner-menu');
		
		if( inner_menu != null && menu != null && content != null &&
		   	typeof(window.content_text) != 'undefined' && typeof(window.content_text[id]) != 'undefined' ){
			
			content.innerHTML = window.content_text[id]; //decodeURIComponent( window.content_text[id] );
			
			var a = inner_menu.getElementsByTagName('a');
			for( i = 0; i < a.length; ++i ){
				a[i].className = '';
			}
			
			menu.className = 'active';
		}
	},

	open_area: function( id ){
		
		var location_content = document.getElementById('location-content');
		var area_info = document.getElementById('area-info');
		var location = document.getElementById('location');
		var step2 = document.getElementById('step2');
		
		if( typeof(window.vacancies) != 'undefined' && 
			location_content != null && area_info != null && location != null && step2 != null ){			
				if( id == '-1' ){ 
					step2.style.display = 'none';
					return false;
				}
				
				area_info.innerHTML = decodeURIComponent( window.vacancies[ id ]['1'].description );
				location_content.innerHTML = '';
	
				for( i = 0; i < window.vacancies[ id ]['1'].length; ++i ){
					var p = document.createElement('p');
					var checkbox = document.createElement('input');
					var textnode = document.createTextNode(' ' + decodeURIComponent(window.vacancies[ id ]['2'][i]));
					
					checkbox.type = 'checkbox';
					checkbox.name = 'locations[]';
					checkbox.value = window.vacancies[ id ]['2'][i];
					
					p.appendChild( checkbox );
					p.appendChild( textnode );
					location_content.appendChild( p );				
				}
				
				step2.style.display = 'block';
		}
	}
	
}
