$(document).ready(function(){
	$('#nav').spasticNav();

	$("#desSlideshow1").desSlideshow({
		autoplay: 'enable',//option:enable,disable
		slideshow_width: '560',//slideshow window width
		slideshow_height: '240',//slideshow window height
		thumbnail_width: '200',//thumbnail width
		time_Interval: '4000',//Milliseconds
		directory: '/public/static_images/'// flash-on.gif and flashtext-bg.jpg directory
	});


	$('ul#verzekeraars').bxCarousel({
		display_num: 3,
		move: 3,
		margin: 17,
		speed: 1000,
		auto_interval: 5000,
		auto: true,
		auto_hover: true,
		controls: false
	});


  $("#kenteken_onbekend_link").click(function() {
    $("#kenteken_row").addClass("invisible")

    $("#kenteken_onbekend_row").removeClass("invisible")

    $("#bouwjaar_row").removeClass("invisible")
    $("#Bouwjaar").focus()

    $("#bouwmaand_row").removeClass("invisible")
    $("#KentekenBekend").attr('value', '0')

    if (($("#Bouwjaar").attr('value') > '') && ($("#Bouwmaand").attr('value') > '') && ($("#Merk").html() > '')) {
      $("#merk_row").removeClass("invisible")

      if (($("#Merk").attr('value') > '') && ($("#Model").html() > '')) {
        $("#model_row").removeClass("invisible")
      }
    }

    return false;
  });


  $("#kenteken_bekend_link").click(function() {
    $("#kenteken_row").removeClass("invisible")
    $("#KentekenBekend").attr('value', '1')

    $("#kenteken_onbekend_row").addClass("invisible")
    $("#bouwjaar_row").addClass("invisible")
    $("#bouwmaand_row").addClass("invisible")
    $("#merk_row").addClass("invisible")
    $("#model_row").addClass("invisible")

    return false;
  });

  
  $("#Bouwmaand").change(function(){
    var bouwjaar = $("#Bouwjaar").attr('value')
    var bouwmaand = $("#Bouwmaand").attr('value')

    $("#AjaxMerkenLoader").show();

    $.getJSON("/autoverzekering?AjaxAction=Merken",{Bouwjaar: bouwjaar, Bouwmaand: bouwmaand}, function(j){
      var options = ''

      for (var i = 0; i < j.length; i++) {
        options += '<option value="' + j[i].Id + '">' + j[i].Naam + '</option>';
      }

      $("#merk_row").removeClass("invisible")
      $("#Merk")
      .html(options)
      .focus()

      $("#AjaxMerkenLoader").hide();
    })
  });



  $("#Merk").change(function(){
    var bouwjaar = $("#Bouwjaar").attr('value')
    var bouwmaand = $("#Bouwmaand").attr('value')
    var merkid = $("#Merk").attr('value')

    $("#AjaxModellenLoader").show();

    $.getJSON("/autoverzekering?AjaxAction=Modellen",{Bouwjaar: bouwjaar, Bouwmaand: bouwmaand, MerkId: merkid}, function(j){
      var options = ''

      for (var i = 0; i < j.length; i++) {
        options += '<option value="' + j[i].Id + '">' + j[i].Naam + '</option>';
      }

      $("#model_row").removeClass("invisible")
      $("#Model")
      .html(options)
      .focus()

      $("#AjaxModellenLoader").hide();

    })
  });

/*  
  $("a[rel]").overlay({
    // start exposing when overlay starts to load
    onBeforeLoad: function() {

      // grab wrapper element inside content
      var wrap = this.getContent().find("div#overlay_content");

      // load content
      wrap.load(this.getTrigger().attr("href"));

      // this line does the magic. it makes the background image sit on top of the mask
      this.getBackgroundImage().expose({color: '#999999'});
    },

    // when overlay is closed take the expose instance and close it as well
    onClose: function() {
      $.expose.close();
    }

  });
*/


  $("input.datum").fluidTyping();

});


function GotoStep(Step) {
  document.forms["berekening"].NextStep.value = Step;
  document.forms["berekening"].submit();
}

function showLoader() {
  document.getElementById('button').style.display = 'none';
  document.getElementById('loader').innerHTML = '<img src="/public/static_images/pre-loader.gif " />';

  $("#inputs").hide();
  $("#search_message").show();
}

function toggleAanvrager(visible) {
  var obj = document.getElementsByTagName('tr')
  for(i=0;i<obj.length;i++) {
    if ((obj[i].className == 'aanvrager_visible') || (obj[i].className == 'aanvrager_invisible')) {
      if (visible) {
        obj[i].className = 'aanvrager_visible'
      }
      else {
        obj[i].className = 'aanvrager_invisible'
      }
    }
  }
}





/*


function ShowNews(NewsItemID) {
  $("#newscontent_" + NewsItemID ).slideToggle("slow");

  if (element = document.getElementById('newslink_' + NewsItemID)) {
    element.style.display = 'none';
  }
}

function HideNews(NewsItemID) {
  $("#newscontent_" + NewsItemID ).slideToggle("slow");

  if (element = document.getElementById('newslink_' + NewsItemID)) {
    element.style.display = 'block';
  }
}

function displayTips() {
  document.getElementById('tips').style.display = 'block';
  document.getElementById('contact').style.display = 'none';
  document.getElementById('schade').style.display = 'none';
  document.getElementById('opzegservice').style.display = 'none';

  document.getElementById('menu_tip').className = 'current_page_item';
  document.getElementById('menu_contact').className = '';
  document.getElementById('menu_schade').className = '';
  document.getElementById('menu_opzegservice').className = '';
}

function displayContact() {
  document.getElementById('tips').style.display = 'none';
  document.getElementById('contact').style.display = 'block';
  document.getElementById('schade').style.display = 'none';
  document.getElementById('opzegservice').style.display = 'none';

  document.getElementById('menu_tip').className = '';
  document.getElementById('menu_contact').className = 'current_page_item';
  document.getElementById('menu_schade').className = '';
  document.getElementById('menu_opzegservice').className = '';
}

function displaySchade() {
  document.getElementById('tips').style.display = 'none';
  document.getElementById('contact').style.display = 'none';
  document.getElementById('schade').style.display = 'block';
  document.getElementById('opzegservice').style.display = 'none';

  document.getElementById('menu_tip').className = '';
  document.getElementById('menu_contact').className = '';
  document.getElementById('menu_schade').className = 'current_page_item';
  document.getElementById('menu_opzegservice').className = '';
}

function displayOpzegservice() {
  document.getElementById('tips').style.display = 'none';
  document.getElementById('contact').style.display = 'none';
  document.getElementById('schade').style.display = 'none';
  document.getElementById('opzegservice').style.display = 'block';

  document.getElementById('menu_tip').className = '';
  document.getElementById('menu_contact').className = '';
  document.getElementById('menu_schade').className = '';
  document.getElementById('menu_opzegservice').className = 'current_page_item';
}

function showLoader() {
  document.getElementById('button').style.display = 'none';
  document.getElementById('loader').innerHTML = '<img src="' + loaderPath + '" />';

  $("#inputs").hide();
  $("#search_message").show();
}

function toggleAanvrager(visible) {
  var obj = document.getElementsByTagName('tr')
  for(i=0;i<obj.length;i++) {
    if ((obj[i].className == 'aanvrager_visible') || (obj[i].className == 'aanvrager_invisible')) {
      if (visible) {
        obj[i].className = 'aanvrager_visible'
      }
      else {
        obj[i].className = 'aanvrager_invisible'
      }
    }
  }
}

*/

