var basedir = "https://fotofocusvoorburg.snappicapp.nl/"
function controleerActiecodeCallBack(call)
{
if (call.notificationOrError == "ok")
{
//gelukt, winkelmand refreshen
redirectSamePage();
}
else
{
alertJsonError(call);
}
}
function controleerActiecodeFotoBestelling()
{
controleerActiecode('foto_bestellen_module');
}
function controleerActiecodeWanddecoratie()
{
controleerActiecode('wanddecoratie_module');
}
function controleerActiecode(menusoort)
{
if ($j("#actiecodeDiv").is(':visible'))
{
var actiecode = $j("#actiecode").val();
if (actiecode.length > 0)
{
//AJAX CALL
var callData = {
"actiecode" : actiecode,
"menusoort" : menusoort
};
executeAjaxCall(basedir+"resources/ajax/actiecodeControleren.php", controleerActiecodeCallBack, "POST", callData);
}
else
{
alert("Voer een actiecode in.");
}
}
else
{
$j("#actiecodeDiv").show();
$j("#actiecodeButton").html("Controleer actiecode");
}
}
var hoofdNav;
function handelResizeAf()
{
hideMobileNav();
zetSubMenuMinBreedte();
}
function zetSubMenuMinBreedte()
{
var maxBreedte = hoofdNav.width();
var hoofdNavOffsetLeft = hoofdNav.offset().left;
hoofdNav.find("ul > li > ul").each(function(index)
{
var element = $j(this);
var breedteUL = element.width();
var offsetParentUL =element.parent().offset().left-hoofdNavOffsetLeft;
if (offsetParentUL+breedteUL>maxBreedte)
{
element.css({marginLeft:(maxBreedte-offsetParentUL-breedteUL-3)+"px"});
}
element.css({minWidth:element.parent().width()+"px"});
});
}
function generateUUID() {
var d = new Date().getTime();
var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
var r = (d + Math.random()*16)%16 | 0;
d = Math.floor(d/16);
return (c=='x' ? r : (r&0x3|0x8)).toString(16);
});
return uuid;
}
function createPartialFunction(func /*, 0..n args */) {
var args = Array.prototype.slice.call(arguments, 1);
return function() {
var allArguments = args.concat(Array.prototype.slice.call(arguments));
return func.apply(this, allArguments);
};
}
function hideMobileNav()
{
$j(".mobile-nav").hide();
$j(".site").removeClass('site-uitklap');
$j("body").removeClass('body-uitklap');
}
function showMobileNav()
{
if ($j(".site").hasClass('site-uitklap'))
{
hideMobileNav();
}
else
{
$j(".mobile-nav").show();
$j(".site").addClass('site-uitklap');
$j("body").addClass('body-uitklap');
}
}
function executeAjaxCall(url, completeFunction, postOrGet, data, transferFunction)
{
$j.ajax({
type: postOrGet,
url: url,
data : data,
success: completeFunction
});
}
function alertJsonError(call)
{
if(call != undefined)
{
if(typeof call.errorMessage !== "undefined")
{
alert(call.errorMessage);
}
}
}
function redirectSamePage()
{
window.location.href = window.location.href;
}
var areClipPathShapesSupported = function () {
var base = 'clipPath',
prefixes = [ 'webkit', 'moz', 'ms', 'o' ],
properties = [ base ],
testElement = document.createElement( 'testelement' ),
attribute = 'polygon(50% 0%, 0% 100%, 100% 100%)';
// Push the prefixed properties into the array of properties.
for ( var i = 0, l = prefixes.length; i < l; i++ ) {
var prefixedProperty = prefixes[i] + base.charAt( 0 ).toUpperCase() + base.slice( 1 ); // remember to capitalize!
properties.push( prefixedProperty );
}
// Interate over the properties and see if they pass two tests.
for ( var i = 0, l = properties.length; i < l; i++ ) {
var property = properties[i];
// First, they need to even support clip-path (IE <= 11 does not)...
if ( testElement.style[property] === '' ) {
// Second, we need to see what happens when we try to create a CSS shape...
testElement.style[property] = attribute;
if ( testElement.style[property] !== '' ) {
return true;
}
}
}
return false;
};
$j(function()
{
hoofdNav = $j(".hoofdnav");
// css clip-path not supported
if (!areClipPathShapesSupported())
{
// Switch classes
$element = $j(".arrow-right-polygon");
$element.toggleClass("arrow-right");
$element.toggleClass("arrow-right-polygon");
}
zetSubMenuMinBreedte();
$j(window).resize(function(){
handelResizeAf();
});
$j('input').attr('autocomplete','off');
});