function showDiv(offer_id, parent_id) {
	// offer:offer_id&parent:parent_id & lang
	openPopup('http://hotelelektor.hotelsoft.pl/?offer:'+offer_id+'&parent:'+parent_id+'&language:pol', 0);
}

function openPopup(address, scrolling) {
	$('<div id="whole"></div><div id="on_click_ajax"><div id="on_click_html"></div></div>').appendTo('body');

	$("#whole").css("height", $(document).height());
	$("#whole").css("width", $(document).width());
	$("#on_click_html").html('<div id="closeDiv"><img src="http://hotelelektor.hotelsoft.pl/img/close-div.png"/></div><iframe id="popupIframe" src="'+address+'" scrolling="'+(scrolling?"yes":"no")+'" marginwidth="1" marginheight="1" border="0" frameborder="0"></iframe>');

	$('html, body').animate({scrollTop:0}, 'slow');
	$("#whole").css("display","block");

	$("#on_click_ajax").css("display","block");

	$("#on_click_ajax").fadeTo("slow", 1.0);
	$("#whole").fadeTo("slow", 0.5);

	$("#closeDiv").click(closePopup);
}

function closePopup() {
	if ($("#whole").css("opacity") == 0.5) {
        	$("#whole").fadeTo("slow", 0.0, function(){
        		$("#whole").css("display","none");
        	});
        
		$("#on_click_html").html("");
		$("#on_click_ajax").fadeTo("slow", 0.0, function(){
			$("#on_click_ajax").css("display","none");
		});
    	}

	$('div.whole').remove();
	
	var currentLocation = window.location.toString();
	
	if (currentLocation.search('voucher.html') == -1) {
		window.location.reload();
	} else {
		window.location = '/';
	}
}

