function addfriend(aid,aicon,adn) {
	document.getElementById("vf_img").src = aicon;
	document.getElementById("vf_name").innerHTML = adn;
	document.getElementById("af_img").src = aicon;
	document.getElementById("af_name").innerHTML = adn;
	document.getElementById("af_confirm").innerHTML = adn;
	document.getElementById("fid").value = aid;
	addfriendpopup.show();
}

function viewstuff2(aid) {
  var friendContent = {};
  friendContent["aid"] = aid+'';
	dojo.xhrPost({
 	  url:"/ic/action/viewfriendx.jsp",
    handleAs: "json",
   	content:	friendContent,
   	load: function(data, ioArgs) {
   			var a2dn = data.dname;
   			var a2icon = data.iurl;
   			document.getElementById("vf_img").src = a2icon;
   			document.getElementById("vf_name").innerHTML = a2dn;
   			document.getElementById("af_img").src = a2icon;
   			document.getElementById("af_name").innerHTML = a2dn;
   			document.getElementById("lf_img").src = a2icon;
   			document.getElementById("lf_name").innerHTML = a2dn;
   			document.getElementById("af_confirm").innerHTML = a2dn;
   			document.getElementById("fid").value = aid;
    		if (data.returnVal == "viewable") {
    			location.href='/ic/mystuff.jsp?u='+aid;
    		} else if (data.returnVal == "friendsonly") {
    			viewfriendpopup.show();
    		}	else {
    			fdlg.show();
    		}
    },
   	timeoutSeconds: 15,
		error: function(data){
		}
	});
 	return false;
}

function addfriendx() {
		addfriendpopup.hide();
		dojo.xhrPost({
  	  url:"/ic/action/addfriendx.jsp",
    	form:	"afx",
	    handleAs: "json",
    	load: function(data, ioArgs) { 
//    		alert(data.status);
    		var bReturn = data.status;
//    		if (status == "Success")
	    },
    	timeoutSeconds: 15,
			error: function(data){
			}
		});
  	return false;
}
var viewfriendpopup;
var addfriendpopup;
var fdlg;
function initaddfriend() {
	viewfriendpopup = dijit.byId("viewfriend");
	addfriendpopup = dijit.byId("addfriend");
	fdlg = dijit.byId("friendlogin");
}

dojo.addOnLoad(initaddfriend);
