﻿function ShowFaqItem(divId) {
	
	var div = document.getElementById(divId)

	if (div.className == 'item') {
		div.className = 'item active';
		return;
	}

	if (div.className == 'item active'){
		div.className = 'item';
		return;
	}

	if (div.className == ''){
		div.className = 'active';
		return;
	}

	if (div.className == 'active'){
		div.className = '';
		return;
	}
}

$(document).ready(function () {
	$('li:first-child').addClass('first');
	$('li:last-child').addClass('last');
	$('div.wrapper').each(function () { $(this).children('div.two-cols:even').addClass('clear'); })
	$('div.wrapper').each(function () { $(this).children('div.three-cols:nth-child(3n-2)').addClass('clear'); })
	$('div.wrapper').each(function () { $(this).children('div.three-cols:nth-child(3n)').addClass('last'); })
	$('.text').focus(function () { $(this).addClass('focus') })
	$('.text').blur(function () { $(this).removeClass('focus') })
	$('.bgoption').hover(function () { $(this).addClass('hover') }, function () { $(this).removeClass('hover') })

	$('div.pageoverview ul li').hover(function () { $(this).addClass('hover') }, function () { $(this).removeClass('hover') })
	/*$('div.pageoverview ul li ul:has(li)').addClass('level2').hide();*/

	/*tooltip*/
	$('body').append('<div class="tooltip"></div>');
	$("span.help").mouseover(function (e) {
		$('div.tooltip').show()
		$('div.tooltip').html($(this).html())
		$('div.tooltip').css({ "left": (e.pageX + 10) + "px", "top": e.pageY + "px" });
	})
	$("span.help").mousemove(function (e) {
		$('div.tooltip').css({ "left": (e.pageX + 10) + "px", "top": e.pageY + "px" });
		$(this).addClass('hover');
	})
	$("span.help").mouseout(function () { $('div.tooltip').hide(); $(this).removeClass('hover'); })
	$('span.help:empty').css('display', 'none')

	$("ul.templates li").hover(function () {
		$(this).css({ 'z-index': '10' });
		$(this).find('img').addClass("hover").stop().animate({ marginTop: '-69px', marginLeft: '-50px', top: '50%', left: '50%', width: '88px', height: '115px' }, 200);

	}, function () {
		$(this).css({ 'z-index': '0' });
		$(this).find('img').removeClass("hover").stop().animate({ marginTop: '0', marginLeft: '0', top: '0', left: '0', width: '78px', height: '102px' }, 200);
	});
});

//input hover icm met jquery
$(document).ready(function() {
	DoJQuery()
})

function DoJQuery() {
    $('span.btn input').mouseover(function () { $(this).parent().addClass('selected')})
	$('span.btn input').mouseout(function() { $(this).parent().removeClass('selected') })
	$('span.btn input').focus(function() { $(this).parent().addClass('active') })
	$('span.btn input').blur(function() { $(this).parent().removeClass('active') })

	$('span.btngray input').mouseover(function() {$(this).parent().addClass('selectedgray')})
	$('span.btngray input').mouseout(function() {$(this).parent().removeClass('selectedgray')})
	$('span.btngray input').focus(function() {$(this).parent().addClass('activegray')})
	$('span.btngray input').blur(function() {$(this).parent().removeClass('activegray')})
}


//-----------------------------------------------------------------
//Dropdown menu's
//-----------------------------------------------------------------
var menuOpen = null;
var menuTimeOutId;

function isSameMenu(p) {
    return (menuOpen != null) ? menuOpen.html() == p.html() : false;
}

function clearMenuTimeOut() {
    window.clearTimeout(menuTimeOutId);
    menuTimeOutId = null;
}

function clearMenu() {
    //Hide Menu
    menuOpen.css('display', 'none');

    //Add active class to parent li
    menuOpen.parent().removeClass('active');

    //Mouseout verwijder van de ul
    menuOpen.unbind('mouseout');

    //Mouseover verwijderen van de li
    var li = jQuery('li a', menuOpen);
    li.each(function () { $(this).unbind('mouseover') });

    //Menu is niet meer open
    menuOpen = null;
}

function closeMenu() {
    //Zet het window uit
    if (menuOpen != null && menuOpen != undefined) {
        clearMenu();

        //Timeout opruimen
        window.clearTimeout(menuTimeOutId);
        menuTimeOutId = null;
    }
}

function initRolloverMenu() {
    $("div.container div.nav > ul li a").mouseover(function () {
        //Timeout clearen
        window.clearTimeout(menuTimeOutId);

        //Submenu
        var subMenu = jQuery('ul:first', $(this).parent('li'));
        var subMenuCount = jQuery('li', subMenu).length;

        if (subMenuCount > 0) {
            if (!isSameMenu(subMenu)) {
                //Check of je dit geen tweede keer doet
                subMenu.css('display', 'block');

                //Add active class to parent li
                $(this).parent().addClass('active');

                //Geef alle li binnen de huidige collectie alle li een timeout killer
                var li = jQuery('li a', subMenu);
                li.each(function () {
                    $(this).unbind();
                    $(this).mouseover(clearMenuTimeOut);
                });


                //Timeout van het totale rollover window
                subMenu.mouseout(function () {
                    menuTimeOutId = window.setTimeout(closeMenu, 100);
                });

                //Sluit eventueel het menu
                closeMenu();

                //Leg het huidige openstaande menu vast
                menuOpen = subMenu;
            }
        } else {
            closeMenu();
        }
    });

    $("div.container div.nav > ul li a").mouseout(function () {
    	menuTimeOutId = window.setTimeout(closeMenu, 10);
    });
}

function initClickMenu() {
	$('div.grid12-3 > div.nav > ul > li > a').click(function () {
        var subMenu = jQuery('ul:first', $(this).parent('li'));

        if (subMenu.length > 0) {
            if (menuOpen) menuOpen.css('display', 'none');
            subMenu.css('display', 'block');
            $(this).parent().addClass('active');
            menuOpen = subMenu;
        } else {
            if (menuOpen) menuOpen.css('display', 'none');
        }
    });
}

$(document).ready(function () {

    //Automatisch controle of er een links,rechts // boven is:
    if ($('div.grid12-3 > div.nav > ul > li').length > 0) {
        initClickMenu();
    } else {
        initRolloverMenu();
    }
      });

      //

      /*************************************
      JQuery	
      *************************************/

      $(document).ready(function () {
      	Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);

      	function EndRequestHandler(sender, args) {
      		$('.datepicker').datepicker({
      			showOn: "button",
      			buttonImage: "/images/calendar.gif",
      			buttonImageOnly: true,
      			clearText: 'Wissen', clearStatus: 'Wis de huidige datum',
      			closeText: 'Sluiten', closeStatus: 'Sluit zonder verandering',
      			prevText: '←', prevStatus: 'Bekijk de vorige maand',
      			prevBigText: '«', nextBigStatus: 'Bekijk het vorige jaar',
      			nextText: '→', nextStatus: 'Bekijk de volgende maand',
      			nextBigText: '»', nextBigStatus: 'Bekijk het volgende jaar',
      			currentText: 'Vandaag', currentStatus: 'Bekijk de huidige maand',
      			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: 'Bekijk een andere maand', yearStatus: 'Bekijk een ander jaar',
      			weekHeader: 'Wk', weekStatus: 'Week van het jaar',
      			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: 'Stel DD in als eerste dag van de week',
      			dateStatus: 'dd-mm-yy', dateFormat: 'dd-mm-yy', firstDay: 1,
      			initStatus: 'Kies een datum', isRTL: false,
      			minDate: '0D', maxDate: '1W'
      		});
      	}

      	$('li:first-child').addClass('first');
      	$('li:last-child').addClass('last');
      	$('div.wrapper').each(function () { $(this).children('div.two-cols:even').addClass('clear'); })
      	$('div.wrapper').each(function () { $(this).children('div.three-cols:nth-child(3n-2)').addClass('clear'); })
      	$('div.wrapper').each(function () { $(this).children('div.three-cols:nth-child(3n)').addClass('last'); })
      	$('.text').focus(function () { $(this).addClass('focus') })
      	$('.text').blur(function () { $(this).removeClass('focus') })
      	$('.bgoption').hover(function () { $(this).addClass('hover') }, function () { $(this).removeClass('hover') })

      	$('div.pageoverview ul li').hover(function () { $(this).addClass('hover') }, function () { $(this).removeClass('hover') })
      	/*$('div.pageoverview ul li ul:has(li)').addClass('level2').hide();*/

      	/*tooltip*/
      	$('body').append('<div class="tooltip"></div>');
      	$("span.help").mouseover(function (e) {
      		$('div.tooltip').show()
      		$('div.tooltip').html($(this).html())
      		$('div.tooltip').css({ "left": (e.pageX + 10) + "px", "top": e.pageY + "px" });
      	})
      	$("span.help").mousemove(function (e) {
      		$('div.tooltip').css({ "left": (e.pageX + 10) + "px", "top": e.pageY + "px" });
      		$(this).addClass('hover');
      	})
      	$("span.help").mouseout(function () { $('div.tooltip').hide(); $(this).removeClass('hover'); })
      	$('span.help:empty').css('display', 'none')

      	$("ul.templates li").hover(function () {
      		$(this).css({ 'z-index': '10' });
      		$(this).find('img').addClass("hover").stop().animate({ marginTop: '-69px', marginLeft: '-50px', top: '50%', left: '50%', width: '88px', height: '115px' }, 200);

      	}, function () {
      		$(this).css({ 'z-index': '0' });
      		$(this).find('img').removeClass("hover").stop().animate({ marginTop: '0', marginLeft: '0', top: '0', left: '0', width: '78px', height: '102px' }, 200);
      	});

      });

      //input hover icm met jquery
      $(document).ready(function () {
      	DoJQuery()
      })

      $.fn.delay = function (time, callback) {
      	// Empty function:
      	jQuery.fx.step.delay = function () { };
      	// Return meaningless animation, (will be added to queue)
      	return this.animate({ delay: 1 }, time, callback);
      }

      function DoJQuery() {
      	$('span.btn input').mouseover(function () { $(this).parent().addClass('selected') })
      	$('span.btn input').mouseout(function () { $(this).parent().removeClass('selected') })
      	$('span.btn input').focus(function () { $(this).parent().addClass('active') })
      	$('span.btn input').blur(function () { $(this).parent().removeClass('active') })

      	$('span.btngray input').mouseover(function () { $(this).parent().addClass('selectedgray') })
      	$('span.btngray input').mouseout(function () { $(this).parent().removeClass('selectedgray') })
      	$('span.btngray input').focus(function () { $(this).parent().addClass('activegray') })
      	$('span.btngray input').blur(function () { $(this).parent().removeClass('activegray') })

      	$('div.message').delay(4500).animate({ opacity: 0, height: 0, marginBottom: -25 }, 1500);
      }

      /*************************************
      Form
      *************************************/

      // Focus: remove watermark text and style
      function FocusThisBox(textBox, value, cssClass) {
      	if (textBox.value == value) {
      		textBox.value = ''
      		textBox.className = cssClass
      	}
      }

      // Blur: set watermark text and style
      function BlurThisBox(textBox, value, cssClass) {
      	if (textBox.value == '') {
      		textBox.value = value
      		textBox.className = cssClass
      	}
      }

      function IsHidden(element) {
      	if (!element.style) return false
      	if (element.style.display == 'none') return true
      	if (!element.parentNode) return false
      	return IsHidden(element.parentNode)
      }

      function CheckRequired(sender, args) {
      	if (IsHidden(document.getElementById(sender.controltovalidate))) {
      		args.IsValid = true;
      		return
      	}

      	if (args.Value != '') {
      		args.IsValid = true;
      	}
      	else {
      		args.IsValid = false;
      	}

      	SetErrorMessage(sender, args.IsValid, "Veld is verplicht");
      	//CheckMaxCharacters(sender, args);
      }

      function CheckPostalCodeFormatTextBox(sender, args) {
      	CheckField(sender, args, "^[1-9][0-9]{3}( )?[a-zA-Z]{2}$", "Vul een geldige postcode in.");
      }

      function CheckEmailFormatTextBox(sender, args) {
      	CheckField(sender, args,
				"^[A-Za-z0-9_-]+([.][A-Za-z0-9_-]+)*[@][A-Za-z0-9-][A-Za-z0-9-]+([.-][A-Za-z0-9-]+)*[.]([A-Za-z]){2,6}$",
				"Vul een geldig e-mailadres in.");
      }

      function CheckStreetAndHouseNrTextBox(sender, args) {
      	CheckField(sender, args, "^[A-Za-z0-9-]*~[0-9]*~[A-Za-z0-9- ]*$", "Vul een geldige straat en huisnummer in");
      }

      function CheckPostalCodeAndCityTextBox(sender, args) {
      	//CheckField(sender, args, "^[1-9][0-9]{3}( )?[a-zA-Z]{2}~[A-Za-z\ \'\-]*$", "Vul een geldige postcode en woonplaats in");

      	var regex = "^[1-9][0-9]{3}( )?[a-zA-Z]{2}~[A-Za-z\ \'\-]*$";
      	var errormessage = "Vul een geldige postcode en woonplaats in";

      	if (IsHidden(document.getElementById(sender.controltovalidate))) {
      		args.IsValid = true;
      		return
      	}

      	var error;

      	var arrMatch = new RegExp(regex).exec(args.Value);

      	if (args.valueOf == '') {
      		args.IsValid = false;
      	}
      	else if (!arrMatch) {
      		args.IsValid = false;
      		error = errormessage;
      	}
      	else {
      		args.IsValid = true;
      	}

      	if (args.IsValid) {
      		CheckMaxCharacters(sender, args);
      	}

      	sender.controltovalidate = sender.ZipcodeId;
      	SetErrorMessage(sender, args.IsValid, error);
      	sender.controltovalidate = sender.CityId;
      	SetErrorMessage(sender, args.IsValid, error);
      	sender.controltovalidate = sender.ZipcodeCityId;

      }

      function CheckTelnrFormatTextBox(sender, args) {
      	CheckField(sender, args, "^[0-9- ]{10,15}$", "Vul een geldig telefoonnummer in.");
      }

      function CheckNumberFormatTextBox(sender, args) {
      	CheckField(sender, args, "^[0-9][0-9]*$", "Vul een geldig nummer in.");
      }

      function CheckDateFormatTextBox(sender, args) {
      	args.IsValid = true;
      	CheckField(sender, args, "(19|20)[0-9]{2}-(0|1)[0-9]-[0-3][0-9]", "Geen geldige datum");
      }

      function CheckMaxCharacters(sender, args) {
      	var max = sender.MaxCharacters;
      	var length = args.Value.length;
      	var value = args.Value;

      	if (max == 0) {
      		args.isValid = true;
      		return;
      	}

      	if (args.Value.length > max) {
      		args.IsValid = false;
      		SetErrorMessage(sender, args.IsValid, "De tekst is te lang. Tekst mag maximaal " + max + " tekens bevatten");
      		return;
      	}
      }

      function CustomCheckPostalCodeAndCityTextBox(validatorId, textboxId) {
      	//sender = {custom:'true',id:textboxId,controltovalidate:textboxId,errormessage:"Vul een geldige postcode en woonplaats in"}
      	var sender = document.getElementById(validatorId)
      	sender.controltovalidate = textboxId
      	args = { Value: document.getElementById(textboxId).value }
      	CheckPostalCodeAndCityTextBox(sender, args)
      }

      function CheckField(sender, args, regex, errormessage) {
      	if (IsHidden(document.getElementById(sender.controltovalidate))) {
      		args.IsValid = true;
      		return
      	}

      	var error;

      	var arrMatch = new RegExp(regex).exec(args.Value);

      	if (args.valueOf == '') {
      		args.IsValid = false;
      	}
      	else if (!arrMatch) {
      		args.IsValid = false;
      		error = errormessage;
      	}
      	else {
      		args.IsValid = true;
      	}

      	if (args.IsValid) {
      		CheckMaxCharacters(sender, args);
      	}

      	SetErrorMessage(sender, args.IsValid, error);
      }

      function SetErrorMessage(sender, isValid, error) {
      	if (!error) error = sender.errormessage
      	if (isValid) {
      		$(sender).parent().attr('title', '')
      		$(sender).hide()
      		$(sender).parent().removeClass('error');
      		$(sender).parent().addClass('ok');
      		$('#' + sender.controltovalidate).removeClass('error');
      	}
      	else {
      		$(sender).parent().attr('title', error)
      		$(sender).show()
      		$(sender).parent().removeClass('ok');
      		$(sender).parent().addClass('error');
      		$('#' + sender.controltovalidate).addClass('error');
      	}
      }

      function showDivByCheckBox(divItem, checkBoxItem) {
      	var visibility = (checkBoxItem.checked) ? "block" : "none";
      	document.getElementById(divItem).style.display = visibility;
      }

      function ChangeTextBoxView(textBoxID, checkbox) {
      	var textbox = document.getElementById(textBoxID);

      	textbox.disabled = !checkbox.checked;

      	if (!textbox.disabled) {
      		textbox.focus();
      	}
      	else {
      		textbox.value = ""
      	}

      }

      function ChangeItemCheck(checkboxID, checkboxItem) {
      	var array = checkboxID.split("~");

      	for (var i = 0; i < array.length; i++) {
      		document.getElementById(array[i]).checked = checkboxItem.checked;
      	}
      }

      function UncheckItem(checkBoxID, checkBoxItem) {
      	if (!checkBoxItem.checked) document.getElementById(checkBoxID).checked = false;
      }

      function FillFullName(textboxId, initialsId, infixId, lastnameId) {
      	var textbox = document.getElementById(textboxId);

      	var initials = document.getElementById(initialsId);
      	var infix = document.getElementById(infixId);
      	var lastname = document.getElementById(lastnameId);

      	textbox.value = (initials.value != "" && lastname.value != "")
				? initials.value + "~" + infix.value + "~" + lastname.value
				: "";
      }

      function FillStreetAndHousenr(textboxId, streetId, housenrId, housenrAddId) {
      	var textbox = document.getElementById(textboxId);

      	var street = document.getElementById(streetId);
      	var housenr = document.getElementById(housenrId);
      	var housenrAdd = document.getElementById(housenrAddId);

      	textbox.value = (street.value != "" && housenr.value != "")
				? street.value + "~" + housenr.value + "~" + housenrAdd.value
				: "";
      }

      function FillPostalCodeAndCity(textboxId, zipcodeId, cityId, validatorId) {
      	var textbox = document.getElementById(textboxId);

      	var zipcode = document.getElementById(zipcodeId);
      	var city = document.getElementById(cityId);

      	textbox.value = (zipcode.value != "" && city.value != "")
				? zipcode.value + "~" + city.value
				: "";

      	if (city.value != '')
      		CustomCheckPostalCodeAndCityTextBox(validatorId, textboxId)
      }

      function FillTextBox(textBox, dropdownDay, dropdownMonth, dropdownYear, mindate, maxdate) {
      	var dropdownboxDay = document.getElementById(dropdownDay);
      	var dropdownboxMonth = document.getElementById(dropdownMonth);
      	var dropdownboxYear = document.getElementById(dropdownYear);

      	document.getElementById(textBox).value = "";

      	if (dropdownboxDay.value != "Dag") {
      		if (dropdownboxMonth.value != "00") {
      			if (dropdownboxYear.value != "Jaar") {
      				date = new Date(dropdownboxYear.value, dropdownboxMonth.value, dropdownboxDay.value);

      				if (date >= mindate && date <= maxdate) {
      					document.getElementById(textBox).value = dropdownboxDay.value + '-' + dropdownboxMonth.value + '-' + dropdownboxYear.value;
      				}
      			}
      		}
      	}
      }

      function MultipleFieldsValidatorEvaluateIsValid(val) {

      	controltovalidateIDs = val.controlstovalidate.split(',');
      	switch (val.condition) {
      		case 'OR':
      			for (var controltovalidateIDIndex in controltovalidateIDs) {
      				var controlID = controltovalidateIDs[controltovalidateIDIndex];
      				if (ValidatorTrim(ValidatorGetValue(controlID)) != '') {
      					return true;
      				}
      			}
      			return false;
      			break;
      		case 'XOR':
      			for (var controltovalidateIDIndex in controltovalidateIDs) {
      				var controlID = controltovalidateIDs[controltovalidateIDIndex];
      				if (controltovalidateIDIndex == '0') {
      					var previousResult = !(ValidatorTrim(ValidatorGetValue(controlID)) == '');
      					continue;
      				}
      				var currentResult = !(ValidatorTrim(ValidatorGetValue(controlID)) == '');
      				if (currentResult != previousResult) {
      					return true;
      				}
      				previousResult != currentResult;
      			}
      			return false;
      			break;
      		case 'AND':
      			for (var controltovalidateIDIndex in controltovalidateIDs) {
      				var controlID = controltovalidateIDs[controltovalidateIDIndex];
      				if (ValidatorTrim(ValidatorGetValue(controlID)) == '') {
      					return false;
      				}
      			}
      			return true;
      			break;
      	}
      	return false;
      }

      function CheckFileExtension(sender, args) {
      	var fileupload = document.getElementById(sender.controltovalidate);
      	var extension = fileupload.value.replace(fileupload.value.substr(fileupload.value, fileupload.value.lastIndexOf(".") + 1), "");
      	var forbiddenExtensions = new Array("bat", "exe", "zip");
      	var error = '';

      	args.IsValid = true;

      	for (var i = 0; i < forbiddenExtensions.length; i++) {
      		if (extension == forbiddenExtensions[i]) {
      			args.IsValid = false;
      			error = 'Dit bestandsformaat is niet toegestaan';
      		}
      	}

      	SetErrorMessage(sender, args.IsValid, error);
      }


      /*************************************
      Onload
      *************************************/

      function AttachEvent(obj, evt, fnc, useCapture) {
      	if (!useCapture) {
      		useCapture = false;
      	}
      	if (obj.addEventListener) {
      		obj.addEventListener(evt, fnc, useCapture)
      		return true
      	}
      	else if (obj.attachEvent) {
      		return obj.attachEvent("on" + evt, fnc);
      	}
      	else {
      		// ancient browser
      	}
      }

      /*************************************
      ColorPicker
      *************************************/

      var ColorPicker =
{
	Init: function (Spans, TextBoxes, ColorPickerId, submitMethod) {
		this.Spans = Spans
		this.TextBoxes = TextBoxes
		this.ColorPickerId = ColorPickerId
		this.currentSpan = this.Spans[0]
		this.currentTextBox = this.TextBoxes[0]
		this.currentColor = document.getElementById(this.currentTextBox).value
		this.Div = document.getElementById('DivOtherColors')
		this.SubmitMethod = submitMethod
	},

	Select: function (n) {
		this.currentSpan = this.Spans[n]
		this.currentTextBox = this.TextBoxes[n]
		this.currentColor = document.getElementById(this.TextBoxes[n]).value
		this.Div.style.visibility = 'hidden'

		//Set color indicator
		$('div.color-selection-arrow').css('top', String((n * 20) + 'px'));
	},

	ClickColor: function (a) {
		this.currentColor = a.innerHTML.replace('Kleur ', '')
		document.getElementById(this.currentSpan).style.backgroundColor = this.currentColor
		document.getElementById(this.currentTextBox).value = this.currentColor
		this.Div.style.visibility = 'hidden'
		this.Submit()
	},

	ToggleOther: function (evnt) {
		evnt = event || evnt
		var x = evnt.clientX
		var y = evnt.clientY

		var visibility = this.Div.style.visibility
		this.Div.style.visibility = (visibility == 'visible' ? 'hidden' : 'visible')
		this.Div.style.left = x + 'px'
		this.Div.style.top = y + 'px'
		SetColorPicker(this.currentColor)
		this.Div.style.visibility = (visibility == 'visible' ? 'hidden' : 'visible')
	},

	OnClientColorChange: function (sender, eventArgs) {
		this.currentColor = sender.get_selectedColor()
		document.getElementById(this.currentSpan).style.backgroundColor = this.currentColor
		document.getElementById(this.currentTextBox).value = this.currentColor
		SetColorPicker(this.currentColor)
		this.Div.style.visibility = 'hidden'
		this.Submit()
	},

	Submit: function () {
		this.SubmitMethod()
	}
}

      function OnClientColorChange(sender, eventArgs) {
      	ColorPicker.OnClientColorChange(sender, eventArgs)
      }

      function GetColorPicker() {
      	return $find(ColorPicker.ColorPickerId);
      }

      function SetColorPicker(color) {
      	var colorPicker = GetColorPicker();
      	colorPicker.set_selectedColor(color);
      }

      /*************************************
      PageTree
      *************************************/

      var PageTree =
{
	TextBoxGuid: null,
	TextBoxAction: null,

	Init: function (textBoxGuid, textBoxAction) {
		this.TextBoxGuid = textBoxGuid
		this.TextBoxAction = textBoxAction
	},

	OrderUp: function (guid) {
		document.getElementById(this.TextBoxGuid).value = guid
		document.getElementById(this.TextBoxAction).value = 'up'
	},

	OrderDown: function (guid) {
		document.getElementById(this.TextBoxGuid).value = guid
		document.getElementById(this.TextBoxAction).value = 'down'
	},

	Delete: function (guid) {
		var yesNo = confirm('Weet u zeker dat u deze pagina wilt verwijderen? Deze actie kan niet ongedaan gemaakt worden!')
		if (yesNo == false) return

		document.getElementById(this.TextBoxGuid).value = guid
		document.getElementById(this.TextBoxAction).value = 'delete'
	},

	Edit: function (guid) {
		document.getElementById(this.TextBoxGuid).value = guid
		document.getElementById(this.TextBoxAction).value = 'edit'
	},

	Copy: function (guid) {
		document.getElementById(this.TextBoxGuid).value = guid
		document.getElementById(this.TextBoxAction).value = 'copy'
	},

	Preview: function (guid) {
		document.getElementById(this.TextBoxGuid).value = guid
		document.getElementById(this.TextBoxAction).value = 'preview'
	}
}

      /*
      Replace theme color letters with images....
      */
      $(document).ready(function () {
      	/*
      	//Zoek of er 
      	var selected;

      	if (!$.browser.msie) {
      	$('div.themeselector option').each(function () {
      	if ($(this).text() != 'Kies een thema') {
      	// $(this).html('<img src=\'Images/' + $(this).text() + '.gif\' />');
      	$(this).css('background', 'transparent url(Images/' + $(this).text() + '.gif\) no-repeat 2px 1px');
      	$(this).css('padding-top', '5px');
      	if ($(this).attr('selected')) selected = $(this).text();
      	$(this).html('');
      	}
      	});

      	$('div.themeselector select').css('background', 'transparent url(Images/' + selected + '.gif\) no-repeat 5px 3px');
      	}
      	*/
      });



      /*******************************************
      Slider menu
      *******************************************
      Usage:
      <div class="hsl">                   <-- selection container...
      <a class="hslleft"/>            <-- left button        
      <div class="hslwidth">          <-- bounding box        -> (float:left, width/height, overflow:hidden, display:block, position:relative)
      <div class="hslslider">     <-- sliding container   -> (position:relative)
      <div class="hslstep" /> <-- element             -> (float:left, width/height, padding)
      <div class="hslstep" /> <-- element
      <div class="hslstep" /> <-- element
      <div class="hslstep" /> <-- element
      </div>
      </div>
      <a class="hslright"/>           <-- right button        
      </div>
      */



      $(document).ready(function () {
      	HSlider.init();
      });


      var HSlider = {
      	init: function () {
      		$('.hsl').each(function () {
      			//Huidige positie vastleggen
      			var sliderX = isNaN(parseFloat((jQuery('.hslslider', $(this))).css('left'))) ? 0 : parseFloat((jQuery('.hslslider', $(this))).css('left'));

      			var ipl = isNaN(parseFloat(jQuery('.hslstep', $(this)).css('padding-left'))) ? 0 : parseFloat(jQuery('.hslstep', $(this)).css('padding-left'));
      			var ipr = isNaN(parseFloat(jQuery('.hslstep', $(this)).css('padding-right'))) ? 0 : parseFloat(jQuery('.hslstep', $(this)).css('padding-right'));
      			var iw = isNaN(parseFloat(jQuery('.hslstep', $(this)).css('width'))) ? 0 : parseFloat(jQuery('.hslstep', $(this)).css('width'));

      			//uittrekken van content zodat alles naast elkaar staat!
      			var itemWidth = ipl + ipr + iw;
      			var itemCount = jQuery('.hslstep', $(this)).length;
      			jQuery('.hslslider', $(this)).css('width', String((itemWidth * itemCount)) + 'px');

      			var btnLeft = jQuery('.hslleft', $(this));
      			var btnRight = jQuery('.hslright', $(this));

      			jQuery.data($(this)[0], 'position', { x: sliderX, btnLeft: btnLeft, btnRight: btnRight });

      			jQuery.data(btnLeft[0], 'hsld', { src: $(this) })
      			jQuery.data(btnRight[0], 'hsld', { src: $(this) })

      			HSlider.addSlider(btnLeft, jQuery('.hslslider', $(this)), -1);
      			HSlider.addSlider(btnRight, jQuery('.hslslider', $(this)), 1);

      			HSlider.setOpacity(btnRight, 1);
      			HSlider.setOpacity(btnLeft, 0.5);

      			//Sommige settings overschrijven ivm raddock
      			HSlider.fixRaddock($(this));
      		});
      	},

      	addSlider: function (button, element, direction) {
      		button.unbind('click');
      		button.click(function () {
      			//Slider root
      			var data = jQuery.data($(this)[0], 'hsld').src;
      			var sliderX = jQuery.data(data[0], 'position').x;

      			//buttons
      			var btnLeft = jQuery.data(data[0], 'position').btnLeft;
      			var btnRight = jQuery.data(data[0], 'position').btnRight;

      			//Slider
      			var hslslider = jQuery('.hslslider', data);
      			var x = isNaN(parseFloat(hslslider.css('left'))) ? 0 : parseFloat(hslslider.css('left'));
      			var width = (HSlider.rdWidth != -1) ? HSlider.rdWidth * HSlider.rdCount : parseFloat(hslslider.css('width')); ;
      			var max = parseFloat(jQuery('.hslwidth', data).css('width'));

      			//item width/count (resetten box na slepen)
      			var ipl = isNaN(parseFloat(jQuery('.hslstep', data).css('padding-left'))) ? 0 : parseFloat(jQuery('.hslstep', data).css('padding-left'));
      			var ipr = isNaN(parseFloat(jQuery('.hslstep', data).css('padding-right'))) ? 0 : parseFloat(jQuery('.hslstep', data).css('padding-right'));
      			var iw = isNaN(parseFloat(jQuery('.hslstep', data).css('width'))) ? 0 : parseFloat(jQuery('.hslstep', data).css('width'));


      			var itemWidth = (HSlider.rdWidth != -1) ? HSlider.rdWidth : ipl + ipr + iw;
      			var itemCount = (HSlider.rdCount != -1) ? HSlider.rdCount : jQuery('.hslstep', data).length;

      			var newPos = sliderX - (itemWidth * direction);

      			if (direction > 0 && newPos <= (max - width)) {
      				jQuery.data(data[0], 'position').x = max - width;
      				newPos = max - width;

      				HSlider.setOpacity(btnRight, 0.5);
      				HSlider.setOpacity(btnLeft, 1);

      			} else if (direction < 0 && newPos >= 0) {
      				jQuery.data(data[0], 'position').x = 0;
      				newPos = 0;

      				HSlider.setOpacity(btnRight, 1);
      				HSlider.setOpacity(btnLeft, 0.5);
      			} else {

      				jQuery.data(data[0], 'position').x = newPos;
      				HSlider.setOpacity(btnRight, 1);
      				HSlider.setOpacity(btnLeft, 1);
      			}



      			hslslider.stop().animate({ left: newPos }, 250);
      		});
      	},

      	fixRaddock: function (cll) {
      		var hfw = jQuery('.hslfixedwidth', cll);
      		if (hfw.length > 0) {
      			hfw.css('float', 'none');
      			hfw.css('border', '0');
      			hfw.css('width', '1067px');

      			HSlider.rdWidth = 150;
      			HSlider.rdCount = 7;
      		}
      	},


      	setOpacity: function (e, n) {
      		e.css({ 'opacity': n, 'filter': ('alpha(opacity = ' + parseInt(n * 100) + ')') });
      	},

      	rdWidth: -1,
      	rdCount: -1
      }



      /*************************************
      Wizard
      *************************************/

      function GetDropdownValue(clientId) {
      	var ddl = document.getElementById(clientId)
      	return ddl.options[ddl.selectedIndex].value
      }

      function GetTextboxColor(clientId) {
      	return document.getElementById(clientId).value.replace('#', '')
      }

      function GetFrameUrl() {
      	var url = $('iframe').attr('src');
      	if (url.indexOf('?') > -1)
      		url = url.substring(0, url.indexOf('?'))
      	return url
      }

      function PostbackSingleChoiceWithDelay(guid, parameter, textbox, myLi, selectedLi) {
      	setTimeout("PostbackSingleChoice('" + guid + "', '" + parameter + "', '" + textbox + "', '" + myLi + "', '" + selectedLi + "')", 1)
      }

      function PostbackSingleChoice(guid, parameter, textbox, myLi, selectedLi) {
      	ShowSaveWarning()
      	if (document.getElementById(selectedLi)) {
      		document.getElementById(selectedLi).className = ''
      	}
      	document.getElementById(myLi).className = 'active'

      	document.getElementById(textbox).value = guid

      	var url = GetFrameUrl()
      	url += '?' + parameter + '=' + guid
      	top.previewiframe.location.href = url
      }

      function ShowSaveWarning() {
      	FormEditedWithoutSave = true
      	document.getElementById('DivSaveWarning').style.display = 'block'
      }

      var FormEditedWithoutSave = false

      function CheckSaveState() {
      	if (FormEditedWithoutSave == false) {
      		return true
      	}
      	else {
      		return confirm('Weet u zeker dat u de pagina wilt verlaten zonder op te slaan?')
      	}
      }

      function ChangeDisplay(controlId, show) {
      	var control = document.getElementById(controlId);
      	control.style.display = (show) ? "block" : "none";
      }

      function ChangeDisplay(controlId) {
      	var control = document.getElementById(controlId);
      	control.style.display = (control.style.display == 'block') ? 'none' : 'block';
      }

      function ChangeDisplayPageTitle(controlId, dropdownId) {
      	var control = document.getElementById(controlId);
      	var dropdown = document.getElementById(dropdownId);

      	control.style.display = (dropdown.options[dropdown.selectedIndex].text == 'Eigen titel') ? 'block' : 'none';
      }

      function ShowFaqItem(divId) {

      	var div = document.getElementById(divId)

      	if (div.className == 'item') {
      		div.className = 'item active';
      		return;
      	}

      	if (div.className == 'item active') {
      		div.className = 'item';
      		return;
      	}

      	if (div.className == '') {
      		div.className = 'active';
      		return;
      	}

      	if (div.className == 'active') {
      		div.className = '';
      		return;
      	}
      }

      function ConfirmRemove(dock, args) {
      	if (!confirm('Weet u zeker dat u de ' + dock.get_title() + ' module wilt verwijderen? Deze actie kan niet ongedaan worden gemaakt.')) {
      		args.set_cancel(true);
      	}
      }

      function SetPollOptions(dropdownId, text1Id, text2Id, text3Id, text4Id, text5Id, text6Id, text7Id, text8Id) {
      	var dropdown = document.getElementById(dropdownId);
      	var text1 = document.getElementById(text1Id);
      	var text2 = document.getElementById(text2Id);
      	var text3 = document.getElementById(text3Id);
      	var text4 = document.getElementById(text4Id);
      	var text5 = document.getElementById(text5Id);
      	var text6 = document.getElementById(text6Id);
      	var text7 = document.getElementById(text7Id);
      	var text8 = document.getElementById(text8Id);

      	var value = dropdown.options[dropdown.selectedIndex].value;

      	text1.style.display = (value > 0) ? "block" : "none";
      	text2.style.display = (value > 1) ? "block" : "none";
      	text3.style.display = (value > 2) ? "block" : "none";
      	text4.style.display = (value > 3) ? "block" : "none";
      	text5.style.display = (value > 4) ? "block" : "none";
      	text6.style.display = (value > 5) ? "block" : "none";
      	text7.style.display = (value > 6) ? "block" : "none";
      	text8.style.display = (value > 7) ? "block" : "none";
      }

      function SetPanelVisibility(checkboxId, panelId) {
      	var checkbox = document.getElementById(checkboxId);
      	var panel = document.getElementById(panelId);

      	panel.style.display = (checkbox.checked) ? "block" : "none";
      }

      function OpenClose(divId, hyperlink) {
      	var div = document.getElementById(divId)
      	if (div.style.display == 'none') {
      		div.style.display = 'block'
      		hyperlink.className = 'min'
      	}
      	else {
      		div.style.display = 'none'
      		hyperlink.className = 'plus'
      	}
      }


      function OnDayRender(sender, eventArgs) {
      	var activeDays = '[]'
      	var inActiveDays = '[]'

      	var day = "0" + eventArgs.get_date()[2]
      	day = day.substring(day.length - 2, day.length)

      	var jsDate = "" + day + "-" + eventArgs.get_date()[1] + "-" + eventArgs.get_date()[0] + "";

      	if (activeDays.toString().indexOf(jsDate) > -1) { activeExists = true; } else { activeExists = false };
      	if (inActiveDays.toString().indexOf(jsDate) > -1) { inActiveExists = true; } else { inActiveExists = false };

      	var cell = eventArgs.get_cell();
      	var day = eventArgs.get_renderDay();
      	if (day) {
      		var view = day.RadCalendarView;

      		if ((day.get_isWeekend() || inActiveExists) && !activeExists) {
      			cell.style.backgroundColor = "#efefef";
      			// replace the default cell content (anchor tag) with a span element 
      			// that contains the processed calendar day number -- necessary for the calendar skinning mechanism 
      			cell.innerHTML = "<span>" + eventArgs.get_date()[2] + "</span>";
      			// disable selection and hover effect for the cell
      			cell.DayId = "";
      		}

      	}
      	else {
      		cell.innerText = "";
      	}
      }

      function SetUniqueRadioButton(nameregex, current) {

      	re = new RegExp(nameregex);

      	for (i = 0; i < document.forms[0].elements.length; i++) {
      		elm = document.forms[0].elements[i];
      		if (elm.type == 'radio') {
      			if (re.test(elm.name)) {
      				elm.checked = false;
      			}
      		}
      	}
      	current.checked = true;
      }






