var xmlHttp,visitor,path;

function createXmlHttp() {

    if (window.XMLHttpRequest) {
       xmlHttp = new XMLHttpRequest();               
    } else {
       xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
    }
}

function findUser(userType,id,picPath) {
	visitor=id;
	path=picPath;
    createXmlHttp();                                            
    xmlHttp.onreadystatechange = replyScope;               
    xmlHttp.open("POST", "newUsers.jsp", true);                 
    xmlHttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
    xmlHttp.send("action=send" +
                 "&type="+userType
                );                    
}

function replyScope(newMsg) {
    if (xmlHttp.readyState == 4) {
    	var newMsgObj = eval("("+xmlHttp.responseText+")");
        var udiv = document.getElementById("newUser");
        if(newMsgObj.users!="null"){
        	var str,users,html='';
        	str = newMsgObj.users.split("+");
    		if(newMsgObj.type=="1"){
    			for(var i=0;i<str.length;i++){
            		users = str[i].split("#");
            		html+='<div class="kuai"><div class="tu_04"><a href="designer.do?method=designerPage&&userId='+users[0]+'"><img src="'+path+users[2]+'" width="39" height="52"alt="" /></a></div><div class="wz_04"><h2><a href="designer.do?method=designerPage&&userId='+users[0]+'">'+users[1]+'</a></h2><p><a href="works.do?method=DetailWorks&&worksId='+users[3]+'">'+users[4]+'</a></p><div>'+users[5]+'</div></div></div>';
    			}
    		}else{
    			for(var i=0;i<str.length;i++){
            		users = str[i].split("#");
            		html+='<div class="kuai"><div class="tu_04"><a href="personal.do?method=UserfinalPage&&userId='+users[0]+'" onclick = "visitorCount('+users[0]+','+visitor+');"><img src="'+path+users[2]+'" width="39" height="52"alt="" /></a></div><div class="wz_04"><h2><a href="personal.do?method=UserfinalPage&&userId='+users[0]+'" onclick = "visitorCount('+users[0]+','+visitor+');">'+users[1]+'</a></h2><p></p><div>'+users[3]+'</div></div></div>';
    			}
    		}
    		udiv.innerHTML=html;
        }
    }
}