$(document).ready(function(){
			//Examples of how to assign the ColorBox event to elements
			$(".tipsenvenn").colorbox({width:"500px",opacity:'0', inline:true, href:"#inline_example1"});

		
			//Default Action
			$(".gws-element-attributTable").hide(); //Hide all content
			$("ul#attributTableMenu li:first").addClass("active").show(); //Activate first tab
			$(".gws-element-attributTable:first").show(); //Show first tab content
			
			//On Click Event
			$("ul#attributTableMenu li").click(function() {
				$("ul#attributTableMenu li").removeClass("active"); //Remove any "active" class
				$(this).addClass("active"); //Add "active" class to selected tab
				$(".gws-element-attributTable").hide(); //Hide all tab content
				var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
				$(activeTab).show(); //Fade in the active content
				return false;
			});
		

			$('#searchStr').each(function(){
				this.focus();
			});
			
			$('#searchStr').each(function(){
				this.focus();
			});
			
			//Delete content of newsletter input
			$('.gws-component-newsletter input').focus(function(){
				if($(this).attr("value") == "For- og etternavn" || $(this).attr("value") == "E-postadresse"){
				
					$(this).attr("value","");
				}
			});
			
			$('.gws-component-newsletter input[class="inputTextName"]').blur(function(){
				if($(this).attr("value") == ""){
					$(this).attr("value", "For- og etternavn");
				}
			});
			
			$('.gws-component-newsletter input[class="inputTextMail"]').blur(function(){
				if($(this).attr("value") == ""){
					$(this).attr("value", "E-postadresse");
				}
			});
			
			
			$('#gws-page-productDetailStudieHoyere .gws-element-productPurchase a').click(function(){
				if($('#valgteKurs .active').size() == 0){
					return false;
				}
			});

			
		});
		
		
		function addCommas(nStr){
			nStr += '';
			x = nStr.split('.');
			x1 = x[0];
			x2 = x.length > 1 ? '.' + x[1] : '';
			var rgx = /(\d+)(\d{3})/;
			while (rgx.test(x1)) {
				x1 = x1.replace(rgx, '$1' + '.' + '$2');
			}
			return x1 + x2;
		}

		
		function externalLinks() {  
			if (!document.getElementsByTagName) return;  
		 	var anchors = document.getElementsByTagName("a");  
		 	for (var i=0; i<anchors.length; i++) {  
		   		var anchor = anchors[i];  
		   		if (anchor.getAttribute("href") &&  anchor.getAttribute("rel") == "external")  {
			  	 	anchor.target = "_blank";  
			   	}
		 	}  
		}  
		
		window.onload = externalLinks;
		
		function purchase(id){
			document.getElementById(id).submit()
		}
