$.noConflict();

jQuery(document).ready(function($){

	/*carousel*/
	$("#mycarousel").jcarousel({
		scroll:1
	});
	
	$('#sidebar .block a').each(function(){
		$(this).not('.more').append('<span>&nbsp;</span>');
 	});
	
	/*grey beside menu*/
	var menuH = $(".user-panel .menu").height();
	var greyT = 168 - (menuH - 110);
	$(".left-bg").height(menuH);
	$(".left-bg").css("top", greyT);


	jQuery('form.fund-form input.submit').click(function(){ 
		if (jQuery('form.fund-form input:checked').length == 0) {
			alert('Choose at least one artform.'); return false;
		}
	});
	
	setInterval(function(){
		if (jQuery('form.fund-form input:checked').length > 0) {
			jQuery('form.fund-form').removeClass('disabled');
		} else {
			jQuery('form.fund-form').addClass('disabled');
		}
	}, 100);
	
// Remove forms in singleview if empty
	$('.tx-lftilskudsbase-pi1 .block a.more').each(function(){
		if($(this).attr('href').length < 1){
			$(this).remove();
		}
	});
	
// Make items in carousel clickable
	$('.visual>div').each(function(){
		var x = $(this);
		var link = x.find('a:first').attr('href');
		
		x.click(function(){
			//console.log(link);
			window.location = link;
		});
	});
	
	$(".search-form input:text").each(function(){
		var ov = $(this).val();
		
		$(this).focus(function(){
			var fv = $(this).val();
			if (fv == ov) {
  				$(this).val('');
  			}
		});
	
		$(this).blur(function(){
			var bv = $(this).val();
  			if (bv.length < 1) {
  				$(this).val(ov);
  			}
		});
});

	
});
