	$('a.poplight').live('click', function() {
		var width, popMargTop, popMargLeft, popID = $(this).attr('rel'), href = $(this).attr('href'), redirect_uri;
		
                popID = popID.split('?');
                
		width = (popID[1] == undefined) ? 460 : popID[1];
		popID = popID[0];
		
                
                
		if (href) {
			redirect_uri = href.split('redirect_uri=');
			if (redirect_uri[1] != undefined) {
				href = redirect_uri[0] + 'redirect_uri=http://' + redirect_uri[1].split('%2F')[2] + '/reload.php';
			}
			$('#' + popID).html('<iframe width="' + width + '" frameborder="0" scrolling="no" height="260" src="' + href + '"></iframe>');
		}
                
                
		$('#' + popID).fadeIn().css({'width': width});

               

		popMargTop = ($('#' + popID).height() + 80) / 2;
		popMargLeft = ($('#' + popID).width() + 80) / 2;

		$('#' + popID).css({'margin-top' : -popMargTop, 'margin-left' : -popMargLeft});

		$('body').append('<div id="fade"></div>');
		$('#fade').css({'filter' : 'alpha(opacity=70)'}).fadeIn();

		if ($('#' + popID + ' textarea').length){$('#' + popID + ' textarea').focus();}

		 $('#' + popID).prepend('<a href="#" class="close"><img src="/img/pb/close_pop.png" class="btn_close" title="Затвори" alt="Затвори" /></a>');
                return false;
	});

	$('a.close, #fade, .lightbox_cancel').live('click', function() {
		$('.lightbox_div').fadeOut();

		$('#fade , .popup_block').fadeOut(function() {
			$('#fade, a.close').remove();
		});

		return false;
	});
