/*(function(){*/
var geocoder;
var map;

var init = function()
{
    geocoder = new google.maps.Geocoder();
    var btn_getLocation = jQuery('#findaddress');
    btn_getLocation.bind('click', geocode);

if($('#query').val() != '' && ($('#query').val() != '(zoek op: stad/postcode)' || $('#query').val() != '(zoek op: winkel/woonplaats)')){

    var searchQuery = $('#query').val();
    var request = {};
    var callback = geocode_callback;
  
    request.address = searchQuery + '  Nederland';
    geocoder.geocode( request, callback );
}
}

var geocode = function(e)
{
 /* if ($('input#adreslijst').is(':checked')) {
    $('form#slocSearchWrapper').submit();
  } else {
    var searchQuery = jQuery('#query').val();
    //var streetAddress = jQuery('#streetAddress').val();
    //var postalCode = jQuery('#postalCode').val();
    //var locality = jQuery('#locality').val();
    //var country = jQuery('#country').val();

    var request = {};
    var callback = geocode_callback;
    //request.address = streetAddress +' '+ postalCode +' '+ locality +'  Nederland';
    request.address = searchQuery + '  Nederland';
    geocoder.geocode( request, callback );
    return false;
  }*/

$('form#slocSearchWrapper').submit();
}

var geocode_callback = function( results, status)
{
    var latitude;
    var longitude;
    var options = {};
    if( status == google.maps.GeocoderStatus.OK ) {
        latitude = results[ 0 ].geometry.location.lat();
        longitude = results[ 0 ].geometry.location.lng();
        options.latitude = latitude;
        options.longitude = longitude;
        options.div = document.getElementById('maps_canvas');
        initializeMap( options );
    }
}

var initializeMap = function( options )
{
    var mapOptions = {};
    var latLang = new google.maps.LatLng( options.latitude, options.longitude, false);
    mapOptions.center = latLang;
    mapOptions.mapTypeId = google.maps.MapTypeId.ROADMAP;
    mapOptions.zoom = 15;
    initializeCompanyMap(latLang);
/*
    if( map ) {
        map.setCenter( latLang );
    } else {
        map = new google.maps.Map( options.div, mapOptions );
    }
*/
}

jQuery(document).ready(init);
/*})();*/ /*
  get cookie
*/
function getCookie(sName){
	var aCookie = document.cookie.split("; ");
	
	for (var i=0; i < aCookie.length; i++){
		var aCrumb = aCookie[i].split("=");
		if (sName == aCrumb[0]){
			return unescape(aCrumb[1]);
		}
	}
	
	return null;
} /*
  getElementsByClassName
*/
document.getElementsByClassName = function (needle){
    var s = [document.documentElement || document.body], i = 0, r = [], l = 0, e;
    var re = new RegExp('(^|\\s)' + needle + '(\\s|$)');

    do{
        e = s[i];

        while (e){
            if (e.nodeType == 1){
                if (e.className && re.test(e.className)) r[l++] = e;

                s[i++] = e.firstChild;
            }

            e = e.nextSibling;
        }
    }
	
    while (i--);

    return r;
}
 /*
	handleBodyLoad();
*/

function handleBodyLoad() {

//	initZebraTables();
	markLinks();
	initMainNav();
	initFlashMolentje();



	initProductPhotoPopup()

	$("#content .carouselWrapper").sisoCarousel({
		speed: 2000,
		interval: 500,
		animateFirst: false,
		autoPlay: false
	});


	var lang = document.getElementsByTagName('html')[0].getAttribute('lang');
	if(lang == 'nl') initInputFocus('qGlobal', 'Zoeken');
	if(lang == 'en') initInputFocus('qGlobal', 'Search');

	if(lang == 'nl') initInputFocus('newsLetterServiceEmailAddress', 'E-mailadres');
	if(lang == 'en') initInputFocus('newsLetterServiceEmailAddress', 'Email address');

	initNewsLetterSubscriptionForm();

       initStorelocator();

       rebuildSizes();

//	setTimeout("rotateMolentje()",500);
} /*
  initFader
*/
  
function initFader(){

	// hide for old browsers
	if(!document.getElementById || !document.createElement || !document.getElementById('albumFader')) return;

	//var li = document.getElementById('listContainer').getElementsByTagName('a');

	window.fadeTime = 3200;

	window.anchors = new Array();
	window.current = 0;
	window.pause = false;
	window.loaded = -1;
	window.loading = true;

	// set opacity to 0 for all images, except the first image 
	anchors = document.getElementById('albumFader').getElementsByTagName('img');

	// get the rest of the images that are loaded in the listBanners pagelet
	//window.alternateImgs = document.getElementById('listContainer').getElementsByTagName('a');
	window.alternateImgs = faderImgList;
	window.totalImages = window.alternateImgs.length + anchors.length;

	anchors[0].style.display = 'block';
	anchors[0].xOpacity = .99;
	anchors[0].onload = function(){

		window.loaded = 0;
		 // if there are more images availbale fade them in
		if(window.alternateImgs.length) addImage(window.alternateImgs[0]);

		setTimeout(fadeBanners, fadeTime);
	}
}

function fadeBanners(){

	if(window.loading){
		setTimeout(fadeBanners, fadeTime);
		return;
	}

	cOpacity = anchors[current].xOpacity;
	nIndex = anchors[current+1]?current+1:0;
	nOpacity = anchors[nIndex].xOpacity;
	cOpacity -= .05;
	nOpacity += .05;

	anchors[nIndex].style.display = 'block';
	anchors[current].xOpacity = cOpacity;
	anchors[nIndex].xOpacity = nOpacity;

	setOpacity(anchors[current]); 
	setOpacity(anchors[nIndex]);

	if(cOpacity<=0){
		anchors[current].style.display = 'none';
		current = nIndex;

		if(window.alternateImgs.length > window.loaded){
			window.loading=true;
			addImage(window.alternateImgs[window.loaded]);
		}

		setTimeout(fadeBanners,fadeTime);
	}else{
		setTimeout(fadeBanners,50);
	}

	function setOpacity(obj){
		if(obj.xOpacity>.99){
			obj.xOpacity = .99;
			return;
		}

		obj.style.opacity = obj.xOpacity;
		obj.style.MozOpacity = obj.xOpacity;
		obj.style.filter = 'alpha(opacity=' + (obj.xOpacity*100) + ')';
	}
}

function addImage(imgSrc){

	var newImage = document.createElement('img');
	newImage.src = imgSrc;
	newImage.xOpacity = 0;

	document.getElementById('albumFader').appendChild(newImage);
	newImage.style.display = 'none';

	newImage.onload = function(){
		window.loading = false;
		window.anchors = document.getElementById('albumFader').getElementsByTagName('img');
	}

	window.loaded++;
}

 /*
  initFlashMolentje
*/

function initFlashMolentje(){

	var molen = new SWFObject('/img/template/molentje.swf', 'molen', '130', '130', '9', '#ffffff');
	molen.addParam('wmode', 'transparent');
	molen.addParam('salign', 'T');
	molen.addParam('menu', 'false');
	molen.addParam('quality', 'high');
	molen.addParam('loop', 'true');
	molen.addParam('allowscriptaccess', 'always');
	molen.write('wieken');	
}

function getFlashMovie(movieName) {
	var isIE = navigator.appName.indexOf("Microsoft") != -1;
	return (isIE) ? window[movieName] : document[movieName];
}


function rotateMolentje(){

	if(!document.body.className.match('d1479')){
		getFlashMovie("molen").playMill(16); // par = rotationspeed

	}

} /*
initInputFocus
*/
function initInputFocus(elemId, elemValue){
	if(!document.getElementById(elemId)) return false;
	var elem = document.getElementById(elemId);
	
	elem.value = elemValue;

	elem.onfocus = function(){
		if(this.value == elemValue){
			this.value = '';
		}
		this.select();
	}
	
	elem.onblur = function(){
		if(this.value == ''){
			this.value = elemValue;
		}
	}

	//hide label
	if(elem.parentNode.getElementsByTagName('span').length){
		elem.parentNode.getElementsByTagName('span')[0].style.display = 'none';
	}
	
}




/*
	initInputFocus by title
*/
function initInputFocusByTitle(){
	var inputs = document.getElementById('site').getElementsByTagName('input');
	var areas = document.getElementById('site').getElementsByTagName('textarea');
	
	var alLinputs = new Array();
	for(var i = 0; i < inputs.length; i++){
		if(inputs[i].getAttribute('type').toLowerCase() == 'text') alLinputs.push(inputs[i]);
	}
	for(var i = 0; i < areas.length; i++){
		alLinputs.push(areas[i]);
	}
	
	if(alLinputs.length == 0) return false;
	
	for(var i = 0; i < alLinputs.length; i++){
		
		if(alLinputs[i].parentNode.nodeName.toLowerCase() != 'label') continue;
		
		alLinputs[i].parentNode.getElementsByTagName('span')[0].style.display = 'none';
		alLinputs[i].value = alLinputs[i].parentNode.getAttribute('title');
		alLinputs[i].onfocus = function(){
			if(this.value == this.parentNode.getAttribute('title')){
				this.value = '';
			}
			this.select();
		}
		alLinputs[i].onblur = function(){
			if(this.value == ''){
				this.value = this.parentNode.getAttribute('title');
			}
		}
	}
}


 /*
	initLangNav
*/

function initLangNav(){
	if(!document.getElementById('langNav')) return false;
	if(!document.getElementById('langNav').getElementsByTagName('li')) return false;
	
	var listItems = document.getElementById('langNav').getElementsByTagName('li');
	var link;
	
	var select = document.createElement('select');
	select.id = 'langNavSelect';
	select.onchange = function(){
		window.open(this.value, '_self');
	}
	
	var lang = document.getElementsByTagName('html')[0].getAttribute('lang');
	
	if(lang == 'de') select.options[select.options.length] = new Option('Deutsch', '');
	if(lang == 'de-de') select.options[select.options.length] = new Option('Deutsch', '');
	if(lang == 'en') select.options[select.options.length] = new Option('English', '');
	if(lang == 'nl') select.options[select.options.length] = new Option('Nederlands', '');
	if(lang == 'nl-nl') select.options[select.options.length] = new Option('Nederlands', '');
	if(lang == 'nl-be') select.options[select.options.length] = new Option('Vlaams', '');
	if(lang == 'fr') select.options[select.options.length] = new Option('Nederlands', '');
	
	for(var i = 0; i < listItems.length; i++){
		link = listItems[i].getElementsByTagName('a')[0];
		select.options[select.options.length] = new Option(link.title, link.href);
	}
	document.getElementById('site').appendChild(select);
	document.getElementById('langNav').style.display = 'none';
}

 /*
  main-nav menus delay
*/
function initMainNav() {

	//create strik
	var strikSpan = document.createElement('span');
	strikSpan.id = 'strik';
	document.getElementById('main-nav').appendChild(strikSpan);


	var nodes = new Array();
	var mainNavCn = document.getElementById('main-nav').childNodes;
	for (i = 0; i < mainNavCn.length; i++) {
		if(mainNavCn[i].nodeName.toLowerCase() == 'li') nodes.push(mainNavCn[i]);
	}

	for (i = 0; i < nodes.length; i++) {
		// init out
		nodes[i].className += ' out';
		
		// over
		nodes[i].onmouseover = function(){
			// close others

			//blockingElements('hide');

			var nodes = new Array();
			var mainNavCn = document.getElementById('main-nav').childNodes;
			for (j = 0; j < mainNavCn.length; j++) {
				if(mainNavCn[j].nodeName.toLowerCase() == 'li') nodes.push(mainNavCn[j]);
			}

			for (j = 0; j < nodes.length; j++) {
				if (nodes[j] != this) {
					nodes[j].className = nodes[j].className.replace(' wait', ' out');
				}
			}

			this.className = this.className.replace(' wait', ' hover');
			this.className = this.className.replace(' out', ' hover');
			document.getElementById('strik').className = this.className;
			
			if(this.t){
				clearTimeout(this.t);
			}
		}
	
		// out
		nodes[i].onmouseout = function(){
			this.className = this.className.replace(' hover', ' wait');
			document.getElementById('strik').className = this.className;
			
			var _this = this;				
			this.t = setTimeout(function(){
				if(_this.className.match('wait')){
					_this.className = _this.className.replace(' wait', ' out');
					document.getElementById('strik').className = _this.className;
					//blockingElements('show');
				} 

			}, 600);
		}
	}
}

function blockingElements(visibity){

	var elements = ['form_size','form_quantity']; // add elementID's to hide here

	if(visibity == 'show'){
		visibity = 'visible';
	} else {
		visibity = 'hidden';
	}
	for (i = 0; i < elements.length; i++) {
		if(document.getElementById(elements[i])){
			document.getElementById(elements[i]).style.visibility = visibity;
		}
	}
}

 /*
	tab navigatie
*/

function initMultiTab(){ 
	var isTabs = document.getElementsByClassName('isTab');
	var hash = window.location.hash;
	var tabNavigations = document.getElementsByClassName('tabnavigation');
	
	// geen hash
	var newHash = '';
	if(hash.indexOf('#tab') == -1){
		
		var startTabs = document.getElementsByClassName('startTab');
		for(var i = 0; i < startTabs.length; i++){
			
			var startId = startTabs[i].id;
			var navId = '';
			for(var ii = 0; ii < tabNavigations.length; ii++){
				var links = tabNavigations[ii].getElementsByTagName('a');
				for(var iii = 0; iii < links.length; iii++){
					if(links[iii].href.indexOf(startId) != -1){
						navId = links[iii].parentNode.parentNode.parentNode.id;
					}
				}
			}

			if(i == 0){
				newHash = newHash+'#tab-'+navId+'-'+startId;
			} else {
				newHash = newHash+'&tab-'+navId+'-'+startId;
			}
		}
		
		if(newHash.length > 0){
			window.location.hash = newHash;
		}
		doTabsFromHash();
	}
	
	// wel hash
	else if(hash.indexOf('#tab-') != -1){
		doTabsFromHash();
	}
	
	// init onclicks
	for(var i = 0; i < tabNavigations.length; i++){
		var tablinks = tabNavigations[i].getElementsByTagName('a');
		for(var ii = 0; ii < tablinks.length; ii++){
			tablinks[ii].onclick = function(){
				var newOpen = this.href.split('#')[1];

				var thisnavId = '';
				var tabNavigations = document.getElementsByClassName('tabnavigation');
				for(var iii = 0; iii < tabNavigations.length; iii++){
					var navLinks = tabNavigations[iii].getElementsByTagName('a');
					for(var iiii = 0; iiii < navLinks.length; iiii++){
						if(navLinks[iiii].href.indexOf(newOpen) != -1){
							thisnavId = navLinks[iiii].parentNode.parentNode.parentNode.id;
						}
					}
				}

				var oldTabId = '';
				thisHash = window.location.hash.split('&');
				for(var iii = 0; iii < thisHash.length; iii++){
					var thish = thisHash[iii].split('-');
					if(thish[1] == thisnavId){
						oldTabId = thish[2];
					}
				}
				window.location.hash = window.location.hash.replace(oldTabId, newOpen);
				doTabsFromHash();
				this.blur();
				return false;
				
			}
		}
	}
}


function doTabsFromHash(){
	var isTabs = document.getElementsByClassName('isTab');
	
	for(var i = 0; i < isTabs.length; i++){
		isTabs[i].style.display = 'none';
	}

	var hash = window.location.hash;
	hash = hash.split('&');	
	for(var i = 0; i < hash.length; i++){
		var h = hash[i].split('-');
		var navId = h[1];
		var tabToOpen = h[2];
		
		if(document.getElementById(tabToOpen))document.getElementById(tabToOpen).style.display = 'block';
		
		// set startlink to active
		if(document.getElementById(navId)){
		var navLinks = document.getElementById(navId).getElementsByTagName('a');
			for(var ii = 0; ii < navLinks.length; ii++){
				navLinks[ii].parentNode.className = navLinks[ii].parentNode.className.replace(' active', '');
				navLinks[ii].parentNode.className = navLinks[ii].parentNode.className.replace('active', '');
				
				if(navLinks[ii].href.indexOf(tabToOpen) != -1){
					navLinks[ii].parentNode.className = navLinks[ii].parentNode.className + ' active';
				}
			}	
		}
	}

	hash = null;
	tabNavigations = null;
	startTabs = null;
	newHash = null;
	mediaObjects = null;
	mediaEmbeds = null;
}

function initStartCountry(){
	bodyClass = document.getElementsByTagName('body')[0].className;
	if(bodyClass.indexOf('country-') != -1){
		var index = bodyClass.indexOf('country-');
		countryCode = bodyClass.substring(index + 8,index + 10);
		
		var startId = '';
		var countryLi = document.getElementsByClassName(countryCode);
		if(!countryLi.length == 0){
			startId = countryLi[0].getElementsByTagName('a')[0].href.split('#')[1];
		}
		if(document.getElementById(startId))document.getElementById(startId).className = document.getElementById(startId).className + ' startTab';
	}
}


 /*
	initZebraTables
*/

function initZebraTables(){

	var rows = document.getElementsByTagName('tr');
	for(var i = 0; i< rows.length; i++){
		if((i % 2) == 0){
			rows[i].className += ' odd';
		}else{
			rows[i].className += ' even';
		}

		if(rows[i].cells.length){
			rows[i].cells[0].className += ' firstCell';
		}
	}


	var theads = document.getElementsByTagName('thead');
	for(var i = 0; i< theads.length; i++){
		if(theads[i].rows.length){
			theads[i].rows[0].className += ' firstRow';
			theads[i].rows[theads[i].rows.length-1].className += ' lastRow';
		}
	}


	var tbodies = document.getElementsByTagName('tbody');
	for(var i = 0; i< tbodies.length; i++){
		if(tbodies[i].rows.length){
			tbodies[i].rows[0].className += ' firstRow';
			tbodies[i].rows[tbodies[i].rows.length-1].className += ' lastRow';
		}
	}


	var tFoots = document.getElementsByTagName('tfoot');
	for(var i = 0; i< tFoots.length; i++){
		if(tFoots[i].rows.length){
			tFoots[i].rows[0].className += ' firstRow';
			tFoots[i].rows[tFoots[i].rows.length-1].className += ' lastRow';
		}
	}

}


 // noscript

var initStorelocator = function(){
    /* storeLocator */
    $('.mapNoShow').removeClass('mapNoShow');
    $('.mapShow').addClass('mapNoShow');
    $('.mapShow').removeClass('mapShow');
    
/*    if ($('#kaart:checked') && $('#query').val() == '') {
        $('#query').val('(zoek op: stad/postcode)');
    }*/
    
/*    if ($('#adreslijst:checked') && $('#query').val() == '') {
        $('#query').val('(zoek op: winkel/woonplaats)');
    }*/
    
/*    $('#query').focus(function(){
		if( $('#query').val() == '(zoek op: stad/postcode)' || $('#query').val() == '(zoek op: winkel/woonplaats)' ){
			$('#query').val('');
		}
        
    });*/
    
/*    $('#query').focusout(function(){
        if ($('#kaart:checked') && $('#query').val() == '') {
            $('#query').val('(zoek op: stad/postcode)');
        }
        
        if ($('#adreslijst:checked') && $('#query').val() == '') {
            $('#query').val('(zoek op: winkel/woonplaats)');
        }
    });*/
    
    $('#kaart').click(function(){
        $('#mapcontainer').removeClass('mapNoShow');
        $('#mapcontainer').addClass('mapShow');
        
        $('#addressescontainer').removeClass('mapShow');
        $('#addressescontainer').addClass('mapNoShow');
        
       
       if($('#query').val() == '' || $('#query').val() == '(zoek op: stad/postcode)' || $('#query').val() == '(zoek op: winkel/woonplaats)'){
        initializeCompanyMap(0);
}else{
   init();
}
      /*  if ($('#query').val() != '') {
            $('#findaddress').trigger('click');
        }*/
		
/*		if ( ( $('#kaart:checked') && $('#query').val() == '' ) || ( $('#kaart:checked') && $('#query').val() == '(zoek op: winkel/woonplaats)' ) ) {
	        $('#query').val('(zoek op: stad/postcode)');
	    } else {
			$('#findaddress').trigger('click');
		}*/
    });

    $('#adreslijst').click(function(){
        $('#mapcontainer').removeClass('mapShow');
        $('#mapcontainer').addClass('mapNoShow');
        
        $('#addressescontainer').removeClass('mapNoShow');
        $('#addressescontainer').addClass('mapShow');
        
		
/*		if ( ($('#adreslijst:checked') && $('#query').val() == '' ) || ( $('#adreslijst:checked') && $('#query').val() == '(zoek op: stad/postcode)' ) ) {
	        $('#query').val('(zoek op: winkel/woonplaats)');
	    } else {
			$('#findaddressGet').trigger('click');
		}*/
    });
    
    // when user selects the addresslist and form is filled, then submit it and load addresses
    /*$('#adreslijst').mouseup(function(){
        if ($('#query').val() != '' && $('#query').val() != '(zoek op: stad/postcode)') {
            $('form#slocSearchWrapper').submit();
        }
    });*/
    
    // when adreslijst is selected when page loads, then also trigger clickevent on it to submit form
    if ($('#adreslijst').is(':checked')) {
        $('#adreslijst').trigger('click');
    }else{
        $('input#kaart').attr('checked', 'checked');
    $('input#kaart').trigger('click');
}

   $('#findaddressGet').click(function(){
     if($('#query').val() == '(zoek op: winkel/woonplaats)'){
       $('#query').val('');
     }
   });

   $('#findaddress').click(function(){
     if($('#query').val() == '(zoek op: stad/postcode)' || $('#query').val() == ''){
       $('#query').val('');
       geocode();
     }
   });

jQuery('#storeLocatorFormReset').bind('click', resetStoreLocationFilterClicked);
}

var resetStoreLocationFilterClicked = function(e){
resetStoreLocationFilter();
return false;
}

var resetStoreLocationFilter = function(){
jQuery('#query').val('');
jQuery('#storeLocatorFormCountryID').val('');
}

var goToMap = function(address){
    $('#query').val(address);
    $('input#kaart').attr('checked', 'checked');
    $('input#kaart').trigger('click');
    $('#findaddress').trigger('click');
}
 /*
	markLinks
*/

function markLinks(){

	var extIcon = '/img/template/link-icons/external.png';	
	var emailIcon = '/img/template/link-icons/email.png';
	var twitIcon = '/img/template/link-icons/twitter-white.png';
	var linkedIcon = '/img/template/link-icons/linkedIn.png';
	var vCardIcon = '/img/template/link-icons/vCard.png';
	var pdfIcon = '/img/template/link-icons/pdf.png';
	var xlsIcon = '/img/template/link-icons/xls.png';
	var docIcon = '/img/template/link-icons/doc.png';
	var pptIcon = '/img/template/link-icons/ppt.png';
	var zipIcon = '/img/template/link-icons/zip.png';
	var wmvIcon = '/img/template/link-icons/wmv.png';

	
	var links = document.getElementsByTagName('a');
	var link, mark;
	
	for(var i = 0; i < links.length; i++){
		link = links[i];
		
		// ext
		if(link.getAttribute('rel') == 'ext' || link.getAttribute('rel') == 'external'){
			link.className += ' external';
			link.target = '_blank';
		}
				
		// mailto
		if(link.getElementsByTagName('img').length == 0){
			// email (niet obv rel)
                   if (link.getAttribute('href') !== null) {
			if(link.getAttribute('href').indexOf('mailto:') != -1){
				link.className += ' external mail';
				link.target = '_blank';
				mark = document.createElement('img');
				mark.src = emailIcon;
				link.appendChild(mark);
			}
                   }
		}
		
		// ext & specific site
		if(link.getElementsByTagName('img').length == 0){
			if(link.getAttribute('rel') == 'ext' || link.getAttribute('rel') == 'external'){
				// twitter
				if(link.getAttribute('href').match('twitter.com')){
					link.className += ' twitter';
					mark = document.createElement('img');
					mark.src = twitIcon;
					link.insertBefore(mark , (link.firstChild));
				}
				// linkedIn
				if(link.getAttribute('href').match('linkedin.com')){
					link.className += ' linkedin';
					mark = document.createElement('img');
					mark.src = linkedIcon;
					link.insertBefore(mark , (link.firstChild));
				}
			}
		}
		
		// ext & filetypes
		if(link.getElementsByTagName('img').length == 0){
			if(link.getAttribute('rel') == 'ext' || link.getAttribute('rel') == 'external'){
				// file types
				var hEnd = link.getAttribute('href').substring(link.getAttribute('href').length-4).toLowerCase();
				switch (hEnd){
				case '.vcf':
					mark = document.createElement('img');
					mark.src = vCardIcon;
					link.className += ' file vcf';
					link.insertBefore(mark , (link.firstChild));
					link.onclick = handleDownloadClick;
					break;
				case '.zip':
					mark = document.createElement('img');
					mark.src = zipIcon;
					link.className += ' file zip';
					link.insertBefore(mark , (link.firstChild));
					link.onclick = handleDownloadClick;
					break;
				case '.wmv':
					mark = document.createElement('img');
					mark.src = wmvIcon;
					link.className += ' file wmv';
					link.insertBefore(mark , (link.firstChild));
					link.onclick = handleDownloadClick;
					break;
				case '.pdf': case 'pdfx':
					mark = document.createElement('img');
					mark.src = pdfIcon;
					link.className += ' file pfd';
					link.insertBefore(mark , (link.firstChild));
					link.onclick = handleDownloadClick;
					break;
				case '.xls': case 'xlsx':
					mark = document.createElement('img');
					mark.src = xlsIcon;
					link.className += ' file xls';
					link.insertBefore(mark , (link.firstChild));
					link.onclick = handleDownloadClick;
					break;
				case '.doc': case 'docx':
					mark = document.createElement('img');
					mark.src = docIcon;
					link.className += ' file doc';
					link.insertBefore(mark , (link.firstChild));
					link.onclick = handleDownloadClick;
					break;
				case '.ppt': case 'pptx':
					mark = document.createElement('img');
					mark.src = pptIcon;
					link.className += ' file ppt';
					link.insertBefore(mark , (link.firstChild));
					link.onclick = handleDownloadClick;
					break;
				default:
					mark = document.createElement('img');
					mark.src = extIcon;
					link.appendChild(mark);
					link.onclick = handleExternalSiteClick;
				}
			}
		}
	}
	
	// print text
	links = document.getElementById('content').getElementsByTagName('a');
	for(var i = 0; i < links.length; i++){
		if(links[i].getAttribute('href')){
			oHref = document.createElement('span');
			oHref.className = 'print';
			oHref.appendChild((document.createTextNode(' [' + links[i].href + ']')));
			links[i].appendChild(oHref);
		}
	}

	mark = null;
	href = null;
	link = null;
	links = null;
}

function handleDownloadClick(){
	if(typeof pageTracker._trackPageview == 'function'){
		pageTracker._trackPageview('/downloads/' + this.href);
	}
}

function handleExternalSiteClick(){
	if(typeof pageTracker._trackPageview == 'function'){
		pageTracker._trackPageview('/externalSites/' + this.href);
	}
}

 /*
  newsLetterSubscription
*/
function initNewsLetterSubscriptionForm(){
  if(!document.getElementById('newsLetterServiceFormMethod')) return false;

  var formMethod = document.getElementById('newsLetterServiceFormMethod');

  if(document.getElementById('buttonUnsubscribeNewsLetterService')){
    var unsubscribeButton = document.getElementById('buttonUnsubscribeNewsLetterService');
    
    unsubscribeButton.onclick = function(){
      formMethod.value = 'unsubscribe';
    }
  }

  if(document.getElementById('buttonSubscribeNewsLetterService')){
    var subscribeButton = document.getElementById('buttonSubscribeNewsLetterService');

    subscribeButton.onclick = function(){
      formMethod.value = 'subscribe';
    }
  }
} /*
  popups
*/
var aPopups = new Array();
var aModalPopups = new Array();

window.onfocus = function()
{
	if(aModalPopups.length != 0)
	{
		aModalPopups[0].focus();
	}
}


var sDefaultFeatures = 'channelmode=0, fullscreen=0, location=0, menubar=0, resizable=0, scrollbars=0, status=0, titlebar=0, toolbar=0';

// create popup
function createPopup(sURL, sName, sFeatures, iWidth, iHeight)
{
	var iLeft	= (screen.availWidth - iWidth) / 2;
	var iTop	= (screen.availHeight - iHeight) / 2;
	
	return window.open(sURL, sName, sFeatures + ', width=' + iWidth + ', height=' + iHeight + ', left=' + iLeft + ', top=' + iTop);
} /*
	popup
*/
function openPopup(html){
	if(!document.getElementById('popupWrapper')){
		var popupWrapper = document.createElement('div');
		popupWrapper.id = 'popupWrapper';
		popupWrapper.onclick = function(){ closePopup() };
		popupWrapper.innerHTML = '<div class="header"><a href="javascript:closePopup();"><em>Close</em></a></div> <div class="body" id="popupBody"></div>';
		document.body.appendChild(popupWrapper);
	}

	document.getElementById('popupBody').innerHTML = html;
	document.getElementById('popupWrapper').style.display = 'block';
	blockingElements('hide');

}

function closePopup(){
	document.getElementById('popupWrapper').style.display = 'none';
	blockingElements('show');
}

/*
	initProductPhotoPopup
	div#productDetails div.productImage a img
*/
function initProductPhotoPopup(){
	if(!document.getElementById('productDetails')) return false;
	
	var mediumSizeLink = $('div#productDetails div.productImage a');
	var mediumSizeImg = $('div#productDetails div.productImage a img');
	mediumSizeLink[0].onclick = function(){
		openPopup('<img src="' + mediumSizeImg[0].src.replace('medium', 'large') +'" />');
		return false;
	}
}

 function rebuildSizes() {
    var selectedSize = $('#form_size').val();
    if ($('#form_size').attr('name') == 'size') {
        $('#form_size option').each(function() {
            if (selectedSize == $(this).val()) {
                className = 'selectedsize';
            } else {
                className = '';
            }
            $(this).replaceWith($('<li class="' + className + '" name="' + $(this).val() + '">' + $(this).html() + '</i>'));
        });

        $('#form_size').replaceWith($('<ul id="sizeSelector">' + $('#form_size').html() + '</ul><input type="hidden" id="form_size" name="size" value="" />'));
        $('ul#sizeSelector li').each(function() {
            var sizeValue = $(this).attr('name');
            $(this).click(function() {
                $('.selectedsize').each(function() {
                    $(this).removeClass('selectedsize');
                });
                $('input#form_size').val(sizeValue);
                $(this).addClass('selectedsize');
            });
        });
        $('#form_size').val($('li.selectedsize').attr('name'));
    }
}



 /*
	sisoCarousel - Sigma Solutions
	.carousel ul li
*/

(function($){
	$.fn.sisoCarousel = function(options){
		return this.each(function(){
			$.sisoCarousel(this, options);
		});
	};

	$.sisoCarousel = function(container, options){
		var o = {
			pageWidth: 1000,
			pageHeight: 410,
			liPerPage: 5,
			speed: 1000,
			interval: 2000,
			animateFirst: false,
			autoPlay: false,
			controls: true
		};
		if (options) $.extend(o, options);
		o.pageCount = Math.ceil($(container).find('ul:first li').length / o.liPerPage);
		o.currentPage = 0;
		//o.currentPage = o.pageCount-1;
		if(o.autoPlay) o.animateFirst = true;
		
		$(container).parent().addClass('carouselOn');
		
		// png filter for ie6
		if(jQuery.browser.msie && jQuery.browser.version == '6.0'){
			$(container).find('img').load(function(){
				$(this).hide();
				$replacer = $("<span />").css({
					display: 'block',
					width: $(this).width()+'px',
					height: $(this).height()+'px',
					filter: "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + $(this).attr('src') + "', sizingMethod='scale')"
				}).appendTo($(this).parent());
			});
		}
		
		// split given ul into seperate ul's (pages)
		var $lis = $(container).find('ul:first li').filter(':gt('+ (o.liPerPage - 1) +')');
		for(i = 0; i < o.pageCount-1; i++){
			$ul = $("<ul />").append($lis.slice(i * o.liPerPage, (i * o.liPerPage) + o.liPerPage)).appendTo($(container));
		}

		// loop ul's
		$(container).find('ul').each(function(i){
			// add classnames
			$(this).addClass('ul'+i);
			$(this).find('li').each(function(j){
				$(this).addClass('li'+j);
			});
			
			// place all ul out of sight
			$(this).css({
				position: 'absolute',
				left: o.pageWidth+'px'
			});
		});
		
		if(o.controls){
			// create prev link
			$prevLink = $('<a class="prevLink" href="#" />').html('<em>Vorige</em>').click(function(){
				if($(container).find('ul:animated').length)return false;
				if(container.sisoCarouselTimeout) clearTimeout(container.sisoCarouselTimeout);
				rotateMolentje();
				move(container, -1); return false;
			}).appendTo($(container).parent());

			// create next link
			$nextLink = $('<a class="nextLink" href="#" />').html('<em>Volgende</em>').click(function(){
				if($(container).find('ul:animated').length)return false;
				if(container.sisoCarouselTimeout) clearTimeout(container.sisoCarouselTimeout);
				rotateMolentje();
				move(container, 1); return false;
			}).appendTo($(container).parent());
		}

		// move
		function move(container, dir){
			// animate current ul
			$(container).find('.ul'+o.currentPage).animate({ left: dir*o.pageWidth+'px' }, o.speed, function(){});
			
			// update currentPage
			o.currentPage = o.currentPage + dir;
			if(o.currentPage < 0){
				o.currentPage = o.pageCount -1;
			} else if(o.currentPage > o.pageCount -1){
				o.currentPage = 0;
			}
			
			// animate new ul
			if(dir == -1){
				$(container).find('.ul'+o.currentPage).css({ left: o.pageWidth+'px' });
			} else {
				$(container).find('.ul'+o.currentPage).css({ left: -1 * o.pageWidth+'px' });
			}
			$(container).find('.ul'+o.currentPage).animate({ left: '0px' }, o.speed, function(){
				if(o.autoPlay){
					container.sisoCarouselTimeout = setTimeout(function(){
						move(container,1);
					}, o.interval);
				}
			});
		}

		// init animateFirst
		if(o.animateFirst || o.autoPlay){
			container.sisoCarouselTimeout = setTimeout(function(){
				move(container,1);
			}, o.interval);
		}else {
			// first to 0
			$(container).find('.ul'+o.currentPage).css({ left: '0px' });
		}
	};
})(jQuery);

 /**
 * SWFObject v1.5: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
 *
 * SWFObject is (c) 2007 Geoff Stearns and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 */
if(typeof deconcept=="undefined"){var deconcept=new Object();}if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a){if(!document.getElementById){return;}this.DETECT_KEY=_a?_a:"detectflash";this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params=new Object();this.variables=new Object();this.attributes=new Array();if(_1){this.setAttribute("swf",_1);}if(id){this.setAttribute("id",id);}if(w){this.setAttribute("width",w);}if(h){this.setAttribute("height",h);}if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(!window.opera&&document.all&&this.installedVer.major>7){deconcept.SWFObject.doPrepUnload=true;}if(c){this.addParam("bgcolor",c);}var q=_7?_7:"high";this.addParam("quality",q);this.setAttribute("useExpressInstall",false);this.setAttribute("doExpressInstall",false);var _c=(_8)?_8:window.location;this.setAttribute("xiRedirectUrl",_c);this.setAttribute("redirectUrl","");if(_9){this.setAttribute("redirectUrl",_9);}};deconcept.SWFObject.prototype={useExpressInstall:function(_d){this.xiSWFPath=!_d?"expressinstall.swf":_d;this.setAttribute("useExpressInstall",true);},setAttribute:function(_e,_f){this.attributes[_e]=_f;},getAttribute:function(_10){return this.attributes[_10];},addParam:function(_11,_12){this.params[_11]=_12;},getParams:function(){return this.params;},addVariable:function(_13,_14){this.variables[_13]=_14;},getVariable:function(_15){return this.variables[_15];},getVariables:function(){return this.variables;},getVariablePairs:function(){var _16=new Array();var key;var _18=this.getVariables();for(key in _18){_16[_16.length]=key+"="+_18[key];}return _16;},getSWFHTML:function(){var _19="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");this.setAttribute("swf",this.xiSWFPath);}_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\"";_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";var _1a=this.getParams();for(var key in _1a){_19+=[key]+"=\""+_1a[key]+"\" ";}var _1c=this.getVariablePairs().join("&");if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}_19+="/>";}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");this.setAttribute("swf",this.xiSWFPath);}_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\">";_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";var _1d=this.getParams();for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}var _1f=this.getVariablePairs().join("&");if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}_19+="</object>";}return _19;},write:function(_20){if(this.getAttribute("useExpressInstall")){var _21=new deconcept.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){this.setAttribute("doExpressInstall",true);this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));document.title=document.title.slice(0,47)+" - Flash Player Installation";this.addVariable("MMdoctitle",document.title);}}if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){var n=(typeof _20=="string")?document.getElementById(_20):_20;n.innerHTML=this.getSWFHTML();return true;}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}return false;}};deconcept.SWFObjectUtil.getPlayerVersion=function(){var _23=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var x=navigator.plugins["Shockwave Flash"];if(x&&x.description){_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}}else{if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){var axo=1;var _26=3;while(axo){try{_26++;axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+_26);_23=new deconcept.PlayerVersion([_26,0,0]);}catch(e){axo=null;}}}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");_23=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}catch(e){if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}catch(e){}}if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}}return _23;};deconcept.PlayerVersion=function(_29){this.major=_29[0]!=null?parseInt(_29[0]):0;this.minor=_29[1]!=null?parseInt(_29[1]):0;this.rev=_29[2]!=null?parseInt(_29[2]):0;};deconcept.PlayerVersion.prototype.versionIsValid=function(fv){if(this.major<fv.major){return false;}if(this.major>fv.major){return true;}if(this.minor<fv.minor){return false;}if(this.minor>fv.minor){return true;}if(this.rev<fv.rev){return false;}return true;};deconcept.util={getRequestParameter:function(_2b){var q=document.location.search||document.location.hash;if(_2b==null){return q;}if(q){var _2d=q.substring(1).split("&");for(var i=0;i<_2d.length;i++){if(_2d[i].substring(0,_2d[i].indexOf("="))==_2b){return _2d[i].substring((_2d[i].indexOf("=")+1));}}}return "";}};deconcept.SWFObjectUtil.cleanupSWFs=function(){var _2f=document.getElementsByTagName("OBJECT");for(var i=_2f.length-1;i>=0;i--){_2f[i].style.display="none";for(var x in _2f[i]){if(typeof _2f[i][x]=="function"){_2f[i][x]=function(){};}}}};if(deconcept.SWFObject.doPrepUnload){if(!deconcept.unloadSet){deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs);};window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet=true;}}if(!document.getElementById&&document.all){document.getElementById=function(id){return document.all[id];};}var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;

 /*
  thumbnails
*/
function initThumbnails(){
	var aThumbnails = document.getElementsByTagName('img');
	var oThumbnail;
	
	for(var i = 0; i < aThumbnails.length; i++)	{
		oThumbnail = aThumbnails[i];
		
		if(oThumbnail.className.toLowerCase() == 'thumbnail'){
			
			oThumbnail.parentNode.setAttribute('naturalWidth', oThumbnail.width);
			oThumbnail.parentNode.setAttribute('naturalHeight', oThumbnail.height);
			
			// resize image
			if(oThumbnail.width > oThumbnail.height){
				oThumbnail.style.width = '90px';
			}else{
				oThumbnail.style.height = '60px';
			}
			
			// create popup
			oThumbnail.parentNode.onclick = function(){
				var iWidth = this.getAttribute('naturalWidth');
				var iHeight = this.getAttribute('naturalHeight');
				
				createPopup(this.getAttribute('href'), 'thumbnail', sDefaultFeatures, iWidth, iHeight);
				
				return false;
			}
		}
	}
}

