$(window).load()
$(document).ready(function()
				{
			mystart()
				$(".example3").click(function()
						{
					h=$(this).attr("h")
					w=$(this).attr("w")
					href=$(this).attr("src")
					var popup_left= (window.screen.width/2)-w/2;
					var popup_top  = (window.screen.height/2) - h/2-50;
					var par='toolbar=0,location=0,status=0,menubar=0,scrollbars=0,resizable=no,width=' + w + 'px , height=' + h + "px , left=" + popup_left + ",top=" + popup_top + ",screenX=" + popup_left + ",screenY=" + popup_top
					 window.open( href, '', par);
					
					
						});
			$(".example1").click(function()
					{
				var h=$(this).attr("h")*1+50
				var w=$(this).attr("w")*1+30
				href=$(this).attr("src")
				var maxh=window.screen.height
				if(h>maxh)
				{
					h=maxh*0.8
				}
				var popup_left= (window.screen.width/2)-w/2;
				var popup_top  = (window.screen.height/2) - h/2-50;
				var par='toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=yes,width=' + w + 'px , height=' + h + "px , left=" + popup_left + ",top=" + popup_top + ",screenX=" + popup_left + ",screenY=" + popup_top
				 window.open( href, '', par);
					
					});
				$('#callbackopen').click(function()
				{
					showcallback()
				});
				$('#callbackclose').click(function()
						{
						hidemain()
					});
				$('#callbackfrompage').click(function()
						{
					showcallback()
					});
				$("a.ancLinks").click(function () {
					 $("html:not(:animated)" +( !$.browser.opera ? ",body:not(:animated)" : "")).animate({ scrollTop: 0}, 500 );  
			            
				      return false;
				    });
				$("h2.trigger").click(function(){
					if( $(this).parent().attr("class")=="leftmenu")
					{
					var thisclass= $(this).attr("class")
					if(thisclass=="trigger active")
					{
						$(this).next().slideUp('100');
						setTimeout(rad,400)
					}
					else
					{
						test=$(".active")
						test.removeClass("active")
						$(this).parent().find("ul").slideUp('100');
						$(this).toggleClass("active")
						$(this).next().slideDown('100');
						$(this).next().removeClass("block");
						$(this).next().addClass("blockopen");
					}
				}	
			});
					
					$("h2.trigger").hover(function(){
						if ($(this).parent().attr('class')=='leftmenu')
						{$(this).next().css('border','1px solid #C5D8DC')
						$(this).next().css('border-width','0 1px 1px 1px')
						}
						});
					$("h2.trigger").mouseleave(function(){
						if ($(this).parent().attr('class')=='leftmenu')
						{
						$(this).next().css('border','1px solid #dde8ea')
						$(this).next().css('border-width','0 1px 1px 1px')
						}
						});
					$("div.example2").hover(function(){
						$(this).children("h4").removeClass("hoverpic2");
						$(this).children("h4").toggleClass("");
						$(this).children("h4").toggleClass('hoverpic1')
						});
					$("div.example2").mouseleave(function(){
						$(this).children("h4").removeClass("hoverpic1");
						$(this).children("h4").toggleClass("");
						$(this).children("h4").toggleClass('hoverpic2')
								
						});

				});
function rad()
{	
	test=$(".active")
	test.removeClass("active")
	
}

function ajust()
{
//	left=$(".left-menu").height()
//	right=$(".Right").height()
	//if (left>right)
//	{
	//	$(".Right").height(left)			
	//}
//	else
	//{
//		$(".Right").height('auto')
	//}
}
function showcallback()
{
	$("#forload").css('z-index','100')
	$("#forload").css('display','block')
	cb=$('#callbackINNER')[0]
	cba=$('#callbackopen')[0]
	cbo=$('#callback')[0]
	cbc=$('#callbackclose')[0]
	cboo=$('#callbackOut')[0]
	cboo.style.width='670px'                       
	cbc.style.display="inline"
	cb.style.height='auto';
	cb.style.width='auto';
	cbo.style.width='660px';
	cbo.style.paddingTop='10px'
	cbo.style.right='30px';
	cbo.style.height='auto';
	$("#callbackINNER:hidden").slideDown("slow");
	frame1=$('#Vopros')[0]
	frame1.src="/web/its-in.nsf/Vopros?OpenForm"
}
function hidemain()
{
		cbc=$('#callbackclose')[0]
		cbc.style.display="none"   		 				                        
		$("#callbackINNER").slideUp("slow")
		setTimeout(hideMy,500)
}
function hideMy()
{
						cb=$('#callbackINNER')[0]
	   					cba=$('#callbackopen')[0]
	      				cbo=$('#callback')[0]
	     				cboo=$('#callbackOut')[0]
	     				//cb.style.display='none';   					                       
	     				cb.style.width='50px';
	    				cbo.style.paddingTop='0'
	    				cbo.style.height='auto';
	   					cbo.style.width='55px';
	   					$('#forhide').show()
	   					$("#forload").css('z-index','-9999')
	   					$("#forload").css('display','none')
}
function mystart()
{
	var url=$(location).attr('href')
	docunid=url.substr(url.length-32,32)
	var selli=$("a[href='/web/its.nsf/0/"+docunid+"']").parent("li:first")
	var selul=selli.parent()
	if(selul.attr("class")=="block" || selul.attr("class")=="blockopen")
	{
	selli.addClass("li1");
	selul.removeClass("block");
	selul.addClass("blockopen");
	selul.prev().toggleClass("active");
	selul.css('border','1px solid #dde8ea');
	selul.css('border-top','0');
	selul.prev().css('background','none repeat scroll 0 0 #dde8ea')
	var needul=selul[0]
	if(needul)
	{
		needul.style.display='block'
	}
	else
	{
		selul.css("display","block")
	}
	}
	$(".leftmenu").css('height',"auto")
	
}
