$( function() {
	$(".contacters .nav a").mouseover( function() {
		mouseovercheck($(this))
	} );
	$(".contacters .nav").each( function() {
		mouseovercheck($(this).find("a:first"));
	} );
	function mouseovercheck(obj) {
		if ( obj.length > 0 ) {
			if ( !obj.hasClass("current") ) {
				obj.parent().parent().find("a").filter( function(index) {
					return $(this).hasClass("current");
				} ).removeClass("current");
				obj.addClass("current");
				LoadContactList(obj);
			}
		}
	}
	
	function LoadContactList(obj) {
		var box = obj.parent().parent().parent().next();
		box.html("数据载入中...");
		$.ajax( {
			type: "get",
			url: "ajax/ContactList.asp",
			cache: false,
			data: "C_id=" + obj.attr("rel"),
			dataType: ($.browser.msie) ? "text" : "xml",
			error: function() { alert("Error loading XML document"); },
			success: function(result) {
				if ( typeof result == "string" ) {
					var xml = new ActiveXObject("Microsoft.XMLDOM");
					xml.async = false;
					xml.loadXML(result);
				}
				else {
					var xml = result;
				}
				if ( xml.getElementsByTagName("root")[0].getAttribute("error") == "PaWrong" ) {
					alert("对不起，参数错误！");
				}
				else {
					var contact = xml.getElementsByTagName("root")[0].getElementsByTagName("contacts") , xmldate = "";
					for ( var i = 0 ; i < contact.length ; i++ ) {
						if ( contact[i].getAttribute("ConstValue") != "" ) {
							xmldate += "<p>" + contact[i].getAttribute("ConstName") + "：" + contact[i].getAttribute("ConstValue") + "</p>\n";
						}
					}
					box.html(xmldate);
				}
			}
		} );
	}
} );