jQuery(document).ready(function()
{
	/*$i1 = parseInt(jQuery("div#topmenu div#ico").width());
	$i2 = parseInt(jQuery("div#topmenu div#topmenu_block").width());
	$i3 = $i1+$i2;
	jQuery("div#topmenu").attr("style", "width:"+ $i3 + "px;");*/
	
	if ((jQuery.browser.msie)&&(jQuery.browser.version)) {
	  	jQuery("div#logo img").attr("src", "http://zvs-ural.ru/img/logo.gif");
	}

	
	$active_index = 0;
	setInterval( "slideSwitch()", 7000 );
	 
	 $editable = jQuery("img.editable").size();
	 for($ed_i=0;$ed_i<$editable;$ed_i++)
	 {
		 jQuery("img.editable").eq($ed_i).wrap('<div class="cont_img"></div>');
		 jQuery("img.editable").eq($ed_i).after('<div></div>');
		 }

	jQuery("div#topmenu_block ul li").hover(
	  function () {
		if (jQuery(this).attr("id") == "act")
		{
		jQuery(this).find("ul li:first").attr("style", "padding-top:6px;");
		jQuery(this).find("ul li:last").attr("style", "padding-bottom:9px;");
		jQuery(this).find("ul").show();	
		}
		else
		{
		jQuery(this).attr("id", "curr");
		jQuery(this).find("ul li:first").attr("style", "padding-top:6px;");
		jQuery(this).find("ul li:last").attr("style", "padding-bottom:9px;");
		$topmenu_block_tb = jQuery("div#topmenu_block ul li#curr .level1").width();
		jQuery(this).find("ul").show();
		}
	  },
	  function () {
		//jQuery("div#topmenu_block ul li#curr div.tb").removeAttr("style");
		/**/
		if (jQuery(this).attr("id") == "act")
		{
		jQuery(this).find("ul li:first").removeAttr("style");
		jQuery(this).find("ul li:last").removeAttr("style");
		jQuery(this).find("ul").hide();
		}
		else
		{
		jQuery(this).find("ul li:first").removeAttr("style");
		jQuery(this).find("ul li:last").removeAttr("style");
		jQuery(this).removeAttr("id");
		jQuery(this).find("ul").hide();
		}		
		/**/
	  }
	);
	
	$sertif_block = jQuery("div#content div#sertif_block div.sertif_block_item").size();
	for (i=2;i<$sertif_block;i=i+3)
	{
		jQuery("div#content div#sertif_block div.sertif_block_item").eq(i).attr("style", "margin:0px;");
		jQuery("div#content div#sertif_block div.sertif_block_item").eq(i).after("<div class='sertif_block_item_sep'><div></div></div>");
		}

	$object_block = jQuery("div#content div.object_foto_line").size();
	for (j=2;j<$object_block;j=j+3)
	{
		jQuery("div#content div.object_foto_line").eq(j).attr("style", "margin:0px;");
		//jQuery("div#content div.object_foto_line").eq(j).after("<div class='object_foto_line_sep'><div></div></div>");
		}
		
	jQuery("div#object_foto_spisok table tr:even").find("td").attr("style", "background:#f7f7f7;");
	/*$border_r_img = jQuery("img.border_r").size();
	for (im=0;im<$border_r_img;im++)
	{
		$width_img = jQuery("img.border_r").eq(im).width();
		$height_img = jQuery("img.border_r").eq(im).height();
		jQuery("img.border_r").eq(im).parent().addClass("border_r").attr("style", "height:"+ $height_img + "px;");
		jQuery("img.border_r").eq(im).after("<span>");
		jQuery(".border_r").eq(im).find("span").attr("style", "width:"+ $width_img + "px;");
		}*/
		
 
	  
	   jQuery('#sertif_block a').lightBox();
	   jQuery('.object_foto_line a').lightBox();

});


function slideSwitch() {
    var $active = jQuery('#slideshow IMG.active');
	/*$all = jQuery('#slideshow IMG').size();
	if ($active_index<$all)
	{
		jQuery('#slideshow IMG.active').removeClass();
		jQuery('#slideshow IMG').hide();	
		jQuery('#slideshow IMG').eq($active_index).fadeIn(3000);
		$active_index++;
		}
		else
		{
			$active_index = 0;
			jQuery('#slideshow IMG.active').removeClass();
			jQuery('#slideshow IMG').hide();	
		jQuery('#slideshow IMG').eq($active_index).fadeIn(3000);
			}*/

    if ( $active.length == 0 ) $active = $('#slideshow IMG:last');

    var $next =  $active.next().length ? $active.next()
        : $('#slideshow IMG:first');


    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 4000, function() {
            $active.removeClass('active last-active');
        });
}
