jQuery(document).ready(function($) {
	//initNavigation();

	if($('.headerTextImage').length){
		$('.headerTextImage').cycle({
			cleartypeNoBg: true,
			timeout: 7000,
			pause: true
		});
	}
	
	$('#route').click(function(e){ 
		
		if ($('#postcode').val() == 'uw postcode' || $('#postcode').val() == '')
		{
			alert ('Vul uw postcode in');
		}
		else
		{
			var url = $('#postcode').val();
			document.location.href="http://maps.google.nl/maps?saddr="+ url +"&daddr=Albert+Cuyplaan+2c+3764+TR+Soest"; 
//			document.location.href="http://maps.google.nl/maps?saddr="+ url +"&daddr=Albert+Cuyplaan+2c+3764+TR+Soest&hl=nl&sll=52.469397,5.509644&sspn=4.585004,11.634521&geocode=FYKqGAMdTBBKAClhVIFoUn7GRzHIuYp_p0buMA%3BFU85HAMd8stQACkH00-svUHGRzFPeZP_Aa4uSQ&vpsrc=0&mra=ls&t=h&z=11"; 
		}
		return false;
	});
	
	if($('#photobook').length){
		$('#photobook a.thumbnail').fancybox({
			'type'  : 'image',
			'titleShow' : 'false'
		});
	}
	
	$("input").focus(function () {
		if ($(this).val() === $(this).attr("title")) {
			$(this).val("");
		}
	}).blur(function () {
		if ($(this).val() === "") {
			$(this).val($(this).attr("title"));
		}
	});
	
	if($('#twitterList').length){
		jQuery("#twitterList").tweet({
//			avatar_size: 45,
			count: 2,
			username: "lcj",
			//username: ["lcj", "keesvanvianen"],
			query: "from:lcj OR from:hhjo",
			refresh_interval: 180,
			loading_text: "searching twitter...",
			template: function(i){return i["text"] + i["time"]}
		});
	};
	
});

function initNavigation(){
	if($('#navigation')){
		$('#navigation ul li.children a').each(function(){
			submenu = $('#navigation ul li.children ul')
			h = submenu.outerHeight();
			submenu.css('position', 'absolute');
			submenu.css('height', h+'px');
			
			w = $(this).width();
			$(this).append('<em style="width:'+w+'px;">&nbsp;</em>');
		});
		$('#navigation ul li').each(function(){
			$(this).hover(function () {
				$(this).addClass("hover");
				}, function () {
				$(this).removeClass("hover");
				}
			);
		});
	};
}





function var_dump(obj, recursive)
{	
	//var recursive = recursive||true;
	var s = var_dump_noprint(obj, 0, recursive);
	
	s = s.replace(/</g, '&lt;');
	s = s.replace(/>/g, '&gt;');
	debugwin = window.open('', 'debugwin', 'left=20,top=20,width=400,height=800,toolbar=0,location=0,status=0,scrollbars=1,resizable=1');
	debugwin.document.write('<html><body style="cursor:pointer;" onClick="self.close()"><pre>' + s + '</pre></body></html>');
	debugwin.document.close();
}

/**
* voor debuggen, wordt gebruikt door var_dump hierboven
* ook los te gebruiken: alert(var_dump_noprint(obj));
*/
function var_dump_noprint(obj, indent_level, recursive)
{

	var LINEFEED = '\n';	
	var INDENT   = '\t';
	var indent_level = indent_level||0;
	var indent_str = '';
	var j;
	for(j=0; j<indent_level; j++) {
		indent_str += INDENT;
	}
	var s = '';
	if(typeof obj == 'undefined' || obj==null) {
		s += 'undefined' + LINEFEED;
	} else if(typeof obj == 'array' || typeof obj == 'object') {
		s += typeof obj + ' (' + LINEFEED;
		if(recursive || indent_level==0) {
			var i;
			for(i in obj) {
				s += indent_str + INDENT + '[' + i + '] => ' /*+ INDENT*/ + var_dump_noprint(obj[i], (indent_level+1), recursive);
			}
		}
		s += indent_str + ')' + LINEFEED;
	} else if(typeof obj == 'function') {
		s += 'function' + LINEFEED;
	} else {
		s += '(' + typeof obj + ') ' /*+ INDENT*/ + obj + LINEFEED;
	}
	return s;
}

