$(document).ready(function(){


	$('.p-m').toggle(function() {
	  $(this).html("<img src=\"http://saglamaile.az/skin/frontend/default/default/jq/images/minus.gif\" alt=\"\" class=\"add-cart\">");
	}, function() {
	  $(this).html("<img src=\"http://saglamaile.az/skin/frontend/default/default/jq/images/plus.gif\" alt=\"\" class=\"add-cart\">");
	});

	$("a[rel^='prettyPhoto']").prettyPhoto({theme: 'light_rounded'});
   
	$("#firstpane p.menu_head, .menu_head2").hover(function() {
		$(this).css({backgroundColor:"#1b6af2"});
	}, function() {
		$(this).css({backgroundColor:"#175fd9"});
	});
	
	$(".category-products table tr:odd td").css({backgroundColor:"#cccccc"});
	$(".category-products table tr:even td").css({backgroundColor:"#f2f2f2"});
	
	$("#print_cart").attr("href", "javascript:void(0)").click(
		function(){
			$('#print_cart, .simpleCart_empty, .itemRemove').fadeOut();
			$('div').not('#cart3').css({'visibility': 'hidden'});
			$('#cart3').css({'visibility': 'visible', 'position':'absolute', 'top':'0px', 'left':'0px', 'z-index':'100000'});
			$('#cart3 *').css({'visibility': 'visible'});
			$('html, body').animate({scrollTop:0}, 'slow');
			window.print();
		}
	);
		
	$("#firstpane p.menu_head").toggle(function() {
		$(".menu_head").css({backgroundColor:"#175fd9", backgroundImage:"url(http://saglamaile.az/skin/frontend/default/default/jq/images/plus2.gif)", backgroundPosition: "240px"});
		$(this).css({backgroundColor:"#1b6af2", backgroundImage:"url(http://saglamaile.az/skin/frontend/default/default/jq/images/minus2.gif)"}).next("div.menu_body").slideToggle(300).siblings("div.menu_body").slideUp("slow");
		}, function() {
		$(this).siblings("div.menu_body").slideUp("slow");
		$(".menu_head").css({backgroundColor:"#175fd9", backgroundImage:"url(http://saglamaile.az/skin/frontend/default/default/jq/images/plus2.gif)", backgroundPosition: "240px"});
	});

   //$('#lab-list-ul').hoverAccordion({
   //   keepheight: 'false'
   //});
   $('#lab-list-ul2').hoverAccordion({
      keepheight: 'false'
   });
	//var dheight = $(document).height();
	//$('body').css({height: dheight});
   $('.postContent img').lightBox({
	imageLoading: 'http://saglamaile.az/skin/frontend/default/default/jq/images/lightbox-btn-loading.gif',
	imageBtnClose: 'http://saglamaile.az/skin/frontend/default/default/jq/images/lightbox-btn-close.gif',
	imageBtnPrev: 'http://saglamaile.az/skin/frontend/default/default/jq/images/lightbox-btn-prev.gif',
	imageBtnNext: 'http://saglamaile.az/skin/frontend/default/default/jq/images/lightbox-btn-next.gif'
   });
    $('#gin').css({'background': 'none', 'border': '0px solid', 'margin-top': '2px'});
		jQuery.each(jQuery.browser, function(i) {
		   if($.browser.msie){
				 $('#menu_22_t').css('margin', '0 40px 0 auto');
		   }
		   else if(i=="mozilla") {
				 $('#menu_22_t').css('margin', '0 auto');
		   }
		   else if(i=="opera") {
				 $('#menu_22_t').css('margin', '0 auto');
		   }
		   else if(i=="webkit") {
				 $('#menu_22_t').css('margin', '0 auto');
		   }		   
		 });
		var documentWidth = $("#header").width();
		$('#cse-search-results').css({height: '900px', overflow: "hidden"});
		set_menu();
		$(".gallery").jMyCarousel({   
		speed: 1000,
		auto: true,
		visible: '986px',	
		btnPrev: $('#left'),
		btnNext: $('#right')
		}) 
	}
);

function set_menu(){
	$('#menu td a img').mouseover(
		function(){
			var src_ = $(this).attr('src');
			
			src_ = src_.replace('.', 'down.');
			$(this).attr('src', src_);
		}
	);
	
	$('#menu td a img').mouseout(
		function(){
			var src_ = $(this).attr('src');
			
			src_ = src_.replace('down.', '.');
			$(this).attr('src', src_);
		}
	);
}

    function PrintElem(elem) {
        Popup($(elem).text());
    }

    function Popup(data) {
        var mywindow = window.open('', 'my div', 'height=400,width=600');
        mywindow.document.write('<html><head><title>Корзина</title>');
        mywindow.document.write('<link rel="stylesheet" href="http://saglamaile.az/skin/frontend/default/default/jq/styles.css" type="text/css" />');
        mywindow.document.write('</head><body >');
        mywindow.document.write(data);
        mywindow.document.write('</body></html>');
        mywindow.document.close();
        mywindow.print();
        return true;
    }
	
	
	
