$(document).ready(function() {
	popup(".popuphold a");
	function popup(open_btn) {
		$(".close").live("click", function(event) {
			event.preventDefault();
		});
		$(".close").live("click", function() {
			$(".popupchik").remove();
		});
		$(open_btn).click(function(event) {
			event.preventDefault();
		});
		$(open_btn).click(function() {
			$(".popupchik").remove();
			$("*:not(.popupchik)").click(function(e) {
				kids = e.target;
				var _a = kids;
				while (true) {
					_atag = _a.tagName;
					if (_atag && ($(_a).hasClass('popupchik'))) {
						break;
					}
					else {
						if (!_atag) {
							$(".popupchik").remove();
							break;
						}
						_a = _a.parentNode;
					}
				}
			});
			selector = $(this).parent();
			ajaxlink = $(this).attr("href");
			$.get(ajaxlink, function(data) {
				$(selector).css({
					zIndex: 10
				});
				$(selector).prepend(data);
				inputValue(".input-text .text");
			});
			
		});
	}
});

