﻿var GUI = (function() {
	function init() {
		MischGuiFixes();
		NavigationSetup();
	}
	
	function MischGuiFixes() {
		$('#lgbgh p a.newwindow').append( $('<img/>').attr('src', 'images/newwindow.gif') );
		$('#lgbgh span.newwindow').append( $('<img/>').attr('src', 'images/newwindow.gif') );
		
		$('#search_header input[name="search_intranet"]').click( 
			function () {
				if( $(this).attr('value') == '[Sök församling]'){
					$(this).attr({ 
						value: ""
					});
				}
			}
		)
		
		$('#search_header input[name="search_personel"]').click( 
			function () {
				if( $(this).attr('value') == '[Sök på sidan]'){
					$(this).attr({ 
						value: ""
					});
				}
			}
		)
		
		if ( $.browser.msie ) {
			$('#mainContent .smallimage').hover (
				function() { $(this).toggleClass('smallhover') },
				function() { $(this).toggleClass('smallhover') }
			);
		}
		
		if ($('#subMenu ul li:last-child').hasClass('activeparent')) {
			$('#subMenu ul li:last-child').addClass('parentlast');
			$('#subMenu ul').addClass('noend');
		}
	}
	
	function NavigationSetup() {
		$('#subMenu li.activeparent').next().addClass('afterActiveparent');
		
		
		
		if ( $.browser.msie ) {
			$('#lgbgh ul > li').hover(
				function() { $(this).toggleClass('hover') },
				function() { $(this).toggleClass('hover') }
			);
		}
	}
	
	return {
		init: init
	}
})();

jQuery(function(){
	GUI.init();
});