/* <![CDATA[ */
			/*
jQuery.fn.countdown = function (date, options) {
		options = jQuery.extend({
			lang: {
				years:   ['год', 'года', 'лет'],
				months:  ['месяц', 'месяца', 'месяцев'],
				days:    ['день', 'дня', 'дней'],
				hours:   ['час', 'часа', 'часов'],
				minutes: ['минута', 'минуты', 'минут'],
				seconds: ['секунда', 'секунды', 'секунд'],
				plurar:  function(n) {
					return (n % 10 == 1 && n % 100 != 11 ? 0 : n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2);
				}
			}, 
			prefix: "Осталось: ", 
			finish: "Всё"			
		}, options);
 
		var timeDifference = function(begin, end) {
		    if (end < begin) {
			    return false;
		    }
		    var diff = {
		    	seconds: [end.getSeconds() - begin.getSeconds(), 60],
		    	minutes: [end.getMinutes() - begin.getMinutes(), 60],
		    	hours: [end.getHours() - begin.getHours(), 24],
		    	days: [end.getDate()  - begin.getDate(), new Date(begin.getYear(), begin.getMonth() + 1, 0).getDate() - 1],
		    	months: [end.getMonth() - begin.getMonth(), 12],
		    	years: [end.getYear()  - begin.getYear(), 0]
		    };
		    var result = new Array();
		    var flag = false;
		    for (i in diff) {
		    	if (flag) {
		    		diff[i][0]--;
		    		flag = false;
		    	}    	
		    	if (diff[i][0] < 0) {
		    		flag = true;
		    		diff[i][0] += diff[i][1];
		    	}
		    	if (!diff[i][0]) continue;
			    result.push(diff[i][0] + '' + '<span>' + options.lang[i][options.lang.plurar(diff[i][0])]+ '</span>');
		    }
		    return result.reverse().join(' ');
		};
		var elem = jQuery(this);
		var timeUpdate = function () {
		    var s = timeDifference(new Date(), date);
		    if (s.length) {
		    	elem.html(options.prefix + s);
		    } else {
		        clearInterval(timer);
		        elem.html(options.finish);
		    }		
		};
		timeUpdate();
		var timer = setInterval(timeUpdate, 1000);		
};*/
// add2cat*/////////////////////////////
(function($) {

	$.extend({
		add2cart: function(source_id, target_id, callback) {
    
      var source = $('#' + source_id );
      var target = $('.' + target_id );
	  var scrollPositionY=$(document).scrollTop();
      
      var shadow = $('#' + source_id + '_shadow');
      if( !shadow.attr('id') ) {
          $('body').prepend('<img id="'+source.attr('id')+'_shadow" src="'+ source.attr('src') +'" style="display: none; border: solid 1px darkgray; position: static; top: 0px; z-index: 100000;" />');
          var shadow = $('#'+source.attr('id')+'_shadow');
      }
      
      if( !shadow ) {
          alert('Cannot create the shadow div');
      }
      
      shadow.width(source.css('width')).height(source.css('height')).css('top', source.offset().top).css('left', source.offset().left).css('opacity', 0.5).show();
      shadow.css('position', 'absolute');
	  
	  
	  $("body").scrollTo( target_id, 300 );     
      shadow.animate( { width: target.innerWidth(), height: target.innerHeight(), top: target.offset().top, left: target.offset().left }, 
					{ duration: 500,
					specialEasing: {
					width: 'swing',
					height: 'swing'
					}})
        	.animate( { opacity: 0 }, 
					    100 , 
					   function()
					     {   
						  $(shadow).remove();
						  $("#divShoppingCart").html(callback);
						   $("body").scrollTo( scrollPositionY+'px', 500 );
						 }
					  );
        
		}
	});
})(jQuery);


jQuery.noConflict();
jQuery(document).ready(function(){		
jQuery("#quick_find_keyword").val("").focus(function()
		{
		   jQuery("#search-txt").fadeOut();		
		})
		.blur(function()
		{
		   if (jQuery(this).attr('value')=="")  jQuery("#search-txt").fadeIn();	   
		});		
	
	jQuery("#search-txt").click(function()
		{
			jQuery(this).fadeOut();
			jQuery("#quick_find_keyword").focus();
		});		
	
	if (jQuery.browser.msie && jQuery.browser.version == 6) {
	
	}
/* login  ****************///  
   jQuery('a.login, #boxLogin .close').live('click', function() {jQuery('#boxLogin').slideToggle("normal"); return false;});
/*new featured */////////////////////////////////////   
   jQuery('.pageItem').hover(function() {
	  jQuery(this).addClass('hover');
	}, function() {
	  jQuery(this).removeClass('hover');
	});

/*reviews */////////////////////////////////////   
   jQuery('#show2, #show').click(function() {
	  jQuery(this).children('span').toggleClass('hidden');
	  jQuery(this).parent().children('.more').slideToggle('slow'); 	
	  return false;
	});
/*manufacturers' info */////////////////////////////////////   
   jQuery('.manufacturer_info').click(function() {
	  jQuery(this).parent().parent().find("#manu_descr").toggleClass('hidden'); 		 
	  return false;
  });
/*bottom *///////////////////////////////////// 
   var windowHeight = parseInt(jQuery(window).height());
   var footerOffset= parseInt(jQuery('.line5').offset().top);
   var footerHeight= parseInt(jQuery('.line5').height())+parseInt(jQuery('.line5').css('padding-top'));
   var footer=Math.abs(footerOffset-windowHeight)-parseInt(jQuery('.line5').css('padding-top'));
   if (windowHeight>(footerHeight+footerOffset)) jQuery('.line5').height(footer+'px');
   
/*input *///////////////////////////////////// 
   jQuery('input[type="radio"], input[type="checkbox"]').checkBox(); 

   jQuery('.myinput').click(function() {		
		  jQuery(this).children(".input").children("input").focus();
	});   
   
 /*regions */
  jQuery("#country").change(function(){
		var searchString = jQuery(this).val();
		jQuery.ajax({
							url: "index_ajax1.php",             
							dataType : "html",                    	
							data: "q=includes/modules/ajax/loadStateXML.php&country_id="+searchString,
							type: "POST",	
							/*beforeSend: function(){
										preview_img.fadeIn();},*/
							success: function(msg){jQuery("#stateXML").html(msg);}				
						 });							 
									 
									 
	});
 
 /* search  ****************///  
   var timeout = null;
  
   function show(msg,searchString)
	{
		if (msg) {
		jQuery("#ajaxQuickFindContent").html(msg);		
		jQuery('#ajaxQuickFindContent').highlight(searchString);
		jQuery("#ajaxQuickFind").slideDown();
		}
	}
   function AjaxQuery()
   {
	   var searchString = jQuery("#quick_find_keyword").val(); 
	   if (searchString.length > 0)
		{
	    jQuery.ajax({
							url: "index_ajax1.php",             
							dataType : "html",                    	
							data: "q=includes/modules/ajax/ajaxQuickFind.php&keywords="+searchString,
							type: "POST",	
							/*beforeSend: function(){
										preview_img.fadeIn();},*/
							success: function(msg){show(msg,searchString);}				
						 });
		}
		else
		{	
			jQuery("#ajaxQuickFind").fadeOut();
		}	
		
   }
   

 jQuery("#quick_find_keyword").keyup(function(){
	if (timeout) clearTimeout(timeout);
	timeout = setTimeout(AjaxQuery, 500);  
   }).blur(function() {jQuery("#ajaxQuickFind").fadeOut();});
 
/* ajaxcart  ****************///  
jQuery(".cart").mouseover(
		function(){
		jQuery('#AjaxCartSlide').slideDown(); 		
		return false;
       });
jQuery('#AjaxCartSlide').live('mouseover' , function(){jQuery(this).show();}).live('mouseout' , function(){jQuery(this).toggle();});

jQuery('#AjaxCartSlide td').live('mouseover' , function(){jQuery(this).toggleClass('hover');}).live('mouseout' , function(){jQuery(this).toggleClass('hover');});
/* admin*/
if(jQuery('#admin').length!=0) 
{
	jQuery('.phone').mouseover(
		function(){
		jQuery('#admin').slideDown(); 		
		return false;
       });
	jQuery('#admin').live('mouseover' , function(){jQuery(this).show();}).live('mouseout' , function(){jQuery(this).toggle();});

}
/* letters */
jQuery('a.highslide ').bind('click' , function(){
		var manu=jQuery(this).next(".highslide-caption");
		var offset=jQuery(this).offset();		
		jQuery.facebox('<ul>'+manu.html()+'</ul>');		 
	});
/*img info*/
jQuery('a.imginfo').facebox();		 
/*login_or_buy*/
if (jQuery('#checkout_attention').length!=0)
{
	jQuery('a[href*="checkout_shipping.php"]').live('click', function()
	{
		jQuery.facebox('<div class="checkout_attention">'+jQuery('#checkout_attention').html()+'');	
		return false;
	});	
}


});
  /* ]]> */
