function CopyClipboard(link)
{
	if (link!="") {
		window.clipboardData.setData('Text', link);
		alert("Ссылка на страницу "+ link + " скопирована в буфер обмена!\nТеперь вы можете с легкостью разместить её в Интернете или послать по почте.");
	}
}

function new_win(page, width, height)
{
	var win = "width="+width+",height="+height+",menubar=no,location=no,resizable=yes,scrollbars=yes";
	newWin = window.open(page,'newWin'+width,win);
	newWin.focus();
}


function ChangeFont(size,obj)
{
rep_str='s_font='+size;
if (document.location.href.indexOf('?')>0)
{
if (document.location.href.indexOf('s_font=')>0)
{
	re = /s_font=\d{1}/;
	str = document.location.href;
	newstr=str.replace(re, rep_str);
	document.getElementById(obj).href=newstr;
}
else
{ document.getElementById(obj).href=document.location.href+'&'+rep_str;}
}
else document.getElementById(obj).href=document.location.href+'?'+rep_str;
}

function reg()
{
alert ("Делать покупки могут только зарегистрированные пользователи.\nВведите свой логин и пароль в окошко, которое находится в левом меню.\nИли пройдите процедуру регистрации, если вы еще не регистрировались на нашем сайте.");

}

function ow(link,pack)
{
if (link!="") {
	var	kolvo = prompt('Введите необходимое количество товара. Товар отгружается коробками. Указывайте количество товаров кратное числу '+pack,pack);
	link = "cart.php?add="+link+"&kolichestvo="+kolvo;

}
else
{
link = "cart.php";

}
	var win = "width=750,height=400,menubar=no,location=no,resizable=yes,scrollbars=yes";

	newWin = window.open(link,'newWin',win);
	newWin.focus();
	if (pack=="print") {newWin.print();}
}


function win(page) {
window.open('good.php?goods_id='+page,'','width=700,height=379,menubar=no,resizable=yes,status=no,tollbar=no,scrollbars=yes');
}

function img(code)
{
   var o=window.document.getElementById("oIframe");
   var picture=window.document.getElementById("kartinka")
   picture.src='i/s.gif';
   picture.width=1;
   picture.height=1;


   //picture.style.visible=false;
   o.style.top=parent.document.body.scrollTop+100 ;
   o.style.left=246 ;
   o.style.display = 'block';
   picture.src='cat/'+code+'.jpg';
   //http://bezant.ru/
   picture.width=300;
   picture.height=300;
   //picture.visible=false;
}
/*

function img(code)
{
var a=navigator.userAgent + navigator.appName;
//if ((a.indexOf("Opera") == -1) && (a.indexOf("Gecko") == -1))  { window.frames["trans"].document.write('Загрузка изображения.......');}
        var o=window.top.document.getElementById("oIframe");
        //alert("");
        o.style.top=parent.document.body.scrollTop+100 ;
        o.style.left=246 ;
        o.style.display = 'block';
        o.src='img_cat.php?img='+code;
}

*/

/*подсветка строк таблицы при наведении мышки*/
function tableRuler() {
if (document.getElementById) {
tables = document.getElementsByTagName('table')
for (i=0;i<tables.length;i++) {
if (tables[i].className == 'tab1') {
trs = tables[i].getElementsByTagName('tr')
for (j=0;j<trs.length;j++) {
if (trs[j].className != 't22') {
trs[j].onmouseover = function() { this.className = 'line'; return false }
trs[j].onmouseout = function() { this.className = ''; return false }
} } } } }
}

/*
function proverka_mf(){
//	if (document.mf.avtor.value=="") {alert("Представьтесь пожалуйста!"); return false;}
	if (document.mf.otziv.value=="") {alert("Вы не написали отзыв\nНапишите хоть пару слов :)"); return false;}
	else{return true;}
}

function img_resize(x, size)
{
window.document.getElementById(x).style.width='auto';
window.document.getElementById(x).style.height='auto';
if (window.document.getElementById(x).width>size) {window.document.getElementById(x).style.width=size;}
if (window.document.getElementById(x).height>400) {window.document.getElementById(x).style.width=400;}
}

function img_error(x)
{
window.document.getElementById(x).src='../i/ico_shkola.gif';
window.document.getElementById(x).style.border='0px solid black';
}

*/

window.onerror = null;
var tooltip_attr_name = "tooltip";
var tooltip_blank_text = "(откроется в новом окне)"; // текст для ссылок с target="_blank"
var tooltip_newline_entity = "  "; // укажите пустую строку (""), если не хотите использовать в tooltip'ах многострочность; ежели хотите, то укажите тот символ или символы, которые будут заменяться на перевод строки
var tooltip_max_width = 300; // максимальная ширина tooltip'а в пикселах; обнулите это значение, если ширина должна быть нелимитирована

window.onload = function(e){
	if (document.createElement) tooltip.d();
}

tooltip = {
	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");
		tooltip.t.style.filter = "alpha(opacity=85)"; // buggy in ie5.0
		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].tagName == "A" || a[i].tagName == "BUTTON" || (a[i].tagName == "INPUT" && (a[i].type == "submit" || a[i].type == "button" || a[i].type == "reset"))) a[i].onclick = self.focus;

			if (!a[i]) continue;

			tooltip_title = a[i].getAttribute("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.currentTarget;
		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.t.innerText = s;
		}
		tooltip.c = setTimeout("tooltip.t.style.visibility = 'visible';", 500);
		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); // was true--Opera7b workaround!
		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 = window.innerWidth ? window.innerWidth + window.pageXOffset : oCanvas.clientWidth + oCanvas.scrollLeft;
		w_height = window.innerHeight ? window.innerHeight + window.pageYOffset : oCanvas.clientHeight + oCanvas.scrollTop;

		tooltip.t.style.width = "auto";

		t_width = window.event ? tooltip.t.clientWidth : tooltip.t.offsetWidth;
		t_height = window.event ? tooltip.t.clientHeight : tooltip.t.offsetHeight;

		if ((tooltip_max_width) && (t_width > tooltip_max_width)){
			tooltip.t.style.width = tooltip_max_width + "px";
			t_width = window.event ? tooltip.t.clientWidth : tooltip.t.offsetWidth;
		}

		t_extra_width = 7; // CSS padding + borderWidth;
		t_extra_height = 5; // CSS padding + borderWidth;

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

		while (x + t_width + t_extra_width > w_width){
			--x;
			tooltip.t.style.left = x + "px";
			t_width = window.event ? tooltip.t.clientWidth : tooltip.t.offsetWidth;
		}

		while (y + t_height + t_extra_height > w_height){
			--y;
			tooltip.t.style.top = y + "px";
			t_height = window.event ? tooltip.t.clientHeight : tooltip.t.offsetHeight;
		}
	}
}

// mail silent
function email (login, sc)
{
 	var serv = new Array;
	serv[0] = "bezant.ru";
	serv[1] = "spb.bezant.ru";
	serv[2] = "kemerovo.bezant.ru";
	serv[3] = "saratov.bezant.ru";
	eml = login +  "@" + serv[sc];
	return eml;

	eml = login +  "@" + sc;
	return eml;
}

function my (login, sc)
{
document.write (email(login, sc));
}

function nm (login, sc, sub)
{
eml = "mailto:" + email(login, sc);
if (sub != "") eml += "?subject=" + sub;
window.location.href = eml;
}
// end mail silent