$(document).ready(function(){

	// webropol questionnaire

	var PAGE_LOADS_COOKIE = 'ploads';

	if($.cookie(PAGE_LOADS_COOKIE)) {

		var wLink = document.createElement('a');
		wLink.id = 'webropolContainer';
		wLink.href = '/misc/webropol_popup/test.html';
		$("body").append(wLink);

		$(wLink).click(function(){

			return hs.htmlExpand(this,
				{
					contentId: 'my-content',
					objectType: 'ajax',
					align: 'center',
					dimmingOpacity:'0.9',
					allowSizeReduction: false
				});

		});


		$("body").prepend('<div class="highslide-html-content" id="my-content" style="width: 400px"><div class="highslide-body"></div></div>');

		pageloads = $.cookie(PAGE_LOADS_COOKIE);
		pageloads++;
		$.cookie(PAGE_LOADS_COOKIE, pageloads, { expires: 60, path: '/' } );

		if(pageloads == 2) {

			setTimeout(function(){
				$(wLink).click();
			},250);

		}

	} else {

		$.cookie(PAGE_LOADS_COOKIE, '1', { expires: 60, path: '/' } );

	}

});