/*==============================*/
/*	Common functions			*/
/*==============================*/
	/**
	 *
	 */
	function goTo(url)
	{
		document.location.href = url;
	}
	
	/**
	 * 
	 */
	var showSubSub = function(id)
	{
		$('.subsubnav').hide();
		
		var o = $('#subsub_'+id).parent().offset();
		
		$('#subsub_'+id).css({'left': '185px', 'marginTop': '-37px'}).fadeIn(200);
	};

/*==============================*/
/*	Document ready functions	*/
/*==============================*/
$(document).ready(function()
{
	//remove border last vacature
	$('#vacatures .vacature:last').css('border', 0);
	
	//determine height #right_content
	if(parseInt($('#left_content').css('height')) > parseInt($('#right_content').css('height')))
		$('#right_content').css('height', $('#left_content').css('height'));
	
	//login action
	$('#fLogin').attr('rel', 'closed');
	$('#login img').click(function()
	{
		if($('#fLogin').attr('rel') == 'closed')
		{
			$('#login').animate({'height': '156px'}, 200);
			
			$('#fLogin').slideDown(200).attr('rel', 'open');
		}
		else
		{
			$('#login').animate({'height': '28px'}, 200);
			
			$('#fLogin').slideUp(200).attr('rel', 'closed');
		};
	});
	
	//fix ie7
	if($.browser.msie && /7.0/.test(navigator.userAgent))
	{
		var kids = $('ul#right_nav').children();
		
		$('#right_content').css('height', ((kids.length * 26) + 300)+'px');
	};
	
	//highlight Egency
	$('h1').each(function()
	{
		var new_text = "";
		
		var text = $(this).text().split(' ');
		
		for(var t = 0; t < text.length; t++)
		{
			if(text[t] == 'Egency' || text[t] == 'egency')
				text[t] = '<span>'+text[t]+'</span>';
			
			new_text = new_text+' '+text[t];
		};
		
		$(this).html(new_text);
	});
	
	//navigation subnav
	$('#top_nav li').hover(function()
	{
		var t = $(this);
		
		t.find('a').css('backgroundPosition', 'left bottom');
		
		t.find('div.subnav').fadeIn(200);

		var o = t.find('a').position();
		
		t.find('div.subnav').css('left', o.left+'px');

	}, function()
	{
		var t = $(this);

		t.find('div.subnav').hide();
		
		t.find('a').css('backgroundPosition', 'left top');	
	});
	
	$('div.subnav').find('a:first').css('borderTop', 'solid 1px #D83460');
});
