<!--

// РАСКРЫВАЮЩЕЕСЯ МЕНЮ
/* ================================================================ 
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);


/* вертикальное меню */
navHover = function() {
        var lis = document.getElementById("navV").getElementsByTagName("LI");
        for (var i=0; i<lis.length; i++) {
                lis[i].onmouseover=function() {
                        this.className+=" iehover";
                }
                lis[i].onmouseout=function() {
                        this.className=this.className.replace(new RegExp(" iehover\\b"), "");
                }
        }
}
if (window.attachEvent) window.attachEvent("onload", navHover);


// 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>');
}


// 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;
}


/* CAPTCHA PROCESSFORM
with prototype.js
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;
 }
*/


// 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("menuV").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("menuV").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";
		}
	}
}


// ADD BOOKMARK

function addBookmark(url, title)
{
 if (!url) url = location.href;
 if (!title) title = "RUSSCO - профессиональное общество онкологов-химиотерапевтов";
 
 //Gecko
 if ((typeof window.sidebar == "object") && (typeof window.sidebar.addPanel == "function")) window.sidebar.addPanel (title, url, "");
 //IE4+
 else if (typeof window.external == "object") window.external.AddFavorite(url, title);
 //Opera7+
 else if (window.opera && document.createElement)
 {
   var a = document.createElement('A');
   if (!a) return false; //IF Opera 6
   a.setAttribute('rel','sidebar');
   a.setAttribute('href',url);
   a.setAttribute('title',title);
   a.click();
 }
 else return false;
 
 return true;
}


// ДОБАВЛЕНИЕ СОБЫТИЯ
// Например, обработка нескольких функций при загрузке окна: addEvent(window,'load',function1,false)
function addEvent(elm, evType, fn, useCapture) 
{
        if (elm.addEventListener) {
			elm.addEventListener(evType, fn, useCapture);
			return true;
        }
        else if (elm.attachEvent) {
			var r = elm.attachEvent('on' + evType, fn);
			return r;
        }
        else {
            elm['on' + evType] = fn;
        }
}


/*
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
*/


// PRELOADIMAGES

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


// HTTPREQUEST

/*
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 createHttpRequest()
{
	  var httpRequest;
	  try {
	    httpRequest = new ActiveXObject("Msxml2.XMLHTTP");
	  } catch (e) {
	    try {
	      httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
	    } catch (E) {
	      httpRequest = false;
	    }
	  }
	  if (!httpRequest && typeof XMLHttpRequest!='undefined') {
	    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 = ''; 



// 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();
}

//-->
