$(document).ready(function(){
	Shadowbox.init({modal: true,overlayOpacity:0.8});
});

var pauseit = function (millis) {
	var date = new Date();
	var curDate = null;
	do { curDate = new Date(); } 
	while(curDate-date < millis);
}
$('#formSent').live('submit', function () {
		var thiselement = $(this);
		try {
			_gaq.push(['_trackEvent', 'Händlersuche', 'submitted', $(this).value()]);
		}
		catch (err) {}
		// pause to allow google script to run
		pauseit(100);
});
$('.bezugsquellen_item a').live('click', function () {
		var thiselement = $(this);
		try {
			_gaq.push(['_trackEvent', 'Bezugsquelle', 'clicked', thiselement.text()]);
		}
		catch (err) {}
		// pause to allow google script to run
		pauseit(100);
});
$('.shops li a').live('click', function () {
		var thiselement = $(this);
		try {
			_gaq.push(['_trackEvent', 'Onlineshop', 'clicked', thiselement.attr('href')]);
		}
		catch (err) {}
		// pause to allow google script to run
		pauseit(100);
});
$('a[rel="shadowbox"]').live('click', function () {
		var thiselement = $(this);
		try {
			_gaq.push(['_trackEvent', 'Bild', 'zoomed', thiselement.attr('href')]);
		}
		catch (err) {}
		// pause to allow google script to run
		pauseit(100);
});
