function setText(inputid,checkbx)
{
	var textfld = document.getElementById(inputid);
	if (checkbx.checked) {
		textfld.disabled = true;
		textfld.style.border = '#414141 1px dotted'; 
		textfld.style.background = '#E8E8E8';
	}
	if (!checkbx.checked) {
		textfld.disabled = false;
		textfld.style.border = '#000000 1px solid'; 
		textfld.style.background = '#FFFFFF';		
	}
}
function knumrksoln(param){document.write(unescape(param))}
function goBack()
{
	if (confirm('Вы уверены, что хотите отменить все изменения и вернуться назад!'))
	{
		return history.back(-1);
	}
	return false;
}
var e;
function p(link, name, w, h) {
	//e = window.open(link, name, 'resizable=no, status=no, scrollbars=yes, width=' + w + ',height=' + h);
	showPopWin(link, w, h);
	// if (window.focus) { e.focus(); }
	return false;
}
function checkConnection(type, id, link) {
	link = link.replace("%d", id);
	p(link,"checkConnection",470,250);
	return false;
}
function isEmail(string) {
    if (string.search(/^(\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+(;|,|$))+$/) != -1)
        return true;
    else
        return false;
}
/*

Скрипт, изменяющий теги title и alt

*/

window.onerror = null;

tooltip = {

attr_name: "tooltip",
blank_text: "",
newline_entity: "  ",
max_width: 0,
delay: 100,


t: document.createElement("DIV"),
c: null,
g: false,

m: function(e){
if (tooltip.g){
oCanvas = document.getElementsByTagName(
(document.compatMode && document.compatMode == "CSS1Compat") ? "HTML" : "BODY")[0];
x = window.event ? event.clientX + oCanvas.scrollLeft : e.pageX;
y = window.event ? event.clientY + oCanvas.scrollTop : e.pageY;
tooltip.a(x, y);
}
},

d: function(){
tooltip.t.setAttribute("id", "tooltip");
document.body.appendChild(tooltip.t);
a = document.all ? document.all : document.getElementsByTagName("*");
aLength = a.length;
for (var i = 0; i < aLength; i++){

if (!a[i]) continue;
tooltip_title = a[i].getAttribute("title");
if (tooltip_title && typeof tooltip_title != "string") tooltip_title = "";

tooltip_alt = a[i].getAttribute("alt");
tooltip_blank = a[i].getAttribute("target") && a[i].getAttribute("target") == "_blank" && tooltip.blank_text;
if (tooltip_title || tooltip_blank){
a[i].setAttribute(tooltip.attr_name, tooltip_blank ? (tooltip_title ? tooltip_title + " " + tooltip.blank_text : tooltip.blank_text) : tooltip_title);
if (a[i].getAttribute(tooltip.attr_name)){
a[i].removeAttribute("title");
if (tooltip_alt && a[i].complete) a[i].removeAttribute("alt");
tooltip.l(a[i], "mouseover", tooltip.s);
tooltip.l(a[i], "mouseout", tooltip.h);
}
}else if (tooltip_alt && a[i].complete){
a[i].setAttribute(tooltip.attr_name, tooltip_alt);
if (a[i].getAttribute(tooltip.attr_name)){
a[i].removeAttribute("alt");
tooltip.l(a[i], "mouseover", tooltip.s);
tooltip.l(a[i], "mouseout", tooltip.h);
}
}
if (!a[i].getAttribute(tooltip.attr_name) && tooltip_blank){
}
}
document.onmousemove = tooltip.m;
window.onscroll = tooltip.h;
tooltip.a(-99, -99);
},

s: function(e){
d = window.event ? window.event.srcElement : e.target;
if (!d.getAttribute(tooltip.attr_name)) return;
s = d.getAttribute(tooltip.attr_name);
if (tooltip.newline_entity){
s = s.replace(/\&/g,"&amp;");
s = s.replace(/\</g,"&lt;");
s = s.replace(/\>/g,"&gt;");
s = s.replace(eval("/" + tooltip.newline_entity + "/g"), "<br />");
tooltip.t.innerHTML = s;
}else{
if (tooltip.t.firstChild) tooltip.t.removeChild(tooltip.t.firstChild);
tooltip.t.appendChild(document.createTextNode(s));
}
tooltip.c = setTimeout("tooltip.t.style.visibility = 'visible';", tooltip.delay);
tooltip.g = true;
},

h: function(e){
tooltip.t.style.visibility = "hidden";
if (!tooltip.newline_entity && tooltip.t.firstChild) tooltip.t.removeChild(tooltip.t.firstChild);
clearTimeout(tooltip.c);
tooltip.g = false;
tooltip.a(-99, -99);
},

l: function(o, e, a){
if (o.addEventListener) o.addEventListener(e, a, false);
else if (o.attachEvent) o.attachEvent("on" + e, a);
else return null;
},

a: function(x, y){
oCanvas = document.getElementsByTagName(
(document.compatMode && document.compatMode == "CSS1Compat") ? "HTML" : "BODY"
)[0];

w_width = oCanvas.clientWidth ? oCanvas.clientWidth + oCanvas.scrollLeft : window.innerWidth + window.pageXOffset;
w_height = window.innerHeight ? window.innerHeight + window.pageYOffset : oCanvas.clientHeight + oCanvas.scrollTop; // should be vice verca since Opera 7 is crazy!

tooltip.t.style.width = ((tooltip.max_width) && (tooltip.t.offsetWidth > tooltip.max_width)) ? tooltip.max_width + "px" : "auto";

t_width = 150; // tooltip.t.offsetWidth;
t_height = tooltip.t.offsetHeight;

tooltip.t.style.left = x + 8 + "px";
tooltip.t.style.top = y + 8 + "px";

if (x + t_width > w_width) tooltip.t.style.left = w_width - t_width + "px";
if (y + t_height > w_height) tooltip.t.style.top = w_height - t_height + "px";
}
}

var root = window.addEventListener || window.attachEvent ? window : document.addEventListener ? document : null;
if (root){
if (root.addEventListener) root.addEventListener("load", tooltip.d, false);
else if (root.attachEvent) root.attachEvent("onload", tooltip.d);
}

/**
* This array is used to remember mark status of rows in browse mode
*/
var marked_row = new Array;

/**
* enables highlight and marking of rows in data tables
*
*/
function PMA_markRowsInit() {
	// for every table row ...
	var rows = document.getElementsByTagName('tr');
	for ( var i = 0; i < rows.length; i++ ) {
		// ... with the class 'odd' or 'even' ...
		if ( 'odd' != rows[i].className.substr(0,3) && 'even' != rows[i].className.substr(0,4) ) {
			continue;
		}
		// ... add event listeners ...
		// ... to highlight the row on mouseover ...
		if ( navigator.appName == 'Microsoft Internet Explorer' ) {
			// but only for IE, other browsers are handled by :hover in css
			rows[i].onmouseover = function() {
				this.className += ' hover';
			}
			rows[i].onmouseout = function() {
				this.className = this.className.replace( ' hover', '' );
			}
		}
	}
}
window.onload=PMA_markRowsInit;

/**
* setting cookies
*
*/
function setCookie (name, value, expires, path, domain, secure)
{
	document.cookie = name + "=" + escape(value) +
        ((expires) ? "; expires=" + expires : "") +
        ((path) ? "; path=" + path : "") +
        ((domain) ? "; domain=" + domain : "") +
        ((secure) ? "; secure" : "");
}
function in_array(str, arr) {
	for (var i=0; i < arr.length; i++) {
		if (str == arr[i]) { return true; }
	}
	return false;
}

function key_in_array(str, arr) {
	for (var i=0; i < arr.length; i++) {
		if (str == arr[i]) { return i; }
	}
	return false;
}