$(document).ready(function () {
	// actueel nieuws: capture expand news item event
	$('a.showHideContent', $('div.newsSummary').parent()).each(expandNews);
	
	// faq: capture expand question
	$('a.showHideContent', $('div.qa').parent()).each(expandQuestion);	
	$('a.question', $('div.qa').parent()).each(expandQuestion);	
	
	// faq: capture post question
	$('#stelEenVraagPopupForm').submit(postQuestion);
	
	// faq: capture post reply
	$('#beantwoordEenVraagPopupForm').submit(function() {setTimeout('postAnswer()', 100);});
	
	// webwinkel: capture click
	$('#webwinkel .kijkonline a').each(clickWebwinkel);	
	
	//doOmniture();
	//alert(s.pageName);	
	//alert('Subsection: ' + s.prop35 + ', Page type: ' + s.prop37);
});

function clickWebwinkel() {	
	$(this).click(function () {
		var s = s_gi(s_account);
		s.linkTrackVars = 'events,eVar32';
		s.linkTrackEvents='event15';
		s.events = 'event15';
		s.eVar32 = $('.firstcol', $(this).parent().parent()).text();		
		//alert(s.eVar32);
		//alert(s.events);
		s.tl(this, 'o', 'click webwinkel');
	
		
		
		return true;		
	});
}

function expandNews() {

	$(this).click(function () {			
		
		var box = $(this).closest('.box');
		
		if (!$('.expandable', $(box)).is(':visible')) {
			var s = s_gi(s_account);
			s.linkTrackVars = 'prop24';
			s.prop24 = shorten(100, $('.news', $(box)).text());
			//alert(s.prop24);
			s.tl(true, 'o', 'expand news item');	
		}
	});
}

function expandQuestion() {
	$(this).click(function () {			
		
		var box = $(this).closest('.qa');
		
		if (!$('.answerBox', $(box)).is(':visible')) {
			var s = s_gi(s_account);
			s.linkTrackVars = 'prop33,prop34';
			s.prop33 = shorten(100, $('.question .searchable', $(box)).text());
			s.prop34 = 'Antwoord bekijken';
			//alert(s.prop33);
			s.tl(true, 'o', 'expand question');	
		}
	});	
}

function postAnswer() {	
	var form = $('#beantwoordEenVraagPopupForm');
	var s = s_gi(s_account);
	s.linkTrackVars = 'prop33,prop34';
	s.prop33 = shorten(100, $('#answerArea').val());
	s.prop34 = 'Vraag beantwoorden';
	//alert(s.prop33);
	s.tl(true, 'o', 'answer question');
	
	return true;
}

function postQuestion() {
	var s = s_gi(s_account);
	s.linkTrackVars = 'prop33,prop34';
	s.prop33 = shorten(100, $('#questionArea').val());
	s.prop34 = 'Vraag stellen';
	//alert(s.prop33);
	s.tl(true, 'o', 'ask question');
	
	return true;
}


