	$(document).ready(function () {


		$('#action').cycle({
			fx:    'fade',
			speed:  2500
		});
		

		$('#searchword').blur( function() { if ( $(this).attr('value') == '' ) { $(this).attr('value', 'Поиск по сайту...'); } } );		
		$('#searchword').click( function() { if ( $(this).attr('value') == 'Поиск по сайту...' ) { $(this).attr('value', ''); } } );
		
		$('#menu2 ul li:last').css( 'background', 'none' );	
		
		$('#pagination a:first').css('background-image','none');
		
		$('#fade').css('opacity', '0');
		$('#tovar_form').css('opacity', '0');
		
		$('.poleznosti tr:last td').addClass('last');
		
		$('#breadcrumbs a:first').addClass('first');
		
		
		/* Заказать звонок */
		
		
		$('#call').click( function(){			

			$('#fade').css('display', 'block');
			$('#fade').fadeTo(1000, 0.8, function() {
				
				hax('index.php?option=com_call&task=form&tmpl=component', { id:'call-form-data', anticache:'true', notitle:'true', nohistory:'true', callback:function() { 
					
					$('#call-form-data').css('top', '50%');
					$('#call-form-data').fadeTo(1000, 1);
					
				} } );			

			
			});
			
			return false;

		} );	
		
		
		/*/ заказать зонок */
		
		
		/* Форма товара */
		
		$('#items a, #more, #best a').click( function(){
			
			var tovar_id = $(this).attr('tovar');

			$('#fade').css('display', 'block');
			$('#fade').fadeTo(500, 0.8, function() {
				
				hax('/index.php?option=com_catalog&view=item&tmpl=component&id=' + tovar_id, { id:'tovar_form_center', anticache:'true', notitle:'true', nohistory:'true', callback:function() { 
					
					$('#tovar_form').css('top', '50%');
					$('#tovar_form').fadeTo(500, 1);
					
				} } );			

			
			});
			
			return false;

		} );
		
		/* форма товара */
		
		
	    $("#menu ul li.parent").hover(
	    		
	    	      function () {
	    	    	  
	    	        $(this).addClass('hover');
	    	        
	    	      }, 
	    	      
	    	      function () {
	    	    	  
	    	    	  $(this).removeClass('hover');
	    	        
	    	      }
	    	      
	    	    );
	    
	    $("#menu ul li a img, .dropmenu, #items tr td .bgcrug2, .bgcrug").pngfix();
	    
	    $('#select-line-form').change( function() { $(this).submit(); } );
	    
	    $("#select-line-form").modmac();
		
		
		$("#opinions-form").submit( function() {
			
			if ( $("input[name=fio]").attr('value') != '' && $("input[name=email]").attr('value') != '' && $("textarea[name=comment]").val() != '' ) {				
			
					return true;
			
				} else {
					
					alert('Пожалуйста, заполните все поля, отмеченные красной звездочкой.');
					
					return false;
					
				}
		
		} );
			
	
	});
