// JavaScript Document

if (!Mould) { var Mould = new Object(); }

Mould.Showproducts = {
		
		initialize : function() {
				var t = this;
				
				$('.cpdt_tab_title li').bind('click',function(){
					$('.cpdt_tab_title li').each(function(i){$(this).removeClass()})
					$(this).addClass('now_two');
					t.get_products($(this).attr('name'),$(this).attr('id'),1);
				});
				
				$('.cpdt_tab2_title li').bind('click',function(){
					$('.cpdt_tab2_title li').each(function(i){$(this).removeClass()})
					$(this).addClass('now_three');
					t.get_products($(this).attr('cname'),$(this).attr('ref'),0);
				});
				
		},
		
		get_products :function(catid,container,cover){
				$("div[id^='two_']").hide();
				$('#two_'+container).show();
				$('.cpdt_picture > div').hide();
				$('#three_'+container).show();
				
				if(cover&&$('#three_'+container+' > .cpdt_pic_table' ).html())
				{
					return;
				}
	
				$.post('/welcome/getproducts',{catid:catid},
				  function(data){
					$('#three_'+container).html(data);
				  });
		}
		

};


$(document).ready(function(){
			Mould.Showproducts.initialize();
			Mould.Showproducts.get_products('01001','con1',1);
}); 

