$(document).ready(function() {
	$('body > #container > #header > div > table > tbody > tr > td > div > form > table > tbody > tr > td > div > div > input').bind('focus', function(e) {
		$(this).parents('body > #container > #header > div > table > tbody > tr > td > div > form > table > tbody > tr > td > div:first').addClass('focused');
	}).bind('blur', function(e) {
		$(this).parents('body > #container > #header > div > table > tbody > tr > td > div > form > table > tbody > tr > td > div:first').removeClass('focused');
	});
	$('body > #container > #header > div > div > ul > li > a').bind('click', function(e) {
		Anamo.Presentation.ContextMenus.ToggleMyContextMenu($(this), e);
		return false;
	});
	$('body > #container > #main > #section > div > div > a').bind('click', function(e) {
		Anamo.Presentation.ContextMenus.ToggleMyContextMenu($(this), e);
		return ($(this).parents('div:first').children('div').length == 0);
	});
	$('body > #container > #main > #section > div > div > div').each(function(intIndex) {
		$(this).css('min-width', $(this).parents('div:first').width()+'px');
	});
	$('body > #container > #header > div > table > tbody > tr > th.apps > table > tbody > tr > td > a').bind('click', function(e) {
		var Element = $(this);
		$(this).effect('transfer', {
			className: 'anamo-ws-movablediv',
			to: 'body'
		}, 700, function() {
			$('body').append('<div class="anamo-ws-movablediv"></div>');
			$('body > .anamo-ws-movablediv').css('border', 'none');
			$('body > .anamo-ws-movablediv').css('width', $('body').width());
			$('body > .anamo-ws-movablediv').css('height', $('body').height());
			window.location = Element.attr('href');
		});
		return false;
	});
	$('body > #container > #header > div > table > tbody > tr > th.apps > table > tbody > tr > th > a').bind('click', function(e) {
		Anamo.Presentation.ContextMenus.ToggleMyContextMenu($(this), e);
		return false;
	});
	$(document).bind('click', function(e) {
		Anamo.Presentation.ContextMenus.SmartHideMenus(e);
	});
	// Application messages.
	Anamo.Presentation.Messages.PreparePHPMessages();
	// Analytics.
	//Anamo.Core.Tracking.InitilizeGoogleAnalytics();
	// IE Fixes.
	if($.browser.msie) {
		// Header search button.
		$('body > #container > #header > div > table > tbody > tr > td > div > form > table > tbody > tr > th > button').replaceWith('<a href="#">'+$('body > #container > #header > div > table > tbody > tr > td > div > form > table > tbody > tr > th > button').html()+'</a>');
		$('body > #container > #header > div > table > tbody > tr > td > div > form > table > tbody > tr > th > a').bind('click', function(e) {
			$(this).parents('form').submit();
			return false;
		});
	}
});
