	var lastel = null;
	function seterror(el){
		$('#'+el).css('border','1px solid #FF9999');
		$('#'+el).css('backgroundColor','#FFBFBF');
		Elem = document.getElementById(el);
		yPos = eval(Elem).offsetTop;
		//alert( yPos )
		$(document).scrollTo(yPos);
		lastel = el;
	}
	
	function removeerror(el){	
		$('#form-error').remove();
		$('#'+el).css('border','1px solid #D4D3E7');
		$('#'+el).css('backgroundColor','');
		DrawBackground();
	}
	
	function alerd(msg){
		$('#form-error').remove();
		$('#'+lastel).append('<div id="form-error">'+msg+'</div>')
	}
	
	jQuery(function($){
		$.datepicker.regional['nl'] = {clearText: 'Wissen', clearStatus: '',
			closeText: 'Sluiten', closeStatus: '',
			prevText: 'Terug', prevStatus: '',
			nextText: 'Vooruit', nextStatus: '',
			currentText: 'Vandaag', currentStatus: '',
			monthNames: ['Januari','Februari','Maart','April','Mei','Juni',
			'Juli','Augustus','September','Oktober','November','December'],
			monthNamesShort: ['Jan','Feb','Maa','Apr','Mei','Jun',
			'Jul','Aug','Sep','Okt','Nov','Dec'],
			monthStatus: '', yearStatus: '',
			weekHeader: 'Wk', weekStatus: '',
			dayNames: ['Zondag','Maandag','Dinsdag','Woensdag','Donderdag','Vrijdag','Zaterdag'],
			dayNamesShort: ['Zon','Maa','Din','Woe','Don','Vri','Zat'],
			dayNamesMin: ['Zo','Ma','Di','Wo','Do','Vr','Za'],
			dayStatus: 'DD', dateStatus: 'D, M d',
			dateFormat: 'dd-mm-yy', firstDay: 0, 
			initStatus: '', isRTL: false};
		$.datepicker.setDefaults($.datepicker.regional['nl']);
	});
	

	
	$(document).ready(function(){
		//$(".roundcont").corner("10px");
		//$(".round").corner("round 10px")
		$(".roundsucces").corner("round 8px").parent().css('padding', '2px').corner("round 10px");
		$(".rounderror").corner("round 8px").parent().css('padding', '2px').corner("round 10px");
		//$(".round5").corner("5px");

	});	
	
	function toggle(el){
		$("#"+el).toggle("slow");
		$("#"+el).css('backgroundColor','white');
		$("#"+el).css('padding', '5px');
		DrawBackground();
	}
	
	function overimage(el,img){
		el.src = '/nieuw/images/' + img
	}

	function checkinput_nieuwsbrief()
	{
		//email adres controle
		re=/[a-zA-Z0-9\-_]+@[a-zA-Z0-9\-_][a-zA-Z0-9\-_]+\.[a-zA-Z0-9\-_][a-zA-Z0-9\-_]+/;
		if(!document.nieuwsbrief_form.emailadres_nieuwsbrief.value.match(re))
		{
			alert('Vul een geldig emailadres in a.u.b.');
			document.nieuwsbrief_form.emailadres_nieuwsbrief.select();
			return false;
		}
		//alert('U bent nu geabonneerd op onze nieuwsbrief.');
		//document.nieuwsbrief_form.submit();
		return true;
	}
		
	function openwin(src){
		var w = 480, h = 300;
		
		if (document.all) {
		   /* the following is only available after onLoad */
		   w = document.body.clientWidth;
		   h = document.body.clientHeight;
		}
		else if (document.layers) {
		   w = window.innerWidth;
		   h = window.innerHeight;
		}
		
		var popW = 630, popH = 500;
		
		var leftPos = (w-popW)/2, topPos = (h-popH)/2;
		
		var chatwin = window.open(src, 'popup','location=1,resizable=yes,scrollbars=yes,width=' + popW + ',height=' + popH + ',top=' + topPos + ',left=' + leftPos);
		chatwin.focus();
	}
	
	function showsubmenu(id){
		
	}

	
	
	
$(document).ready(function(){  
	$(".round").backgroundCanvas();
});

// Draw the background  on load and resize
$(window).load(function () 
{ 
	DrawBackground(); 
});

$(window).resize(function()
{
	DrawBackground(); 
});

$(window).click(function()
		{
			DrawBackground(); 
		});

function DrawBackground()
{
	$(".round").backgroundCanvasPaint(Demo1BackgroundPaintFkt); 
}



function Demo1BackgroundPaintFkt(context, width, height, canvas, $canvas, $canvasDiv, $content, $element ) 
{
		var options = {x:0, height: height, width: width, radius:14,  border: 0 };
		var backgroundGradient = context.createLinearGradient(0, 0, 0, height - 2);
		backgroundGradient.addColorStop(0 ,'#EEEEFF');
		backgroundGradient.addColorStop(1, '#AAAAFF');
		context.fillStyle = "#9999EF";
		
		// Draw the blue border rectangle 
		$.canvasPaint.roundedRect(context,options);
		
		// Draw the gradient filled inner rectangle
		options.border = 1;
		context.fillStyle = backgroundGradient; 
		$.canvasPaint.roundedRect(context,options);
}	

var aantal_pakketen_int = null;

function hide_all(name){
	
	$('.'+name).toggle();
	update_pakket_aantal();
}

function update_pakket_aantal(){
	var options_count = 0;
	$('.option_box').each(function(){
		if( this.style.display != 'none' )
			options_count++;	
	})
	$('#aantal_pakketen_int').html( options_count );
}

function hide_min_speed(speed){	
	$('.option_box').each(function(){
		$(this).show();
	})
	for(x=0; x < speed;x++){
		$('.downspeed_'+ x).hide();
	}
	update_pakket_aantal();
}

function reposition_things(){

	//get an array of the matching DOM elements   
	var liItems = $(".Tele2").get();

	//iterate through this array in reverse order    
	for(var i = liItems.length - 1; i >= 0; --i){
		//get the html
		var box = $(liItems[i]).html();
		$(liItems[i]).remove();
		//prepend it to the list of packages
		$('#package-list').prepend('<div class="option_box Tele2 downspeed_20">'+ box + '</div>');
	}
	
}

function close_pakket(me){
	$(me).parent().parent().fadeOut('slow', function() {
	    // Animation complete.
		update_pakket_aantal();	
		DrawBackground();
	  });
}

