function right(obj){

	document.getElementById(obj).innerHTML = "&#9658;";
}

function down(obj){
	document.getElementById(obj).innerHTML = "&#9660;";
}

function particle(cnt){

	stopwidth = 130;
	widthstep=15;
	opacitystep=0.2;
	delaytime=20;
	
	current_width = new Array();
	current_opacity = new Array();
	current_display = new Array();
	
	for(i=0; i<=cnt; i++){
		
		current_width[i] = parseInt(document.getElementById('undermenu['+i+']').style.width);
		current_opacity[i] = parseFloat(document.getElementById('undermenu['+i+']').style.opacity);
		current_display[i] = document.getElementById('undermenu['+i+']').style.display;
		switch(umenu[i]){
			case 1:
				if (current_display[i] != "block") {
					document.getElementById('undermenu['+i+']').style.display = "block";
				}
				else if (current_width[i] < stopwidth){
					temp = current_width[i] + widthstep;
					document.getElementById('undermenu['+i+']').style.width = temp+'px';
					
				}
				
				else if(current_opacity[i] < 1){
					//document.getElementById('undermenu['+i+']').style.width = 'auto';
					//document.getElementById('undermenu['+i+']').style.minWidth = stopwidth+'px';
					temp = current_opacity[i] + opacitystep;
					document.getElementById('undermenu['+i+']').style.opacity = temp;
				}
		
			break;
			case -1:
				if(current_opacity[i] > 0){
					temp = current_opacity[i] - opacitystep;
					document.getElementById('undermenu['+i+']').style.opacity = temp;
					
					if(temp <= 0){
						//document.getElementById('undermenu['+i+']').style.width = stopwidth+'px';
						//document.getElementById('undermenu['+i+']').style.minWidth = '0px';
						
					}
				}
				
				else if (current_width[i] > 0){
					
					temp = current_width[i] - widthstep;
					document.getElementById('undermenu['+i+']').style.width = temp+'px';
					
				}
				else if (current_display[i] != "none") {
					document.getElementById('undermenu['+i+']').style.display = "none";
					
				}
			break;
		}
		
	
	}
	setTimeout("particle("+cnt+");", delaytime);
	
	/*widthstep=10;
	opacitystep=0.1;
	delaytimew=0.5;
	delaytimeo=100;
	
	stopwidth = 100;
	
	//getStyleSheet(0).cssRules[1].style.display = 'block';
	
	currentopacity = parseFloat(getStyleSheet(0).cssRules[0].style.opacity);
	currentwidth = parseInt(getStyleSheet(0).cssRules[0].style.width);
	
	if(currentwidth<stopwidth) nextwidth =currentwidth;
	if(currentopacity<1) nextopacity =currentopacity;
	else getStyleSheet(0).cssRules[0].style.opacity=0;
	
	
	if(nextwidth <= stopwidth){
	
		nextw=nextwidth+widthstep;
		getStyleSheet(0).cssRules[0].style.width=nextw+'px';
		
		
		setTimeout("particle("+nextw+", "+nextopacity+");",delaytimew);
	}

	if(nextwidth > stopwidth){
		nexto = nextopacity+opacitystep;
		getStyleSheet(0).cssRules[0].style.opacity=nexto;
		
		if(nexto <1){
			
			
			setTimeout("particle("+nextwidth+", "+nexto+");",delaytimeo);
		}
		
	}*/
	
	
	
	
	
}

function particle1(nextwidth, nextopacity){
	widthstep=10;
	opacitystep=0.1;
	delaytimew=0.5;
	delaytimeo=100;
	
	stopwidth = 100;
	
	//getStyleSheet(0).cssRules[1].style.display = 'block';
	
	currentopacity = parseFloat(getStyleSheet(0).cssRules[0].style.opacity);
	currentwidth = parseInt(getStyleSheet(0).cssRules[0].style.width);
	
	if(currentwidth<stopwidth) nextwidth =currentwidth;
	if(currentopacity<1) nextopacity =currentopacity;
	else getStyleSheet(0).cssRules[0].style.opacity=0;
	
	
	if(nextwidth <= stopwidth){
	
		nextw=nextwidth+widthstep;
		getStyleSheet(0).cssRules[0].style.width=nextw+'px';
		
		
		setTimeout("particle("+nextw+", "+nextopacity+");",delaytimew);
	}

	if(nextwidth > stopwidth){
		nexto = nextopacity+opacitystep;
		getStyleSheet(0).cssRules[0].style.opacity=nexto;
		
		if(nexto <1){
			
			
			setTimeout("particle("+nextwidth+", "+nexto+");",delaytimeo);
		}
		
	}
	
	
	
	
	
}


function getStyleSheet(index)
{
  // Проверяем параметр
  if (typeof index == 'undefined')
    index = 0;
  if (index < 0)
    index = document.styleSheets.length + index;
  if (typeof document.styleSheets == 'undefined' || index < 0
      || index >= document.styleSheets.length)
    return null;

  // Находим стиль
  var style = document.styleSheets[index];

  // Делаем объект совместимыми с W3C DOM2 (для IE)
  return StyleSheet_makeCompatible(style);
}

function StyleSheet_makeCompatible(style)
{
  // Mozilla не даёт доступа к cssRules до загрузки стиля
  try
  {
    style.cssRules;
  }
  catch (e)
  {
    return style;
  }

  // Создаём CSSStyleSheet.cssRules
  if (typeof style.cssRules == 'undefined' && typeof style.rules != 'undefined')
    style.cssRules = style.rules;

  // Создаём CSSStyleSheet.insertRule и CSSStyleSheet.deleteRule
  if (typeof style.insertRule == 'undefined' && typeof style.addRule != 'undefined')
    style.insertRule = StyleSheet_insertRule;
  if (typeof style.deleteRule == 'undefined' && typeof style.removeRule != 'undefined')
    style.deleteRule = style.removeRule;

  // Проверяем, существуют ли все нужные свойства
  if (typeof style.cssRules == 'undefined' || typeof style.insertRule == 'undefined'
      || typeof style.deleteRule == 'undefined')
    return null;
  else
    return style;
}

function StyleSheet_insertRule(rule, index)
{
  // Выделяем селектор и стиль из параметра
  if (rule.match(/^([^{]+)\{(.*)\}\s*$/))
  {
    this.addRule(RegExp.$1, RegExp.$2, index);
    return index;
  }
  throw "Syntax error in CSS rule to be added";
}

function addStyleSheet(url)
{
  // Создаём элемент LINK/STYLE и добавляем в документ
  var style;
  if (typeof url == 'undefined')
  {
    style = document.createElement('style');
  }
  else
  {
    style = document.createElement('link');
    style.rel = 'stylesheet';
    style.type = 'text/css';
    style.href = url;
  }
  document.getElementsByTagName('head')[0].appendChild(style);

  // Находим новый стиль в коллекции styleSheets
  style = document.styleSheets[document.styleSheets.length - 1];

  // Делаем объект совместимыми с W3C DOM2 (для IE)
  return StyleSheet_makeCompatible(style);
}