var d = document;
var offsetfromcursorY=0 // y offset of tooltip
var ie=d.all && !window.opera;
var ns6=d.getElementById && !d.all;
var tipobj,op;
//var op;
var mes1='help1';
var notWhitespace = /\S/;
var isiOS = ((navigator.userAgent.match(/iP[ao]d/i) != null) || (navigator.userAgent.match(/iPhone/i) != null)) ;

//var tipobj=d.getElementById('mess');

function gestureChange(event) {
// Disable browser zoom
event.preventDefault();

}



function cleanWhitespace(node) {
  for (var x = 0; x < node.childNodes.length; x++) {
    var childNode = node.childNodes[x]
    if ((childNode.nodeType == 3)&&(!notWhitespace.test(childNode.nodeValue))) {
      node.removeChild(node.childNodes[x])
      x--
    }
    if (childNode.nodeType == 1) {
      cleanWhitespace(childNode)
    }
  }
}



arrhelp = {
	"help1":"<b>Шаблоны поиска:</b><br><b>?</b> - любой символ<br/><b>*</b> - любая последовательность символов<br><b>REGEXP:<i>expr</i></b> - поиск с использованием регулярных выражений, <i>expr</i> - регулярное выражение",
	"help2":"Увеличить",
	"help3":"Вы можете заказать каталог аукциона в&nbsp;разделе МАГАЗИН нашего сайта"
}

arr = {
	"Биткин#" : "<b>Биткин В.В.</b> Сводный каталог монет России. Части I–II. Киев, 2003.",
	"ГМ#": "<b>Георгий Михайлович, Великий Князь.</b> Корпус русских монет:<br>Монеты царствования Императора Петра I. СПб., 1914.<br>Таблица монет 1511–1719 годов. СПб.,<br>Монеты царствования Императрицы Екатерины I и Императора Петра II. СПб., 1904.<br>Монеты царствования Императрицы Анны Иоанновны и Императора Иоанна III. СПб., 1901.<br>Монеты царствования Императрицы Елизаветы и Императора Петра III. Т 1–2. СПб., 1896.<br>Монеты царствования Императрицы Екатерины II. Т 1–2. СПб., 1894.<br>Монеты царствования Императора Павла I и Императора Александра I. СПб., 1891.<br>Монеты царствования Императора Николая I. СПб., 1890.<br>Монеты царствования Императора Александра II. СПб., 1888.<br>Монеты 1881–1890 годов. СПб., 1891.<br>Монеты для Пруссии, Грузии, Польши и Финляндии. СПб., 1893.",
	"Денисов#": "<b>Денисов А.Е.</b> Бумажные денежные знаки России 1769–1917 годов. Ч. 1–4. М., 2002–2005.",
	"Дьяков#": "<b>Diakov M.E.</b> Russian Coins of Peter the Great. Parts 1–2. M., 2000.<br><b>Diakov M.E.</b> Russian Coins of Catherine I and Peter II. M., 2001.<br><b>Diakov M.E.</b> Russian Coins of Anna and Ioann III. M., 2001.<br><b>Diakov M.E.</b> Russian Coins of Elizabeth I and Peter III. M., 2002.<br><b>Diakov M.E.</b> Russian Coins of Catherine II. M., 2003.<br><b>Дьяков М.Е.</b> Медали Российской Империи. Ч. 1–8. М., 2004–2008.",
	"Diakov#": "<b>Diakov M.E.</b> Russian Coins of Peter the Great. Parts 1–2. M., 2000.<br><b>Diakov M.E.</b> Russian Coins of Catherine I and Peter II. M., 2001.<br><b>Diakov M.E.</b> Russian Coins of Anna and Ioann III. M., 2001.<br><b>Diakov M.E.</b> Russian Coins of Elizabeth I and Peter III. M., 2002.<br><b>Diakov M.E.</b> Russian Coins of Catherine II. M., 2003.<br><b>Дьяков М.Е.</b> Медали Российской Империи. Ч. 1–8. М., 2004–2008.",
	"Иверсен#": "<b>Иверсен Ю.Б.</b> Медали на деяния Императора Петра Великого. СПб., 1872.<br><b>Иверсен Ю.Б.</b> Медали в честь русских государственных деятелей и частных лиц. Т. 1–3. СПб., 1880–1896.",
	"по Ильину":"<b>Гиль Х., Ильин А.</b>Русские монеты, чеканенные с 1801–1904 г. Практическое руководство для собирателей. СПб., 1904;<br><b>Ильин А., Толстой И., гр.</b> Русские монеты, чеканенные с 1725 по 1801 г. Практическое руководство для собирателей. СПб., 1910.",
	"Казаков#": "<b>Казаков В.В.</b> Монеты царствования Императора Николая II. М., 2004",
	"Кардаков#": "<b>Кардаков Н.И.</b> Каталог денежных знаков России и Балтийских стран 1769–1950. Берлин, 1953. 444 с. На нем. и рус. яз.",
	"Кац, Малышев#": "<b>Кац Л.З., Малышев В.П.</b> Энциклопедия бумажных денежных знаков России. Т.I. Правительственные эмиссии 1769–1995. СПб., 1998. ",
	"Малышев и др.#": "Бумажные денежные знаки России и СССР / А.И.Малышев, В.И.Таранков, И.Н.Смиренный; под ред. В.И.Таранкова. М., 1991.",
	"по Петрову":"<b>Нумизматический магазин В.И.Петрова в Москве.</b> Практическое руководство для собирателей монет… 3-е издание. М., 1900.",
	"Петров, Федорин#": "<b>Петров Л.Ф., Федорин А.И.</b> Монеты Страны Советов. Тиражные монеты специального чекана РСФСР и СССР. 1921–1991. Каталог. М., 2008.",
	"Руденко#": "<b>Руденко И.В.</b> Памятные жетоны Императорской России (1721–1917 гг.). Каталог. Ростов-на-Дону, 2007.",
	"Рылов, Соболин#": "Монеты России от Николая II до наших дней. Каталог / И.И.Рылов, В.И.Соболин. М., 2004.",
	"Смирнов#": "Описание русских медалей / Составил В.П.Смирнов. СПб., 1908.",
	"СРМ#": "Собрание русских медалей, изданное по Высочайшему повелению Археографической комиссией. Вып. I–V. СПб., 1840–1846.",
	"Соколов#": "Сводный каталог русских медалей / Составитель С.П.Соколов. Т. I–II. Киев, 2000. ",
	"Тункель#": "Металлические боны России и СССР / Международное объединение нумизматов. Составитель А.В.Тункель. Донецк, 1992.",
	"Узд#": "<b>Уздеников В.В.</b> Монеты России 1700–1917. М., 1992.",
	"Уздеников#": "<b>Уздеников В.В.</b> Монеты России 1700–1917. М., 1992.",
	"Федорин#": "<b>Федорин А.И.</b> Монеты страны Советов. 1921–1991. Каталог. Изд. 3-е, доп. и испр. М., 2007. ",
	"Федорин IV #": "<b>Федорин А.И.</b> Монеты страны Советов. 1921–1991. Каталог. Изд. 4-е, доп. и испр. М., 2010.",
	"АФ#": "<b>Федорин А.И.</b> Монеты страны Советов. 1921–1991. Каталог. Изд. 3-е, доп. и испр. М., 2007. ",
	"Широков, Золотарев, Сорокин#": "<b>Широков А.И., Золотарев М.Л., Сорокин В.Ю.</b> Монеты страны Советов. Юбилейные и памятные монеты из недрагоценных металлов. 1921–1991. Каталог-справочник. М., 2008.",
	"Brekke#": "<b>Brekke B.F.</b> The Copper Coinage of Imperial Russia. 1700–1917. Malmo, 1977.",
	"Holmasto99#": "Suomi Finland. Rahat ja Setelit. Mynt och Sedlar. Coins and Banknotes. 1811–1999. Arviohintoineen. Med varderingspriser. With valuations / Holmasto team.",
	"Pick#": "Standard Catalog of World Paper Money by Albert Pick. 7th edition. Vol. I. Specialized Issues. Krause Publications, 1995.<br>Standard Catalog of World Paper Money. Based on the original works of Albert Pick. 8th edition. Vol. II. General Issues to 1960. Krause Publications, 1996.",
	"Петрунин#": "Петрунин Ю.П. Известный и неизвестный рубль Петра II. Монетная иконография. Изобразительный ряд (каталог). Очерки по нумизматике (рубли Петра II). Памятные медали Петра II. Б.м., 2007",
	"Severin#" : "<b>Северин Г.М.</b> Золотые и платиновые монеты Российской Империи с 1701 до 1911 г. Пер. с англ. М., 2000.<br><b>Северин Г.М.</b> Серебряные монеты Российской Империи. 1682–1801. Пер. с англ. М., 2001.<br><b>Северин Г.М.</b> Серебряные монеты Российской Империи. 1801–1917. Пер. с англ. М., 2001." 
}

function getElementPosition(elem) {
	var w = elem.offsetWidth;
	var h = elem.offsetHeight;
	var l = 0;
	var t = 0;
	while (elem) {
		l += elem.offsetLeft;
		t += elem.offsetTop;
		elem = elem.offsetParent;
	}
	return {"left":l, "top":t, "width": w, "height":h};
}


function initmess(txt) {

	tipobj=d.getElementById('mess');

	tipobj.innerHTML = '\
	<div style="position:absolute; top:0px; left:0px; width:26px; height:26px; background: url(/images/tt1.png);"></div> \
	<div style="position:absolute; top:0px; left:26px; right:26px; height:26px; background: url(/images/tt2.png) repeat-x; "></div> \
	<div style="position:absolute; top:0px; width:26px; right:0px; height:26px; background: url(/images/tt3.png);"></div> \
	<div style="position:absolute; top:26px; width:26px; right:0px; bottom:26px; background: url(/images/tt4.png) repeat-y;"></div> \
	<div style="position:absolute; bottom:0px; width:26px; right:0px; height:26px; background: url(/images/tt5.png);"></div> \
	<div style="position:absolute; bottom:0px; left:26px; right:26px; height:26px; background: url(/images/tt6.png) repeat-x;"></div> \
	<div style="position:absolute; bottom:0px; left:0px; width:26px; height:26px; background: url(/images/tt7.png);"></div> \
	<div style="position:absolute; bottom:26px; left:0px; width:26px; top:26px; background: url(/images/tt8.png) repeat-y;"></div> \
	<div id="arr" style="position:absolute; width:14px;  height:26px; background-image: url();"></div> \
	<div class="tooltiptext">' + txt + '</div>';

	if(tipobj.getElementsByClassName == undefined) { 
		tipobj.getElementsByClassName = function(cl) { 
		      var retnode = []; 
		      var myclass = new RegExp('\\b'+cl+'\\b'); 
		      var elem = this.getElementsByTagName('div'); 
		      for (var i = 0; i < elem.length; i++) { 
		         var classes = elem[i].className; 
		         if (myclass.test(classes)) { 
		            retnode.push(elem[i]); 
		         } 
		      } 
		      return retnode; 
		   } 
	}; 

}

function tooltip(el,txt,mymode) {
	tipobj=d.getElementById('mess');
	tipobjtxt=d.getElementById('tooltiptext');
	tipobj.style.cssText= 'width:260px;';

	if (mymode==1) {
		txt = arr[txt];

	} else {
		txt = arrhelp[txt];
	}

	initmess(txt);

	op = 0.1;  

	tipobj.style.opacity = op;
	tipobj.style.visibility="visible";

	tipobj.onclick=hide_info;

	arrdiv=d.getElementById('arr');
	pos=getElementPosition(el);
	
	curX=pos.left+(pos.width/2);
	curY=pos.top+ (pos.height/2);
	winwidth=ie? ietruebody().clientWidth : window.innerWidth-20
	winheight=ie? ietruebody().clientHeight : window.innerHeight-20

	rightedge=winwidth-curX;
	bottomedge=winheight-curY;


	if (rightedge < tipobj.offsetWidth)  {
		tipobj.style.left=curX+40-tipobj.offsetWidth+"px";
		arrdiv.style.left= 220 +"px";
	}
	else {
		tipobj.style.left=curX-40+"px";
		arrdiv.style.left=30+"px";
	}
	if (bottomedge < tipobj.offsetHeight) {
		tipobj.style.top=curY-tipobj.offsetHeight-offsetfromcursorY+"px";
		arrdiv.style.bottom= 0 + "px";
		arrdiv.style.background='url(/images/tt10.png)';
	}
	else {
		tipobj.style.top=curY+offsetfromcursorY+"px";
		arrdiv.style.background='url(/images/tt9.png)';
	}
	appear();
}



function checkLoad (img) {
	if(!img.complete){
		setTimeout("checkLoad(img)", 10)
	}
}


function tooltip2(number, au, el) {
	tipobj=d.getElementById('mess');
	tipobjtxt=d.getElementById('tooltiptext');

	
	initmess(d.getElementById('l'+number).innerHTML);
	tipobj.style.width = '1040px';

	tipobj.innerHTML = tipobj.innerHTML.replace (/class="literatura"/g, "")

	cleanWhitespace(tipobj); //Удаляет пробельные childNodes

	lottext=tipobj.childNodes[9];
	lottext.style.cssText = "background-color:white;"
	lottext.childNodes[0].style.cssText ="width:100px; margin:0px; padding:5px; border:none " // номер лота
	lottext.childNodes[2].style.cssText= "width:700px; padding:10px; text-align:justify; float:left; *float:none" //описание
	lottext.childNodes[3].childNodes[0].style.cssText= "padding:10px;" //цена
	lottext.childNodes[3].childNodes[0].childNodes[0].style.display="none" //"описание в каталоге"
	lottext.childNodes[3].childNodes[1].style.display='none' //заочные торги
	imageDiv=lottext.childNodes[1];


	imageDiv.onclick = ""
	imageDiv.style.cssText = "float:none; width:990px;"



	op = 0.1;  
	tipobj.style.opacity = op;
	tipobj.style.visibility="visible";

	winwidth=ie? ietruebody().clientWidth : window.innerWidth-20
	myleft = (winwidth-1040)/2;
	tipobj.style.left=(myleft>0)?myleft+"px":0;
	mytop=ie? ietruebody().scrollTop:window.scrollY;
	tipobj.style.top= mytop +"px"

	appear();



	if (imageDiv.hasChildNodes()) {
		for( i=0; i<imageDiv.childNodes.length; i++) {
//			var smallImage=imageDiv.children[i];
			var smallImage=imageDiv.childNodes[i];
			var height = smallImage.getAttribute("hb");
			var width = smallImage.getAttribute("wb");
			var bigsrc= smallImage.src.replace(/auct-lo/, "bgimauctabs"+au);
			var bigImage = document.createElement("img");
			bigImage.setAttribute("src", bigsrc);
			bigImage.setAttribute("width", width);
			bigImage.setAttribute("height", height);
			bigImage.setAttribute("style", "background: white url(/images/wait2.gif) 50% 50% no-repeat;");
			imageDiv.replaceChild(bigImage, smallImage);
		}

	}

	tipobj.onclick=hide_info;
}


function tooltip3(number,el) {
	tipobj=d.getElementById('mess');
	tipobjtxt=d.getElementById('tooltiptext');
	initmess(d.getElementById(number).innerHTML);
	tipobj.style.width = '1040px';
	var tmptxt = tipobj.innerHTML;
	tmptxt = tmptxt.replace (/literatura/g, "")
	tmptxt = tmptxt.replace (/searchresult/g, "")
	tipobj.innerHTML=tmptxt;

	tipobj.innerHTML+='<div id="ttclose" style="position:absolute; top:18px; right:18px; width:20px; height:20px; background: url(/images/close.gif) #f1e4d2; cursor:pointer"></div>';
	d.getElementById("ttclose").onclick=hide_info;

	tipobj.getElementsByClassName("tooltiptext")[0].style.cssText = "background-color:white;"
	tipobj.getElementsByClassName("shop-history")[0].style.cssText = "display:block;" //дополн. описание
	tipobj.getElementsByClassName("shop-descrN")[0].style.cssText = "width:960px; padding:10px; text-align:justify; float:left; background-color:white;" //описание
	tipobj.getElementsByClassName("shop-catalogN")[0].style.cssText="display:none" //описание в каталоге
	tipobj.getElementsByClassName("shop-priceS")[0].style.cssText="padding:0 5px 5px 0;" // в корзину?
	myStyle=d.getElementById('b'+number).className;
	tipobj.getElementsByClassName(myStyle)[0].id= "xxx"// в корзину


	cleanWhitespace(tipobj); //Удаляет пробельные childNodes

////	lottext=tipobj.childNodes[9];
////	lottext.style.cssText = "background-color:white;"
//	lottext.childNodes[1].className= "shop-descrN" //описание
////	lottext.childNodes[1].lastChild.style.cssText="display:block;";  //дополн. описание
////	lottext.childNodes[1].style.cssText= "width:700px; padding:10px; text-align:justify; float:left; background-color:white; " //описание
//	lottext.childNodes[2].className= "shop-priceN" //цена
//	lottext.childNodes[2].childNodes[0].style.cssText= "padding:10px;" //цена
////	lottext.childNodes[2].childNodes[0].style.display="none" //"описание в каталоге"
//	lottext.childNodes[2].childNodes[1].className = "shop-priceS"
//	lottext.childNodes[2].childNodes[1].childNodes[0].childNodes[1].id = "xxx"// в корзину
//	lottext.childNodes[2].childNodes[1].childNodes[0].childNodes[1].style.cssText="display:block;"
//	lottext.childNodes[2].childNodes[1].style.cssText= "padding:0 5px 5px 0;"
///	lottext.childNodes[3].style.cssText="clear:both; display:block;";

////	imageDiv=lottext.childNodes[0];
	imageDiv=tipobj.getElementsByClassName("shop-picN")[0];

	imageDiv.onclick = ""
	imageDiv.style.cssText = "float:none; width:990px;"
	imageDiv.onclick = ""
	imageDiv.title = ""

	var re = new RegExp('shop');
	if (!tipobj.ownerDocument.URL.match(re)) {
		var divElement = document.createElement("div");
		divElement.innerHTML="Для оформления заказа перейдите в раздел <a href='/shops.shtml'>&laquo;Магазин&raquo</a> нашего сайта";
		lottext.appendChild(divElement);
	}

	op = 0.1;  
	tipobj.style.opacity = op;
	tipobj.style.visibility="visible";
	winwidth=ie? ietruebody().clientWidth : window.innerWidth-20
	myleft = (winwidth-1040)/2;
	tipobj.style.left=(myleft>0)?myleft+"px":0;
	var mytop=ie ? ietruebody().scrollTop : window.scrollY;
	tipobj.style.top= mytop +"px"
	appear();

	if (imageDiv.hasChildNodes()) {
		for( i=0; i<imageDiv.childNodes.length; i++) {
			var smallImage=imageDiv.childNodes[i];
			var height = smallImage.getAttribute("hb");
			var width = smallImage.getAttribute("wb");
			var bigsrc= smallImage.src.replace(/newsmimabs/, "newbgimabs");
			var bigImage = document.createElement("img");
			bigImage.setAttribute("src", bigsrc);
			bigImage.setAttribute("width", width);
			bigImage.setAttribute("height", height);
			bigImage.setAttribute("style", "background: white url(/images/wait2.gif) 50% 50% no-repeat;");
			imageDiv.replaceChild(bigImage, smallImage);
		}
	}

	//tipobj.onclick=hide_info;
}


function tooltip5(number,el) {
	tipobj=d.getElementById('mess');
	tipobjtxt=d.getElementById('tooltiptext');
	initmess(d.getElementById(number).innerHTML);
	tipobj.style.width = '1040px';

	cleanWhitespace(tipobj); //Удаляет пробельные childNodes

	lottext=tipobj.childNodes[9];
	lottext.style.cssText = "background-color:white;"
	lottext.childNodes[1].className= "shop-descrN" //описание
	//lottext.childNodes[1].childNodes[0].style.dispalay="none";
	lottext.childNodes[1].childNodes[0].innerHTML=""
	lottext.childNodes[1].childNodes[1].style.cssText="dispalay:block;";


	lottext.childNodes[1].lastChild.style.cssText="dispalay:block;";  //дополн. описание

	lottext.childNodes[1].style.cssText= "width:700px; padding:10px; text-align:justify; float:left; background-color:white; " //описание
	lottext.childNodes[2].className= "shop-priceN" //цена
	lottext.childNodes[2].childNodes[0].style.cssText= "padding:10px;" //цена
	lottext.childNodes[2].childNodes[0].style.display="none" //"описание в каталоге"

	lottext.childNodes[2].childNodes[1].className = "shop-priceS"
	lottext.childNodes[2].childNodes[1].childNodes[0].childNodes[1].id = "xxx"// в корзину
	lottext.childNodes[2].childNodes[1].childNodes[0].childNodes[1].style.cssText="display:block;"

	lottext.childNodes[2].childNodes[1].style.cssText= "padding:0 5px 5px 0;"

	lottext.childNodes[3].style.cssText="clear:both; display:block;";

	imageDiv=lottext.childNodes[0];
	imageDiv.onclick = ""
	imageDiv.style.cssText = "float:none; width:990px;"
	imageDiv.onclick = ""
	imageDiv.title = ""

	var re = new RegExp('shop');
	if (!tipobj.ownerDocument.URL.match(re)) {
		var divElement = document.createElement("div");
		divElement.innerHTML="Для оформления заказа перейдите в раздел <a href='/shops.shtml'>&laquo;Магазин&raquo</a> нашего сайта";
		lottext.appendChild(divElement);
	}

	op = 0.1;  
	tipobj.style.opacity = op;
	tipobj.style.visibility="visible";
	winwidth=ie? ietruebody().clientWidth : window.innerWidth-20
	myleft = (winwidth-1040)/2;
	tipobj.style.left=(myleft>0)?myleft+"px":0;
	var mytop=ie ? ietruebody().scrollTop : window.scrollY;
	tipobj.style.top= mytop +"px"
	appear();

	if (imageDiv.hasChildNodes()) {
		for( i=0; i<imageDiv.childNodes.length; i++) {
			var smallImage=imageDiv.childNodes[i];
			var height = smallImage.getAttribute("hb");
			var width = smallImage.getAttribute("wb");
			var bigsrc= smallImage.src.replace(/newsmimabs/, "newbgimabs");
			var bigImage = document.createElement("img");
			bigImage.setAttribute("src", bigsrc);
			bigImage.setAttribute("width", width);
			bigImage.setAttribute("height", height);
			bigImage.setAttribute("style", "background: white url(/images/wait2.gif) 50% 50% no-repeat;");
			imageDiv.replaceChild(bigImage, smallImage);
		}
	}

	tipobj.onclick=hide_info;
}




function tooltip4(number, au, el) {
	tipobj=d.getElementById('mess');




	tipobjtxt=d.getElementById('tooltiptext');


	
	initmess(d.getElementById('l'+number).innerHTML);
	tipobj.style.width = '800px';

	tipobj.innerHTML = tipobj.innerHTML.replace (/class="literatura"/g, "")
	if (isiOS) {	tipobj.style.setProperty("-webkit-user-select", "none") }
	tipobj.innerHTML+='<div id="ttclose" style="position:absolute; top:18px; right:18px; width:20px; height:20px; background: url(/images/close.gif) #f1e4d2; cursor:pointer"></div>';
	d.getElementById("ttclose").onclick=hide_info;

//	cleanWhitespace(tipobj); //Удаляет пробельные childNodes
	tipobj.getElementsByClassName("tooltiptext")[0].style.cssText = "background-color:white;"
	tipobj.getElementsByClassName("au-lotN")[0].style.cssText ="width:100px; margin:0px; padding:5px; border:none " // номер лота

//	tipobj.getElementsByClassName("shop-descrN")[0].style.cssText= "width:500px; padding:10px; text-align:justify; float:left; *float:none;" //описание
	tipobj.getElementsByClassName("shop-descrN")[0].style.cssText= "width:500px; padding:10px; text-align:justify; float:left;" //описание

	tipobj.getElementsByClassName("shop-priceN")[0].style.cssText= "padding:0px; float:left; margin:10px 0 0 10px" //цена
	tipobj.getElementsByClassName("shop-catalogN")[0].style.display="none" //"описание в каталоге"
	tipobj.getElementsByClassName("shop-bid")[0].style.display='none' //заочные торги
	imageDiv=tipobj.getElementsByClassName("shop-picN")[0];
	imageDiv.onclick = ""
	imageDiv.style.cssText = "float:none; width:760px;"

	op = 0.1;  
	tipobj.style.opacity = op;
	tipobj.style.visibility="visible";
	winwidth=ie? ietruebody().clientWidth : window.innerWidth-20
	myleft = (winwidth-800)/2;
	tipobj.style.left=(myleft>0)?myleft+"px":0;
	mytop=ie? ietruebody().scrollTop:window.scrollY;
	tipobj.style.top= mytop +"px"
	appear();

	if (imageDiv.hasChildNodes()) {
		for( i=0; i<imageDiv.childNodes.length; i++) {
			var smallImage=imageDiv.childNodes[i];
			if (smallImage.width >100) {
				myWidth=401;
				myHeight=251;
				myZoomify="ZoomRV3H.swf";
			} else {
				myWidth=326;
				myHeight=301;
				myZoomify="ZoomRV3.swf";
			}
			var bigImage = document.createElement("span");
			var bigsrc;
			if (isiOS) {
				bigsrc= smallImage.src.replace(/auct-lo/, "mdimauctabs"+au);
				bigImage.innerHTML='<img style="width:326px; -webkit-touch-callout:none" src="'+bigsrc+'"  25>';
			} else {
				bigsrc= smallImage.src.replace(/auct-lo/, "bgimauctabs"+au);
				

				bigsrc=bigsrc.replace(/.jpg/, ""); 
				bigImage.innerHTML='<OBJECT style=" width:'+myWidth+'px; height:'+myHeight+'px;" CLASSID="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" CODEBASE="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" ID="Lot"> \
				<PARAM NAME="FlashVars" VALUE="zoomifyImagePath='+ bigsrc + '&zoomifyNavigatorVisible=true&zoomifyInitialRotation=0&zoomifyToolbarLogo=0&zoomifyNavigatorWidth=40&zoomifyNavigatorHeight=40&zoomifyNavigatorX=0"> \
				<PARAM NAME="BGCOLOR" VALUE="#ffffff"> \
               			<PARAM NAME="MENU" VALUE="false"> \
				<param name="allowFullScreen" value="false" /> \
				<PARAM NAME="SRC" VALUE="../'+myZoomify+'"> \
				<EMBED  FlashVars="zoomifyImagePath=' + bigsrc + '&zoomifyNavigatorVisible=true&zoomifyToolbarLogo=0&zoomifyNavigatorWidth=40&zoomifyNavigatorHeight=40" SRC="../'+myZoomify+'" BGCOLOR="#ffffff" MENU="false" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"  WIDTH="'+myWidth+'" HEIGHT="'+myHeight+'" NAME="theMovie"></EMBED> \
				</OBJECT>';
			}
			imageDiv.replaceChild(bigImage, smallImage);
		}
	}
}




function tooltip_bid2(page, tipwidth , tipheight) {
	tipwidth=(!tipwidth)?875:tipwidth;
	tipheight=(!tipheight)?800:tipheight;

	tipobj=d.getElementById('mess');
	tipobj.style.width = tipwidth+'px';
	tipobj.style.display = 'block';
	initmess("<iframe id=\"bidframe\" style=\"background-color:white; width:"+(tipwidth-55)+"px; height:"+tipheight+"px; padding:5px; margin-top:20px\" src=\"cgi-bin2/" + page +"\"></iframe>");
	tipobj.innerHTML+='<div id="ttclose" style="position:absolute; top:18px; right:18px; width:20px; height:20px; background: url(/images/close.gif); cursor:pointer;"></div>';
	d.getElementById("ttclose").onclick=hide_info;

	op = 0.1;  
	tipobj.style.opacity = op;
	tipobj.style.visibility="visible";
	winwidth=ie? ietruebody().clientWidth : window.innerWidth-20
	myleft = (winwidth-tipwidth+5)/2;
	tipobj.style.left=(myleft>0)?myleft+"px":0;
	mytop=ie? ietruebody().scrollTop:window.scrollY;
	tipobj.style.top= mytop +"px"
	appear();

//	tipobj.onclick=hide_info;
}


function hide_info() {
	d.getElementById('mess').style.visibility='hidden';
}

function ietruebody(){
	return (d.compatMode && d.compatMode!="BackCompat")? d.documentElement : d.body
}


function appear() {
	if(op < 1) {
		op += 0.1;
		tipobj.style.opacity = op;
		t = setTimeout('appear()', 30);
	}
}

function disappear() {
	if(op > 0) {
		op -= 0.1;
		tipobj.style.opacity = op;
		t = setTimeout('disappear()', 10);
	} else {
		d.getElementById('mess').style.visibility='hidden';
	}
}




function myMark() { //подсветка терминов

	//myHTML=document.body.innerHTML;
	myHTML=	document.getElementById('zapisi').innerHTML;
	mySearch = "";
	for (var key in arr) { 
		mySearch += "(" + key + ")|"
	}
	mySearch ="(" + mySearch + "(ZZZZZ))";

	reg=new RegExp(mySearch, "g");
	myHTML=myHTML.replace(reg, "<span class='literatura' onclick=\"tooltip(this, '$1', 1);\">$1</span>");
	reg=/>по ((Ильину)|(Петрову))/g;
	myHTML=myHTML.replace(reg, ">по&nbsp;$1");
	reg=/>((Петров,)|(Кац,)|(Рылов,)|(Широков,)|(Золотарев,)) ((Федорин#)|(Малышев#)|(Соболин)|(Золотарев,)|(Сорокин#))/g;
	myHTML=myHTML.replace(reg, ">$1&nbsp;$8");
	reg=/>(Малышев) (и) (др.#)/g;
	myHTML=myHTML.replace(reg, ">$1&nbsp;$2&nbsp;$3");

	document.getElementById('zapisi').innerHTML=myHTML;
	//document.body.innerHTML=myHTML;
}


function myMarkSearch() { // подсветка поиска
	if (document.form.descr.value!=''){
		searchTxt=document.form.descr.value;
		myHTML=d.getElementById('zapisi').innerHTML;
		reg = /REGEXP:/i;
		if (searchTxt.match(reg)) {
			searchTxt=searchTxt.replace(reg,"");
		} else {
			reg=/([\.\+\[\$\(\)\|\^\\])/g;
			searchTxt=searchTxt.replace(reg,"\\$1");
			reg=/(['"])/g;
			searchTxt=searchTxt.replace(reg,"");
			reg=/\?/g;
			searchTxt=searchTxt.replace(reg,".");
			reg=/\*/g;
			searchTxt=searchTxt.replace(reg,".*?");
		}
		searchTxt=searchTxt.replace(/(^\s+)|(\s+$)/g,"");

		if (searchTxt!='') {
			reg=new RegExp("("+ searchTxt + ")", "gi");
			myHTML=myHTML.replace(reg,"<span class='searchresult'>$1</span>");
			d.getElementById('zapisi').innerHTML=myHTML;
		}
	};
}
