//商品详情块切换   
$(function()
{
$(".tab_block a").click(function()
{
	$(this).addClass("click").siblings().removeClass("click");
	var index = $(".tab_block a").index(this);
	$(".tab_info .right-center").eq(index).show().siblings().hide();
}
)
$.get("/Handler/HProduct.ashx",{flag:+new Date(),productId:ProductId,act:"adrate"},function(response){
  $("#ADRate").html(unescape(response))
})
$.getJSON( "/Handler/Productdata.ashx",
{
	act:'gethotproduct',num : 4,timestamp: + new Date()
} 
, function( data )
{
$.each( data, function( i, data )
{
	$( "#productHot" ).append( "<li><a href=\"/product/"+data.pId+".html\"><img src=\""+data.smallImg+"\" onload='zoomimg(this, 150,150)' \/><\/a><p><a href=\"/product/"+data.pId+".html\">" + data.productName + "<\/a><\/p><\/li>" )
}
)
}
); 


}
)
$(function()
{
	$(".comments_list ul:nth-child(odd)").addClass("gray");
    $("#priceArea").hover(function(){       
    $("#InformPrice").show()
    },
    function(){
    $("#InformPrice").hide()
    })	
}
)
function copy()
{
	if ( window.clipboardData )
	{
		window.clipboardData.setData( "Text", location.href )
		alert( '地址已经复制到您的剪贴板，您可以发送给您的朋友啦！' );
	}
	else
	{
		alert( "您的浏览器不支持此功能！请手动复制！" )
	}
}
$(document).ready(function()
{
$(".fre_search").toggle(function()
{
	$(this).parent().next().animate(
	{
		height: 'toggle', opacity: 'toggle'
	}
	, "slow");
}
,function()
{
	$(this).parent().next().animate(
	{
		height: 'toggle', opacity: 'toggle'
	}
	, "slow");
}
);
$("#salesArea").toggle(function()
{
	$(this).parent().parent().next().animate(
	{
		height: 'toggle', opacity: 'toggle'
	}
	, "slow");
}
,function()
{
	$(this).parent().parent().next().animate(
	{
		height: 'toggle', opacity: 'toggle'
	}
	, "slow");
}
);

}
);
var ProductPop ;
$(document).ready(function()
{
	$("body").bind("copy",function()
		{ 
			try
			{
					event.returnValue=false; 
					var s=document.selection.createRange().text; 
					t = s+'\n信息来自[http://www.maiduo.com/] [买多网]'; 
					clipboardData.setData('Text',t); 
			  }
		   catch(err)
			{
			   event.returnValue=true;
			}
		})
		
		
	}
);
// 新添加的js代码 为商品评论提供支持

//显示相应页码
function showProductComment(page, pagesize,productid) {
	$.ajax({
		type: "POST",
		url: "/post/productcomment.aspx",
		data: "act=showcommentpagelist&page="+ page +"&pagesize="+pagesize + "&productid="+ productid +"&s="+Math.random(),
		success: function(msg) {
			$("#productComment").html(msg);
			if(page != 1){
			$(document).scrollTop($("#productComment").offset().top);
			}
		}
	});
}

// 是否有效的判断
function ifHelp(productId,commentId,type)
{
		$.ajax({
		type: "POST",
		url: "/post/productcomment.aspx",
		data: "act=ifhelp&productid="+ productId +"&commentid="+ commentId +"&ifhelp="+type+"&s="+Math.random(),
		success: function(msg) {
			eval(msg);
		}
	});
}


// 收藏商品
function addThisProdut(id) {
	$.ajax({
	   type: "POST",
	   url: "/post/productAction.aspx",
	   data: "act=addthisproduct&id="+id+"&s="+Math.random(),
	   success: function(msg){
		 eval(msg);
	   }
	});
}