function lsfShowAdminPopup(url, clientWidth, clientHeight, callback, header){
	if((window.parent != window) && typeof window.parent.lsfShowAdminPopup == 'function')
		return window.parent.lsfShowAdminPopup(url, clientWidth, clientHeight, callback, header);
		
	if(url.indexOf('?') == -1)
		url += '?';
	else
		url += '&';
	url += '_adminMode=popup';
	
	if(typeof header == 'undefined')
		header = 'Добавление элемента';
		
	if(!window.lsfPanelCounter)
		window.lsfPanelCounter = 1;
		
	window.lsfPanelCounter++;
		
	var panel = new YAHOO.widget.Panel("newPanel" + window.lsfPanelCounter, { 
			visible:false, 
			draggable:true, 
			close:true, 
			modal: true,
			fixedcenter: true, 
			underlay: "shadow"
		} );
		
	panel.setHeader(header); 
	panel.setBody('<iframe src="' + url + '" style="width: ' + clientWidth + 'px; height: ' + clientHeight + 'px" frameborder="0"></iframe>');
	panel.body.style.padding = 0;
	
	var topWindow = window;
	while(topWindow.parent != topWindow){
		topWindow = topWindow.parent;
	}
	
	panel.render(topWindow.document.body);

	
	var newCallback = function(arg){
			panel.hide();
			panel = null;
			
			if(typeof callback == 'function')
				callback(arg);
		}
	
	panel.body.firstChild.lsfCompleteCallback = newCallback;
	
	panel.show();
	
	return panel;
}

function lsfShowNewSelectPopup(select, url, clientWidth, clientHeight, header){
	if(typeof select == 'string')
		select = document.getElementById(select);
		
	var callback = function(arg){
		var value = arg[0];
		var text = (typeof arg[1] == 'undefined') ? arg[0] : arg[1];
		var found = false;
		
		for(var i = 0; i < select.options.length; i++){
			if(select.options[i].value == value){
				select.options[i].innerHTML = text;
				select.options[i].selected = true;
				found = true;
			}
		}
		
		if(!found){
			var option = document.createElement('OPTION');
			option.value = value;
			option.innerHTML = text;
			
			select.appendChild(option);
			option.selected = true;
		}
	}

	return lsfShowAdminPopup(url, clientWidth, clientHeight, callback, header);	
}