

ddaccordion.init({
	headerclass: "expandable", //Shared CSS class name of headers group that are expandable
	contentclass: "categoryitems", //Shared CSS class name of contents group
	revealtype: "mouseover", //Reveal content when user clicks or onmouseover the header? Valid value: "click", "clickgo", or "mouseover"
	mouseoverdelay: 350, //if revealtype="mouseover", set delay in milliseconds before header expands onMouseover
	collapseprev: true, //Collapse previous content (so only one open at any time)? true/false 
	defaultexpanded: [0], //index of content(s) open by default [index1, index2, etc]. [] denotes no content
	onemustopen: true, //Specify whether at least one header should be open always (so never all headers closed)
	animatedefault: false, //Should contents open by default be animated into view?
	persiststate: false, //persist state of opened contents within browser session?
	//toggleclass: ["", "openheader"], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
	toggleclass: ["", ""], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
	togglehtml: ["prefix", "", ""], //Additional HTML added to the header when it's collapsed and expanded, respectively  ["position", "html1", "html2"] (see docs)
	animatespeed: "fast", //speed of animation: integer in milliseconds (ie: 200), or keywords "fast", "normal", or "slow"
	oninit:function(headers, expandedindices){ //custom code to run when headers have initalized
		//do nothing
	},
	onopenclose:function(header, index, state, isuseractivated){ //custom code to run whenever a header is opened or closed
		//do nothing
	}
});



var active_color = '#000'; // Colour of user provided text
var inactive_color = '#ccc'; // Colour of default text


function setPage(headerID, pagina){
	$(".openheader").removeClass('openheader');
	switch (headerID)
	{
		case "een":
			var nr = 1;
		  $("#een").addClass('openheader');
		  break;
		case "twee":
			var nr = 2;
		  $("#twee").addClass('openheader');
		  break;
		case "drie":
		  var nr = 3;
		  $("#drie").addClass('openheader');
		  break;
		case "vier":
			var nr = 4;
		  $("#vier").addClass('openheader');
		  break;
		case "vijf":
			var nr = 5;
		  $("#vijf").addClass('openheader');
		  break;
		case "zes":
			var nr = 6;
		  $("#zes").addClass('openheader');
		  break;
		case "zeven":
		  var nr = 7;
		  $("#zeven").addClass('openheader');
		  break;
		case "acht":
		  var nr = 8;
		  $("#acht").addClass('openheader');
		  break;
		case "negen":
		  var nr = 9;
		  $("#negen").addClass('openheader');
		  break;
		case "tien":
		  var nr = 10;
		  $("#tien").addClass('openheader');
		  break;	
		case "elf":
		  var nr = 11;
		  $("#elf").addClass('openheader');
		  break;
		case "twaalf":
		  var nr = 12;
		  $("#twaalf").addClass('openheader');
		  break;

	}
	var loc= new String(window.location)
	if ((loc.indexOf("dealer.php")) == -1){	
		/*$("#midden").load("./pages/"  + pagina + ".php");*/
		$("#midden").fadeOut('fast', function() {
			$("#midden").load("./pages/"  + pagina + ".php").hide().fadeIn('fast', function(){
			if (pagina == "vinden"){
					$("a.fancy").fancybox({
						'width' : 800,
						'height': 350,
						'scrolling' : 'no',
						'transitionIn'		: 'elastic',
						'transitionOut'		: 'elastic',
						'type'			: 'iframe'
					});
			}
				
			});
		});
	}else{
		window.location = "index.php?p="  + pagina + "&expandable=" + nr;
	}
}
function inschrijven(){
	$("a.inschrijven").attr("href", "./scripting/nieuwsbrief.php?email="+$('#email-adres').val());
	$("a.inschrijven").click();//trigger('click');
}

$(document).ready(function(){
	
		$("a.alcarfancy").fancybox({
		'width' : 1050,
		'height': 600,
		'autoDimensions': true,
		'scrolling' : 'auto',
		'transitionIn'		: 'elastic',
		'transitionOut'		: 'elastic',
		'type'			: 'iframe'
	});
	

	//Custom settings
	var style_in = 'easeOutBounce';
	var style_out = 'jswing';
	var speed_in = 1000;
	var speed_out = 300;	

	//Calculation for corners
	var neg = -115;	
	var pos = 115;	
	var out = 230;
	
	$('.qitem2').each(function () {
	
		url = $(this).find('a').attr('href');
		img = $(this).find('img').attr('src');
		alt = $(this).find('img').attr('img');
		
		$('img', this).remove();
		$(this).append('<div class="topLeft2"></div><div class="topRight2"></div><div class="bottomLeft2"></div><div class="bottomRight2"></div>');
		$(this).children('div').css('background-image','url('+ img + ')');

		$(this).find('div.topLeft2').css({top:0, left:0, width:111 , height:67});	
		$(this).find('div.topRight2').css({top:0, left:111, width:111 , height:67});	
		$(this).find('div.bottomLeft2').css({bottom:0, left:0, width:111 , height:67});	
		$(this).find('div.bottomRight2').css({bottom:0, left:111, width:111 , height:67});	

	}).hover(function () {
	
		$(this).find('div.topLeft2').stop(false, true).animate({top:-67, left:-111}, {duration:speed_out, easing:style_out});	
		$(this).find('div.topRight2').stop(false, true).animate({top:-67, left:222}, {duration:speed_out, easing:style_out});	
		$(this).find('div.bottomLeft2').stop(false, true).animate({bottom:-67, left:-111}, {duration:speed_out, easing:style_out});	
		$(this).find('div.bottomRight2').stop(false, true).animate({bottom:-67, left:222}, {duration:speed_out, easing:style_out});	
				
	},
	
	function () {

		$(this).find('div.topLeft2').stop(false, true).animate({top:0, left:0}, {duration:speed_in, easing:style_in});	
		$(this).find('div.topRight2').stop(false, true).animate({top:0, left:111}, {duration:speed_in, easing:style_in});	
		$(this).find('div.bottomLeft2').stop(false, true).animate({bottom:0, left:0}, {duration:speed_in, easing:style_in});	
		$(this).find('div.bottomRight2').stop(false, true).animate({bottom:0, left:111}, {duration:speed_in, easing:style_in});	
	
	});/*.click (function () {
		if (($(this).find('a').attr('href') != "") && ($(this).find('a').attr('href') != "http://www.alcar.be/AlcarKonfigurator/produktion_neu/index.php?site=15&lng=vl")){
			window.location = $(this).find('a').attr('href');	
		}
		if ($(this).find('a').attr('href') == "http://www.alcar.be/AlcarKonfigurator/produktion_neu/index.php?site=15&lng=vl"){
				$("a.alcarfancy").trigger('click');
		}
	});*/
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	$("a.alcarfancy2").fancybox({
		'width' : 1050,
		'height': 600,
		'autoDimensions': true,
		'scrolling' : 'auto',
		'transitionIn'		: 'elastic',
		'transitionOut'		: 'elastic',
		'type'			: 'iframe'
	});

	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	$("#inlinePage").fancybox({
		'width'		: '75%',
		'height'		: '75%',
		'autoScale'     	: false,
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'elastic',
		'type'			: 'iframe'
	});
	
	$("#GemeenteSelector").load('./scripting/getGemeentes.php');

	$('#vindByPostCode').click(function() {
		$("a.gemeenteFancy").attr("href", "./scripting/getDealers.php?provincie=&postcode="+$('#ZoekOpPostcode').val());
		$("a.gemeenteFancy").click();//trigger('click');
	});



	
	$("a.gemeenteFancy").fancybox({
		'width' : 800,
		'height': 350,
		'scrolling' : 'no',
		'transitionIn'		: 'elastic',
		'transitionOut'		: 'elastic',
		'type'			: 'iframe'
	});
	
	$("a.fancy").fancybox({
		'width' : 800,
		'height': 350,
		'scrolling' : 'no',
		'transitionIn'		: 'elastic',
		'transitionOut'		: 'elastic',
		'type'			: 'iframe'
	});
	
	$("a.inschrijven").fancybox({
		'width' : 800,
		'height': 350,
		'scrolling' : 'no',
		'transitionIn'		: 'elastic',
		'transitionOut'		: 'elastic',
		'type'			: 'iframe'
	});
	

	$('.nieuwsSlider').cycle({
		fx:     'scrollLeft', 
		timeout: 6000,
		pause:   1
	});
	
	$('.promotiesSlider').cycle({
		fx:     'scrollLeft', // voor alle transities: http://www.malsup.com/jquery/cycle/browser.html
		timeout: 8000,
		pause:   1,
		fit:	1
	});
	
	$("input.default-value").css("color", inactive_color);
  var default_values = new Array();
  $("input.default-value").focus(function() {
    if (!default_values[this.id]) {
      default_values[this.id] = this.value;
    }
    if (this.value == default_values[this.id]) {
      this.value = '';
      this.style.color = active_color;
    }
    $(this).blur(function() {
      if (this.value == '') {
        this.style.color = inactive_color;
        this.value = default_values[this.id];
      }
    });
  });
	
	

	$("#pageflip").hover(function() { //On hover...
		$("#pageflip img , .msg_block").stop()
			.animate({ //Animate and expand the image and the msg_block (Width + height)
				width: '200px',
				height: '500px'
			}, 100);
		} , function() {
		$("#pageflip img").stop() //On hover out, go back to original size 50x52
			.animate({
				width: '50px',
				height: '52px'
			}, 220);
		$(".msg_block").stop() //On hover out, go back to original size 50x50
			.animate({
				width: '50px',
				height: '50px'
			}, 200); //Note this one retracts a bit faster (to prevent glitching in IE)
	});

});

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

