
var patt1=/#partner=\d+/g;
var partnerMatch = window.location.href.match(patt1);
if(partnerMatch){$(function(){var data = {'partner' : partnerMatch.toString().substr(9),'location': window.location.href};$.post('./json.php',data,false)});}

var postform = '';
var transdesc = 1;

$(function(){

   //loginbox
  var loginBoxOpened = false;
  //$('#loginbox').hide();
  $('a#login-link').click(function(){
    $('a#login-link').toggleClass('open');
    $('#loginbox').toggle();
    $('#useremail').focus();

    if(!loginBoxOpened){
      $(document).mouseup(function(e) {
        if($('#loginbox').css('display') == 'block'){
          if(($(e.target).attr('id') != 'loginbox') && (!$(e.target).parents('#loginbox').length) && ($(e.target).attr('id') != 'login-link')){
            $('#loginbox').hide();
            $('#login-link').toggleClass('open');
          }
        }
       });
       loginBoxOpened = true;
    }
    return false;
  });

   // hide message-new op homepage including cookie
   $('.remove-message').click(function(){

     	var messageBar = $(this).parent();
  		var messageBarId = messageBar.attr('id');
  		messageBar.fadeOut("slow");
	    $.cookie(messageBarId, 'hide_'+messageBarId, { path: '/', expires: 200 });
	    return false;
   });


  // refresh recent rooms list on homepage
  $('#recent-refresh').click(function(){
    var recentRoomsUl = $('#recent-rooms ul');
    // adds the loader
    recentRoomsUl.after('<div class="loading"></div>');

    var since = recentRoomsUl.find('span:first').attr('class').substr(5);

		$.getJSON('./ajax/newest-rooms.php',{'since':since},function(data){

			// Update the time
			recentRoomsUl.find('span').each(function(a,b){
				var obj = $(b);
				var newTime = data.stamp-obj.attr('class').substr(5);
				obj.html(calculateTimePast(newTime));
			});


			// Removing the last X li's from the ul and adding X new li's
			if(data.total_new){
				recentRoomsUl.find('li:gt('+(4-data.total_new)+')').fadeOut(500,function(){
					$(this).remove();
					if(data.html){
						// removes the loader
						recentRoomsUl.prepend(data.html)
						data.html = false;
					}
				});
			}
			$('.loading').remove();
  	});
  	return false;
  });


  // tooltip
	$('.info-tip').wTooltip({
    style: {
        border: "1px solid #A5D6DB",
        background: "#E4F5F7",
        color: "#025c66",
        width: "200px",
        margin: '-20px 0 0 10px ',
        zIndex: "9999"
    }
  });

	// hide message-enquete op homepage including cookie

/*  $("a.remove-message").click(function () {
	  $("div.message-enquete").fadeOut("slow");
    $.cookie('message_enquete', 'hide_message-enquete', { path: '/', expires: 200 });
    return false;
  });


  // hide login info box op homepage including cookie
  $("#login-info-box a").click(function () {
	  $("#login-info-box").fadeOut("slow");
    $.cookie('login-info-box', 'hide-login-info-box', { path: '/', expires: 200 });
    return false;
  });*/


	if ($("#hiddendesc").length > 0 ) {
		$.ajax({
		type: 'GET',
		url: '../../js/getOrigDesc.ajax.php',
		cache: false,
		success: function(response){
			var html = $("#hiddendesc").html();
			$("#hiddendesc").html(html + response);
		}
		});
	}


  //open links in nieuw venster
  $("a[@rel=external]").each(function(i) {this.target="_blank";});

  // navigation background animation
  $('#nav > ul.sf-menu > li > a')
    .css( {backgroundPosition: "0 0"} )
    .mouseover(function(){
      $(this).stop().animate({backgroundPosition:"(0 -32px)"}, {duration:300})
    })
    .mouseout(function(){
      $(this).stop().animate({backgroundPosition:"(0 0)"}, {duration:300})
    })

  //toggle faq questions
  $('.faq div').hide()
  $('.faq h4').click(function(){
    $(this).next('div').slideToggle('fast');
    return false;
  });

  //toggle city info
  $('#city-info').hide()
  $('#result-view #city_info_button').click(function(){
     $('#city-info').slideToggle();
     return false;
  });

  //toggle form fieldset of <ol>
  //$('legend.toggle-fieldset').next('ol').hide()
  $('legend.toggle-fieldset').click(function(){
     $(this).toggleClass('toggle-open').next('ol').slideToggle();
     return false;
  });

  //form fields <li>-container focus
  $('form.frm input[type="text"],form.frm input[type="password"],form.frm input[type="file"],form.frm select,form.frm textarea').focus(function() {
    $(this).parent("li").addClass('frm-focus');
  });
  $('form.frm input[type="text"],form.frm input[type="password"],form.frm input[type="file"],form.frm select,form.frm textarea').blur(function() {
    $(this).parent("li").removeClass('frm-focus');
  });

  $('form.frm input[type="radio"],form.frm input[type="checkbox"]').focus(function() {
    $(this).parent("li").parent("ol").parent("fieldset").parent("li").addClass('frm-focus');
  });
  $('form.frm input[type="radio"],form.frm input[type="checkbox"]').blur(function() {
    $(this).parent("li").parent("ol").parent("fieldset").parent("li").removeClass('frm-focus');
  });

  $('form.frm input[type="submit"]').focus(function() {
    $(this).parent("div").addClass('frm-focus');
  });
  $('form.frm input[type="submit"]').blur(function() {
    $(this).parent("div").removeClass('frm-focus');
  });

  // Confirm removal of room from saved rooms
  $('.delete_saved_room>a').click(function(){
  	if(confirm(gettext("Weet je zeker dat je deze kamer wilt verwijderen uit je opgeslagen kamers?")))
  		return true;
  	else
	  	return false;
  });

  // Confirm removal of room from offered rooms
  $('.delete_offered_room>a').click(function(){
  	if(confirm(gettext("Weet je zeker dat je deze aangeboden kamer wilt verwijderen?")))
  		return true;
  	else
	  	return false;
  });

  // Confirm removal of room from offered rooms
  $('.delete_room>a').click(function(){
  	if(confirm(gettext("Weet je zeker dat je deze kamer wilt verwijderen?")))
  		return true;
  	else
	  	return false;
  });


  // Oproep inschakelen
		if($('#oproep_1:checked').length != 1){
			$('#restOfForm').hide();
		}
		$('#oproepInschakelen').click(function(){
			if($('#oproep_1:checked').length == 1){
				$('#restOfForm').show();
			}else{
				$('#restOfForm').hide();
			}
		});




  // sitemap tree
	$(".sitemap").treeview({
		persist: "location",
		collapsed: true,
		unique: true
	});

  //lightbox
  $("a[rel^='prettyPhoto']").prettyPhoto();

  // table check marks
  $("#features-overview td:contains('ja')").addClass("feature-yes");
  $("#features-overview td:contains('nee')").addClass("feature-no");

  // mail a friend stuff
  $('#mail-a-friend').hide();
  $('.action-mail').click(function() {
  	$('#mail-a-friend').slideToggle();
  });

  // Hide the date selectors in the rental contract generator
  $("#rent_till_date").parent().hide();
  $("#contract_bepaald").click(function() {
    $("#rent_till_date").parent().show();
    $("#rent_till_date").removeAttr('disabled');
    $("#rent_till_month").removeAttr('disabled');
    $("#rent_till_year").removeAttr('disabled');
  });
  $("#contract_onbepaald").click(function() {
    $("#rent_till_date").parent().hide();
    $("#rent_till_date").attr('disabled', 'disabled')
    $("#rent_till_month").attr('disabled', 'disabled')
    $("#rent_till_year").attr('disabled', 'disabled')
  });

  //Hide the account number input fields in the rental contract generator on cash payment
  $("#betalingswijze_contant").click(function() {
	$(".accountnumber-wrap").hide();
  });
  $("#betalingswijze_bank").click(function() {
	$(".accountnumber-wrap").show();
  });

  $('#quickSearch').submit(function(){
   if($('#quickSearch .searchPlaats').val() == gettext("kies-een-plaats")){
		alert(gettext("Selecteer eerst een plaatsnaam")+". ");
		return false;
	}else
		return true;
  });

  $('#translate_text').click(function(){
  	var hiddendesc = $('#hiddendesc').html();
  	var desc = $('p.room-description').html();

  	$('#hiddendesc').html(desc);
  	$('p.room-description').html(hiddendesc);

  	if (transdesc == 1) {
  		$('#translate_text a').text(gettext('Vertaalde omschrijving tonen'));
  		transdesc = 0;
  	} else {
  		$('#translate_text a').text(gettext('Originele omschrijving tonen'));
  		transdesc = 1;
  	}

  	return false;
	});


  $('#uitgebreidzoeken').submit(function(){
   if($('#'+this.id+' .searchPlaats').val() == gettext("kies-een-plaats")){
		alert(gettext("Selecteer eerst een plaatsnaam")+". ");
		return false;
	}else if(!$('#uitgebreidzoeken #opp').val()){
		alert(gettext("Selecteer een oppervlakte")+".");
		return false;
	}else
		return true;
  });

  // Show/hide the 'bemiddelingskosten' vraag
  if ($('#bemiddelingskostenvraag_2:checked').length == 1) {
  	$("#bemiddelingskosten").parent().parent('div').hide();
  }

  $('#bemiddelingskostenvraag_2').click(function() {
 	$("#bemiddelingskosten").parent().parent('div').hide();
  })
  $('#bemiddelingskostenvraag_1').click(function() {
 	$("#bemiddelingskosten").parent().parent('div').show();
  })

  // Show/hide the 'tot datum' vraag
  if ($('#tijdelijk_2:checked, #tijdelijk_4:checked').length == 1) {
  	$("#datumtot_day").parent('div').hide(); // Hide on first instance
  }

  $('#tijdelijk_2, #tijdelijk_4').click(function() {
 		$("#datumtot_day").parent('div').hide();
  })
  $('#tijdelijk_1, #tijdelijk_3').click(function() {
 		$("#datumtot_day").parent('div').show();
  })

  //toggle reaction form
//  $('#react').hide();
  $('#react-button').click(function() {
  	$('#react').slideToggle();
  });

  $('#react-button-bottom').click(function(){
	$('html,body').animate({scrollTop: 0}, 500,false,function(){$('#react').slideDown()});
  });

  $('#react #message').click(function(){
  	if($(this).val() == gettext("Vul hier je tekst in..."))
  		$(this).val('');

  }).blur(function(){
  	if(!$(this).val())
  	  	$(this).val(gettext("Vul hier je tekst in..."));
  });
  $('#react form').not('#LoginReact').submit(function(){
  	var doNotReturn	= false;
		var alertMe		= '';
		var url			= '../reageer';

		$('#error').html('');

		if($(this).attr('action') == 'huurdercontact'){
			url = './huurdercontact'
			if($('#from').val() == ''){
				doNotReturn = true;
				alertMe	 += "<li>"+gettext("Vul je naam in")+"</li>";
			}

			if(!checkMail($('#fromemail').val())){
				doNotReturn = true;
				alertMe	 += "<li>"+gettext("Geef een e-mailadres op")+"</li>";
			}
		}

  	if($('#subject').val() == ''){
  		doNotReturn = true;
			alertMe	 += "<li>"+gettext("Vul een onderwerp in")+"\n</li>";
  	}

  	if(($('#message').val() == '') || ($('#message').val() == gettext("Vul hier je tekst in..."))){
  		doNotReturn = true;
			alertMe	 += "<li>"+gettext("Vul een bericht in")+"\n</li>";
  	}

  	if(doNotReturn){
  		$('#error').html('<p id="mail-return-message"><img src="./img/no-check.gif" alt="'+gettext("Error!")+'"><ul>'+alertMe+'</ul></p>');
  /*	else{

			$.post(url,{'subject':$('#subject').val()}, function(msg){
				alert(msg);

			//$.post(url,{'subject':$('#subject').val(),'message':$('#message').val(),'from':$('#from').val(),'kamerid':$('#kamerid').val(),'fromemail':$('#fromemail').val(),'useruniqid':$('#useruniqid').val()}, function(msg){

				var data = msg.split(':');

				if(data[0] == 'error')
					$('#error').html('<p id="mail-return-message"><img src="./img/no-check.gif" alt="'+gettext("Error!")+'"><strong>'+data[1]+'</strong></p>');

				if(data[0] == 'success')
					$('#react form').html('<p id="mail-return-message"><img src="./img/check.png" alt="'+gettext("Succes!")+'"><strong>'+data[1]+'</strong></p>');

			});

  		},'json');
  	}*/
  	return false;
  	}

  });


   $('#payment_button').click(function(){
   		if ($('input[@name="payment"]:checked').val() == '3') {
   			$('#payment_form').attr('action', 'https://www.paypal.com/cgi-bin/webscr');
   		}
   		$('#payment_form').submit();
   });



  $('#huurderzoeken').submit(function(){
	  var doNotReturn	= false;
	  var alertMe		= '';

	  if($('#plaatsoproep').val() == gettext("Kies een plaats")){
		  doNotReturn = true;
		  alertMe	 += "- "+gettext("Kies een plaats")+"\n";
	  }

	  if(!$('#opp').val()){
		  doNotReturn = true;
		  alertMe	  += "- "+gettext("Vul een oppervlakte")+" in\n";
	  }

	  if(!$('#prijs').val()){
		  doNotReturn = true;
		  alertMe	  += "- "+gettext("Vul een huurprijs")+" in\n";
	  }

	  if(doNotReturn){
		  alert(alertMe);
		  return false;
	  }else{
		  return true;
	  }
  });

  $('#postalcode_nr,#postalcode_letters,#housenumber').keyup(function(){
		/*alert(getCaretPos(document.getElementById('postalcode_nr')));
		return;
  	var focused;
  	if (document.getElementById('postalcode_nr').hasFocus()) {
  		focused = 'postalcode_nr';
  	}
  	if (document.getElementById('postalcode_letters').hasFocus()) {
  		focused = 'postalcode_letters';
  	}*/


  var postalcode_nr = $('#postalcode_nr').val();
	var postalcode_letters = $('#postalcode_letters').val();
	var housenumber = $('#housenumber').val();

	if (postalcode_nr.length == 4 && postalcode_letters.length == 0) {
		document.getElementById('postalcode_letters').focus();
	} else {
		if (postalcode_letters.length == 2 && postalcode_nr.length == 4) {
			document.getElementById('housenumber').focus();
		}
	}

	if (postalcode_nr.match(/^([0-9]{4})$/) &&
	    postalcode_letters.match(/^([a-zA-Z]{2})$/) &&
		housenumber.match(/^([0-9]).*?$/)) {

		timeout = setTimeout(checkAddress, 1200);
		return;
	} else {
		clearTimeout(timeout);
		$('#straat,#plaats,#error').hide();
		$('#street,#place').val('');
	}
	});

	if($('#opleidingsrichtingdiv').length){
		$('#opleidingsrichtingdiv').hide();

		var origineleOpleiding = $('#opleidingsrichting').val();
		$('#opleidingsrichting').replaceWith('<select id="opleidingsrichting" name="opleidingsrichting"></select>');
		opleidingsRichting('first',origineleOpleiding);
		$('#opleiding').change(opleidingsRichting);
	}

	if ($('#postalcode_nr,#postalcode_letters,#housenumber').val() != '') {
  	$('#straat,#plaats').show();
  }


  $('#stap1').submit(function() {
  	if (postform.length > 0) {
  		return true;
  	}
  	var street = $('#street').val();
		var place = $('#place').val();
		var postalcode_nr = $('#postalcode_nr').val();
		var postalcode_letters = $('#postalcode_letters').val();
		var housenumber = $('#housenumber').val();

		if (street == "" || place == "") {
			if (postalcode_nr.match(/^([0-9]{4})$/) &&
	    		postalcode_letters.match(/^([a-zA-Z]{2})$/) &&
					housenumber.match(/^([0-9]).*?$/)) {

				postform = this;
				clearTimeout(timeout);
				timeout = setTimeout(checkAddress, 1200);
				return false;
			} else {
				clearTimeout(timeout);
				$('#straat,#plaats,#error').hide();
				$('#street,#place').val('');
			}
			return false;
		}
	});

	$('#stap2').submit(function() {
  	if (postform.length > 0) {
  		return true;
  	}
  	var street = $('#street').val();
		var place = $('#place').val();
		var postalcode_nr = $('#postalcode_nr').val();
		var postalcode_letters = $('#postalcode_letters').val();
		var housenumber = $('#housenumber').val();

		if (postalcode_nr.match(/^([0-9]{4})$/) &&
	   		postalcode_letters.match(/^([a-zA-Z]{2})$/) &&
				housenumber.match(/^([0-9]).*?$/)) {

				postform = this;
				clearTimeout(timeout);
				timeout = setTimeout(checkAddress, 1200);
				return false;
		} else {
			return true;
		}
	});

	if ($('#contact_2:checked').length == 1) {
		$('#tel').hide();
  }
  $('#contact_2').click(function() {
		$('#tel').hide();
	});
	$('#contact_1').click(function() {
		$('#tel').show();
	});


	if ($('#beschikbaarvraag_1:checked').length == 1) {
		$('#datumvanaf_day').parent('div').hide();
  }
  $('#beschikbaarvraag_1').click(function() {
		$('#datumvanaf_day').parent('div').hide();
	});
	$('#beschikbaarvraag_2').click(function() {
		$('#datumvanaf_day').parent('div').show();
	});

	if ($('#kijkavond_4:checked, #kijkavond_6:checked').length == 1) {
		$('#datumkijk_day').parent('div').hide();
  }
	$('#kijkavond_4, #kijkavond_6').click(function() {
		$('#datumkijk_day').parent('div').hide();
	});
	$('#kijkavond_3, #kijkavond_5').click(function() {
		$('#datumkijk_day').parent('div').show();
	});

	$('.abonnementcheck').submit(function(){
		if($(this).find('input[type="radio"]:checked').length){
			return true;
		}else
			$('#errorbox').html('<div class="highlight-box"><p><strong>'+gettext("Je hebt nog geen abonnement gekozen")+'.</strong></p></div>');

		return false;
	});

	$('#select-date-view').change(function(){
		$('#date_view').submit();
	});

	$('#deeplink-generator').submit(function(){
		var targetUrl = $('#url').val().toLowerCase();

		if(targetUrl.length < 5){
			$('#deeplinkfield').hide();
			return false;
		}
		var affid = $('#aff_id').val();
		var partner = 'partner='+affid;

		var questionMark = targetUrl.search(/\?/);
		var newUrl = targetUrl+'#'+partner;

		$('#deeplinkfield').show();
		$('#deeplink').html(newUrl);

		return false;
	});
});

function ValidURL(str) {
  var pattern = new RegExp('^(https?:\/\/)?'+ // protocol
    '((([a-z\d]([a-z\d-]*[a-z\d])*)\.)+[a-z]{2,}|'+ // domain name
    '(\?[;&a-z\d%_.~+=-]*)?'+ // query string
    '(\#[-a-z\d_]*)?$','i'); // fragment locater
  if(!pattern.test(str)) {
    alert("Please enter a valid URL.");
    return false;
  } else {
    return true;
  }
}

function checkMail(email){
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (filter.test(email)) {
		return true;
	}
	return false;
}

function didReact(msg){
	var data = msg.split(':');

	if(data[0] == 'error')
		$('#error').html('<p id="mail-return-message"><img src="./img/no-check.gif" alt="'+gettext("Error!")+'"><strong>'+data[1]+'</strong></p>');

	if(data[0] == 'success')
		$('#react form').html('<p id="mail-return-message"><img src="./img/check.png" alt="'+gettext("Succes!")+'"><strong>'+data[1]+'</strong></p>');
}

function opleidingsRichting(first,origineleOpleiding){
	var opleiding = $('#opleiding').val();
	var opleidingsrichting = $('#opleidingsrichting').val();

	if(opleidingsrichtingen[opleiding]){
		var options = '';
		for(x=0;x<opleidingsrichtingen[opleiding].length;x++)
			options += '<option value="'+opleidingsrichtingen[opleiding][x]+'">'+opleidingsrichtingen[opleiding][x]+'</option>';
		$('#opleidingsrichting').html(options);
		if(origineleOpleiding)
			$('#opleidingsrichting').val(origineleOpleiding);
		$('#opleidingsrichtingdiv').show().children('select').attr('name','opleidingsrichting');;
	}else{
		$('#opleidingsrichtingdiv').hide().children('select').attr('name','opleidingsrichtingNOT');
	}
}

var timeout;

function MailAFriend() {
	var toemail 	= $('#toemail').val(this.value);
	var toname  	= $('#toname').val(this.value);
	var fromemail 	= $('#fromemail').val(this.value);
	var fromname	= $('#fromname').val(this.value);
	var roomid		= $('#kamerid').val(this.value);
	$.get("../../js/mailafriend.php?loc=" + locale + "&toemail=" + toemail + "&toname=" + toname + "&fromemail=" + fromemail + "&fromname=" + fromname + "&roomid=" + roomid, function(data){
		var data = data.split('msg:');

		if(data[0] == 'error')
			$("#mail-a-friend-return-message").html(data[1]);
		if(data[0] == 'success')
			$('#mail-a-friend').html('<p id="mail-a-friend-return-message">'+data[1]+'</p>');

	});

}

function controleerkamer(theForm) {

	if(theForm.plaats.value=="")
    {
      alert (gettext("Vul een plaats in")+".")
      theForm.plaats.focus();
	  return false;
    }

	if(theForm.opp.value=="")
    {
      alert (gettext("Vul een oppervlakte in")+".")
      theForm.opp.focus();
	  return false;
    }

	if(theForm.prijs.value=="")
    {
      alert (gettext("Vul een huurprijs in")+".")
      theForm.prijs.focus();
	  return false;
    }

return true;
}

function getCaretPos(el) {
	var rng, ii=-1;
	if(typeof el.selectionStart=="number") {
			ii=el.selectionStart;
	} else if (document.selection && el.createTextRange) {
		rng=document.selection.createRange();
		rng.collapse(true);
		rng.moveStart("character", -el.value.length);
		ii=rng.text.length;
	}
	return ii;
}

function activate_order(id,search) {
	if (search.length == 0) {
		search = 'all';
	}
	sure = confirm(gettext("Weet je zeker dat je deze bestelling wilt activeren?"));
	if (sure === true) {
		window.location = '/'+dgettext("url", "admin_search")+'/'+search+'/'+dgettext("url", "activate-order")+'/'+id;
	}
	return;
}

function delete_order(id,search) {
	if (search.length == 0) {
		search = 'all';
	}
	sure = confirm(gettext("Weet je zeker dat je deze bestelling wilt verwijderen?"));
	if (sure === true) {
		window.location = '/'+dgettext("url", "admin_search")+'/'+search+'/'+dgettext("url", "delete-order")+'/'+id;
	}
	return;
}

function delete_user(id,search) {
	if (search.length == 0) {
		search = 'all';
	}
	sure = confirm(gettext("Weet je zeker dat je deze gebruiker wilt verwijderen?"));
	if (sure === true) {
		window.location = './'+dgettext("url", "admin_search")+'/'+search+'/'+dgettext("url", "delete-user")+'/'+id;
	}
	return;
}

function checkAddress() {
	var postalcode_nr = $('#postalcode_nr').val();
	var postalcode_letters = $('#postalcode_letters').val();
	var housenumber = $('#housenumber').val();

	$.ajax({
		type: 'GET',
		url: 'js/getAddress.ajax.php',
		data: 'postalcode_nr='+postalcode_nr+'&postalcode_letters='+postalcode_letters+'&housenumber='+housenumber,
		cache: false,
		success: function(response){
			if (response.length > 0) {
				if (response.substr(0,6) == 'ERROR:') {
					$('#straat,#plaats').show();
					$('#error').html(response.substr(6,response.length-7));
					$('#error').show();
					return;
				}
				$('#error').hide();
				response = response.split(';');
				$('#street').val(response[0]);
				$('#place').val(response[1]);
				$('#straat,#plaats').show();
			} else {
				$('#straat,#plaats,#error').hide();
				$('#street,#place').val('');
			}
			if (postform.length > 0) {
				postform.submit();
			}
		}
	});
}


function afkeuren(e){
//	return false;
//	if(confirm('Weet je zeker dat je deze kamer wilt afkeuren?'))
}


$(function() {
  $('form.login-react-test').hide()
    $('a#login-react-link').click(function(){
      $(this).parent('p').next('form').toggle();
      return false;
    });
});

/**
 * Calculates the time
 */

calculateTimePast = function(seconds){
  var diff = new Date(seconds*1000);

  var calc = {
    'days'		: diff.getUTCDate()-1,
    'hours'		: diff.getUTCHours(),
    'minutes'	: diff.getUTCMinutes(),
    'seconds' : diff.getUTCSeconds()
  }

	var string;
  for(i in calc) {
  	if(calc[i]){
  		switch(i){
				case 'seconds':
					string = ngettext('%s seconde geleden','%s seconden geleden',calc[i]);
				break;

				case 'minutes':
					string = ngettext('%s minuut geleden','%s minuten geleden',calc[i]);
				break;

				case 'hours':
					string = ngettext('%s uur geleden','%s uur geleden',calc[i]);
				break;

				case 'days':
					string = ngettext('%s dag geleden','%s dagen geleden',calc[i]);
				break;
  		}
    return string;
  	}
  }
}
