var LogoType = get_cookie('LogoType');
if(!LogoType)
LogoType = 'flash'; // Тип логотипа  по умолчанию

// Функция вызывается при загрузке страницы
function Logo()
{                            
	if(window.LogoType=='flash')
		LogoSet('flash');
	else
		LogoSet('img');	
}

// Изменяет тип логотипа
function LogoSwitch()
{
	if(window.LogoType=='flash')
	{
		LogoSet('img');	
	}
	else
	{
		LogoSet('flash');
	}

}

// Устанавливает переданный тип логотипа (img или flash)
function LogoSet(type)
{
	//alert('LogoSwitch('+type+')');

	var logobox=document.getElementById('logobox');
	
	if(type=='img')
	{  
		logobox.innerHTML='<img src="/tpl/img/kedrdayfull1.jpg" style="width:100%;" />';
		set_cookie('LogoType', 'img');
		window.LogoType='img';
		
	}
	else if(type=='flash')
	{
		//logobox.innerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0/#version=9,0,28,0/" width="100%" height="403" id="topflash"><param name="movie" value="/tpl/swf/kp13.swf" /><param name="quality" value="high" /><embed src="/tpl/swf/kp13.swf" quality="high" bgcolor="#628541" width="100%" height="403" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"/></object>';
		logobox.innerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'
                        + '        codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0/#version=9,0,28,0/"'
                        + '        width="100%" height="403" id="topflash">'
                        + '<param name="movie" value="/tpl/swf/finalnew14.swf" />'
                        + '<param name="quality" value="high" />'
                        + '<param name="wmode" value="transparent" />'
                        + '<embed src="/tpl/swf/finalnew14.swf" quality="high" bgcolor="#628541" width="100%" height="403" '
                        + '       wmode="transparent"'
                        + '       type="application/x-shockwave-flash"'
                        + '       pluginspage="http://www.macromedia.com/go/getflashplayer"/></object>';
		set_cookie('LogoType', 'flash');
		window.LogoType='flash';	
	}
}



  var currentUl;

		function Ulopen(UlElement) {
			UlElement.style.display = "block";
			window.currentUl = UlElement;
		}
		
		function Ulclose(UlElement) {
			UlElement.style.display = "none";
			window.currentUl = null;
		}			

		function toggle(UlID)
		{
			if(UlID==0 && window.currentUl != null)
			{	
				set_cookie("activeUl", 0);
			}
			var UlElement = document.getElementById(UlID);
			if (UlElement)
			{
				if(window.currentUl != null) Ulclose(currentUl);
				Ulopen(UlElement);
				
				set_cookie("activeUl", UlID);
				//alert('set '+ID);
			}
 			
 		}



function set_cookie(name, value) {
      var valueEscaped = escape(value);
      var expiresDate = new Date();
      expiresDate.setTime(expiresDate.getTime() + 365 * 24 * 60 * 60 * 1000); // срок - 1 год
      var expires = expiresDate.toGMTString();
      var newCookie = name + "=" + valueEscaped + "; path=/; expires=" + expires;
      if (valueEscaped.length <= 4000) document.cookie = newCookie + ";";
} 

function get_cookie(name) {
      var prefix = name + "=";
      var cookieStartIndex = document.cookie.indexOf(prefix);
      if (cookieStartIndex == -1) return null;
      var cookieEndIndex = document.cookie.indexOf(";", cookieStartIndex + prefix.length);
      if (cookieEndIndex == -1) cookieEndIndex = document.cookie.length;
      return unescape(document.cookie.substring(cookieStartIndex + prefix.length, cookieEndIndex));
}				

