var tempImg = 1;

// check form on wrong entries
function checkForm(f)
{
	var errorMsg = "";
	
	$('#'+f.id).find('input:text').each(function(){
		
		$(this).css('margin','1px 1px 6px 1px');
		$(this).css('border','none');
		
		if ($(this).val() == "" && $(this).attr('error'))
		{
			// Error message
			errorMsg = $(this).attr('error');

			$(this).css('margin','0px 0px 5px 0px');
			$(this).css('border','1px solid red');
		}
	})
	
	$('#'+f.id).find('textarea').each(function(){
		
		$(this).css('margin','1px 1px 19px 1px');
		$(this).css('border','none');
		
		if ($(this).val() == "" && $(this).attr('error'))
		{
			errorMsg = $(this).attr('error');
			
			$(this).css('margin','0px 0px 18px 0px');
			$(this).css('border','1px solid red');
		}
	})
	
	if (errorMsg)
	{
		alert(errorMsg);
		
		return false;
	}
	
	return true;
}

// Replace big picture on detail page
function changeBigPict(elm)
{
	// Alle afbeeldingen deselecteren
	$('.imageBox').find('li').find('a').attr('class','');
	
	// De geselecteerde donkerder maken
	$('.imageBox').find('#'+elm.id).attr('class','selected');
	
	// Afbeelding wisselen
	$('#bigpict').attr('src',$('.imageBox').find('#'+elm.id).find('img').attr('bigpict'));
	
	tempImg = elm.id
}

// Hover over small images changes the opacity
function hover(elm,type)
{
	$('.imageBox').find('#'+elm.id).attr('class','selected');

	if (type == 'out' && elm.id != tempImg) $('.imageBox').find('#'+elm.id).attr('class','');
	
}
