<!--

Array.prototype.inArray = function(value){
	for(var i = 0; i < this.length; i++){
		if(this[i] === value){
			return true;
		}
	}
	return false;
}

function ShowMessageBox(iFrameName, iFrameObject){
	var innerHTML = iFrameInnerHTML(iFrameName, iFrameObject);
	//alert(innerHTML);
	if((innerHTML !== null) && (typeof innerHTML === 'string') && (innerHTML.length > 0))
		return messageInnerHTML(innerHTML, 'MessageBox');
	else
		return false;
};

function textareaLimitation(textArea, Limit, counterArea){
	var
		fLength = function (vText){
				var
					cc = function(s, sp, spp){var pos = s.indexOf(sp); for(var count = 0; pos != -1; count++){pos = s.indexOf(sp, pos + sp.length);} return count * (spp.length - sp.length);},
					c0 = 0, //cc(vText, '\\', '\\\\'),
					c1 = cc(vText, '&', '&amp;'),
					c2 = cc(vText, '\'', '&#039;'),
					c3 = cc(vText, '"', '&quot;'),
					c4 = cc(vText, '<', '&lt;'),
					c5 = cc(vText, '>', '&gt;');
				return (typeof vText === 'string') ? vText.length + c0 + c1 + c2 + c3 + c4 + c5 : 0;
			},
		obj = ((typeof textArea === 'string') && (textArea.length > 0)) ? document.getElementById(textArea) : ((typeof textArea === 'object') ? textArea : null),
		counter = ((typeof counterArea === 'string') && (counterArea.length > 0)) ? document.getElementById(counterArea) : ((typeof counterArea === 'object') ? counterArea : null),
		limit = parseInt(Limit),
		content = ((obj !== null) && (typeof obj.value === 'string')) ? obj.value : null,
		used = (content !== null) ? limit - fLength(content) : limit,
		iLimit = limit;
	// CAT
	if(used < 0){
		do{
			content = content.substr(0, iLimit);
			iLimit--;
			used = limit - fLength(content);
		}while(used < 0);
		obj.value = content;
	}
	// RETURN
	if((counter !== null) && (typeof counter.value === 'string')){
		counter.value = used;
		return false;
	}
	else{
		return used;
	}
};

function OpenWindow(url, w, h, n, wait){
	if(wait) waitMessage(document, document.body, 'для того, чтобы разблокировать, кликните два раза');
	var x = (screen.width - w) / 2;
	var y = (screen.height - h) / 2;
	var name = (typeof n === 'string') ? n : 'newWindow';
	var str = "width=" + w + ", height=" + h + ", left=" + x + ", top=" + y + ", scrollbars=1, alwaysRaised=yes, resizable=no, dependent=yes, z-lock=yes";
	var winnew = window.open(url, name, str);
	return false;
}

function EraseObject(erasingObject){
	var obj = (typeof erasingObject === 'string') ? document.getElementById(erasingObject) : ((typeof erasingObject === 'object') ? erasingObject : null);
	if(obj !== null){
		obj.innerHTML = '';
		obj.removeNode(true);
		return true;
	}
	return false;
};

//-->