//Cufon.set('fontFamily', 'Franklin Gothic Medium Cond').replace('a.hoofdnav','a.subnav');
//Cufon.set('fontFamily', 'Franklin Gothic Medium Cond').replace('a.hoofdnav','a.subnav');
$(document).ready(function(){

/*
$('#topmenu').width(
	($(window).width()/2)+200
);
*/

if ($.browser.msie && $.browser.version.substr(0, 1) < 7) {
	
	$('a.hoofdnav').hover(function(){
		$('.subnavver').css({
			height: 0
		});
		//alert($(this).offset().left)
		$($(this).attr('subid')).css({
			left: $(this).offset().left - $('#main').offset().left
		});
		$($(this).attr('subid')).css({
			height: 39
		});
	}, function(){
		$($(this).attr('subid')).delay(200).css({
			height: 0
		});
		$('.subnavverActive').css({
			height: 39
		});
	});
}else{
	$('a.hoofdnav').hover(function(){
		$('.subnavver').css({
			height: 0
		});
		//alert($(this).offset().left)
		$($(this).attr('subid')).css({
			left: $(this).offset().left
		});
		$($(this).attr('subid')).css({
			height: 39
		});
	}, function(){
		$($(this).attr('subid')).delay(200).css({
			height: 0
		});
		$('.subnavverActive').css({
			height: 39
		});
	});
}	
	$('#subsubhider').animate({
		height:  $('#subsubcontent').height() 
	},400);
	
	$('#topmenu').find('a.topmenu').hover(
		function(){
			$(this).find('img').attr('src', 'images/'+$(this).find('img').attr('gifon')+'.gif')	
		},
		function(){
			$(this).find('img').attr('src', 'images/'+$(this).find('img').attr('gifoff')+'.gif')
		}
	);
if ($.browser.msie && $.browser.version.substr(0, 1) < 7) {
	$('.subnavverActive').css({
		left: $('a.hoofdnavActive').offset().left - $('#main').offset().left
	});
}else{
	$('.subnavverActive').css({
		left: $('a.hoofdnavActive').offset().left
	});
}	
	$('.subnavver').hover(
		function(){
			$('.subnavverActive').css({
				height: 0
			});
			$(this).stop(true, true).css({
				height: 39
			});
			
		},
		function(){
			$(this).stop(true, true).css({
				height: 0
			});
			$('.subnavverActive').css({	height: 39 });
		}	
	)
	
	$('#slideshow').cycle({
		timeout:       7000,
		speed: 3000
	});	
	
/*
	$('#rondleidinghome').cycle({
		timeout:       7000,
		speed: 3000,
		cleartypeNoBg: true,
		 height:       72
	});
*/	
	
	$('.slotholder').click(
		function(){
				ts = $(this).attr('id');
			if ($(this).hasClass('Blocked')) {
				alert('U kunt voor deze dag geen afspraken meer inplannen. Voor meer informatie neem contact op met onze administratie.');
			} else {
				tb_show('Afspraak inplannen', 'includes/ajax.timeslot.php?ts=' + ts + '&TB_iframe=true&height=460&width=400');
			}
		}
	)
	
	$('.timeslot').click(
		function(){
			$(this).parent().unbind('click');
			id = $(this).attr('id');
			if ($(this).hasClass('Blocked') || $(this).hasClass('activeslot') || $(this).hasClass('cancelledslot') || $(this).attr('edit')=='0') {
			alert('U kunt deze afspraak niet meer aanpassen. Voor meer informatie neem contact op met onze administratie.');
			} else {
			tb_show('Afspraak wijzigen', 'includes/ajax.timeslot.php?dateid=' + id + '&TB_iframe=true&height=460&width=400');
			}
		}
	)			
 	initialize();
	
	if($("#kaartenbak").height() > 0){
		$("#kaartenbak").scrollview();
	}
	
	
});

$(window).resize(function(){
/*
	$('#topmenu').width(
		($(window).width()/2)+200
	);
*/
});
function initialize() {
    var latlng = new google.maps.LatLng(50.840979,5.664423);
	var Mylatlng = new google.maps.LatLng(50.839070,5.662578);
	var Mylatlng2 = new google.maps.LatLng(50.842504,5.664598);
    var myOptions = {
      zoom: 16,
      center: latlng,
      mapTypeId: google.maps.MapTypeId.HYBRID
    };
	goMap = false;
   if ($('#map_canvas').height() > 0) {
   	var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
   
   	var image2 = new google.maps.MarkerImage('images/marker2.png',
    new google.maps.Size(24, 30),
    new google.maps.Point(0,0),
    new google.maps.Point(21, 28));
	
	var image = new google.maps.MarkerImage('images/marker.png',
    new google.maps.Size(24, 30),
    new google.maps.Point(0,0),
    new google.maps.Point(3, 27));
	
   	var marker = new google.maps.Marker({
   		position: Mylatlng,
   		map: map,
   		title: "Ingang Tongerseweg",
		icon: image2
   	});
	
	var marker2 = new google.maps.Marker({
   		position: Mylatlng2,
   		map: map,
   		title: "Ingang Javastraat",
		icon: image
   	});
	
   }
  }
 
