var cmsBehaviours = {

  '.editContainerBLOCK' : function (el) {
    el.onclick = function () {
			toggleDisplayCookie(el,$(el.hash.substr(1)),getParentNode(el,"FORM").name,"editContainerBLOCK","editContainerNONE");
    }
  },

  '.editContainerNONE' : function (el) {
    el.onclick = function () {
			toggleDisplayCookie(el,$(el.hash.substr(1)),getParentNode(el,"FORM").name,"editContainerBLOCK","editContainerNONE");
    }
  },

	'.formTab a' : function (el) {
		el.onclick = function () {
			var toggleObj = eval(el.hash.substr(1));
			toggleObj.toggle();
			return false;
		}
	},

	'.disabled' : function (el) {
		el.onkeypress = function (event) { /*
      var key = event.keyCode;alert(key);
     	if ((key==null) || (key==8) ||(key==9) || (key==13) || (key==27) ) return true;
     	else return false;   */
			return false;
		},
		el.onfocus = function () {
			el.blur();
		}
	},
	
	'.checkSameBoxes' : function (el) {
		el.onclick = function () {
			checkSameBoxes(el);
		}
	},

  'a.popupPic' : function (el) {
    el.onclick = function () {
			return popupPic(el);
    }
  },

	'a.popupWin' : function (el) {
		el.onclick = function () {
			openWindow(el.href,el.id+'PopupWin');
			return false;
		}
	},

	'.addPicForText' : function (el) {
    el.onclick = function () {
			var newPicNum=Number(el.parentNode.parentNode.getElementsByTagName("INPUT")[0].name.match(/\d+/))+1;
      addFields(el,/\d+/,newPicNum);
      return false;
    }
  },

	'.addRefbookItem' : function (el) {
		el.onclick = function () {
			addPostingContainer(el,'ITEM_ORDNUM',10);
      return false;
		}
	},

	'.redirectMenu' : function (el) {
		el.onchange = function () {
			setActionAndSubmit(el.form);
			el.selectedIndex=0;
		}
	},

	'.submitMenu' : function (el) {
		el.onchange = function () {
			if (el.value) el.form.submit();
		}
	},

	'#switchWysiwyg' : function (el) {
		el.onchange = function () {
			var message;
			var cookieValue=Number(el.checked);
			if (cookieValue)message="Визуальный редактор будет активирован после обновления страницы!";
			else message="Визуальный редактор будет отключен после обновления страницы!";
			var cookieExpires=new Date();
		  cookieExpires.setTime(cookieExpires.getTime() + 3600000 * 24 * 30 * 12 * 10)
			if (confirm(message)) setCookie('WYSIWYG',cookieValue,cookieExpires,"/");
		}
	},

	'#toolbarToggle' : function (el) {
		el.onclick = function () {
			toggleDisplayCookie(el,$("toolbarMenu"));
			return false;
		}
	},
	'#orderSAVE' : function (el) {
		el.onclick = function () {
			processOrderedList('orderList','orderField');
			el.form.submit();
		}
	}

}
Behaviour.register(cmsBehaviours);
