$(document).ready( function(){
	
	//First and last childs, lists
	$('ul li:first-child').addClass('fli');
	$('ul li:last-child').addClass('lli');

	//Zebra-striped tables
	$('table.zebra tr:even').addClass('even');

	//Reklame-banner
	$('#rek').cycle({ 
		fx: 'fade', 
		speed: 2500,
		timeout: 8000,
		pause: 1
	});
	
	//Kategori-meny
		//Skjul underkategorier onload
		$("ul#kategorier li:not('.selected') ul").css({ display: "none" });
		$('ul#kategorier li.selected:last').addClass('chosen');

		//Meny-dynamikk
		$("ul#kategorier li a.parent").click( function(){

			if($(this).text() == "Gotisk" || $(this).text() == "MakeUp"){
			
			} else {
				$("ul#kategorier > li a").removeClass("active");
				$(this).addClass("active");

				if($(this).next().css("display") == "none") {
					$(this).next().show("slow");
					return false;
				} else {
					$(this).next().hide("slow");
					return false;
				}
			}
		});
		
	//Rounded corners
	$('h2').corner('10px top');
	$('.box_4').corner('10px bottom');
	$('.box_5').corner('10px bottom');
	$('.alert_box').corner('10px');
	$('.sub_alert_box').corner('10px');
	$('#top_info').corner('10px bottom');
	
	//Label-switcher for forms

	$('form.labelswitch .swl').each( function(){
		
		$(this).prev().hide();
		if($(this).val() == ''){
			$(this).val($(this).prev().text().slice(0, -1));
			if($(this).attr('type') == 'password'){
				//$(this).attr('type', 'text');
			}
		}

	});
	
	$('form.labelswitch .swl').click( function(){
		$(this).val('');
		if($(this).prev().text() == 'Passord:'){
			$(this).attr('type', 'password');
		}
	});
	
	
	$('ul#bestsellers li').click( function(){
		var yo = $(this).children('a').attr('href');
		window.location = yo;
	});
	
});