
	var savedCountVotes = 0;
	var countEmailBoxes = 3;

	/*** DJ VOTE PLUGIN ***/
	$(document).ready(function()
	{
		/***  VOTE  ***/
		var	maxVotes = 3;
	
		if(!savedCountVotes)
			var countVotes = 0;
		else
			var countVotes = savedCountVotes;

		$("input[type='checkbox'].vote").click(function()
		{
			if($(this).attr("checked") && countVotes < maxVotes)
			{
				countVotes++;
			}
			else if(!$(this).attr("checked") && countVotes > 1)
			{
				countVotes--;
			}
			else if($(this).attr("checked"))
			{
				//alert("Je mag maximaal 3 DJ's selecteren!");
				//return false;
			}
		});
		
		$("label#submit").click(function()
		{
			var errors = $("form.forrmVote").validate({ action:"return" });
			
			countVotes = 0;
			
			$("input.vote").each(function(i)
			{
				if($(this).attr("checked"))
					countVotes++;
			});
					
			if(countVotes < 3)
				errors += "\n - Je moet minimaal 3 dj's selecteren";
			else if(countVotes > 3)
				errors += "\n - Je mag maximaal 3 dj's selecteren";

			if(!errors)
				$("form.forrmVote").submit();
			else
				alert(errors);
		});
		
		
		/***  SEND A FRIEND  ***/
		var	safObj = $("div.sendafriend p").eq(1).clone();
		
		$("a[href*='meer/vrienden']").click(function()
		{
			if($(safObj))
			{
				var	newSafObj = $(safObj).clone();
				var	inputObjCount = 2;

				$(newSafObj).find("input").each(function(i)
				{
					$(this).attr("tabIndex", (((countEmailBoxes*2)+1)+inputObjCount))
					inputObjCount--;
				});
				
				$("div.sendafriend p").eq(countEmailBoxes).after(newSafObj);

				countEmailBoxes++;
				
				return false;
			}
		});
		
		
		$("label#send").click(function()
		{
			var errors = $("form.forrmVote").validate({ action:"return" });

			if(!errors)
				$("form.forrmVote").submit();
			else
				alert(errors);
		});
	});