var imgs = new Array();function ch_loc(wich, loc) {  var wind = eval( wich );  wind.location.href = loc + "&tmp=" + Math.random();}function take_battle (bt, off) {  if (!confirm("Вы действительно хотите принять эту заявку?")) return false;  window.location = "main.php?page=take_it&battle_type="+ bt +"&offer="+ off;}function setbgImg (el, active) {  var el = document.getElementById(el);  if (active == 1)    el.style.backgroundImage = "url(/images/butt/button_center-Roll.gif)";  else    el.style.backgroundImage = "url(/images/butt/button_center.gif)";}function showEl(el, doc) {  var el = doc.getElementById(el);  if (el.style.display == 'block') el.style.display = 'none';  else el.style.display = 'block';}function dispButt(menu_item) {  for (var i=0;i<menu_item.length;i++) {    document.write('<tr><td><img src="/images/butt/button_left.gif"></td><td align="center" nowrap id="mn_'+i+'" onClick="'+menu_item[i][1]+'" onmouseOut="setbgImg (\'mn_'+i+'\', 0)" onmouseOver="setbgImg (\'mn_'+i+'\', 1)" style="padding-top: 3px; font-size: 12px; cursor: pointer; background-image: url(\'/images/butt/button_center.gif\');">'+menu_item[i][0]+'</td><td><img src="/images/butt/button_right.gif"></td></tr>');  }}function getRequestVar(req, vname) {  if (!req) return false;  var elm = req.split('&');  for (var i in elm) {    var tmp = elm[i].split('=');    if (tmp[0] == vname) return tmp[1];  }  return false;}function preLoader (callBack, progress) {  this.callBack = callBack;  this.onProgress = progress;  this.img_cnt = 0;  this.im_load = 0;  this.im_err = 0;  this.im_ab = 0;}preLoader.prototype = {  imgs : new Array(),  exec : function (im) {           this.img_cnt = im.length;           for (var i=0;i<this.img_cnt;i++) {             var cnt = this.imgs.length;             this.imgs.push(new Image());             this.imgs[cnt].onload = this.onL;             this.imgs[cnt].onerror = this.onE;             this.imgs[cnt].onabort = this.onA;             this.imgs[cnt].oPreloader = this;             this.imgs[cnt].src = im[i];           }         },  onL : function () {          this.oPreloader.im_load++;          this.oPreloader.mkProgress();        },  onE : function (msg,url,l) {          this.oPreloader.im_err++;          this.oPreloader.mkProgress();        },  onA : function () {          this.oPreloader.im_ab++;          this.oPreloader.mkProgress();        },  mkProgress : function () {                 if (this.onProgress != undefined) {                   this.onProgress(this.im_load, this.im_err, this.im_ab);                 }                 if ((this.im_load + this.im_err + this.im_ab) == this.img_cnt) {                   if (this.callBack != undefined) this.callBack();                 }               }}function progr(g, e, a) {  top.putmsg('Загрузка картинок : '+ldr.img_cnt+' / '+g, true, false);}function newWin(src, name, spec) {  if (!name) name = '_blank';  window.open(src, name, spec, false);}function getDoc2(doc, frm) {  var iframe = doc.getElementById(frm);  if (iframe == undefined) return null;  if (iframe.contentDocument) return iframe.contentDocument;  else return iframe.contentWindow.document;}function cmGetX (obj) {	var x = 0;	do {		x += obj.offsetLeft;		obj = obj.offsetParent;	}	while (obj);	return x;}function cmGetY (obj) {	var y = 0;	do{		y += obj.offsetTop;		obj = obj.offsetParent;	}	while (obj);	return y;}//images funcsfunction mkHTMLImage(src, id, mOver, mOut, mClick, iClass, iStyle, x, y, title) {  var inStl = false;  var res = '<img src="' + src + '"';  if (id != undefined && id != '') res += ' id="'+id+'"';  if (iClass != undefined && iClass != '') res += ' class="' + iClass + '"';  if (x != undefined && x != '' && y != undefined && y != '') {    res += 'style="position: absolute; left:' + x + 'px; top:' + y + 'px;';    inStl = true;  }  if (iStyle != undefined && iStyle != '') {    if (!inStl) res += ' style="';    res += iStyle + '"';  }  else if (inStl) res += '"';  if (mOver != undefined && mOver != '') res += ' onMouseOver="'+ mOver +'"';  if (mOut != undefined && mOut != '') res += ' onMouseOut="'+ mOut +'"';  if (mClick != undefined && mClick != '') res += ' onClick="'+ mClick +'"';  if (title != undefined && title != '') res += ' title="'+title+'"';  return res + '>';}function dispNav(doc, nav, imgDir) {  for (var i=0;i<nav.length;i++) {    doc.write(mkHTMLImage(imgDir + nav[i][1], nav[i][0],                          'top.s_img(this,\''+imgDir+nav[i][2]+'\');',                          'top.s_img(this,\''+imgDir+nav[i][1]+'\');',                          nav[i][5], 'imgbut', nav[i][6], nav[i][3], nav[i][4], nav[i][7]));  }}function scroll_iframe(frm, inc, dir) {  if (!window.frames[frm]) return;  if (dir == "v") window.frames[frm].scrollBy(0, inc);  else window.frames[frm].scrollBy(inc, 0);}function inFrmProc (selfName, frmId, urlPrefix, msgFunc) {  this.name = selfName;  this.fid = document.getElementById(frmId);  this.mess = msgFunc;  this.urlPrefix = urlPrefix;  this.error;  this.timeout = 60;  this.queue = new Array();  this.useQueue = false;  this.lastReq;  this.lastReqTime = 0;  this.status = 0;  this.wait = 0;}inFrmProc.prototype = {  send: function(req) {    if (this.wait != 0) {			if (this.useQueue) this.queue.push(req);			return 0;		}    this.error = 0;    this.lastReqTime = 0;    this.status = 1;    this.lastReq = req;    if (this.fid == undefined) {      this.error = 1;      return 0;    }    if (this.urlPrefix) {      var url = this.urlPrefix;      if (url.indexOf('?') == -1) url += '?';      else url += '&';      req = url + req;    }    this.fid.src = req;    this.status = 2;    this.waitFor();    return 1;  },  getLastError: function () {    switch (this.error) {      case 0: return '';      case 1: return 'Не указан "fid".';      case 2: return 'Время выполнения запроса превышено.';      case 3: return 'Уже выполняется один запрос.';      default: return 'Неизвестная ошибка.';    }  },  waitFor: function () {    this.lastReqTime += 2;    if (this.lastReqTime > this.timeout) {      this.error = 2;      this.status = 0;    }    if (this.status == 3 || this.status == 0) {      this.erorr = 0;      if(this.mess != undefined) this.mess();      this.status = 0;      clearTimeout(this.wait);      this.wait = 0;      this.fid.src = "";      if (this.queue.length)				this.send(this.queue.shift());    }    else this.wait = setTimeout(this.name + '.waitFor()', 500);  }}function progressBar (selfName) {  this.name = selfName;  if (!this.name) this.name = 'bar';  this.txt_id;  this.grf_id;  this.procDone;  this.timeout = 60;  this.step = 0;  this.max = 100;  this.pos = 0;  this._yellow = 35;  this._red = 75;  this._until;	this._onTime;	this.bar_width = 100;}progressBar.prototype = {  draw: function() {    document.write(      '<div id="pr_t_'+this.name+'" align="center"></div><div id="pr_g_'+this.name+'" style="width:0px;height:5px;background-color:green;"></div>'    );    this.txt_id = document.getElementById('pr_t_'+this.name);		this.scale = (this.bar_width / 100).toFixed(2);    this.grf_id = document.getElementById('pr_g_'+this.name);		this.setPos(this.pos);  },  waitFor: function (pos) {    if (pos) this._until = pos;    if (this.step == 0) return;		if (this._onTime != undefined) this._onTime(this);    this.setPos(this.pos + this.step);    if (this._until != undefined && this.pos == this._until) {      if (this.procDone != undefined) this.procDone(this.pos);    }    else //if (this.pos != this.max)      setTimeout(this.name + '.waitFor()', 1000);  },  setPos: function (pos) {    this.pos = pos;    if (this.pos > this.max) this.pos = this.max;    else if (this.pos < 0) this.pos = 0;    var nval = ((this.pos * 100) / this.max).toFixed(2);    this.txt_id.innerHTML = nval+'%';    this.grf_id.style.width = (nval * this.scale)+'px';    if (nval > this._red)      this.grf_id.style.backgroundColor = '#FF0000';    else if (nval > this._yellow)      this.grf_id.style.backgroundColor = '#FFFF00';    else this.grf_id.style.backgroundColor = '#008000';  }}function setl(el, val) {  var el = document.getElementById(el);  if (el == undefined) return;  el.innerHTML = val;}function getl(el) {  var el = document.getElementById(el);  if (el == undefined) return;  return el.innerHTML;}function htmlObj (tag) {  this.tag = tag;  this.style = '';}htmlObj.prototype = {  fetch: function() {    var res = '<'+this.tag;    if (this.width) this.style += 'width:'+this.width+'px;';    if (this.height) this.style += 'height:'+this.height+'px;';    if (this.src) res += ' src="'+this.src+'"';    if(this.onMouseOver) res += ' onMouseOver="'+this.onMouseOver+'"';    if(this.onMouseOut) res += ' onMouseOut="'+this.onMouseOut+'"';    if(this.onClick) res += ' onClick="'+this.onClick+'"';    if(this.title) res += ' title="'+this.title+'"';    if (this.style) res += ' style="'+this.style+'"';    if (this.id) res += ' id="'+this.id+'"';    return res + '>';  },  display: function (doc) {    if (doc == undefined) doc = document;    doc.write(this.fetch());  },  setSize: function (width, height) {    this.width = width;    this.height = height;  },  setImg: function (singl, roll) {    this.src = this.imgDir + singl;    if (roll == undefined) return;    this.onMouseOver = 'this.src=\''+this.imgDir + roll+'\'';    this.onMouseOut = 'this.src=\''+this.imgDir + singl+'\'';  },  setOnClick: function(clk) {    this.onClick = clk;  },  setTitle: function(title) {    this.title= title;  },  setStyle: function(stl) {    this.style += stl;  }}function htmlDoc (selfName) {  this.name = selfName;  if (!this.name) this.name = 'bar';  this.doc = document;  this.imgDir;  this.butCnt = 0;}htmlDoc.prototype = {  getEl: function(el, doc) {    if (doc == undefined) doc = this.doc;    return doc.getElementById(el);  },  getVal: function (el, doc) {    var el = this.getEl(el, doc);    if (el == undefined) return false;    return el.value;  },  setVal: function(id, val, doc) {    var el = this.getEl(id, doc);    if (el != undefined) el.value = val;  },  setHtml: function(id, val, doc) {    var el = this.getEl(id, doc);    if (el != undefined) el.innerHTML = val;  },  getHtml: function(id, doc) {    var el = this.getEl(id, doc);    if (el == undefined) return false;    return el.innerHTML;  },  img: function (width, height, img1, img2) {    var el_img = new htmlObj('img');    el_img.imgDir = this.imgDir;    el_img.setSize(width, height);    el_img.setImg(img1, img2);    return el_img;  },  button: function (cap, click) {    var el = new htmlObj('img');    el.imgDir = 'images/butt/';    el.setImg('button_left.gif');    var res = '<table cellpadding="0" cellcpaceing="0" class="but_tbl"><tr style="cursor: pointer;"'+              ' onMouseOver="'+this.name+'.getEl(\'main_b'+this.butCnt+'\').style.backgroundImage=\'url('+el.imgDir+'button_center-Roll.gif)\'"'+              ' onMouseOut="'+this.name+'.getEl(\'main_b'+this.butCnt+'\').style.backgroundImage=\'url('+el.imgDir+'button_center.gif)\'"'+              ' onClick="'+click+'">'+              '<td>'+el.fetch()+'</td><td id="main_b'+              this.butCnt+'" style=" background-image: url('+el.imgDir+'button_center.gif); background-repeat: repeat-x;"'+              '>'+ cap + '</td><td>';    el.setImg('button_right.gif');    res += el.fetch() + '</td></tr></table>';    this.butCnt++;    return res;  }}function message (selfName, id) {  this.name = selfName;  this.id = id;  this.doc = document;  this.vis = 0;  this.imgNorm = ['/images/msgs/blue/', '#95B2C8'];  this.imgErr = ['/images/msgs/red/', '#E85B43'];  this.msg;  this.autoHide = 3000;  this.cnt = 0;}message.prototype = {  init: function() {    this.msg = this.doc.getElementById('msg_'+this.id);    if(this.msg) {      alert('<!-- ERR_MSG_ID_ALREADY_IN_USE -->');      return;    }    this.doc.write('<div id="msg_'+this.id+'" class="dlg"></div>');    this.msg = this.doc.getElementById('msg_'+this.id);  },  display: function (stl, txt) {    if (this.id == undefined || !this.msg) {      alert('<!-- ERR_MSG_NO_ID -->');      return;    }    this.msg.innerHTML = '<table cellspacing="0" cellpadding="0">'+              '<tr><td width="23"><img src="'+stl[0]+'left_top.gif"></td><td style="background-image: url('+stl[0]+'up.gif);"></td><td width="23"><img src="'+stl[0]+'right_top.gif"></td></tr>'+              '<tr><td style="padding-left:2px; background-image: url('+stl[0]+'left.gif); "></td><td style="background-color: '+stl[1]+'; text-align: center;">'+txt+'</td><td style="background-image: url('+stl[0]+'right.gif);"></td></tr>'+              '<tr><td><img src="'+stl[0]+'left_bottom.gif"></td><td style="background-image: url('+stl[0]+'down.gif);"></td><td><img src="'+stl[0]+'right_bottom.gif"></td></tr></table>';    this.msg.style.left = (this.doc.body.clientWidth - this.msg.clientWidth - 155) / 2;    this.msg.style.visibility = 'visible';    this.cnt++;  },  putmsg: function  (msg, unlim, alr) {    if (this.vis) this.hide();    if (alr) this.display(this.imgErr, msg);    else this.display(this.imgNorm, msg);    if (!unlim)      setTimeout(this.name+".hide();", this.autoHide);  },  putDialog: function (msg, buts, alr) {    var bt = '';    if (buts == undefined) return false;    for(var i in buts) {      if(bt) bt += '&nbsp;';      bt += '<input type="button" value="'+buts[i][0]+'" class="standbut" onclick="'+buts[i][1]+'">';    }    this.putmsg (msg+'<br><br>'+bt, 1, alr);  },  putConfirm: function (msg, onOk) {    var bt = '';    if (onOk)      bt += '<input type="button" value="'+onOk[0]+'" class="standbut" onclick="'+onOk[1]+';'+this.name+'.hide();">&nbsp;';    bt += '<input type="button" value="Отмена" class="standbut" onclick="'+this.name+'.hide()">';    this.putmsg (msg+'<br><br>'+bt, 1, 0);  },  hide: function () {		this.cnt--;		if (this.cnt <= 0) {			this.cnt = 0;			this.msg.style.visibility = 'hidden';		}  }}function dig2(val, cnt, dig) {	if (cnt == undefined) cnt = 2;	if (dig == undefined) dig = "0";	var s = new String(val);	while (s.length < cnt)		s = dig + s;	return s;}function timer(time) {	var min = new String(time / 60);	var p = min.indexOf('.');	if (p) min = new Number(min.substr(0, p));	else min = new Number(min);	var hrs = (min > 59) ? new String(min / 60) : '0';	p = hrs.indexOf('.');	if (p) hrs = new Number(hrs.substr(0, p));	else hrs = 0;	if (hrs) min -= hrs * 60;	var sec = new String(time - hrs * 60 * 60 - min * 60);	sec = sec.substr(0, sec.indexOf('.'));	return dig2(hrs)+":"+dig2(min)+":"+dig2(sec);}function getHTTPObject() {	if (typeof XMLHttpRequest != 'undefined') return new XMLHttpRequest();	 try {		return new ActiveXObject("Msxml2.XMLHTTP");	} catch (e) {		try {			return new ActiveXObject("Microsoft.XMLHTTP");		} catch (e) {}	}	return false;}