﻿var nowpush = 0;
function procard() {
	$("#cyzsm a").focus( function() {
		$(this).blur();
	} ).click( function() {
		setprocards( $(this) );
	} );
	setprocards( $("#cyzsm a:first") );
}

function setprocards(obj) {
	var classid = obj.attr("rel").split(",")[0];
	var i = obj.attr("rel").split(",")[1];
	$("#cyzsm a:eq(" + nowpush + ")").css( { "font-weight" : "normal" , "color" : "#999" } );
	nowpush = i;
	$("#cyzsm a:eq(" + nowpush + ")").css( { "font-weight" : "bold" , "color" : "red" } );

	$.ajax({
		type: "post",
		url: "indexpro_ajax.asp",
		cache: false,
		data: "id=" + classid,
		dataType: ($.browser.msie) ? "text" : "xml",
		success: function(result) {
			if ( typeof result == "string" ) {
				$("#cyzsmain ul:first").empty();
				var xml = new ActiveXObject("Microsoft.XMLDOM");
				xml.async = false;
				xml.loadXML(result);
				var pro = xml.getElementsByTagName("root")[0].getElementsByTagName("pro");
				var xmldate;
				var img = new Image();
				for ( var x = 0 ; x < pro.length ; x++ ) {
					xmldate = "<li>";
						xmldate += "<p class='cyzspic'><img src='"
						if ( pro[x].getAttribute("src") != "" ) {
							xmldate += pro[x].getAttribute("src");
						}
						else {
							xmldate += "images/nopic.gif";
						}
						xmldate += "' width='167' height='125' /></p>";
						xmldate += "<p class='cyname'><a href='product_view.asp?id=" + pro[x].getAttribute("id") + "' class='red'>[名 称]：" + pro[x].getAttribute("name") + "</a></p>";
						xmldate += "<p class='xh'>[型 号]：" + pro[x].getAttribute("type") + "</p>";
						xmldate += "<p class='cctime'>[出厂时间]：" + pro[x].getAttribute("time") + "</p>";
					xmldate += "</li>";
					$("#cyzsmain ul:first").append(xmldate);
				}
			}
		}
	});
}
