﻿function pageLoad() {
    var hetdomein = $('.jsPath').val();
   //alert(hetdomein);
    maakflash(hetdomein);


        /*** validatie ***/
        $('.validatie_pointer').each(function() {
            active = ($(this).css('display'));
            if (active == "inline") { $(this).parents('p.rij').find('input').addClass('error'); }
        });
        $('input').blur(function() {
            $('.validatie-pointer:hidden').parents('p.rij').find('input').removeClass('error');
            $('.validatie-pointer:visible').parents('p.rij').find('input').addClass('error');
        });
        $('input').focus(function() {
            $('.validatie-pointer:hidden').parents('p.rij').find('input').removeClass('error');
            $('.validatie-pointer:visible').parents('p.rij').find('input').addClass('error');
        });
        $('input[type=submit], #ctl00_ctl00_content_right_lbPayment').click(function() {
            $('.validatie-pointer:hidden').parents('p.rij').find('input').removeClass('error');
            $('.validatie-pointer:visible').parents('p.rij').find('input').addClass('error');
            setTimeout(check, 10);
        });
        /** einde validatie **/

        //breek uit frame
        if (top.location != location) {
            top.location.href = document.location.href;
        }   

}

$('document').ready(function start() {

    //betaalwijzes
    if ($('#betaalwijze-container').length > 0) {
        $('#betaalwijze-container .betaalwijze').click(function() {
            $(this).parents('#betaalwijze-container').find('.betaalwijze').removeClass('selected');
            $(this).addClass('selected');
            $(this).find('input').attr("checked", "checked"); 
        });
    }

});
//einde document ready

    function check() {
             $('.validatie-pointer:hidden').parents('p.rij').find('input').removeClass('error');
             $('.validatie-pointer:visible').parents('p.rij').find('input').addClass('error');
    }
    






function trim(value) {
    value = value.replace(/^\s+/, '');
    value = value.replace(/\s+$/, '');
    return value;
}

function maakflash(url) {
    $('.borisblackbloxx').each(function() {
        var detekst = $(this).text();
        $(this).flash(
			{
			    src: url + 'Flashtext/Borisblackbloxx_20px.swf',
			    width: 520,
			    height: 35,
			    wmode: 'transparent',
			    menu: false,
			    flashvars: { detekst: detekst, kleur: "6DCFF5" }
			}, { update: false }
		);
});

$('.officina').each(function() {
    var detekst = $(this).text();
    $(this).flash(
			{
			    src: url + 'Flashtext/Officina_18px.swf',
			    width: 500,
			    height: 30,
			    wmode: 'transparent',
			    menu: false,
			    flashvars: { detekst: detekst, kleur: "EE4023" }
			}, { update: false }
		);
});


$('.officina-blue').each(function() {
    var detekst = $(this).text();
    $(this).flash(
			{
			    src: url + 'Flashtext/Officina_18px.swf',
			    width: 500,
			    height: 30,
			    wmode: 'transparent',
			    menu: false,
			    flashvars: { detekst: detekst, kleur: "6DCFF5" }
			}, { update: false }
		);
});

$('.officina-white').each(function() {
    var detekst = $(this).text();
    $(this).flash(
			{
			    src: url + 'Flashtext/Officina_18px.swf',
			    width: 500,
			    height: 30,
			    wmode: 'transparent',
			    menu: false,
			    flashvars: { detekst: detekst, kleur: "FFFFFF" }
			}, { update: false }
		);
});



$('.borisblackbloxx,.officina, .officina-blue, .officina-white').css({ 'visibility': 'visible' });
}
//einde maakflash functies





/* gewone alert oproepen */
function maakmodal(titel, text, sluit) {
    var boven_en_onderkant = '<div class="top">&nbsp;</div><div class="bottom">&nbsp;</div>';
    var de_text = '<p class="message">' + text + '</p>';
    if (titel.length > 0) { var de_titel = '<div class="header"><span>' + titel + '</span></div>'; } else { var de_titel = ""; }
    if (sluit == 1) { var sluiten = true; } else { var sluiten = false; }
    $(boven_en_onderkant + de_titel + de_text).modal({ appendTo: 'Form', opacity: 40, position: [, ], close: sluiten });
    // alert('maakmodal functie aangeroepen');
}




/* gewone alert oproepen */
function maakflashmodal(src) {
    iframe = '<iframe src="'+src+'" frameborder="0"></iframe>';
    $(iframe).modal({ appendTo: 'Form',containerId:'flashmodal-container', opacity: 40, position: [, ], close: 1 });
}


// titel, inhoud, sluitknop (bool)
//maakmodal("Vraagje!", "text", "1");

function confirm(title, message, callback) {
    $('#confirm').modal({
        opacity: 10,
        close: false,
        position: [, ],
        overlayId: 'confirmModalOverlay',
        containerId: 'confirmModalContainer',
        onShow: function(dialog) {

            if (message != false) { dialog.data.find('.message').append(message); }
            if (title != false) { dialog.data.find('.popup-title').text(title); }

            dialog.data.find('.yes').click(function() {
                if ($.isFunction(callback)) { callback.apply(); }
                $.modal.close();
            });
        }
    });
}
