$(document).ready(function(){
    Main.bind();    
});


var Class_Main = function(){
}

Class_Main.prototype = {
    bind: function()
    {		
		$('#to_cart').click( function ()
		{
			var id = $('#product_id').val();
			$.ajax({
				url: host+'?task=add_to_cart&id='+id,
				cache: false,
				success: function(html){										
					$('#pr_no').html(html);
				}				
			});
			return false;	
		})
		
		$('.remove').click( function ()
		{
			var id = $(this).attr('title');						
			$.ajax({
				url: host+'?task=remove_item&id='+id,
				cache: false,
				success: function(html){
					$('#cart_container').html(html);
				}
			});
			$.ajax({
				url: host+'?task=update_no',
				cache: false,
				success: function(html){
					$('#pr_no').html(html);
				}
			});
			return false;
		})
				
		$('#tmen2').hover(
			function(){
				$('.sub_menu').show();
				$('#tmen2').addClass('active');
			},
			function(){
				$('.sub_menu').hide();
				$('#tmen2').removeClass('active');
			}
		
		);
		
		$('.sub_menu').hover(
			function(){
				$('.sub_menu').show();
				$('#tmen2').addClass('active');
			},
			function(){
			$('.sub_menu').hide();
			$('#tmen2').removeClass('active');
			}
		);				
				
		$('.show_more').click( function(){
			var id = $(this).attr('id');
			$.ajax({
				url: host+'?task=show_more&id='+id,
				cache: false,
				success: function(response){
					$.fancybox(response);
				}
			});
		});
    }
}

var Main = new Class_Main();
