		$(function () {
			//VARIABEL TIL TIMEREN...
			var loopTimer = {};

			jQuery.changeFocus = function(to) {
				//CLEARER EKSISTERENDE TIMEOUTS, SÃ… DER IKKE OPSTÃ…R DOBBELTE,
				$.clearTimer(loopTimer);
				//VÆLG DET RIGTIGE BILLEDE, FADER OP OG ANDRE NED. (tid=400ms)
				var billede = $("#focus" + to + "");
				billede.fadeTo(400,1);
				var andrebilleder = $("#focuspic div");
				andrebilleder.not(billede).stop().fadeTo(400,0);
				//VÆLG DEN RIGTIGE PIND, ANIMER UD (500ms) OG ANDRE IND (300ms)
				var pind = $("#li" + to + "");
				pind.addClass("focusChosen").removeClass("focusMouse").animate({
					'width' : '460px'
				},500 );
				var andrepinde = $("#focus ul li");
				andrepinde.not(pind).stop().animate({
					'width' : '300px'
				},300 ).removeClass("focusChosen");
				
				//TÆLLER ANTAL MULIGHEDER, FASTSÆTTER NÆSTE AUTOSKIFT OG SÆTTER NY TIMEOUT (5000ms)
				var antal = andrepinde.length;
				var nyFocus = parseInt(to)+1;
				if(nyFocus > antal) { var nyFocus = 1; }
				
				loopTimer = $.timer(5000,"$.changeFocus(" + nyFocus + ")");
			}	
			
			//LAVER ALLE LIer OM TIL KNAPPER MED ID
			$("#focus ul li").click(function() {
				//KALDER CHANGEFOCUS
				var ny = this.id.replace(/li/, "");
				$.changeFocus(ny);
			}).hover(function(){
				$(this).addClass("focusMouse");
			}, function() {
				$(this).removeClass("focusMouse");
			});
			
			//STARTER LOOPET EFTER 5000ms MED AT SKIFTE TIL NR2
			$.changeFocus(1);
			loopTimer = $.timer(5000,"$.changeFocus(2)");
			
			
			//HOVER PÅ BOTTOMRIGHT VIDEOER
			$("#nyeste .brvid").bind("mouseenter",function() {
				$("div.brvidhover",this).css({
					'display' : 'block'
				});
				$(this).addClass("bundon");
			}).bind("mouseleave", function() {
				$("div.brvidhover",this).css({
					'display' : 'none'
				});
				$(this).removeClass("bundon");
			});
			$("#mestsete .brvid").bind("mouseenter",function() {
				$("div.brvidhover",this).css({
					'display' : 'block'
				});
				$(this).addClass("bundon");
			}).bind("mouseleave", function() {
				$("div.brvidhover",this).css({
					'display' : 'none'
				});
				$(this).removeClass("bundon");
			});
			
			//TEXT IN SEARCH
			$("#soegfelt, #fsoegfelt").focus(function() {
				var defvalue=this.defaultValue;
				if(this.value==defvalue) {
					this.value="";
				}
				$(this).css({
					'color' : '#000000'
				});
			}).blur(function() {
				if(this.value=="") {
					this.value = this.defaultValue;
				}
				if(this.value==" ") {
					this.value = this.defaultValue;
				}
				$(this).css({
					'color' : '#a7a7a7'
				});
			});
			
			//BRVID SELECTOR
			$("#nyestemenu a:first, #mestsetemenu a:first").css({
				'background' : 'url("images/brmenusplit.png") no-repeat right top',
				'margin-right' : '3px',
				'color' : '#FFFFFF'
			});
			$("#nyestemenu a, #mestsetemenu a").click(function() {
				$("#mestsetemenu, #nyestemenu").css({ 'display' : 'none'});
				$("" + this.hash + "menu").css({ 'display' : 'block'});
				$("#mestsete, #nyeste").stop().animate({
					'opacity' : '0'
				},500 ).css({ 'display' : 'none'});
				$("" + this.hash + "").stop().animate({
					'opacity' : '1'
				},500 ).css({ 'display' : 'block'});
				return false;
			});
			
			//Grafik Rettelser til IE6 i forb m transperant png
 			if ($.browser.msie) {
 				if (parseInt($.browser.version) == "6") {
 					var ie6="yes";
					$("#loginknap img").attr("src","fileadmin/templates/valgmenighed.tv/images/ie6/loginknapie6.jpg");
				}
			}
			
			//Loginbox
			var swap="off";
			function swaploginbox(denne) {
				if(swap == "off") {
					denne.src='fileadmin/templates/valgmenighed.tv/images/loginknapact.png';
					if(ie6 == "yes") {
						denne.src='fileadmin/templates/valgmenighed.tv/images/ie6/loginknapact.jpg';
					}
					$("#loginbox").css({
						'display' : 'block'
					});
					swap="on";
				}
				else {
					denne.src='fileadmin/templates/valgmenighed.tv/images/loginknapro.png';
					if(ie6 == "yes") {
						denne.src='fileadmin/templates/valgmenighed.tv/images/ie6/loginknapro.jpg';
					}

					$("#loginbox").css({
						'display' : 'none'
					});
					swap="off";
				}
			}
			
			//hover og klik pÅ li undervisningssiden...
			$("#column1 li, #column2 li").mouseover(function() {
				$(this).addClass("ro");
			}).mouseout(function() {
				$(this).removeClass("ro");
			}).click(function() {
				var link = $(this).find("div p a:first").attr("href");
				parent.location=link;
			});
			
			$("#column3 .underviser").mouseover(function() {
				$(this).addClass("on");
			}).mouseout(function() {
				$(this).removeClass("on");
			}).click(function() {
				var link2 = $(this).find("a").attr("href");
				parent.location=link2;
				
			});
			
			
			//Fold "alle-" ud pÃ¥ undervisning
			var more1 = "in";
			var more2 = "in";
			var more3 = "in";
			$("#more1, #more2, #more3").click(function() {
				var id = $(this).attr("id");
				if (id == "more1" && more1 == "in") {
				$(this).stop().animate({
					height: "150px"
				},500).addClass("moreout");
				more1="out"
				} 
				else if (id == "more2" && more2 == "in") {
				$(this).stop().animate({
					height: "150px"
				},500).addClass("moreout");
				more2="out"
				} 
				else if (id == "more3" && more3 == "in") {
				$(this).stop().animate({
					height: "150px"
				},500).addClass("moreout");
				more3="out"
				} 
				else if (id == "more1" && more1 == "out") {
				$(this).stop().animate({
					height: "25px"
				},500).removeClass("moreout");
				more1="in"
				} 
				else if (id == "more2" && more2 == "out") {
				$(this).stop().animate({
					height: "25px"
				},500).removeClass("moreout");
				more2="in"
				} 
				else if (id == "more3" && more3 == "out") {
				$(this).stop().animate({
					height: "25px"
				},500).removeClass("moreout");
				more3="in"
				} 
				
			});
			
			
			$("#infodownload .option").click(function() {
				var sti = $(this).find("a").attr("href");
				parent.location=sti;
				return false;
			}).mouseover(function() {
				$(this).addClass("ho");
				var billede = $(this).find(".imghover");
				billede.css({
					display:'block'
				});

			}).mouseout(function() {
				$(this).removeClass("ho");
				var billede = $(this).find(".imghover");
				billede.css({
					display:'none'
				});
			});
			
			
			$("div .block").mouseover(function() {
				$(this).addClass("ro");
			}).mouseout(function() {
				$(this).removeClass("ro");
			}).click(function() {
				var alreadyopen = $(this).find(".on").attr("class");
				if (alreadyopen == "on hide") {
					$(this).find(".on").removeClass("hide");
				} else {
					$(this).find(".on").addClass("hide");
				}
			});

			$("#infoshare input").focus(function() {
				$(this).select();
			});
			
			
			$("#bottommore .brvid").mouseover(function() {
				$("div.brvidhover",this).css({
					'display' : 'block'
				});
				$(this).addClass("bundon");
			}).mouseout(function() {
				$("div.brvidhover",this).css({
					'display' : 'none'
				});
				$(this).removeClass("bundon");
			}).click(function() {
				parent.location=$(this).find("a").attr("href");
			});
			
			$("#oversigt .oversigtitem").mouseover(function() {
				$(this).addClass("ro");
				$(this).find(".billedcolumn .imghover").css({
					'display' : 'block'
				});
			}).mouseout(function() {
				$(this).removeClass("ro");
				$(this).find(".billedcolumn .imghover").css({
					'display' : 'none'
				});
			}).click(function() {
				parent.location=$(this).find("a").attr("href");
			});
			
			
						
			//HOVER PÃ LOGINKNAP
			$("#loginknap img").mouseover(function() {
				if(swap == "off") {
					$(this).attr("src","fileadmin/templates/valgmenighed.tv/images/loginknapro.png");
					//if(ie6 == "yes") {
					//	$(this).src='fileadmin/templates/valgmenighed.tv/images/ie6/loginknapro.jpg';
					//}
					console.log("test");
				}
			}).mouseout(function() {
				if(swap == "off") {
					$(this).attr("src","fileadmin/templates/valgmenighed.tv/images/loginknap.png");
					//if(ie6 == "yes") {
					//	$(this).src='fileadmin/templates/valgmenighed.tv/images/ie6/loginknap.jpg';
					//}
				}
			}).click(function() {
				swaploginbox(this);
			});
						
			//margin-rettelse til safari
			if ($.browser.safari) {
				$("#fsoegfelt").css({
					'margin-top' : '48px'
				});
 			}
 
		});

