function zoom(id) {
	openwin("../product/zoomer.jsp?id=" + id, null, "width=" + 600 + ", height=" + 600 + ", resizable=no, scrollbars=no, toolbar=no");
}

var labels = 5;

function switchClass(id) {
	for (var i = 0; i < labels; i++)  {
		if (id == i) style("label" + id, "label a");
		else style("label" + i, "label hover");
	}
}

function switchPanel(id) {
	for (var i = 0; i < labels; i++) {
		if (id == i) show("panel" + id);
		else hide("panel" + i);
	}
}

function switchLabel(id) {
	switchClass(id);
	switchPanel(id);
}


var rating = false;

function doRequestRate(id, rank, sn) {
	if (rating) return;
	style("current").width = rank * 6;
	rating = true;
	html("res",iLan==0? "&nbsp;处理中...&nbsp;":"&nbsp;In processing...&nbsp;");
	send("/web/product/rate_.jsp?id=" + id + "&rank=" + rank + "&sn=" + sn, "doResponseRate");
}

function doResponseRate(res) {
	if (res > 0) html("res",iLan==0? "&nbsp;已保存!&nbsp;":"&nbsp;Saved&nbsp;");
	else if (res == 0) html("res",iLan==0? "&nbsp;已更新!&nbsp;":"&nbsp;Updated&nbsp;");
	else html("res", iLan==0? "&nbsp;评分失败!&nbsp;":"&nbsp;Submission failed!&nbsp;");
	rating = false;
}


function doComment() {
	switchLabel(4);
	focus("comment");
}

function doRequestComment(id) {
	if (length("comment") <= 10) {
		html("com",iLan==0? '<span class="red">评论内容过短, 不得少于10个字!</span>':'<span class="red">Too brief. Has to be more than 10 words!</span>');
		return;
	}
	html("com", iLan==0? '<span class="gray">处理中...</span>':'<span class="gray">In processing...</span>');
	send("../product/comment_.jsp?id=" + id, "doResponseComment", param("authcode") + param("username") + param("password") + param("comment"));
}

function doResponseComment(res) {
	if (res == 1) {
		hide("login");
		clear("comment");
		html("com",iLan==0? '<span class="blue">感谢您的评论与分享，我们会尽快予以过目。如符合规范，我们将立即发表.</span>':'<span class="blue">Thank you for your review and sharing. If all right after check, we\'ll get it published immediately.</span>');
	}
	else html("com",iLan==0? '<span class="red">登陆验证错误, 请重试!</span>':'<span class="red">Wrong log-in check, please try again!</span>');
}
