﻿jQuery.noConflict();
			var $j = jQuery.noConflict();
			
			window.addEvent('domready', function(){
				$$('.area ul li').each(function(li){
					li.addEvent('mouseenter', function() {   
						li.addClass('arealiover');   
					});   
					li.addEvent('mouseleave', function() {   
						li.removeClass('arealiover');   
					});   
				});
			});			
			
			(function($){
				$.fn.swapImage = function() {
					$(this).mouseover(function(event){
						if (this == event.target){
							var data = $(this).metadata();
							$(this).attr("overSrc", $(this).attr("src"));
							$(this).attr("src", data.overSwapSrc);
						};
					});
					$(this).mouseout(function(event){
						if (this == event.target){
							$(this).attr("src", $(this).attr("overSrc"));
						};
					});
					$('.dropdownbutton').mouseover(function(event){
						if (this == event.target){
							
							var data = $('.jSwapNestedImage:last img').metadata();
							var img = $('.jSwapNestedImage:last img')
							img.attr("overSrc", img.attr("src"));
							img.attr("src", data.overSwapSrc);
						}
					});
					$('.dropdownbutton').mouseout(function(event){
						if (this == event.target){
							var img = $('.jSwapNestedImage:last img')
							img.attr("src", img.attr("overSrc"));
						}
					});
					
					return this;
				};
				
				$.fn.swapOnlyImage = function() {
					$(this).mouseover(function(event){
						if (this == event.target){
							var data = $(this).metadata();
							$(this).attr("overSrc", $(this).attr("src"));
							$(this).attr("src", data.overSwapSrc);
						};
					});
					$(this).mouseout(function(event){
						if (this == event.target){
							$(this).attr("src", $(this).attr("overSrc"));
						};
					});
					return this;
				};
				
				$.fn.swapNestedImage = function() {
					$(this).mouseover(function(event){
						if(this == event.target){
							
							var img = $('img', this);
							var data = img.metadata();
							img.attr("overSrc", img.attr("src"));
							img.attr("src", data.overSwapSrc);
						};
					});
					$(this).mouseout(function(event){
						if (this == event.target){
							var img = $('img', this);
							
							img.attr("src", img.attr("overSrc"));
						};
					});
					
					
				};
				
				

			})(jQuery);
			
			(function($){
				$.fn.goToUrlFromSelect = function() {
					currentForm = this;
					$("select", this).bind("change", function(event) {
						currentForm.submit();
					}),
					this.bind("submit", function(event) {
						selectedOption = $(":selected", this);
						window.location = selectedOption.val();
						return false;
					});
					return this;
				};
				
				/*OBS Man SKAL bruge [title] attributten på input feltet*/
				$.fn.removeDefaultInputValue = function(){ 
					//$(this).attr("title",$(this).val()); 
					$(this).bind("focus", function(event) { 
						if ($(this).val() == $(this).attr('title')){ 
							$(this).val(''); 
						} 
					}), 
					$(this).bind("blur", function(event) { 
						if ($(this).val() == ''){ 
							$(this).val($(this).attr('title')); 
						} 
					}); 
					var obj = $(this);
					$(this).parents('form').bind("submit", function(event) {
						if (obj.val() == obj.attr('title')){ 
							obj.val(''); 
						} 
					}); 
					
					return this; 
				}; 

				
				$.fn.addRemoveClass = function(myitem, classtoadd){
					
					$(this).bind("mouseover", function(event){
						$(myitem).addClass(classtoadd);
					}),
					$(this).bind("mouseout", function(event){
						$(myitem).removeClass(classtoadd);
					});
					return this;
				};
				
				$.fn.addRemoveThisClass = function(myitem, classtoadd){
					
					$(this).bind("mouseover", function(event){
						$(this).addClass(classtoadd);
					}),
					$(this).bind("mouseout", function(event){
						$(this).removeClass(classtoadd);
					});
					return this;
				};
				
				$.fn.toggleClassOnClick = function(myitem, classtoadd){
					
					$(this).bind("click", function(event){
						alert($(this));
					});
					return this;
				};
				
				$.fn.boxLink = function(){
					$(this).bind("click", function(event){
						
							window.location = $(this).find('a').attr('href');	
						
					});
				}
				
			})(jQuery);
			
			
			jQuery(function(){
				$j('.pyntmaske').boxLink();
				$j('ul.shortBox li').boxLink();
				$j('.area ul li').boxLink();
				$j('.kontor').boxLink();
				$j('.solidCenter').boxLink();
				$j('.publikationer ul li').boxLink();
				$j('.SwapImage').swapOnlyImage();
				$j('#footerform').goToUrlFromSelect();
				$j("#searchword").removeDefaultInputValue();
				$j("#pubsearchword").removeDefaultInputValue();
				$j("#email").removeDefaultInputValue();
				$j("#afmeld").removeDefaultInputValue();
				$j("#pubsearchword").removeDefaultInputValue();
				$j("#lastsubject").addRemoveClass('#lastsubject .dropdownbutton', 'smallover');
				$j("#stem").addRemoveClass('#stem', 'over');
				$j("#lastsubject .dropdownbutton").addRemoveClass('#lastsubject .dropdownbutton', 'largeover');
				$j("#pub").addRemoveClass('#pub', 'searchbuttonover');
				$j(".searchbutton").addRemoveClass('#searchButton', 'searchbuttonover');
				$j(".searchbuttonUK").addRemoveClass('#searchButton', 'searchbuttonUKover');
				$j("#search").addRemoveClass('#search', 'topsearchover');
				$j(".shortBox li").addRemoveThisClass('.shortBox li', 'boxover');
				$j(".publikationer .largeboxover li").addRemoveThisClass('.publikationer .largeboxover li', 'largeboxover');
				$j(".kontor").addRemoveThisClass('.kontor', 'over');
				$j(".jSwapImage").swapImage();
				$j(".indextext a").toggleClassOnClick('.indextext', 'indextextover');
				$j("#sendEmail").addRemoveClass('#sendEmail', 'over');
				$j("#sendAfmeld").addRemoveClass('#sendAfmeld', 'over');
				$j(document).pngFix(); 
				$j('.dropdownbutton').click(function () {
					var page = $j('.topnavigation').offset();
					var pageleft = page.left + 706;
					var smTopLeft = $j('#topmenu li:first').width() + $j(this).width() + 4;
					var smTopWidth = 666 - smTopLeft;
					$j('#submenu').css({'left': pageleft + 'px', 'top': $j('.righttop').height() + 'px', 'z-index': + '10000'})
					$j('#submenu').slideToggle('normal');
					if($j('#submenu').css('height')!=='1px'){
					$j('#topmenu a:first').focus().blur();
					}
					return false;
				});
				$j('.green .firstchoice a').click(function() {
					$j('#secondgreen').css('display', 'none');
					$j('#firstgreen').css('display', 'inline');
					$j('.green .secondchoice').removeClass('secondchoicechoosen');
					$j('.green .firstchoice').addClass('firstchoicechoosen');
					return false;
				});
				$j('.green .secondchoice a').click(function() {
					$j('#secondgreen').css('display', 'inline');
					$j('#firstgreen').css('display', 'none');
					$j('.green .secondchoice').addClass('secondchoicechoosen');
					$j('.green .firstchoice').removeClass('firstchoicechoosen');
					return false;
				});
				$j('.blue .firstchoice a').click(function() {
					$j('#secondblue').css('display', 'none');
					$j('#firstblue').css('display', 'inline');
					$j('.blue .secondchoice').removeClass('secondchoicechoosen');
					$j('.blue .firstchoice').addClass('firstchoicechoosen');
					return false;
				});
				$j('.blue .secondchoice a').click(function() {
					$j('#secondblue').css('display', 'inline');
					$j('#firstblue').css('display', 'none');
					$j('.blue .secondchoice').addClass('secondchoicechoosen');
					$j('.blue .firstchoice').removeClass('firstchoicechoosen');
					return false;
				});
				
				$j('#print').removeClass('hidden');
				$j('#print').addClass('print');
				
				
			});