<!--


// РАСКРЫВАЮЩЕЕСЯ МЕНЮ
/* ================================================================ 
This copyright notice must be kept untouched in the stylesheet at all times.
The original version of this script and the associated (x)html is available at http://www.stunicholls.com/menu/pro_drop_1.html
Copyright (c) 2005-2007 Stu Nicholls. All rights reserved. This script and the associated (x)html may be modified in any way to fit your requirements.
=================================================================== */
stuHover = function() {
	var cssRule;
	var newSelector;
	for (var i = 0; i < document.styleSheets.length; i++)
		for (var x = 0; x < document.styleSheets[i].rules.length ; x++)
			{
			cssRule = document.styleSheets[i].rules[x];
			if (cssRule.selectorText.indexOf("LI:hover") != -1)
			{
				 newSelector = cssRule.selectorText.replace(/LI:hover/gi, "LI.iehover");
				document.styleSheets[i].addRule(newSelector , cssRule.style.cssText);
			}
		}
	var getElm = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<getElm.length; i++) {
		getElm[i].onmouseover=function() {
			this.className+=" iehover";
		}
		getElm[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" iehover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", stuHover);


// CAPTCHA

function processForm()
  {
    $('submit').disabled = true;
    $('submit').value = "Проверка, подождите...";

    $('mailform').request({
      onSuccess: function(transport)
      {
        if(transport.responseText.match(/^OK/) != null) {
          alert('Ваше сообщение отправлено!');
          $('mailform').reset();
        } else {
          alert(transport.responseText);
        }

        $('submit').value = 'Отправить';
        $('submit').disabled = false;
      }
    });

    return false;
  }


// AddFavorite

function getBrowserInfo() {
 var t,v = undefined;
 if (window.opera) t = 'Opera';
 else if (document.all) {
  t = 'IE';
  var nv = navigator.appVersion;
  var s = nv.indexOf('MSIE')+5;
  v = nv.substring(s,s+1);
 }
 else if (navigator.appName) t = 'Netscape';
 return {type:t,version:v};
}
 
function bookmark(a){
 var url = window.document.location;
 var title = window.document.title;
 var b = getBrowserInfo();
 if (b.type == 'IE' && 9 > b.version && b.version >= 4) window.external.AddFavorite(url,title);
 else if (b.type == 'Opera') {
  a.href = url;
  a.rel = "sidebar";
  a.title = url+','+title;
  return true;
 }
 else if (b.type == "Netscape") window.sidebar.addPanel(title,url,"");
 else alert("Нажмите CTRL-D, чтобы добавить страницу в закладки");
 return false;
}


// BLOCKERROR

function blockError(){return true;}
window.onerror = blockError;


// SHOWMAIL

function ShowMail(user, domain1, domain2, subj) {
	var email = user+'&#64;'+domain1+'&#46;'+domain2;
	if (ShowMail.arguments[3]) name = ShowMail.arguments[3];
	else name = email;
	var subj = ShowMail.arguments[4];
	document.writeln('<a href="mailto:'+email+'?subject='+subj+'">'+name+'</a>');

/*function ShowMail(user, domain1, domain2) {
	var email = user+'&#64;'+domain1+'&#46;'+domain2;
	if (ShowMail.arguments[3]) name = ShowMail.arguments[3];
	else name = email;
	document.writeln('<a href="mailto:'+email+'">'+name+'</a>');*/

}


//SHOWHIDE

function ShowHide(obj)
{
	var el = document.getElementById(obj);

    if (el.style.display == 'block')
        el.style.display = 'none';
    else
        el.style.display = 'block';
}


// CHECKFORM

function repl(val) {
var find=val.value.match(/[^0-9()-_+]/g);
if (find!=null) {
val.value = val.value.replace(/[^0-9()-_+]/g, '');
}
}

function CheckForm(obj, elems) 
	{
	var element, pattern;
	for (var i = 0; i < obj.elements.length; i++)
		{
		element = obj.elements[i];
	 if (elems != undefined)
 if (elems.join().indexOf(element.type) < 0) continue;
 if (!element.getAttribute("check_message")) continue;
 if (pattern = element.getAttribute("check_pattern"))
 	{
	 pattern = new RegExp(pattern, "g");
	 if (!pattern.test(element.value))
  	{
 alert(element.getAttribute("check_message"));
 element.focus();
 return false;
 }
	}
 else if(/^\s*$/.test(element.value))
 {
 alert(element.getAttribute("check_message"));
 element.focus();
 return false;
 }
	}
 return true;
}


// SWITCH STYLE

function ButStl(id) 
{ 
var div_name="eve"; 
as=document.getElementsByTagName('a'); 
for(i=1;i<=as.length;i++)
	{ 
	if(i==id)
	document.getElementById(div_name+i).style.color='#000', document.getElementById(div_name+i).style.padding='3 10 4 10'; 
	else
	document.getElementById(div_name+i).style.color='#999', document.getElementById(div_name+i).style.padding='3 10 3 10';
	} 
} 

// SUBNEWS

function subp(postid) {
whichpost = document.getElementById(postid);
if (whichpost.className=="comments") {whichpost.className="commenth";}
else {whichpost.className="comments";}
}


// SWITCH SUBMENU

var persistmenu="yes" //"yes" or "no". Make sure each SPAN content contains an incrementing ID starting at 1 (id="sub1", id="sub2", etc)
var persisttype="sitewide" //enter "sitewide" for menu to persist across site, "local" for this page only

if (document.getElementById){ // change
document.write('<style type="text/css">\n')
document.write('.submenu{display: none;}\n')
document.write('</style>\n')
}

function SwitchMenu(obj){
	if(document.getElementById){
	var el = document.getElementById(obj);
	var ar = document.getElementById("content-l-nav").getElementsByTagName("ul"); // change
		if(el.style.display != "block"){ // change
			for (var i=0; i<ar.length; i++){
				if (ar[i].className=="submenu") // change
				ar[i].style.display = "none";
			}
			el.style.display = "block";
		}else{
			el.style.display = "none";
		}
	}
}

function SwitchSubMenu(obj){
	if(document.getElementById){
	var el = document.getElementById(obj);
	var ar = document.getElementById("content-l-nav").getElementsByTagName("span"); // change
		if(el.style.display != "block"){ // change
			for (var i=0; i<ar.length; i++){
				if (ar[i].className=="submenu") // change
				ar[i].style.display = "none";
			}
			el.style.display = "block";
		}else{
			el.style.display = "none";
		}
	}
}


function get_cookie(Name) { 
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) { 
offset += search.length
end = document.cookie.indexOf(";", offset);
if (end == -1) end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}

function onloadfunction(){
if (persistmenu=="yes"){
var cookiename=(persisttype=="sitewide")? "switchmenu" : window.location.pathname
var cookievalue=get_cookie(cookiename)
if (cookievalue!="")
document.getElementById(cookievalue).style.display="block"
}
}

function savemenustate(){
var inc=1, blockid=""
while (document.getElementById("sub"+inc)){
if (document.getElementById("sub"+inc).style.display=="block"){
blockid="sub"+inc
break
}
inc++
}
var cookiename=(persisttype=="sitewide")? "switchmenu" : window.location.pathname
var cookievalue=(persisttype=="sitewide")? blockid+";path=/" : blockid
document.cookie=cookiename+"="+cookievalue
}

if (window.addEventListener)
window.addEventListener("load", onloadfunction, false)
else if (window.attachEvent)
window.attachEvent("onload", onloadfunction)
else if (document.getElementById)
window.onload=onloadfunction

if (persistmenu=="yes" && document.getElementById)
window.onunload=savemenustate

// INFO CHANGE

function showInv1() {
	if (document.getElementById) {
		document.getElementById('inv-tab-l-a').style.color = '#000000';
		document.getElementById('inv-tab-r-a').style.color = '#cc3300';
		document.getElementById('inv-tab-l-p').style.borderTop = '4px solid #e44c16';
		document.getElementById('inv-tab-l-p').style.background = '#f8f6f5';
		document.getElementById('inv-tab-r-p').style.borderTop = '4px solid #c1b5aa';
		document.getElementById('inv-tab-r-p').style.background = '#ffffff';
		document.getElementById('inv-info1').style.display = 'block';
		document.getElementById('inv-info2').style.display = 'none';
		document.getElementById('inv-info1').style.background = '#f8f6f5';
	}
}

function showInv2() {
	if (document.getElementById) {
		document.getElementById('inv-tab-l-a').style.color = '#cc3300';
		document.getElementById('inv-tab-r-a').style.color = '#000000';
		document.getElementById('inv-tab-l-p').style.borderTop = '4px solid #c1b5aa';
		document.getElementById('inv-tab-l-p').style.background = '#ffffff';
		document.getElementById('inv-tab-r-p').style.borderTop = '4px solid #e44c16';
		document.getElementById('inv-tab-r-p').style.background = '#f8f6f5';
		document.getElementById('inv-info1').style.display = 'none';
		document.getElementById('inv-info2').style.display = 'block';
		document.getElementById('inv-info2').style.background = '#f8f6f5';
	}
}


// dropdown select location change
function sel(Url) {
	if (Url) {
 	window.open(Url,"_blank");
 }
}

// OPEN A POPUP WINDOW
function openwin(url,w,h,s) {
 var scrl;
	if (s) { scrl="scrollbars=yes,"; w = w+16; }
	else { scrl="scrollbars=no,"; }

	if (!w) w = 640;
	if (!h) h = 480;

	fenster = window.open(url,"_blank",scrl+"resizable=yes,width="+w+",height="+h+",screenX=50,screenY=50,top=25,left=25");
	fenster.focus();
}


/* AJAX */

function createHttpRequest() {
var httpRequest;
var browser = navigator.appName;

if (browser == "Microsoft Internet Explorer") {
httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
} else {
httpRequest = new XMLHttpRequest();
}

return httpRequest;
}

function sendRequest(file, _resultId, getRequestProc) {
resultId = _resultId;
document.getElementById(resultId).innerHTML = 'Подождите, идет загрузка...';
httpRequest.open('get', file);
httpRequest.onreadystatechange = getRequestProc;
httpRequest.send(null);
} 

function getRequest() {
if (httpRequest.readyState == 4) {
document.getElementById(resultId).innerHTML = httpRequest.responseText;
}
} 

var httpRequest = createHttpRequest();
var resultId = ''; 

//-->