	
	function product_switch( MainDiv, CurrItem ) {
		 jQuery( '#menuTovara li' ).attr( 'class', '' );
		 jQuery( '#' + CurrItem + '_btn' ).attr( 'class', 'menuTovara-active' );
		 
		 jQuery( '#product_info div.catalog' ).hide();
		 jQuery( '#' + CurrItem + '_box' ).show();
		 
	}
	
	function ShowCenter( box_id ) {
		var popupX = Math.round( ($(window).width() - $(box_id).width()) / 2) ;
		var popupY = $(document).scrollTop() + Math.round($(window).height()/2) - Math.round($(box_id).height()/2);
		$(box_id).css({top: popupY+"px", left: popupX+"px"});
		$(box_id).show();	
	}
	
	function ShowResponse( fshow ) {
		
		if ( fshow ) {  
			
			var box_id = "#response-popup-win";
			ShowCenter( box_id );	
				
			
			jQuery( "#cboxOverlay" ).show();
		} else {
			jQuery( "#response-popup-win" ).hide();
			jQuery( "#cboxOverlay" ).hide();
		}
		
	}
	
	
	var getresults = function(results) { 
		eval(results);
	}
	
	
	function CartAdd( product_id ) {
		jQuery( "#cboxOverlay" ).show();
		ShowCenter( "#cboxMessage" );	
		
		ajax.post( ROOT + '/ajax.php?action=cart_add&product_id='+ product_id, getresults, 0 );		
	}
	
	function ChangeCart( new_count, product_id, price ) {
		ajax.post( ROOT + '/ajax.php?action=cart_add&mode=change_count&product_id='+ product_id + "&new_count=" + new_count + "&price=" + price, getresults, 0 );		
	}
	
	function CartDelete( product_id ) {
		ajax.post( ROOT + '/ajax.php?action=cart_add&mode=delete&product_id='+ product_id, getresults, 0 );		
	}
	
	function sendForm( frm ) {
		ajax.post( ROOT + "ajax.php", getresults, "frmID=" + frm.id + "&" + ajax.serialize(frm) );
	}
	
	
	 /* RATING */
	$(document).ready(function(){
		$( "div.star-rating a" ).hover(function() {
			$( "div.star-rating" ).removeClass( "static" );
			
     	var num = jQuery(this).attr( "title" );
    	
     	for( Index = 0; Index < num; Index++ ) {
     		if ( $( "div.star-rating:eq("+ Index +")" ).hasClass( "star-rating-on" ) == false ) {
     			$( "div.star-rating:eq("+ Index +")" ).addClass( "star-rating-on" );
     		}
     	}
     	
    }, function() {
    	var num = 5;
    	for( Index = 0; Index < num; Index++ ) 
	    	if ( $( "div.star-rating:eq("+ Index +")" ).hasClass( "static" ) == false )
	    		$( "div.star-rating:eq("+ Index +")" ).removeClass( "star-rating-on" );
    });

    $( "div.star-rating a" ).click(function() {
    	var num = jQuery(this).attr( "title" );
    	for( Index = 0; Index < num; Index++ ) {
     		if ( $( "div.star-rating:eq("+ Index +")" ).hasClass( "static" ) == false ) {
     			$( "div.star-rating:eq("+ Index +")" ).addClass( "static" );
     		}
     	}
     	
     	$( "#stars" ).val( num );
     	
    });
    
    
		
	});

