// JavaScript Document

function bestelBlad (bladid) {
	actieid = $('#aanbieding' + bladid).html();
	if (actieid != '') {
		new $.nyroModalManual({
			bgColor: '#DFEFEF',
			width: 540,
			height: $(window).height()-32,
			forceType: 'iframe',
			resizeable: true,
			modal: false,
			url: 'https://aboland2.aboportal.nl/frminschrijven.aspx?aktie=' + actieid + '&ss=http://www.aboland.nl/css/formulieren.css'
		});
	}
	else {
		blinkField ($('#aanbiedingopener' + bladid + ' div'))
	}
}

function bestelBlad2 (bladid) {
	actieid = $('#aanbieding' + bladid).html();
	if (actieid != '') {
		parent.frames.formulier_iframe.location.href = 'https://aboland2.aboportal.nl/inschrijven.aspx?aktie=' + actieid + '&ss=http://www.aboland.nl/css/formulieren.css';
		$('.blad_container_detail').hide();
		$('#kop').hide();
		$('#formulier_iframe').show();
	}
	else {
		blinkField ($('#aanbiedingopener' + bladid + ' div'))
	}
}

function openForm (url) {
	new $.nyroModalManual({
		bgColor: '#DFEFEF',
		width: 540,
		height: $(window).height()-32,
		forceType: 'iframe',
		resizeable: true,
		modal: false,
		url: url
	});
}


function openForm2 (url) {
	parent.frames.formulier_iframe.location.href = url;
	$('.blad_container_detail').hide();
	$('#kop').hide();
	$('#formulier_iframe').show();
}

function aanmeldenNieuwsbrief () {
	new $.nyroModalManual({
		bgColor: '#DFEFEF',
		width: 540,
		height: 300,
		forceType: 'iframe',
		resizeable: true,
		modal: false,
		url: 'http://aboland.aboportal.nl/nieuwsbrief.aspx?ss=http://www.aboland.nl/css/formulieren.css'
	});
}

function afmeldenNieuwsbrief () {
	new $.nyroModalManual({
		bgColor: '#DFEFEF',
		width: 540,
		height: 300,
		forceType: 'iframe',
		resizeable: true,
		modal: false,
		url: 'http://aboland.aboportal.nl/nieuwsbriefafmelden.aspx?ss=http://www.aboland.nl/css/formulieren.css'
	});
}

function blinkField (element) {
	element.fadeIn(200).fadeOut(200).fadeIn(200).fadeOut(200).fadeIn(200).fadeOut(200).fadeIn(200);
}

function submitForm (formid) {
	if ($("#" + formid).validate().form()) {
		$('#' + formid).submit();
	}
}

function showAanbiedingen () {
	$('#formulier_iframe').hide();
	$('.hide').show();
	$('.knoppen').hide();
}
