/**
 * Copyright(c) 2008-2009, gamegoldfast.com Inc. Some rights reserved.
 */
$(document).ready(function(){

    // delete all pakcage
    $('.btn_clear').click(function(){
        window.location.href = 'cart.php?act=remove_all';
    });
    
    // delete package by selected productid
    $('#cart_list .list_pak img').click(function(){
        productid = $(this).attr('class');
        window.location.href = 'cart.php?act=delete&productid=' + productid;
    });
    
    // add background color by mouse hover event
    $('#cart_list .list_pak').each(function(){
        $(this).hover(function(){
            $(this).addClass('hover');
        }, function(){
            $(this).removeClass('hover');
        })
    });
    
    // checkout for shop cart
    $('#cart_list .btn_checkout').click(function(){	
    	window.location.href = "order/setup-2.php";
    });    
    
    // update cart number
    $('#cart_list .list_pak .update').each(function(){    	
    	$(this).click(function(){
    		$(this).parents().find('input').focus(function(){
    			
    			$(this).val().replace(/\D/g, '');
    		});   		
    		
    		productid=$(this).parents().find('input').attr('id');
    		count = $(this).parents().find('input').val();
    		
    		window.location.href = "cart.php?act=update&productid=" + productid + "&count=" + count;
    		
    	});    	
    });    
      
   // tab mouse down
    function tab_mousedown(index){
        $('.menu li').each(function(){
            $(this).removeClass('tab_active');
        });
        $('.menu #tab' + index).addClass('tab_active');
    }
    tab_mousedown(1); 
    
    // Continue Shopping
    $('#cart_list .btn_shop').click(function(){	
    	history.back(-1);
    });  
});