Core_Button= function(parent,name,click){
	this.anddo=false;//что ещё делать если условие true
	this.condition=false;//условие на сробатывание кнопки
	this.whatdo=false;//что делать если условие false
	//определяем атрибуты
	this.click=click;//функция на клике
	this.parent=parent;//окно
	this.name=name;
	this.button;//кнопка
	//this.button.className="button";
	this.setFunClick=function(){//this.click ключевое слово уже имеющееся варианты функций если слово неопределено оно считается строкой кода и присваивается для выполнения
		core.addHandler(this.button, 'click',this.onclick.bind(this));
	}
	this.onclick=function(evt){
		if(this.condition===false||(typeof(this.condition)=='function'&&this.condition())){
			if(this.anddo!==false){
				if(typeof(this.anddo)=='string'){
					eval(this.anddo);
				}else if(typeof(this.anddo)=='function'){
					this.anddo();
				}
			}
			if(typeof(this.click)=='function'){
				this.click();
				this.parent.hideWindow();
				//core.addHandler(this.button, 'click', this.click);
				//core.addHandler(this.button, 'click', this.parent.hideWindow.bind(parent));
				//this.button.onclick=this.click;
			}else if(typeof(this.click)=='string'){
				if(this.click=="close"){
					this.parent.hideWindow();
				}else if(this.click=="submit"){//отправка формы, которая будет находится в области окна
					if(!core.justOneClick(evt)){
						return false;
					}

					if(!this.parent.submitFormInWindow()){
						this.parent.hideWindow();
					};
				}else{
					eval(this.click);
					this.parent.hideWindow();//.bind(parent);
				}
			}else{
				core_error+='В объект кнопка (Core_Button) на кнопку вешается собитие ни строка и не функция\n';
			}
		}else{
			if(this.whatdo!==false){
				this.whatdo();
			}
		}
	}
	this.init=function(){//инициализация
		this.button=document.createElement("input");
		this.button.type='button';
		//this.button.style.cursor='pointer';
		this.button.className='button';
		this.button.style.margin="2px";
		this.button.style.margin="2px";
		this.button.style.marginLeft="10px";
		this.button.style.marginRight="10px";
		//this.button.height='30px';
		this.button.value=this.name;
		this.setFunClick();
	}
	this.init();
	this.getChild=function(){
		//this.button.appendChild();
		return this.button;
	}
}