jQuery.noConflict();

jQuery(document).ready(function(){ 
	jQuery("#basketItemsWrap li:first").hide();

	jQuery("#product a img").click(function() {
		var productIDValSplitter 	= (this.id).split("_");
		var productIDVal 			= productIDValSplitter[1];
		
		jQuery("#notificationsLoader").html('<img src="images/ajax_load_2.gif">');
        jQuery.ajax({  
		type: "POST",  
		url: "./functions.php",  
		data: { productID: productIDVal, action: "addToBasket", quantity: jQuery("#quant" + productIDVal).val(), ves: jQuery("#ves" + productIDVal).val()},  
		success: function(theResponse) {
			
			if( jQuery("#productID_" + productIDVal).length > 0){
				jQuery("#productID_" + productIDVal).animate({ opacity: 0 }, 500, function() {
					jQuery("#productID_" + productIDVal).before(theResponse).remove();
				});				
				jQuery("#productID_" + productIDVal).animate({ opacity: 0 }, 500);
				jQuery("#productID_" + productIDVal).animate({ opacity: 1 }, 500);
				jQuery("#notificationsLoader").empty();
				jQuery("#notificationsDisc").empty();
				

				
			} else {
				jQuery("#basketItemsWrap li:first").before(theResponse);
				jQuery("#basketItemsWrap li:first").hide();
				jQuery("#basketItemsWrap li:first").show("slow");  
				jQuery("#notificationsLoader").empty();
				jQuery("#notificationsDisc").empty();
							
			}
			

                        jQuery("#notificationsCount").load("./getcount.php"); 
						jQuery("#notificationsSum").load("./getsum.php");
						alert("Товар успешно добавлен в корзину.");
						
						
		} 
		});  
		
	});
	
	
	
	jQuery("#basketItemsWrap li img").live("click", function(event) { 
														
		var productIDValSplitter 	= (this.id).split("_");
		var productIDVal 			= productIDValSplitter[1];	
	
		jQuery("#notificationsLoader").html('<img src="images/ajax_load_2.gif">');
	
		jQuery.ajax({  
		type: "POST",  
		url: "functions.php",  
		data: { productID: productIDVal, action: "deleteFromBasket"},  
		success: function(theResponse) {
			
			jQuery("#productID_" + productIDVal).hide("slow",  function() {jQuery(this).remove();});
			jQuery("#notificationsLoader").empty();
			jQuery("#notificationsDisc").empty();
                       jQuery("#notificationsCount").load("./inc/js/getcount.php");  
						jQuery("#notificationsSum").load("getsum.php");
					
		}  
		});  
		
	});

});
//Создание появления миниатюр
function Sim_Sim_Otkroysya()
{
 var obj=document.getElementById('Sim_Sim');
 if(obj.style.display=='none' || obj.style.display=="")
  {obj.style.display='block';}
 else
  {obj.style.display='none';}
}
function Sim_Sim1_Otkroysya()
{
 var obj=document.getElementById('Sim_Sim1');
 if(obj.style.display=='none' || obj.style.display=="")
  {obj.style.display='block';}
 else
  {obj.style.display='none';}
}
function Sim_Sim4_Otkroysya()
{
 var obj=document.getElementById('Sim_Sim4');
 if(obj.style.display=='none' || obj.style.display=="")
  {obj.style.display='block';}
 else
  {obj.style.display='none';}
}
//Модальные окна
jQuery.noConflict();
jQuery(document).ready(function() {   
    jQuery('a[name=modal]').click(function(e) {
    e.preventDefault();
    var id = jQuery(this).attr('href');
  
        var maskHeight = jQuery(document).height();
    var maskWidth = jQuery(window).width();
  
    jQuery('#mask').css({'width':maskWidth,'height':maskHeight});
  
    jQuery('#mask').fadeIn(300); 
    jQuery('#mask').fadeTo("slow",0.8); 
  
    var winH = jQuery(window).height();
    var winW = jQuery(window).width();
  
   jQuery(id).css('top',  winH/2-jQuery(id).height()/2);
    jQuery(id).css('left', winW/2-jQuery(id).width()/2);
  
    jQuery(id).fadeIn(2000); 
  
   });
  
    jQuery('.window .close').click(function (e) {
e.preventDefault();
    jQuery('#mask, .window').hide();
    }); 
 
    jQuery('#mask').click(function () {
    jQuery(this).hide();
    jQuery('.window').hide();
    }); 
  
    });  

jQuery.noConflict();
jQuery(document).ready(function() {
			
			jQuery("a.gallery2").fancybox(
			{						
"padding" : 20, // ?????? ???????? ?? ????? ????
"imageScale" : false, // ????????? ???????? true - ???????(???????????) ?????????????? ?? ??????? ????, ??? false - ???? ???????????? ?? ??????? ????????. ?? ????????? - TRUE
			"zoomOpacity" : false,	// ????????? ???????????? ???????? ?? ????? ???????? (?? ????????? false)
			"zoomSpeedIn" : 1000,	// ???????? ???????? ? ?? ??? ?????????? ???? (?? ????????? 0)
			"zoomSpeedOut" : 1000,	// ???????? ???????? ? ?? ??? ?????????? ???? (?? ????????? 0)
			"zoomSpeedChange" : 1000, // ???????? ???????? ? ?? ??? ????? ???? (?? ????????? 0)
			"frameWidth" : 700,	 // ?????? ????, px (425px - ?? ?????????)
			"frameHeight" : 600, // ?????? ????, px(355px - ?? ?????????)
			"overlayShow" : true, // ???? true ???????? ???????? ??? ??????????? ?????. (?? ????????? true). ???? ???????? ? jquery.fancybox.css - div#fancy_overlay 
			"overlayOpacity" : 0.8,	 // ???????????? ????????? 	(0.3 ?? ?????????)
			"hideOnContentClick" :false, // ???? TRUE  ????????? ???? ?? ????? ?? ????? ??? ????? (????? ????????? ?????????). ??????????? TRUE		
			"centerOnScroll" : true // ???? TRUE ???? ???????????? ?? ??????, ????? ???????????? ???????????? ????????		
				
			});
		
		jQuery("#menu a, .anim").hover( function() {
      jQuery(this).animate({"paddingLeft" : "10px"}, 300)},
	  function() {jQuery(this).animate({"paddingLeft" : "0"}, 300);
});
jQuery.noConflict();
	jQuery("a.iframe").fancybox(
{								  
			"frameWidth" : 800,	 // ?????? ????, px (425px - ?? ?????????)
			"frameHeight" : 600 // ?????? ????, px(355px - ?? ?????????)
								  
});	
		});
jQuery.noConflict();

jQuery(document).ready(function() {   
    jQuery('a[name=modal]').click(function(e) {
    e.preventDefault();
    var id = jQuery(this).attr('href');
  
        var maskHeight = jQuery(document).height();
    var maskWidth = jQuery(window).width();
  
    jQuery('#mask').css({'width':maskWidth,'height':maskHeight});
  
    jQuery('#mask').fadeIn(1000); 
    jQuery('#mask').fadeTo("slow",0.8); 
  
    var winH = jQuery(window).height();
    var winW = jQuery(window).width();
  
   jQuery(id).css('top',  winH/2-jQuery(id).height()/2);
    jQuery(id).css('left', winW/2-jQuery(id).width()/2);
  
    jQuery(id).fadeIn(2000); 
  
   });
  
    jQuery('.window .close').click(function (e) {
e.preventDefault();
    jQuery('#mask, .window').hide();
    }); 
 
    jQuery('#mask').click(function () {
    jQuery(this).hide();
    jQuery('.window').hide();
    }); 
  
    });  


