$(document).ready(function () {
// Shadowbox extension
/*
Shadowbox.init(
{
displayNav: false,
displayCounter: false,
viewportPadding: 1,
skipSetup: true,
troubleElements: ""
});
$("a[rel='shadowbox[Example]']").each(function()
{
$(this).removeAttr('rel');
$(this).removeAttr('title');
$(this).click(function()
{
var LBheight = 510;
var html = '';
html += '
';
html += '
'
html += '
.attr('href') + ')
';
html += '
';
if ($('div#SiteContainer').hasClass('landing') == false)
{
html += '
'
html += '

';
html += '
';
}
else
{
LBheight = 432;
}
html += '
';
Shadowbox.open(
{
content: html,
player: "html",
title: $(this).attr('title'),
height: LBheight,
width: 750
});
return false;
});
});
*/
if ($('div.innerContent select').length > 0)
$('div.innerContent select').selectbox();
// Cufon Button --------------------------------------------------------------------
/*
$('div#Register div.nextStep div.label').prepend('');
$('div#Register div.nextStep div.label a').appendTo('div#Register div.nextStep div.label div.button');
*/
$('div.nextStep').each(function () {
$(this).find('div.label').prepend('');
$(this).find('div.label a').appendTo($(this).find('div.label div.button'));
});
$('div.colourBlock div.button').each(function () {
if ($(this).find('a').length == 0) {
$(this).hide();
}
});
$('div.customForm_Button').not('div.popup div.customForm_Button').each(function () {
$(this).append('');
$(this).find('a').appendTo($(this).find('div.button'));
});
//Landing Page
$('div.landing div.shoppingCart a.justPrint, div.large div.blockCenter a, div.large a.blockFooter').not('div.large div.blockCenter a.endedOverlay').each(function () {
$(this).click(function () {
window.open('/content/print.html?img=' + $(this).attr('href'), 'Print', 'location=0,status=0,scrollbars=0,width=500,height=288'); //1285*740
return false;
});
});
// Cufon fonts ------------------------------------------------------------------------
Cufon.now();
Cufon.set('fontFamily', 'ITC Kabel Std Bold');
Cufon('div#Top3 div.title');
Cufon('div#Cart div.title');
Cufon('div.brandContent div.title');
Cufon($('div#Register div.header h2').not('div.innerContent div#Register div.header h2'));
Cufon.set('fontFamily', 'ITC Kabel Std');
Cufon('div#ContentRight div.large div.product div.productInfo div.productTitle');
Cufon('div#ContentRight div.large div.product div.productInfo div.productDesc');
Cufon.set('fontFamily', 'MetaPlusBold');
Cufon('div.button:not(div.add div.button) a', { textShadow: '1px 1px rgba(0, 0, 0, 0.3)' })
Cufon('body.drvdhoog div.button:not(div.add div.button) a', { textShadow: '1px 1px rgba(225, 255, 255, 1.0)' })
Cufon('body.clearskin div.button:not(div.add div.button) a', { textShadow: '1px 1px rgba(225, 255, 255, 1.0)' })
Cufon('div.add div.button a')
Cufon('div.banner div.bannerTop')
Cufon('div.banner div.list div.item div.itemNr')
Cufon('div.banner div.list div.item div.bannerText')
Cufon('div.banner div.button a', { textShadow: '1px 1px rgba(0, 0, 0, 0.3)' })
Cufon('div#ContentRight div.large div.blockTop div')
Cufon('div.block a.blockFooter')
Cufon.set('fontFamily', 'Hand Of Sean');
Cufon('h1');
Cufon($('h2').not('div#Register div.header h2'));
Cufon('div.innerContent div#Register div.header h2');
//Cufon('div#RegisterBlock div.title');
//Cufon('div.colourBlock div.title');
Cufon.set('fontFamily', 'Caslon Bold Italic'); // DA font
Cufon.set('fontFamily', 'Caslon Bold'); // DA font
Cufon('div.da div.discount div.price');
Cufon('div.da div.discount div.text');
Cufon('div.da div.discount div.priceInfo');
// Input ------------------------------------------------------------------------
/*if ($('div#Login').length > 1)
$('div#Login input[type=text]').each().watermark('E-mail adres');
else
$('div#Login input[type=text]').watermark('E-mail adres');*/
$('div#Register div.houseNr').insertAfter('div#Register div.postalCode');
$('div#Register div.input input[type=text]').each(function () {
var label = $(this).parent().parent().find('div.label span').text();
if ($(this).val() == '')
$(this).val(label);
if ($(this).val() != label)
$(this).addClass('fill')
});
$('div#Register div.input input[type=text]').focus(function () {
if ($(this).hasClass('fill') == true)
return;
$(this).val('');
});
$('div#Register div.input input[type=text]').blur(function () {
var thisLabel = $(this).parent().parent().find('div.label span').text();
if ($(this).val() == '') {
if (thisLabel != 'Tussenvoegsel')
$(this).val(thisLabel);
}
else
$(this).addClass('fill');
});
var errorMessage = '';
$('div#Register div.nextStep a').click(function () {
if (Page_IsValid != false)
$('div#Register div.input input[type=text]:not(.fill)').val('');
/*checkForm();
if (errorMessage != '')
return;*/
});
var myName = $('div.customForm.forward:first input:first').val();
var textarea = $('textarea');
$('div.customForm.forward:first input:first').blur(function () {
if (myName != $(this).val()) {
var newArea = textarea.val();
newArea = newArea.replace(myName, '');
$(this).parents('div.innerContent').find('textarea').val(newArea);
}
if (myName == $(this).val())
return;
myName = $(this).val();
textarea = $(this).parents('div.innerContent').find('textarea');
textarea.val(textarea.val() + myName);
});
function checkForm() {
var postalCode = $('div.postalCode input').val();
var houseNr = $('div.houseNr input').val();
var postalCodeRegex = '^[0-9]{4}\s{0,1}[a-zA-Z]{2}$';
var houseNrRegex = '[0-9]';
if (postalCode.match(postalCodeRegex) != false)
errorMessage += 'De postcode is onjuist \n';
if (houseNr.match(houseNrRegex) != false)
errorMessage += 'Het huisnummer is onjuist \n';
}
// Forward coupons ------------------------------------------------------------------------
$('div.add a').click(function () {
var newFriend = $('div.friends div.friend:first').clone();
newFriend.appendTo('div.friends').addClass('newFriend');
newFriend.find('input:first').val('Naam ontvanger...');
newFriend.find('input:last').val('E-mail adres ontvanger...');
});
// Discount Prices --------------------------------------------------------------------
$('div#ContentRight div.functions div.discount div.price').each(function () {
var price = $(this).text();
if (price.indexOf('/') >= 0) {
price = price.split('/');
var oldPrice = price[0];
price = price[1];
}
price = price.replace(/\,/, '.')
if (price.match(/\./) == '.') {
var splitPrice = price.split('.');
var euro = splitPrice[0];
euro = euro.replace(/\ /g, '');
var cents = splitPrice[1];
var info = $(this).next();
if (info.text() != "") {
// $(this).html('€' + euro + '.' + cents + '');
$(this).html('' + euro + '.' + cents + '');
info.addClass('posUp');
}
else {
$(this).html('' + euro + '.' + cents + '');
//Check old price
if (oldPrice) {
$(this).parent().append('' + oldPrice + '
');
}
}
};
if (price.match(/\%/) == '%') {
var amount = price.split('%');
$(this).html(amount[0] + '%')
};
Cufon.refresh('div.da div.discount div.price');
});
// Sharebuttons --------------------------------------------------------------------
$('div.share').hover(function () {
if ($(this).parents('div.block').hasClass('added') == false)
$(this).addClass('hover');
if ($(this).parent().hasClass('shareButtons'))
$(this).addClass('hover');
var tooltip = $(this).find('div.tooltip');
var tooltipWidth = tooltip.width();
var shareWidth = $(this).width();
tooltipWidth /= 2;
shareWidth /= 2;
tooltipPos = tooltipWidth - shareWidth + 4;
tooltip.css('left', -tooltipPos);
}, function () {
$(this).removeClass('hover');
});
// Content Brand IE6 Fix --------------------------------------------------------------------
$('div#ContentRight div.block').each(function () {
if ($(this).hasClass('added') == true)
$(this).find('div.functions').addClass('added');
});
// Menu --------------------------------------------------------------------
var menuItems = $('div#Menu a');
menuItems.mouseover(function () {
$(this).addClass('hover');
/*var image = $(this).find('img');
var imageSrc = '/content/images/Menu_' + $(this).attr('id') + '_Active.png';
image.attr('src', imageSrc);*/
});
menuItems.mouseout(function () {
$(this).removeClass('hover');
/*var image = $(this).find('img');
var imageSrc = '/content/images/Menu_' + $(this).attr('id') + '.png';
image.attr('src', imageSrc);*/
});
// Dekakorting DIV
if (typeof (dekaKorting) != 'undefined') {
$('body').prepend('');
}
var popup = $('div#PopupMessage');
if (popup.length > 0) {
var html = 'Welkom!
';
html += 'Door samenwerking tussen Kortingisleuk.nl en DekaMarkt kunt u profiteren van nog meer korting. Op deze site kunt u speciale DekaMarkt kortingsbonnen printen die direct bij de kassa korting opleveren! Naast de kortingsbonnen van DekaMarkt kunt u ook nog eens van andere winkelketens kortingsbonnen selecteren en printen..
'
html += '';
popup.html(html);
popup.append('');
popup.css('left', ($(window).width() / 2) - (popup.outerWidth() / 2));
popup.css('top', ($(window).height() / 2) - (popup.outerHeight() / 2));
popup.find('a').click(function () {
$(this).parents('div#PopupMessage').remove();
return false;
});
}
var metaTitle = $('meta[property=og:title]').attr('content');
var metaDescr = $('meta[property=og:description]').attr('content');
var metaUrl = $('meta[property=og:url]').attr('content'); ;
$('div.socialMedia a.social').each(function () {
var linkReplace = $(this).attr("href");
linkReplace = linkReplace.replace('[url]', metaUrl);
linkReplace = linkReplace.replace('[title]', metaTitle);
linkReplace = linkReplace.replace('[description]', metaDescr);
$(this).attr("href", linkReplace);
});
});
function post_to_url(path, params, method) {
$('form').remove(); // Removes the current form to make sure it won't be posted
method = method || "post"; // Set method to post by default, if not specified.
// The rest of this code assumes you are not using a library.
// It can be made less wordy if you use one.
var form = document.createElement("form");
form.setAttribute("method", method);
form.setAttribute("action", path);
form.setAttribute("target", "_self");
for (var key in params) {
var hiddenField = document.createElement("input");
hiddenField.setAttribute("type", "hidden");
hiddenField.setAttribute("name", key);
hiddenField.setAttribute("value", params[key]);
form.appendChild(hiddenField);
}
document.body.appendChild(form); // Not entirely sure if this is necessary
form.submit();
}