$(document).ready(function(){
    $('.PBaseinfo').html();
    $('#data tr td.PBaseinfo').each(function(i,n){
        var pBaseInfo = eval('(' + $(this).text() + ')');
        var pItem = pBaseInfo.PBaseInfo[0];
        $('.cpname td').eq(i+1).html('<a href=' + shopFolder + 'products/product-' + pItem.ProductID + '.' + extend + ' target="_blank">'+pItem.ProductName+'</a>');
//        $('.cpimg td').eq(i+1).html('<a href=' + shopFolder + 'products/product-' + pItem.ProductID + '.' + extend + ' target="_blank"><img src="'+shopFolder+'upload/ProductImg/' +PPFolder(pItem.CategoryNo)+'/'+pItem.ThumbnailImg+'" width="100" /></a>');
        $('.cpimg td').eq(i+1).html('<a href=' + shopFolder + 'products/product-' + pItem.ProductID + '.' + extend + ' target="_blank"><img src="'+shopFolder+'upload/ProductImg/' + pItem.ImgFolder + pItem.ThumbnailImg+'" width="100" /></a>');
        $('.cpbrand td').eq(i+1).html(pItem.BrandName);
        $('.cpprice td').eq(i+1).html(pItem.MemberPrice);
        $('.cpweight td').eq(i+1).html(pItem.Weight + 'KG');
        $('.cpscore td').eq(i+1).html(pItem.Score);
        $('.cpdiscount td').eq(i+1).html(pItem.IsDiscount == '1' ? '是' : '否');
        
        var pProperties = eval('(' + $(this).next().html() + ')');
//      if(pProperties.paras[0]){
//        for(var k=0;k<pProperties.paras.length;k++){
        for(var k in pProperties.paras){
            var propItem = pProperties.paras[k];
		    var tempItem=$("<tr><th class='tdTitle' colspan='2'>"+propItem.group+"</th></tr>").appendTo($(".Ptable").eq(i));					
		    $.each(propItem.options,function(j,m){
			    var tempRow=$("<tr></tr>").appendTo($(".Ptable").eq(i));
			    var tempCell1=$("<td class='tdTitle'>"+m.name+"</td>").appendTo(tempRow);
			    var tempCell2=$("<td>"+m.value+"</td>").appendTo(tempRow);
		    });
		}
    });
});

function PPFolder(cid){
    return (cid.length > 4 ? cid.substring(0,4) : cid);
}