////////////*Google*/
var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-2827478-3']);
  _gaq.push(['_trackPageview']);

  (function() {
	var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
	ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
	var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
  
////////////*Scroll code */
$(function() {
	$('#secNavContainer a').bind('click',function(event){
		var $anchor = $(this);
		
		$('html, body').stop().animate({
			scrollTop: $($anchor.attr('href')).offset().top - 60
		}, 1500,'easeInOutExpo');

		event.preventDefault();
	});
});

function scroll($clicked,$target) {
	if($target == '.volgende'){
		var $scrollto = $clicked + 1;
	}
	if($target == '.vorige'){
		var $scrollto = $clicked - 1;
	}
	if($target == '.top'){
		var $scrollto = 'top';
	}
	
	$('html, body').stop().animate({
		scrollTop: $('#'+$scrollto).offset().top - 60
	}, 1500,'easeInOutExpo');
}

////////////*Cooltip code*/
function showtipbot($kop,$tekst,$id) {
	$('#cooltekst').html($tekst);
	$('#coolkop').html($kop);
	var $positie = $($id).offset();
	var $width = $('#cooltip').width()/2 - $($id).width()/2 + 10;
	$positie.left = $positie.left - $width;
	$positie.top = $positie.top - $('#cooltip').height() - 70;
	$('#cooltip').css({ 'left':$positie.left, 'top':$positie.top});
	$('#cooltip').stop().animate({
		top: $positie.top+20,
		opacity: 1
		}, 500,'easeOutCirc');
}
function hidetipbot() {
	var $positie = $('#cooltip').offset();
	$('#cooltip').delay(100).stop().animate({
		top: $positie.top-20,
		opacity: 0
		}, 500,'easeOutCirc');
}

////////////*calcheight code*/
var the_height=0;

//for normal order forms
function calcHeight()
{
	setTimeout("set_height('the_iframe')",50);
}

//find the height of the internal page
function set_height($id) {
	var the_height=
	document.getElementById($id).contentWindow.
	document.body.scrollHeight + 60;
	
	//change the height of the iframe
	document.getElementById($id).height=the_height;
}

//for domaincheck forms
function calcHeight_check()
{
	setTimeout("set_height('iframe_domaincheck')",50);
}

////////////*twitter blogger*/
function twitterCallback2(twitters) {
  var statusHTML = [];
  for (var i=0; i<twitters.length; i++){
    var username = twitters[i].user.screen_name;
    var status = twitters[i].text.replace(/((https?|s?ftp|ssh)\:\/\/[^"\s\<\>]*[^.,;'">\:\s\<\>\)\]\!])/g, function(url) {
      return '<a href="'+url+'">'+url+'</a>';
    }).replace(/\B@([_a-z0-9]+)/ig, function(reply) {
      return  reply.charAt(0)+'<a href="http://twitter.com/'+reply.substring(1)+'">'+reply.substring(1)+'</a>';
    });
    statusHTML.push ('<li><span>'+status+'</span> <a href="http://twitter.com/'+username+'/status/'+twitters[i].id_str+'">'+relative_time(twitters[i].created_at)+'</a></li>');
  }
  document.getElementById('twitter_update_list').innerHTML = statusHTML.join('');
}

function relative_time(time_value) {
  var values = time_value.split(" ");
  time_value = values[1] + " " + values[2] + ", " + values[5] + " " + values[3];
  var parsed_date = Date.parse(time_value);
  var relative_to = (arguments.length > 1) ? arguments[1] : new Date();
  var delta = parseInt((relative_to.getTime() - parsed_date) / 1000);
  delta = delta + (relative_to.getTimezoneOffset() * 60);

  if (delta < 60) {
    return 'minder dan een minuut geleden';
  } else if(delta < 120) {
    return 'een minuut geleden';
  } else if(delta < (60*60)) {
    return (parseInt(delta / 60)).toString() + ' minuten geleden';
  } else if(delta < (120*60)) {
    return 'een uur geleden';
  } else if(delta < (24*60*60)) {
    return (parseInt(delta / 3600)).toString() + ' uren geleden';
  } else if(delta < (48*60*60)) {
    return '1 dag geleden';
  } else {
    return (parseInt(delta / 86400)).toString() + ' dagen geleden';
  }
}

