	// var ActiveMMenuItem = 1;
	var ActiveSMenuItem = 1;
	var sRateImgPath = '/img/stars/';

function GoTo(A){
  var title = document.title;
  var Where = A.href;
  if (Where == null || Where == '') {
    return true;
  } else {
  document.location.replace(Where);
  document.title = title;
  return false; }
}  // Go

function GoTop(){
  scrollTo(0,0);
  return false;
}  // GoTop

function WindowOpen(HREF,width,height) {
  window.open(HREF,null,'toolbar=0, location=0, menubar=0, status=1, directories=0, resizable=0, width=' + width + ', height=' + height);
} // WindowOpen

function WindowOpen2(HREF,width,height) {
  window.open(HREF,null,'toolbar=0, location=0, menubar=0, status=1, directories=0, resizable=1, width=' + width + ', height=' + height);
} // WindowOpen

function AddOption(oSelect, sValue, sText) {

	var oOption = document.createElement("OPTION");
	oSelect.options.add(oOption);
	oOption.text = sText;
	oOption.value = sValue;
} // AddOption

function UpdateList(oSelect, oInput) {
	oInput.value = GetOptionsList(oSelect);
} // UpdateList

function GetOptionsList(oSelect, sSep) {
	if ((sSep == null)) sSep = ',';
	iLength = oSelect.options.length;
	S = '';
	for (i=0; i<iLength; i++) {
		S = S + oSelect.options[i].value;
		if (i+1 < iLength) S = S + sSep;
	}
	return S;
} // UpdateList

function RemoveOption(oSelect, iIndex) {
  if (iIndex <= oSelect.options.length && iIndex >=0) oSelect.remove(iIndex);
} // RemoveOption

function RemoveAllOptions(oSelect) {
  oSelect.options.length = 0;
} // RemoveAllOptions

function CopyOption(oSrc, oDest) {
  var oOption = oSrc.options[oSrc.selectedIndex];
	
	if (typeof(oOption) == 'object') AddOption(oDest, oOption.value, oOption.text);
} // CopyOption

function SaveOption(oSelect, iIndex, sValue, sText) {
  oSelect.options[iIndex].value = sValue;
	oSelect.options[iIndex].innerText = sText;
} // SaveOption

function MakePlayerReference(oSelect) {
	var PlayerName = oSelect.options[oSelect.selectedIndex].innerText;
	var PlayerID = oSelect.options[oSelect.selectedIndex].value;
	var Ref = '<a href=/_players/?id=' + PlayerID + ' title=\'' + PlayerName + ' - досье\'>' + PlayerName + '</a>';
	window.clipboardData.setData("Text", Ref);
} // MakeReference	

function MakeGlossaryReference(oSelect, oTextarea) {
	var Term = oSelect.options[oSelect.selectedIndex].innerHTML;
	var TermID = oSelect.options[oSelect.selectedIndex].value;
	var Ref = '<a href=/_misc/glossary.php?language_id=1#a' + TermID + '>' + Term.toLowerCase() + '</a>';
	oTextarea.innerHTML = oTextarea.innerHTML + Ref;
	// alert(oTextarea.innerHTML);
	// window.clipboardData.setData("Text", Ref);
} // MakeReference	

function AddToBasket(GoodID) {
  sName = 'ishop_' + GoodID;
	basket=window.open('/_shop/basket.php?GoodID=' + GoodID,'basket','width=700,height=400,scrollbars=yes,resizable=yes,copyhistory=no');
	basket.focus();
} // AddToBasket

function SeybertsOrder() {
  var GoodID = '81';
  sName = 'ishop_' + GoodID;
	basket=window.open('/_shop/seyberts-order.php?GoodID=' + GoodID,'basket','width=700,height=400,scrollbars=yes,resizable=yes,copyhistory=no');
	basket.focus();
	return false;
} // AddToBasket

function isEmail(email) {
	if (email.indexOf('@') == -1 || email.indexOf('.') == -1 || email.indexOf('href') != -1) return false; else return true;
} // isEmail

function Empty(s) {
	var re = /[\s,\r,\n,\t]/g;
	if (s.replace(re, '') != '' && s != 0) return false; else return true;
} // Empty

function confirmDelete(msg) {
	if (msg==null) msg = 'Удалить запись';
	window.event.returnValue = confirm(msg);
} // confirmDelete

function rate(oInput, oImg, Rate, Mode) {
	switch (Mode) {
		case 1 : oInput.value = Rate;	break;
		case 2 : Rate = oInput.value;	break;
	}
	oImg.src = sRateImgPath + Rate*2 + '.gif';
}

function rate2(oInput, oImg, Rate, Mode) {
	switch (Mode) {
		case 1 : oInput.value = Rate;	break;
		case 2 : Rate = oInput.value;	break;
	}
	oImg.src = sRateImgPath + Rate + '.gif';
}

function Search() {
	var Query = document.getElementById('text').value;
	if (!Empty(Query) && Query != '' && Query != 'Поиск по сайту') document.getElementById('SF').submit();
}

function getXmlHttp(){
  var xmlhttp;
  try {
    xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (e) {
    try {
      xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (E) {
      xmlhttp = false;
    }
  }
  if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
    xmlhttp = new XMLHttpRequest();
  }
  return xmlhttp;
}

function getDOM() {
	// var DOM = new ActiveXObject("Msxml2.DOMDocument.3.0");
	try {
	var DOM = new ActiveXObject("msxml");
	} catch (e) {
		var DOM = document.implementation.createDocument("", "", null);
	}
	
	// var DOM = new ActiveXObject("Microsoft.XMLDOM");
	return DOM; 
}

function setCookie(sName, sValue, iMinutes) {
  document.cookie = sName + "=" + escape(sValue);
  // Expires the cookie in one month
  var date = new Date();
  date.setMinutes(date.getMinutes() + iMinutes);
  document.cookie += ("; expires=" + date.toUTCString()); 
}

function getCookie(sName) {
  // cookies are separated by semicolons
  var aCookie = document.cookie.split("; ");
  for (var i=0; i < aCookie.length; i++) {
    // a name/value pair (a crumb) is separated by an equal sign
    var aCrumb = aCookie[i].split("=");
    if (sName == aCrumb[0]) 
      return unescape(aCrumb[1]);
  }
  // a cookie with the requested name does not exist
  return null;
}

// User agent type definition
agt=navigator.userAgent.toLowerCase();
isDOM=document.getElementById
isKonq=(typeof(navigator.vendor)!="undefined" && navigator.vendor=="KDE")
isOpera=isOpera5=window.opera && isDOM
isOpera6=isOpera && window.print
isOpera7=isOpera && document.readyState
isOpera8=isOpera && window.XMLHttpRequest
isMSIE=document.all && document.all.item && !isOpera
isMSIE5=isDOM && isMSIE
isMSIE6=isDOM && isMSIE && window.ActiveXObject
isNetscape4=document.layers
isNN=isNC=navigator.appName=="Netscape"
isNN4=isNC4=isNN && !isDOM
isMozilla=isDOM && navigator.appName=="Netscape"
isGecko=((window.XMLHttpRequest)&&(!isMSIE6)&&(!isOpera))
isSafari=(agt.indexOf("safari")>-1 || (typeof document.childNodes!="undefined" && typeof document.all=="undefined" && typeof navigator.taintEnabled=="undefined"))
ver='unknown';
if(isKonq)ver='konquerior'
if(isOpera)ver='opera'
if(isOpera6)ver='opera6'
if(isOpera7)ver='opera7'
if(isOpera8)ver='opera8'
if(isMSIE)ver='isMSIE'
if(isMSIE5)ver='isMSIE5'
if(isMSIE6)ver='isMSIE6'
if(isNetscape4)ver='isNetscape4'
if(isNN)ver='isNN'
if(isNN4)ver='isNN4'
if(isMozilla)ver='isMozilla'
if(isGecko)ver='isGecko'
if(isSafari)ver='isSafari'